From 7c61cec6833ae3c9dcb6a8105ef75af35a785016 Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Mon, 31 Jan 2011 13:39:26 -0500 Subject: Update to be independant of countryipblocks site to relieve bandwidth --- config/countryblock/countryblock.inc | 15 +- config/countryblock/countryblock.sh | 168 +++++++------- config/countryblock/countryblock.tmp | 57 ++++- config/countryblock/countryblock.xml | 395 ++++++++++++++++---------------- config/countryblock/countryblock_if.tmp | 0 config/countryblock/email.tmp | 0 config/countryblock/execute.sh | 168 +++++++------- config/countryblock/firewall_shaper.tmp | 0 config/countryblock/help.tmp | 0 config/countryblock/interfaces.txt | 0 config/countryblock/settings.tmp | 0 config/countryblock/whitelist.tmp | 0 12 files changed, 436 insertions(+), 367 deletions(-) mode change 100755 => 100644 config/countryblock/countryblock.sh mode change 100755 => 100644 config/countryblock/countryblock.tmp mode change 100755 => 100644 config/countryblock/countryblock_if.tmp mode change 100755 => 100644 config/countryblock/email.tmp mode change 100755 => 100644 config/countryblock/execute.sh mode change 100755 => 100644 config/countryblock/firewall_shaper.tmp mode change 100755 => 100644 config/countryblock/help.tmp mode change 100755 => 100644 config/countryblock/interfaces.txt mode change 100755 => 100644 config/countryblock/settings.tmp mode change 100755 => 100644 config/countryblock/whitelist.tmp (limited to 'config') diff --git a/config/countryblock/countryblock.inc b/config/countryblock/countryblock.inc index 902bcad5..25077311 100644 --- a/config/countryblock/countryblock.inc +++ b/config/countryblock/countryblock.inc @@ -4,7 +4,7 @@ /* ========================================================================== */ /* countryblock.inc - Copyright (C) 2010 Tom Schaefer + Copyright (C) 2011 Tom Schaefer All rights reserved. */ /* ========================================================================== */ @@ -54,6 +54,11 @@ function php_install_command_cb() exec("mkdir /usr/local/www/packages/countryblock/"); } + if (!is_dir('/usr/local/www/packages/countryblock/CIDR')) { + exec("mkdir /usr/local/www/packages/countryblock/CIDR"); + } + + //rename PHP files from .tmp to .php @@ -97,7 +102,15 @@ function php_install_command_cb() exec("cp /tmp/interfaces.txt /usr/local/www/packages/countryblock/interfaces.txt"); unlink_if_exists("/tmp/interfaces.txt"); + exec("cp /tmp/CIDR.tar.gz /usr/local/www/packages/countryblock/CIDR.tar.gz"); + unlink_if_exists("/tmp/CIDR.tar.gz"); + exec("tar xzf /usr/local/www/packages/countryblock/CIDR.tar.gz -C /usr/local/www/packages/countryblock/CIDR"); + exec("rm /usr/local/www/packages/countryblock/CIDR.tar.gz"); + + exec("mkdir /usr/local/www/packages/countryblock/lists"); + exec("touch /usr/local/www/packages/countryblock/lists/countries.txt"); + conf_mount_ro(); config_unlock(); diff --git a/config/countryblock/countryblock.sh b/config/countryblock/countryblock.sh old mode 100755 new mode 100644 index 11a8c335..c979045d --- a/config/countryblock/countryblock.sh +++ b/config/countryblock/countryblock.sh @@ -1,84 +1,84 @@ -#!/bin/sh - -#check if countryblock running -export resultr=`pfctl -s rules | grep -c countryblock` -#echo $resultr -if [ "$resultr" -gt "0" ]; then - echo running - exit 1 -else - echo not running - /usr/bin/logger -s "Countryblock was found not running" - echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php -fi - -pfctl -t countryblock -T kill -sed -i -e '/countryblock/d' /tmp/rules.debug - -#Now edit /tmp/rules.debug - -#find my line for table -export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` -export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` - -i=$(($i+'1')) -t=$(($t+'1')) -#i = line where is -#t is where 'User Aliases' is -echo $i -echo $t - -rm /tmp/rules.debug.tmp - -#Insert table-entry limit -sed -i -e '/900000/d' /tmp/rules.debug -while read line - do a=$(($a+1)); - #echo $a; - if [ "$a" = "$t" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 - -rm /tmp/rules.debug.tmp - -#Insert countryblock rules -a="0" -echo $a -while read line - do a=$(($a+1)); - echo $a; - if [ "$a" = "$i" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "#countryblock" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp - - for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do - echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - if [ -f logging ]; then - echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - else - echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - fi - if [ -f OUTBOUND ]; then - echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - fi - done - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -rm errorOUT.txt -pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 +#!/bin/sh + +#check if countryblock running +export resultr=`pfctl -s rules | grep -c countryblock` +#echo $resultr +if [ "$resultr" -gt "0" ]; then + echo running + exit 1 +else + echo not running + /usr/bin/logger -s "Countryblock was found not running" + echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php +fi + +pfctl -t countryblock -T kill +sed -i -e '/countryblock/d' /tmp/rules.debug + +#Now edit /tmp/rules.debug + +#find my line for table +export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` +export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` + +i=$(($i+'1')) +t=$(($t+'1')) +#i = line where is +#t is where 'User Aliases' is +echo $i +echo $t + +rm /tmp/rules.debug.tmp + +#Insert table-entry limit +sed -i -e '/900000/d' /tmp/rules.debug +while read line + do a=$(($a+1)); + #echo $a; + if [ "$a" = "$t" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 + +rm /tmp/rules.debug.tmp + +#Insert countryblock rules +a="0" +echo $a +while read line + do a=$(($a+1)); + echo $a; + if [ "$a" = "$i" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "#countryblock" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp + + for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do + echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + else + echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + fi + if [ -f OUTBOUND ]; then + echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + fi + done + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +rm errorOUT.txt +pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 diff --git a/config/countryblock/countryblock.tmp b/config/countryblock/countryblock.tmp old mode 100755 new mode 100644 index 605b0d3a..94fffcc3 --- a/config/countryblock/countryblock.tmp +++ b/config/countryblock/countryblock.tmp @@ -41,7 +41,9 @@ if (count($_POST)>0) { exec("mkdir lists"); foreach ($lines as $line) { //echo("fetch -o lists http://www.countryipblocks.net/e_country_data/{$line}_cidr.txt"); - exec("fetch -o lists/temp http://www.countryipblocks.net/e_country_data/{$line}_cidr.txt"); + //Fetch countries from server + exec("fetch -o lists/temp http://127.0.0.1//packages/countryblock/CIDR/{$line}_cidr.txt"); + //exec("fetch -o lists/temp http://www.countryipblocks.net/e_country_data/{$line}_cidr.txt"); exec("cat lists/temp >> lists/countries.txt"); $filename = basename($line); //Extract list @@ -80,7 +82,7 @@ if (count($_POST)>0) { -

+
@@ -304,7 +306,7 @@ background-color: #F3F3F3; ?> - of 246 selected. select/unselect + of 252 selected. select/unselect
@@ -639,6 +641,14 @@ ob_end_clean(); echo "
  • Bolivia
  • "; else echo "
  • Bolivia
  • "; + +ob_start(); +$results = exec("cat countries.txt | grep BQ"); +ob_end_clean(); + if ($results == 'BQ') + echo "
  • Bonaire, Saint Eustatius and Saba
  • "; + else + echo "
  • Bonaire, Saint Eustatius and Saba
  • "; ob_start(); $results = exec("cat countries.txt | grep BA"); @@ -868,6 +878,15 @@ ob_end_clean(); echo "
  • Cuba
  • "; else echo "
  • Cuba
  • "; + +ob_start(); +$results = exec("cat countries.txt | grep CW"); +ob_end_clean(); + if ($results == 'CW') + echo "
  • Curacao
  • "; + else + echo "
  • Curacao
  • "; + ob_start(); $results = exec("cat countries.txt | grep CY"); @@ -1361,6 +1380,14 @@ ob_end_clean(); echo "
  • Japan
  • "; else echo "
  • Japan
  • "; + +ob_start(); +$results = exec("cat countries.txt | grep JE"); +ob_end_clean(); + if ($results == 'JE') + echo "
  • Jersey
  • "; + else + echo "
  • Jersey
  • "; ob_start(); $results = exec("cat countries.txt | grep JO"); @@ -2012,6 +2039,14 @@ ob_end_clean();
      Saint Barthelemy"; + else + echo "
    • Saint Barthelemy
    • "; + ob_start(); $results = exec("cat countries.txt | grep SH"); ob_end_clean(); @@ -2035,6 +2070,14 @@ ob_end_clean(); echo "
    • Saint Lucia
    • "; else echo "
    • Saint Lucia
    • "; + +ob_start(); +$results = exec("cat countries.txt | grep MF"); +ob_end_clean(); + if ($results == 'MF') + echo "
    • Saint Martin
    • "; + else + echo "
    • Saint Martin
    • "; ob_start(); $results = exec("cat countries.txt | grep PM"); @@ -2123,6 +2166,14 @@ ob_end_clean(); echo "
    • Singapore
    • "; else echo "
    • Singapore
    • "; + +ob_start(); +$results = exec("cat countries.txt | grep SX"); +ob_end_clean(); + if ($results == 'SX') + echo "
    • Sint Maarten
    • "; + else + echo "
    • Sint Maarten
    • "; ob_start(); $results = exec("cat countries.txt | grep SK"); diff --git a/config/countryblock/countryblock.xml b/config/countryblock/countryblock.xml index c58fc917..a91a5ed7 100644 --- a/config/countryblock/countryblock.xml +++ b/config/countryblock/countryblock.xml @@ -1,195 +1,200 @@ - - - - - - - - Country Block - Active Internet - http://forum.pfsense.org/index.php/topic,25732.0.html - Country Block Settings - 0.1.9 - Settings - /usr/local/pkg/countryblock.inc - - Country Block - Country Block settings -
      Firewall
      - countryblock.xml - /packages/countryblock/countryblock.php -
      - - - Settings - /packages/countryblock/countryblock.php - - - - installedpackages->package->$packagename->configuration->countryblock - - /usr/local/pkg/ - 0755 - http://www.pfsense.org/packages/config/countryblock/countryblock.xml - - - /usr/local/pkg/ - 0755 - http://www.pfsense.org/packages/config/countryblock/countryblock.inc - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/interfaces.txt - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/countryblock.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/execute.sh - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/countryblock.sh - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/index.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/ddaccordion.js - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/jquery.min.js - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/public_smo_scripts.js - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/titlebar.png - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/titlebar-active.png - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/purge.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/whitelist.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/countryblock_if.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/firewall_shaper.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/help.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/settings.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/class.phpmailer.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/class.smtp.tmp - - - /tmp/ - 0755 - http://www.pfsense.org/packages/config/countryblock/email.tmp - - - - Variable One - var1 - Enter the variable one here. - input - - - Variable Two - var1 - Enter the variable one here. - input - - - - - - php_sync_package_cb(); - - - php_sync_package_cb(); - - - php_install_command_cb(); - - - deinstall_command_cb(); - -
      + + + + + + + + Country Block + Active Internet + http://forum.pfsense.org/index.php/topic,25732.0.html + Country Block Settings + 0.2.0 + Settings + /usr/local/pkg/countryblock.inc + + Country Block + Country Block settings +
      Firewall
      + countryblock.xml + /packages/countryblock/countryblock.php +
      + + + Settings + /packages/countryblock/countryblock.php + + + + installedpackages->package->$packagename->configuration->countryblock + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/countryblock/countryblock.xml + + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/countryblock/countryblock.inc + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/interfaces.txt + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/countryblock.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/execute.sh + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/countryblock.sh + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/index.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/ddaccordion.js + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/jquery.min.js + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/public_smo_scripts.js + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/titlebar.png + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/titlebar-active.png + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/purge.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/whitelist.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/countryblock_if.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/firewall_shaper.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/help.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/settings.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/class.phpmailer.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/class.smtp.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/email.tmp + + + /tmp/ + 0755 + http://www.pfsense.org/packages/config/countryblock/CIDR.tar.gz + + + + Variable One + var1 + Enter the variable one here. + input + + + Variable Two + var1 + Enter the variable one here. + input + + + + + + php_sync_package_cb(); + + + php_sync_package_cb(); + + + php_install_command_cb(); + + + deinstall_command_cb(); + +
      diff --git a/config/countryblock/countryblock_if.tmp b/config/countryblock/countryblock_if.tmp old mode 100755 new mode 100644 diff --git a/config/countryblock/email.tmp b/config/countryblock/email.tmp old mode 100755 new mode 100644 diff --git a/config/countryblock/execute.sh b/config/countryblock/execute.sh old mode 100755 new mode 100644 index 41f6d2cf..f30e9d20 --- a/config/countryblock/execute.sh +++ b/config/countryblock/execute.sh @@ -1,84 +1,84 @@ -#!/bin/sh - -#is countryblock running -#export resultr=`pfctl -s rules | grep -c countryblock` -#echo $resultr -#if [ "$resultr" -gt "0" ]; then -# echo running -# exit 1 -#else -# echo not running -# /usr/bin/logger -s "Countryblock was found not running" -# echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php -#fi - -pfctl -t countryblock -T kill -sed -i -e '/countryblock/d' /tmp/rules.debug - -#Now edit /tmp/rules.debug - -#find my line for table -export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` -export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` - -i=$(($i+'1')) -t=$(($t+'1')) -#i = line where is -#t is where 'User Aliases' is -echo $i -echo $t - -rm /tmp/rules.debug.tmp - -#Insert table-entry limit -sed -i -e '/900000/d' /tmp/rules.debug -while read line - do a=$(($a+1)); - #echo $a; - if [ "$a" = "$t" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 - -rm /tmp/rules.debug.tmp - -#Insert countryblock rules -a="0" -echo $a -while read line - do a=$(($a+1)); - echo $a; - if [ "$a" = "$i" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "#countryblock" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp - - for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do - echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - if [ -f logging ]; then - echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - else - echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - fi - if [ -f OUTBOUND ]; then - echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - fi - done - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -rm errorOUT.txt -pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 +#!/bin/sh + +#is countryblock running +#export resultr=`pfctl -s rules | grep -c countryblock` +#echo $resultr +#if [ "$resultr" -gt "0" ]; then +# echo running +# exit 1 +#else +# echo not running +# /usr/bin/logger -s "Countryblock was found not running" +# echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php +#fi + +pfctl -t countryblock -T kill +sed -i -e '/countryblock/d' /tmp/rules.debug + +#Now edit /tmp/rules.debug + +#find my line for table +export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` +export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` + +i=$(($i+'1')) +t=$(($t+'1')) +#i = line where is +#t is where 'User Aliases' is +echo $i +echo $t + +rm /tmp/rules.debug.tmp + +#Insert table-entry limit +sed -i -e '/900000/d' /tmp/rules.debug +while read line + do a=$(($a+1)); + #echo $a; + if [ "$a" = "$t" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 + +rm /tmp/rules.debug.tmp + +#Insert countryblock rules +a="0" +echo $a +while read line + do a=$(($a+1)); + echo $a; + if [ "$a" = "$i" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "#countryblock" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp + + for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do + echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + else + echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + fi + if [ -f OUTBOUND ]; then + echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + fi + done + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +rm errorOUT.txt +pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 diff --git a/config/countryblock/firewall_shaper.tmp b/config/countryblock/firewall_shaper.tmp old mode 100755 new mode 100644 diff --git a/config/countryblock/help.tmp b/config/countryblock/help.tmp old mode 100755 new mode 100644 diff --git a/config/countryblock/interfaces.txt b/config/countryblock/interfaces.txt old mode 100755 new mode 100644 diff --git a/config/countryblock/settings.tmp b/config/countryblock/settings.tmp old mode 100755 new mode 100644 diff --git a/config/countryblock/whitelist.tmp b/config/countryblock/whitelist.tmp old mode 100755 new mode 100644 -- cgit v1.2.3