From the project
Security update regenerates stale SSH ECDSA host key
Peter Lieven from KAMP.de discovered a problem with TurnKey 13.0 where the OpenSSH ECDSA key is not regenerated on firstboot like the RSA and DSA host keys.
We've issued a signed hotpatch to TurnKey Core 13.0 that regenerates the ECDSA SSH host key. TurnKey deployments that have not disabled automatic security updates (it's on by default) will have their ECDSA SSH host key regenerated automatically within the next 24 hours.
If you don't want to wait for cron-apt to install the security update you can install the hotpatch immediately by executing this command as root:
install-security-updates
If you've turned off security updates you can regenerate the ECDSA SSH host key by executing the following command in a root shell:
rm -f /etc/ssh/ssh_host_ecdsa_key* dpkg-reconfigure openssh-server
Which is essentially what the hotpatch does.
Warning: Remote host identification has changed
If you're using an SSH client that supports ECDSA then after regenerating the ECDSA host key you may get the following error message when trying to login to your server:
~$ ssh my-turnkey-app.net @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is 54:e9:46:79:f3:ff:5c:97:88:79:55:3c:80:af:39:a0. Please contact your system administrator. Add correct host key in /home/liraz/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home/liraz/.ssh/known_hosts:1506 ECDSA host key for my-turnkey-app.net has changed and you have requested strict checking. Host key verification failed.
Getting rid of this error is simple:
ssh-keygen -R my-turnkey-app.net
This removes all keys belonging to hostname from your $HOME/.ssh/known_hosts file.
Why was this update necessary?
The SSH host key is supposed to be secret. If a stale key is leftover from the build process then that makes active MITM attacks possible under certain conditions.
SSH host keys are the login shell equivalent of SSL certificates. They allow you to know that you are connecting to your server and not to some other server that is performing a man in the middle attack against your SSH session.
The ramification of this is limited by the fact that your SSH client needs to support ECDSA and be configured to default to that. Even if that is the case an attacker couldn't have used this to passively eavsedrop on your SSH connections. Rerouting network traffic in an active man in the middle attack would have been required to take advantage of this. Passively eavsedropping on the connection would not be enough to break the encryption because unique encryption keys are used for every session.
Does my SSH client support ECDSA?
Only users using SSH clients that supported ECDSA and are configured to default to that over RSA or DSA could have been effected by this.
OpenSSH gained ECDSA support since version 5.7. At the time of writing, Windows SSH clients such as Putty and WinSCP still don't have ECDSA support. Newer versions of Tera Term do support ECDSA however.
Should I do anything else?
If you used an SSH client that defaults to ECDSA and also use password based authentication with SSH you may want to consider changing your passwords, assuming you are worried about the type of attacker that has the capability to reroute network traffic and that would target your SSH sessions for an active man in the middle attack.
How did this happen?
Support for ECDSA keys was new to Debian Wheezy. The script that runs on firstboot only regenerated RSA and DSA keys. It was too specific. To prevent this from happening again I committed a fix to make SSH key regeneration more generic.
I've also added to our release checklist to go over the changelogs of the major packages that go into Core more carefully to try and spot any changes that could have security ramifications.
Many thanks again to Peter Lieven from KAMP.de for discovering this and reporting it.
John, the mismatch between the key and the hostname is also potentially unsafe because the hostname may have changed since the ecdsa was created.
I think the best we can do is to match variations of tkldev and fab-dev in the offending key.