Debian, missing SSH key


There is a low priority Debian bug (still there in Jessie) which results in log messages like this:

May 08 18:12:37 vps sshd[13405]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
May 08 18:11:34 vps sshd[13403]: Received disconnect from x.x.x.x: 11:  [preauth]

These are a typical result of the server being probed and they can safely be ignored.
But, the tidy minded amongst us do not like errors in log files.

To create the missing key:

# grep HostKey sshd_config
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# ls -l ssh_host*
-rw------- 1 root root    668 Apr 19 17:57 ssh_host_dsa_key
-rw-r--r-- 1 root root    603 Apr 19 17:57 ssh_host_dsa_key.pub
-rw------- 1 root root    227 Apr 19 17:57 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    175 Apr 19 17:57 ssh_host_ecdsa_key.pub
-rw------- 1 root root   1679 Apr 19 17:57 ssh_host_rsa_key
-rw-r--r-- 1 root root    395 Apr 19 17:57 ssh_host_rsa_key.pub

# ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_ed25519_key.
Your public key has been saved in /etc/ssh/ssh_host_ed25519_key.pub.
<rest of output snipped>

# systemctl restart sshd

Solved, people still probing server but no more irritating errors:

May 08 18:22:14 vps sshd[13454]: Received disconnect from x.x.x.x: 11:  [preauth]
May 08 18:19:38 vps sshd[13452]: Received disconnect from x2.x2.x2.x2: 11:  [preauth]
Comment on this article using form below. Requires email login only for authentication. HTML forbidden, Markdown only.