From 2c35182c5ca64d013490b2118e563d6770bc5cf9 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 10 May 2021 13:30:17 +0000 Subject: [PATCH] Add 'sshd-login.sh' --- sshd-login.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sshd-login.sh diff --git a/sshd-login.sh b/sshd-login.sh new file mode 100644 index 0000000..db91259 --- /dev/null +++ b/sshd-login.sh @@ -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 \ No newline at end of file