summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr/local/www/services_unbound.php208
-rw-r--r--usr/local/www/services_unbound_acls.php88
-rw-r--r--usr/local/www/services_unbound_advanced.php112
-rw-r--r--usr/local/www/services_unbound_domainoverride_edit.php264
-rw-r--r--usr/local/www/services_unbound_host_edit.php79
5 files changed, 420 insertions, 331 deletions
diff --git a/usr/local/www/services_unbound.php b/usr/local/www/services_unbound.php
index 9176e4b..699a3a8 100644
--- a/usr/local/www/services_unbound.php
+++ b/usr/local/www/services_unbound.php
@@ -110,8 +110,9 @@ if ($_POST) {
system_dhcpleases_configure();
} else {
if (isset($_POST['enable']) && isset($config['dnsmasq']['enable'])) {
- if ($_POST['port'] == $config['dnsmasq']['port'])
+ if ($_POST['port'] == $config['dnsmasq']['port']) {
$input_errors[] = "The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.";
+ }
}
if (empty($_POST['active_interface'])) {
@@ -202,7 +203,7 @@ if ($_GET['act'] == "del") {
}
$closehead = false;
-$pgtitle = array(gettext("Services"),gettext("DNS Resolver"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"));
$shortcut_section = "resolver";
include_once("head.inc");
@@ -254,10 +255,13 @@ function show_advanced_dns() {
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Enable");?></td>
- <td width="78%" class="vtable"><p>
- <input name="enable" type="checkbox" id="enable" value="yes" <?php if (isset($pconfig['enable'])) echo "checked=\"checked\"";?> onclick="enable_change(false)" />
- <strong><?=gettext("Enable DNS Resolver");?><br />
- </strong></p>
+ <td width="78%" class="vtable">
+ <p>
+ <input name="enable" type="checkbox" id="enable" value="yes" <?php if (isset($pconfig['enable'])) echo "checked=\"checked\"";?> onclick="enable_change(false)" />
+ <strong>
+ <?=gettext("Enable DNS Resolver");?><br />
+ </strong>
+ </p>
</td>
</tr>
<tr>
@@ -283,8 +287,9 @@ function show_advanced_dns() {
<?php
foreach ($interface_addresses as $laddr => $ldescr):
$selected = "";
- if (in_array($laddr, $pconfig['active_interface']))
+ if (in_array($laddr, $pconfig['active_interface'])) {
$selected = 'selected="selected"';
+ }
?>
<option value="<?=$laddr;?>" <?=$selected;?>>
<?=htmlspecialchars($ldescr);?>
@@ -304,14 +309,16 @@ function show_advanced_dns() {
<?php
foreach ($interface_addresses as $laddr => $ldescr):
$selected = "";
- if (in_array($laddr, $pconfig['outgoing_interface']))
- $selected = 'selected="selected"';
+ if (in_array($laddr, $pconfig['outgoing_interface'])) {
+ $selected = 'selected="selected"';
+ }
?>
<option value="<?=$laddr;?>" <?=$selected;?>>
<?=htmlspecialchars($ldescr);?>
</option>
- <?php endforeach;
- unset($interface_addresses);
+ <?php
+ endforeach;
+ unset($interface_addresses);
?>
</select>
<br /><br />
@@ -319,48 +326,64 @@ function show_advanced_dns() {
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("DNSSEC");?></td>
- <td width="78%" class="vtable"><p>
- <input name="dnssec" type="checkbox" id="dnssec" value="yes" <?php echo (isset($pconfig['dnssec']) ? "checked=\"checked\"" : "");?> />
- <strong><?=gettext("Enable DNSSEC Support");?><br />
- </strong></p>
+ <td width="78%" class="vtable">
+ <p>
+ <input name="dnssec" type="checkbox" id="dnssec" value="yes" <?php echo (isset($pconfig['dnssec']) ? "checked=\"checked\"" : "");?> />
+ <strong>
+ <?=gettext("Enable DNSSEC Support");?><br />
+ </strong>
+ </p>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("DNS Query Forwarding");?></td>
- <td width="78%" class="vtable"><p>
- <input name="forwarding" type="checkbox" id="forwarding" value="yes" <?php echo (isset($pconfig['forwarding']) ? "checked=\"checked\"" : "");?> />
- <strong><?=gettext("Enable Forwarding Mode");?></strong><br /></p>
+ <td width="78%" class="vtable">
+ <p>
+ <input name="forwarding" type="checkbox" id="forwarding" value="yes" <?php echo (isset($pconfig['forwarding']) ? "checked=\"checked\"" : "");?> />
+ <strong><?=gettext("Enable Forwarding Mode");?></strong><br />
+ </p>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("DHCP Registration");?></td>
- <td width="78%" class="vtable"><p>
- <input name="regdhcp" type="checkbox" id="regdhcp" value="yes" <?php if (isset($pconfig['regdhcp'])) echo "checked=\"checked\"";?> />
- <strong><?=gettext("Register DHCP leases in the DNS Resolver");?><br />
- </strong><?php printf(gettext("If this option is set, then machines that specify".
- " their hostname when requesting a DHCP lease will be registered".
- " in the DNS Resolver, so that their name can be resolved.".
- " You should also set the domain in %sSystem:".
- " General setup%s to the proper value."),'<a href="system.php">','</a>')?></p>
+ <td width="78%" class="vtable">
+ <p>
+ <input name="regdhcp" type="checkbox" id="regdhcp" value="yes" <?php if (isset($pconfig['regdhcp'])) echo "checked=\"checked\"";?> />
+ <strong>
+ <?=gettext("Register DHCP leases in the DNS Resolver");?><br />
+ </strong>
+ <?php printf(gettext("If this option is set, then machines that specify".
+ " their hostname when requesting a DHCP lease will be registered".
+ " in the DNS Resolver, so that their name can be resolved.".
+ " You should also set the domain in %sSystem:".
+ " General setup%s to the proper value."), '<a href="system.php">', '</a>')?>
+ </p>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Static DHCP");?></td>
- <td width="78%" class="vtable"><p>
- <input name="regdhcpstatic" type="checkbox" id="regdhcpstatic" value="yes" <?php if (isset($pconfig['regdhcpstatic'])) echo "checked=\"checked\"";?> />
- <strong><?=gettext("Register DHCP static mappings in the DNS Resolver");?><br />
- </strong><?php printf(gettext("If this option is set, then DHCP static mappings will ".
+ <td width="78%" class="vtable">
+ <p>
+ <input name="regdhcpstatic" type="checkbox" id="regdhcpstatic" value="yes" <?php if (isset($pconfig['regdhcpstatic'])) echo "checked=\"checked\"";?> />
+ <strong>
+ <?=gettext("Register DHCP static mappings in the DNS Resolver");?><br />
+ </strong>
+ <?php printf(gettext("If this option is set, then DHCP static mappings will ".
"be registered in the DNS Resolver, so that their name can be ".
"resolved. You should also set the domain in %s".
- "System: General setup%s to the proper value."),'<a href="system.php">','</a>');?></p>
+ "System: General setup%s to the proper value."), '<a href="system.php">', '</a>');?>
+ </p>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("TXT Comment Support");?></td>
- <td width="78%" class="vtable"><p>
- <input name="txtsupport" type="checkbox" id="txtsupport" value="yes" <?php echo (isset($pconfig['txtsupport']) ? "checked=\"checked\"" : "");?> />
- <strong><?=gettext("If this option is set, then any descriptions associated with Host entries and DHCP Static mappings will create a corresponding TXT record.");?><br />
- </strong></p>
+ <td width="78%" class="vtable">
+ <p>
+ <input name="txtsupport" type="checkbox" id="txtsupport" value="yes" <?php echo (isset($pconfig['txtsupport']) ? "checked=\"checked\"" : "");?> />
+ <strong>
+ <?=gettext("If this option is set, then any descriptions associated with Host entries and DHCP Static mappings will create a corresponding TXT record.");?><br />
+ </strong>
+ </p>
</td>
</tr>
<tr>
@@ -390,28 +413,37 @@ function show_advanced_dns() {
</table>
-<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
-</strong></span><?php printf(gettext("If the DNS Resolver is enabled, the DHCP".
-" service (if enabled) will automatically serve the LAN IP".
-" address as a DNS server to DHCP clients so they will use".
-" the DNS Resolver. If Forwarding, is enabled, the DNS Resolver will use the DNS servers".
-" entered in %sSystem: General setup%s".
-" or those obtained via DHCP or PPP on WAN if the &quot;Allow".
-" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
-" is checked."),'<a href="system.php">','</a>');?><br />
-</span></p>
+<p>
+ <span class="vexpl">
+ <span class="red">
+ <strong>
+ <?=gettext("Note:");?><br />
+ </strong>
+ </span>
+ <?php printf(gettext("If the DNS Resolver is enabled, the DHCP".
+ " service (if enabled) will automatically serve the LAN IP".
+ " address as a DNS server to DHCP clients so they will use".
+ " the DNS Resolver. If Forwarding, is enabled, the DNS Resolver will use the DNS servers".
+ " entered in %sSystem: General setup%s".
+ " or those obtained via DHCP or PPP on WAN if the &quot;Allow".
+ " DNS server list to be overridden by DHCP/PPP on WAN&quot;".
+ " is checked."), '<a href="system.php">', '</a>');?>
+ <br />
+ </span>
+</p>
&nbsp;<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont" summary="host overrides">
-<tr>
- <td colspan="5" valign="top" class="listtopic"><?=gettext("Host Overrides");?></td>
-</tr>
-<tr>
- <td><br />
- <?=gettext("Entries in this section override individual results from the forwarders.");?>
- <?=gettext("Use these for changing DNS results or for adding custom DNS records.");?>
- </td>
-</tr>
+ <tr>
+ <td colspan="5" valign="top" class="listtopic"><?=gettext("Host Overrides");?></td>
+ </tr>
+ <tr>
+ <td>
+ <br />
+ <?=gettext("Entries in this section override individual results from the forwarders.");?>
+ <?=gettext("Use these for changing DNS results or for adding custom DNS records.");?>
+ </td>
+ </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" summary="results">
<thead>
@@ -444,7 +476,10 @@ function show_advanced_dns() {
</tr>
</tfoot>
<tbody>
- <?php $i = 0; foreach ($a_hosts as $hostent): ?>
+<?php
+ $i = 0;
+ foreach ($a_hosts as $hostent):
+?>
<tr>
<td class="listlr" ondblclick="document.location='services_unbound_host_edit.php?id=<?=$i;?>';">
<?=strtolower($hostent['host']);?>&nbsp;
@@ -467,8 +502,10 @@ function show_advanced_dns() {
</table>
</td>
</tr>
- <?php if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])): ?>
- <?php foreach ($hostent['aliases']['item'] as $alias): ?>
+<?php
+ if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
+ foreach ($hostent['aliases']['item'] as $alias):
+?>
<tr>
<td class="listlr" ondblclick="document.location='services_unbound_host_edit.php?id=<?=$i;?>';">
<?=strtolower($alias['host']);?>&nbsp;
@@ -486,9 +523,12 @@ function show_advanced_dns() {
<a href="services_unbound_host_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
</td>
</tr>
- <?php endforeach; ?>
- <?php endif; ?>
- <?php $i++; endforeach; ?>
+<?php
+ endforeach;
+ endif;
+ $i++;
+ endforeach;
+?>
<tr style="display:none"><td></td></tr>
</tbody>
</table>
@@ -498,9 +538,13 @@ function show_advanced_dns() {
<td colspan="5" valign="top" class="listtopic"><?=gettext("Domain Overrides");?></td>
</tr>
<tr>
- <td><p><?=gettext("Entries in this area override an entire domain by specifying an".
- " authoritative DNS server to be queried for that domain.");?>
- <?=gettext("If there are multiple authoritative DNS servers available for a domain then make a separate entry for each, using the same domain name.");?></p></td>
+ <td>
+ <p>
+ <?=gettext("Entries in this area override an entire domain by specifying an".
+ " authoritative DNS server to be queried for that domain.");?>
+ <?=gettext("If there are multiple authoritative DNS servers available for a domain then make a separate entry for each, using the same domain name.");?>
+ </p>
+ </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" summary="results">
@@ -523,17 +567,20 @@ function show_advanced_dns() {
<tr>
<td class="list" colspan="3"></td>
<td class="list">
- <table border="0" cellspacing="0" cellpadding="1" summary="add">
- <tr>
- <td width="17" height="17"></td>
- <td><a href="services_unbound_domainoverride_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
- </tr>
- </table>
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <tr>
+ <td width="17" height="17"></td>
+ <td><a href="services_unbound_domainoverride_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
+ </tr>
+ </table>
</td>
</tr>
</tfoot>
<tbody>
- <?php $i = 0; foreach ($a_domainOverrides as $doment): ?>
+<?php
+ $i = 0;
+ foreach ($a_domainOverrides as $doment):
+?>
<tr>
<td class="listlr">
<?=strtolower($doment['domain']);?>&nbsp;
@@ -547,17 +594,24 @@ function show_advanced_dns() {
<td valign="middle" class="list nowrap">
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
- <td valign="middle"><a href="services_unbound_domainoverride_edit.php?id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" />
- </a></td>
- <td valign="middle"><a href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this domain override?");?>')">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
- </a></td>
+ <td valign="middle">
+ <a href="services_unbound_domainoverride_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" />
+ </a>
+ </td>
+ <td valign="middle">
+ <a href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this domain override?");?>')">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
+ </a>
+ </td>
</tr>
</table>
</td>
</tr>
- <?php $i++; endforeach; ?>
+<?php
+ $i++;
+ endforeach;
+?>
<tr style="display:none"><td></td></tr>
</tbody>
</table>
diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php
index 7a1af28..b97a05f 100644
--- a/usr/local/www/services_unbound_acls.php
+++ b/usr/local/www/services_unbound_acls.php
@@ -85,12 +85,13 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = services_unbound_configure();
$savemsg = get_std_save_message($retval);
- if ($retval == 0)
+ if ($retval == 0) {
clear_subsystem_dirty('unbound');
+ }
} else {
// input validation - only allow 50 entries in a single ACL
- for($x=0; $x<50; $x++) {
+ for ($x=0; $x<50; $x++) {
if (isset($pconfig["acl_network{$x}"])) {
$networkacl[$x] = array();
$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
@@ -143,7 +144,6 @@ if ($_POST) {
pfSenseHeader("/services_unbound_acls.php");
exit;
}
-
}
}
}
@@ -201,13 +201,15 @@ include("head.inc");
<tr>
<td id="mainarea">
<div class="tabcont">
- <?php if($act=="new" || $act=="edit"): ?>
- <input name="aclid" type="hidden" value="<?=$id;?>" />
- <input name="act" type="hidden" value="<?=$act;?>" />
+<?php
+ if ($act == "new" || $act == "edit"):
+?>
+ <input name="aclid" type="hidden" value="<?=$id;?>" />
+ <input name="act" type="hidden" value="<?=$act;?>" />
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
- <td colspan="2" valign="top" class="listtopic"><?=ucwords(sprintf(gettext("%s Access List"),$act));?></td>
+ <td colspan="2" valign="top" class="listtopic"><?=ucwords(sprintf(gettext("%s Access List"), $act));?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Access List name");?></td>
@@ -221,11 +223,16 @@ include("head.inc");
<td width="22%" valign="top" class="vncellreq"><?=gettext("Action");?></td>
<td width="78%" class="vtable">
<select name="aclaction" class="formselect">
- <?php $types = explode(",", "Allow,Deny,Refuse,Allow Snoop"); foreach ($types as $type): ?>
+ <?php
+ $types = explode(",", "Allow,Deny,Refuse,Allow Snoop");
+ foreach ($types as $type):
+ ?>
<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['aclaction'])) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($type);?>
</option>
- <?php endforeach; ?>
+ <?php
+ endforeach;
+ ?>
</select>
<br />
<span class="vexpl">
@@ -247,16 +254,14 @@ include("head.inc");
<td><div id="twocolumn"><?=gettext("CIDR");?></div></td>
<td><div id="threecolumn"><?=gettext("Description");?></div></td>
</tr>
- <?php $counter = 0; ?>
<?php
- if($networkacl)
- foreach($networkacl as $item):
- ?>
- <?php
+ $counter = 0;
+ if ($networkacl) {
+ foreach ($networkacl as $item):
$network = $item['acl_network'];
$cidr = $item['mask'];
$description = $item['description'];
- ?>
+ ?>
<tr>
<td>
<input name="acl_network<?=$counter;?>" type="text" class="formfld unknown ipv4v6" id="acl_network<?=$counter;?>" size="30" value="<?=htmlspecialchars($network);?>" />
@@ -279,8 +284,11 @@ include("head.inc");
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
</td>
</tr>
- <?php $counter++; ?>
- <?php endforeach; ?>
+ <?php
+ $counter++;
+ endforeach;
+ }
+ ?>
</tbody>
</table>
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
@@ -318,10 +326,10 @@ include("head.inc");
</td>
</tr>
</table>
-
- <?php else: ?>
-
- <table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="results">
+<?php
+ else:
+?>
+ <table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="results">
<thead>
<tr>
<td width="25%" class="listhdrr"><?=gettext("Access List Name"); ?></td>
@@ -337,9 +345,11 @@ include("head.inc");
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
<td width="17">&nbsp;</td>
- <td valign="middle"><a href="services_unbound_acls.php?act=new">
- <img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Add new Access List"); ?>" border="0" alt="add" />
- </a></td>
+ <td valign="middle">
+ <a href="services_unbound_acls.php?act=new">
+ <img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Add new Access List"); ?>" border="0" alt="add" />
+ </a>
+ </td>
</tr>
</table>
</td>
@@ -355,7 +365,7 @@ include("head.inc");
<tbody>
<?php
$i = 0;
- foreach($a_acls as $acl):
+ foreach ($a_acls as $acl):
?>
<tr ondblclick="document.location='services_unbound_acls.php?act=edit&amp;id=<?=$i;?>'">
<td class="listlr">
@@ -370,25 +380,31 @@ include("head.inc");
<td valign="middle" class="list nowrap">
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
- <td valign="middle"><a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>">
- <img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit access list"); ?>" width="17" height="17" border="0" alt="edit" />
- </a></td>
- <td valign="middle"><a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')">
- <img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete access list"); ?>" width="17" height="17" border="0" alt="delete" />
- </a></td>
+ <td valign="middle">
+ <a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>">
+ <img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit access list"); ?>" width="17" height="17" border="0" alt="edit" />
+ </a>
+ </td>
+ <td valign="middle">
+ <a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')">
+ <img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete access list"); ?>" width="17" height="17" border="0" alt="delete" />
+ </a>
+ </td>
</tr>
</table>
</td>
</tr>
<?php
- $i++;
+ $i++;
endforeach;
?>
- <tr style="display:none"><td></td></tr>
+ <tr style="display:none"><td></td></tr>
</tbody>
- </table>
- <?php endif; ?>
- </div>
+ </table>
+<?php
+ endif;
+?>
+ </div>
</td>
</tr>
</tbody>
diff --git a/usr/local/www/services_unbound_advanced.php b/usr/local/www/services_unbound_advanced.php
index 0712ce9..0e50e18 100644
--- a/usr/local/www/services_unbound_advanced.php
+++ b/usr/local/www/services_unbound_advanced.php
@@ -42,14 +42,14 @@
require_once("guiconfig.inc");
require_once("unbound.inc");
-if(!is_array($config['unbound'])) {
+if (!is_array($config['unbound'])) {
$config['unbound'] = array();
}
if (isset($config['unbound']['hideidentity'])) {
$pconfig['hideidentity'] = true;
}
-if (isset($config['unbound']['hideversion'])){
+if (isset($config['unbound']['hideversion'])) {
$pconfig['hideversion'] = true;
}
if (isset($config['unbound']['prefetch'])) {
@@ -133,7 +133,7 @@ if ($_POST) {
if (isset($_POST['dnssecstripped']) && !isset($config['unbound']['dnssec'])) {
$input_errors[] = "Harden DNSSEC Data option can only be enabled if DNSSEC support is enabled.";
}
-
+
if (!$input_errors) {
if (isset($_POST['hideidentity'])) {
@@ -184,21 +184,21 @@ if ($_POST) {
unset($config['unbound']['use_caps']);
}
write_config("DNS Resolver configured.");
-
+
mark_subsystem_dirty('unbound');
}
}
}
$closehead = false;
-$pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Advanced"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Advanced"));
$shortcut_section = "resolver";
include_once("head.inc");
?>
</head>
-
+
<body>
<?php include("fbegin.inc"); ?>
<form action="services_unbound_advanced.php" method="post" name="iform" id="iform">
@@ -266,7 +266,7 @@ include_once("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Message Cache Size");?></td>
<td width="78%" class="vtable">
- <select id="msgcachesize" name="msgcachesize">
+ <select id="msgcachesize" name="msgcachesize">
<?php
foreach (array("4", "10", "20", "50", "100", "250", "512") as $size) :
?>
@@ -276,14 +276,14 @@ include_once("head.inc");
<?php
endforeach;
?>
- </select><br />
- <?=gettext("Size of the message cache. The message cache stores DNS rcodes and validation statuses. The RRSet cache will automatically be set to twice this amount. The RRSet cache contains the actual RR data. The default is 4 megabytes.");?>
+ </select><br />
+ <?=gettext("Size of the message cache. The message cache stores DNS rcodes and validation statuses. The RRSet cache will automatically be set to twice this amount. The RRSet cache contains the actual RR data. The default is 4 megabytes.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Outgoing TCP Buffers");?></td>
<td width="78%" class="vtable">
- <select id="outgoing_num_tcp" name="outgoing_num_tcp">
+ <select id="outgoing_num_tcp" name="outgoing_num_tcp">
<?php
for ($num_tcp = 0; $num_tcp <= 50; $num_tcp += 10):
?>
@@ -293,14 +293,14 @@ include_once("head.inc");
<?php
endfor;
?>
- </select><br />
- <?=gettext("The number of outgoing TCP buffers to allocate per thread. The default value is 10. If 0 is selected then no TCP queries, to authoritative servers, are done.");?>
+ </select><br />
+ <?=gettext("The number of outgoing TCP buffers to allocate per thread. The default value is 10. If 0 is selected then no TCP queries, to authoritative servers, are done.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Incoming TCP Buffers");?></td>
<td width="78%" class="vtable">
- <select id="incoming_num_tcp" name="incoming_num_tcp">
+ <select id="incoming_num_tcp" name="incoming_num_tcp">
<?php
for ($num_tcp = 0; $num_tcp <= 50; $num_tcp += 10):
?>
@@ -310,14 +310,14 @@ include_once("head.inc");
<?php
endfor;
?>
- </select><br />
- <?=gettext("The number of incoming TCP buffers to allocate per thread. The default value is 10. If 0 is selected then no TCP queries, from clients, are accepted.");?>
+ </select><br />
+ <?=gettext("The number of incoming TCP buffers to allocate per thread. The default value is 10. If 0 is selected then no TCP queries, from clients, are accepted.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("EDNS Buffer Size");?></td>
<td width="78%" class="vtable">
- <select id="edns_buffer_size" name="edns_buffer_size">
+ <select id="edns_buffer_size" name="edns_buffer_size">
<?php
foreach (array("512", "1480", "4096") as $size) :
?>
@@ -327,14 +327,14 @@ include_once("head.inc");
<?php
endforeach;
?>
- </select><br />
- <?=gettext("Number of bytes size to advertise as the EDNS reassembly buffer size. This is the value that is used in UDP datagrams sent to peers. RFC recommendation is 4096 (which is the default). If you have fragmentation reassemble problems, usually seen as timeouts, then a value of 1480 should help. The 512 value bypasses most MTU path problems, but it can generate an excessive amount of TCP fallback.");?>
+ </select><br />
+ <?=gettext("Number of bytes size to advertise as the EDNS reassembly buffer size. This is the value that is used in UDP datagrams sent to peers. RFC recommendation is 4096 (which is the default). If you have fragmentation reassemble problems, usually seen as timeouts, then a value of 1480 should help. The 512 value bypasses most MTU path problems, but it can generate an excessive amount of TCP fallback.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Number of queries per thread");?></td>
<td width="78%" class="vtable">
- <select id="num_queries_per_thread" name="num_queries_per_thread">
+ <select id="num_queries_per_thread" name="num_queries_per_thread">
<?php
foreach (array("512", "1024", "2048") as $queries) :
?>
@@ -344,14 +344,14 @@ include_once("head.inc");
<?php
endforeach;
?>
- </select><br />
- <?=gettext("The number of queries that every thread will service simultaneously. If more queries arrive that need to be serviced, and no queries can be jostled, then these queries are dropped.");?>
+ </select><br />
+ <?=gettext("The number of queries that every thread will service simultaneously. If more queries arrive that need to be serviced, and no queries can be jostled, then these queries are dropped.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Jostle Timeout");?></td>
<td width="78%" class="vtable">
- <select id="jostle_timeout" name="jostle_timeout">
+ <select id="jostle_timeout" name="jostle_timeout">
<?php
foreach (array("100", "200", "500", "1000") as $timeout) :
?>
@@ -361,68 +361,68 @@ include_once("head.inc");
<?php
endforeach;
?>
- </select><br />
- <?=gettext("This timeout is used for when the server is very busy. This protects against denial of service by slow queries or high query rates. The default value is 200 milliseconds.");?>
+ </select><br />
+ <?=gettext("This timeout is used for when the server is very busy. This protects against denial of service by slow queries or high query rates. The default value is 200 milliseconds.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Maximum TTL for RRsets and messages");?></td>
<td width="78%" class="vtable">
- <input type="text" id="cache_max_ttl" name="cache_max_ttl" size="5" value="<?php if(isset($pconfig['cache_max_ttl'])) echo $pconfig['cache_max_ttl']; ?>" /><br />
- <?=gettext("Configure a maximum Time to live for RRsets and messages in the cache. The default is 86400 seconds (1 day). When the internal TTL expires the cache item is expired. This can be configured to force the resolver to query for data more often and not trust (very large) TTL values.");?>
+ <input type="text" id="cache_max_ttl" name="cache_max_ttl" size="5" value="<?php if (isset($pconfig['cache_max_ttl'])) echo $pconfig['cache_max_ttl']; ?>" /><br />
+ <?=gettext("Configure a maximum Time to live for RRsets and messages in the cache. The default is 86400 seconds (1 day). When the internal TTL expires the cache item is expired. This can be configured to force the resolver to query for data more often and not trust (very large) TTL values.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Minimum TTL for RRsets and messages");?></td>
<td width="78%" class="vtable">
- <input type="text" id="cache_min_ttl" name="cache_min_ttl" size="5" value="<?php if(isset($pconfig['cache_min_ttl'])) echo $pconfig['cache_min_ttl']; ?>" /><br />
- <?=gettext("Configure a minimum Time to live for RRsets and messages in the cache. The default is 0 seconds. If the minimum value kicks in, the data is cached for longer than the domain owner intended, and thus less queries are made to look up the data. The 0 value ensures the data in the cache is as the domain owner intended. High values can lead to trouble as the data in the cache might not match up with the actual data anymore.");?>
+ <input type="text" id="cache_min_ttl" name="cache_min_ttl" size="5" value="<?php if (isset($pconfig['cache_min_ttl'])) echo $pconfig['cache_min_ttl']; ?>" /><br />
+ <?=gettext("Configure a minimum Time to live for RRsets and messages in the cache. The default is 0 seconds. If the minimum value kicks in, the data is cached for longer than the domain owner intended, and thus less queries are made to look up the data. The 0 value ensures the data in the cache is as the domain owner intended. High values can lead to trouble as the data in the cache might not match up with the actual data anymore.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("TTL for Host cache entries");?></td>
<td width="78%" class="vtable">
- <select id="infra_host_ttl" name="infra_host_ttl">
- <option value="60" <?php if ($pconfig['infra_host_ttl'] == "60") echo "selected=\"selected\""; ?>>1 minute</option>
- <option value="120" <?php if ($pconfig['infra_host_ttl'] == "120") echo "selected=\"selected\""; ?>>2 minutes</option>
- <option value="300" <?php if ($pconfig['infra_host_ttl'] == "300") echo "selected=\"selected\""; ?>>5 minutes</option>
- <option value="600" <?php if ($pconfig['infra_host_ttl'] == "600") echo "selected=\"selected\""; ?>>10 minutes</option>
- <option value="900" <?php if ($pconfig['infra_host_ttl'] == "900") echo "selected=\"selected\""; ?>>15 minutes</option>
- </select><br />
- <?=gettext("Time to live for entries in the host cache. The host cache contains roundtrip timing, lameness and EDNS support information. The default is 15 minutes.");?>
+ <select id="infra_host_ttl" name="infra_host_ttl">
+ <option value="60" <?php if ($pconfig['infra_host_ttl'] == "60") echo "selected=\"selected\""; ?>>1 minute</option>
+ <option value="120" <?php if ($pconfig['infra_host_ttl'] == "120") echo "selected=\"selected\""; ?>>2 minutes</option>
+ <option value="300" <?php if ($pconfig['infra_host_ttl'] == "300") echo "selected=\"selected\""; ?>>5 minutes</option>
+ <option value="600" <?php if ($pconfig['infra_host_ttl'] == "600") echo "selected=\"selected\""; ?>>10 minutes</option>
+ <option value="900" <?php if ($pconfig['infra_host_ttl'] == "900") echo "selected=\"selected\""; ?>>15 minutes</option>
+ </select><br />
+ <?=gettext("Time to live for entries in the host cache. The host cache contains roundtrip timing, lameness and EDNS support information. The default is 15 minutes.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Number of Hosts to cache");?></td>
<td width="78%" class="vtable">
- <select id="infra_cache_numhosts" name="infra_cache_numhosts">
- <option value="1000" <?php if ($pconfig['infra_cache_numhosts'] == "1000") echo "selected=\"selected\""; ?>>1000</option>
- <option value="5000" <?php if ($pconfig['infra_cache_numhosts'] == "5000") echo "selected=\"selected\""; ?>>5000</option>
- <option value="10000" <?php if ($pconfig['infra_cache_numhosts'] == "10000") echo "selected=\"selected\""; ?>>10 000</option>
- <option value="20000" <?php if ($pconfig['infra_cache_numhosts'] == "20000") echo "selected=\"selected\""; ?>>20 000</option>
- <option value="50000" <?php if ($pconfig['infra_cache_numhosts'] == "50000") echo "selected=\"selected\""; ?>>50 000</option>
- </select><br />
- <?=gettext("Number of hosts for which information is cached. The default is 10,000.");?>
+ <select id="infra_cache_numhosts" name="infra_cache_numhosts">
+ <option value="1000" <?php if ($pconfig['infra_cache_numhosts'] == "1000") echo "selected=\"selected\""; ?>>1000</option>
+ <option value="5000" <?php if ($pconfig['infra_cache_numhosts'] == "5000") echo "selected=\"selected\""; ?>>5000</option>
+ <option value="10000" <?php if ($pconfig['infra_cache_numhosts'] == "10000") echo "selected=\"selected\""; ?>>10 000</option>
+ <option value="20000" <?php if ($pconfig['infra_cache_numhosts'] == "20000") echo "selected=\"selected\""; ?>>20 000</option>
+ <option value="50000" <?php if ($pconfig['infra_cache_numhosts'] == "50000") echo "selected=\"selected\""; ?>>50 000</option>
+ </select><br />
+ <?=gettext("Number of hosts for which information is cached. The default is 10,000.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Unwanted Reply Threshold");?></td>
<td width="78%" class="vtable">
- <select id="unwanted_reply_threshold" name="unwanted_reply_threshold">
- <option value="disabled" <?php if ($pconfig['unwanted_reply_threshold'] == "disabled") echo "selected=\"selected\""; ?>>disabled</option>
- <option value="5000000" <?php if ($pconfig['unwanted_reply_threshold'] == "5000000") echo "selected=\"selected\""; ?>>5 million</option>
- <option value="10000000" <?php if ($pconfig['unwanted_reply_threshold'] == "10000000") echo "selected=\"selected\""; ?>>10 million</option>
- <option value="20000000" <?php if ($pconfig['unwanted_reply_threshold'] == "20000000") echo "selected=\"selected\""; ?>>20 million</option>
- <option value="40000000" <?php if ($pconfig['unwanted_reply_threshold'] == "40000000") echo "selected=\"selected\""; ?>>40 million</option>
- <option value="50000000" <?php if ($pconfig['unwanted_reply_threshold'] == "50000000") echo "selected=\"selected\""; ?>>50 million</option>
- </select><br />
- <?=gettext("If enabled, a total number of unwanted replies is kept track of in every thread. When it reaches the threshold, a defensive action is taken and a warning is printed to the log file. This defensive action is to clear the RRSet and message caches, hopefully flushing away any poison. The default is disabled, but if enabled a value of 10 million is suggested.");?>
+ <select id="unwanted_reply_threshold" name="unwanted_reply_threshold">
+ <option value="disabled" <?php if ($pconfig['unwanted_reply_threshold'] == "disabled") echo "selected=\"selected\""; ?>>disabled</option>
+ <option value="5000000" <?php if ($pconfig['unwanted_reply_threshold'] == "5000000") echo "selected=\"selected\""; ?>>5 million</option>
+ <option value="10000000" <?php if ($pconfig['unwanted_reply_threshold'] == "10000000") echo "selected=\"selected\""; ?>>10 million</option>
+ <option value="20000000" <?php if ($pconfig['unwanted_reply_threshold'] == "20000000") echo "selected=\"selected\""; ?>>20 million</option>
+ <option value="40000000" <?php if ($pconfig['unwanted_reply_threshold'] == "40000000") echo "selected=\"selected\""; ?>>40 million</option>
+ <option value="50000000" <?php if ($pconfig['unwanted_reply_threshold'] == "50000000") echo "selected=\"selected\""; ?>>50 million</option>
+ </select><br />
+ <?=gettext("If enabled, a total number of unwanted replies is kept track of in every thread. When it reaches the threshold, a defensive action is taken and a warning is printed to the log file. This defensive action is to clear the RRSet and message caches, hopefully flushing away any poison. The default is disabled, but if enabled a value of 10 million is suggested.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Log level verbosity");?></td>
<td width="78%" class="vtable">
- <select id="log_verbosity" name="log_verbosity">
+ <select id="log_verbosity" name="log_verbosity">
<?php
for ($level = 0; $level <= 5; $level++):
?>
@@ -432,8 +432,8 @@ include_once("head.inc");
<?php
endfor;
?>
- </select><br />
- <?=gettext("Select the log verbosity.");?>
+ </select><br />
+ <?=gettext("Select the log verbosity.");?>
</td>
</tr>
<tr>
diff --git a/usr/local/www/services_unbound_domainoverride_edit.php b/usr/local/www/services_unbound_domainoverride_edit.php
index 821823b..05b5812 100644
--- a/usr/local/www/services_unbound_domainoverride_edit.php
+++ b/usr/local/www/services_unbound_domainoverride_edit.php
@@ -1,34 +1,34 @@
<?php
/*
- services_unbound_domainoverride_edit.php
- part of the pfSense project (https://www.pfsense.org)
- Copyright (C) 2014 Warren Baker (warren@decoy.co.za)
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
-
- Copyright (C) 2003-2005 Bob Zoller <bob@kludgebox.com> and 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.
+ services_unbound_domainoverride_edit.php
+ part of the pfSense project (https://www.pfsense.org)
+ Copyright (C) 2014 Warren Baker (warren@decoy.co.za)
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
+
+ Copyright (C) 2003-2005 Bob Zoller <bob@kludgebox.com> and 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.
*/
/*
pfSense_MODULE: dnsresolver
@@ -45,74 +45,82 @@ require("guiconfig.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound.php');
-if (!is_array($config['unbound']['domainoverrides']))
- $config['unbound']['domainoverrides'] = array();
+if (!is_array($config['unbound']['domainoverrides'])) {
+ $config['unbound']['domainoverrides'] = array();
+}
$a_domainOverrides = &$config['unbound']['domainoverrides'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_domainOverrides[$id]) {
- $pconfig['domain'] = $a_domainOverrides[$id]['domain'];
- $pconfig['ip'] = $a_domainOverrides[$id]['ip'];
- $pconfig['descr'] = $a_domainOverrides[$id]['descr'];
+ $pconfig['domain'] = $a_domainOverrides[$id]['domain'];
+ $pconfig['ip'] = $a_domainOverrides[$id]['ip'];
+ $pconfig['descr'] = $a_domainOverrides[$id]['descr'];
}
if ($_POST) {
- unset($input_errors);
- $pconfig = $_POST;
-
- /* input validation */
- $reqdfields = explode(" ", "domain ip");
- $reqdfieldsn = array(gettext("Domain"),gettext("IP address"));
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
-
- function String_Begins_With($needle, $haystack) {
- return (substr($haystack, 0, strlen($needle))==$needle);
- }
-
- if (String_Begins_With(_msdcs, $_POST['domain'])) {
- $subdomainstr = substr($_POST['domain'], 7);
- if ($subdomainstr && !is_domain($subdomainstr))
- $input_errors[] = gettext("A valid domain must be specified after _msdcs.");
- } elseif ($_POST['domain'] && !is_domain($_POST['domain']))
- $input_errors[] = gettext("A valid domain must be specified.");
-
- if ($_POST['ip']) {
- if (strpos($_POST['ip'],'@') !== false) {
- $ip_details = explode("@", $_POST['ip']);
- if (!is_ipaddr($ip_details[0]) || !is_port($ip_details[1]))
- $input_errors[] = gettext("A valid IP address and port must be specified, for example 192.168.100.10@5353.");
- } else if (!is_ipaddr($_POST['ip']))
- $input_errors[] = gettext("A valid IP address must be specified, for example 192.168.100.10.");
- }
-
- if (!$input_errors) {
- $doment = array();
- $doment['domain'] = $_POST['domain'];
- $doment['ip'] = $_POST['ip'];
- $doment['descr'] = $_POST['descr'];
-
- if (isset($id) && $a_domainOverrides[$id])
- $a_domainOverrides[$id] = $doment;
- else
- $a_domainOverrides[] = $doment;
-
- mark_subsystem_dirty('unbound');
-
- write_config();
-
- header("Location: services_unbound.php");
- exit;
- }
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = explode(" ", "domain ip");
+ $reqdfieldsn = array(gettext("Domain"), gettext("IP address"));
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+
+ function String_Begins_With($needle, $haystack) {
+ return (substr($haystack, 0, strlen($needle)) == $needle);
+ }
+
+ if (String_Begins_With(_msdcs, $_POST['domain'])) {
+ $subdomainstr = substr($_POST['domain'], 7);
+ if ($subdomainstr && !is_domain($subdomainstr)) {
+ $input_errors[] = gettext("A valid domain must be specified after _msdcs.");
+ }
+ } elseif ($_POST['domain'] && !is_domain($_POST['domain'])) {
+ $input_errors[] = gettext("A valid domain must be specified.");
+ }
+
+ if ($_POST['ip']) {
+ if (strpos($_POST['ip'], '@') !== false) {
+ $ip_details = explode("@", $_POST['ip']);
+ if (!is_ipaddr($ip_details[0]) || !is_port($ip_details[1])) {
+ $input_errors[] = gettext("A valid IP address and port must be specified, for example 192.168.100.10@5353.");
+ }
+ } else if (!is_ipaddr($_POST['ip'])) {
+ $input_errors[] = gettext("A valid IP address must be specified, for example 192.168.100.10.");
+ }
+ }
+
+ if (!$input_errors) {
+ $doment = array();
+ $doment['domain'] = $_POST['domain'];
+ $doment['ip'] = $_POST['ip'];
+ $doment['descr'] = $_POST['descr'];
+
+ if (isset($id) && $a_domainOverrides[$id]) {
+ $a_domainOverrides[$id] = $doment;
+ } else {
+ $a_domainOverrides[] = $doment;
+ }
+
+ mark_subsystem_dirty('unbound');
+
+ write_config();
+
+ header("Location: services_unbound.php");
+ exit;
+ }
}
-$pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit Domain Override"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Edit Domain Override"));
$shortcut_section = "resolver";
include("head.inc");
@@ -121,50 +129,50 @@ include("head.inc");
<body>
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
- <form action="services_unbound_domainoverride_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="domain override">
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Domain");?></td>
- <td width="78%" class="vtable">
- <?=$mandfldhtml;?><input name="domain" type="text" class="formfld unknown" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
- <span class="vexpl">
- <?=gettext("Domain to override (NOTE: this does not have to be a valid TLD!)"); ?><br />
- <?=gettext("e.g."); ?> <em><?=gettext("test"); ?></em> <?=gettext("or"); ?> <em>mycompany.localdomain</em> <?=gettext("or"); ?> <em>1.168.192.in-addr.arpa</em>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("IP address");?></td>
- <td width="78%" class="vtable">
- <?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="40" value="<?=htmlspecialchars($pconfig['ip']);?>" /><br />
- <span class="vexpl">
- <?=gettext("IP address of the authoritative DNS server for this domain"); ?><br />
- <?=gettext("e.g."); ?> <em>192.168.100.100</em><br />
- <?=gettext("To use a nondefault port for communication, append an '@' with the port number."); ?><br />
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
- <span class="vexpl">
- <?=gettext("You may enter a description here for your reference (not parsed).");?>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
- <?php if (isset($id) && $a_domainOverrides[$id]): ?>
- <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
+ <form action="services_unbound_domainoverride_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="domain override">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Domain");?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="domain" type="text" class="formfld unknown" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
+ <span class="vexpl">
+ <?=gettext("Domain to override (NOTE: this does not have to be a valid TLD!)"); ?><br />
+ <?=gettext("e.g."); ?> <em><?=gettext("test"); ?></em> <?=gettext("or"); ?> <em>mycompany.localdomain</em> <?=gettext("or"); ?> <em>1.168.192.in-addr.arpa</em>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("IP address");?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="40" value="<?=htmlspecialchars($pconfig['ip']);?>" /><br />
+ <span class="vexpl">
+ <?=gettext("IP address of the authoritative DNS server for this domain"); ?><br />
+ <?=gettext("e.g."); ?> <em>192.168.100.100</em><br />
+ <?=gettext("To use a nondefault port for communication, append an '@' with the port number."); ?><br />
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
+ <span class="vexpl">
+ <?=gettext("You may enter a description here for your reference (not parsed).");?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
+ <?php if (isset($id) && $a_domainOverrides[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/usr/local/www/services_unbound_host_edit.php b/usr/local/www/services_unbound_host_edit.php
index 5c20e6c..522feb3 100644
--- a/usr/local/www/services_unbound_host_edit.php
+++ b/usr/local/www/services_unbound_host_edit.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/* $Id$ */
/*
services_unbound_host_edit.php
@@ -6,20 +6,20 @@
Copyright (C) 2014 Warren Baker (warren@decoy.co.za)
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
All rights reserved.
-
+
Copyright (C) 2003-2004 Bob Zoller <bob@kludgebox.com> and 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
@@ -51,23 +51,27 @@ function hostcmp($a, $b) {
function hosts_sort() {
global $g, $config;
- if (!is_array($config['unbound']['hosts']))
+ if (!is_array($config['unbound']['hosts'])) {
return;
+ }
usort($config['unbound']['hosts'], "hostcmp");
}
require("guiconfig.inc");
-if (!is_array($config['unbound']['hosts']))
+if (!is_array($config['unbound']['hosts'])) {
$config['unbound']['hosts'] = array();
+}
$a_hosts = &$config['unbound']['hosts'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_hosts[$id]) {
$pconfig['host'] = $a_hosts[$id]['host'];
@@ -84,12 +88,12 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "domain ip");
- $reqdfieldsn = array(gettext("Domain"),gettext("IP address"));
-
+ $reqdfieldsn = array(gettext("Domain"), gettext("IP address"));
+
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
-
+
if ($_POST['host']) {
- if (!is_hostname($_POST['host'])) {
+ if (!is_hostname($_POST['host'])) {
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9, '_' and '-'. It may not start or end with '-'.");
} else {
if (!is_unqualified_hostname($_POST['host'])) {
@@ -98,11 +102,13 @@ if ($_POST) {
}
}
- if (($_POST['domain'] && !is_domain($_POST['domain'])))
+ if (($_POST['domain'] && !is_domain($_POST['domain']))) {
$input_errors[] = gettext("A valid domain must be specified.");
-
- if (($_POST['ip'] && !is_ipaddr($_POST['ip'])))
+ }
+
+ if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) {
$input_errors[] = gettext("A valid IP address must be specified.");
+ }
/* collect aliases */
$aliases = array();
@@ -111,12 +117,10 @@ if ($_POST) {
if (!substr_compare('aliashost', $key, 0, 9)) {
$entry = substr($key, 9);
$field = 'host';
- }
- elseif (!substr_compare('aliasdomain', $key, 0, 11)) {
+ } elseif (!substr_compare('aliasdomain', $key, 0, 11)) {
$entry = substr($key, 11);
$field = 'domain';
- }
- elseif (!substr_compare('aliasdescription', $key, 0, 16)) {
+ } elseif (!substr_compare('aliasdescription', $key, 0, 16)) {
$entry = substr($key, 16);
$field = 'description';
}
@@ -141,17 +145,20 @@ if ($_POST) {
}
}
}
- if (($alias['domain'] && !is_domain($alias['domain'])))
+ if (($alias['domain'] && !is_domain($alias['domain']))) {
$input_errors[] = gettext("A valid domain must be specified in alias list.");
+ }
}
/* check for overlaps */
foreach ($a_hosts as $hostent) {
- if (isset($id) && ($a_hosts[$id]) && ($a_hosts[$id] === $hostent))
+ if (isset($id) && ($a_hosts[$id]) && ($a_hosts[$id] === $hostent)) {
continue;
+ }
- if (($hostent['host'] == $_POST['host']) && ($hostent['domain'] == $_POST['domain'])
- && ((is_ipaddrv4($hostent['ip']) && is_ipaddrv4($_POST['ip'])) || (is_ipaddrv6($hostent['ip']) && is_ipaddrv6($_POST['ip'])))) {
+ if (($hostent['host'] == $_POST['host']) &&
+ ($hostent['domain'] == $_POST['domain']) &&
+ ((is_ipaddrv4($hostent['ip']) && is_ipaddrv4($_POST['ip'])) || (is_ipaddrv6($hostent['ip']) && is_ipaddrv6($_POST['ip'])))) {
$input_errors[] = gettext("This host/domain already exists.");
break;
}
@@ -165,22 +172,23 @@ if ($_POST) {
$hostent['descr'] = $_POST['descr'];
$hostent['aliases']['item'] = $aliases;
- if (isset($id) && $a_hosts[$id])
+ if (isset($id) && $a_hosts[$id]) {
$a_hosts[$id] = $hostent;
- else
+ } else {
$a_hosts[] = $hostent;
+ }
hosts_sort();
-
+
mark_subsystem_dirty('unbound');
-
+
write_config();
-
+
header("Location: services_unbound.php");
exit;
}
}
-$pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit host"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Edit host"));
$shortcut_section = "resolver";
include("head.inc");
@@ -217,7 +225,8 @@ include("head.inc");
<td width="78%" class="vtable">
<input name="host" type="text" class="formfld unknown" id="host" size="40" value="<?=htmlspecialchars($pconfig['host']);?>" /><br />
<span class="vexpl"><?=gettext("Name of the host, without domain part"); ?><br />
- <?=gettext("e.g."); ?> <em><?=gettext("myhost"); ?></em></span>
+ <?=gettext("e.g."); ?> <em><?=gettext("myhost"); ?></em>
+ </span>
</td>
</tr>
<tr>
@@ -225,7 +234,8 @@ include("head.inc");
<td width="78%" class="vtable">
<input name="domain" type="text" class="formfld unknown" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
<span class="vexpl"><?=gettext("Domain of the host"); ?><br />
- <?=gettext("e.g."); ?> <em><?=gettext("example.com"); ?></em></span>
+ <?=gettext("e.g."); ?> <em><?=gettext("example.com"); ?></em>
+ </span>
</td>
</tr>
<tr>
@@ -233,7 +243,8 @@ include("head.inc");
<td width="78%" class="vtable">
<input name="ip" type="text" class="formfld unknown" id="ip" size="40" value="<?=htmlspecialchars($pconfig['ip']);?>" /><br />
<span class="vexpl"><?=gettext("IP address of the host"); ?><br />
- <?=gettext("e.g."); ?> <em>192.168.100.100</em> <?=gettext("or"); ?> <em>fd00:abcd::1</em></span>
+ <?=gettext("e.g."); ?> <em>192.168.100.100</em> <?=gettext("or"); ?> <em>fd00:abcd::1</em>
+ </span>
</td>
</tr>
<tr>
@@ -263,7 +274,7 @@ include("head.inc");
<?php
$counter = 0;
if ($pconfig['aliases']['item']):
- foreach($pconfig['aliases']['item'] as $item):
+ foreach ($pconfig['aliases']['item'] as $item):
$host = $item['host'];
$domain = $item['domain'];
$description = $item['description'];
OpenPOWER on IntegriCloud