aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/countryblock/countryblock.inc4
-rwxr-xr-x[-rw-r--r--]config/countryblock/countryblock.tmp27
-rw-r--r--config/countryblock/countryblock.xml10
-rw-r--r--config/countryblock/countryblock_if.tmp194
-rwxr-xr-xconfig/countryblock/firewall_shaper.tmp11
5 files changed, 240 insertions, 6 deletions
diff --git a/config/countryblock/countryblock.inc b/config/countryblock/countryblock.inc
index 7cab6c1d..e716f25b 100644
--- a/config/countryblock/countryblock.inc
+++ b/config/countryblock/countryblock.inc
@@ -59,8 +59,12 @@ function php_install_command_cb()
//rename PHP files from .tmp to .php
exec("cp /tmp/countryblock.tmp /usr/local/www/packages/countryblock/countryblock.php");
unlink_if_exists("/tmp/countryblock.tmp");
+ exec("cp /tmp/countryblock_if.tmp /usr/local/www/packages/countryblock/countryblock_if.php");
+ unlink_if_exists("/tmp/countryblock_if.tmp");
exec("cp /tmp/index.tmp /usr/local/www/packages/countryblock/index.php");
unlink_if_exists("/tmp/index.tmp");
+ exec("cp /tmp/firewall_shaper.tmp /usr/local/www/packages/countryblock/firewall_shaper.php");
+ unlink_if_exists("/tmp/firewall_shaper.tmp");
//Get scripts
exec("cp /tmp/countryblock.sh /usr/local/etc/rc.d/countryblock.sh");
unlink_if_exists("/tmp/countryblock.sh");
diff --git a/config/countryblock/countryblock.tmp b/config/countryblock/countryblock.tmp
index dc0fbbbc..f95c2e7c 100644..100755
--- a/config/countryblock/countryblock.tmp
+++ b/config/countryblock/countryblock.tmp
@@ -68,7 +68,7 @@ if (count($_POST)>0) {
}
- write_config();
+ //write_config();
//services_dnsmasq_configure();
sleep(1);
$savemsg_cb = "Country Block settings have been saved/updated. ";
@@ -98,7 +98,7 @@ else {
?>
<?php
-
+conf_mount_rw();
mwexec("touch countries.txt");
//$myFile = "countries.txt";
//$fh = fopen($myFile, 'a+');
@@ -152,6 +152,7 @@ mwexec("touch countries.txt");
echo("</p>");
}
}
+conf_mount_ro();
?>
@@ -260,7 +261,7 @@ background-color: #F3F3F3;
<strong>Enable Country Block</strong><br><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td class="tabcont" >
+ <td >
<?php if ($savemsg_cb) print_info_box($savemsg_cb);
//if ($output) print_info_box($output,$output2);
echo($output);
@@ -271,7 +272,18 @@ background-color: #F3F3F3;
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<p>
- Check the country that you would like to block completely. Currently
+ <?php
+ $countif = "interfaces.txt";
+ if (file_exists($countif)) {
+ $countif = count(file($countif));
+ echo "$countlines";
+ } else {
+ echo "<span style='color:red'>Warning! No Interfaces Selected Click <a href='countryblock_if.php' target='_parent'><img src='../../themes/nervecenter/images/icons/icon_cablenic.gif' ALT='if'></a></span>";
+ }
+
+ ?>
+ </p>
+ <p>Check the country that you would like to block completely. Currently
<?php
$countfile = "countries.txt";
if (file_exists($countfile)) {
@@ -284,6 +296,7 @@ background-color: #F3F3F3;
?>
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><a href="countryblock_if.php" target="_parent"><img src="../../themes/nervecenter/images/icons/icon_cablenic.gif" ALT="Manual" ALIGN=RIGHT></a></p>
<p>
Block outbound?
<?php
@@ -569,9 +582,9 @@ ob_end_clean();
echo "<li><input name='formCountry[]' type='checkbox' value='BD' />Bangladesh</li>";
ob_start();
-$results = exec("cat countries.txt | grep BD");
+$results = exec("cat countries.txt | grep BB");
ob_end_clean();
- if ($results == 'BD')
+ if ($results == 'BB')
echo "<li><input name='formCountry[]' type='checkbox' value='BB' checked/>Barbados</li>";
else
echo "<li><input name='formCountry[]' type='checkbox' value='BB' />Barbados</li>";
@@ -820,6 +833,7 @@ ob_end_clean();
else
echo "<li><input name='formCountry[]' type='checkbox' value='CG' />Congo - Brazzaville</li>";
+
ob_start();
$results = exec("cat countries.txt | grep CD");
ob_end_clean();
@@ -2558,6 +2572,7 @@ ob_end_clean();
echo "<li><input name='formCountry[]' type='checkbox' value='ZW' />Zimbabwe </li>";
?>
+
</ul>
diff --git a/config/countryblock/countryblock.xml b/config/countryblock/countryblock.xml
index 68ed8797..4edc4a6e 100644
--- a/config/countryblock/countryblock.xml
+++ b/config/countryblock/countryblock.xml
@@ -124,6 +124,16 @@
<chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/countryblock/whitelist.tmp</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock_if.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/countryblock/firewall_shaper.tmp</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Variable One</fielddescr>
diff --git a/config/countryblock/countryblock_if.tmp b/config/countryblock/countryblock_if.tmp
new file mode 100644
index 00000000..af56756a
--- /dev/null
+++ b/config/countryblock/countryblock_if.tmp
@@ -0,0 +1,194 @@
+<?php
+/*
+ interfaces_assign.php
+ part of m0n0wall (http://m0n0.ch/wall)
+ Written by Jim McBeath based on existing m0n0wall files
+
+ Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = "Country Block - Interfaces";
+require("guiconfig.inc");
+
+/*
+ In this file, "port" refers to the physical port name,
+ while "interface" refers to LAN, WAN, or OPTn.
+*/
+
+/* get list without VLAN interfaces */
+$portlist = get_interface_list();
+
+/* add VLAN interfaces */
+if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
+ $i = 0;
+ foreach ($config['vlans']['vlan'] as $vlan) {
+ $portlist['vlan' . $i] = $vlan;
+ $portlist['vlan' . $i]['isvlan'] = true;
+ $i++;
+ }
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+
+ /* input validation */
+
+ /* Build a list of the port names so we can see how the interfaces map */
+ $portifmap = array();
+ foreach ($portlist as $portname => $portinfo)
+ $portifmap[$portname] = array();
+
+ /* Go through the list of ports selected by the user,
+ build a list of port-to-interface mappings in portifmap */
+ conf_mount_rw();
+ $myFile = "interfaces.txt";
+ $fh = fopen($myFile, 'w+');
+
+ foreach ($_POST as $ifname => $ifport) {
+ //echo $ifname;
+ //echo "<br>";
+ fwrite($fh, $ifname . "\n");
+ //if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt'))
+ //$portifmap[$ifport][] = strtoupper($ifname);
+ }
+
+ conf_mount_ro();
+
+
+ if (!$input_errors) {
+ /* No errors detected, so update the config */
+ foreach ($_POST as $ifname => $ifport) {
+
+ if (($ifname == 'lan') || ($ifname == 'wan') ||
+ (substr($ifname, 0, 3) == 'opt')) {
+
+
+ }
+ }
+
+ $savemsg = get_std_save_message($retval);
+
+
+
+ }
+}
+
+
+
+
+
+$pgtitle = "CountryBlock Interfaces";
+include("head.inc");
+
+
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box("Interfaces selected - Click <a href='countryblock.php'>Here</a> to go back"); ?>
+<form action="" method="post" name="iform" id="iform">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Interface assignments", true, "");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Interface</td>
+ <td class="listhdr">Selected</td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php foreach ($config['interfaces'] as $ifname => $iface):
+ if ($iface['descr'])
+ $ifdescr = $iface['descr'];
+ else
+ $ifdescr = strtoupper($ifname);
+ ?>
+ <tr>
+ <td class="listlr" valign="middle"><strong><?=$ifdescr;?></strong></td>
+ <td valign="middle" class="listr">
+
+
+ <!---<input name='<?=$ifname;?>' type='checkbox' value='<?=$ifname;?>' checked/>- <?=$ifname;?>--->
+
+ <?php foreach ($portlist as $portname => $portinfo): ?>
+
+ <?php if ($portname == $iface['if']) {
+
+ ob_start();
+ $results = exec("cat interfaces.txt | grep $portname");
+ ob_end_clean();
+ if ($results == $portname)
+ echo "<input name='$portname' type='checkbox' value='$portname' checked/>$portname";
+ else
+ echo "<input name='$portname' type='checkbox' value='$portname' />$portname";
+ }
+ ?>
+ <?php endforeach; ?>
+
+ </td>
+ <td valign="middle" class="list">
+
+ </td>
+ </tr>
+ <?php endforeach; ?>
+
+ <tr>
+ <td class="list" colspan="3" height="10"></td>
+ </tr>
+
+</table>
+</div>
+<br>
+<input type="submit" class="formbtn" value="Save"><br><br>
+<p></p></td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+
+
+</body>
+</html>
+
+<?php
+conf_mount_rw();
+ if ($_POST) {
+ if (!$input_errors)
+ touch("interfaces.txt");
+
+ }
+ conf_mount_ro();
+?>
diff --git a/config/countryblock/firewall_shaper.tmp b/config/countryblock/firewall_shaper.tmp
new file mode 100755
index 00000000..d01ed55c
--- /dev/null
+++ b/config/countryblock/firewall_shaper.tmp
@@ -0,0 +1,11 @@
+<html>
+<HEAD>
+<SCRIPT language="JavaScript">
+<!--
+window.parent.location="../../firewall_shaper.php";
+//-->
+</SCRIPT>
+</HEAD>
+
+
+</html> \ No newline at end of file