forked from rpms/openssh
8b8c4dc83c
(#193184) - call setkeycreatecon when selinux context is established - test for NULL privk when freeing key (#391871) - patch by Pierre Ossman
67 lines
1.5 KiB
Diff
67 lines
1.5 KiB
Diff
--- 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
|
|
@@ -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: "
|
|
@@ -99,12 +101,14 @@
|
|
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
|
|
|
|
- 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
|
|
@@ -112,17 +116,30 @@
|
|
|
|
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
|
|
}
|