run ssh-keygen from dtrfs (instead of template)

This commit is contained in:
ghe0 2025-01-28 23:49:17 +02:00
parent 60f1c8c2e2
commit b1fd8c355e
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4
2 changed files with 4 additions and 3 deletions

@ -21,6 +21,7 @@ install_binary $(which blkid)
install_binary $(which fdisk)
install_binary $(which sysctl)
install_binary $(which mkfs.ext4)
install_binary $(which ssh-keygen)
install_binary $(which fsarchiver)
install_kmod
install_busybox

@ -62,9 +62,9 @@ echo "=== Setting up guest hostname as $hostname"
echo "=== Generating SSH public keys"
echo "root:x:0:0:root:/root:/bin/sh" > /etc/passwd
[[ -f "/mnt/etc/ssh/ssh_host_rsa_key" ]] ||
/mnt/usr/bin/ssh-keygen -t rsa -f /mnt/etc/ssh/ssh_host_rsa_key -N '' > /dev/null
ssh-keygen -t rsa -f /mnt/etc/ssh/ssh_host_rsa_key -N '' > /dev/null
[[ -f "/mnt/etc/ssh/ssh_host_ecdsa_key" ]] ||
/mnt/usr/bin/ssh-keygen -t ecdsa -f /mnt/etc/ssh/ssh_host_ecdsa_key -N '' > /dev/null
ssh-keygen -t ecdsa -f /mnt/etc/ssh/ssh_host_ecdsa_key -N '' > /dev/null
[[ -f "/mnt/etc/ssh/ssh_host_ed25519_key" ]] ||
/mnt/usr/bin/ssh-keygen -t ed25519 -f /mnt/etc/ssh/ssh_host_ed25519_key -N '' > /dev/null
ssh-keygen -t ed25519 -f /mnt/etc/ssh/ssh_host_ed25519_key -N '' > /dev/null
echo "=== Done! Download keys from /server_pubkeys"