Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OpenSSH with certificate user authentication #15183

Closed
AliveDevil opened this issue Oct 9, 2023 · 1 comment · Fixed by #15187 or #15254
Closed

Support OpenSSH with certificate user authentication #15183

AliveDevil opened this issue Oct 9, 2023 · 1 comment · Fixed by #15187 or #15254
Assignees
Labels
bug sftp SFTP Protocol Implementation
Milestone

Comments

@AliveDevil
Copy link
Contributor

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

@AliveDevil AliveDevil added bug sftp SFTP Protocol Implementation labels Oct 9, 2023
dkocher added a commit that referenced this issue Oct 10, 2023
@dkocher dkocher added this to the 8.7.0 milestone Oct 10, 2023
@dkocher dkocher linked a pull request Oct 10, 2023 that will close this issue
dkocher added a commit that referenced this issue Oct 23, 2023
This reverts commit d823292.
@dkocher
Copy link
Contributor

dkocher commented Oct 23, 2023

Reverted in 59e1843.

@dkocher dkocher reopened this Oct 23, 2023
@dkocher dkocher modified the milestones: 8.7.0, 8.7.1 Oct 23, 2023
dkocher added a commit that referenced this issue Oct 23, 2023
@dkocher dkocher linked a pull request Oct 23, 2023 that will close this issue
@dkocher dkocher reopened this Oct 25, 2023
dkocher added a commit that referenced this issue Oct 26, 2023
This reverts commit d823292.
@dkocher dkocher modified the milestones: 8.7.1, 8.7.2 Nov 3, 2023
@dkocher dkocher modified the milestones: 8.7.2, 8.7.3 Jan 10, 2024
@dkocher dkocher modified the milestones: 8.8.0, 8.8.1, 8.8.2 Mar 8, 2024
@dkocher dkocher modified the milestones: 8.8.2, 8.8.3 Apr 8, 2024
dkocher added a commit that referenced this issue Apr 29, 2024
dkocher added a commit that referenced this issue May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug sftp SFTP Protocol Implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants