Skip to content

Instantly share code, notes, and snippets.

@jaredh
Created February 21, 2016 22:24
Show Gist options
  • Save jaredh/f1f4be66b6d6f809ae38 to your computer and use it in GitHub Desktop.
Save jaredh/f1f4be66b6d6f809ae38 to your computer and use it in GitHub Desktop.
Script for notifying Pushover of successful SSH logins
#!/bin/sh
PUSHOVER_API_URL="https://api.pushover.net/1/messages.json"
PUSHOVER_APPTOKEN="<YOUR_APP_TOKEN>"
PUSHOVER_USERKEY="<YOUR_USER_KEY>"
if [ "$PAM_TYPE" != "close_session" ]; then
MESSAGE="User '$PAM_USER' logged into '`hostname`' from IP address '$PAM_RHOST'"
curl -s -F "user=$PUSHOVER_USERKEY" -F "token=$PUSHOVER_APPTOKEN" -F "message=$MESSAGE" $PUSHOVER_API_URL
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment