Skip to content

Instantly share code, notes, and snippets.

@Neo23x0
Created September 11, 2022 21:22
Show Gist options
  • Save Neo23x0/9a98a633c3eb0a20e1f95dd03211380a to your computer and use it in GitHub Desktop.
Save Neo23x0/9a98a633c3eb0a20e1f95dd03211380a to your computer and use it in GitHub Desktop.
Slack Hook - System Logon
#!/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