From 9ab0622886ac7af9518d5ffebed2c1e6cf0fc212 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Sun, 2 Apr 2017 14:01:30 +0900 Subject: [PATCH] Fix SSH dial error (#413) Error message: [Apr 2 13:36:49] DEBUG [localhost] Failed to Dial to u16, err: ssh: must specify HostKeyCallback, Retrying in 552.330144ms... It is caused by breaking changes of Go library. https://go-review.googlesource.com/c/38701/ --- scan/executil.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scan/executil.go b/scan/executil.go index 976b780c..232617d4 100644 --- a/scan/executil.go +++ b/scan/executil.go @@ -364,8 +364,9 @@ func getAgentAuth() (auth ssh.AuthMethod, ok bool) { func tryAgentConnect(c conf.ServerInfo) *ssh.Client { if auth, ok := getAgentAuth(); ok { config := &ssh.ClientConfig{ - User: c.User, - Auth: []ssh.AuthMethod{auth}, + User: c.User, + Auth: []ssh.AuthMethod{auth}, + HostKeyCallback: ssh.InsecureIgnoreHostKey(), } client, _ := ssh.Dial("tcp", c.Host+":"+c.Port, config) return client @@ -385,8 +386,9 @@ func sshConnect(c conf.ServerInfo) (client *ssh.Client, err error) { // http://blog.ralch.com/tutorial/golang-ssh-connection/ config := &ssh.ClientConfig{ - User: c.User, - Auth: auths, + User: c.User, + Auth: auths, + HostKeyCallback: ssh.InsecureIgnoreHostKey(), } notifyFunc := func(e error, t time.Duration) {