[sshd]: regenerate ssh key if ssh_host_rsa_key is not present

ssh_host_key is removed in debian stretch. Use ssh_host_rsa_key
to decide if the host keys are present.

Signed-off-by: Guohan Lu <gulv@microsoft.com>
This commit is contained in:
Guohan Lu 2018-08-11 21:38:33 +00:00
parent 88ea503e63
commit 7f7a2a019e

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
[ -r /etc/ssh/ssh_host_key ] || { [ -r /etc/ssh/ssh_host_rsa_key ] || {
rm -f /etc/ssh/ssh_host_*_key* rm -f /etc/ssh/ssh_host_*_key*
/usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key /usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
/usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key /usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key