Page 1 of 1

External subnet block lists in CIDR notation

Posted: 31 Mar 2022 09:14
by BOOZy
It'd be nice if there was an option to use block lists like the Spamhaus drop and edrop lists.

https://www.spamhaus.org/drop/
https://www.spamhaus.org/drop/drop.txt

This would also allow me to dynamically block IPs from a list generated by a different application in my network.

Re: External subnet block lists in CIDR notation

Posted: 31 Mar 2022 13:38
by freyuh
How about using a cidr table for this: http://www.postfix.org/cidr_table.5.html

So downloading the drop list daily by cron and converting it to a cidr list.
This shouldn't be to complicated ...


Ulrich.

Re: External subnet block lists in CIDR notation

Posted: 31 Mar 2022 14:04
by freyuh
wget http://www.spamhaus.org/drop/drop.txt
wget http://www.spamhaus.org/drop/dropv6.txt
wget http://www.spamhaus.org/drop/edrop.txt

cat drop.txt | sed -e 's/;.*//' | grep -v '^ *$' | ( while read OneAddr ; do echo "$OneAddr reject" ; done ) > Spamhaus_drop.cidr
cat dropv6.txt | sed -e 's/;.*//' | grep -v '^ *$' | ( while read OneAddr ; do echo "$OneAddr reject" ; done ) > Spamhaus_dropv6.cidr
cat edrop.txt | sed -e 's/;.*//' | grep -v '^ *$' | ( while read OneAddr ; do echo "$OneAddr reject" ; done ) > Spamhaus_edrop.cidr