diff options
Diffstat (limited to 'config/ipblocklist')
-rw-r--r-- | config/ipblocklist/ipblocklist.tmp | 4 | ||||
-rw-r--r-- | config/ipblocklist/ipblocklist7.inc | 128 | ||||
-rw-r--r-- | config/ipblocklist/ipblocklist7.xml | 180 |
3 files changed, 309 insertions, 3 deletions
diff --git a/config/ipblocklist/ipblocklist.tmp b/config/ipblocklist/ipblocklist.tmp index e27215ea..3b517c70 100644 --- a/config/ipblocklist/ipblocklist.tmp +++ b/config/ipblocklist/ipblocklist.tmp @@ -53,9 +53,7 @@ if (count($_POST)>0) { //Prep pfctl mwexec("/usr/bin/touch lists/ipfw.ipfw"); mwexec("/usr/bin/touch Wlists/whitelist"); - mwexec("/bin/mkdir /usr/local/www/packages/countryblock/lists"); - mwexec("/usr/bin/touch /usr/local/www/packages/countryblock/lists/countries.txt"); - mwexec("/usr/bin/touch /usr/local/www/packages/countryblock/countries-white.txt"); + //Now clear ipfw, and process each list to ipfw commands exec("/bin/sh convert-execute.sh"); diff --git a/config/ipblocklist/ipblocklist7.inc b/config/ipblocklist/ipblocklist7.inc new file mode 100644 index 00000000..b3036c20 --- /dev/null +++ b/config/ipblocklist/ipblocklist7.inc @@ -0,0 +1,128 @@ +<?php +/* $Id$ */ +/* +/* ========================================================================== */ +/* + ipblocklist.inc + Copyright (C) 2010 Tom Schaefer + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +function php_sync_package_ip() +{ + global $config; +} + + +function php_install_command_ip() +{ + + global $config; + conf_mount_rw(); + config_lock(); + + if (!is_dir('/usr/local/www/packages/')) { + exec("mkdir /usr/local/www/packages/"); + } + + if (!is_dir('/usr/local/www/packages/ipblocklist/')) { + exec("mkdir /usr/local/www/packages/ipblocklist/"); + } + + + //install PERL + 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"); + //exec("pkg_add -r http://www.pfsense.org/packages/config/ipblocklist/compat7x.tbz"); + + //rename PHP files from .tmp to .php + exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/ipblocklist/class.phpmailer.php"); + unlink_if_exists("/tmp/class.phpmailer.tmp "); + exec("cp /tmp/class.smtp.tmp /usr/local/www/packages/ipblocklist/class.smtp.php"); + unlink_if_exists("/tmp/class.smtp.tmp"); + exec("cp /tmp/email.tmp /usr/local/www/packages/ipblocklist/email.php"); + unlink_if_exists("/tmp/email.tmp"); + exec("cp /tmp/ipblocklist_if.tmp /usr/local/www/packages/ipblocklist/ipblocklist_if.php"); + unlink_if_exists("/tmp/ipblocklist_if.tmp"); + exec("cp /tmp/settings.tmp /usr/local/www/packages/ipblocklist/settings.php"); + unlink_if_exists("/tmp/settings.tmp"); + exec("cp /tmp/interfaces.txt /usr/local/www/packages/ipblocklist/interfaces.txt"); + unlink_if_exists("/tmp/interfaces.txt"); + exec("cp /tmp/firewall_shaper.tmp /usr/local/www/packages/ipblocklist/firewall_shaper.php"); + unlink_if_exists("/tmp/firewall_shaper.tmp"); + + exec("cp /tmp/ipblocklist.tmp /usr/local/www/packages/ipblocklist/ipblocklist.php"); + unlink_if_exists("/tmp/ipblocklist.tmp"); + exec("cp /tmp/ipblocklist_list.tmp /usr/local/www/packages/ipblocklist/ipblocklist_list.php"); + unlink_if_exists("/tmp/ipblocklist_list.tmp"); + exec("cp /tmp/purge.tmp /usr/local/www/packages/ipblocklist/purge.php"); + unlink_if_exists("/tmp/purge.tmp"); + exec("cp /tmp/index.tmp /usr/local/www/packages/ipblocklist/index.php"); + unlink_if_exists("/tmp/index.tmp"); + exec("cp /tmp/whitelist.tmp /usr/local/www/packages/ipblocklist/whitelist.php"); + unlink_if_exists("/tmp/whitelist.tmp"); + exec("cp /tmp/purgeip.tmp /usr/local/www/packages/ipblocklist/purgeip.php"); + unlink_if_exists("/tmp/purgeip.tmp"); + //Get scripts + exec("cp /tmp/convert.pl /usr/local/www/packages/ipblocklist/convert.pl"); + unlink_if_exists("/tmp/convert.pl"); + exec("cp /tmp/convert-execute.sh /usr/local/www/packages/ipblocklist/convert-execute.sh"); + unlink_if_exists("/tmp/convert-execute.sh"); + exec("cp /tmp/IP-Blocklist.sh /usr/local/etc/rc.d/IP-Blocklist.sh"); + unlink_if_exists("/tmp/IP-Blocklist.sh"); + //Touch files + exec("touch /usr/local/www/packages/ipblocklist/wlists.txt"); + exec("/bin/mkdir /usr/local/www/packages/countryblock/lists"); + exec("/bin/mkdir /usr/local/www/packages/ipblocklist/lists"); + exec("/bin/mkdir /usr/local/www/packages/ipblocklist/Wlists"); + exec("/usr/bin/touch /usr/local/www/packages/countryblock/lists/countries.txt"); + exec("/usr/bin/touch /usr/local/www/packages/countryblock/countries-white.txt"); + exec("/usr/bin/touch /usr/local/www/packages/ipblocklist/lists/ipfw.ipfw"); + exec("/usr/bin/touch /usr/local/www/packages/ipblocklist/Wlists/whitelist"); + exec("/usr/bin/touch /usr/local/www/packages/ipblocklist/OUTBOUND"); + + + conf_mount_ro(); + config_unlock(); +} + + +function deinstall_command_ip() +{ + conf_mount_rw(); + $handle = popen("/usr/local/etc/rc.d/ipblocklist.sh stop", "r"); + unlink_if_exists("/usr/local/pkg/ipblocklist.xml"); + unlink_if_exists("/usr/local/pkg/ipblocklist.inc"); + exec("rm -R /usr/local/www/packages/ipblocklist/ipblocklists"); + exec("rm -R /usr/local/www/packages/ipblocklist"); + exec("rm /usr/local/etc/rc.d/IP-Blocklist.sh"); + exec("pfctl -t ipblocklist -T kill"); + exec("ipfw -f flush"); + conf_mount_ro(); +} + +?> diff --git a/config/ipblocklist/ipblocklist7.xml b/config/ipblocklist/ipblocklist7.xml new file mode 100644 index 00000000..c10027a2 --- /dev/null +++ b/config/ipblocklist/ipblocklist7.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + ipblocklist.xml + Copyright (C) 2010 Tom Schaefer + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>IP Blocklist</description> + <requirements>perl</requirements> + <faq>http://forum.pfsense.org/index.php/topic,24769.0.html</faq> + <name>IP Blocklist Settings</name> + <version>0.3.0</version> + <title>Settings</title> + <include_file>/usr/local/pkg/ipblocklist7.inc</include_file> + <menu> + <name>IP Blocklist</name> + <tooltiptext>IP Blocklist settings.</tooltiptext> + <section>Firewall</section> + <configfile>ipblocklist7.xml</configfile> + <url>/packages/ipblocklist/ipblocklist.php</url> + </menu> + <tabs> + <tab> + <text>Settings</text> + <url>/packages/ipblocklist/ipblocklist.php</url> + <active/> + </tab> + </tabs> + <configpath>installedpackages->package->$packagename->configuration->ipblocklist</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist7.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/ipblocklist7.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <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.org/packages/config/ipblocklist/interfaces.txt</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <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.org/packages/config/ipblocklist/ipblocklist_if.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/firewall_shaper.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <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.org/packages/config/ipblocklist/convert-execute.sh</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <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.org/packages/config/ipblocklist/index.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <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.org/packages/config/ipblocklist/purgeip.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/IP-Blocklist.sh</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/settings.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/class.phpmailer.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/class.smtp.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/ipblocklist/email.tmp</item> + </additional_files_needed> + <fields> + <field> + <fielddescr>Variable One</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + <field> + <fielddescr>Variable Two</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + </fields> + <custom_add_php_command> + </custom_add_php_command> + <custom_php_resync_config_command> + php_sync_package_ip(); + </custom_php_resync_config_command> + <custom_delete_php_command> + php_sync_package_ip(); + </custom_delete_php_command> + <custom_php_install_command> + php_install_command_ip(); + </custom_php_install_command> + <custom_php_deinstall_command> + deinstall_command_ip(); + </custom_php_deinstall_command> +</packagegui> |