summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-10 14:37:55 +0000
committerColin Watson <cjwatson@debian.org>2014-02-10 14:37:55 +0000
commit11cbb530aa4ca54344eb8941342bfe510f4b981b (patch)
tree3cc6e4aa03bb76121fa1d4f8ee2fbcbdc6cdb5c1
parente4c505521f820cadada465ebfa8ff12e3d37feb9 (diff)
Add systemd support (thanks, Sven Joachim; closes: #676830).
-rw-r--r--debian/README.Debian20
-rw-r--r--debian/changelog1
-rw-r--r--debian/control2
-rw-r--r--debian/openssh-server.install4
-rw-r--r--debian/openssh-server.postinst7
l---------debian/openssh-server.ssh.service1
-rwxr-xr-xdebian/rules5
-rw-r--r--debian/systemd/ssh.service15
-rw-r--r--debian/systemd/ssh.socket11
-rw-r--r--debian/systemd/ssh@.service9
-rw-r--r--debian/systemd/sshd.conf1
11 files changed, 74 insertions, 2 deletions
diff --git a/debian/README.Debian b/debian/README.Debian
index 00dfea13d..b9efeb9f5 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -201,6 +201,26 @@ If you do this, note that you will need to stop sshd being started in the
201normal way ('rm -f /etc/rc[2345].d/S16ssh') and that you will need to 201normal way ('rm -f /etc/rc[2345].d/S16ssh') and that you will need to
202restart this sshd manually on upgrades. 202restart this sshd manually on upgrades.
203 203
204systemd socket activation
205-------------------------
206
207If you want to reconfigure systemd to launch sshd using socket activation,
208then you can run:
209
210 systemctl stop ssh.service
211 systemctl start ssh.socket
212
213To make this permanent:
214
215 systemctl disable ssh.service
216 systemctl enable ssh.socket
217
218This may be appropriate in environments where minimal footprint is critical
219(e.g. cloud guests). Be aware that this bypasses MaxStartups, and systemd's
220MaxConnections cannot quite replace this as it cannot distinguish between
221authenticated and unauthenticated connections; see
222https://bugzilla.redhat.com/show_bug.cgi?id=963268 for more discussion.
223
204-- 224--
205Matthew Vernon <matthew@debian.org> 225Matthew Vernon <matthew@debian.org>
206Colin Watson <cjwatson@debian.org> 226Colin Watson <cjwatson@debian.org>
diff --git a/debian/changelog b/debian/changelog
index 5dc215554..e0adf6e70 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,7 @@ openssh (1:6.5p1-1) UNRELEASED; urgency=medium
28 'ssh-keygen -q -f /etc/ssh/ssh_host_ed25519_key -N "" -t ed25519'. 28 'ssh-keygen -q -f /etc/ssh/ssh_host_ed25519_key -N "" -t ed25519'.
29 * Drop long-obsolete "SSH now uses protocol 2 by default" section from 29 * Drop long-obsolete "SSH now uses protocol 2 by default" section from
30 README.Debian. 30 README.Debian.
31 * Add systemd support (thanks, Sven Joachim; closes: #676830).
31 32
32 -- Colin Watson <cjwatson@debian.org> Sun, 09 Feb 2014 15:52:14 +0000 33 -- Colin Watson <cjwatson@debian.org> Sun, 09 Feb 2014 15:52:14 +0000
33 34
diff --git a/debian/control b/debian/control
index 8b3679570..78746affe 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: openssh
2Section: net 2Section: net
3Priority: standard 3Priority: standard
4Maintainer: Debian OpenSSH Maintainers <debian-ssh@lists.debian.org> 4Maintainer: Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>
5Build-Depends: libwrap0-dev | libwrap-dev, zlib1g-dev (>= 1:1.2.3-1), libssl-dev (>= 0.9.8g), libpam0g-dev | libpam-dev, libgtk2.0-dev, libedit-dev, debhelper (>= 8.1.0~), libselinux1-dev [linux-any], libkrb5-dev | heimdal-dev, dpkg (>= 1.16.1~), libck-connector-dev, dh-autoreconf, autotools-dev 5Build-Depends: libwrap0-dev | libwrap-dev, zlib1g-dev (>= 1:1.2.3-1), libssl-dev (>= 0.9.8g), libpam0g-dev | libpam-dev, libgtk2.0-dev, libedit-dev, debhelper (>= 8.1.0~), libselinux1-dev [linux-any], libkrb5-dev | heimdal-dev, dpkg (>= 1.16.1~), libck-connector-dev, dh-autoreconf, autotools-dev, dh-systemd (>= 1.4)
6Standards-Version: 3.8.4 6Standards-Version: 3.8.4
7Uploaders: Colin Watson <cjwatson@debian.org>, Matthew Vernon <matthew@debian.org> 7Uploaders: Colin Watson <cjwatson@debian.org>, Matthew Vernon <matthew@debian.org>
8Homepage: http://www.openssh.org/ 8Homepage: http://www.openssh.org/
diff --git a/debian/openssh-server.install b/debian/openssh-server.install
index 8e04c4170..d04788cca 100644
--- a/debian/openssh-server.install
+++ b/debian/openssh-server.install
@@ -4,3 +4,7 @@ usr/share/man/man5/authorized_keys.5
4usr/share/man/man5/sshd_config.5 4usr/share/man/man5/sshd_config.5
5usr/share/man/man8/sftp-server.8 5usr/share/man/man8/sftp-server.8
6usr/share/man/man8/sshd.8 6usr/share/man/man8/sshd.8
7
8debian/systemd/ssh.socket lib/systemd/system
9debian/systemd/ssh@.service lib/systemd/system
10debian/systemd/sshd.conf usr/lib/tmpfiles.d
diff --git a/debian/openssh-server.postinst b/debian/openssh-server.postinst
index 91c757db5..b35e227e7 100644
--- a/debian/openssh-server.postinst
+++ b/debian/openssh-server.postinst
@@ -304,6 +304,13 @@ if [ "$action" = configure ]; then
304 # restart it under Upstart. 304 # restart it under Upstart.
305 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid || true 305 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid || true
306 fi 306 fi
307 if dpkg --compare-versions "$2" lt 1:6.5p1-1 && \
308 [ -d /run/systemd/system ] && \
309 ! systemctl --quiet is-active ssh; then
310 # We must stop the sysvinit-controlled sshd before we can
311 # restart it under systemd.
312 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid || true
313 fi
307fi 314fi
308 315
309#DEBHELPER# 316#DEBHELPER#
diff --git a/debian/openssh-server.ssh.service b/debian/openssh-server.ssh.service
new file mode 120000
index 000000000..609457230
--- /dev/null
+++ b/debian/openssh-server.ssh.service
@@ -0,0 +1 @@
systemd/ssh.service \ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 5b0d8f9d6..c8870b3a4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -114,7 +114,7 @@ confflags += --with-ldflags='$(strip -Wl,--as-needed $(default_ldflags))'
114confflags_udeb += --with-ldflags='-Wl,--as-needed' 114confflags_udeb += --with-ldflags='-Wl,--as-needed'
115 115
116%: 116%:
117 dh $@ --with=autoreconf 117 dh $@ --with=autoreconf,systemd
118 118
119autoreconf: 119autoreconf:
120 autoreconf -f -i 120 autoreconf -f -i
@@ -190,6 +190,9 @@ override_dh_installdocs:
190 # Avoid breaking dh_installexamples later. 190 # Avoid breaking dh_installexamples later.
191 mkdir -p debian/openssh-server/usr/share/doc/openssh-client 191 mkdir -p debian/openssh-server/usr/share/doc/openssh-client
192 192
193override_dh_systemd_enable:
194 dh_systemd_enable --name ssh
195
193override_dh_installinit: 196override_dh_installinit:
194 dh_installinit -R --name ssh -- start 16 2 3 4 5 . 197 dh_installinit -R --name ssh -- start 16 2 3 4 5 .
195 198
diff --git a/debian/systemd/ssh.service b/debian/systemd/ssh.service
new file mode 100644
index 000000000..333690bfc
--- /dev/null
+++ b/debian/systemd/ssh.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=OpenBSD Secure Shell server
3After=syslog.target network.target auditd.service
4ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
5
6[Service]
7EnvironmentFile=-/etc/default/ssh
8ExecStartPre=/usr/bin/test -c /dev/null
9ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
10ExecReload=/bin/kill -HUP $MAINPID
11KillMode=process
12Restart=on-failure
13
14[Install]
15WantedBy=multi-user.target
diff --git a/debian/systemd/ssh.socket b/debian/systemd/ssh.socket
new file mode 100644
index 000000000..fa1f615e4
--- /dev/null
+++ b/debian/systemd/ssh.socket
@@ -0,0 +1,11 @@
1[Unit]
2Description=OpenBSD Secure Shell server socket
3Conflicts=ssh.service
4ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
5
6[Socket]
7ListenStream=22
8Accept=yes
9
10[Install]
11WantedBy=sockets.target
diff --git a/debian/systemd/ssh@.service b/debian/systemd/ssh@.service
new file mode 100644
index 000000000..c2f9b1547
--- /dev/null
+++ b/debian/systemd/ssh@.service
@@ -0,0 +1,9 @@
1[Unit]
2Description=OpenBSD Secure Shell server per-connection daemon
3After=auditd.service
4
5[Service]
6EnvironmentFile=-/etc/default/ssh
7ExecStartPre=/usr/bin/test -c /dev/null
8ExecStart=-/usr/sbin/sshd -i $SSHD_OPTS
9StandardInput=socket
diff --git a/debian/systemd/sshd.conf b/debian/systemd/sshd.conf
new file mode 100644
index 000000000..ab7302189
--- /dev/null
+++ b/debian/systemd/sshd.conf
@@ -0,0 +1 @@
d /var/run/sshd 0755 root root