Add the SSH login script
This commit is contained in:
20
ssh-login-ntfy.sh
Normal file
20
ssh-login-ntfy.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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"
|
||||||
Reference in New Issue
Block a user