diff options
-rwxr-xr-x | kvmx-create | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kvmx-create b/kvmx-create index 3071346..0982f4d 100755 --- a/kvmx-create +++ b/kvmx-create @@ -387,6 +387,16 @@ EOF # Fix hostname in keys kvmx_sudo_run sed -i -e "s/root@.*$/root@$hostname.$domain/" $WORK/etc/ssh/*.pub + # SSH dir + sshdir="`dirname $image`/ssh/" + mkdir -p $sshdir + + # Save host SSH key fingerprints + for key in $WORK/etc/ssh/*pub; do + ssh-keygen -l -f $key >> `basename $key`.sha256 + ssh-keygen -l -E md5 -f $key >> `basename $key`.md5 + done + # Sudo echo "Installing sudo..." $APT_INSTALL sudo -y @@ -402,9 +412,8 @@ EOF if [ "$ssh_support" == "y" ]; then if [ "$ssh_custom" == "y" ]; then - privkey="`dirname $image`/ssh/$hostname.key" + privkey="$sshdir/ssh/$hostname.key" pubkey="${privkey}.pub" - mkdir -p "`dirname $privkey`" __kvmx_ssh_keygen $privkey "$user@$hostname" else pubkey="$DIRNAME/share/ssh/insecure_private_key.pub" |