Project

General

Profile

Download (17 KB) Statistics
| Branch: | Tag: | Revision:
1 7ed0e844 Warren Baker
<?php
2
/*
3
	services_unbound.php
4
*/
5 df6cb8fe Stephen Beaver
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *	Copyright (c)  2014 Warren Baker (warren@pfsense.org)
8
 *
9
 *	Redistribution and use in source and binary forms, with or without modification,
10
 *	are permitted provided that the following conditions are met:
11
 *
12
 *	1. Redistributions of source code must retain the above copyright notice,
13
 *		this list of conditions and the following disclaimer.
14
 *
15
 *	2. Redistributions in binary form must reproduce the above copyright
16
 *		notice, this list of conditions and the following disclaimer in
17
 *		the documentation and/or other materials provided with the
18
 *		distribution.
19
 *
20
 *	3. All advertising materials mentioning features or use of this software
21
 *		must display the following acknowledgment:
22
 *		"This product includes software developed by the pfSense Project
23
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
24
 *
25
 *	4. The names "pfSense" and "pfSense Project" must not be used to
26
 *		 endorse or promote products derived from this software without
27
 *		 prior written permission. For written permission, please contact
28
 *		 coreteam@pfsense.org.
29
 *
30
 *	5. Products derived from this software may not be called "pfSense"
31
 *		nor may "pfSense" appear in their names without prior written
32
 *		permission of the Electric Sheep Fencing, LLC.
33
 *
34
 *	6. Redistributions of any form whatsoever must retain the following
35
 *		acknowledgment:
36
 *
37
 *	"This product includes software developed by the pfSense Project
38
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
52
 *
53
 *	====================================================================
54
 *
55
 */
56 7ed0e844 Warren Baker
/*
57 51c224bc sbeaver
	pfSense_MODULE: dnsresolver
58 7ed0e844 Warren Baker
*/
59
60
##|+PRIV
61 0b8328c5 jim-p
##|*IDENT=page-services-dnsresolver
62 5230f468 jim-p
##|*NAME=Services: DNS Resolver
63 7ed0e844 Warren Baker
##|*DESCR=Allow access to the 'Services: DNS Resolver' page.
64
##|*MATCH=services_unbound.php*
65 9c8a7b13 Stephen Beaver
##|-PRIV
66 7ed0e844 Warren Baker
67
require_once("guiconfig.inc");
68
require_once("unbound.inc");
69 4dbcf2fb Renato Botelho
require_once("system.inc");
70 7ed0e844 Warren Baker
71 be11b6f1 Warren Baker
if (!is_array($config['unbound'])) {
72 2783e408 Renato Botelho
	$config['unbound'] = array();
73 be11b6f1 Warren Baker
}
74
75 7ed0e844 Warren Baker
$a_unboundcfg =& $config['unbound'];
76
77 932711c7 Matt Smith
if (!is_array($a_unboundcfg['hosts'])) {
78
	$a_unboundcfg['hosts'] = array();
79 be11b6f1 Warren Baker
}
80
81 932711c7 Matt Smith
$a_hosts =& $a_unboundcfg['hosts'];
82 7ed0e844 Warren Baker
83 932711c7 Matt Smith
if (!is_array($a_unboundcfg['domainoverrides'])) {
84
	$a_unboundcfg['domainoverrides'] = array();
85 be11b6f1 Warren Baker
}
86
87 932711c7 Matt Smith
$a_domainOverrides = &$a_unboundcfg['domainoverrides'];
88 7ed0e844 Warren Baker
89 932711c7 Matt Smith
if (isset($a_unboundcfg['enable'])) {
90 fe9d4894 Renato Botelho
	$pconfig['enable'] = true;
91 be11b6f1 Warren Baker
}
92 932711c7 Matt Smith
if (isset($a_unboundcfg['dnssec'])) {
93 fe9d4894 Renato Botelho
	$pconfig['dnssec'] = true;
94 be11b6f1 Warren Baker
}
95 932711c7 Matt Smith
if (isset($a_unboundcfg['forwarding'])) {
96 fe9d4894 Renato Botelho
	$pconfig['forwarding'] = true;
97 be11b6f1 Warren Baker
}
98 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcp'])) {
99 fe9d4894 Renato Botelho
	$pconfig['regdhcp'] = true;
100 be11b6f1 Warren Baker
}
101 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcpstatic'])) {
102 fe9d4894 Renato Botelho
	$pconfig['regdhcpstatic'] = true;
103 be11b6f1 Warren Baker
}
104 932711c7 Matt Smith
if (isset($a_unboundcfg['txtsupport'])) {
105 fe9d4894 Renato Botelho
	$pconfig['txtsupport'] = true;
106 be11b6f1 Warren Baker
}
107 615ae81f Renato Botelho
108 932711c7 Matt Smith
$pconfig['port'] = $a_unboundcfg['port'];
109
$pconfig['custom_options'] = base64_decode($a_unboundcfg['custom_options']);
110 615ae81f Renato Botelho
111 932711c7 Matt Smith
if (empty($a_unboundcfg['active_interface'])) {
112 2783e408 Renato Botelho
	$pconfig['active_interface'] = array();
113 be11b6f1 Warren Baker
} else {
114 932711c7 Matt Smith
	$pconfig['active_interface'] = explode(",", $a_unboundcfg['active_interface']);
115 be11b6f1 Warren Baker
}
116 51c224bc sbeaver
117 932711c7 Matt Smith
if (empty($a_unboundcfg['outgoing_interface'])) {
118 2783e408 Renato Botelho
	$pconfig['outgoing_interface'] = array();
119 be11b6f1 Warren Baker
} else {
120 932711c7 Matt Smith
	$pconfig['outgoing_interface'] = explode(",", $a_unboundcfg['outgoing_interface']);
121 be11b6f1 Warren Baker
}
122 615ae81f Renato Botelho
123 7ed0e844 Warren Baker
if ($_POST) {
124 2783e408 Renato Botelho
	if ($_POST['apply']) {
125
		$retval = services_unbound_configure();
126
		$savemsg = get_std_save_message($retval);
127
		if ($retval == 0) {
128
			clear_subsystem_dirty('unbound');
129 fe9d4894 Renato Botelho
		}
130 2783e408 Renato Botelho
		/* Update resolv.conf in case the interface bindings exclude localhost. */
131
		system_resolvconf_generate();
132 4dbcf2fb Renato Botelho
		/* Start or restart dhcpleases when it's necessary */
133
		system_dhcpleases_configure();
134 2783e408 Renato Botelho
	} else {
135 7aeae838 Matt Smith
		$pconfig = $_POST;
136
		unset($input_errors);
137
138 932711c7 Matt Smith
		if (isset($pconfig['enable']) && isset($config['dnsmasq']['enable'])) {
139
			if ($pconfig['port'] == $config['dnsmasq']['port']) {
140 8106d446 Chris Buechler
				$input_errors[] = "The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.";
141 e92ee598 Phil Davis
			}
142 fe9d4894 Renato Botelho
		}
143 615ae81f Renato Botelho
144 932711c7 Matt Smith
		if (empty($pconfig['active_interface'])) {
145 b026cb18 Chris Buechler
			$input_errors[] = "One or more Network Interfaces must be selected for binding.";
146 932711c7 Matt Smith
		} else if (!isset($config['system']['dnslocalhost']) && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) {
147 b7960673 Chris Buechler
			$input_errors[] = "This system is configured to use the DNS Resolver as its DNS server, so Localhost or All must be selected in Network Interfaces.";
148 fe9d4894 Renato Botelho
		}
149 7ed0e844 Warren Baker
150 932711c7 Matt Smith
		if (empty($pconfig['outgoing_interface'])) {
151 b026cb18 Chris Buechler
			$input_errors[] = "One or more Outgoing Network Interfaces must be selected.";
152 fe9d4894 Renato Botelho
		}
153 7ed0e844 Warren Baker
154 932711c7 Matt Smith
		if ($pconfig['port'] && !is_port($pconfig['port'])) {
155
			$input_errors[] = gettext("You must specify a valid port number.");
156 fe9d4894 Renato Botelho
		}
157 fff4a9d1 Warren Baker
158 932711c7 Matt Smith
		if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) {
159
			$display_active_interface = $pconfig['active_interface'];
160
			$pconfig['active_interface'] = implode(",", $pconfig['active_interface']);
161 fe9d4894 Renato Botelho
		}
162 7ed0e844 Warren Baker
163 932711c7 Matt Smith
		$display_custom_options = $pconfig['custom_options'];
164
		$pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options']));
165
166
		if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) {
167
			$display_outgoing_interface = $pconfig['outgoing_interface'];
168
			$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
169 fe9d4894 Renato Botelho
		}
170 188609c6 Warren Baker
171 932711c7 Matt Smith
		$test_output = array();
172
		if (test_unbound_config($pconfig, $test_output)) {
173
			$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
174
			$input_errors = array_merge($input_errors, $test_output);
175
		}
176 7ed0e844 Warren Baker
177 2783e408 Renato Botelho
		if (!$input_errors) {
178 932711c7 Matt Smith
			$a_unboundcfg['enable'] = isset($pconfig['enable']);
179
			$a_unboundcfg['dnssec'] = isset($pconfig['dnssec']);
180
			$a_unboundcfg['forwarding'] = isset($pconfig['forwarding']);
181
			$a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']);
182
			$a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']);
183
			$a_unboundcfg['txtsupport'] = isset($pconfig['txtsupport']);
184
			$a_unboundcfg['active_interface'] = $pconfig['active_interface'];
185
			$a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface'];
186
			$a_unboundcfg['custom_options'] = $pconfig['custom_options'];
187
188 2783e408 Renato Botelho
			write_config("DNS Resolver configured.");
189
			mark_subsystem_dirty('unbound');
190
		}
191 932711c7 Matt Smith
192
		$pconfig['active_interface'] = $display_active_interface;
193
		$pconfig['outgoing_interface'] = $display_outgoing_interface;
194
		$pconfig['custom_options'] = $display_custom_options;
195 2783e408 Renato Botelho
	}
196 7ed0e844 Warren Baker
}
197
198 f2bc186f Warren Baker
if ($_GET['act'] == "del") {
199 2783e408 Renato Botelho
	if ($_GET['type'] == 'host') {
200
		if ($a_hosts[$_GET['id']]) {
201
			unset($a_hosts[$_GET['id']]);
202
			write_config();
203
			mark_subsystem_dirty('unbound');
204
			header("Location: services_unbound.php");
205
			exit;
206
		}
207
	} elseif ($_GET['type'] == 'doverride') {
208
		if ($a_domainOverrides[$_GET['id']]) {
209
			unset($a_domainOverrides[$_GET['id']]);
210
			write_config();
211
			mark_subsystem_dirty('unbound');
212
			header("Location: services_unbound.php");
213
			exit;
214
		}
215
	}
216 f2bc186f Warren Baker
}
217
218 7aeae838 Matt Smith
function build_if_list($selectedifs) {
219 51c224bc sbeaver
	$interface_addresses = get_possible_listen_ips(true);
220
	$iflist = array('options' => array(), 'selected' => array());
221
222 7275a7a2 Stephen Beaver
	$iflist['options']['all']	= "All";
223 7aeae838 Matt Smith
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
224 7275a7a2 Stephen Beaver
		array_push($iflist['selected'], "all");
225 7aeae838 Matt Smith
	}
226 51c224bc sbeaver
227
	foreach ($interface_addresses as $laddr => $ldescr) {
228
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
229
230 7aeae838 Matt Smith
		if ($selectedifs && in_array($laddr, $selectedifs))
231 51c224bc sbeaver
			array_push($iflist['selected'], $laddr);
232
	}
233
234
	unset($interface_addresses);
235
236
	return($iflist);
237
}
238
239 931f47ea Colin Fleming
$closehead = false;
240 e92ee598 Phil Davis
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"));
241 db88a3a2 Phil Davis
$shortcut_section = "resolver";
242 7ed0e844 Warren Baker
243 51c224bc sbeaver
include_once("head.inc");
244 7ed0e844 Warren Baker
245 51c224bc sbeaver
if ($input_errors)
246
	print_input_errors($input_errors);
247
248
if ($savemsg)
249
	print_info_box($savemsg, 'success');
250
251 7aeae838 Matt Smith
if (is_subsystem_dirty('unbound')) {
252
	print_info_box_np(gettext("The configuration of the DNS Resolver has been changed. You must apply changes for them to take effect."));
253
}
254
255 51c224bc sbeaver
$tab_array = array();
256
$tab_array[] = array(gettext("General settings"), true, "services_unbound.php");
257
$tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_advanced.php");
258
$tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php");
259
display_top_tabs($tab_array, true);
260
261
$form = new Form();
262
263
$section = new Form_Section('General DNS Resolver Options');
264
265
$section->addInput(new Form_Checkbox(
266
	'enable',
267
	'Enable',
268
	'Enable DNS resolver',
269
	$pconfig['enable']
270
));
271
272
$section->addInput(new Form_Input(
273
	'port',
274
	'Listen Port',
275
	'text',
276
	$pconfig['port']
277
))->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.');
278
279 7aeae838 Matt Smith
$activeiflist = build_if_list($pconfig['active_interface']);
280 51c224bc sbeaver
281
$section->addInput(new Form_Select(
282
	'active_interface',
283
	'Network Interfaces',
284 7aeae838 Matt Smith
	$activeiflist['selected'],
285
	$activeiflist['options'],
286 51c224bc sbeaver
	true
287
))->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. ' .
288
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
289
290 7aeae838 Matt Smith
$outiflist = build_if_list($pconfig['outgoing_interface']);
291
292 51c224bc sbeaver
$section->addInput(new Form_Select(
293
	'outgoing_interface',
294
	'Outgoing Network Interfaces',
295 7aeae838 Matt Smith
	$outiflist['selected'],
296
	$outiflist['options'],
297 51c224bc sbeaver
	true
298
))->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.');
299
300
$section->addInput(new Form_Checkbox(
301
	'dnssec',
302
	'DNSSEC',
303
	'Enable DNSSEC Support',
304
	$pconfig['dnssec']
305
));
306
307
$section->addInput(new Form_Checkbox(
308
	'forwarding',
309
	'DNS Query Forwarding',
310
	'Enable Forwarding Mode',
311
	$pconfig['forwarding']
312
));
313
314
$section->addInput(new Form_Checkbox(
315
	'regdhcp',
316
	'DHCP Registration',
317
	'Register DHCP leases in the DNS Resolver',
318
	$pconfig['regdhcp']
319
))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered'.
320
					' in the DNS Resolver, so that their name can be resolved.'.
321
					' You should also set the domain in %sSystem: General setup%s to the proper value.','<a href="system.php">','</a>'));
322
323
$section->addInput(new Form_Checkbox(
324
	'regdhcpstatic',
325
	'Static DHCP',
326
	'Register DHCP static mappings in the DNS Resolver',
327
	$pconfig['regdhcpstatic']
328
))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be '.
329
					'resolved. You should also set the domain in %s'.
330
					'System: General setup%s to the proper value.','<a href="system.php">','</a>'));
331
332
$section->addInput(new Form_Checkbox(
333
	'txtsupport',
334
	'TXT Comment Support',
335 520ee1d0 Phil Davis
	'Create TXT records',
336 51c224bc sbeaver
	$pconfig['txtsupport']
337
))->setHelp('Any descriptions associated with Host entries and DHCP Static mappings will create a corresponding TXT record.');
338
339
$btnadvdns = new Form_Button(
340
	'btnadvdns',
341 932711c7 Matt Smith
	'Custom options'
342 51c224bc sbeaver
);
343
344
$btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm');
345
346
$section->addInput(new Form_StaticText(
347 932711c7 Matt Smith
	'Custom options',
348
	$btnadvdns . '&nbsp;' . 'Show custom options'
349 51c224bc sbeaver
));
350
351 1fcfea39 Stephen Beaver
$section->addInput(new Form_Textarea (
352 51c224bc sbeaver
	'custom_options',
353
	'Custom options',
354
	$pconfig['custom_options']
355
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline');
356
357
$form->add($section);
358
print($form);
359
?>
360 932711c7 Matt Smith
361 51c224bc sbeaver
<script>
362
//<![CDATA[
363
events.push(function(){
364
365 96c18fe4 Stephen Beaver
	// If the enable checkbox is not checked, disable the next three checkboxes
366 51c224bc sbeaver
	function disableDHCP() {
367
		var hide = ! $('#enable').prop('checked');
368
369
		disableInput('port', hide);
370
		disableInput('active_interface', hide);
371
		disableInput('outgoing_interface', hide);
372
		disableInput('regdhcpstatic', hide);
373
		disableInput('dnssec', hide);
374
		disableInput('forwarding', hide);
375
		disableInput('regdhcp', hide);
376
		disableInput('regdhcpstatic', hide);
377
		disableInput('txtsupport', hide);
378
		disableInput('btnadvdns', hide);
379
	}
380
381 520ee1d0 Phil Davis
	// Make the 'additional options' button a plain button, not a submit button
382 51c224bc sbeaver
	$("#btnadvdns").prop('type','button');
383
384 520ee1d0 Phil Davis
	// Un-hide additional  controls
385 51c224bc sbeaver
	$("#btnadvdns").click(function() {
386
		hideInput('custom_options', false);
387
388
	});
389
390 520ee1d0 Phil Davis
	// When 'enable' is clicked, disable/enable the following three checkboxes
391 51c224bc sbeaver
	$('#enable').click(function() {
392
		disableDHCP();
393
	});
394
395
	// On initial load
396 df6cb8fe Stephen Beaver
	if($('#custom_options').val().length == 0) {
397
		hideInput('custom_options', true);
398
	}
399
400 51c224bc sbeaver
	disableDHCP();
401
402
});
403
//]]>
404
</script>
405
406
<div class="panel panel-default">
407 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
408 51c224bc sbeaver
	<div class="panel-body table-responsive">
409 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
410 51c224bc sbeaver
			<thead>
411 2783e408 Renato Botelho
				<tr>
412 51c224bc sbeaver
					<th><?=gettext("Host")?></th>
413
					<th><?=gettext("Domain")?></th>
414
					<th><?=gettext("IP")?></th>
415
					<th><?=gettext("Description")?></th>
416
					<th></th>
417 2783e408 Renato Botelho
				</tr>
418 51c224bc sbeaver
			</thead>
419
			<tbody>
420
<?php
421
$i = 0;
422
foreach ($a_hosts as $hostent):
423
?>
424 2783e408 Renato Botelho
				<tr>
425 51c224bc sbeaver
					<td>
426
						<?=strtolower($hostent['host'])?>
427
					</td>
428
					<td>
429
						<?=strtolower($hostent['domain'])?>
430
					</td>
431
					<td>
432 de038a27 Stephen Beaver
						<?=$hostent['ip']?>
433 51c224bc sbeaver
					</td>
434
					<td>
435
						<?=htmlspecialchars($hostent['descr'])?>
436
					</td>
437
					<td>
438 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" href="services_unbound_host_edit.php?id=<?=$i?>"></a>
439
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>" href="services_unbound.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
440 51c224bc sbeaver
					</td>
441 2783e408 Renato Botelho
				</tr>
442 51c224bc sbeaver
443
<?php
444
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
445
		foreach ($hostent['aliases']['item'] as $alias):
446
?>
447 2783e408 Renato Botelho
				<tr>
448 51c224bc sbeaver
					<td>
449
						<?=strtolower($alias['host'])?>
450
					</td>
451
					<td>
452
						<?=strtolower($alias['domain'])?>
453
					</td>
454
					<td>
455
						Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
456
					</td>
457
					<td>
458
						<?=htmlspecialchars($alias['description'])?>
459
					</td>
460
					<td>
461 2b36a04b heper
						<a a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$i?>"></a>
462 51c224bc sbeaver
					</td>
463 2783e408 Renato Botelho
				</tr>
464 51c224bc sbeaver
<?php
465
		endforeach;
466
	endif;
467
	$i++;
468
endforeach;
469
?>
470
			</tbody>
471
		</table>
472
	</div>
473
</div>
474
475 c10cb196 Stephen Beaver
<nav class="action-buttons">
476 782922c2 Stephen Beaver
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
477 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
478 782922c2 Stephen Beaver
		<?=gettext('Add')?>
479
	</a>
480 51c224bc sbeaver
</nav>
481
482
<div class="panel panel-default">
483 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
484 51c224bc sbeaver
	<div class="panel-body table-responsive">
485 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
486 51c224bc sbeaver
			<thead>
487 2783e408 Renato Botelho
				<tr>
488 51c224bc sbeaver
					<th><?=gettext("Domain")?></th>
489
					<th><?=gettext("IP")?></th>
490
					<th><?=gettext("Description")?></th>
491
					<th></th>
492 2783e408 Renato Botelho
				</tr>
493 51c224bc sbeaver
			</thead>
494
495
			<tbody>
496
<?php
497
$i = 0;
498
foreach ($a_domainOverrides as $doment):
499
?>
500 2783e408 Renato Botelho
				<tr>
501 51c224bc sbeaver
					<td>
502
						<?=strtolower($doment['domain'])?>&nbsp;
503
					</td>
504
					<td>
505
						<?=$doment['ip']?>&nbsp;
506
					</td>
507
					<td>
508
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
509
					</td>
510
					<td>
511 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
512
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
513 51c224bc sbeaver
					</td>
514 2783e408 Renato Botelho
				</tr>
515 51c224bc sbeaver
<?php
516
	$i++;
517
endforeach;
518
?>
519
			</tbody>
520
		</table>
521
	</div>
522
</div>
523
524 c10cb196 Stephen Beaver
<nav class="action-buttons">
525 782922c2 Stephen Beaver
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
526 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
527 782922c2 Stephen Beaver
		<?=gettext('Add')?>
528
	</a>
529 51c224bc sbeaver
</nav>
530 782922c2 Stephen Beaver
531
<div id="infoblock">
532
	<?=print_info_box(sprintf(gettext("If the DNS Resolver is enabled, the DHCP".
533
		" service (if enabled) will automatically serve the LAN IP".
534
		" address as a DNS server to DHCP clients so they will use".
535 520ee1d0 Phil Davis
		" the DNS Resolver. If Forwarding is enabled, the DNS Resolver will use the DNS servers".
536 782922c2 Stephen Beaver
		" entered in %sSystem: General setup%s".
537 520ee1d0 Phil Davis
		" or those obtained via DHCP or PPP on WAN if &quot;Allow".
538 782922c2 Stephen Beaver
		" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
539
		" is checked."),'<a href="system.php">','</a>'), info)?>
540
</div>
541 82afb104 Stephen Beaver
542 6f65dc19 Chris Buechler
<?php include("foot.inc");