Created
February 21, 2016 22:24
-
-
Save jaredh/f1f4be66b6d6f809ae38 to your computer and use it in GitHub Desktop.
Script for notifying Pushover of successful SSH logins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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