Project

General

Profile

Download (18.3 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 615ae81f Renato Botelho
105 932711c7 Matt Smith
$pconfig['port'] = $a_unboundcfg['port'];
106
$pconfig['custom_options'] = base64_decode($a_unboundcfg['custom_options']);
107 615ae81f Renato Botelho
108 932711c7 Matt Smith
if (empty($a_unboundcfg['active_interface'])) {
109 2783e408 Renato Botelho
	$pconfig['active_interface'] = array();
110 be11b6f1 Warren Baker
} else {
111 932711c7 Matt Smith
	$pconfig['active_interface'] = explode(",", $a_unboundcfg['active_interface']);
112 be11b6f1 Warren Baker
}
113 51c224bc sbeaver
114 932711c7 Matt Smith
if (empty($a_unboundcfg['outgoing_interface'])) {
115 2783e408 Renato Botelho
	$pconfig['outgoing_interface'] = array();
116 be11b6f1 Warren Baker
} else {
117 932711c7 Matt Smith
	$pconfig['outgoing_interface'] = explode(",", $a_unboundcfg['outgoing_interface']);
118 be11b6f1 Warren Baker
}
119 615ae81f Renato Botelho
120 ca47c065 NOYB
if (empty($a_unboundcfg['system_domain_local_zone_type'])) {
121
	$pconfig['system_domain_local_zone_type'] = "transparent";
122
} else {
123
	$pconfig['system_domain_local_zone_type'] = $a_unboundcfg['system_domain_local_zone_type'];
124
}
125
126 7ed0e844 Warren Baker
if ($_POST) {
127 2783e408 Renato Botelho
	if ($_POST['apply']) {
128
		$retval = services_unbound_configure();
129
		$savemsg = get_std_save_message($retval);
130
		if ($retval == 0) {
131
			clear_subsystem_dirty('unbound');
132 fe9d4894 Renato Botelho
		}
133 2783e408 Renato Botelho
		/* Update resolv.conf in case the interface bindings exclude localhost. */
134
		system_resolvconf_generate();
135 4dbcf2fb Renato Botelho
		/* Start or restart dhcpleases when it's necessary */
136
		system_dhcpleases_configure();
137 2783e408 Renato Botelho
	} else {
138 7aeae838 Matt Smith
		$pconfig = $_POST;
139
		unset($input_errors);
140
141 932711c7 Matt Smith
		if (isset($pconfig['enable']) && isset($config['dnsmasq']['enable'])) {
142
			if ($pconfig['port'] == $config['dnsmasq']['port']) {
143 8106d446 Chris Buechler
				$input_errors[] = "The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.";
144 e92ee598 Phil Davis
			}
145 fe9d4894 Renato Botelho
		}
146 615ae81f Renato Botelho
147 932711c7 Matt Smith
		if (empty($pconfig['active_interface'])) {
148 b026cb18 Chris Buechler
			$input_errors[] = "One or more Network Interfaces must be selected for binding.";
149 932711c7 Matt Smith
		} else if (!isset($config['system']['dnslocalhost']) && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) {
150 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.";
151 fe9d4894 Renato Botelho
		}
152 7ed0e844 Warren Baker
153 932711c7 Matt Smith
		if (empty($pconfig['outgoing_interface'])) {
154 b026cb18 Chris Buechler
			$input_errors[] = "One or more Outgoing Network Interfaces must be selected.";
155 fe9d4894 Renato Botelho
		}
156 7ed0e844 Warren Baker
157 ca47c065 NOYB
		if (empty($pconfig['system_domain_local_zone_type'])) {
158
			$input_errors[] = "A System Domain Local-Zone Type must be selected.";
159
		}
160
161 932711c7 Matt Smith
		if ($pconfig['port'] && !is_port($pconfig['port'])) {
162
			$input_errors[] = gettext("You must specify a valid port number.");
163 fe9d4894 Renato Botelho
		}
164 fff4a9d1 Warren Baker
165 932711c7 Matt Smith
		if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) {
166
			$display_active_interface = $pconfig['active_interface'];
167
			$pconfig['active_interface'] = implode(",", $pconfig['active_interface']);
168 fe9d4894 Renato Botelho
		}
169 7ed0e844 Warren Baker
170 932711c7 Matt Smith
		$display_custom_options = $pconfig['custom_options'];
171
		$pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options']));
172
173
		if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) {
174
			$display_outgoing_interface = $pconfig['outgoing_interface'];
175
			$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
176 fe9d4894 Renato Botelho
		}
177 188609c6 Warren Baker
178 ca47c065 NOYB
		if (isset($pconfig['system_domain_local_zone_type']) && !empty($pconfig['system_domain_local_zone_type'])) {
179
			$display_system_domain_local_zone_type = $pconfig['system_domain_local_zone_type'];
180
			$pconfig['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
181
		}
182
183 932711c7 Matt Smith
		$test_output = array();
184
		if (test_unbound_config($pconfig, $test_output)) {
185
			$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
186
			$input_errors = array_merge($input_errors, $test_output);
187
		}
188 7ed0e844 Warren Baker
189 2783e408 Renato Botelho
		if (!$input_errors) {
190 932711c7 Matt Smith
			$a_unboundcfg['enable'] = isset($pconfig['enable']);
191 439ba83c NOYB
			$a_unboundcfg['port'] = $pconfig['port'];
192 932711c7 Matt Smith
			$a_unboundcfg['dnssec'] = isset($pconfig['dnssec']);
193
			$a_unboundcfg['forwarding'] = isset($pconfig['forwarding']);
194
			$a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']);
195
			$a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']);
196
			$a_unboundcfg['active_interface'] = $pconfig['active_interface'];
197
			$a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface'];
198 ca47c065 NOYB
			$a_unboundcfg['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
199 932711c7 Matt Smith
			$a_unboundcfg['custom_options'] = $pconfig['custom_options'];
200
201 2783e408 Renato Botelho
			write_config("DNS Resolver configured.");
202
			mark_subsystem_dirty('unbound');
203
		}
204 932711c7 Matt Smith
205
		$pconfig['active_interface'] = $display_active_interface;
206
		$pconfig['outgoing_interface'] = $display_outgoing_interface;
207 ca47c065 NOYB
		$pconfig['system_domain_local_zone_type'] = $display_system_domain_local_zone_type;
208 932711c7 Matt Smith
		$pconfig['custom_options'] = $display_custom_options;
209 2783e408 Renato Botelho
	}
210 7ed0e844 Warren Baker
}
211
212 f2bc186f Warren Baker
if ($_GET['act'] == "del") {
213 2783e408 Renato Botelho
	if ($_GET['type'] == 'host') {
214
		if ($a_hosts[$_GET['id']]) {
215
			unset($a_hosts[$_GET['id']]);
216
			write_config();
217
			mark_subsystem_dirty('unbound');
218
			header("Location: services_unbound.php");
219
			exit;
220
		}
221
	} elseif ($_GET['type'] == 'doverride') {
222
		if ($a_domainOverrides[$_GET['id']]) {
223
			unset($a_domainOverrides[$_GET['id']]);
224
			write_config();
225
			mark_subsystem_dirty('unbound');
226
			header("Location: services_unbound.php");
227
			exit;
228
		}
229
	}
230 f2bc186f Warren Baker
}
231
232 7aeae838 Matt Smith
function build_if_list($selectedifs) {
233 51c224bc sbeaver
	$interface_addresses = get_possible_listen_ips(true);
234
	$iflist = array('options' => array(), 'selected' => array());
235
236 7275a7a2 Stephen Beaver
	$iflist['options']['all']	= "All";
237 7aeae838 Matt Smith
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
238 7275a7a2 Stephen Beaver
		array_push($iflist['selected'], "all");
239 7aeae838 Matt Smith
	}
240 51c224bc sbeaver
241
	foreach ($interface_addresses as $laddr => $ldescr) {
242
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
243
244 7aeae838 Matt Smith
		if ($selectedifs && in_array($laddr, $selectedifs))
245 51c224bc sbeaver
			array_push($iflist['selected'], $laddr);
246
	}
247
248
	unset($interface_addresses);
249
250
	return($iflist);
251
}
252
253 931f47ea Colin Fleming
$closehead = false;
254 548231bc Phil Davis
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General"));
255 db88a3a2 Phil Davis
$shortcut_section = "resolver";
256 7ed0e844 Warren Baker
257 51c224bc sbeaver
include_once("head.inc");
258 7ed0e844 Warren Baker
259 51c224bc sbeaver
if ($input_errors)
260
	print_input_errors($input_errors);
261
262
if ($savemsg)
263
	print_info_box($savemsg, 'success');
264
265 7aeae838 Matt Smith
if (is_subsystem_dirty('unbound')) {
266
	print_info_box_np(gettext("The configuration of the DNS Resolver has been changed. You must apply changes for them to take effect."));
267
}
268
269 51c224bc sbeaver
$tab_array = array();
270
$tab_array[] = array(gettext("General settings"), true, "services_unbound.php");
271
$tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_advanced.php");
272
$tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php");
273
display_top_tabs($tab_array, true);
274
275
$form = new Form();
276
277
$section = new Form_Section('General DNS Resolver Options');
278
279
$section->addInput(new Form_Checkbox(
280
	'enable',
281
	'Enable',
282
	'Enable DNS resolver',
283
	$pconfig['enable']
284
));
285
286
$section->addInput(new Form_Input(
287
	'port',
288
	'Listen Port',
289 d5a9e030 NOYB
	'number',
290 3e568739 NOYB
	$pconfig['port'],
291
	['placeholder' => '53']
292 51c224bc sbeaver
))->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.');
293
294 7aeae838 Matt Smith
$activeiflist = build_if_list($pconfig['active_interface']);
295 51c224bc sbeaver
296
$section->addInput(new Form_Select(
297
	'active_interface',
298
	'Network Interfaces',
299 7aeae838 Matt Smith
	$activeiflist['selected'],
300
	$activeiflist['options'],
301 51c224bc sbeaver
	true
302
))->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. ' .
303
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
304
305 7aeae838 Matt Smith
$outiflist = build_if_list($pconfig['outgoing_interface']);
306
307 51c224bc sbeaver
$section->addInput(new Form_Select(
308
	'outgoing_interface',
309
	'Outgoing Network Interfaces',
310 7aeae838 Matt Smith
	$outiflist['selected'],
311
	$outiflist['options'],
312 51c224bc sbeaver
	true
313
))->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.');
314
315 ca47c065 NOYB
$unbound_local_zone_types = array("deny" => gettext("Deny"), "refuse" => gettext("Refuse"), "static" => gettext("Static"), "transparent" => gettext("Transparent"), "typetransparent" => gettext("Type Transparent"), "redirect" => gettext("Redirect"), "inform" => gettext("Inform"), "inform_deny" => gettext("Inform Deny"), "nodefault" => gettext("No Default"));
316
317
$section->addInput(new Form_Select(
318
	'system_domain_local_zone_type',
319
	'System Domain Local Zone Type',
320
	$pconfig['system_domain_local_zone_type'],
321
	$unbound_local_zone_types
322
))->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.');
323
324 51c224bc sbeaver
$section->addInput(new Form_Checkbox(
325
	'dnssec',
326
	'DNSSEC',
327
	'Enable DNSSEC Support',
328
	$pconfig['dnssec']
329
));
330
331
$section->addInput(new Form_Checkbox(
332
	'forwarding',
333
	'DNS Query Forwarding',
334
	'Enable Forwarding Mode',
335
	$pconfig['forwarding']
336
));
337
338
$section->addInput(new Form_Checkbox(
339
	'regdhcp',
340
	'DHCP Registration',
341
	'Register DHCP leases in the DNS Resolver',
342
	$pconfig['regdhcp']
343
))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered'.
344
					' in the DNS Resolver, so that their name can be resolved.'.
345
					' You should also set the domain in %sSystem: General setup%s to the proper value.','<a href="system.php">','</a>'));
346
347
$section->addInput(new Form_Checkbox(
348
	'regdhcpstatic',
349
	'Static DHCP',
350
	'Register DHCP static mappings in the DNS Resolver',
351
	$pconfig['regdhcpstatic']
352
))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be '.
353
					'resolved. You should also set the domain in %s'.
354
					'System: General setup%s to the proper value.','<a href="system.php">','</a>'));
355
356
$btnadvdns = new Form_Button(
357
	'btnadvdns',
358 932711c7 Matt Smith
	'Custom options'
359 51c224bc sbeaver
);
360
361
$btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm');
362
363
$section->addInput(new Form_StaticText(
364 932711c7 Matt Smith
	'Custom options',
365
	$btnadvdns . '&nbsp;' . 'Show custom options'
366 51c224bc sbeaver
));
367
368 1fcfea39 Stephen Beaver
$section->addInput(new Form_Textarea (
369 51c224bc sbeaver
	'custom_options',
370
	'Custom options',
371
	$pconfig['custom_options']
372
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline');
373
374
$form->add($section);
375
print($form);
376
?>
377 932711c7 Matt Smith
378 8fd9052f Colin Fleming
<script type="text/javascript">
379 51c224bc sbeaver
//<![CDATA[
380
events.push(function(){
381
382 96c18fe4 Stephen Beaver
	// If the enable checkbox is not checked, disable the next three checkboxes
383 51c224bc sbeaver
	function disableDHCP() {
384
		var hide = ! $('#enable').prop('checked');
385
386
		disableInput('port', hide);
387
		disableInput('active_interface', hide);
388
		disableInput('outgoing_interface', hide);
389 ca47c065 NOYB
		disableInput('system_domain_local_zone_type', hide);
390 51c224bc sbeaver
		disableInput('regdhcpstatic', hide);
391
		disableInput('dnssec', hide);
392
		disableInput('forwarding', hide);
393
		disableInput('regdhcp', hide);
394
		disableInput('regdhcpstatic', hide);
395
		disableInput('btnadvdns', hide);
396
	}
397
398 520ee1d0 Phil Davis
	// Make the 'additional options' button a plain button, not a submit button
399 51c224bc sbeaver
	$("#btnadvdns").prop('type','button');
400
401 520ee1d0 Phil Davis
	// Un-hide additional  controls
402 51c224bc sbeaver
	$("#btnadvdns").click(function() {
403
		hideInput('custom_options', false);
404
405
	});
406
407 520ee1d0 Phil Davis
	// When 'enable' is clicked, disable/enable the following three checkboxes
408 51c224bc sbeaver
	$('#enable').click(function() {
409
		disableDHCP();
410
	});
411
412
	// On initial load
413 df6cb8fe Stephen Beaver
	if($('#custom_options').val().length == 0) {
414
		hideInput('custom_options', true);
415
	}
416
417 51c224bc sbeaver
	disableDHCP();
418
419
});
420
//]]>
421
</script>
422
423
<div class="panel panel-default">
424 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
425 51c224bc sbeaver
	<div class="panel-body table-responsive">
426 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
427 51c224bc sbeaver
			<thead>
428 2783e408 Renato Botelho
				<tr>
429 51c224bc sbeaver
					<th><?=gettext("Host")?></th>
430
					<th><?=gettext("Domain")?></th>
431
					<th><?=gettext("IP")?></th>
432
					<th><?=gettext("Description")?></th>
433
					<th></th>
434 2783e408 Renato Botelho
				</tr>
435 51c224bc sbeaver
			</thead>
436
			<tbody>
437
<?php
438
$i = 0;
439
foreach ($a_hosts as $hostent):
440
?>
441 2783e408 Renato Botelho
				<tr>
442 51c224bc sbeaver
					<td>
443 c8a7d17c NOYB
						<?=$hostent['host']?>
444 51c224bc sbeaver
					</td>
445
					<td>
446 c8a7d17c NOYB
						<?=$hostent['domain']?>
447 51c224bc sbeaver
					</td>
448
					<td>
449 de038a27 Stephen Beaver
						<?=$hostent['ip']?>
450 51c224bc sbeaver
					</td>
451
					<td>
452
						<?=htmlspecialchars($hostent['descr'])?>
453
					</td>
454
					<td>
455 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" href="services_unbound_host_edit.php?id=<?=$i?>"></a>
456
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>" href="services_unbound.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
457 51c224bc sbeaver
					</td>
458 2783e408 Renato Botelho
				</tr>
459 51c224bc sbeaver
460
<?php
461
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
462
		foreach ($hostent['aliases']['item'] as $alias):
463
?>
464 2783e408 Renato Botelho
				<tr>
465 51c224bc sbeaver
					<td>
466 c8a7d17c NOYB
						<?=$alias['host']?>
467 51c224bc sbeaver
					</td>
468
					<td>
469 c8a7d17c NOYB
						<?=$alias['domain']?>
470 51c224bc sbeaver
					</td>
471
					<td>
472
						Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
473
					</td>
474
					<td>
475 39bd0b51 Stephen Beaver
						<i class="fa fa-angle-double-right text-info"></i>
476 51c224bc sbeaver
						<?=htmlspecialchars($alias['description'])?>
477
					</td>
478
					<td>
479 2b36a04b heper
						<a a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$i?>"></a>
480 51c224bc sbeaver
					</td>
481 2783e408 Renato Botelho
				</tr>
482 51c224bc sbeaver
<?php
483
		endforeach;
484
	endif;
485
	$i++;
486
endforeach;
487
?>
488
			</tbody>
489
		</table>
490
	</div>
491
</div>
492
493 c10cb196 Stephen Beaver
<nav class="action-buttons">
494 782922c2 Stephen Beaver
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
495 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
496 782922c2 Stephen Beaver
		<?=gettext('Add')?>
497
	</a>
498 51c224bc sbeaver
</nav>
499
500
<div class="panel panel-default">
501 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
502 51c224bc sbeaver
	<div class="panel-body table-responsive">
503 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
504 51c224bc sbeaver
			<thead>
505 2783e408 Renato Botelho
				<tr>
506 51c224bc sbeaver
					<th><?=gettext("Domain")?></th>
507
					<th><?=gettext("IP")?></th>
508
					<th><?=gettext("Description")?></th>
509
					<th></th>
510 2783e408 Renato Botelho
				</tr>
511 51c224bc sbeaver
			</thead>
512
513
			<tbody>
514
<?php
515
$i = 0;
516
foreach ($a_domainOverrides as $doment):
517
?>
518 2783e408 Renato Botelho
				<tr>
519 51c224bc sbeaver
					<td>
520 c8a7d17c NOYB
						<?=$doment['domain']?>&nbsp;
521 51c224bc sbeaver
					</td>
522
					<td>
523
						<?=$doment['ip']?>&nbsp;
524
					</td>
525
					<td>
526
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
527
					</td>
528
					<td>
529 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
530
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
531 51c224bc sbeaver
					</td>
532 2783e408 Renato Botelho
				</tr>
533 51c224bc sbeaver
<?php
534
	$i++;
535
endforeach;
536
?>
537
			</tbody>
538
		</table>
539
	</div>
540
</div>
541
542 c10cb196 Stephen Beaver
<nav class="action-buttons">
543 782922c2 Stephen Beaver
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
544 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
545 782922c2 Stephen Beaver
		<?=gettext('Add')?>
546
	</a>
547 51c224bc sbeaver
</nav>
548 782922c2 Stephen Beaver
549
<div id="infoblock">
550
	<?=print_info_box(sprintf(gettext("If the DNS Resolver is enabled, the DHCP".
551
		" service (if enabled) will automatically serve the LAN IP".
552
		" address as a DNS server to DHCP clients so they will use".
553 520ee1d0 Phil Davis
		" the DNS Resolver. If Forwarding is enabled, the DNS Resolver will use the DNS servers".
554 782922c2 Stephen Beaver
		" entered in %sSystem: General setup%s".
555 520ee1d0 Phil Davis
		" or those obtained via DHCP or PPP on WAN if &quot;Allow".
556 782922c2 Stephen Beaver
		" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
557
		" is checked."),'<a href="system.php">','</a>'), info)?>
558
</div>
559 82afb104 Stephen Beaver
560 6f65dc19 Chris Buechler
<?php include("foot.inc");