Created
September 11, 2022 21:22
-
-
Save Neo23x0/9a98a633c3eb0a20e1f95dd03211380a to your computer and use it in GitHub Desktop.
Slack Hook - System Logon
This file contains 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 -x | |
hostname=$(hostname) | |
source=$(echo "$SSH_CONNECTION" | cut -d' ' -f 1) | |
geo=$(geoiplookup "$source") | |
curl -X POST --silent --data "payload={\"text\": \":bust_in_silhouette: SYSTEM: $hostname USER: $USER SOURCE: $source GEO: $geo\"}" https://hooks.slack.com/services/XXXXXXXX_YOURHOOK_XXXXX > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment