Skip to content

Instantly share code, notes, and snippets.

@halit
Last active April 7, 2016 20:37
Show Gist options
  • Save halit/21f865908891738aa51e to your computer and use it in GitHub Desktop.
Save halit/21f865908891738aa51e to your computer and use it in GitHub Desktop.
[Service]
Type=simple
NonBlocking=true
ExecStart=/usr/bin/firewall-log.sh
#!/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
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