You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
572 B
17 lines
572 B
#!/bin/bash
|
|
|
|
[[ "$PAM_TYPE" != "open_session" ]] && exit 0
|
|
|
|
if journalctl --since "1 minute ago" -u ssh | tac | grep Accepted -m1 | grep password; then
|
|
{
|
|
echo "User: $PAM_USER"
|
|
echo "Remote Host: $PAM_RHOST"
|
|
echo "Service: $PAM_SERVICE"
|
|
echo "TTY: $PAM_TTY"
|
|
echo "Date: $(date)"
|
|
echo "Server: $(uname -a)"
|
|
echo
|
|
echo "Somebody has successfully logged in your machine, please be aware and acknowledge this event."
|
|
} | mail -s "$PAM_SERVICE login on $(hostname -f) for account $PAM_USER" root
|
|
fi
|
|
exit 0
|