summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-04 10:42:48 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-04 10:42:48 -0300
commit079d1952fdd2aeb668f785a804bcedfd6b8115ef (patch)
treeefffcd48b83181127920dd654389bb9750240c37 /usr/local/www
parentd9f33a7f607d11d8884665368a32114184c7e9c9 (diff)
downloadpfsense-079d1952fdd2aeb668f785a804bcedfd6b8115ef.zip
pfsense-079d1952fdd2aeb668f785a804bcedfd6b8115ef.tar.gz
Add a new alias type, URLs containing Ports
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/firewall_aliases_edit.php41
-rwxr-xr-xusr/local/www/firewall_nat_edit.php2
-rwxr-xr-xusr/local/www/firewall_nat_out_edit.php2
-rwxr-xr-xusr/local/www/firewall_rules_edit.php2
-rwxr-xr-xusr/local/www/load_balancer_pool_edit.php2
-rwxr-xr-xusr/local/www/load_balancer_virtual_server_edit.php2
6 files changed, 37 insertions, 14 deletions
diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php
index 115ee92..c2b0f44 100755
--- a/usr/local/www/firewall_aliases_edit.php
+++ b/usr/local/www/firewall_aliases_edit.php
@@ -111,7 +111,6 @@ if (isset($id) && $a_aliases[$id]) {
$pconfig['updatefreq'] = $a_aliases[$id]['updatefreq'];
}
if($a_aliases[$id]['aliasurl'] <> "") {
- $pconfig['type'] = "url";
if(is_array($a_aliases[$id]['aliasurl']))
$pconfig['address'] = implode(" ", $a_aliases[$id]['aliasurl']);
else
@@ -190,7 +189,7 @@ if ($_POST) {
else
$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
}
- } elseif($_POST['type'] == "url") {
+ } else if ($_POST['type'] == "url" || $_POST['type'] == "url_ports") {
$isfirst = 0;
$address_count = 2;
@@ -234,7 +233,12 @@ if ($_POST) {
$tmp = trim($tmp_split[0]);
}
$tmp = trim($tmp);
- if(!empty($tmp) && (is_ipaddr($tmp) || is_subnet($tmp))) {
+ if ($_POST['type'] == "url")
+ $is_valid = (is_ipaddr($tmp) || is_subnet($tmp));
+ else
+ $is_valid = (is_port($tmp) || is_portrange($tmp));
+
+ if (!empty($tmp) && $is_valid) {
$address[] = $tmp;
$isfirst = 1;
$address_count++;
@@ -252,6 +256,8 @@ if ($_POST) {
}
}
}
+ if ($_POST['type'] == "url_ports")
+ $address = group_ports($address);
} else {
/* item is a normal alias type */
$wrongaliases = "";
@@ -372,7 +378,7 @@ if ($_POST) {
{
$pconfig['name'] = $_POST['name'];
$pconfig['descr'] = $_POST['descr'];
- if ($_POST['type'] == 'url')
+ if (($_POST['type'] == 'url') || ($_POST['type'] == 'url_ports'))
$pconfig['address'] = implode(" ", $alias['aliasurl']);
else
$pconfig['address'] = implode(" ", $address);
@@ -441,8 +447,15 @@ function typesel_change() {
eval(comd);
}
break;
-
- case 4: /* urltable */
+ case 4: /* url_ports */
+ var cmd;
+ newrows = totalrows;
+ for(i=0; i<newrows; i++) {
+ comd = 'document.iform.address_subnet' + i + '.disabled = 1;';
+ eval(comd);
+ }
+ break;
+ case 5: /* urltable */
var cmd;
newrows = totalrows;
for(i=0; i<newrows; i++) {
@@ -470,7 +483,8 @@ $hosts_str = gettext("Host(s)");
$ip_str = gettext("IP");
$ports_str = gettext("Port(s)");
$port_str = gettext("Port");
-$url_str = gettext("URL");
+$url_str = gettext("URL (IPs)");
+$url_ports_str = gettext("URL (Ports)");
$urltable_str = gettext("URL Table");
$update_freq_str = gettext("Update Freq.");
@@ -478,6 +492,7 @@ $networks_help = gettext("Networks are specified in CIDR format. Select the CID
$hosts_help = gettext("Enter as many hosts as you would like. Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used.");
$ports_help = gettext("Enter as many ports as you wish. Port ranges can be expressed by seperating with a colon.");
$url_help = sprintf(gettext("Enter as many URLs as you wish. After saving %s will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000)."), $g['product_name']);
+$url_ports_help = sprintf(gettext("Enter as many URLs as you wish. After saving %s will download the URL and import the items into the alias. Use only with small sets of Ports (less than 3000)."), $g['product_name']);
$urltable_help = sprintf(gettext("Enter a single URL containing a large number of IPs and/or Subnets. After saving %s will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers."), $g['product_name']);
$openvpn_str = gettext("Username");
@@ -518,6 +533,13 @@ function update_box_type() {
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
document.getElementById ("itemhelp").firstChild.data = "{$url_help}";
document.getElementById ("addrowbutton").style.display = 'block';
+ } else if(selected == '{$url_ports_str}') {
+ document.getElementById ("addressnetworkport").firstChild.data = "{$url_ports_str}";
+ document.getElementById ("onecolumn").firstChild.data = "{$url_ports_str}";
+ document.getElementById ("twocolumn").firstChild.data = "";
+ document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
+ document.getElementById ("itemhelp").firstChild.data = "{$url_ports_help}";
+ document.getElementById ("addrowbutton").style.display = 'block';
} else if(selected == '{$openvpn_user_str}') {
document.getElementById ("addressnetworkport").firstChild.data = "{$openvpn_user_str}";
document.getElementById ("onecolumn").firstChild.data = "{$openvpn_str}";
@@ -584,7 +606,7 @@ EOD;
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
<?php
if (empty($tab)) {
- if ($pconfig['type'] == 'urltable')
+ if (preg_match("/url/i", $pconfig['type']))
$tab = 'url';
else if ($pconfig['type'] == 'host')
$tab = 'ip';
@@ -630,7 +652,8 @@ if (empty($tab)) {
<option value="network" <?php if ($pconfig['type'] == "network") echo "selected=\"selected\""; ?>><?=gettext("Network(s)"); ?></option>
<option value="port" <?php if ($pconfig['type'] == "port") echo "selected=\"selected\""; ?>><?=gettext("Port(s)"); ?></option>
<!--<option value="openvpn" <?php if ($pconfig['type'] == "openvpn") echo "selected=\"selected\""; ?>><?=gettext("OpenVPN Users"); ?></option> -->
- <option value="url" <?php if ($pconfig['type'] == "url") echo "selected=\"selected\""; ?>><?=gettext("URL");?></option>
+ <option value="url" <?php if ($pconfig['type'] == "url") echo "selected=\"selected\""; ?>><?=gettext("URL (IPs)");?></option>
+ <option value="url_ports" <?php if ($pconfig['type'] == "url_ports") echo "selected=\"selected\""; ?>><?=gettext("URL (Ports)");?></option>
<option value="urltable" <?php if ($pconfig['type'] == "urltable") echo "selected=\"selected\""; ?>><?=gettext("URL Table"); ?></option>
</select>
</td>
diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php
index 87de18f..26e4a35 100755
--- a/usr/local/www/firewall_nat_edit.php
+++ b/usr/local/www/firewall_nat_edit.php
@@ -912,7 +912,7 @@ $has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['upda
<script type="text/javascript">
//<![CDATA[
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list("port")) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("localip"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php
index 1cc2e4d..6a36e2d 100755
--- a/usr/local/www/firewall_nat_out_edit.php
+++ b/usr/local/www/firewall_nat_out_edit.php
@@ -720,7 +720,7 @@ $has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['upda
poolopts_change();
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list("port")) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("source"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("sourceport"), new StateSuggestions(customarray));
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index 4105343..c955346 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -1629,7 +1629,7 @@ $has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]
<?php endif; ?>
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list("port")) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("srcbeginport_cust"), new StateSuggestions(customarray));
diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php
index 32b2e4f..5164de1 100755
--- a/usr/local/www/load_balancer_pool_edit.php
+++ b/usr/local/www/load_balancer_pool_edit.php
@@ -215,7 +215,7 @@ function clearcombo(){
</div>
<script type="text/javascript">
//<![CDATA[
- var addressarray = <?= json_encode(get_alias_list("port")) ?>;
+ var addressarray = <?= json_encode(get_alias_list(array("port", "url_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("port"), new StateSuggestions(addressarray));
//]]>
</script>
diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php
index b2e73b1..3cdc9b5 100755
--- a/usr/local/www/load_balancer_virtual_server_edit.php
+++ b/usr/local/www/load_balancer_virtual_server_edit.php
@@ -186,7 +186,7 @@ include("head.inc");
<br><?=gettext("You may also specify a port alias listed in Firewall -&gt; Aliases here."); ?>
<script type="text/javascript">
//<![CDATA[
- var port_aliases = <?= json_encode(get_alias_list("port")) ?>;
+ var port_aliases = <?= json_encode(get_alias_list(array("port", "url_ports"))) ?>;
var oTextbox2 = new AutoSuggestControl(document.getElementById("port"), new StateSuggestions(port_aliases));
//]]>
</script>
OpenPOWER on IntegriCloud