Skip to content

Commit 1f6fec2

Browse files
committed
hostagent: Log ssh forwarding command
We log a message when forwarding to guest unix socket, but it is not clear from the log how this is implemented, and the code is confusing (using ssh forwarding when using GRPC forwarding). Let's make this more clear by logging the ssh forwarding command. Example logs: {"level":"debug","msg":"Forwarding unix sockets","time":"2025-07-06T15:59:43+03:00"} {"level":"info","msg":"Forwarding \"/run/user/501/podman/podman.sock\" (guest) to \"/Users/nir/.lima/podman/sock/podman.sock\" (host)","time":"2025-07-06T15:59:43+03:00"} {"level":"debug","msg":"Running \"/usr/bin/ssh -F /dev/null -o IdentityFile=\\\"/Users/nir/.lima/_config/user\\\" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o GSSAPIAuthentication=no -o Ciphers=\\\"^[email protected],[email protected]\\\" -o User=nir -o ControlMaster=auto -o ControlPath=\\\"/Users/nir/.lima/podman/ssh.sock\\\" -o ControlPersist=yes -T -O forward -L /Users/nir/.lima/podman/sock/podman.sock:/run/user/501/podman/podman.sock -N -f -p 53505 127.0.0.1 --\"","time":"2025-07-06T15:59:43+03:00"} Signed-off-by: Nir Soffer <[email protected]>
1 parent e05d782 commit 1f6fec2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/hostagent/hostagent.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ func forwardSSH(ctx context.Context, sshConfig *ssh.SSHConfig, port int, local,
758758
}
759759
}
760760
cmd := exec.CommandContext(ctx, sshConfig.Binary(), args...)
761+
logrus.Debugf("Running %q", cmd)
761762
if out, err := cmd.Output(); err != nil {
762763
if verb == verbForward && strings.HasPrefix(local, "/") {
763764
if reverse {

0 commit comments

Comments
 (0)