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