Add ecdsa cert-based auth via SSH Agent #1
+70
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Users of "Open Remote - SSH" have requested support for certificate-based authentication. This feature request is currently tracked in jeanp413/open-remote-ssh#95.
Currently "Open Remote - SSH" fails to authenticate to hosts that require certificate-based authentication. This is, primarily, because
ssh2does not implement certificate-based authentication.This issue is called out across multiple Github Issues and Pull Requests upstream, including, but not limited to:
Approach
Meta: This PR is (mostly) a clone of the one currently sitting upstream in mscdex#1440. I have cloned this here since "Open Remote - SSH" is built on top of this
ssh2fork.This code change adds additional key parsing logic that, when other methods fail, will attempt to parse the key as a certificate. During the authentication flow, these certificate key types are then mapped to the corresponding signature type.
On top of the original cert types, I added several non vendor-extension cert types called out in the internet draft: https://www.ietf.org/archive/id/draft-miller-ssh-cert-01.html.
Importantly, this only works via an SSH agent (more on that later). This lightweight implementation serves to unblock folks who otherwise would be unable to connect to their hosts. In order to make use of certificates only available on disk, more significant changes would need to be made to the library to prevent public keys from being overwritten by the library-generated keys (depending on what is available on the machine).
NB: This CR is targeted toward addressing common ecdsa keys.
User Experience
In order to connect to hosts requiring certificate-based authentication, users will need to add their certificate to their running ssh agent by running, for example
ssh-add. If the certificate expires, then they will need to re-add the certificate to their running agent.Testing
I tested these changes by linking them as a dependency to "Open Remote - SSH" and connecting to a host that requires (ECDSA) certificate-based authentication.
Follow-up steps
Relevant links: