Skip to content

Support OpenSSH with certificate user authentication #15183

@AliveDevil

Description

@AliveDevil

Feature 8.0 mentions support for SSH certificates due to support in SSHJ (v0.32.0), but requires setup to work properly.
In 8.0 Public Key Authentication is used as

provider.init(new InputStreamReader(identity.getInputStream(), StandardCharsets.UTF_8), new PasswordFinder() {

We'd need to forward the absolute file path to SSHJ in order to get SSH certificates to work properly, like:

public static File getPublicKeyFile(File privateKeyFile) {
    File pubKey = new File(privateKeyFile + "-cert.pub");
    if (!pubKey.exists()) {
        pubKey = new File(privateKeyFile + ".pub");
    }
    if (pubKey.exists()) {
        return pubKey;
    }
    return null;
}

https://github.com/hierynomus/sshj/blob/ff4a4774bd1e3d45e9e796c2b17ef835e7e6d67f/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java#L32-L41

or, based on contract, call initPublicKey after init:

https://github.com/hierynomus/sshj/blob/ff4a4774bd1e3d45e9e796c2b17ef835e7e6d67f/src/main/java/net/schmizz/sshj/userauth/keyprovider/OpenSSHKeyFile.java#L88-L92

Metadata

Metadata

Assignees

Labels

sftpSFTP Protocol Implementation

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions