Add 'sshd-login.sh'
This commit is contained in:
parent
3855a7cabb
commit
2c35182c5c
40
sshd-login.sh
Normal file
40
sshd-login.sh
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WEBHOOK_URL="https://discord.com/api/webhooks/123456789012345678/longassfuckingstring"
|
||||||
|
|
||||||
|
case "$PAM_TYPE" in
|
||||||
|
open_session)
|
||||||
|
read -r -d '' PAYLOAD << EOM
|
||||||
|
{
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"description": "$PAM_USER logged in from $PAM_RHOST.",
|
||||||
|
"color": 5354307,
|
||||||
|
"author": {
|
||||||
|
"name": "$(uname -n)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOM
|
||||||
|
;;
|
||||||
|
close_session)
|
||||||
|
read -r -d '' PAYLOAD << EOM
|
||||||
|
{
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"description": "$PAM_USER logged out from $PAM_RHOST.",
|
||||||
|
"color": 12929867,
|
||||||
|
"author": {
|
||||||
|
"name": "$(uname -n)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOM
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$PAYLOAD" ] ; then
|
||||||
|
curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" "$WEBHOOK_URL"
|
||||||
|
fi
|
Loading…
Reference in a new issue