Fixed ssh host keys not regenerating
When using the -p option, the ssh host keys would be deleted, but not regenerated, rendering ssh unusable. See issue #168
This commit is contained in:
parent
43f1a885cd
commit
0100952018
|
@ -316,7 +316,12 @@ if [[ $prep == true ]]; then
|
||||||
info "Syspreping: Removing logs, apt archives, dhcp leases and ssh hostkeys"
|
info "Syspreping: Removing logs, apt archives, dhcp leases and ssh hostkeys"
|
||||||
mountdir=$(mktemp -d)
|
mountdir=$(mktemp -d)
|
||||||
mount "$loopback" "$mountdir"
|
mount "$loopback" "$mountdir"
|
||||||
rm -rvf $mountdir/var/cache/apt/archives/* $mountdir/var/lib/dhcpcd5/* $mountdir/var/log/* $mountdir/var/tmp/* $mountdir/tmp/* $mountdir/etc/ssh/*_host_*
|
rm -rvf $mountdir/var/cache/apt/archives/* $mountdir/var/lib/dhcpcd5/* $mountdir/var/log/* $mountdir/var/tmp/* $mountdir/tmp/*
|
||||||
|
if [[ -f "$mountdir/lib/systemd/system/regenerate_ssh_host_keys.service" ]] && [[ -d "$mountdir/etc/systemd/system/multi-user.target.wants" ]]; then
|
||||||
|
ln -s $mountdir/lib/systemd/system/regenerate_ssh_host_keys.service $mountdir/etc/systemd/system/multi-user.target.wants/regenerate_ssh_host_keys.service
|
||||||
|
else
|
||||||
|
info "could not locate key regeneration service, skipping keygen"
|
||||||
|
fi
|
||||||
umount "$mountdir"
|
umount "$mountdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue