summaryrefslogtreecommitdiff
path: root/debian/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'debian/systemd')
-rw-r--r--debian/systemd/ssh-agent.override1
-rw-r--r--debian/systemd/ssh-agent.service8
-rwxr-xr-xdebian/systemd/ssh-session-cleanup11
-rw-r--r--debian/systemd/ssh-session-cleanup.service13
-rw-r--r--debian/systemd/ssh.service17
-rw-r--r--debian/systemd/ssh.socket12
-rw-r--r--debian/systemd/ssh@.service8
-rw-r--r--debian/systemd/sshd.conf1
8 files changed, 71 insertions, 0 deletions
diff --git a/debian/systemd/ssh-agent.override b/debian/systemd/ssh-agent.override
new file mode 100644
index 0000000..2905494
--- /dev/null
+++ b/debian/systemd/ssh-agent.override
@@ -0,0 +1 @@
+manual
diff --git a/debian/systemd/ssh-agent.service b/debian/systemd/ssh-agent.service
new file mode 100644
index 0000000..2297f8f
--- /dev/null
+++ b/debian/systemd/ssh-agent.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=OpenSSH Agent
+Before=graphical-session-pre.target
+ConditionPathExists=/etc/X11/Xsession.options
+
+[Service]
+ExecStart=/usr/lib/openssh/agent-launch start
+ExecStopPost=/usr/lib/openssh/agent-launch stop
diff --git a/debian/systemd/ssh-session-cleanup b/debian/systemd/ssh-session-cleanup
new file mode 100755
index 0000000..f283cc9
--- /dev/null
+++ b/debian/systemd/ssh-session-cleanup
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+ssh_session_pattern='sshd: \S.*@pts/[0-9]+'
+
+IFS="$IFS@"
+pgrep -a -f "$ssh_session_pattern" | while read pid daemon user pty; do
+ echo "Found ${daemon%:} session $pid on $pty; sending SIGTERM"
+ kill "$pid" || true
+done
+
+exit 0
diff --git a/debian/systemd/ssh-session-cleanup.service b/debian/systemd/ssh-session-cleanup.service
new file mode 100644
index 0000000..b867272
--- /dev/null
+++ b/debian/systemd/ssh-session-cleanup.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=OpenBSD Secure Shell session cleanup
+Wants=network.target
+After=network.target
+
+[Service]
+ExecStart=/bin/true
+ExecStop=/usr/lib/openssh/ssh-session-cleanup
+RemainAfterExit=yes
+Type=oneshot
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/systemd/ssh.service b/debian/systemd/ssh.service
new file mode 100644
index 0000000..3df8c64
--- /dev/null
+++ b/debian/systemd/ssh.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=OpenBSD Secure Shell server
+After=network.target auditd.service
+ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
+
+[Service]
+EnvironmentFile=-/etc/default/ssh
+ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+RestartPreventExitStatus=255
+Type=notify
+
+[Install]
+WantedBy=multi-user.target
+Alias=sshd.service
diff --git a/debian/systemd/ssh.socket b/debian/systemd/ssh.socket
new file mode 100644
index 0000000..5a766dc
--- /dev/null
+++ b/debian/systemd/ssh.socket
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenBSD Secure Shell server socket
+Before=ssh.service
+Conflicts=ssh.service
+ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
+
+[Socket]
+ListenStream=22
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/debian/systemd/ssh@.service b/debian/systemd/ssh@.service
new file mode 100644
index 0000000..4b0801d
--- /dev/null
+++ b/debian/systemd/ssh@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=OpenBSD Secure Shell server per-connection daemon
+After=auditd.service
+
+[Service]
+EnvironmentFile=-/etc/default/ssh
+ExecStart=-/usr/sbin/sshd -i $SSHD_OPTS
+StandardInput=socket
diff --git a/debian/systemd/sshd.conf b/debian/systemd/sshd.conf
new file mode 100644
index 0000000..4fbeba1
--- /dev/null
+++ b/debian/systemd/sshd.conf
@@ -0,0 +1 @@
+d /run/sshd 0755 root root