Created
December 10, 2019 14:25
-
-
Save Efrat19/ba557c77d6bc09e8b592bf0d7a4a6c75 to your computer and use it in GitHub Desktop.
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
# listen on port 25 and notify on slack if the program tries to send mail through | |
msg2slack() { | |
read MESSAGE | |
echo "PID: $$" | |
echo "$MESSAGE" | |
msg="connection attempt to port 25 on $(cat /etc/hostname):\n$MESSAGE" | |
$DETECTMAIL_SLACK_URL && curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$msg\"}" $DETECTMAIL_SLACK_URL | |
} | |
socat -u tcp-l:25,fork system:msg2slack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment