containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
24.02k stars 2.43k forks source link

Support for ssh common args when podman service connects to a destination #23703

Open bmenant opened 3 months ago

bmenant commented 3 months ago

Feature request description

On a Linux host, some Podman commands open ssh connections to remote machines, notably: podman_system_connection, podman_farm, podman_machine and podman_image_scp to name a few.

However, beside --identity and --port (and ssh-agent support), it is difficult to provide additional configuration to the ssh client on a per command/project basis.

It would be convenient if Podman connections supported additional ssh common arguments.

Suggest potential solution

Add a --ssh-args option to commands relying on ssh connections, and pass those to the underlying ssh client.

For example:

podman system connection add dev1 user@remote_host --ssh-args="-F $(pwd)/ssh_config"
podman image scp --ssh-args="-F $(pwd)/ssh_config" image1 user@remote_host::

Have you considered any alternatives?

Additional context

This is especially useful on a workstation with several projects having different ssh configuration files with specific directives (e.g. ProxyJump).

Ansible has a variable ansible_ssh_common_args for example. Podman lacks this feature.

Luap99 commented 3 months ago

We use the native golang ssh implementation and do not call the ssh binary for the remote connection so this is impossible at least for the normal ssh based remote API. I am not sure if scp or farm shell out to ssh but I don't think so.

I know we had some efforts to allow using the ssh binary directly as proxy but I am not sure if this was ever properly finished or is even working at all. It looks like it got a root level option at least --ssh=native vs --ssh=golang (default) so if that works then I could see the point in the feature request but if not than the ssh native mode would need to be fixed first before this could be considered.

bmenant commented 3 months ago

The global option --ssh=native is documented, but it looks like its implementation is incomplete:

$ podman --log-level=debug --ssh=native system connection add dev1 user@remote_host"
INFO[0000] podman filtering at log level debug          
Error: exit status 255
DEBU[0000] Shutting down engines
github-actions[bot] commented 2 months ago

A friendly reminder that this issue had no activity for 30 days.