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']))) { $input_errors[] = gettext("This system is configured to use the DNS Resolver as its DNS server, so Localhost or All must be selected in Network Interfaces."); } if (empty($pconfig['outgoing_interface'])) { $input_errors[] = gettext("One or more Outgoing Network Interfaces must be selected."); } if ($pconfig['port'] && !is_port($pconfig['port'])) { $input_errors[] = gettext("You must specify a valid port number."); } if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) { $display_active_interface = $pconfig['active_interface']; $pconfig['active_interface'] = implode(",", $pconfig['active_interface']); } $display_custom_options = $pconfig['custom_options']; $pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options'])); if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) { $display_outgoing_interface = $pconfig['outgoing_interface']; $pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']); } $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:"); $input_errors = array_merge($input_errors, $test_output); } if (!$input_errors) { $a_unboundcfg['enable'] = isset($pconfig['enable']); $a_unboundcfg['port'] = $pconfig['port']; $a_unboundcfg['dnssec'] = isset($pconfig['dnssec']); $a_unboundcfg['forwarding'] = isset($pconfig['forwarding']); $a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']); $a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']); $a_unboundcfg['active_interface'] = $pconfig['active_interface']; $a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface']; $a_unboundcfg['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type']; $a_unboundcfg['custom_options'] = $pconfig['custom_options']; write_config(gettext("DNS Resolver configured.")); mark_subsystem_dirty('unbound'); } $pconfig['active_interface'] = $display_active_interface; $pconfig['outgoing_interface'] = $display_outgoing_interface; $pconfig['custom_options'] = $display_custom_options; } } if ($_GET['act'] == "del") { if ($_GET['type'] == 'host') { if ($a_hosts[$_GET['id']]) { unset($a_hosts[$_GET['id']]); write_config(); mark_subsystem_dirty('unbound'); header("Location: services_unbound.php"); exit; } } elseif ($_GET['type'] == 'doverride') { if ($a_domainOverrides[$_GET['id']]) { unset($a_domainOverrides[$_GET['id']]); write_config(); mark_subsystem_dirty('unbound'); header("Location: services_unbound.php"); exit; } } } function build_if_list($selectedifs) { $interface_addresses = get_possible_listen_ips(true); $iflist = array('options' => array(), 'selected' => array()); $iflist['options']['all'] = gettext("All"); if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) { array_push($iflist['selected'], "all"); } foreach ($interface_addresses as $laddr => $ldescr) { $iflist['options'][$laddr] = htmlspecialchars($ldescr); if ($selectedifs && in_array($laddr, $selectedifs)) { array_push($iflist['selected'], $laddr); } } unset($interface_addresses); return($iflist); } $pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General Settings")); $shortcut_section = "resolver"; include_once("head.inc"); if ($input_errors) { print_input_errors($input_errors); } if ($savemsg) { print_info_box($savemsg, 'success'); } if (is_subsystem_dirty('unbound')) { print_apply_box(gettext("The DNS resolver configuration has been changed.") . "
" . gettext("You must apply the changes in order for them to take effect.")); } $tab_array = array(); $tab_array[] = array(gettext("General Settings"), true, "services_unbound.php"); $tab_array[] = array(gettext("Advanced Settings"), false, "services_unbound_advanced.php"); $tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php"); display_top_tabs($tab_array, true); $form = new Form(); $section = new Form_Section('General DNS Resolver Options'); $section->addInput(new Form_Checkbox( 'enable', 'Enable', 'Enable DNS resolver', $pconfig['enable'] )); $section->addInput(new Form_Input( 'port', 'Listen Port', 'number', $pconfig['port'], ['placeholder' => '53'] ))->setHelp('The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.'); $activeiflist = build_if_list($pconfig['active_interface']); $section->addInput(new Form_Select( 'active_interface', 'Network Interfaces', $activeiflist['selected'], $activeiflist['options'], true ))->addClass('general')->setHelp('Interface IPs used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. ' . 'The default behavior is to respond to queries on every available IPv4 and IPv6 address.'); $outiflist = build_if_list($pconfig['outgoing_interface']); $section->addInput(new Form_Select( 'outgoing_interface', 'Outgoing Network Interfaces', $outiflist['selected'], $outiflist['options'], 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.'); $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() ))->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( 'dnssec', 'DNSSEC', 'Enable DNSSEC Support', $pconfig['dnssec'] )); $section->addInput(new Form_Checkbox( 'forwarding', 'DNS Query Forwarding', 'Enable Forwarding Mode', $pconfig['forwarding'] )); $section->addInput(new Form_Checkbox( 'regdhcp', 'DHCP Registration', 'Register DHCP leases in the DNS Resolver', $pconfig['regdhcp'] ))->setHelp(sprintf('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.','','')); $section->addInput(new Form_Checkbox( 'regdhcpstatic', 'Static DHCP', 'Register DHCP static mappings in the DNS Resolver', $pconfig['regdhcpstatic'] ))->setHelp(sprintf('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.','','')); $btnadvdns = new Form_Button( 'btnadvdns', 'Custom options' ); $btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm'); $section->addInput(new Form_StaticText( 'Custom options', $btnadvdns . ' ' . 'Show custom options' )); $section->addInput(new Form_Textarea ( 'custom_options', 'Custom options', $pconfig['custom_options'] ))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline'); $form->add($section); print($form); ?>

     
', ''), 'info', false); ?>