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:
  • Please share the output of ssh -vv root@serverip(verbose output). And do you actually have an SSH client configuration to use the ~/.ssh/id_rsa_dropbear key for that host? Because I think it just tries to use the ~/.ssh/id_rsa key which the verbose output can clarify. And besides, an SSH server doesn't know about encrypted client keys. It's the client or agent to decrypt the keys and perform the cryptographic action (challenge/response), ie. the private key itself doesn't get sent to the server. – gertvdijk May 6 '15 at 15:41
  • Also, very important: did you take account for the conversion of Dropbear vs. OpenSSH key format? They use a different public key representation. – gertvdijk May 6 '15 at 15:43
  • Yes, I have a config file on the client to use id_rsa_dropbear when connecting to this specific host. I have updated the original post to include the output of ssh -vv root@serverip as you requested. – Pete Buonomo May 6 '15 at 17:30
  • read_keyfile_line: /home/Pete/.ssh/id_rsa_dropbear line 3 exceeds size limit worries me. However, it appears to be recognised somehow. But later on you appear to supply the wrong passphrase to decrypt the apparently encrypted key (incorrect passphrase supplied to decrypt private key). Please include in your question how you converted the private key. It appears not to be performed the right way. OpenSSH client now disregards this key to authenticate with because it doesn't show the line I expect to be there: Offering RSA public key: .... – gertvdijk May 6 '15 at 23:43
  • I didn't convert the private key myself, I read that dropbear converts the private key automaticall upon install. – Pete Buonomo May 7 '15 at 0:39

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.

  • I'm having the same problems right now to the point. It's very strange. – con-f-use Jun 25 '15 at 10:50

I just ran into the same issue. What had happened is that the key was stored in the old format:

cat /etc/ssh/ssh_host_rsa_key
SSH PRIVATE KEY FILE FORMAT 1.1
<encoded private key here>

However the newer sshd is expecting the newer base64 encoded keys.

cat /etc/ssh/ssh_host_rsa_key
-----BEGIN RSA PRIVATE KEY-----
<base64 encoding here>
-----END RSA PRIVATE KEY-----

There's probably a way to copy the private and public key numbers out, and reformat into base64. However the easiest option would be to regenerate the keys using the latest ssh-keygen

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.