File: 70-install-ssh

package info (click to toggle)
xen-tools 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,568 kB
  • ctags: 172
  • sloc: perl: 5,082; sh: 2,092; makefile: 239
file content (63 lines) | stat: -rwxr-xr-x 1,251 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/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

#
# Log our finish
#
logMessage Script $0 finished