containers / common

Location for shared common files in github.com/containers repos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ssh.Validate forces ssh connections to use socket paths which begin with /run

dfr opened this issue · comments

I have a FreeBSD machine, lab2, which is running podman system service with socket path /var/run/podman/podman.sock. On some other machine, if I try to add a connection without specifying the path everthing works fine since podman queries lab2 for its default path:

$ podman system connection add --identity ~/.ssh/podman-machine-default test ssh://root@lab2
$ podman system connection list
Name        URI                                            Identity                               Default
test        ssh://root@lab2:22/var/run/podman/podman.sock  /home/dfr/.ssh/podman-machine-default  true
$

If I specify the path explicitly, the /var/run prefix is silently replaced with /run:

$ podman system connection add --identity ~/.ssh/podman-machine-default --socket-path=/var/run/podman/podman.sock test ssh://root@lab2
$ podman system connection list
Name        URI                                        Identity                               Default
test        ssh://root@lab2:22/run/podman/podman.sock  /home/dfr/.ssh/podman-machine-default  true
$

This happens in github.com/containers/common/pkg/ssh.Validate which splits the input path ("ssh://root@lab2/var/run/podman/podman.sock") after the "/run" and then reconstructs the URI without the "/var" part.

Possibly this could just use the path which is parsed out of the input string via url.Parse?

SGTM
Want to open a PR?