Summary: | net-misc/openssh - sshd sessions don't get killed when system goes down or reboots | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Herbert Wantesh <rauchwolke> |
Component: | [OLD] Core system | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | alexander, polynomial-c |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=259183 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Herbert Wantesh
2011-05-16 16:50:44 UTC
updated version that uses SSHD_BINARY instead... stop() { if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi ebegin "Stopping ${SVCNAME}" if [ "`/sbin/runlevel|/bin/cut -c 3`" = "3" ]; then start-stop-daemon --stop --exec "${SSHD_BINARY}" \ --pidfile "${SSHD_PIDFILE}" --quiet else killall -q "${SSHD_BINARY}" fi eend $? } to keep consistency use start-stop-daemon ... stop() { if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi ebegin "Stopping ${SVCNAME}" if [ "`/sbin/runlevel|/bin/cut -c 3`" = "1" ]; then start-stop-daemon --stop --exec "${SSHD_BINARY}" \ --pidfile "${SSHD_PIDFILE}" --quiet else start-stop-daemon --stop -n "${SSHD_BINARY}" --quiet fi eend $? } test for runlevel 3 not 1 ... stop() { if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi ebegin "Stopping ${SVCNAME}" if [ "`/sbin/runlevel|/bin/cut -c 3`" = "3" ]; then start-stop-daemon --stop --exec "${SSHD_BINARY}" \ --pidfile "${SSHD_PIDFILE}" --quiet else start-stop-daemon --stop -n "${SSHD_BINARY}" --quiet fi eend $? } yeah, we cant merge any of those. obviously the first one will kill too much when doing `/etc/init.d/sshd stop`, and the latter rely on sysvinit. i dont see this as being a real problem, and i'm not aware of any other distro that attempts to address this. but there is no better way to find out if the service is stopped by the user or at reboot/shutdown? atm, i dont think so. openrc doesnt provide differentiation between "shutting down" and "switching runlevels". simply switching between runlevels where the new one doesnt have sshd init.d in it should not kill sessions. i dont think `fuser` or a similar util can deduce the reason for an app using the network, so it couldnt just say "kill all processes with a network socket open" before bringing down the network. Shouldn't services that need net be stopped before net goes down? (In reply to comment #7) > Shouldn't services that need net be stopped before net goes down? As Mike pointed out in comment #6, OpenRC doesn't provide the ability to know that shut down is happening due to a runlevel change or the system going down. *** Bug 452026 has been marked as a duplicate of this bug. *** as it seems openrc intruduced this fix a long time ago kexec allready uses this the stop function for the openssh initscript should be changed to: stop() { if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi ebegin "Stopping ${SVCNAME}" if yesno $RC_REBOOT; then #rebooting start-stop-daemon --stop -n "${SSHD_BINARY}" --quiet else start-stop-daemon --stop --exec "${SSHD_BINARY}" \ --pidfile "${SSHD_PIDFILE}" --quiet fi eend $? } this fix doesn't work as it just recognizes a reboot a shutdown is still unhandeld Isn't this a dublicate of bug 259183? *** This bug has been marked as a duplicate of bug 259183 *** |