From 1c722d02a740a1a252ab90200d83c1942d9e76d3 Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Thu, 19 Aug 2010 23:36:03 -0400 Subject: countryblock added logging and stats modified: config/countryblock/countryblock.inc modified: config/countryblock/countryblock.tmp modified: config/countryblock/countryblock.xml modified: config/countryblock/execute.sh modified: pkg_config.7.xml modified: pkg_config.8.xml modified: pkg_config.8.xml.amd64 --- config/countryblock/countryblock.inc | 6 ++--- config/countryblock/countryblock.tmp | 48 ++++++++++++++++++++++++++++++------ config/countryblock/countryblock.xml | 36 +++++++++++++-------------- config/countryblock/execute.sh | 6 ++++- 4 files changed, 67 insertions(+), 29 deletions(-) (limited to 'config/countryblock') diff --git a/config/countryblock/countryblock.inc b/config/countryblock/countryblock.inc index 1f94dff1..7cab6c1d 100644 --- a/config/countryblock/countryblock.inc +++ b/config/countryblock/countryblock.inc @@ -33,13 +33,13 @@ -function php_sync_package() +function php_sync_package_cb() { global $config; } -function php_install_command() +function php_install_command_cb() { global $config; @@ -88,7 +88,7 @@ function php_install_command() } -function deinstall_command() +function deinstall_command_cb() { conf_mount_rw(); $handle = popen("/usr/local/etc/rc.d/countryblock.sh stop", "r"); diff --git a/config/countryblock/countryblock.tmp b/config/countryblock/countryblock.tmp index c827fc4f..a8196cdc 100644 --- a/config/countryblock/countryblock.tmp +++ b/config/countryblock/countryblock.tmp @@ -74,8 +74,7 @@ if (count($_POST)>0) { $savemsg_cb = "Country Block settings have been saved/updated. "; conf_mount_ro(); } -?> - +?> +

Firewall: Country Block

@@ -119,6 +119,15 @@ mwexec("touch countries.txt"); $output2 = " and Outbound access is ALLOWED."; exec("rm OUTBOUND"); } + + if(isset($_POST['formlogging'])) + { + exec("touch logging"); + } + else + { + exec("rm logging"); + } if(empty($aCountry)) @@ -274,7 +283,7 @@ background-color: #F3F3F3; ?> - of 245 selected. Manual

+ of 246 selected. Manual

Block outbound? select/unselect

+ Enable Logging? +"; + } else { + echo ""; + } +?>
@@ -469,9 +487,9 @@ ob_start(); $results = exec("cat countries.txt | grep AR"); ob_end_clean(); if ($results == 'AR') - echo "
  • Argentia
  • "; + echo "
  • Argentina
  • "; else - echo "
  • Argentia
  • "; + echo "
  • Argentina
  • "; ob_start(); $results = exec("cat countries.txt | grep AM"); @@ -682,9 +700,9 @@ ob_start(); $results = exec("cat countries.txt | grep BF"); ob_end_clean(); if ($results == 'BF') - echo "
  • Burkia Faso
  • "; + echo "
  • Burkina Faso
  • "; else - echo "
  • Burkia Faso
  • "; + echo "
  • Burkina Faso
  • "; ob_start(); $results = exec("cat countries.txt | grep BI"); @@ -1649,6 +1667,14 @@ ob_end_clean(); else echo "
  • Mongolia
  • "; +ob_start(); +$results = exec("cat countries.txt | grep ME"); +ob_end_clean(); + if ($results == 'ME') + echo "
  • Montenegro
  • "; + else + echo "
  • Montenegro
  • "; + ob_start(); $results = exec("cat countries.txt | grep MS"); ob_end_clean(); @@ -2570,6 +2596,14 @@ ob_end_clean(); echo "
    "; echo $results; echo ""; + + //Get IP Count + echo "
    You are blocking "; + ob_start(); + $results = exec("pfctl -T show -t countryblock |grep -v -c Z"); + ob_end_clean(); + echo $results; + echo " IPs"; ?> diff --git a/config/countryblock/countryblock.xml b/config/countryblock/countryblock.xml index a4cffe27..68ed8797 100644 --- a/config/countryblock/countryblock.xml +++ b/config/countryblock/countryblock.xml @@ -41,7 +41,7 @@ Active Internet http://forum.pfsense.org/index.php/topic,25732.0.html Country Block Settings - 0.1.3 + 0.1.5 Settings /usr/local/pkg/countryblock.inc @@ -62,67 +62,67 @@ /usr/local/pkg/ 0755 - http://www.pfsense.com/packages/config/countryblock/countryblock.xml + http://www.pfsense.org/packages/config/countryblock/countryblock.xml /usr/local/pkg/ 0755 - http://www.pfsense.com/packages/config/countryblock/countryblock.inc + http://www.pfsense.org/packages/config/countryblock/countryblock.inc /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/countryblock.tmp + http://www.pfsense.org/packages/config/countryblock/countryblock.tmp /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/execute.sh + http://www.pfsense.org/packages/config/countryblock/execute.sh /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/countryblock.sh + http://www.pfsense.org/packages/config/countryblock/countryblock.sh /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/index.tmp + http://www.pfsense.org/packages/config/countryblock/index.tmp /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/ddaccordion.js + http://www.pfsense.org/packages/config/countryblock/ddaccordion.js /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/jquery.min.js + http://www.pfsense.org/packages/config/countryblock/jquery.min.js /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/public_smo_scripts.js + http://www.pfsense.org/packages/config/countryblock/public_smo_scripts.js /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/titlebar.png + http://www.pfsense.org/packages/config/countryblock/titlebar.png /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/titlebar-active.png + http://www.pfsense.org/packages/config/countryblock/titlebar-active.png /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/purge.tmp + http://www.pfsense.org/packages/config/countryblock/purge.tmp /tmp/ 0755 - http://www.pfsense.com/packages/config/countryblock/whitelist.tmp + http://www.pfsense.org/packages/config/countryblock/whitelist.tmp @@ -141,15 +141,15 @@ - php_sync_package(); + php_sync_package_cb(); - php_sync_package(); + php_sync_package_cb(); - php_install_command(); + php_install_command_cb(); - deinstall_command(); + deinstall_command_cb(); diff --git a/config/countryblock/execute.sh b/config/countryblock/execute.sh index 350cd170..bc3d6d21 100644 --- a/config/countryblock/execute.sh +++ b/config/countryblock/execute.sh @@ -48,7 +48,11 @@ while read line echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp echo "pass quick from to any label 'countryblock'" >> /tmp/rules.debug.tmp echo "pass quick from any to label 'countryblock'" >> /tmp/rules.debug.tmp - echo "block quick from to any label 'countryblock'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from to any label 'countryblock'" >> /tmp/rules.debug.tmp + else + echo "block quick from to any label 'countryblock'" >> /tmp/rules.debug.tmp + fi if [ -f OUTBOUND ]; then echo "block quick from any to label 'countryblock'" >> /tmp/rules.debug.tmp fi -- cgit v1.2.3