aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-27 13:30:13 -0400
committerGitHub <noreply@github.com>2020-10-27 13:30:13 -0400
commitee29328abcc8f09f90dd6c0efa15f79728aeb46d (patch)
treeb517e155b868ccca00b8e02d976afb0876e03819 /pkg
parent95f3ec7b08c9115d50358086f6fa7e683c63a522 (diff)
parent6f6cf87f8f651e2c7efd40a4c9fc1a0acb3c49bb (diff)
downloadpodman-ee29328abcc8f09f90dd6c0efa15f79728aeb46d.tar.gz
podman-ee29328abcc8f09f90dd6c0efa15f79728aeb46d.tar.bz2
podman-ee29328abcc8f09f90dd6c0efa15f79728aeb46d.zip
Merge pull request #8141 from afbjorklund/podman-remote-host-port-master
Add support for host keys for non-22 ports
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bindings/connection.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go
index 3a7662c41..31435ae91 100644
--- a/pkg/bindings/connection.go
+++ b/pkg/bindings/connection.go
@@ -214,19 +214,23 @@ func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) (
authMethods = append(authMethods, ssh.Password(string(pass)))
}
+ port := _url.Port()
+ if port == "" {
+ port = "22"
+ }
+
callback := ssh.InsecureIgnoreHostKey()
if secure {
- key := terminal.HostKey(_url.Hostname())
+ host := _url.Hostname()
+ if port != "22" {
+ host = fmt.Sprintf("[%s]:%s", host, port)
+ }
+ key := terminal.HostKey(host)
if key != nil {
callback = ssh.FixedHostKey(key)
}
}
- port := _url.Port()
- if port == "" {
- port = "22"
- }
-
bastion, err := ssh.Dial("tcp",
net.JoinHostPort(_url.Hostname(), port),
&ssh.ClientConfig{