Merge pull request #8141 from afbjorklund/podman-remote-host-port-master

Add support for host keys for non-22 ports
This commit is contained in:
OpenShift Merge Robot
2020-10-27 13:30:13 -04:00
committed by GitHub

View File

@ -214,19 +214,23 @@ func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) (
authMethods = append(authMethods, ssh.Password(string(pass)))
}
callback := ssh.InsecureIgnoreHostKey()
if secure {
key := terminal.HostKey(_url.Hostname())
if key != nil {
callback = ssh.FixedHostKey(key)
}
}
port := _url.Port()
if port == "" {
port = "22"
}
callback := ssh.InsecureIgnoreHostKey()
if secure {
host := _url.Hostname()
if port != "22" {
host = fmt.Sprintf("[%s]:%s", host, port)
}
key := terminal.HostKey(host)
if key != nil {
callback = ssh.FixedHostKey(key)
}
}
bastion, err := ssh.Dial("tcp",
net.JoinHostPort(_url.Hostname(), port),
&ssh.ClientConfig{