block_ip.sh block IPs through DirectAdmin?

bigboy

Verified User
Joined
Nov 25, 2005
Messages
231
Location
USA
Hello

can add to block_ip.sh?

please provide instruction

thank you
 

pipokoeie

New member
Joined
Nov 2, 2011
Messages
2
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?
 
Top