[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[off-topic] iptables and blocklist



I am running debian amd64 and wondering what would be to integrate a block list and iptables. I am thinking of using block lists similar to this http://list.iblocklist.com/?list=bt_spyware. When I tried importing one such block list after parsing it with the script list below I get the following error "iptables: memory allocation problem"

BLOCKLIST="/etc/blocklist.gz"
IPTABLES="/sbin/iptables"
SED="/bin/sed"

while read line
do
       ip_range=`echo -n $line | $SED -e 's/.*:\(.*\)-\(.*\)/\1-\2/'`;
$IPTABLES --append INPUT --match iprange --src-range $ip_range --jump DROP $IPTABLES --append OUTPUT --match iprange --dst-range $ip_range --jump DROP
done < <(zcat ${BLOCKLIST} | iconv -f latin1 -t utf-8 - | dos2unix)



I feel that this because of the large number of rules that are being created. My question would be what would be a good way to block large number of ip ranges with iptables.

Thanks,

Bharath


Reply to: