summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-28 08:49:36 -0200
committerRenato Botelho <renato@netgate.com>2016-01-28 08:49:36 -0200
commit7ffd90780c83615d6619a5f558634ad153c9218e (patch)
tree2292b24ab5dda7daed712b23eb8fb6e3d756d5ad /src
parentbc243c302c7510212e7e386a0921e1df38ec4e5f (diff)
parent77d9edf585a48c21fc16d1029224385de7f842b7 (diff)
downloadpfsense-7ffd90780c83615d6619a5f558634ad153c9218e.zip
pfsense-7ffd90780c83615d6619a5f558634ad153c9218e.tar.gz
Merge pull request #2120 from NOYB/Services-DNS_Resolver-System_Domain_Local_Zone_Type
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/unbound.inc24
-rw-r--r--src/usr/local/www/services_unbound.php14
2 files changed, 21 insertions, 17 deletions
diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc
index b903551..492d5ae 100644
--- a/src/etc/inc/unbound.inc
+++ b/src/etc/inc/unbound.inc
@@ -599,13 +599,14 @@ function unbound_add_domain_overrides($pvt_rev="", $cfgsubdir = "") {
function unbound_add_host_entries($cfgsubdir = "") {
global $config, $g;
- if (empty($config['unbound']['system_domain_local_zone_type'])) {
- $system_domain_local_zone_type = "transparent";
- } else {
+ // Make sure the config setting is a valid unbound local zone type. If not use "transparent".
+ if (array_key_exists($config['unbound']['system_domain_local_zone_type'], unbound_local_zone_types())) {
$system_domain_local_zone_type = $config['unbound']['system_domain_local_zone_type'];
+ } else {
+ $system_domain_local_zone_type = "transparent";
}
- $unbound_entries = "local-zone: \"{$config['system']['domain']}\" $system_domain_local_zone_type\n";
+ $unbound_entries = "local-zone: \"{$config['system']['domain']}\" {$system_domain_local_zone_type}\n";
$hosts = read_hosts();
$added_ptr = array();
@@ -793,4 +794,19 @@ function unbound_hosts_generate() {
unbound_control("reload");
}
+// Array of valid unbound local zone types
+function unbound_local_zone_types() {
+ return array(
+ "deny" => gettext("Deny"),
+ "refuse" => gettext("Refuse"),
+ "static" => gettext("Static"),
+ "transparent" => gettext("Transparent"),
+ "typetransparent" => gettext("Type Transparent"),
+ "redirect" => gettext("Redirect"),
+ "inform" => gettext("Inform"),
+ "inform_deny" => gettext("Inform Deny"),
+ "nodefault" => gettext("No Default")
+ );
+}
+
?>
diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php
index 1f882fc..48f017a 100644
--- a/src/usr/local/www/services_unbound.php
+++ b/src/usr/local/www/services_unbound.php
@@ -151,10 +151,6 @@ if ($_POST) {
$input_errors[] = gettext("One or more Outgoing Network Interfaces must be selected.");
}
- if (empty($pconfig['system_domain_local_zone_type'])) {
- $input_errors[] = gettext("A System Domain Local-Zone Type must be selected.");
- }
-
if ($pconfig['port'] && !is_port($pconfig['port'])) {
$input_errors[] = gettext("You must specify a valid port number.");
}
@@ -172,11 +168,6 @@ if ($_POST) {
$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
}
- if (isset($pconfig['system_domain_local_zone_type']) && !empty($pconfig['system_domain_local_zone_type'])) {
- $display_system_domain_local_zone_type = $pconfig['system_domain_local_zone_type'];
- $pconfig['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
- }
-
$test_output = array();
if (test_unbound_config($pconfig, $test_output)) {
$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
@@ -201,7 +192,6 @@ if ($_POST) {
$pconfig['active_interface'] = $display_active_interface;
$pconfig['outgoing_interface'] = $display_outgoing_interface;
- $pconfig['system_domain_local_zone_type'] = $display_system_domain_local_zone_type;
$pconfig['custom_options'] = $display_custom_options;
}
}
@@ -311,13 +301,11 @@ $section->addInput(new Form_Select(
true
))->addClass('general')->setHelp('Utilize different network interface(s) that the DNS Resolver will use to send queries to authoritative servers and receive their replies. By default all interfaces are used.');
-$unbound_local_zone_types = array("deny" => gettext("Deny"), "refuse" => gettext("Refuse"), "static" => gettext("Static"), "transparent" => gettext("Transparent"), "typetransparent" => gettext("Type Transparent"), "redirect" => gettext("Redirect"), "inform" => gettext("Inform"), "inform_deny" => gettext("Inform Deny"), "nodefault" => gettext("No Default"));
-
$section->addInput(new Form_Select(
'system_domain_local_zone_type',
'System Domain Local Zone Type',
$pconfig['system_domain_local_zone_type'],
- $unbound_local_zone_types
+ unbound_local_zone_types()
))->setHelp('The local-zone type used for the pfSense system domain (System | General Setup | Domain). Transparent is the default. Local-Zone type descriptions are available in the unbound.conf(5) manual pages.');
$section->addInput(new Form_Checkbox(
OpenPOWER on IntegriCloud