2 # Adds an IP to null route
3 # Requirements: ip route
6 # Modifyed script host-deny from Daniel B. Cid
7 # Last modified: Feb 16, 2007
17 LOCK="${PWD}/host-deny-lock"
18 LOCK_PID="${PWD}/host-deny-lock/pid"
23 echo "`date` $0 $1 $2 $3 $4 $5" >> ${PWD}/../logs/active-responses.log
26 # IP Address must be provided
27 if [ "x${IP}" = "x" ]; then
28 echo "$0: Missing argument <action> <user> (ip)"
33 # Adding the ip to null route
34 if [ "x${ACTION}" = "xadd" ]; then
35 if [ "X${UNAME}" = "XLinux" ]; then
36 route add ${IP} reject
40 if [ "X${UNAME}" = "XFreeBSD" ]; then
41 route -q add ${IP} 127.0.0.1 -blackhole
45 # Deleting from null route
46 # be carefull not to remove your default route
47 elif [ "x${ACTION}" = "xdelete" ]; then
48 if [ "X${UNAME}" = "XLinux" ]; then
49 route del ${IP} reject
53 if [ "X${UNAME}" = "XFreeBSD" ]; then
54 route -q delete ${IP} 127.0.0.1 -blackhole
60 echo "$0: invalid action: ${ACTION}"