diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-02-06 01:32:13 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-02-06 01:32:13 -0600 |
commit | 7b03ef633aeadd8b128c69fbd1c89990004810e7 (patch) | |
tree | 1c0192157944799fe410d28dfa12f8faf216e6f0 /src/usr/local | |
parent | d20dd6589ac43905556d82a77973a5552bea2aed (diff) | |
download | pfsense-7b03ef633aeadd8b128c69fbd1c89990004810e7.zip pfsense-7b03ef633aeadd8b128c69fbd1c89990004810e7.tar.gz |
Verify a DNS server exists before allowing enabling of forwarding mode. Ticket #4747
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/services_unbound.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php index 48f017a..5a35ddb 100644 --- a/src/usr/local/www/services_unbound.php +++ b/src/usr/local/www/services_unbound.php @@ -141,6 +141,32 @@ if ($_POST) { } } + // forwarding mode requires having valid DNS servers + if (isset($pconfig['forwarding'])) { + $founddns = false; + if (isset($config['system']['dnsallowoverride'])) { + $a_gateways = return_gateways_array(); + if (is_array($a_gateways)) { + foreach ($a_gateways as $gateway) { + if ($gateway['dynamic'] == true) { + // assume DNS is being obtained dynamically + $founddns = true; + } + } + } + } + if (is_array($config['system']['dnsserver'])) { + foreach ($config['system']['dnsserver'] as $dnsserver) { + if (is_ipaddr($dnsserver)) { + $founddns = true; + } + } + } + if ($founddns == false) { + $input_errors[] = gettext("At least one DNS server must be specified under System>General Setup to enable Forwarding mode."); + } + } + if (empty($pconfig['active_interface'])) { $input_errors[] = gettext("One or more Network Interfaces must be selected for binding."); } else if (!isset($config['system']['dnslocalhost']) && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) { |