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
| #Place this file under /etc/profile.d/ to get notifyed whenever someone goes through a login procedure in ssh | |
| USERID="<the chatID where you want to get notificated>"#use api.telegram.org/bot$KEY/getUpdate to find out the ID | |
| KEY="<your bot api-key here" | |
| TIMEOUT="10" | |
| URL="https://api.telegram.org/bot$KEY/sendMessage" | |
| DATE_EXEC="$(date "+%d %b %Y %H:%M")" | |
| #TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt' Only for additional IPLookup | |
| if [ -n "$SSH_CLIENT" ]; then | |
| IP=$(echo $SSH_CLIENT | awk '{print $1}') | |
| PORT=$(echo $SSH_CLIENT | awk '{print $3}') |