fix(cli): use local ssh client for vm access#2442
Draft
LopatinDmitr wants to merge 1 commit into
Draft
Conversation
Use the local OpenSSH/SCP clients for VM access by default and remove the embedded native SSH/SCP implementation. Keep --local-ssh and --local-ssh-opts as deprecated compatibility flags, add --ssh-opts for extra client options, and map --known-hosts to OpenSSH UserKnownHostsFile. Signed-off-by: Dmitry Lopatin <dmitry.lopatin@flant.com>
ab8e42b to
5969f19
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Remove the embedded native SSH/SCP implementation from the virtualization CLI.
d8 v sshandd8 v scpnow always use the local OpenSSH/SCP clients throughd8 v port-forward --stdio=trueasProxyCommand.This change also:
--ssh-optsfor passing additional options to the local SSH/SCP client;--local-sshas a deprecated no-op compatibility flag;--local-ssh-optsas a deprecated alias for extra SSH/SCP client options;--identity-file/-idirectly to OpenSSH/SCP as-i;--known-hoststo OpenSSHUserKnownHostsFile;Why do we need it, and what problem does it solve?
The native SSH implementation does not fully match OpenSSH behavior.
One observed issue is authentication with an explicit identity file when
SSH_AUTH_SOCKis set. The native client tries ssh-agent first. If the agent key is rejected,golang.org/x/crypto/sshmarks thepublickeymethod as already tried and the explicitly provided--identity-filekey is skipped. As a result,d8 v ssh -i <key>may fall back to password authentication or fail completely, whiled8 v ssh --local-ssh -i <key>works.Using local OpenSSH/SCP as the only implementation makes authentication behavior consistent with users' expectations and supports local OpenSSH configuration, agent behavior, certificates, and client options.
What is the expected result?
d8 v ssh user@vm -i /path/to/keywhileSSH_AUTH_SOCKis set and contains unrelated keys.d8 v scp -i /path/to/key ./file user@vm:/tmp/fileand verify that SCP uses the same local-client path.--local-sshor--local-ssh-optsand verify that they still work and print deprecation warnings.d8 v ssh user@vm --known-hosts /path/to/known_hostsand verify that OpenSSH uses it asUserKnownHostsFile.Checklist
Changelog entries