diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-29 06:31:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 06:31:20 -0400 |
commit | fdd32604cf75fc310afca209adad15b1bcecfef7 (patch) | |
tree | 9523aa76c5d110a747c03f1fc4c164ebba4c244c /pkg/terminal | |
parent | cce6c6cd40137c460f173300b36c5868383870c5 (diff) | |
parent | 83e54885ff6441eafff40627a7d89c9342521b27 (diff) | |
download | podman-fdd32604cf75fc310afca209adad15b1bcecfef7.tar.gz podman-fdd32604cf75fc310afca209adad15b1bcecfef7.tar.bz2 podman-fdd32604cf75fc310afca209adad15b1bcecfef7.zip |
Merge pull request #8161 from afbjorklund/podman-remote-host-hash
Support hashed hostnames in the known_hosts file
Diffstat (limited to 'pkg/terminal')
-rw-r--r-- | pkg/terminal/util.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/terminal/util.go b/pkg/terminal/util.go index ab3dc54e4..169bec2af 100644 --- a/pkg/terminal/util.go +++ b/pkg/terminal/util.go @@ -12,6 +12,7 @@ import ( "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh" + "golang.org/x/crypto/ssh/knownhosts" "golang.org/x/crypto/ssh/terminal" "k8s.io/client-go/util/homedir" ) @@ -114,6 +115,9 @@ func HostKey(host string) ssh.PublicKey { return nil } + // support -H parameter for ssh-keyscan + hashhost := knownhosts.HashHostname(host) + scanner := bufio.NewScanner(fd) for scanner.Scan() { _, hosts, key, _, _, err := ssh.ParseKnownHosts(scanner.Bytes()) @@ -123,7 +127,7 @@ func HostKey(host string) ssh.PublicKey { } for _, h := range hosts { - if h == host { + if h == host || h == hashhost { return key } } |