misc/ssh_tg_notify: Lookup & inform user which logged in as well

master
Felix Stupp 2 years ago
parent 10a3e8aa9f
commit c842c40c89
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -31,5 +31,10 @@ if [[ "$PAM_SERVICE" == "sshd" && "$PAM_TYPE" == "open_session" && "$PAM_USER" !
TEXT="Successful login from [$IP](https://stat.ripe.net/app/$IP) for ${PAM_USER} @ ${HOSTNAME} ($(date "+%Y-%m-%d %H:%M"))"
# send to root
ROOT_USER_ID="$(getUserId root)"
sendMessage "$ROOT_USER_ID" "$TEXT"
sendMessage "$ROOT_USER_ID" "$TEXT (This message was sent to you because you are the admin.)"
# send to user if id is known
USER_ID="$(getUserId "$PAM_USER")"
if [[ -n "$USER_ID" ]]; then
sendMessage "$USER_ID" "$TEXT"
fi
fi

Loading…
Cancel
Save