Last active
April 7, 2016 20:37
-
-
Save halit/21f865908891738aa51e to your computer and use it in GitHub Desktop.
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
[Service] | |
Type=simple | |
NonBlocking=true | |
ExecStart=/usr/bin/firewall-log.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/bash | |
dmesg --follow | grep "UFW" | while read log | |
do | |
src=$(echo $log | cut -d ' ' -f8 | cut -d '=' -f2) | |
port=$(echo $log | cut -d ' ' -f17 | cut -d '=' -f2) | |
notify-send -t 1 "BLOCKED from $src to our $port!" | |
done |
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
chmod +x /usr/bin/firewall-log.sh | |
pacman -S notify-osd | |
pacman -S ufw | |
ufw enable | |
systemctl start firewall-log.service | |
systemctl enable firewall-log.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment