summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-07-16 16:28:32 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-19 00:09:01 +0100
commitc0585ca59aff5b662da236d0c7692113825e1593 (patch)
treeb10de48c77aa8189c08fb9492f277604a0679478 /meta/recipes-connectivity
parentcd9ab376a2a5f39642b70d6ff6a31dd5c2d84535 (diff)
downloadpoky-c0585ca59aff5b662da236d0c7692113825e1593.tar.gz
openssh: use pidfile in initscript
Stopping sshd must only kill the listening (top-level) daemon; it must not stop any other sshd process, because those are forked ssh connections which may include e.g. the connection that called /etc/init.d/sshd stop. This initscript uses "start-stop-daemon -x <exe>" for starting/stopping. When that is provided by busybox, this behavior is broken: `/etc/init.d/sshd stop` stops *all* sshd processes. This was caused by a fix to busybox 1.20: 17eedcad9406c43beddab3906c8c693626c351fb "ssd: compat: match -x EXECUTABLE by /proc/pid/exe too". The fix is to use a pidfile. All initscripts in upstream openssh do this, as does dropbear. Acked-by: Gratian Crisan <gratian.crisan@ni.com> Acked-by: Ken Sharp <ken.sharp@ni.com> (From OE-Core rev: 993405285e547403d5c753adfa91c26c43be13f6) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Ben Shelton <ben.shelton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r--meta/recipes-connectivity/openssh/openssh/init12
1 files changed, 7 insertions, 5 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh/init b/meta/recipes-connectivity/openssh/openssh/init
index 37c8e7b907..70d4a34659 100644
--- a/meta/recipes-connectivity/openssh/openssh/init
+++ b/meta/recipes-connectivity/openssh/openssh/init
@@ -1,6 +1,8 @@
1#! /bin/sh 1#! /bin/sh
2set -e 2set -e
3 3
4PIDFILE=/var/run/sshd.pid
5
4# source function library 6# source function library
5. /etc/init.d/functions 7. /etc/init.d/functions
6 8
@@ -70,12 +72,12 @@ case "$1" in
70 echo "Starting OpenBSD Secure Shell server: sshd" 72 echo "Starting OpenBSD Secure Shell server: sshd"
71 check_keys 73 check_keys
72 check_privsep_dir 74 check_privsep_dir
73 start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS 75 start-stop-daemon -S -p $PIDFILE -x /usr/sbin/sshd -- $SSHD_OPTS
74 echo "done." 76 echo "done."
75 ;; 77 ;;
76 stop) 78 stop)
77 echo -n "Stopping OpenBSD Secure Shell server: sshd" 79 echo -n "Stopping OpenBSD Secure Shell server: sshd"
78 start-stop-daemon -K -x /usr/sbin/sshd 80 start-stop-daemon -K -p $PIDFILE -x /usr/sbin/sshd
79 echo "." 81 echo "."
80 ;; 82 ;;
81 83
@@ -84,7 +86,7 @@ case "$1" in
84 check_keys 86 check_keys
85 check_config 87 check_config
86 echo -n "Reloading OpenBSD Secure Shell server's configuration" 88 echo -n "Reloading OpenBSD Secure Shell server's configuration"
87 start-stop-daemon -K -s 1 -x /usr/sbin/sshd 89 start-stop-daemon -K -p $PIDFILE -s 1 -x /usr/sbin/sshd
88 echo "." 90 echo "."
89 ;; 91 ;;
90 92
@@ -92,11 +94,11 @@ case "$1" in
92 check_keys 94 check_keys
93 check_config 95 check_config
94 echo -n "Restarting OpenBSD Secure Shell server: sshd" 96 echo -n "Restarting OpenBSD Secure Shell server: sshd"
95 start-stop-daemon -K --oknodo -x /usr/sbin/sshd 97 start-stop-daemon -K -p $PIDFILE --oknodo -x /usr/sbin/sshd
96 check_for_no_start 98 check_for_no_start
97 check_privsep_dir 99 check_privsep_dir
98 sleep 2 100 sleep 2
99 start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS 101 start-stop-daemon -S -p $PIDFILE -x /usr/sbin/sshd -- $SSHD_OPTS
100 echo "." 102 echo "."
101 ;; 103 ;;
102 104