Subversion Repositories lsh

Compare Revisions

Ignore whitespace Rev 51 → Rev 52

/branches/experimental/debian/changelog
22,8 → 22,16
* Add ANNOUNCE and ChangeLog.2 to lsh-doc.
* Drop the no longer useful lsh-server-config script.
* Drop obsolete manpages from debian/mans.
* Rewrite lsh-server.init.d a bit:
* Use LSB logging functions.
* Let lshd daemonize and create/delete its pid file by itself.
* Change the Provides: line in the LSB header to "lsh-server" and
declare that it should start before the services that depend on an
SSH server (Closes: #542689). Thanks to Petter Reinholdtsen.
* Support the status action.
* Update path to sftp-server and don't run lsh-write-key.
 
-- Magnus Holmgren <holmgren@debian.org> Sat, 29 Aug 2009 19:01:21 +0200
-- Magnus Holmgren <holmgren@debian.org> Sat, 05 Sep 2009 02:51:19 +0200
 
lsh-utils (2.0.4-dfsg-2) unstable; urgency=low
 
/branches/experimental/debian/lsh-server.init.d
3,12 → 3,14
# lsh-utils Start/stop secure shell server.
# Written by Timshel Knoll <timshel@debian.org>
# Updated by Stefan Pfetzing <dreamind@dreamind.de>
#
# Updated by Magnus Holmgren <magnus@debian.org>
 
### BEGIN INIT INFO
# Provides: sshd
# Provides: lsh-server
# Required-Start: $local_fs $remote_fs $syslog $named $network
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# X-Start-Before: cman drbd smokeping vz
# X-Stop-After: cman drbd smokeping vz
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: lsh secure shell server
19,6 → 21,7
NAME=lshd
DESC="secure shell v2 server"
CONFIG=/etc/default/lsh-server
PIDFILE=/var/run/$NAME.pid
 
RANDOM_SEED="/var/spool/lsh/yarrow-seed-file"
HOST_KEY="/etc/lsh_host_key"
25,8 → 28,10
 
test -f $DAEMON || exit 0
 
set -e
. /lib/lsb/init-functions
 
set +e
 
if [ -r "$CONFIG" ]; then
. "$CONFIG"
fi
37,7 → 42,7
 
case "$ENABLE_SFTP" in
true|y*|Y*)
SFTP_FLAG="--subsystems sftp=/usr/lib/lsh-server/sftp-server"
SFTP_FLAG="--subsystems sftp=/usr/lib/lsh/sftp-server"
;;
*)
SFTP_FLAG=""
44,77 → 49,67
;;
esac
 
if [ "$1" != "stop" -a "$1" != "graceful-stop" ]; then
create_seed_and_key() {
if [ ! -f "$RANDOM_SEED" ]; then
echo -n "Creating lsh random seed file (this only needs to be done once): $RANDOM_SEED"
log_action_begin_msg "Creating lsh random seed file (this only needs to be done once)"
DIR=$(dirname "$RANDOM_SEED")
mkdir -p "$DIR"
chmod 700 "$DIR"
dd if=/dev/random "of=$RANDOM_SEED" bs=1 count=32 2>/dev/null
chmod 600 "$RANDOM_SEED"
echo "."
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
echo -n "Creating lsh host key (this only needs to be done once): $HOST_KEY"
lsh-keygen --server | \
lsh-writekey --server --output-file "$HOST_KEY"
log_action_begin_msg "Creating lsh host key (this only needs to be done once)"
lsh-keygen --server --output-file "$HOST_KEY"
 
if [ ! -f "$HOST_KEY" ]; then
echo " failed! not starting lshd"
exit 0
log_action_end_msg 1
exit 1
fi
echo "."
log_action_end_msg 0
fi
fi
}
 
 
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--background --make-pidfile --exec $DAEMON -- \
--port "$LSHD_PORT" $SFTP_FLAG
echo "."
create_seed_and_key
[ "$VERBOSE" = no ] || log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON \
-- --daemonic --port "$LSHD_PORT" $SFTP_FLAG
ret=$?
[ "$VERBOSE" = no ] || log_end_msg $ret
;;
stop|graceful-stop)
echo -n "Gracefully stopping $DESC: $NAME"
[ "$VERBOSE" = no ] || log_daemon_msg "Gracefully stopping $DESC" "$NAME"
# Signal 1 causes the "old" lsh to close up shop on its port, but
# keeps running until all active connections have been closed
start-stop-daemon --stop --signal 1 --quiet --pidfile \
/var/run/$NAME.pid --oknodo --exec $DAEMON
# Remove the old pid file, the server will exit when ready
rm -f /var/run/$NAME.pid
echo "."
start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \
--oknodo --exec $DAEMON
ret=$?
[ "$VERBOSE" = no ] || log_end_msg $ret
;;
#reload)
# Signal 1 causes the "old" lsh to close up shop on its port, but
# keeps running until all active connections have been closed
#echo -n "Reloading $DESC configuration files."
#start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
#;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --signal 1 --quiet --pidfile \
/var/run/$NAME.pid --oknodo --exec $DAEMON
# Remove the old pid file, the old server will exit when ready
rm -f /var/run/$NAME.pid
sleep 1
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--background --make-pidfile --exec $DAEMON -- \
--port "$LSHD_PORT" $SFTP_FLAG
echo "."
create_seed_and_key
[ "$VERBOSE" = no ] || log_daemon_msg "Restarting $DESC" "$NAME"
start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \
--oknodo --exec $DAEMON &&
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
-- --daemonic --port "$LSHD_PORT" $SFTP_FLAG
ret=$?
[ "$VERBOSE" = no ] || log_end_msg $ret
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/lsh-utils {start|stop|restart|force-reload}" >&2
exit 1
exit 3
;;
esac
 
exit 0