2007-08-09 18:33:41 +00:00
|
|
|
--- openssh-4.5p1/contrib/redhat/sshd.init.initscript 2006-04-22 13:26:08.000000000 +0200
|
|
|
|
+++ openssh-4.5p1/contrib/redhat/sshd.init 2007-07-25 18:26:50.000000000 +0200
|
2006-11-02 13:33:37 +00:00
|
|
|
@@ -29,6 +29,8 @@
|
|
|
|
DSA_KEY=/etc/ssh/ssh_host_dsa_key
|
|
|
|
PID_FILE=/var/run/sshd.pid
|
|
|
|
|
|
|
|
+runlevel=$(set -- $(runlevel); eval "echo \$$#" )
|
|
|
|
+
|
|
|
|
do_rsa1_keygen() {
|
|
|
|
if [ ! -s $RSA1_KEY ]; then
|
|
|
|
echo -n $"Generating SSH1 RSA host key: "
|
2007-08-09 18:33:41 +00:00
|
|
|
@@ -99,12 +101,16 @@
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
# Create keys if necessary
|
|
|
|
- do_rsa1_keygen
|
|
|
|
- do_rsa_keygen
|
|
|
|
- do_dsa_keygen
|
|
|
|
+ if [ "x${AUTOCREATE_SERVER_KEYS}" != xNO ]; then
|
|
|
|
+ do_rsa1_keygen
|
|
|
|
+ do_rsa_keygen
|
|
|
|
+ do_dsa_keygen
|
|
|
|
+ fi
|
2006-11-02 13:33:37 +00:00
|
|
|
+
|
|
|
|
+ cp -af /etc/localtime /var/empty/sshd/etc
|
|
|
|
|
|
|
|
- echo -n $"Starting $prog:"
|
|
|
|
- initlog -c "$SSHD $OPTIONS" && success || failure
|
|
|
|
+ echo -n $"Starting $prog: "
|
|
|
|
+ $SSHD $OPTIONS && success || failure
|
|
|
|
RETVAL=$?
|
|
|
|
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/sshd
|
|
|
|
echo
|
2007-08-09 18:33:41 +00:00
|
|
|
@@ -112,17 +118,30 @@
|
2006-11-02 13:33:37 +00:00
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
- echo -n $"Stopping $prog:"
|
|
|
|
- killproc $SSHD -TERM
|
|
|
|
+ echo -n $"Stopping $prog: "
|
|
|
|
+ if [ -n "`pidfileofproc $SSHD`" ] ; then
|
|
|
|
+ killproc $SSHD
|
|
|
|
+ else
|
|
|
|
+ failure $"Stopping $prog"
|
|
|
|
+ fi
|
|
|
|
RETVAL=$?
|
|
|
|
+ # if we are in halt or reboot runlevel kill all running sessions
|
|
|
|
+ # so the TCP connections are closed cleanly
|
|
|
|
+ if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
|
|
|
|
+ killall $prog 2>/dev/null
|
|
|
|
+ fi
|
|
|
|
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/sshd
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
reload()
|
|
|
|
{
|
|
|
|
- echo -n $"Reloading $prog:"
|
|
|
|
- killproc $SSHD -HUP
|
|
|
|
+ echo -n $"Reloading $prog: "
|
|
|
|
+ if [ -n "`pidfileofproc $SSHD`" ] ; then
|
|
|
|
+ killproc $SSHD -HUP
|
|
|
|
+ else
|
|
|
|
+ failure $"Reloading $prog"
|
|
|
|
+ fi
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
}
|