24 lines
426 B
Bash
24 lines
426 B
Bash
#!/bin/bash
|
|
# Ignore the user git if you have one..
|
|
if [ "$PAM_USER" = "git" ]; then
|
|
exit 0
|
|
fi=
|
|
# Your ntfy topic URL
|
|
NTFY_TOPIC="bla bla bla"
|
|
|
|
HOSTNAME=$(hostname)
|
|
USER="$PAM_USER"
|
|
IP="$PAM_RHOST"
|
|
TIME=$(date +"%Y-%m-%d %H:%M:%S %Z")
|
|
|
|
MESSAGE="SSH login
|
|
User: $USER
|
|
IP: $IP
|
|
Host: $HOSTNAME
|
|
Time: $TIME"
|
|
|
|
curl -s -X POST "$NTFY_TOPIC" \
|
|
-H "Title: New SSH Login detected !" \
|
|
-H "Priority: 4" \
|
|
-d "$MESSAGE"
|