summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2008-03-30 20:42:51 +0000
committerColin Watson <cjwatson@debian.org>2008-03-30 20:42:51 +0000
commit90f8cf5340c1b07d8dc62eecbc5efbd635215748 (patch)
treecab897a335541b002455b60ec0b798aa2f3bac56
parent3ca4df8019718052bde24bd6b717d3dd284c5180 (diff)
* Disable the Linux kernel's OOM-killer for the sshd parent; tweak
SSHD_OOM_ADJUST in /etc/default/ssh to change this (closes: #341767).
-rw-r--r--debian/changelog7
-rw-r--r--debian/openssh-server.default5
-rw-r--r--debian/openssh-server.init12
3 files changed, 24 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 7ae211514..d1174acf7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1openssh (1:4.7p1-6) UNRELEASED; urgency=low
2
3 * Disable the Linux kernel's OOM-killer for the sshd parent; tweak
4 SSHD_OOM_ADJUST in /etc/default/ssh to change this (closes: #341767).
5
6 -- Colin Watson <cjwatson@debian.org> Fri, 28 Mar 2008 18:54:06 +0000
7
1openssh (1:4.7p1-5) unstable; urgency=low 8openssh (1:4.7p1-5) unstable; urgency=low
2 9
3 * Recommends: xauth rather than Suggests: xbase-clients. 10 * Recommends: xauth rather than Suggests: xbase-clients.
diff --git a/debian/openssh-server.default b/debian/openssh-server.default
index 304042224..c4569e6c1 100644
--- a/debian/openssh-server.default
+++ b/debian/openssh-server.default
@@ -3,3 +3,8 @@
3 3
4# Options to pass to sshd 4# Options to pass to sshd
5SSHD_OPTS= 5SSHD_OPTS=
6
7# OOM-killer adjustment for sshd (see
8# linux/Documentation/filesystems/proc.txt; lower values reduce likelihood
9# of being killed, -17 = disable)
10SSHD_OOM_ADJUST=-17
diff --git a/debian/openssh-server.init b/debian/openssh-server.init
index 67b204789..8c38eedf5 100644
--- a/debian/openssh-server.init
+++ b/debian/openssh-server.init
@@ -16,6 +16,7 @@ set -e
16test -x /usr/sbin/sshd || exit 0 16test -x /usr/sbin/sshd || exit 0
17( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 17( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
18 18
19SSHD_OOM_ADJUST=-17
19if test -f /etc/default/ssh; then 20if test -f /etc/default/ssh; then
20 . /etc/default/ssh 21 . /etc/default/ssh
21fi 22fi
@@ -70,6 +71,15 @@ check_config() {
70 fi 71 fi
71} 72}
72 73
74adjust_oom() {
75 if [ -e /var/run/sshd.pid ]; then
76 PID="$(head -n1 /var/run/sshd.pid)"
77 if [ -e "/proc/$PID/oom_adj" ]; then
78 printf '%s' "$SSHD_OOM_ADJUST" >"/proc/$PID/oom_adj"
79 fi
80 fi
81}
82
73export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 83export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
74 84
75case "$1" in 85case "$1" in
@@ -80,6 +90,7 @@ case "$1" in
80 log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" 90 log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
81 if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then 91 if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
82 log_end_msg 0 92 log_end_msg 0
93 adjust_oom
83 else 94 else
84 log_end_msg 1 95 log_end_msg 1
85 fi 96 fi
@@ -113,6 +124,7 @@ case "$1" in
113 check_dev_null log_end_msg 124 check_dev_null log_end_msg
114 if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then 125 if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
115 log_end_msg 0 126 log_end_msg 0
127 adjust_oom
116 else 128 else
117 log_end_msg 1 129 log_end_msg 1
118 fi 130 fi