Project

General

Profile

Download (946 Bytes) Statistics
| Branch: | Tag: | Revision:
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, unless an argument is specified.
15
if [ ! $1 ]; then
16
    sleep $value
17
fi    
18

    
19
echo "rc.update_bogons.sh is beginning the update cycle." | logger
20

    
21
/etc/rc.conf_mount_rw
22
/usr/bin/fetch -q -o /tmp/bogons "http://files.pfsense.org/bogon-bn-nonagg.txt"
23
if [ ! -f /tmp/bogons ]; then
24
	echo "Could not download http://files.pfsense.org/bogon-bn-nonagg.txt" | logger
25
	# Relaunch and sleep
26
	sh /etc/rc.update_bogons.sh & 
27
	exit
28
fi
29
egrep -v "^192.168.0.0/16|^172.16.0.0/12|^10.0.0.0/8" /tmp/bogons > /etc/bogons
30
/etc/rc.conf_mount_ro
31
RESULT=`/sbin/pfctl -t bogons -T replace -f /etc/bogons 2>&1`
32
rm /tmp/bogons
33
echo "Bogons file downloaded:  $RESULT" | logger
(78-78/87)