sonic-buildimage/files/sshd/host-ssh-keygen.sh
Guohan Lu 7f7a2a019e [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>
2018-08-11 21:38:33 +00:00

11 lines
427 B
Bash
Executable File

#!/bin/bash
[ -r /etc/ssh/ssh_host_rsa_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 dsa -N '' -f /etc/ssh/ssh_host_dsa_key
/usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key
/usr/bin/ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key
/usr/bin/ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key
}