Created
April 16, 2019 19:53
-
-
Save Semamir/ecb3d42839fab87fb6a90bccbfe22da5 to your computer and use it in GitHub Desktop.
login notification (/etc/ssh/sshrc)
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 | |
ip_user=`echo $SSH_CONNECTION | cut -d " " -f 1` | |
ip_server=`echo $SSH_CONNECTION | cut -d " " -f 3 ` | |
message="`hostname -f`($ip_server) ssh login $USER - $ip_user" | |
data=\'{\"text\":\""$message"\"}\' | |
command="curl -X POST -H 'Content-type: application/json' --data $data https://hooks.slack.com/services/<SLACK_KEYS>" | |
eval "$command" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment