nanobox-io/nanobox

Nanobox-machine fails on win redstone or win10 with native SSH

baybal opened this issue · 4 comments

(nanobox) DBG | Checking vm logs: C:\Users\ASUS.docker\machine\machines\nanobox\nanobox\Logs\VBox.log
(nanobox) DBG | Getting to WaitForSSH function...
(nanobox) DBG | Using SSH client type: external
(nanobox) DBG | &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i C:\Users\ASUS.docker\machine\machines\nanobox\id_rsa -p 50748] C:\WINDOWS\System32\OpenSSH\ssh.exe }
(nanobox) DBG | About to run SSH command:
(nanobox) DBG | exit 0
(nanobox) DBG | SSH cmd err, output: exit status 255:
(nanobox) DBG | Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
(nanobox) DBG | command : exit 0
(nanobox) DBG | err : exit status 255
(nanobox) DBG | output :
(nanobox) DBG |
(nanobox) DBG | Getting to WaitForSSH function...

Recent Windows versions come with native OpenSSH builds. There is no /dev/null on Windows obviously.

An easy solution seemed to be to use --native-ssh option for docker machine (so it uses go stdlib internal ssh), but it seem to be defunct on the build being shipped with nanobox (it still tries to use external SSH even with that parameter passed to it)

System: Windows redstone internal preview December build.
VM: virtualbox 5.2.8

C:\WINDOWS\System32\OpenSSH\ssh.exe: Could not resolve hostname /dev/null: No such host is known.
PS C:\Users\ASUS\alpha-draft-communication-service> ssh -F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecki
ng=no -o UserKnownHostsFile=/dev/null -o LogLevel=verbose -vvv -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMa
ster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i C:\Users\ASUS.docker\machine\machines\nanobox\id_
rsa -p 50957
OpenSSH_7.5p1, without OpenSSL
debug1: Reading configuration data /dev/null
debug2: resolving "127.0.0.1" port 50957
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 50957.
debug3: socket:488, socktype:1, io:0000023462C54BE0, fd:3
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 10000 ms remain after connect
key_load_public: invalid format
debug1: identity file C:\Users\ASUS\.docker\machine\machines\nanobox\id_rsa type -1
debug3: Failed to open file:C:\Users\ASUS\.docker\machine\machines\nanobox\id_rsa-cert error:2
debug3: Failed to open file:C:\Users\ASUS\.docker\machine\machines\nanobox\id_rsa-cert.pub error:2
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\ASUS\.docker\machine\machines\nanobox\id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 127.0.0.1:50957 as 'docker'
debug3: put_host_port: [127.0.0.1]:50957
debug3: hostkeys_foreach: reading file "/dev/null"
debug3: Failed to open file:./ssh_known_hosts error:2
debug3: Failed to open file:./ssh_known_hosts2 error:2
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ext-info-c
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: (no match)
Unable to negotiate with 127.0.0.1 port 50957: no matching host key type found. Their offer: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256
PS C:\Users\ASUS\alpha-draft-communication-service>

The issue is with nanobox image not providing ec25519 host key

For now , there is a workaround: you need to compile openssh for windows by hand with RSA keys enabled at configure time, then replace the one that came from windows update with what you compiled.