diff options
Diffstat (limited to 'debian/systemd')
-rwxr-xr-x | debian/systemd/ssh-session-cleanup | 11 | ||||
-rw-r--r-- | debian/systemd/ssh-session-cleanup.service | 13 |
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 000000000..f283cc967 --- /dev/null +++ b/debian/systemd/ssh-session-cleanup | |||
@@ -0,0 +1,11 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | ssh_session_pattern='sshd: \S.*@pts/[0-9]+' | ||
4 | |||
5 | IFS="$IFS@" | ||
6 | pgrep -a -f "$ssh_session_pattern" | while read pid daemon user pty; do | ||
7 | echo "Found ${daemon%:} session $pid on $pty; sending SIGTERM" | ||
8 | kill "$pid" || true | ||
9 | done | ||
10 | |||
11 | exit 0 | ||
diff --git a/debian/systemd/ssh-session-cleanup.service b/debian/systemd/ssh-session-cleanup.service new file mode 100644 index 000000000..b86727227 --- /dev/null +++ b/debian/systemd/ssh-session-cleanup.service | |||
@@ -0,0 +1,13 @@ | |||
1 | [Unit] | ||
2 | Description=OpenBSD Secure Shell session cleanup | ||
3 | Wants=network.target | ||
4 | After=network.target | ||
5 | |||
6 | [Service] | ||
7 | ExecStart=/bin/true | ||
8 | ExecStop=/usr/lib/openssh/ssh-session-cleanup | ||
9 | RemainAfterExit=yes | ||
10 | Type=oneshot | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=multi-user.target | ||