|
|
|
@ -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
|
|
|
|
|