SSH client with authentication by signed certificates does not work with SSH_AGENT
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.8k
- Forks
- 734
- PR merge metrics
- No merged PRs in 30d
Description
Connection from an SSH client with Signed User Key Certificates in SSH_AGENT are not correctly handled and Authenticantion of user Fails
PR #808 implements support for public keys and this works great to enable SSH CA signed certificates from and SSH client to an appropriately configure SSH server with a CA key installed and configured in sshd_config TrustedUserCAKeys.
This means that a Hasicorp Vault SSH CA signing process works well for SSH sessions using this SSH2 and SSH2_STREAMS (with PR https://github.com/mscdex/ssh2-streams/pull/137) when keys are declared in privateKey and publicKey parameters to connect as per example in #808 .
However Authentication Fails in the scenario of the users keys and signed certificate being added to SSH_AGENT with ssh_add <key> . It appears the https://github.com/mscdex/ssh2/blob/632073fdef53988b71109ff49d80c61fd0e0a8bd/lib/client.js#L520 function does not handle certificates appropriately, particularly the signed response from ssh_agent when a signed certificate public key is used
#808 has been waiting for approval for a long time. I have a work around for this SSH_AGENT issue that is dependent on #808. This workaround https://github.com/auphofBSF/ssh2/commit/74ec8630981d76d83769739e68191c9ca5bf344d is not complete for all types of certificates, it does hopever incorporate #808 and does work correctly for my use case of Hashicorp Vault CA signed keys.
I have added 2 more todo's to the existing todo with my interpretations of what may still be missing. It is not worthy of being a PR yet but is an immediate fix.
I don't like submitting something not fully complete but I am a Newbie to this wonderful world of PublicKey SSH Certificates and SSH Security so would hope someone with suitable experience would more confidently and robustly fill in the general cases and be able to make it into a useful PR to complement #808.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/client.js around the authentication logic at the referenced line, then compare the public-key support in PR #808 with the SSH_AGENT workaround commit. Trace how signed certificate keys and the signed response from ssh_agent are handled. Done means SSH clients using certificates stored in SSH_AGENT authenticate correctly beyond the reported Vault CA use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100