mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 07:34:23 +00:00
19 lines
518 B
Bash
19 lines
518 B
Bash
#!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 |