All hooks files which were identical in two groups (debianoid and redhatoid) have been moved to the new hooks/common directory and now have symbolic links to the according new files at their old locations.
68 lines
1.3 KiB
Bash
Executable File
68 lines
1.3 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 [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then
|
|
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
|
|
fi
|
|
|
|
#
|
|
# Third, Generate the Host DSA Key
|
|
#
|
|
if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then
|
|
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
|
|
fi
|
|
|
|
#
|
|
# Install ssh
|
|
#
|
|
installDebianPackage ${prefix} openssh-server
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|
|
|