SSH: Could not load host key: /etc/ssh/ssh_host_ed25519_key

Автор: | 13/02/2016
 

ssh_logoПосле запуска нового EC2 инстанса с Debian 8 – в /var/log/auth.log стали появлятся ошибки такого вида:

...
Feb 13 08:17:18 ip-172-31-24-203 sshd[882]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Feb 13 08:17:18 ip-172-31-24-203 sshd[882]: Connection closed by 176.37.186.107 [preauth]
...

Проверяем наличие самого файла:

# file /etc/ssh/ssh_host_ed25519_key
/etc/ssh/ssh_host_ed25519_key: cannot open `/etc/ssh/ssh_host_ed25519_key' (No such file or directory)

Про саму систему цифровой подписи Ed25519 можно почитать тут>>>.

Проверяем настройки демона SSH:

# cat /etc/ssh/sshd_config | grep ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_ed25519_key

Из документации к sshd_config мы видим, что:


HostKey /etc/ssh/ssh_host_key
The option HostKey specifies the location containing the private host key.

А в документации к ssh-keygen – есть описание опции -A:

# man ssh-keygen
...
     -A      For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) for which host keys do not exist, generate the host keys with the default key file path, an empty passphrase, default bits for the key type, and default comment.  This is used by system
             administration scripts to generate new host keys.
...

Запускаем на AWS-инстансе генерирацию ключей:

# ssh-keygen -A
ssh-keygen: generating new host keys: RSA1 ED25519

Проверяем:

# file /etc/ssh/ssh_host_ed25519_key
/etc/ssh/ssh_host_ed25519_key: OpenSSH private key

Готово.

В целом – можно было просто закомментировать строку HostKey /etc/ssh/ssh_host_ed25519_key в файле /etc/ssh/sshd_config:

Protocol 2
# 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

С другой стороны – у Ed25519 есть ряд преимуществ.

Ссылки по теме

https://utcc.utoronto.ca

https://en.wikipedia.org

http://ed25519.cr.yp.to