From a0052fdb687f80ac07e67d7a0f39dcf3a66e32dd Mon Sep 17 00:00:00 2001 From: JD Friedrikson Date: Sat, 20 May 2017 16:17:04 -0400 Subject: [PATCH] Specify InsecureIgnoreHostKey for HostKeyCallback [A recent breaking change upstream in Golang's crypto library](https://github.com/golang/crypto/commit/e4e2799dd7aab89f583e1d898300d96367750991) has broken SSH connectivity for a few builders: ``` ==> qemu: Waiting for SSH to become available... 2017/05/20 16:23:58 ui: ==> qemu: Waiting for SSH to become available... 2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [INFO] Attempting SSH connection... 2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 reconnecting to TCP connection for SSH 2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshaking with SSH 2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshake error: ssh: must specify HostKeyCallback 2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback 2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [INFO] Attempting SSH connection... 2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 reconnecting to TCP connection for SSH 2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshaking with SSH 2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshake error: ssh: must specify HostKeyCallback 2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback ``` Specifying HostKeyCallback as insecure should make things work again and would make sense for packer's use case. --- builder/hyperv/common/ssh.go | 5 +++-- builder/null/ssh.go | 1 + builder/oneandone/ssh.go | 5 +++-- builder/profitbricks/ssh.go | 5 +++-- builder/qemu/ssh.go | 5 +++-- builder/virtualbox/common/ssh.go | 5 +++-- builder/vmware/common/ssh.go | 5 +++-- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/builder/hyperv/common/ssh.go b/builder/hyperv/common/ssh.go index 50db23ac2..182d154ff 100644 --- a/builder/hyperv/common/ssh.go +++ b/builder/hyperv/common/ssh.go @@ -42,8 +42,9 @@ func SSHConfigFunc(config *SSHConfig) func(multistep.StateBag) (*gossh.ClientCon } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } } diff --git a/builder/null/ssh.go b/builder/null/ssh.go index 3c31df5cc..7af2b55d7 100644 --- a/builder/null/ssh.go +++ b/builder/null/ssh.go @@ -50,6 +50,7 @@ func SSHConfig(username string, password string, privateKeyFile string) func(mul gossh.KeyboardInteractive( ssh.PasswordKeyboardInteractive(password)), }, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } } diff --git a/builder/oneandone/ssh.go b/builder/oneandone/ssh.go index 8f1856a8e..33fe0cc01 100644 --- a/builder/oneandone/ssh.go +++ b/builder/oneandone/ssh.go @@ -41,7 +41,8 @@ func sshConfig(state multistep.StateBag) (*gossh.ClientConfig, error) { auth = append(auth, gossh.PublicKeys(signer)) } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } diff --git a/builder/profitbricks/ssh.go b/builder/profitbricks/ssh.go index 7069a77ba..a40959cc7 100644 --- a/builder/profitbricks/ssh.go +++ b/builder/profitbricks/ssh.go @@ -41,7 +41,8 @@ func sshConfig(state multistep.StateBag) (*gossh.ClientConfig, error) { auth = append(auth, gossh.PublicKeys(signer)) } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } diff --git a/builder/qemu/ssh.go b/builder/qemu/ssh.go index 83c923f67..1881613fd 100644 --- a/builder/qemu/ssh.go +++ b/builder/qemu/ssh.go @@ -35,7 +35,8 @@ func sshConfig(state multistep.StateBag) (*gossh.ClientConfig, error) { } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } diff --git a/builder/virtualbox/common/ssh.go b/builder/virtualbox/common/ssh.go index 5316a1c31..b09c0cc47 100644 --- a/builder/virtualbox/common/ssh.go +++ b/builder/virtualbox/common/ssh.go @@ -36,8 +36,9 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConf } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } } diff --git a/builder/vmware/common/ssh.go b/builder/vmware/common/ssh.go index c03a4e2df..0d94599f8 100644 --- a/builder/vmware/common/ssh.go +++ b/builder/vmware/common/ssh.go @@ -84,8 +84,9 @@ func SSHConfigFunc(config *SSHConfig) func(multistep.StateBag) (*gossh.ClientCon } return &gossh.ClientConfig{ - User: config.Comm.SSHUsername, - Auth: auth, + User: config.Comm.SSHUsername, + Auth: auth, + HostKeyCallback: gossh.InsecureIgnoreHostKey(), }, nil } }