Skip to content

Commit

Permalink
firewall: regressing in bogon blocking, we're blocking too many now..
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed May 26, 2016
1 parent 2f26fb0 commit 9def0e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/etc/bogons.sample
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
0.0.0.0/8
10.0.0.0/8
100.64.0.0/10
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.0.0.0/24
192.0.2.0/24
192.168.0.0/16
198.18.0.0/15
198.51.100.0/24
203.0.113.0/24
Expand Down
9 changes: 8 additions & 1 deletion src/etc/inc/filter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,14 @@ EOD;
}

foreach ($FilterIflist as $on => $oc) {
/* block bogon networks via http://www.cymru.com/Documents/bogon-bn-nonagg.txt */
/*
* Block bogon networks via the following list. Note that "bogons"
* are excluding the four private address ranges for one reason or
* another. They exist in the upstream files but are stripped during
* the upgrade stage.
*
* http://www.cymru.com/Documents/bogon-bn-nonagg.txt
*/
if (!isset($config['syslog']['nologbogons'])) {
$bogonlog = 'log';
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/etc/rc.update_bogons
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ if [ "$BOGON_V4_CKSUM" = "$ON_DISK_V4_CKSUM" ] || [ "$BOGON_V6_CKSUM" = "$ON_DIS
ENTRIES_V4=`pfctl -vvsTables | awk '/-\tbogons$/ {getline; print $2}'`
LINES_V4=`wc -l /tmp/bogons | awk '{ print $1 }'`
if [ $ENTRIES_MAX -gt $((2*ENTRIES_TOT-${ENTRIES_V4:-0}+LINES_V4)) ]; then
egrep -v "^192.168.0.0/16|^172.16.0.0/12|^10.0.0.0/8" /tmp/bogons > /usr/local/etc/bogons
# These bogons are removed as they are private. I'm not going
# to question this now, adding a big WARNING instead. Here be
# dragons...
egrep -v "^100.64.0.0/10|^192.168.0.0/16|^172.16.0.0/12|^10.0.0.0/8" /tmp/bogons > /usr/local/etc/bogons
RESULT=`/sbin/pfctl -t bogons -T replace -f /usr/local/etc/bogons 2>&1`
echo "$RESULT" | awk '{ print "Bogons V4 file downloaded: " $0 }' | logger
else
Expand Down

0 comments on commit 9def0e3

Please sign in to comment.