Created
October 10, 2019 10:45
-
-
Save cmaster11/0a2c1b524502b98b3faf65b63b7e5e55 to your computer and use it in GitHub Desktop.
Markdium-Script PAM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# We want to trigger the script only when the SSH session starts. | |
# To be notified also when session closes, you can watch for | |
# the "close_session" value. | |
if [[ "$PAM_TYPE" != "open_session" ]]; then | |
exit 0 | |
fi | |
read -r -d '' CONTENT <<-EOF || true | |
Now UTC: $(date --utc "+%F %T") | |
Env: | |
$(printenv) | |
EOF | |
curl -s -X POST "https://hook.notify17.net/api/raw/REPLACE_WITH_RAW_API_KEY" \ | |
-F title="SSH - User $PAM_USER logged in" \ | |
-F content="$CONTENT" > /dev/null || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment