diff options
Diffstat (limited to 'main/openssh/sshd.initd')
-rw-r--r-- | main/openssh/sshd.initd | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/main/openssh/sshd.initd b/main/openssh/sshd.initd index b56343472a8..477cdbc619f 100644 --- a/main/openssh/sshd.initd +++ b/main/openssh/sshd.initd @@ -49,6 +49,14 @@ generate_host_keys() { done } +get_conf() { + awk "/^$1/{ print \$2 }" "$cfgfile" 2>/dev/null +} + +conf_enabled() { + [ "$(get_conf "$1")" = "yes" ] +} + depend() { use logger dns after entropy @@ -58,7 +66,7 @@ depend() { else local x warn_addr # shellcheck disable=SC2013 - for x in $(awk '/^ListenAddress/{ print $2 }' "$cfgfile" 2>/dev/null) ; do + for x in $(get_conf ListenAddress) ; do case "$x" in 0.0.0.0|0.0.0.0:*) ;; ::|\[::\]*) ;; @@ -75,7 +83,16 @@ depend() { fi } +update_command() { + if conf_enabled KerberosAuthentication || conf_enabled GSSAPIAuthentication && [ -r /usr/sbin/sshd.krb5 ]; then + command="${SSHD_BINARY:-"/usr/sbin/sshd.krb5"}" + elif conf_enabled UsePAM && [ -r /usr/sbin/sshd.pam ]; then + command="${SSHD_BINARY:-"/usr/sbin/sshd.pam"}" + fi +} + checkconfig() { + update_command warn_deprecated_var SSHD_BINARY warn_deprecated_var SSHD_CONFDIR warn_deprecated_var SSHD_CONFIG cfgfile @@ -105,16 +122,14 @@ start_pre() { checkconfig } -stop() { +stop_pre() { + update_command if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi +} - ebegin "Stopping $RC_SVCNAME" - start-stop-daemon --stop --exec "$command" \ - --pidfile "$pidfile" --quiet - eend $? - +stop_post() { if [ "$RC_RUNLEVEL" = "shutdown" ]; then _sshd_pids=$(pgrep "${command##*/}") if [ -n "$_sshd_pids" ]; then |