ntfy-ssh-login.sh 354 B

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