1
|
#!/bin/sh
|
2
|
|
3
|
# Update bogons file
|
4
|
# Part of the pfSense project
|
5
|
# www.pfsense.com
|
6
|
|
7
|
# Grab a random value
|
8
|
value=`od -A n -d -N2 /dev/random | awk '{print int(($1/65536)*2000)}'`
|
9
|
|
10
|
# Sleep for that time.
|
11
|
sleep $value
|
12
|
|
13
|
/etc/rc.conf_mount_rw
|
14
|
/usr/bin/fetch -q -o /tmp/bogons "http://files.pfsense.org/bogon-bn-nonagg.txt"
|
15
|
if [ ! -f /tmp/bogons ]; then
|
16
|
echo "Could not download http://files.pfsense.org/bogon-bn-nonagg.txt" | logger
|
17
|
exit
|
18
|
fi
|
19
|
egrep -v "^192.168.0.0/16|^172.16.0.0/12|^10.0.0.0/8" /tmp/bogons > /etc/bogons
|
20
|
/etc/rc.conf_mount_ro
|
21
|
RESULT=`/sbin/pfctl -t bogons -T replace -f /etc/bogons 2>&1`
|
22
|
rm /tmp/bogons
|
23
|
echo "Bogons file downloaded: $RESULT" | logger
|