Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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