Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 40 | Rev 62 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 40 Rev 61
Line 21... Line 21...
21
#     post-installation script, and should be protected with a conditional
21
#     post-installation script, and should be protected with a conditional
22
#     so that unnecessary prompting doesn't happen if a package's
22
#     so that unnecessary prompting doesn't happen if a package's
23
#     installation fails and the `postinst' is called with `abort-upgrade',
23
#     installation fails and the `postinst' is called with `abort-upgrade',
24
#     `abort-remove' or `abort-deconfigure'.
24
#     `abort-remove' or `abort-deconfigure'.
25
25
-
 
26
create_seed_and_key() {
-
 
27
    RANDOM_SEED="/var/spool/lsh/yarrow-seed-file"
-
 
28
    HOST_KEY="/etc/lsh_host_key"
-
 
29
    OPENSSH_HOST_KEY="/etc/ssh/ssh_host_rsa_key"
-
 
30
-
 
31
    if [ ! -f "$RANDOM_SEED" ]; then
-
 
32
	echo -n "Creating lsh random seed file (this may take a while) ..."
-
 
33
	DIR=$(dirname "$RANDOM_SEED")
-
 
34
	if install -d -m 700 "$DIR" &&
-
 
35
	    dd if=/dev/random "of=$RANDOM_SEED" bs=1 count=32 2>/dev/null &&
-
 
36
	    chmod 600 "$RANDOM_SEED"; then
-
 
37
	    echo " done."
-
 
38
	else
-
 
39
	    echo " failed!"
-
 
40
	    return 1
-
 
41
	fi
-
 
42
    fi
-
 
43
-
 
44
    if [ ! -f "$HOST_KEY" ]; then
-
 
45
	if [ -r "$OPENSSH_HOST_KEY" ]; then
-
 
46
	    echo -n "Converting existing OpenSSH RSA host key ... "
-
 
47
	    if pkcs1-conv < "$OPENSSH_HOST_KEY" | lsh-writekey --server &&
-
 
48
		[ -f "$HOST_KEY" ]; then
-
 
49
		echo -n "done."
-
 
50
		return 0
-
 
51
	    fi
-
 
52
	    echo "failed. Will generate a new key instead."
-
 
53
	fi
-
 
54
	echo -n "Creating lsh host key ... "
-
 
55
	if lsh-keygen --server | lsh-writekey --server &&
-
 
56
	    [ -f "$HOST_KEY" ]; then
-
 
57
	    echo " done."
-
 
58
	else
-
 
59
	    echo " failed!"
-
 
60
	    return 1
-
 
61
	fi
-
 
62
    fi
-
 
63
    return 0
-
 
64
}
26
65
27
LSHD_DEFAULTS=/etc/default/lsh-server
66
LSHD_DEFAULTS=/etc/default/lsh-server
28
67
29
case "$1" in
68
case "$1" in
30
    configure)
69
    configure)
Line 91... Line 130...
91
# Please don't remove this file unless you have first disabled lsh, and don't
130
# Please don't remove this file unless you have first disabled lsh, and don't
92
# change the first line ... otherwise lsh-server won't recognise it!!!
131
# change the first line ... otherwise lsh-server won't recognise it!!!
93
EOF
132
EOF
94
	    fi
133
	    fi
95
	fi
134
	fi
-
 
135
-
 
136
	create_seed_and_key
96
    ;;
137
    ;;
97
138
98
    abort-upgrade|abort-remove|abort-deconfigure)
139
    abort-upgrade|abort-remove|abort-deconfigure)
99
140
100
    ;;
141
    ;;