updated login-notify.sh

This commit is contained in:
Samuel Philipp 2020-10-05 19:50:34 +02:00
parent 8729431f90
commit af9cf6cd9a

View file

@ -9,10 +9,9 @@ subject="SSH Login: $PAM_USER from $PAM_RHOST on $HOST"
message="User $PAM_USER logged in on $HOST from $PAM_RHOST at $(date)."
if [ "$PAM_TYPE" == "open_session" ]; then
if [ "$PAM_USER" != "root" ]; then
echo "$message" | mailx -a "From: $sender" -s "$subject" "$recipient"
fi
if [ -n "$GOTIFY_TOKEN" ]; then
curl -F "title=$subject" -F "message=$message" -F "priority=5" "https://push.sp-codes.de/message?token=$GOTIFY_TOKEN"
elif [ "$PAM_USER" != "root" ]; then
echo "$message" | mailx -a "From: $sender" -s "$subject" "$recipient"
fi
fi