scripting block_ip.sh on freebsd
Hi,
You just create the file block_ip.sh in the given directory
/usr/local/directadmin/scripts/custom/
Put this in it:
#!/bin/sh
echo "Blocking $ip with ipfw ...<br>";
ipfw add deny ip from $ip to any
exit $?
and now you should have a Block this IP button.
You find the button in Brute Force Monitor, when you click "IP Info".
Note that if IPFW gets restarted the IP is no longer blocked.
Hope that helps!
Does anybody know how to change this script so it writes the rule to /etc/firewall.rules ?(so blocked IP's are saved)
What i've tried is
#!/bin/sh
echo "Blocking $ip with ipfw ...<br>";
add deny ip from $ip to any >> /etc/firewall.rules
exit $?
But i get an error and the file is not amended.
Any ideas anyone?