diff options
author | Tom Schaefer <tom@tomschaefer.org> | 2010-12-06 12:20:00 -0500 |
---|---|---|
committer | Tom Schaefer <tom@tomschaefer.org> | 2010-12-06 12:20:00 -0500 |
commit | e6a67ab642563f5122d8a661977740c1ea8749b7 (patch) | |
tree | e1a1dc530f45d9303389c806b386899902457c6d /config/ipblocklist/7/ipblocklist.inc | |
parent | 7ab65e4c7553580cf9f66350cb3cb6401443d045 (diff) | |
download | pfsense-packages-e6a67ab642563f5122d8a661977740c1ea8749b7.tar.gz pfsense-packages-e6a67ab642563f5122d8a661977740c1ea8749b7.tar.bz2 pfsense-packages-e6a67ab642563f5122d8a661977740c1ea8749b7.zip |
ipblocklist 3.0.1 update with new file structure
Diffstat (limited to 'config/ipblocklist/7/ipblocklist.inc')
-rwxr-xr-x | config/ipblocklist/7/ipblocklist.inc | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/config/ipblocklist/7/ipblocklist.inc b/config/ipblocklist/7/ipblocklist.inc new file mode 100755 index 00000000..d331dcc8 --- /dev/null +++ b/config/ipblocklist/7/ipblocklist.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/7/perl-5.12.2_2.tbz"); + exec("pkg_add -r http://www.pfsense.org/packages/config/ipblocklist/7/p5-Net-CIDR-0.14.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/ipblocklist7.xml"); + unlink_if_exists("/usr/local/pkg/ipblocklist7.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(); +} + +?> |