diff options
Diffstat (limited to 'config')
-rwxr-xr-x | config/ipblocklist/convert-execute.sh | 11 | ||||
-rwxr-xr-x | config/ipblocklist/ipblocklist.inc | 39 | ||||
-rwxr-xr-x | config/ipblocklist/ipblocklist.tmp | 38 | ||||
-rwxr-xr-x | config/ipblocklist/ipblocklist.xml | 32 |
4 files changed, 65 insertions, 55 deletions
diff --git a/config/ipblocklist/convert-execute.sh b/config/ipblocklist/convert-execute.sh index d4e4a687..916cd1b5 100755 --- a/config/ipblocklist/convert-execute.sh +++ b/config/ipblocklist/convert-execute.sh @@ -1,5 +1,5 @@ #!/bin/sh -#Version 2.1 +#Version 2.2 logging #kill tables to elminate dups pfctl -t ipblocklist -T kill @@ -86,8 +86,13 @@ while read line echo "table <ipblocklistW> persist file '/usr/local/www/packages/ipblocklist/Wlists/whitelist'" >> /tmp/rules.debug.tmp echo "pass quick from <ipblocklistW> to any label 'IP-Blocklist'" >> /tmp/rules.debug.tmp echo "pass quick from any to <ipblocklistW> label 'IP-Blocklist'" >> /tmp/rules.debug.tmp - echo "block quick from <ipblocklist> to any label 'IP-Blocklist'" >> /tmp/rules.debug.tmp - echo "block quick from any to <ipblocklist> label 'IP-Blocklist'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from <ipblocklist> to any label 'IP-Blocklist'" >> /tmp/rules.debug.tmp + echo "block log quick from any to <ipblocklist> label 'IP-Blocklist'" >> /tmp/rules.debug.tmp + else + echo "block quick from <ipblocklist> to any label 'IP-Blocklist'" >> /tmp/rules.debug.tmp + echo "block quick from any to <ipblocklist> label 'IP-Blocklist'" >> /tmp/rules.debug.tmp + fi fi echo $line >> /tmp/rules.debug.tmp done < "/tmp/rules.debug" diff --git a/config/ipblocklist/ipblocklist.inc b/config/ipblocklist/ipblocklist.inc index bab40e4b..0bb7bfb1 100755 --- a/config/ipblocklist/ipblocklist.inc +++ b/config/ipblocklist/ipblocklist.inc @@ -3,7 +3,7 @@ /* /* ========================================================================== */ /* - ipblocklist.inc v2.1 + ipblocklist.inc Copyright (C) 2010 Tom Schaefer All rights reserved. */ @@ -30,42 +30,15 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -function pkg_is_service_running($servicename) -{ - exec("/bin/ps ax | awk '{ print $5 }'", $psout); - array_shift($psout); - foreach($psout as $line) { - $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); - } - if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { - return true; - } - else { - return false; - } -} */ -function byte_convert( $bytes ) { - if ($bytes<=0) - return '0 Byte'; - - $convention=1000; //[1000->10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; -} - - - -function php_sync_package() +function php_sync_package_ip() { global $config; } -function php_install_command() +function php_install_command_ip() { global $config; @@ -82,8 +55,8 @@ function php_install_command() //install PERL - exec("pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/All/perl-5.8.9_2.tbz"); - exec("pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/All/p5-Net-CIDR-0.13.tbz"); + exec("pkg_add -r http://www.pfsense.org/packages/config/ipblocklist/perl-5.8.9_2.tbz"); + exec("pkg_add -r http://www.pfsense.org/packages/config/ipblocklist/p5-Net-CIDR-0.13.tbz"); //rename PHP files from .tmp to .php exec("cp /tmp/ipblocklist.tmp /usr/local/www/packages/ipblocklist/ipblocklist.php"); @@ -115,7 +88,7 @@ function php_install_command() } -function deinstall_command() +function deinstall_command_ip() { conf_mount_rw(); $handle = popen("/usr/local/etc/rc.d/ipblocklist.sh stop", "r"); diff --git a/config/ipblocklist/ipblocklist.tmp b/config/ipblocklist/ipblocklist.tmp index baa0ff09..3c07817b 100755 --- a/config/ipblocklist/ipblocklist.tmp +++ b/config/ipblocklist/ipblocklist.tmp @@ -1,5 +1,5 @@ <?php - //Version 2.1 + //Version 2.2 require_once('config.inc'); require("guiconfig.inc"); @@ -90,7 +90,22 @@ else { echo "<input name='enable' type='checkbox' value='1'>\n"; } ?> - +<?php +if(isset($_POST['formSubmit'])) + { + + + if(isset($_POST['formlogging'])) + { + exec("touch logging"); + } + else + { + exec("rm logging"); + } + + } +?> <strong>Enable IP-Blocklist</strong><br><br> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> @@ -98,8 +113,17 @@ else { <?php if ($savemsg_dnsb) print_info_box($savemsg_dnsb); ?> </form> + <?php + + if (file_exists("logging")) { + echo "<input name='formlogging' type='checkbox' value='Yes' checked/>"; + } else { + echo "<input name='formlogging' type='checkbox' value='Yes'/>"; + } +?> + Enable Logging <input type="submit" name="formSubmit" value="Save" /><br /> <center> - <iframe frameboarder=0 boarder=0 src="ipblocklist_list.php" name="lists" id="lists" width="100%" height="200"> + <iframe frameboarder=0 boarder=0 src="ipblocklist_list.php" name="lists" id="lists" width="100%" height="200"> </iframe> </center> <br/> @@ -130,6 +154,14 @@ else { 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 ipblocklist |grep -v -c Z"); + ob_end_clean(); + echo $results; + echo " IPs"; ?> diff --git a/config/ipblocklist/ipblocklist.xml b/config/ipblocklist/ipblocklist.xml index 2bcad359..416a12e1 100755 --- a/config/ipblocklist/ipblocklist.xml +++ b/config/ipblocklist/ipblocklist.xml @@ -41,7 +41,7 @@ <requirements>perl</requirements> <faq>http://forum.pfsense.org/index.php/topic,24769.0.html</faq> <name>IP Blocklist Settings</name> - <version>0.2.1</version> + <version>0.2.2</version> <title>Settings</title> <include_file>/usr/local/pkg/ipblocklist.inc</include_file> <menu> @@ -62,57 +62,57 @@ <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/ipblocklist.xml</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/ipblocklist.inc</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist.inc</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/ipblocklist.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/ipblocklist_list.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist_list.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/convert.pl</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/convert.pl</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/convert-execute.sh</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/convert-execute.sh</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/purge.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/purge.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/index.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/index.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/whitelist.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/whitelist.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/purgeip.tmp</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/purgeip.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/ipblocklist/IP-Blocklist.sh</item> + <item>http://www.pfsense.org/packages/config/ipblocklist/IP-Blocklist.sh</item> </additional_files_needed> <fields> <field> @@ -131,15 +131,15 @@ <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - php_sync_package(); + php_sync_package_ip(); </custom_php_resync_config_command> <custom_delete_php_command> - php_sync_package(); + php_sync_package_ip(); </custom_delete_php_command> <custom_php_install_command> - php_install_command(); + php_install_command_ip(); </custom_php_install_command> <custom_php_deinstall_command> - deinstall_command(); + deinstall_command_ip(); </custom_php_deinstall_command> </packagegui> |