add notification and update aws-backup (the changes will come soon)

This commit is contained in:
2024-12-17 20:49:59 +01:00
parent 97e628deab
commit e9e0d7cc64
4 changed files with 164 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
#!bin/bash
source /etc/serverconfig/.env
case "$PAM_TYPE" in
open_session)
PAYLOAD=" { \"text\": \"$PAM_USER logged in (remote host: $PAM_RHOST) at $(date).\" }"
;;
close_session)
PAYLOAD=" { \"text\": \"$PAM_USER logged out (remote host: $PAM_RHOST) at $(date).\" }"
;;
esac
if [ -n "$PAYLOAD" ] ; then
curl -X POST "https://api.telegram.org/bot$TOKEN/sendMessage" \
-d "chat_id=$CHAT_ID" \
-d "text=$PLAYLOAD" \
-d "parse_mode=HTML"
fi