Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 1.06 KB

File metadata and controls

27 lines (22 loc) · 1.06 KB

ssh-telegram-alert

Telegram notifications about ssh authorization on the server

  1. First you need to create a telegram bot via https://t.me/BotFather
  2. Then create a private (or not, as you prefer) channel for alerts
  3. Create a URI as follows:
https://api.telegram.org/bot*****:***-*****************/getUpdates

and invoke it

  1. Add your bot to the channel
  2. Get channel ID from https://api.telegram.org/bot*****:***-*****************/getUpdates

  1. Register at https://ipinfo.io/ and get an API token
  2. Fill in the variables in the script
  3. chown +x ssh-alert.sh
  4. Call the script and check that everything works correctly
  5. 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