projects
/
grml-etc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
08c6565
)
ssh init script: sync with Debian's 1:5.9p1-5 openssh-server package
author
Michael Prokop
<mika@grml.org>
Fri, 22 Jun 2012 21:18:05 +0000
(23:18 +0200)
committer
Michael Prokop
<mika@grml.org>
Fri, 22 Jun 2012 21:20:22 +0000
(23:20 +0200)
etc/init.d/ssh
patch
|
blob
|
history
diff --git
a/etc/init.d/ssh
b/etc/init.d/ssh
index
f302f21
..
f832b71
100755
(executable)
--- a/
etc/init.d/ssh
+++ b/
etc/init.d/ssh
@@
-5,12
+5,19
@@
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
-# Default-Stop:
+# Default-Stop:
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
-# Notice: this file has been adjusted by the Grml team so
-# the script supports key-generation for ssh
+# Notice: this file has been slightly adjusted by the
+# Grml team so the script supports key-generation
+
+# Configurable options:
+KEYGEN=/usr/bin/ssh-keygen
+RSA1_KEY=/etc/ssh/ssh_host_key
+RSA_KEY=/etc/ssh/ssh_host_rsa_key
+DSA_KEY=/etc/ssh/ssh_host_dsa_key
+ECDSA_KEY=/etc/ssh/ssh_host_ecdsa_key
set -e
set -e
@@
-31,13
+38,6
@@
if [ -n "$2" ]; then
SSHD_OPTS="$SSHD_OPTS $2"
fi
SSHD_OPTS="$SSHD_OPTS $2"
fi
-# Configurable options:
-KEYGEN=/usr/bin/ssh-keygen
-RSA1_KEY=/etc/ssh/ssh_host_key
-RSA_KEY=/etc/ssh/ssh_host_rsa_key
-DSA_KEY=/etc/ssh/ssh_host_dsa_key
-ECDSA_KEY=/etc/ssh/ssh_host_ecdsa_key
-
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
@@
-45,12
+45,12
@@
run_by_init() {
check_for_no_start() {
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
check_for_no_start() {
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
- if [ -e /etc/ssh/sshd_not_to_be_run ]; then
+ if [ -e /etc/ssh/sshd_not_to_be_run ]; then
if [ "$1" = log_end_msg ]; then
if [ "$1" = log_end_msg ]; then
- log_end_msg 0
+ log_end_msg 0
|| true
fi
if ! run_by_init; then
fi
if ! run_by_init; then
- log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
+ log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
|| true
fi
exit 0
fi
fi
exit 0
fi
@@
-62,7
+62,7
@@
check_dev_null() {
log_end_msg 1 || true
fi
if ! run_by_init; then
log_end_msg 1 || true
fi
if ! run_by_init; then
- log_action_msg "/dev/null is not a character device!"
+ log_action_msg "/dev/null is not a character device!"
|| true
fi
exit 1
fi
fi
exit 1
fi
@@
-113,19
+113,19
@@
case "$1" in
check_for_no_start
check_dev_null
generate_ssh_keys
check_for_no_start
check_dev_null
generate_ssh_keys
- log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
+ log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
|| true
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
- log_end_msg 0
+ log_end_msg 0
|| true
else
else
- log_end_msg 1
+ log_end_msg 1
|| true
fi
;;
stop)
fi
;;
stop)
- log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd"
+ log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd"
|| true
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
- log_end_msg 0
+ log_end_msg 0
|| true
else
else
- log_end_msg 1
+ log_end_msg 1
|| true
fi
;;
fi
;;
@@
-133,11
+133,11
@@
case "$1" in
check_for_no_start
check_config
generate_ssh_keys
check_for_no_start
check_config
generate_ssh_keys
- log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd"
+ log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd"
|| true
if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then
if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then
- log_end_msg 0
+ log_end_msg 0
|| true
else
else
- log_end_msg 1
+ log_end_msg 1
|| true
fi
;;
fi
;;
@@
-145,14
+145,14
@@
case "$1" in
check_privsep_dir
check_config
generate_ssh_keys
check_privsep_dir
check_config
generate_ssh_keys
- log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
+ log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
|| true
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
- log_end_msg 0
+ log_end_msg 0
|| true
else
else
- log_end_msg 1
+ log_end_msg 1
|| true
fi
;;
fi
;;
@@
-160,31
+160,29
@@
case "$1" in
check_privsep_dir
check_config
generate_ssh_keys
check_privsep_dir
check_config
generate_ssh_keys
- log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
- set +e
- start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid
- RET="$?"
- set -e
+ log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
+ RET=0
+ start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid || RET="$?"
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
- log_end_msg 0
+ log_end_msg 0
|| true
else
else
- log_end_msg 1
+ log_end_msg 1
|| true
fi
;;
1)
# daemon not running
fi
;;
1)
# daemon not running
- log_progress_msg "(not running)"
- log_end_msg 0
+ log_progress_msg "(not running)"
|| true
+ log_end_msg 0
|| true
;;
*)
# failed to stop
;;
*)
# failed to stop
- log_progress_msg "(failed to stop)"
- log_end_msg 1
+ log_progress_msg "(failed to stop)"
|| true
+ log_end_msg 1
|| true
;;
esac
;;
;;
esac
;;
@@
-194,10
+192,8
@@
case "$1" in
;;
*)
;;
*)
- log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}"
+ log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}"
|| true
exit 1
esac
exit 0
exit 1
esac
exit 0
-
-## END OF FILE #################################################################