Ubuntu – Unable to ssh remote unlock encrypted ubuntu server 15.04 using dropbear/initramfs

encryptioninitramfsssh

So I'm trying to set up a brand new Ubuntu 15.04 headless server with full disk encryption and remote unlock capabilities. I've done this successfully on a raspberry pi running Raspbian-Wheezy, and another headless Ubuntu 14.04 server.

For both the successful attempts and this latest unsuccessful attempt I've been following the directions in this guide.

Install Dropbear/busybox:

sudo apt-get install busybox dropbear

Copy generated ssh keys to client:

sudo cp /etc/initramfs-tools/root/.ssh/id_rsa ~/id_rsa_dropbear
sudo scp ~/id_rsa_dropbear client@client:~/.ssh/id_rsa_dropbear

Since my client is a windows client running cygwin, change permissions on new key:

chgrp Users ~/.ssh/id_rsa_dropbear
chmod 600 ~/.ssh/id_rsa_dropbear

Dropbear automatically appends the public key to authorized_keys file on key generation. Created crypt_unlock.sh script as stated in above link, made executable:

sudo vi /etc/initramfs-tools/hooks/crypt_unlock.sh
sudo chmod +x /etc/initramfs-tools/hooks/crypt_unlock.sh

Update initramfs:

sudo initramfs-update -u

Reboot server, trying to SSH root@serverip asks for a key passphrase and then for the root user's password. There is no passphrase for this key, I thought dropbear doesn't support encrypted keys? What should happen is the key should be recognized and I should be at a busybox prompt, where I can type 'unlock' and then enter the encryption passphrase to unlock the root disk on the server.

I can enter the encryption passphrase locally (when server is directly connected to a keyboard/monitor) and the server will boot correctly. What I can't figure out is why dropbear isn't playing nice with the private key. I've even tried manually recreating the private/public keys using the directions in the cryptsetup readme multiple times. Dropbear is successfully starting with initramfs, it can be seen at the local passphrase prompt.

If anyone has any suggestions, it would be greatly appreciated. I'm really flustered as like I said, I've done this twice before with zero issues. I tried searching to see if it was possibly an issue with 15.04, but couldn't find anything.

EDIT:

Output of ssh -vv root@serverip:

    $ ssh -vv alphabot_dropbear
OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014
debug1: Reading configuration data /home/Pete/.ssh/config
debug1: /home/Pete/.ssh/config line 2: Applying options for alphabot_dropbear
debug1: Hostname has changed; re-reading configuration
debug1: Reading configuration data /home/Pete/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.82.125 [192.168.82.125] port 22.
debug1: Connection established.
debug1: read_keyfile_line: /home/Pete/.ssh/id_rsa_dropbear line 3 exceeds size limit
debug1: read_keyfile_line: /home/Pete/.ssh/id_rsa_dropbear line 3 exceeds size limit
debug1: key_load_public: No such file or directory
debug1: identity file /home/Pete/.ssh/id_rsa_dropbear type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Pete/.ssh/id_rsa_dropbear-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7
debug1: Remote protocol version 2.0, remote software version dropbear_2014.65
debug1: no match: dropbear_2014.65
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: 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,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: 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,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,kexguess2@matt.ucc.asn.au
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,3des-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc
debug2: kex_parse_kexinit: aes128-ctr,3des-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc
debug2: kex_parse_kexinit: hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: zlib,zlib@openssh.com,none
debug2: kex_parse_kexinit: zlib,zlib@openssh.com,none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-sha2-256
debug1: kex: server->client aes128-ctr hmac-sha2-256 none
debug2: mac_setup: setup hmac-sha2-256
debug1: kex: client->server aes128-ctr hmac-sha2-256 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA ea:e6:df:5a:82:d6:db:20:3e:c9:5b:93:ad:f5:3b:3a
debug1: Host '192.168.82.125' is known and matches the RSA host key.
debug1: Found key in /home/Pete/.ssh/known_hosts.initramfs:1
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/Pete/.ssh/id_rsa_dropbear (0x0), explicit
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/Pete/.ssh/id_rsa_dropbear
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
Enter passphrase for key '/home/Pete/.ssh/id_rsa_dropbear':
debug2: no passphrase given, try next key
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
root@192.168.82.125's password:

Best Answer

I'm really not sure what the problem was; I tried using a different known-working dropbear id_rsa key and that still didn't work. I ended up completely reinstalling a fresh 15.04, and following all the steps again and was able to remote unlock without issue.