Subversion Repositories lsh

Compare Revisions

Ignore whitespace Rev 60 → Rev 61

/trunk/debian/changelog
7,8 → 7,10
lsh-writekey and lsh-decode-key.
* lsh-server: Depend on openssh-blacklist, recommend -blacklist-extra.
lsh-utils: Recommend openssh-blacklist and -blacklist-extra.
* Move seed and key creation back to postinst and import RSA key from
openssh-server if it exists (Closes: #211252).
 
-- Magnus Holmgren <holmgren@debian.org> Sat, 07 Nov 2009 23:08:23 +0100
-- Magnus Holmgren <holmgren@debian.org> Sat, 07 Nov 2009 23:21:52 +0100
 
lsh-utils (2.0.4-dfsg-4) unstable; urgency=high
 
/trunk/debian/lsh-server.postinst
23,7 → 23,46
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
 
create_seed_and_key() {
RANDOM_SEED="/var/spool/lsh/yarrow-seed-file"
HOST_KEY="/etc/lsh_host_key"
OPENSSH_HOST_KEY="/etc/ssh/ssh_host_rsa_key"
 
if [ ! -f "$RANDOM_SEED" ]; then
echo -n "Creating lsh random seed file (this may take a while) ..."
DIR=$(dirname "$RANDOM_SEED")
if install -d -m 700 "$DIR" &&
dd if=/dev/random "of=$RANDOM_SEED" bs=1 count=32 2>/dev/null &&
chmod 600 "$RANDOM_SEED"; then
echo " done."
else
echo " failed!"
return 1
fi
fi
 
if [ ! -f "$HOST_KEY" ]; then
if [ -r "$OPENSSH_HOST_KEY" ]; then
echo -n "Converting existing OpenSSH RSA host key ... "
if pkcs1-conv < "$OPENSSH_HOST_KEY" | lsh-writekey --server &&
[ -f "$HOST_KEY" ]; then
echo -n "done."
return 0
fi
echo "failed. Will generate a new key instead."
fi
echo -n "Creating lsh host key ... "
if lsh-keygen --server | lsh-writekey --server &&
[ -f "$HOST_KEY" ]; then
echo " done."
else
echo " failed!"
return 1
fi
fi
return 0
}
 
LSHD_DEFAULTS=/etc/default/lsh-server
 
case "$1" in
93,6 → 132,8
EOF
fi
fi
 
create_seed_and_key
;;
 
abort-upgrade|abort-remove|abort-deconfigure)
/trunk/debian/lsh-server.init.d
49,37 → 49,8
;;
esac
 
create_seed_and_key() {
if [ ! -f "$RANDOM_SEED" ]; then
log_action_begin_msg "Creating lsh random seed file (this only needs to be done once)"
DIR=$(dirname "$RANDOM_SEED")
if install -d -m 700 "$DIR" &&
dd if=/dev/random "of=$RANDOM_SEED" bs=1 count=32 2>/dev/null &&
chmod 600 "$RANDOM_SEED"; then
log_action_end_msg 0
else
log_action_end_msg 1
exit 1
fi
fi
 
if [ ! -f "$HOST_KEY" ]; then
log_action_begin_msg "Creating lsh host key (this only needs to be done once)"
lsh-keygen --server | lsh-writekey --server --output-file "$HOST_KEY"
 
if [ ! -f "$HOST_KEY" ]; then
log_action_end_msg 1
exit 1
fi
log_action_end_msg 0
fi
}
 
 
case "$1" in
start)
create_seed_and_key
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON \
-- --daemonic --port "$LSHD_PORT" $SFTP_FLAG
94,7 → 65,6
log_end_msg $?
;;
restart|force-reload)
create_seed_and_key
log_daemon_msg "Restarting $DESC" "$NAME"
start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \
--oknodo --exec $DAEMON &&