From ba6b55ed652857082d7702c29923af2168f00308 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 13 Jun 2007 22:34:33 +0000 Subject: * Add /etc/network/if-up.d/openssh-server to restart sshd when new interfaces appear (LP: #103436). --- debian/changelog | 2 ++ debian/openssh-server.dirs | 1 + debian/openssh-server.if-up | 30 ++++++++++++++++++++++++++++++ debian/rules | 1 + 4 files changed, 34 insertions(+) create mode 100644 debian/openssh-server.if-up diff --git a/debian/changelog b/debian/changelog index 7a9dcc970..95a7c741b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ openssh (1:4.6p1-2) UNRELEASED; urgency=low * Document the SILENT loglevel in sftp-server(8), ssh_config(5), and sshd_config(5). * Add try-restart action to init script. + * Add /etc/network/if-up.d/openssh-server to restart sshd when new + interfaces appear (LP: #103436). -- Colin Watson Wed, 13 Jun 2007 00:56:45 +0100 diff --git a/debian/openssh-server.dirs b/debian/openssh-server.dirs index b28faf929..7cc4c0d84 100644 --- a/debian/openssh-server.dirs +++ b/debian/openssh-server.dirs @@ -1,5 +1,6 @@ etc/init.d etc/default +etc/network/if-up.d usr/lib/openssh usr/sbin usr/share/man/man5 diff --git a/debian/openssh-server.if-up b/debian/openssh-server.if-up new file mode 100644 index 000000000..67f06c094 --- /dev/null +++ b/debian/openssh-server.if-up @@ -0,0 +1,30 @@ +#! /bin/sh +# Reload the OpenSSH server when an interface comes up, to allow it to start +# listening on new addresses. + +set -e + +# Don't bother to restart sshd when lo is configured. +if [ "$IFACE" = lo ]; then + exit 0 +fi + +# Only run from ifup. +if [ "$MODE" != start ]; then + exit 0 +fi + +# OpenSSH only cares about inet and inet6. Get thee gone, strange people +# still using ipx. +if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then + exit 0 +fi + +# Is /usr mounted? +if [ ! -e /usr/sbin/sshd ]; then + exit 0 +fi + +/etc/init.d/ssh reload >/dev/null 2>&1 + +exit 0 diff --git a/debian/rules b/debian/rules index 6e335cf6e..71e291b7a 100755 --- a/debian/rules +++ b/debian/rules @@ -171,6 +171,7 @@ install: build install -o root -g root debian/openssh-server.init debian/openssh-server/etc/init.d/ssh install -o root -g root -m 644 debian/openssh-server.default debian/openssh-server/etc/default/ssh + install -o root -g root debian/openssh-server.if-up debian/openssh-server/etc/network/if-up.d/openssh-server install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp -- cgit v1.2.3