This will fix 70-install-ssh, allowing it complete postinst by generating host SSH keys for it. The resulting RSA host key fingerprint is printed in an Installation summary at the end of isntall. Next step is to apply the same change to the remaining 70-install-ssh's.
61 lines
1.2 KiB
Bash
Executable File
61 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script installs OpenSSH Server on the newly created guest.
|
|
#
|
|
# It does this by generating the keys within the host, since guests
|
|
# do not have the necessary /dev/random and /dev/urandom to generate
|
|
# their own keys before boot.
|
|
#
|
|
# Dmitry Nedospasov
|
|
# --
|
|
# http://nedos.net/
|
|
|
|
prefix=$1
|
|
|
|
#
|
|
# Source our common functions
|
|
#
|
|
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
|
. /usr/lib/xen-tools/common.sh
|
|
else
|
|
. ./hooks/common.sh
|
|
fi
|
|
|
|
#
|
|
# Log our start
|
|
#
|
|
logMessage Script $0 starting
|
|
|
|
#
|
|
# Since our guests doesn't have an RNG, generate the keys from the host
|
|
#
|
|
# First, create an ssh directory
|
|
#
|
|
mkdir -p ${prefix}/etc/ssh
|
|
|
|
#
|
|
# Second, Generate the Host RSA Key
|
|
#
|
|
if ssh-keygen -t rsa -N '' -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then
|
|
logMessage "successfully generetaged Host RSA"
|
|
else
|
|
logMessage "failed to generate Host RSA Key"
|
|
fi
|
|
|
|
#
|
|
# Third, Generate the Host DSA Key
|
|
#
|
|
if ssh-keygen -t dsa -N '' -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then
|
|
logMessage "successfully generetaged Host DSA"
|
|
else
|
|
logMessage "failed to generate Host DSA Key"
|
|
fi
|
|
|
|
#
|
|
# Install ssh
|
|
#
|
|
installDebianPackage ${prefix} openssh-server
|
|
|
|
logMessage Script $0 finished
|
|
|