Commit 70fc8787 authored by Michael Büsch's avatar Michael Büsch

pilc: Call ssh-keygen directly to regenerate keys

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent b839c2d7
......@@ -4,13 +4,21 @@ export PATH=/bin:/usr/bin:/sbin:/usr/sbin
export LC_ALL=C LANGUAGE=C LANG=C
if [ "$1" = "SECOND_STAGE" ]; then
dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096
echo "Seeding /dev/urandom..."
dd if=/dev/hwrng of=/dev/urandom count=16 bs=1024
echo "Regenerating SSH keys..."
rm -f /etc/ssh/ssh_host_*_key*
if dpkg-reconfigure openssh-server; then
if ssh-keygen -A -v; then
echo "Starting SSH daemon..."
rm -f /etc/ssh/sshd_not_to_be_run
systemctl enable ssh
systemctl disable regenerate_ssh_host_keys
systemctl start ssh
echo "Disabling regeneration trigger..."
systemctl disable regenerate_ssh_host_keys
echo "Done."
else
echo "FAILED to regenerate SSH keys."
fi
else
nohup sh /etc/ssh/regenerate_ssh_host_keys.sh SECOND_STAGE >/var/log/regenerate_ssh_host_keys.log 2>&1 &
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment