Debian Codegraph @

examples/ssh-login-alert/ntfy-ssh-login.sh

raw
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 TOPIC_URL=ntfy.sh/alerts
6
7 if [ "${PAM_TYPE}" = "open_session" ]; then
8 curl -H tags:warning -H prio:high -d "SSH login to $(hostname): ${PAM_USER} from ${PAM_RHOST}" "${TOPIC_URL}"
9 fi