Created
February 16, 2019 23:07
-
-
Save idnovic/c43a7d2d754882e8f1b42343245a02b6 to your computer and use it in GitHub Desktop.
pushover ssh
This file contains hidden or 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
above config is for push notifications over pushover for ssh logins