Subversion Repositories lsh

Compare Revisions

Ignore whitespace Rev 60 → Rev 61

/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)