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)"
32 # Match the loopback address to the version of the provided IP address
34 echo "${IP}" | grep "\:" > /dev/null 2>&1
39 # Adding the ip to null route
40 if [ "x${ACTION}" = "xadd" ]; then
41 if [ "X${UNAME}" = "XLinux" ]; then
42 route add ${IP} reject
46 if [ "X${UNAME}" = "XFreeBSD" ]; then
47 route -q add ${IP} $LOOPBACK -blackhole
51 # Deleting from null route
52 # be carefull not to remove your default route
53 elif [ "x${ACTION}" = "xdelete" ]; then
54 if [ "X${UNAME}" = "XLinux" ]; then
55 route del ${IP} reject
59 if [ "X${UNAME}" = "XFreeBSD" ]; then
60 route -q delete ${IP} $LOOPBACK -blackhole
66 echo "$0: invalid action: ${ACTION}"