aboutsummaryrefslogtreecommitdiff
path: root/kvmx-create
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-13 13:15:04 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-13 13:15:04 -0300
commit80d7be771c6e442e46c74bedb71207fdf6400fa6 (patch)
tree140a26bd2595abdf8fd777c309412c93a346b319 /kvmx-create
parentcbe2e6f3c4dd81879aaec84546e0b9f86d67c1d0 (diff)
downloadkvmx-80d7be771c6e442e46c74bedb71207fdf6400fa6.tar.gz
kvmx-80d7be771c6e442e46c74bedb71207fdf6400fa6.tar.bz2
Save host SSH key fingerprints on kvmx-create
Diffstat (limited to 'kvmx-create')
-rwxr-xr-xkvmx-create13
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"