ansible-role--sshd/files/notify_login.sh

16 lines
411 B
Bash
Raw Normal View History

2024-07-12 12:38:33 +00:00
#!/bin/bash
# Récupérer les variables d'environnement
USER=$PAM_USER
HOST=$PAM_RHOST
IPADDR=$PAM_RHOSTADDR
SESSION=$PAM_TTY
# Envoyer une notification via ntfy.sh (remplacer "your_topic" par votre sujet ntfy)
curl -X POST https://ntfy.sh/your_topic \
-d '{
"title": "Connexion SSH",
"message": "Utilisateur '$USER' connecté depuis '$HOST' ($IPADDR) - Session: '$SESSION'",
"priority": 1
}'