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: [email protected],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: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],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-sha2[email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,[email protected]
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,[email protected],none
debug2: kex_parse_kexinit: zlib,[email protected],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
[email protected]'s password:
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.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: ...
.