fix(cli): use local ssh client for vm access#2442
Open
LopatinDmitr wants to merge 1 commit into
Open
Conversation
ab8e42b to
5969f19
Compare
57f6d8d to
6dd0b06
Compare
diafour
reviewed
Jun 10, 2026
9483c25 to
4aa6af8
Compare
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>
d065a23 to
4b60517
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
Drop the embedded Go SSH/SCP implementation and run the local
ssh/scpbinaries directly through a
ProxyCommand(thed8port-forward subcommand).Provide a uniform way to pass extra options to the local client and to run
a command on the VM.
Highlights of the user-facing surface:
--ssh-argsflag for the localssh/scpclient. Can be repeatedor given as a single value with space-separated options:
--separator for the command to execute on the VM (mirrors plainssh):-c/--commandremains supported as an equivalent to--.--known-hostsis mapped to OpenSSHUserKnownHostsFile;--identity-fileto
-i.--local-sshand--local-ssh-optsare kept as deprecated compatibilityflags (
--local-ssh-optsis the old name for--ssh-args).templates.MinimumArgswas added so commands can consume everythingafter
--.Why do we need it, and what problem does it solve?
The previous
virtctl-style command shipped its own native Go SSH/SCPclient, including terminal handling,
knownhostsparsing andstdiotunnel plumbing. Maintaining that implementation:
host key verification, compression, control master, etc.);
(
-L,-R,-D, jump hosts, custom config in~/.ssh/config,ProxyJump, etc.) without growing the wrapper with more flags;had to be ported to the embedded code.
Switching to the local
ssh/scpclient makes the CLI delegate to thetooling users (and CI) already have, with a much smaller surface in Go
code. The new
--ssh-argsdesign replaces the previous--ssh-opts/positional-tail approach, which was both verbose (each
-ohad to bewrapped in its own flag) and inconsistent with the standard
sshCLI.What is the expected result?
d8 ssh user@myvmopens an interactive SSH session throughd8 v port-forward --stdio=true(ProxyCommand).d8 ssh user@myvm -- 'cmd'runscmdon the VM and exits with itsstatus code;
d8 ssh user@myvm -c 'cmd'does the same.d8 ssh user@myvm --ssh-args='-o X -o Y'passes-o X -o Yto thelocal
ssh(split into separate argv entries by whitespace).d8 scp local user@myvm:remotecopies a file via localscp;scpflags can be supplied via the same
--ssh-argsflag.--local-ssh-optsflag still works and emits awarning pointing to
--ssh-args.Manual smoke test (13 cases covering
--ssh-argssingle/repeat/mixedforms,
--vs-c, deprecation warning, scp up- and download) was runagainst
vm-alpinein thetestnamespace.Checklist
Changelog entries