Project

General

Profile

Download (22.6 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-2018 Rubicon Communications, LLC (Netgate)
7
 * Copyright (c) 2014 Warren Baker (warren@pfsense.org)
8
 * All rights reserved.
9
 *
10
 * Licensed under the Apache License, Version 2.0 (the "License");
11
 * you may not use this file except in compliance with the License.
12
 * You may obtain a copy of the License at
13
 *
14
 * http://www.apache.org/licenses/LICENSE-2.0
15
 *
16
 * Unless required by applicable law or agreed to in writing, software
17
 * distributed under the License is distributed on an "AS IS" BASIS,
18
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
 * See the License for the specific language governing permissions and
20
 * limitations under the License.
21
 */
22

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

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

    
35
if (!is_array($config['unbound'])) {
36
	$config['unbound'] = array();
37
}
38

    
39
$a_unboundcfg =& $config['unbound'];
40

    
41
if (!is_array($a_unboundcfg['hosts'])) {
42
	$a_unboundcfg['hosts'] = array();
43
}
44

    
45
$a_hosts =& $a_unboundcfg['hosts'];
46

    
47
if (!is_array($a_unboundcfg['domainoverrides'])) {
48
	$a_unboundcfg['domainoverrides'] = array();
49
}
50

    
51
$a_domainOverrides = &$a_unboundcfg['domainoverrides'];
52

    
53
if (isset($a_unboundcfg['enable'])) {
54
	$pconfig['enable'] = true;
55
}
56
if (isset($a_unboundcfg['enablessl'])) {
57
	$pconfig['enablessl'] = true;
58
}
59
if (isset($a_unboundcfg['dnssec'])) {
60
	$pconfig['dnssec'] = true;
61
}
62
if (isset($a_unboundcfg['forwarding'])) {
63
	$pconfig['forwarding'] = true;
64
}
65
if (isset($a_unboundcfg['forward_tls_upstream'])) {
66
	$pconfig['forward_tls_upstream'] = true;
67
}
68
if (isset($a_unboundcfg['regdhcp'])) {
69
	$pconfig['regdhcp'] = true;
70
}
71
if (isset($a_unboundcfg['regdhcpstatic'])) {
72
	$pconfig['regdhcpstatic'] = true;
73
}
74
if (isset($a_unboundcfg['regovpnclients'])) {
75
	$pconfig['regovpnclients'] = true;
76
}
77

    
78
$pconfig['port'] = $a_unboundcfg['port'];
79
$pconfig['sslport'] = $a_unboundcfg['sslport'];
80
$pconfig['sslcertref'] = $a_unboundcfg['sslcertref'];
81
$pconfig['custom_options'] = base64_decode($a_unboundcfg['custom_options']);
82

    
83
if (empty($a_unboundcfg['active_interface'])) {
84
	$pconfig['active_interface'] = array();
85
} else {
86
	$pconfig['active_interface'] = explode(",", $a_unboundcfg['active_interface']);
87
}
88

    
89
if (empty($a_unboundcfg['outgoing_interface'])) {
90
	$pconfig['outgoing_interface'] = array();
91
} else {
92
	$pconfig['outgoing_interface'] = explode(",", $a_unboundcfg['outgoing_interface']);
93
}
94

    
95
if (empty($a_unboundcfg['system_domain_local_zone_type'])) {
96
	$pconfig['system_domain_local_zone_type'] = "transparent";
97
} else {
98
	$pconfig['system_domain_local_zone_type'] = $a_unboundcfg['system_domain_local_zone_type'];
99
}
100

    
101
$a_cert =& $config['cert'];
102
$certs_available = false;
103

    
104
if (is_array($a_cert) && count($a_cert)) {
105
	$certs_available = true;
106
} else {
107
	$a_cert = array();
108
}
109

    
110
if ($_POST['apply']) {
111
	$retval = 0;
112
	$retval |= services_unbound_configure();
113
	if ($retval == 0) {
114
		clear_subsystem_dirty('unbound');
115
	}
116
	/* Update resolv.conf in case the interface bindings exclude localhost. */
117
	system_resolvconf_generate();
118
	/* Start or restart dhcpleases when it's necessary */
119
	system_dhcpleases_configure();
120
}
121

    
122
if ($_POST['save']) {
123
	$pconfig = $_POST;
124
	unset($input_errors);
125

    
126
	if (isset($pconfig['enable']) && isset($config['dnsmasq']['enable'])) {
127
		if ($pconfig['port'] == $config['dnsmasq']['port']) {
128
			$input_errors[] = gettext("The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.");
129
		}
130
	}
131

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

    
136
	// forwarding mode requires having valid DNS servers
137
	if (isset($pconfig['forwarding'])) {
138
		$founddns = false;
139
		if (isset($config['system']['dnsallowoverride'])) {
140
			$dns_servers = get_dns_servers();
141
			if (is_array($dns_servers)) {
142
				foreach ($dns_servers as $dns_server) {
143
					if (!ip_in_subnet($dns_server, "127.0.0.0/8")) {
144
						$founddns = true;
145
					}
146
				}
147
			}
148
		}
149
		if (is_array($config['system']['dnsserver'])) {
150
			foreach ($config['system']['dnsserver'] as $dnsserver) {
151
				if (is_ipaddr($dnsserver)) {
152
					$founddns = true;
153
				}
154
			}
155
		}
156
		if ($founddns == false) {
157
			$input_errors[] = gettext("At least one DNS server must be specified under System &gt; General Setup to enable Forwarding mode.");
158
		}
159
	}
160

    
161
	if (empty($pconfig['active_interface'])) {
162
		$input_errors[] = gettext("One or more Network Interfaces must be selected for binding.");
163
	} else if (!isset($config['system']['dnslocalhost']) && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) {
164
		$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.");
165
	}
166

    
167
	if (empty($pconfig['outgoing_interface'])) {
168
		$input_errors[] = gettext("One or more Outgoing Network Interfaces must be selected.");
169
	}
170

    
171
	if ($pconfig['port'] && !is_port($pconfig['port'])) {
172
		$input_errors[] = gettext("A valid port number must be specified.");
173
	}
174
	if ($pconfig['sslport'] && !is_port($pconfig['sslport'])) {
175
		$input_errors[] = gettext("A valid SSL/TLS port number must be specified.");
176
	}
177

    
178
	if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) {
179
		$display_active_interface = $pconfig['active_interface'];
180
		$pconfig['active_interface'] = implode(",", $pconfig['active_interface']);
181
	}
182

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

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

    
191
	$display_custom_options = $pconfig['custom_options'];
192
	$pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options']));
193

    
194
	if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) {
195
		$display_outgoing_interface = $pconfig['outgoing_interface'];
196
		$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
197
	}
198

    
199
	$test_output = array();
200
	if (test_unbound_config($pconfig, $test_output)) {
201
		$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
202
		$input_errors = array_merge($input_errors, $test_output);
203
	}
204

    
205
	if (!$input_errors) {
206
		$a_unboundcfg['enable'] = isset($pconfig['enable']);
207
		$a_unboundcfg['enablessl'] = isset($pconfig['enablessl']);
208
		$a_unboundcfg['port'] = $pconfig['port'];
209
		$a_unboundcfg['sslport'] = $pconfig['sslport'];
210
		$a_unboundcfg['sslcertref'] = $pconfig['sslcertref'];
211
		$a_unboundcfg['dnssec'] = isset($pconfig['dnssec']);
212
		$a_unboundcfg['forwarding'] = isset($pconfig['forwarding']);
213
		$a_unboundcfg['forward_tls_upstream'] = isset($pconfig['forward_tls_upstream']);
214
		$a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']);
215
		$a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']);
216
		$a_unboundcfg['regovpnclients'] = isset($pconfig['regovpnclients']);
217
		$a_unboundcfg['active_interface'] = $pconfig['active_interface'];
218
		$a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface'];
219
		$a_unboundcfg['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
220
		$a_unboundcfg['custom_options'] = $pconfig['custom_options'];
221

    
222
		write_config(gettext("DNS Resolver configured."));
223
		mark_subsystem_dirty('unbound');
224
	}
225

    
226
	$pconfig['active_interface'] = $display_active_interface;
227
	$pconfig['outgoing_interface'] = $display_outgoing_interface;
228
	$pconfig['custom_options'] = $display_custom_options;
229
}
230

    
231

    
232
if ($pconfig['custom_options']) {
233
	$customoptions = true;
234
} else {
235
	$customoptions = false;
236
}
237

    
238
if ($_POST['act'] == "del") {
239
	if ($_POST['type'] == 'host') {
240
		if ($a_hosts[$_POST['id']]) {
241
			unset($a_hosts[$_POST['id']]);
242
			write_config(gettext("Host override deleted from DNS Resolver."));
243
			mark_subsystem_dirty('unbound');
244
			header("Location: services_unbound.php");
245
			exit;
246
		}
247
	} elseif ($_POST['type'] == 'doverride') {
248
		if ($a_domainOverrides[$_POST['id']]) {
249
			unset($a_domainOverrides[$_POST['id']]);
250
			write_config(gettext("Domain override deleted from DNS Resolver."));
251
			mark_subsystem_dirty('unbound');
252
			header("Location: services_unbound.php");
253
			exit;
254
		}
255
	}
256
}
257

    
258
function build_if_list($selectedifs) {
259
	$interface_addresses = get_possible_listen_ips(true);
260
	$iflist = array('options' => array(), 'selected' => array());
261

    
262
	$iflist['options']['all']	= gettext("All");
263
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
264
		array_push($iflist['selected'], "all");
265
	}
266

    
267
	foreach ($interface_addresses as $laddr => $ldescr) {
268
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
269

    
270
		if ($selectedifs && in_array($laddr, $selectedifs)) {
271
			array_push($iflist['selected'], $laddr);
272
		}
273
	}
274

    
275
	unset($interface_addresses);
276

    
277
	return($iflist);
278
}
279

    
280
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General Settings"));
281
$pglinks = array("", "@self", "@self");
282
$shortcut_section = "resolver";
283

    
284
include_once("head.inc");
285

    
286
if ($input_errors) {
287
	print_input_errors($input_errors);
288
}
289

    
290
if ($_POST['apply']) {
291
	print_apply_result_box($retval);
292
}
293

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

    
298
$tab_array = array();
299
$tab_array[] = array(gettext("General Settings"), true, "services_unbound.php");
300
$tab_array[] = array(gettext("Advanced Settings"), false, "services_unbound_advanced.php");
301
$tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php");
302
display_top_tabs($tab_array, true);
303

    
304
$form = new Form();
305

    
306
$section = new Form_Section('General DNS Resolver Options');
307

    
308
$section->addInput(new Form_Checkbox(
309
	'enable',
310
	'Enable',
311
	'Enable DNS resolver',
312
	$pconfig['enable']
313
));
314

    
315
$section->addInput(new Form_Input(
316
	'port',
317
	'Listen Port',
318
	'number',
319
	$pconfig['port'],
320
	['placeholder' => '53']
321
))->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.');
322

    
323
$section->addInput(new Form_Checkbox(
324
	'enablessl',
325
	'Enable SSL/TLS Service',
326
	'Respond to incoming SSL/TLS queries from local clients',
327
	$pconfig['enablessl']
328
))->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. ' .
329
		'Activating this option disables automatic interface response routing behavior, thus it works best with specific interface bindings.' );
330

    
331
if ($certs_available) {
332
	$values = array();
333
	foreach ($a_cert as $cert) {
334
		$values[ $cert['refid'] ] = $cert['descr'];
335
	}
336

    
337
	$section->addInput($input = new Form_Select(
338
		'sslcertref',
339
		'SSL/TLS Certificate',
340
		$pconfig['sslcertref'],
341
		$values
342
	))->setHelp('The server certificate to use for SSL/TLS service. The CA chain will be determined automatically.');
343
} else {
344
	$section->addInput(new Form_StaticText(
345
		'SSL/TLS Certificate',
346
		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.',
347
		'<a href="system_certmanager.php">', '</a>')
348
	));
349
}
350

    
351
$section->addInput(new Form_Input(
352
	'sslport',
353
	'SSL/TLS Listen Port',
354
	'number',
355
	$pconfig['sslport'],
356
	['placeholder' => '853']
357
))->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.');
358

    
359
$activeiflist = build_if_list($pconfig['active_interface']);
360

    
361
$section->addInput(new Form_Select(
362
	'active_interface',
363
	'*Network Interfaces',
364
	$activeiflist['selected'],
365
	$activeiflist['options'],
366
	true
367
))->addClass('general', 'resizable')->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. ' .
368
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
369

    
370
$outiflist = build_if_list($pconfig['outgoing_interface']);
371

    
372
$section->addInput(new Form_Select(
373
	'outgoing_interface',
374
	'*Outgoing Network Interfaces',
375
	$outiflist['selected'],
376
	$outiflist['options'],
377
	true
378
))->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.');
379

    
380
$section->addInput(new Form_Select(
381
	'system_domain_local_zone_type',
382
	'*System Domain Local Zone Type',
383
	$pconfig['system_domain_local_zone_type'],
384
	unbound_local_zone_types()
385
))->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.');
386

    
387
$section->addInput(new Form_Checkbox(
388
	'dnssec',
389
	'DNSSEC',
390
	'Enable DNSSEC Support',
391
	$pconfig['dnssec']
392
));
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 DHCP/PPP on WAN'.
401
					' (if DNS Server Override is enabled there).','<a href="system.php">','</a>');
402

    
403
$section->addInput(new Form_Checkbox(
404
	'forward_tls_upstream',
405
	null,
406
	'Use SSL/TLS for outgoing DNS Queries to Forwarding Servers',
407
	$pconfig['forward_tls_upstream']
408
))->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.');
409

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

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

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

    
435
$btnadv = new Form_Button(
436
	'btnadvcustom',
437
	'Custom options',
438
	null,
439
	'fa-cog'
440
);
441

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

    
444
$section->addInput(new Form_StaticText(
445
	'Display Custom Options',
446
	$btnadv
447
));
448

    
449
$section->addInput(new Form_Textarea (
450
	'custom_options',
451
	'Custom options',
452
	$pconfig['custom_options']
453
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline.');
454

    
455
$form->add($section);
456
print($form);
457
?>
458

    
459
<script type="text/javascript">
460
//<![CDATA[
461
events.push(function() {
462

    
463
	// Show advanced custom options ==============================================
464
	var showadvcustom = false;
465

    
466
	function show_advcustom(ispageload) {
467
		var text;
468
		// On page load decide the initial state based on the data.
469
		if (ispageload) {
470
			showadvcustom = <?=($customoptions ? 'true' : 'false');?>;
471
		} else {
472
			// It was a click, swap the state.
473
			showadvcustom = !showadvcustom;
474
		}
475

    
476
		hideInput('custom_options', !showadvcustom);
477

    
478
		if (showadvcustom) {
479
			text = "<?=gettext('Hide Custom Options');?>";
480
		} else {
481
			text = "<?=gettext('Display Custom Options');?>";
482
		}
483
		$('#btnadvcustom').html('<i class="fa fa-cog"></i> ' + text);
484
	}
485

    
486
	// If the enable checkbox is not checked, hide all inputs
487
	function hideGeneral() {
488
		var hide = ! $('#enable').prop('checked');
489

    
490
		hideMultiClass('general', hide);
491
		hideInput('port', hide);
492
		hideSelect('system_domain_local_zone_type', hide);
493
		hideCheckbox('dnssec', hide);
494
		hideCheckbox('forwarding', hide);
495
		hideCheckbox('regdhcp', hide);
496
		hideCheckbox('regdhcpstatic', hide);
497
		hideCheckbox('regovpnclients', hide);
498
		hideInput('btnadvcustom', hide);
499
		hideInput('custom_options', hide || !showadvcustom);
500
	}
501

    
502
	// Un-hide additional controls
503
	$('#btnadvcustom').click(function(event) {
504
		show_advcustom();
505
	});
506

    
507
	// When 'enable' is clicked, disable/enable the following hide inputs
508
	$('#enable').click(function() {
509
		hideGeneral();
510
	});
511

    
512
	// On initial load
513
	if ($('#custom_options').val().length == 0) {
514
		hideInput('custom_options', true);
515
	}
516

    
517
	hideGeneral();
518
	show_advcustom(true);
519

    
520
});
521
//]]>
522
</script>
523

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

    
561
<?php
562
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
563
		foreach ($hostent['aliases']['item'] as $alias):
564
?>
565
				<tr>
566
					<td>
567
						<?=$alias['host']?>
568
					</td>
569
					<td>
570
						<?=$alias['domain']?>
571
					</td>
572
					<td>
573
						<?=gettext("Alias for ");?><?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
574
					</td>
575
					<td>
576
						<i class="fa fa-angle-double-right text-info"></i>
577
						<?=htmlspecialchars($alias['description'])?>
578
					</td>
579
					<td>
580
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$i?>"></a>
581
					</td>
582
				</tr>
583
<?php
584
		endforeach;
585
	endif;
586
	$i++;
587
endforeach;
588
?>
589
			</tbody>
590
		</table>
591
	</div>
592
</div>
593

    
594
<span class="help-block">
595
	Enter any individual hosts for which the resolver's standard DNS lookup process should be overridden and a specific
596
	IPv4 or IPv6 address should automatically be returned by the resolver. Standard and also non-standard names and parent domains
597
	can be entered, such as 'test', 'mycompany.localdomain', '1.168.192.in-addr.arpa', or 'somesite.com'. Any lookup attempt for
598
	the host will automatically return the given IP address, and the usual lookup server for the domain will not be queried for
599
	the host's records.
600
</span>
601

    
602
<nav class="action-buttons">
603
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
604
		<i class="fa fa-plus icon-embed-btn"></i>
605
		<?=gettext('Add')?>
606
	</a>
607
</nav>
608

    
609
<div class="panel panel-default">
610
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
611
	<div class="panel-body table-responsive">
612
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
613
			<thead>
614
				<tr>
615
					<th><?=gettext("Domain")?></th>
616
					<th><?=gettext("Lookup Server IP Address")?></th>
617
					<th><?=gettext("Description")?></th>
618
					<th><?=gettext("Actions")?></th>
619
				</tr>
620
			</thead>
621

    
622
			<tbody>
623
<?php
624
$i = 0;
625
foreach ($a_domainOverrides as $doment):
626
?>
627
				<tr>
628
					<td>
629
						<?=$doment['domain']?>&nbsp;
630
					</td>
631
					<td>
632
						<?=$doment['ip']?>&nbsp;
633
					</td>
634
					<td>
635
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
636
					</td>
637
					<td>
638
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
639
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>" usepost></a>
640
					</td>
641
				</tr>
642
<?php
643
	$i++;
644
endforeach;
645
?>
646
			</tbody>
647
		</table>
648
	</div>
649
</div>
650

    
651
<span class="help-block">
652
	Enter any domains for which the resolver's standard DNS lookup process should be overridden and a different (non-standard)
653
	lookup server should be queried instead. Non-standard, 'invalid' and local domains, and subdomains, can also be entered,
654
	such as 'test', 'mycompany.localdomain', '1.168.192.in-addr.arpa', or 'somesite.com'. The IP address is treated as the
655
	authoritative lookup server for the domain (including all of its subdomains), and other lookup servers will not be queried.
656
</span>
657

    
658
<nav class="action-buttons">
659
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
660
		<i class="fa fa-plus icon-embed-btn"></i>
661
		<?=gettext('Add')?>
662
	</a>
663
</nav>
664

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

    
676
<?php include("foot.inc");
(147-147/234)