Created
January 9, 2020 08:41
-
-
Save interbiznw/967c842675099d80dd972a34c104e7d8 to your computer and use it in GitHub Desktop.
/etc/ssh/login-notify.sh script,. place this line in /etc/pam.d/sshd: "session optional pam_exec.so seteuid /etc/ssh/login-notify.sh"
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/sh | |
| # Change these two lines: | |
| sender="root" | |
| recepient="btcpj62" | |
| if [ "$PAM_TYPE" != "close_session" ]; then | |
| host="`hostname`" | |
| subject="SSH Login: $PAM_USER from $PAM_RHOST on $host" | |
| msg_content=\"$subject\" | |
| # Message to send, e.g. the current environment variables. | |
| message="`env`" | |
| url='https://discordapp.com/api/webhooks/{replace this whole url with full webhook url}' | |
| curl -H "Content-Type: application/json" -X POST -d "{\"content\": $msg_content}" $url | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment