aboutsummaryrefslogtreecommitdiff
path: root/files/firstboot/21-generate-ssh-keys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'files/firstboot/21-generate-ssh-keys.sh')
-rw-r--r--files/firstboot/21-generate-ssh-keys.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/files/firstboot/21-generate-ssh-keys.sh b/files/firstboot/21-generate-ssh-keys.sh
index a6c567c..928ee2e 100644
--- a/files/firstboot/21-generate-ssh-keys.sh
+++ b/files/firstboot/21-generate-ssh-keys.sh
@@ -1,8 +1,20 @@
logger -t "rc.firstboot" "Generating SSH host keys"
-rm -f /etc/ssh/ssh_host_*
-ssh-keygen -q -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
-ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
-ssh-keygen -q -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key
-ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
-systemctl restart sshd
+if [ -d "/etc/ssh/" ] ; then
+ rm -f /etc/ssh/ssh_host_*
+ systemctl stop sshd
+ ssh-keygen -q -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
+ ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
+ ssh-keygen -q -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key
+ ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
+ systemctl start sshd
+fi
+
+if [ -d "/etc/dropbear/" ] ; then
+ rm -f /etc/dropbear/dropbear_*
+ systemctl stop dropbear
+ dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+ dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key
+ systemctl start dropbear
+fi