aboutsummaryrefslogtreecommitdiffstats
path: root/config/countryblock
diff options
context:
space:
mode:
authorTom Schaefer <tom@tomschaefer.org>2010-08-19 23:36:03 -0400
committerTom Schaefer <tom@tomschaefer.org>2010-08-19 23:36:03 -0400
commit1c722d02a740a1a252ab90200d83c1942d9e76d3 (patch)
treeccc0fc5a14fb83fba7cdd7318b5f2c390540e123 /config/countryblock
parentcb04733b4420ba7d590a2ab3aee1317f8e98cca9 (diff)
downloadpfsense-packages-1c722d02a740a1a252ab90200d83c1942d9e76d3.tar.gz
pfsense-packages-1c722d02a740a1a252ab90200d83c1942d9e76d3.tar.bz2
pfsense-packages-1c722d02a740a1a252ab90200d83c1942d9e76d3.zip
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
Diffstat (limited to 'config/countryblock')
-rw-r--r--config/countryblock/countryblock.inc6
-rw-r--r--config/countryblock/countryblock.tmp48
-rw-r--r--config/countryblock/countryblock.xml36
-rw-r--r--config/countryblock/execute.sh6
4 files changed, 67 insertions, 29 deletions
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();
}
-?>
-<head>
+?><head>
<?php include("fbegin.inc"); ?>
<style type="text/css">
<!--
@@ -85,6 +84,7 @@ if (count($_POST)>0) {
-->
</style>
+
<p class="pgtitle">Firewall: Country Block</p>
<form method=POST action="">
@@ -119,6 +119,15 @@ mwexec("touch countries.txt");
$output2 = " and Outbound access is ALLOWED.</b>";
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. <a href="whitelist.php" target="_parent"><img src="../../themes/nervecenter/images/icons/icon_plus.gif" ALT="Manual" ALIGN=RIGHT></a></p>
+ of 246 selected. <a href="whitelist.php" target="_parent"><img src="../../themes/nervecenter/images/icons/icon_plus.gif" ALT="Manual" ALIGN=RIGHT></a></p>
<p>
Block outbound?
<?php
@@ -288,6 +297,15 @@ background-color: #F3F3F3;
<input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/>select/unselect
</p>
+ Enable Logging?
+<?php
+
+ if (file_exists("logging")) {
+ echo "<input name='formlogging' type='checkbox' value='Yes' checked/>";
+ } else {
+ echo "<input name='formlogging' type='checkbox' value='Yes'/>";
+ }
+?>
<br/>
@@ -469,9 +487,9 @@ ob_start();
$results = exec("cat countries.txt | grep AR");
ob_end_clean();
if ($results == 'AR')
- echo " <li><input name='formCountry[]' type='checkbox' value='AR' checked/>Argentia</li>";
+ echo " <li><input name='formCountry[]' type='checkbox' value='AR' checked/>Argentina</li>";
else
- echo " <li><input name='formCountry[]' type='checkbox' value='AR' />Argentia</li>";
+ echo " <li><input name='formCountry[]' type='checkbox' value='AR' />Argentina</li>";
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 "<li><input name='formCountry[]' type='checkbox' value='BF' checked/>Burkia Faso</li>";
+ echo "<li><input name='formCountry[]' type='checkbox' value='BF' checked/>Burkina Faso</li>";
else
- echo "<li><input name='formCountry[]' type='checkbox' value='BF' />Burkia Faso</li>";
+ echo "<li><input name='formCountry[]' type='checkbox' value='BF' />Burkina Faso</li>";
ob_start();
$results = exec("cat countries.txt | grep BI");
@@ -1650,6 +1668,14 @@ ob_end_clean();
echo "<li><input name='formCountry[]' type='checkbox' value='MN' />Mongolia</li>";
ob_start();
+$results = exec("cat countries.txt | grep ME");
+ob_end_clean();
+ if ($results == 'ME')
+ echo "<li><input name='formCountry[]' type='checkbox' value='ME' checked/>Montenegro</li>";
+ else
+ echo "<li><input name='formCountry[]' type='checkbox' value='ME' />Montenegro</li>";
+
+ob_start();
$results = exec("cat countries.txt | grep MS");
ob_end_clean();
if ($results == 'MS')
@@ -2570,6 +2596,14 @@ ob_end_clean();
echo "<br/><span style='color:red'>";
echo $results;
echo "</span>";
+
+ //Get IP Count
+ echo "<br>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 @@
<requirements>Active Internet</requirements>
<faq>http://forum.pfsense.org/index.php/topic,25732.0.html</faq>
<name>Country Block Settings</name>
- <version>0.1.3</version>
+ <version>0.1.5</version>
<title>Settings</title>
<include_file>/usr/local/pkg/countryblock.inc</include_file>
<menu>
@@ -62,67 +62,67 @@
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/countryblock.xml</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/countryblock.inc</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/countryblock.tmp</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock.tmp</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/execute.sh</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/execute.sh</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/countryblock.sh</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock.sh</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/index.tmp</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/index.tmp</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/ddaccordion.js</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/ddaccordion.js</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/jquery.min.js</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/jquery.min.js</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/public_smo_scripts.js</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/public_smo_scripts.js</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/titlebar.png</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/titlebar.png</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/titlebar-active.png</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/titlebar-active.png</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/purge.tmp</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/purge.tmp</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/countryblock/whitelist.tmp</item>
+ <item>http://www.pfsense.org/packages/config/countryblock/whitelist.tmp</item>
</additional_files_needed>
<fields>
<field>
@@ -141,15 +141,15 @@
<custom_add_php_command>
</custom_add_php_command>
<custom_php_resync_config_command>
- php_sync_package();
+ php_sync_package_cb();
</custom_php_resync_config_command>
<custom_delete_php_command>
- php_sync_package();
+ php_sync_package_cb();
</custom_delete_php_command>
<custom_php_install_command>
- php_install_command();
+ php_install_command_cb();
</custom_php_install_command>
<custom_php_deinstall_command>
- deinstall_command();
+ deinstall_command_cb();
</custom_php_deinstall_command>
</packagegui>
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 <countryblockW> persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp
echo "pass quick from <countryblockW> to any label 'countryblock'" >> /tmp/rules.debug.tmp
echo "pass quick from any to <countryblockW> label 'countryblock'" >> /tmp/rules.debug.tmp
- echo "block quick from <countryblock> to any label 'countryblock'" >> /tmp/rules.debug.tmp
+ if [ -f logging ]; then
+ echo "block log quick from <countryblock> to any label 'countryblock'" >> /tmp/rules.debug.tmp
+ else
+ echo "block quick from <countryblock> to any label 'countryblock'" >> /tmp/rules.debug.tmp
+ fi
if [ -f OUTBOUND ]; then
echo "block quick from any to <countryblock> label 'countryblock'" >> /tmp/rules.debug.tmp
fi