Skip to content

Commit 4d48c5d

Browse files
author
Philipp Heckel
committed
Examples
1 parent b9b53bc commit 4d48c5d

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# This is a PAM script hook that shows how to notify you when
3+
# somebody logs into your server. Place at /usr/local/bin/ntfy-ssh-login.sh (with chmod +x!).
4+
5+
if [ "${PAM_TYPE}" = "open_session" ]; then
6+
echo -en "\u26A0\uFE0F SSH login to $(hostname): ${PAM_USER} from ${PAM_RHOST}" | curl -T- ntfy.sh/alerts
7+
fi

examples/ssh-login-alert/pam_sshd

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PAM config file snippet
2+
#
3+
# Put this snippet AT THE END of the file /etc/pam.d/sshd
4+
# See https://geekthis.net/post/run-scripts-after-ssh-authentication/ for details.
5+
6+
# (lots of stuff here ...)
7+
8+
session optional pam_exec.so /usr/local/bin/ntfy-ssh-login.sh

0 commit comments

Comments
 (0)