summaryrefslogtreecommitdiffstats
path: root/etc/rc.update_bogons.sh
blob: 33c3f4e1bea8df132f43aac5f8547a06ecdc4234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# Update bogons file
# Part of the pfSense project
# www.pfsense.com

# Grab a random value 
value=`hexdump -n1 -e\"%u\" /dev/random`

# Sleep for that time.
sleep $value

/etc/rc.conf_mount_rw
/usr/bin/fetch -q -o /tmp/bogons "http://www.pfsense.com/mirrors/bogon-bn-nonagg.txt"
if [ ! -f /tmp/bogons ]; then
	echo "Could not download http://www.pfsense.com/mirrors/bogon-bn-nonagg.txt" | logger
	exit
fi
egrep -v "^192.168.0.0/16|^172.16.0.0/12|^10.0.0.0/8" /tmp/bogons > /etc/bogons
/etc/rc.conf_mount_ro
/sbin/pfctl -t bogons -T replace -f /etc/bogons
rm /tmp/bogons
OpenPOWER on IntegriCloud