Created
October 9, 2019 17:05
-
-
Save cmaster11/52b73ddd6dfefa19babb548549b3ca81 to your computer and use it in GitHub Desktop.
Markdium-How to get notified whenever someone SSH'es into an instance?
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
| if [[ -n $SSH_CONNECTION ]] ; then | |
| 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_YOUR_API_KEY" \ | |
| -F title="SSH - User $USER logged in" \ | |
| -F content="$CONTENT" > /dev/null || true | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment