Skip to content

Instantly share code, notes, and snippets.

@idnovic
Created February 16, 2019 23:07
Show Gist options
  • Save idnovic/c43a7d2d754882e8f1b42343245a02b6 to your computer and use it in GitHub Desktop.
Save idnovic/c43a7d2d754882e8f1b42343245a02b6 to your computer and use it in GitHub Desktop.
pushover ssh
API_TOKEN=abcdefg1234hijklmno567890pqrstuv
API_USER=vutsrqp098765onmlkjih4321gfedcba
if [ -n "$SSH_CLIENT" ]; then
USER_IP=`echo $SSH_CLIENT|awk '{print $1}'`
TITLE="SSH: ${USER}@$(hostname -f) (${USER_IP})"
TEXT="$(date)"
curl -s \
-F "token=$API_TOKEN" \
-F "user=$API_USER" \
-F "title=$TITLE" \
-F "message=$TEXT" \
-F "priority=0" \
https://api.pushover.net/1/messages.json >/dev/null 2>&1
fi
## read me
# put the above config in /etc/ssh/sshrc with your own api token and key from pushover
@idnovic
Copy link
Author

idnovic commented Feb 17, 2019

above config is for push notifications over pushover for ssh logins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment