From 17c0885cd557181cfc81ed481dccfa5d8ce78f4a Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 9 Dec 2014 16:32:41 +0100 Subject: [PATCH] etc: move bogons* --- {etc => usr/local/etc}/bogons | 0 {etc => usr/local/etc}/bogonsv6 | 0 usr/local/etc/inc/filter.inc | 12 ++++++------ usr/local/etc/rc.update_bogons.sh | 15 +++++---------- 4 files changed, 11 insertions(+), 16 deletions(-) rename {etc => usr/local/etc}/bogons (100%) rename {etc => usr/local/etc}/bogonsv6 (100%) diff --git a/etc/bogons b/usr/local/etc/bogons similarity index 100% rename from etc/bogons rename to usr/local/etc/bogons diff --git a/etc/bogonsv6 b/usr/local/etc/bogonsv6 similarity index 100% rename from etc/bogonsv6 rename to usr/local/etc/bogonsv6 diff --git a/usr/local/etc/inc/filter.inc b/usr/local/etc/inc/filter.inc index 25c53d9ae..40aece208 100644 --- a/usr/local/etc/inc/filter.inc +++ b/usr/local/etc/inc/filter.inc @@ -589,13 +589,13 @@ function filter_generate_aliases() { $aliases .= "#Snort tables\n"; $aliases .= "table \n"; $aliases .= "table \n"; - if (!file_exists("/etc/bogons")) - @file_put_contents("/etc/bogons", ""); - if (!file_exists("/etc/bogonsv6")) - @file_put_contents("/etc/bogonsv6", ""); - $aliases .= "table persist file \"/etc/bogons\"\n"; + if (!file_exists("/usr/local/etc/bogons")) + @file_put_contents("/usr/local/etc/bogons", ""); + if (!file_exists("/usr/local/etc/bogonsv6")) + @file_put_contents("/usr/local/etc/bogonsv6", ""); + $aliases .= "table persist file \"/usr/local/etc/bogons\"\n"; if (is_bogonsv6_used()) - $aliases .= "table persist file \"/etc/bogonsv6\"\n"; + $aliases .= "table persist file \"/usr/local/etc/bogonsv6\"\n"; $vpns_list = filter_get_vpns_list(); if($vpns_list) diff --git a/usr/local/etc/rc.update_bogons.sh b/usr/local/etc/rc.update_bogons.sh index 47b3c000b..f089cd97d 100755 --- a/usr/local/etc/rc.update_bogons.sh +++ b/usr/local/etc/rc.update_bogons.sh @@ -69,11 +69,6 @@ fi echo "rc.update_bogons.sh is beginning the update cycle." | logger -# Load custom bogon configuration -if [ -f /var/etc/bogon_custom ]; then - . /var/etc/bogon_custom -fi - # Set default values if not overriden v4url=${v4url:-"https://files.pfsense.org/lists/fullbogons-ipv4.txt"} v6url=${v6url:-"https://files.pfsense.org/lists/fullbogons-ipv6.txt"} @@ -105,8 +100,8 @@ 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 > /etc/bogons - RESULT=`/sbin/pfctl -t bogons -T replace -f /etc/bogons 2>&1` + egrep -v "^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 echo "Not updating IPv4 bogons (increase table-entries limit)" | logger @@ -124,15 +119,15 @@ if [ "$BOGON_V4_CKSUM" = "$ON_DISK_V4_CKSUM" ] || [ "$BOGON_V6_CKSUM" = "$ON_DIS if [ $BOGONS_V6_TABLE_COUNT -gt 0 ]; then ENTRIES_V6=`pfctl -vvsTables | awk '/-\tbogonsv6$/ {getline; print $2}'` if [ $ENTRIES_MAX -gt $((2*ENTRIES_TOT-${ENTRIES_V6:-0}+LINES_V6)) ]; then - egrep -iv "^fc00::/7" /tmp/bogonsv6 > /etc/bogonsv6 - RESULT=`/sbin/pfctl -t bogonsv6 -T replace -f /etc/bogonsv6 2>&1` + egrep -iv "^fc00::/7" /tmp/bogonsv6 > /usr/local/etc/bogonsv6 + RESULT=`/sbin/pfctl -t bogonsv6 -T replace -f /usr/local/etc/bogonsv6 2>&1` echo "$RESULT" | awk '{ print "Bogons V6 file downloaded: " $0 }' | logger else echo "Not saving or updating IPv6 bogons (increase table-entries limit)" | logger fi else if [ $ENTRIES_MAX -gt $((2*ENTRIES_TOT+LINES_V6)) ]; then - egrep -iv "^fc00::/7" /tmp/bogonsv6 > /etc/bogonsv6 + egrep -iv "^fc00::/7" /tmp/bogonsv6 > /usr/local/etc/bogonsv6 echo "Bogons V6 file downloaded but not updating IPv6 bogons table because IPv6 Allow is off" | logger else echo "Not saving IPv6 bogons table (IPv6 Allow is off and table-entries limit is potentially too low)" | logger