Begin adding support for bogons filtering, plus auto updating

master
bruns@2mbit.com 2009-09-25 01:02:23 +00:00
parent 7cd42ed7be
commit cdb55dcf69
3 changed files with 68 additions and 0 deletions

View File

@ -1,3 +1,7 @@
0.7 - Brielle Bruns <bruns@2mbit.com>
- Beginning support for bogons filtering and updater
script.
0.6 - Brielle Bruns <bruns@2mbit.com>
- Fixed some potential ordering issues with NAT
- Added file for blocked IPs, plus new config option

23
include/bogon-bn-agg.txt Normal file
View File

@ -0,0 +1,23 @@
0.0.0.0/7
5.0.0.0/8
14.0.0.0/8
23.0.0.0/8
27.0.0.0/8
31.0.0.0/8
36.0.0.0/7
39.0.0.0/8
42.0.0.0/8
49.0.0.0/8
50.0.0.0/8
100.0.0.0/6
104.0.0.0/6
127.0.0.0/8
169.254.0.0/16
176.0.0.0/7
179.0.0.0/8
181.0.0.0/8
185.0.0.0/8
192.0.2.0/24
198.18.0.0/15
223.0.0.0/8
224.0.0.0/3

41
include/update-bogons Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# Script to auto update bogons file for use with firewall script
VERSION="0.1"
WGET=/usr/bin/wget
PREFIX=`pwd`
BOGONSFILE=$PREFIX/bogon-bn-agg.txt
BOGONSURL="http://www.cymru.com/Documents/bogon-bn-agg.txt"
REMOVECIDR="(192.168.0.0|10.0.0.0|172.16.0.0)"
if [ ! -x $WGET ]; then
echo "wget command not found or executable. Please"
echo "edit the update-bogons script."
exit 1
fi
echo "Bogons update script - Version $VERSION"
echo -e "Part of Firewall/SOSDG - http://www.sosdg.org \n"
echo "Uses The Team Cymru Bogon List located at:"
echo -e "http://www.cymru.com/Documents/bogon-list.html\n"
if `wget -q -O $BOGONSFILE.new $BOGONSURL`; then
echo "Downloaded new bogons file..."
mv $BOGONSFILE $BOGONSFILE.old &>/dev/null
echo "Backed up $BOGONSFILE to .old..."
if [ $REMOVECIDR ]; then
grep -vE -e "$REMOVECIDR" $BOGONSFILE.new > $BOGONSFILE
echo "Removed blocks listed in REMOVECIDR..."
rm -f $BOGONSFILE.new
else
mv $BOGONSFILE.new $BOGONSFILE
echo "Replaced old bogons file with new one."
fi
else
echo "Error downloading bogons file. Please try again later."
rm -f $BOGONSFILE.new
exit 1
fi
exit 0