summaryrefslogtreecommitdiffstats
path: root/debian/systemd/ssh-session-cleanup
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:26:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:26:58 +0000
commit4722d4b7980d6fd8145e2e9f08492d951ea261d1 (patch)
tree7ab498b39f5bdce46b1bbc41ef5201322df4e2d4 /debian/systemd/ssh-session-cleanup
parentAdding upstream version 1:7.9p1. (diff)
downloadopenssh-4722d4b7980d6fd8145e2e9f08492d951ea261d1.tar.xz
openssh-4722d4b7980d6fd8145e2e9f08492d951ea261d1.zip
Adding debian version 1:7.9p1-10+deb10u2.debian/1%7.9p1-10+deb10u2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/systemd/ssh-session-cleanup11
-rw-r--r--debian/systemd/ssh-session-cleanup.service13
2 files changed, 24 insertions, 0 deletions
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