Telegram notifications about ssh authorization on the server
- First you need to create a telegram bot via https://t.me/BotFather
- Then create a private (or not, as you prefer) channel for alerts
- Create a URI as follows:
https://api.telegram.org/bot*****:***-*****************/getUpdates
and invoke it
- Add your bot to the channel
- Get channel ID from
https://api.telegram.org/bot*****:***-*****************/getUpdates
- Register at https://ipinfo.io/ and get an API token
- Fill in the variables in the script
chown +x ssh-alert.sh
- Call the script and check that everything works correctly
- vi /etc/pam.d/sshd and enter at the end of the file
session optional pam_exec.so type=open_session seteuid /full/path/to/ssh-alert.sh
Try connecting to the server via ssh and enjoy your notification system