Commit 17c0885c authored by Franco Fichtner's avatar Franco Fichtner

etc: move bogons*

parent 36f79213
......@@ -589,13 +589,13 @@ function filter_generate_aliases() {
$aliases .= "#Snort tables\n";
$aliases .= "table <snort2c>\n";
$aliases .= "table <virusprot>\n";
if (!file_exists("/etc/bogons"))
@file_put_contents("/etc/bogons", "");
if (!file_exists("/etc/bogonsv6"))
@file_put_contents("/etc/bogonsv6", "");
$aliases .= "table <bogons> 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 <bogons> persist file \"/usr/local/etc/bogons\"\n";
if (is_bogonsv6_used())
$aliases .= "table <bogonsv6> persist file \"/etc/bogonsv6\"\n";
$aliases .= "table <bogonsv6> persist file \"/usr/local/etc/bogonsv6\"\n";
$vpns_list = filter_get_vpns_list();
if($vpns_list)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment