Project

General

Profile

Download (24.1 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * services_unbound.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
9
 * Copyright (c) 2014 Warren Baker (warren@pfsense.org)
10
 * All rights reserved.
11
 *
12
 * Licensed under the Apache License, Version 2.0 (the "License");
13
 * you may not use this file except in compliance with the License.
14
 * You may obtain a copy of the License at
15
 *
16
 * http://www.apache.org/licenses/LICENSE-2.0
17
 *
18
 * Unless required by applicable law or agreed to in writing, software
19
 * distributed under the License is distributed on an "AS IS" BASIS,
20
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
 * See the License for the specific language governing permissions and
22
 * limitations under the License.
23
 */
24

    
25
##|+PRIV
26
##|*IDENT=page-services-dnsresolver
27
##|*NAME=Services: DNS Resolver
28
##|*DESCR=Allow access to the 'Services: DNS Resolver' page.
29
##|*MATCH=services_unbound.php*
30
##|-PRIV
31

    
32
require_once("guiconfig.inc");
33
require_once("unbound.inc");
34
require_once("pfsense-utils.inc");
35
require_once("system.inc");
36

    
37
$pconfig['enable'] = config_path_enabled('unbound');
38
$pconfig['enablessl'] = config_path_enabled('unbound', 'enablessl');
39
$pconfig['strictout'] = config_path_enabled('unbound', 'strictout');
40
$pconfig['dnssec'] = config_path_enabled('unbound', 'dnssec');
41
$pconfig['python'] = config_path_enabled('unbound', 'python');
42
$pconfig['forwarding'] = config_path_enabled('unbound', 'forwarding');
43
$pconfig['forward_tls_upstream'] = config_path_enabled('unbound', 'forward_tls_upstream');
44
$pconfig['regdhcp'] = config_path_enabled('unbound', 'regdhcp');
45
$pconfig['regdhcpstatic'] = config_path_enabled('unbound', 'regdhcpstatic');
46
$pconfig['regovpnclients'] = config_path_enabled('unbound', 'regovpnclients');
47

    
48
$pconfig['python_order'] = config_get_path('unbound/python_order');
49
$pconfig['python_script'] = config_get_path('unbound/python_script');
50
$pconfig['port'] = config_get_path('unbound/port');
51
$pconfig['tlsport'] = config_get_path('unbound/tlsport');
52
$pconfig['sslcertref'] = config_get_path('unbound/sslcertref');
53
$pconfig['custom_options'] = base64_decode(config_get_path('unbound/custom_options'));
54

    
55
if (config_get_path('unbound/active_interface')) {
56
	$pconfig['active_interface'] = explode(",", config_get_path('unbound/active_interface'));
57
} else {
58
	$pconfig['active_interface'] = array();
59
}
60

    
61
if (config_get_path('unbound/outgoing_interface')) {
62
	$pconfig['outgoing_interface'] = explode(",", config_get_path('unbound/outgoing_interface'));
63
} else {
64
	$pconfig['outgoing_interface'] = array();
65
}
66

    
67
$pconfig['system_domain_local_zone_type'] = config_get_path('unbound/system_domain_local_zone_type', 'transparent');
68

    
69
$certs_available = false;
70
if (count(config_get_path('cert', []))) {
71
	$certs_available = true;
72
}
73

    
74
if ($_POST['apply']) {
75
	$retval = 0;
76
	$retval |= services_unbound_configure();
77
	if ($retval == 0) {
78
		clear_subsystem_dirty('unbound');
79
	}
80
	/* Update resolv.conf in case the interface bindings exclude localhost. */
81
	system_resolvconf_generate();
82
	/* Start or restart dhcpleases when it's necessary */
83
	system_dhcpleases_configure();
84
}
85

    
86
if ($_POST['save']) {
87
	$pconfig = $_POST;
88
	unset($input_errors);
89

    
90
	if (isset($pconfig['enable']) && config_path_enabled('dnsmasq')) {
91
		if ($pconfig['port'] == config_get_path('dnsmasq/port')) {
92
			$input_errors[] = gettext("The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.");
93
		}
94
	}
95

    
96
	if (isset($pconfig['enablessl']) && (!$certs_available || empty($pconfig['sslcertref']))) {
97
		$input_errors[] = gettext("Acting as an SSL/TLS server requires a valid server certificate");
98
	}
99

    
100
	// forwarding mode requires having valid DNS servers
101
	if (isset($pconfig['forwarding'])) {
102
		$founddns = false;
103
		foreach (get_dns_nameservers(false, true) as $dns_server) {
104
			if (!ip_in_subnet($dns_server, "127.0.0.0/8")) {
105
				$founddns = true;
106
			}
107
		}
108
		if ($founddns == false) {
109
			$input_errors[] = gettext("At least one DNS server must be specified under System > General Setup to enable Forwarding mode.");
110
		}
111
	}
112

    
113
	if (empty($pconfig['active_interface'])) {
114
		$input_errors[] = gettext("One or more Network Interfaces must be selected for binding.");
115
	} elseif ((config_get_path('system/dnslocalhost') != 'remote') && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) {
116
		$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.");
117
	}
118

    
119
	if (empty($pconfig['outgoing_interface'])) {
120
		$input_errors[] = gettext("One or more Outgoing Network Interfaces must be selected.");
121
	}
122

    
123
	if ($pconfig['port'] && !is_port($pconfig['port'])) {
124
		$input_errors[] = gettext("A valid port number must be specified.");
125
	}
126
	if ($pconfig['tlsport'] && !is_port($pconfig['tlsport'])) {
127
		$input_errors[] = gettext("A valid SSL/TLS port number must be specified.");
128
	}
129

    
130
	if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) {
131
		$display_active_interface = $pconfig['active_interface'];
132
		$pconfig['active_interface'] = implode(",", $pconfig['active_interface']);
133
	}
134

    
135
	if ((isset($pconfig['regdhcp']) || isset($pconfig['regdhcpstatic'])) && !is_dhcp_server_enabled()) {
136
		$input_errors[] = gettext("DHCP Server must be enabled for DHCP Registration to work in DNS Resolver.");
137
	}
138

    
139
	if (($pconfig['system_domain_local_zone_type'] == "redirect") && isset($pconfig['regdhcp'])) {
140
		$input_errors[] = gettext('A System Domain Local Zone Type of "redirect" is not compatible with dynamic DHCP Registration.');
141
	}
142

    
143
	$display_custom_options = $pconfig['custom_options'];
144
	$pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options']));
145

    
146
	if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) {
147
		$display_outgoing_interface = $pconfig['outgoing_interface'];
148
		$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
149
	}
150

    
151
	$test_output = array();
152
	if (test_unbound_config($pconfig, $test_output)) {
153
		$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
154
		$input_errors = array_merge($input_errors, $test_output);
155
	}
156

    
157
	if (!$input_errors) {
158
		config_set_path('unbound/enable', isset($pconfig['enable']));
159
		config_set_path('unbound/enablessl', isset($pconfig['enablessl']));
160
		config_set_path('unbound/port', $pconfig['port']);
161
		config_set_path('unbound/tlsport', $pconfig['tlsport']);
162
		config_set_path('unbound/sslcertref', $pconfig['sslcertref']);
163
		config_set_path('unbound/strictout', isset($pconfig['strictout']));
164
		config_set_path('unbound/dnssec', isset($pconfig['dnssec']));
165

    
166
		config_set_path('unbound/python', isset($pconfig['python']));
167
		if (isset($pconfig['python'])) {
168
			config_set_path('unbound/python_order', $pconfig['python_order']);
169
			config_set_path('unbound/python_script', $pconfig['python_script']);
170
		} else {
171
			config_del_path('unbound/python_order');
172
			config_del_path('unbound/python_script');
173
		}
174

    
175
		config_set_path('unbound/forwarding', isset($pconfig['forwarding']));
176
		config_set_path('unbound/forward_tls_upstream', isset($pconfig['forward_tls_upstream']));
177
		config_set_path('unbound/regdhcp', isset($pconfig['regdhcp']));
178
		config_set_path('unbound/regdhcpstatic', isset($pconfig['regdhcpstatic']));
179
		config_set_path('unbound/regovpnclients', isset($pconfig['regovpnclients']));
180
		config_set_path('unbound/active_interface', $pconfig['active_interface']);
181
		config_set_path('unbound/outgoing_interface', $pconfig['outgoing_interface']);
182
		config_set_path('unbound/system_domain_local_zone_type', $pconfig['system_domain_local_zone_type']);
183
		config_set_path('unbound/custom_options', $pconfig['custom_options']);
184

    
185
		write_config(gettext("DNS Resolver configured."));
186
		mark_subsystem_dirty('unbound');
187
	}
188

    
189
	$pconfig['active_interface'] = $display_active_interface;
190
	$pconfig['outgoing_interface'] = $display_outgoing_interface;
191
	$pconfig['custom_options'] = $display_custom_options;
192
}
193

    
194

    
195
if ($pconfig['custom_options']) {
196
	$customoptions = true;
197
} else {
198
	$customoptions = false;
199
}
200

    
201
if ($_POST['act'] == "del") {
202
	if ($_POST['type'] == 'host') {
203
		if (config_get_path('unbound/hosts/' . $_POST['id'])) {
204
			config_del_path('unbound/hosts/' . $_POST['id']);
205
			write_config(gettext("Host override deleted from DNS Resolver."));
206
			mark_subsystem_dirty('unbound');
207
			header("Location: services_unbound.php");
208
			exit;
209
		}
210
	} elseif ($_POST['type'] == 'doverride') {
211
		if (config_get_path('unbound/domainoverrides/' . $_POST['id'])) {
212
			config_del_path('unbound/domainoverrides/' . $_POST['id']);
213
			write_config(gettext("Domain override deleted from DNS Resolver."));
214
			mark_subsystem_dirty('unbound');
215
			header("Location: services_unbound.php");
216
			exit;
217
		}
218
	}
219
}
220

    
221
function build_if_list($selectedifs) {
222
	$interface_addresses = get_possible_listen_ips(true);
223
	$iflist = array('options' => array(), 'selected' => array());
224

    
225
	$iflist['options']['all']	= gettext("All");
226
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
227
		array_push($iflist['selected'], "all");
228
	}
229

    
230
	foreach ($interface_addresses as $laddr => $ldescr) {
231
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
232

    
233
		if ($selectedifs && in_array($laddr, $selectedifs)) {
234
			array_push($iflist['selected'], $laddr);
235
		}
236
	}
237

    
238
	unset($interface_addresses);
239

    
240
	return($iflist);
241
}
242

    
243
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General Settings"));
244
$pglinks = array("", "@self", "@self");
245
$shortcut_section = "resolver";
246

    
247
include_once("head.inc");
248

    
249
if ($input_errors) {
250
	print_input_errors($input_errors);
251
}
252

    
253
if ($_POST['apply']) {
254
	print_apply_result_box($retval);
255
}
256

    
257
if (is_subsystem_dirty('unbound')) {
258
	print_apply_box(gettext("The DNS resolver configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
259
}
260

    
261
display_isc_warning();
262

    
263
$tab_array = array();
264
$tab_array[] = array(gettext("General Settings"), true, "services_unbound.php");
265
$tab_array[] = array(gettext("Advanced Settings"), false, "services_unbound_advanced.php");
266
$tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php");
267
display_top_tabs($tab_array, true);
268

    
269
$form = new Form();
270

    
271
$section = new Form_Section('General DNS Resolver Options');
272

    
273
$section->addInput(new Form_Checkbox(
274
	'enable',
275
	'Enable',
276
	'Enable DNS resolver',
277
	$pconfig['enable']
278
));
279

    
280
$section->addInput(new Form_Input(
281
	'port',
282
	'Listen Port',
283
	'number',
284
	$pconfig['port'],
285
	['placeholder' => '53']
286
))->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.');
287

    
288
$section->addInput(new Form_Checkbox(
289
	'enablessl',
290
	'Enable SSL/TLS Service',
291
	'Respond to incoming SSL/TLS queries from local clients',
292
	$pconfig['enablessl']
293
))->setHelp('Configures the DNS Resolver to act as a DNS over SSL/TLS server which can answer queries from clients which also support DNS over TLS. ' .
294
		'Activating this option disables automatic interface response routing behavior, thus it works best with specific interface bindings.' );
295

    
296
if ($certs_available) {
297
	$section->addInput($input = new Form_Select(
298
		'sslcertref',
299
		'SSL/TLS Certificate',
300
		$pconfig['sslcertref'],
301
		cert_build_list('cert', 'IPsec')
302
	))->setHelp('The server certificate to use for SSL/TLS service. The CA chain will be determined automatically.');
303
} else {
304
	$section->addInput(new Form_StaticText(
305
		'SSL/TLS Certificate',
306
		sprintf('No Certificates have been defined. A certificate is required before SSL/TLS can be enabled. %1$s Create or Import %2$s a Certificate.',
307
		'<a href="system_certmanager.php">', '</a>')
308
	));
309
}
310

    
311
$section->addInput(new Form_Input(
312
	'tlsport',
313
	'SSL/TLS Listen Port',
314
	'number',
315
	$pconfig['tlsport'],
316
	['placeholder' => '853']
317
))->setHelp('The port used for responding to SSL/TLS DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 853.');
318

    
319
$activeiflist = build_if_list($pconfig['active_interface']);
320

    
321
$section->addInput(new Form_Select(
322
	'active_interface',
323
	'*Network Interfaces',
324
	$activeiflist['selected'],
325
	$activeiflist['options'],
326
	true
327
))->addClass('general', 'resizable')->setHelp('Interface IP addresses used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 addresses, both are used. Queries to addresses not selected in this list are discarded. ' .
328
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
329

    
330
$outiflist = build_if_list($pconfig['outgoing_interface']);
331

    
332
$section->addInput(new Form_Select(
333
	'outgoing_interface',
334
	'*Outgoing Network Interfaces',
335
	$outiflist['selected'],
336
	$outiflist['options'],
337
	true
338
))->addClass('general', 'resizable')->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.');
339

    
340
$section->addInput(new Form_Checkbox(
341
	'strictout',
342
	'Strict Outgoing Network Interface Binding',
343
	'Do not send recursive queries if none of the selected Outgoing Network Interfaces are available.',
344
	$pconfig['strictout']
345
))->setHelp('By default the DNS Resolver sends recursive DNS requests over any available interfaces if none of the selected Outgoing Network Interfaces are available. This option makes the DNS Resolver refuse recursive queries.');
346

    
347
$section->addInput(new Form_Select(
348
	'system_domain_local_zone_type',
349
	'*System Domain Local Zone Type',
350
	$pconfig['system_domain_local_zone_type'],
351
	unbound_local_zone_types()
352
))->setHelp('The local-zone type used for the %1$s system domain (System | General Setup | Domain).  Transparent is the default.', g_get('product_label'));
353

    
354
$section->addInput(new Form_Checkbox(
355
	'dnssec',
356
	'DNSSEC',
357
	'Enable DNSSEC Support',
358
	$pconfig['dnssec']
359
));
360

    
361
$section->addInput(new Form_Checkbox(
362
	'python',
363
	'Python Module',
364
	'Enable Python Module',
365
	$pconfig['python']
366
))->setHelp('Enable the Python Module.');
367

    
368
$python_files = glob("{$g['unbound_chroot_path']}/*.py");
369
$python_scripts = array();
370
if (!empty($python_files)) {
371
	foreach ($python_files as $file) {
372
		$file = pathinfo($file, PATHINFO_FILENAME);
373
		$python_scripts[$file] = $file;
374
	}
375
}
376
else {
377
	$python_scripts = array('' => 'No Python Module scripts found');
378
}
379

    
380
$section->addInput(new Form_Select(
381
	'python_order',
382
	'Python Module Order',
383
	$pconfig['python_order'],
384
	[ 'pre_validator' => 'Pre Validator', 'post_validator' => 'Post Validator' ]
385
))->setHelp('Select the Python Module ordering.');
386

    
387
$section->addInput(new Form_Select(
388
	'python_script',
389
	'Python Module Script',
390
	$pconfig['python_script'],
391
	$python_scripts
392
))->setHelp('Select the Python module script to utilize.');
393

    
394
$section->addInput(new Form_Checkbox(
395
	'forwarding',
396
	'DNS Query Forwarding',
397
	'Enable Forwarding Mode',
398
	$pconfig['forwarding']
399
))->setHelp('If this option is set, DNS queries will be forwarded to the upstream DNS servers defined under'.
400
					' %1$sSystem &gt; General Setup%2$s or those obtained via dynamic ' .
401
					'interfaces such as DHCP, PPP, or OpenVPN (if DNS Server Override ' .
402
				        'is enabled there).','<a href="system.php">','</a>');
403

    
404
$section->addInput(new Form_Checkbox(
405
	'forward_tls_upstream',
406
	null,
407
	'Use SSL/TLS for outgoing DNS Queries to Forwarding Servers',
408
	$pconfig['forward_tls_upstream']
409
))->setHelp('When set in conjunction with DNS Query Forwarding, queries to all upstream forwarding DNS servers will be sent using SSL/TLS on the default port of 853. Note that ALL configured forwarding servers MUST support SSL/TLS queries on port 853.');
410

    
411
if (dhcp_is_backend('isc')):
412
$section->addInput(new Form_Checkbox(
413
	'regdhcp',
414
	'DHCP Registration',
415
	'Register DHCP leases in the DNS Resolver',
416
	$pconfig['regdhcp']
417
))->setHelp('If this option is set, then machines that specify their hostname when requesting an IPv4 DHCP lease will be registered'.
418
					' in the DNS Resolver so that their name can be resolved.'.
419
	    				' Note that this will cause the Resolver to reload and flush its resolution cache whenever a DHCP lease is issued.'.
420
					' The domain in %1$sSystem &gt; General Setup%2$s should also be set to the proper value.','<a href="system.php">','</a>');
421

    
422
$section->addInput(new Form_Checkbox(
423
	'regdhcpstatic',
424
	'Static DHCP',
425
	'Register DHCP static mappings in the DNS Resolver',
426
	$pconfig['regdhcpstatic']
427
))->setHelp('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be resolved. '.
428
					'The domain in %1$sSystem &gt; General Setup%2$s should also be set to the proper value.','<a href="system.php">','</a>');
429
endif;
430

    
431
$section->addInput(new Form_Checkbox(
432
	'regovpnclients',
433
	'OpenVPN Clients',
434
	'Register connected OpenVPN clients in the DNS Resolver',
435
	$pconfig['regovpnclients']
436
))->setHelp(sprintf('If this option is set, then the common name (CN) of connected OpenVPN clients will be ' .
437
	    'registered in the DNS Resolver, so that their name can be resolved. This only works for OpenVPN ' .
438
	    'servers (Remote Access SSL/TLS or User Auth with Username as Common Name option) operating ' .
439
	    'in "tun" mode. The domain in %sSystem: General Setup%s should also be set to the proper value.',
440
	    '<a href="system.php">','</a>'));
441

    
442
$btnadv = new Form_Button(
443
	'btnadvcustom',
444
	'Custom options',
445
	null,
446
	'fa-cog'
447
);
448

    
449
$btnadv->setAttribute('type','button')->addClass('btn-info btn-sm');
450

    
451
$section->addInput(new Form_StaticText(
452
	'Display Custom Options',
453
	$btnadv
454
));
455

    
456
$section->addInput(new Form_Textarea (
457
	'custom_options',
458
	'Custom options',
459
	$pconfig['custom_options']
460
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline.');
461

    
462
$form->add($section);
463
print($form);
464
?>
465

    
466
<script type="text/javascript">
467
//<![CDATA[
468
events.push(function() {
469

    
470
	// Show advanced custom options ==============================================
471
	var showadvcustom = false;
472

    
473
	function show_advcustom(ispageload) {
474
		var text;
475
		// On page load decide the initial state based on the data.
476
		if (ispageload) {
477
			showadvcustom = <?=($customoptions ? 'true' : 'false');?>;
478
		} else {
479
			// It was a click, swap the state.
480
			showadvcustom = !showadvcustom;
481
		}
482

    
483
		hideInput('custom_options', !showadvcustom);
484

    
485
		if (showadvcustom) {
486
			text = "<?=gettext('Hide Custom Options');?>";
487
		} else {
488
			text = "<?=gettext('Display Custom Options');?>";
489
		}
490
		$('#btnadvcustom').html('<i class="fa fa-cog"></i> ' + text);
491
	}
492

    
493
	// Un-hide additional controls
494
	$('#btnadvcustom').click(function(event) {
495
		show_advcustom();
496
	});
497

    
498
	// On initial load
499
	if ($('#custom_options').val().length == 0) {
500
		hideInput('custom_options', true);
501
	}
502

    
503
	show_advcustom(true);
504

    
505
	// When the Python Module 'enable' is clicked, disable/enable the Python Module options
506
	function show_python_script() {
507
		var python = $('#python').prop('checked');
508
		hideInput('python_order', !python);
509
		hideInput('python_script', !python);
510
	}
511
	show_python_script();
512
	$('#python').click(function () {
513
		show_python_script();
514
	});
515

    
516
});
517
//]]>
518
</script>
519

    
520
<div class="panel panel-default">
521
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
522
	<div class="panel-body table-responsive">
523
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
524
			<thead>
525
				<tr>
526
					<th><?=gettext("Host")?></th>
527
					<th><?=gettext("Parent domain of host")?></th>
528
					<th><?=gettext("IP to return for host")?></th>
529
					<th><?=gettext("Description")?></th>
530
					<th><?=gettext("Actions")?></th>
531
				</tr>
532
			</thead>
533
			<tbody>
534
<?php
535
foreach (config_get_path('unbound/hosts', []) as $idx => $hostent):
536
?>
537
				<tr>
538
					<td>
539
						<?=$hostent['host']?>
540
					</td>
541
					<td>
542
						<?=$hostent['domain']?>
543
					</td>
544
					<td>
545
						<?=$hostent['ip']?>
546
					</td>
547
					<td>
548
						<?=htmlspecialchars($hostent['descr'])?>
549
					</td>
550
					<td>
551
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" href="services_unbound_host_edit.php?id=<?=$idx?>"></a>
552
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>" href="services_unbound.php?type=host&amp;act=del&amp;id=<?=$idx?>" usepost></a>
553
					</td>
554
				</tr>
555

    
556
<?php
557
	foreach (array_get_path($hostent, 'aliases/item', []) as $alias):
558
?>
559
				<tr>
560
					<td>
561
						<?=$alias['host']?>
562
					</td>
563
					<td>
564
						<?=$alias['domain']?>
565
					</td>
566
					<td>
567
						<?=gettext("Alias for ");?><?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
568
					</td>
569
					<td>
570
						<i class="fa fa-angle-double-right text-info"></i>
571
						<?=htmlspecialchars($alias['description'])?>
572
					</td>
573
					<td>
574
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$idx?>"></a>
575
					</td>
576
				</tr>
577
<?php
578
	endforeach;
579
endforeach;
580
?>
581
			</tbody>
582
		</table>
583
	</div>
584
</div>
585

    
586
<span class="help-block">
587
	Enter any individual hosts for which the resolver's standard DNS lookup process should be overridden and a specific
588
	IPv4 or IPv6 address should automatically be returned by the resolver. Standard and also non-standard names and parent domains
589
	can be entered, such as 'test', 'nas.home.arpa', 'mycompany.localdomain', '1.168.192.in-addr.arpa', or 'somesite.com'. Any lookup attempt for
590
	the host will automatically return the given IP address, and the usual lookup server for the domain will not be queried for
591
	the host's records.
592
</span>
593

    
594
<nav class="action-buttons">
595
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
596
		<i class="fa fa-plus icon-embed-btn"></i>
597
		<?=gettext('Add')?>
598
	</a>
599
</nav>
600

    
601
<div class="panel panel-default">
602
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
603
	<div class="panel-body table-responsive">
604
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
605
			<thead>
606
				<tr>
607
					<th><?=gettext("Domain")?></th>
608
					<th><?=gettext("Lookup Server IP Address")?></th>
609
					<th><?=gettext("Description")?></th>
610
					<th><?=gettext("Actions")?></th>
611
				</tr>
612
			</thead>
613

    
614
			<tbody>
615
<?php
616
$i = 0;
617
foreach (config_get_path('unbound/domainoverrides') as $doment):
618
?>
619
				<tr>
620
					<td>
621
						<?=$doment['domain']?>&nbsp;
622
					</td>
623
					<td>
624
						<?=$doment['ip']?>&nbsp;
625
					</td>
626
					<td>
627
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
628
					</td>
629
					<td>
630
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
631
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>" usepost></a>
632
					</td>
633
				</tr>
634
<?php
635
	$i++;
636
endforeach;
637
?>
638
			</tbody>
639
		</table>
640
	</div>
641
</div>
642

    
643
<span class="help-block">
644
	Enter any domains for which the resolver's standard DNS lookup process should be overridden and a different (non-standard)
645
	lookup server should be queried instead. Non-standard, 'invalid' and local domains, and subdomains, can also be entered,
646
	such as 'test', 'nas.home.arpa', 'mycompany.localdomain', '1.168.192.in-addr.arpa', or 'somesite.com'. The IP address is treated as the
647
	authoritative lookup server for the domain (including all of its subdomains), and other lookup servers will not be queried.
648
	If there are multiple authoritative DNS servers available for a domain then make a separate entry for each,
649
	using the same domain name.
650
</span>
651

    
652
<nav class="action-buttons">
653
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
654
		<i class="fa fa-plus icon-embed-btn"></i>
655
		<?=gettext('Add')?>
656
	</a>
657
</nav>
658

    
659
<div class="infoblock">
660
	<?php print_info_box(sprintf(gettext('If the DNS Resolver is enabled, the DHCP'.
661
		' service (if enabled) will automatically serve the LAN IP'.
662
		' address as a DNS server to DHCP clients so they will use'.
663
		' the DNS Resolver. If Forwarding is enabled, the DNS Resolver will use the DNS servers'.
664
		' entered in %1$sSystem &gt; General Setup%2$s'.
665
		' or those obtained via DHCP or PPP on WAN if &quot;Allow'.
666
		' DNS server list to be overridden by DHCP/PPP on WAN&quot;'.
667
		' is checked.'), '<a href="system.php">', '</a>'), 'info', false); ?>
668
</div>
669

    
670
<?php
671
include("foot.inc");
(141-141/228)