1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-10-31 09:01:12 +01:00
ntfy/examples/ssh-login-alert/ntfy-ssh-login.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
354 B
Bash
Raw Normal View History

2021-11-09 02:15:13 +01:00
#!/bin/bash
# This is a PAM script hook that shows how to notify you when
# somebody logs into your server. Place at /usr/local/bin/ntfy-ssh-login.sh (with chmod +x!).
2021-11-29 21:34:29 +01:00
TOPIC_URL=ntfy.sh/alerts
2021-11-09 02:15:13 +01:00
if [ "${PAM_TYPE}" = "open_session" ]; then
2021-11-29 21:34:29 +01:00
curl -H tags:warning -H prio:high -d "SSH login to $(hostname): ${PAM_USER} from ${PAM_RHOST}" "${TOPIC_URL}"
2021-11-09 02:15:13 +01:00
fi