TelePAM is a little unicorn that sends you messages when someone opens a new session in your Linux machine through PAM's pam_exec.
Instructions
- Follow this instructions to create a Telegram bot and this to get your ID.
- Clone the repo and enter its folder.
- Add the following line at the end of the file
/etc/pam.d/common-session
:
session optional pam_exec.so /usr/bin/pam_login.sh
- Change file pam_login.py with your id and token
- Place the files pam_login.[py,sh] in /usr/bin
mv pam_login.* /usr/bin/
pip3 install telebot
If everything goes correctly at the next login you will receive a message to your bot similar to: Remember to send a message to the bot before setting this up, or Telegram will reject the request.
For any debugging purposes change the line we added in /etc/pam.d/common-session
to:
session optional pam_exec.so debug log=/tmp/pam_exec.log /usr/bin/pam_login.sh
- You'll have a file in
/tmp/pam_exec.log
with pam_exec's output to guide you in troubleshooting
The idea started while playing with PAM for reasons that i do not recall because: