Project

General

Profile

Download (17.4 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
##|+PRIV
58 0b8328c5 jim-p
##|*IDENT=page-services-dnsresolver
59 5230f468 jim-p
##|*NAME=Services: DNS Resolver
60 7ed0e844 Warren Baker
##|*DESCR=Allow access to the 'Services: DNS Resolver' page.
61
##|*MATCH=services_unbound.php*
62 9c8a7b13 Stephen Beaver
##|-PRIV
63 7ed0e844 Warren Baker
64
require_once("guiconfig.inc");
65
require_once("unbound.inc");
66 4dbcf2fb Renato Botelho
require_once("system.inc");
67 7ed0e844 Warren Baker
68 be11b6f1 Warren Baker
if (!is_array($config['unbound'])) {
69 2783e408 Renato Botelho
	$config['unbound'] = array();
70 be11b6f1 Warren Baker
}
71
72 7ed0e844 Warren Baker
$a_unboundcfg =& $config['unbound'];
73
74 932711c7 Matt Smith
if (!is_array($a_unboundcfg['hosts'])) {
75
	$a_unboundcfg['hosts'] = array();
76 be11b6f1 Warren Baker
}
77
78 932711c7 Matt Smith
$a_hosts =& $a_unboundcfg['hosts'];
79 7ed0e844 Warren Baker
80 932711c7 Matt Smith
if (!is_array($a_unboundcfg['domainoverrides'])) {
81
	$a_unboundcfg['domainoverrides'] = array();
82 be11b6f1 Warren Baker
}
83
84 932711c7 Matt Smith
$a_domainOverrides = &$a_unboundcfg['domainoverrides'];
85 7ed0e844 Warren Baker
86 932711c7 Matt Smith
if (isset($a_unboundcfg['enable'])) {
87 fe9d4894 Renato Botelho
	$pconfig['enable'] = true;
88 be11b6f1 Warren Baker
}
89 932711c7 Matt Smith
if (isset($a_unboundcfg['dnssec'])) {
90 fe9d4894 Renato Botelho
	$pconfig['dnssec'] = true;
91 be11b6f1 Warren Baker
}
92 932711c7 Matt Smith
if (isset($a_unboundcfg['forwarding'])) {
93 fe9d4894 Renato Botelho
	$pconfig['forwarding'] = true;
94 be11b6f1 Warren Baker
}
95 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcp'])) {
96 fe9d4894 Renato Botelho
	$pconfig['regdhcp'] = true;
97 be11b6f1 Warren Baker
}
98 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcpstatic'])) {
99 fe9d4894 Renato Botelho
	$pconfig['regdhcpstatic'] = true;
100 be11b6f1 Warren Baker
}
101 615ae81f Renato Botelho
102 932711c7 Matt Smith
$pconfig['port'] = $a_unboundcfg['port'];
103
$pconfig['custom_options'] = base64_decode($a_unboundcfg['custom_options']);
104 615ae81f Renato Botelho
105 932711c7 Matt Smith
if (empty($a_unboundcfg['active_interface'])) {
106 2783e408 Renato Botelho
	$pconfig['active_interface'] = array();
107 be11b6f1 Warren Baker
} else {
108 932711c7 Matt Smith
	$pconfig['active_interface'] = explode(",", $a_unboundcfg['active_interface']);
109 be11b6f1 Warren Baker
}
110 51c224bc sbeaver
111 932711c7 Matt Smith
if (empty($a_unboundcfg['outgoing_interface'])) {
112 2783e408 Renato Botelho
	$pconfig['outgoing_interface'] = array();
113 be11b6f1 Warren Baker
} else {
114 932711c7 Matt Smith
	$pconfig['outgoing_interface'] = explode(",", $a_unboundcfg['outgoing_interface']);
115 be11b6f1 Warren Baker
}
116 615ae81f Renato Botelho
117 ca47c065 NOYB
if (empty($a_unboundcfg['system_domain_local_zone_type'])) {
118
	$pconfig['system_domain_local_zone_type'] = "transparent";
119
} else {
120
	$pconfig['system_domain_local_zone_type'] = $a_unboundcfg['system_domain_local_zone_type'];
121
}
122
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 4bb7c0d1 bruno
				$input_errors[] = gettext("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 4bb7c0d1 bruno
			$input_errors[] = gettext("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 4bb7c0d1 bruno
			$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.");
148 fe9d4894 Renato Botelho
		}
149 7ed0e844 Warren Baker
150 932711c7 Matt Smith
		if (empty($pconfig['outgoing_interface'])) {
151 4bb7c0d1 bruno
			$input_errors[] = gettext("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 439ba83c NOYB
			$a_unboundcfg['port'] = $pconfig['port'];
180 932711c7 Matt Smith
			$a_unboundcfg['dnssec'] = isset($pconfig['dnssec']);
181
			$a_unboundcfg['forwarding'] = isset($pconfig['forwarding']);
182
			$a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']);
183
			$a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']);
184
			$a_unboundcfg['active_interface'] = $pconfig['active_interface'];
185
			$a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface'];
186 ca47c065 NOYB
			$a_unboundcfg['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
187 932711c7 Matt Smith
			$a_unboundcfg['custom_options'] = $pconfig['custom_options'];
188
189 4bb7c0d1 bruno
			write_config(gettext("DNS Resolver configured."));
190 2783e408 Renato Botelho
			mark_subsystem_dirty('unbound');
191
		}
192 932711c7 Matt Smith
193
		$pconfig['active_interface'] = $display_active_interface;
194
		$pconfig['outgoing_interface'] = $display_outgoing_interface;
195
		$pconfig['custom_options'] = $display_custom_options;
196 2783e408 Renato Botelho
	}
197 7ed0e844 Warren Baker
}
198
199 f2bc186f Warren Baker
if ($_GET['act'] == "del") {
200 2783e408 Renato Botelho
	if ($_GET['type'] == 'host') {
201
		if ($a_hosts[$_GET['id']]) {
202
			unset($a_hosts[$_GET['id']]);
203
			write_config();
204
			mark_subsystem_dirty('unbound');
205
			header("Location: services_unbound.php");
206
			exit;
207
		}
208
	} elseif ($_GET['type'] == 'doverride') {
209
		if ($a_domainOverrides[$_GET['id']]) {
210
			unset($a_domainOverrides[$_GET['id']]);
211
			write_config();
212
			mark_subsystem_dirty('unbound');
213
			header("Location: services_unbound.php");
214
			exit;
215
		}
216
	}
217 f2bc186f Warren Baker
}
218
219 7aeae838 Matt Smith
function build_if_list($selectedifs) {
220 51c224bc sbeaver
	$interface_addresses = get_possible_listen_ips(true);
221
	$iflist = array('options' => array(), 'selected' => array());
222
223 4bb7c0d1 bruno
	$iflist['options']['all']	= gettext("All");
224 7aeae838 Matt Smith
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
225 7275a7a2 Stephen Beaver
		array_push($iflist['selected'], "all");
226 7aeae838 Matt Smith
	}
227 51c224bc sbeaver
228
	foreach ($interface_addresses as $laddr => $ldescr) {
229
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
230
231 20db3e1a Phil Davis
		if ($selectedifs && in_array($laddr, $selectedifs)) {
232 51c224bc sbeaver
			array_push($iflist['selected'], $laddr);
233 20db3e1a Phil Davis
		}
234 51c224bc sbeaver
	}
235
236
	unset($interface_addresses);
237
238
	return($iflist);
239
}
240
241 548231bc Phil Davis
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General"));
242 db88a3a2 Phil Davis
$shortcut_section = "resolver";
243 7ed0e844 Warren Baker
244 51c224bc sbeaver
include_once("head.inc");
245 7ed0e844 Warren Baker
246 20db3e1a Phil Davis
if ($input_errors) {
247 51c224bc sbeaver
	print_input_errors($input_errors);
248 20db3e1a Phil Davis
}
249 51c224bc sbeaver
250 20db3e1a Phil Davis
if ($savemsg) {
251 51c224bc sbeaver
	print_info_box($savemsg, 'success');
252 20db3e1a Phil Davis
}
253 51c224bc sbeaver
254 7aeae838 Matt Smith
if (is_subsystem_dirty('unbound')) {
255 464358b4 Phil Davis
	print_apply_box(gettext("The DNS Resolver configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
256 7aeae838 Matt Smith
}
257
258 51c224bc sbeaver
$tab_array = array();
259
$tab_array[] = array(gettext("General settings"), true, "services_unbound.php");
260
$tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_advanced.php");
261
$tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php");
262
display_top_tabs($tab_array, true);
263
264
$form = new Form();
265
266
$section = new Form_Section('General DNS Resolver Options');
267
268
$section->addInput(new Form_Checkbox(
269
	'enable',
270
	'Enable',
271
	'Enable DNS resolver',
272
	$pconfig['enable']
273
));
274
275
$section->addInput(new Form_Input(
276
	'port',
277
	'Listen Port',
278 d5a9e030 NOYB
	'number',
279 3e568739 NOYB
	$pconfig['port'],
280
	['placeholder' => '53']
281 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.');
282
283 7aeae838 Matt Smith
$activeiflist = build_if_list($pconfig['active_interface']);
284 51c224bc sbeaver
285
$section->addInput(new Form_Select(
286
	'active_interface',
287
	'Network Interfaces',
288 7aeae838 Matt Smith
	$activeiflist['selected'],
289
	$activeiflist['options'],
290 51c224bc sbeaver
	true
291 d3a3eef0 Francisco Cavalcante
))->addClass('general')->setHelp('Interface IPs used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. ' .
292 51c224bc sbeaver
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
293
294 7aeae838 Matt Smith
$outiflist = build_if_list($pconfig['outgoing_interface']);
295
296 51c224bc sbeaver
$section->addInput(new Form_Select(
297
	'outgoing_interface',
298
	'Outgoing Network Interfaces',
299 7aeae838 Matt Smith
	$outiflist['selected'],
300
	$outiflist['options'],
301 51c224bc sbeaver
	true
302 d3a3eef0 Francisco Cavalcante
))->addClass('general')->setHelp('Utilize different network interface(s) that the DNS Resolver will use to send queries to authoritative servers and receive their replies. By default all interfaces are used.');
303 51c224bc sbeaver
304 ca47c065 NOYB
$section->addInput(new Form_Select(
305
	'system_domain_local_zone_type',
306
	'System Domain Local Zone Type',
307
	$pconfig['system_domain_local_zone_type'],
308 9a83872f NOYB
	unbound_local_zone_types()
309 ca47c065 NOYB
))->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.');
310
311 51c224bc sbeaver
$section->addInput(new Form_Checkbox(
312
	'dnssec',
313
	'DNSSEC',
314
	'Enable DNSSEC Support',
315
	$pconfig['dnssec']
316
));
317
318
$section->addInput(new Form_Checkbox(
319
	'forwarding',
320
	'DNS Query Forwarding',
321
	'Enable Forwarding Mode',
322
	$pconfig['forwarding']
323
));
324
325
$section->addInput(new Form_Checkbox(
326
	'regdhcp',
327
	'DHCP Registration',
328
	'Register DHCP leases in the DNS Resolver',
329
	$pconfig['regdhcp']
330
))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered'.
331
					' in the DNS Resolver, so that their name can be resolved.'.
332
					' You should also set the domain in %sSystem: General setup%s to the proper value.','<a href="system.php">','</a>'));
333
334
$section->addInput(new Form_Checkbox(
335
	'regdhcpstatic',
336
	'Static DHCP',
337
	'Register DHCP static mappings in the DNS Resolver',
338
	$pconfig['regdhcpstatic']
339
))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be '.
340
					'resolved. You should also set the domain in %s'.
341
					'System: General setup%s to the proper value.','<a href="system.php">','</a>'));
342
343
$btnadvdns = new Form_Button(
344
	'btnadvdns',
345 932711c7 Matt Smith
	'Custom options'
346 51c224bc sbeaver
);
347
348
$btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm');
349
350
$section->addInput(new Form_StaticText(
351 932711c7 Matt Smith
	'Custom options',
352
	$btnadvdns . '&nbsp;' . 'Show custom options'
353 51c224bc sbeaver
));
354
355 1fcfea39 Stephen Beaver
$section->addInput(new Form_Textarea (
356 51c224bc sbeaver
	'custom_options',
357
	'Custom options',
358
	$pconfig['custom_options']
359
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline');
360
361
$form->add($section);
362
print($form);
363
?>
364 932711c7 Matt Smith
365 8fd9052f Colin Fleming
<script type="text/javascript">
366 51c224bc sbeaver
//<![CDATA[
367 20db3e1a Phil Davis
events.push(function() {
368 51c224bc sbeaver
369 d3a3eef0 Francisco Cavalcante
	// If the enable checkbox is not checked, hide all inputs
370
	function hideGeneral() {
371 51c224bc sbeaver
		var hide = ! $('#enable').prop('checked');
372
373 d3a3eef0 Francisco Cavalcante
		hideMultiClass('general', hide);
374
		hideInput('port', hide);
375
		hideSelect('system_domain_local_zone_type', hide);
376
		hideCheckbox('dnssec', hide);
377
		hideCheckbox('forwarding', hide);
378
		hideCheckbox('regdhcp', hide);
379
		hideCheckbox('regdhcpstatic', hide);
380
		hideInput('btnadvdns', hide);
381 51c224bc sbeaver
	}
382
383 520ee1d0 Phil Davis
	// Make the 'additional options' button a plain button, not a submit button
384 51c224bc sbeaver
	$("#btnadvdns").prop('type','button');
385
386 520ee1d0 Phil Davis
	// Un-hide additional  controls
387 51c224bc sbeaver
	$("#btnadvdns").click(function() {
388
		hideInput('custom_options', false);
389
	});
390
391 d3a3eef0 Francisco Cavalcante
	// When 'enable' is clicked, disable/enable the following hide inputs
392 51c224bc sbeaver
	$('#enable').click(function() {
393 d3a3eef0 Francisco Cavalcante
		hideGeneral();
394 51c224bc sbeaver
	});
395
396
	// On initial load
397 20db3e1a Phil Davis
	if ($('#custom_options').val().length == 0) {
398 df6cb8fe Stephen Beaver
		hideInput('custom_options', true);
399
	}
400
401 d3a3eef0 Francisco Cavalcante
	hideGeneral();
402 51c224bc sbeaver
403
});
404
//]]>
405
</script>
406
407
<div class="panel panel-default">
408 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
409 51c224bc sbeaver
	<div class="panel-body table-responsive">
410 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
411 51c224bc sbeaver
			<thead>
412 2783e408 Renato Botelho
				<tr>
413 51c224bc sbeaver
					<th><?=gettext("Host")?></th>
414
					<th><?=gettext("Domain")?></th>
415
					<th><?=gettext("IP")?></th>
416
					<th><?=gettext("Description")?></th>
417
					<th></th>
418 2783e408 Renato Botelho
				</tr>
419 51c224bc sbeaver
			</thead>
420
			<tbody>
421
<?php
422
$i = 0;
423
foreach ($a_hosts as $hostent):
424
?>
425 2783e408 Renato Botelho
				<tr>
426 51c224bc sbeaver
					<td>
427 c8a7d17c NOYB
						<?=$hostent['host']?>
428 51c224bc sbeaver
					</td>
429
					<td>
430 c8a7d17c NOYB
						<?=$hostent['domain']?>
431 51c224bc sbeaver
					</td>
432
					<td>
433 de038a27 Stephen Beaver
						<?=$hostent['ip']?>
434 51c224bc sbeaver
					</td>
435
					<td>
436
						<?=htmlspecialchars($hostent['descr'])?>
437
					</td>
438
					<td>
439 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" href="services_unbound_host_edit.php?id=<?=$i?>"></a>
440
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>" href="services_unbound.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
441 51c224bc sbeaver
					</td>
442 2783e408 Renato Botelho
				</tr>
443 51c224bc sbeaver
444
<?php
445
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
446
		foreach ($hostent['aliases']['item'] as $alias):
447
?>
448 2783e408 Renato Botelho
				<tr>
449 51c224bc sbeaver
					<td>
450 c8a7d17c NOYB
						<?=$alias['host']?>
451 51c224bc sbeaver
					</td>
452
					<td>
453 c8a7d17c NOYB
						<?=$alias['domain']?>
454 51c224bc sbeaver
					</td>
455
					<td>
456 4bb7c0d1 bruno
						<?=gettext("Alias for ");?><?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
457 51c224bc sbeaver
					</td>
458
					<td>
459 39bd0b51 Stephen Beaver
						<i class="fa fa-angle-double-right text-info"></i>
460 51c224bc sbeaver
						<?=htmlspecialchars($alias['description'])?>
461
					</td>
462
					<td>
463 2b36a04b heper
						<a a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$i?>"></a>
464 51c224bc sbeaver
					</td>
465 2783e408 Renato Botelho
				</tr>
466 51c224bc sbeaver
<?php
467
		endforeach;
468
	endif;
469
	$i++;
470
endforeach;
471
?>
472
			</tbody>
473
		</table>
474
	</div>
475
</div>
476
477 c10cb196 Stephen Beaver
<nav class="action-buttons">
478 782922c2 Stephen Beaver
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
479 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
480 782922c2 Stephen Beaver
		<?=gettext('Add')?>
481
	</a>
482 51c224bc sbeaver
</nav>
483
484
<div class="panel panel-default">
485 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
486 51c224bc sbeaver
	<div class="panel-body table-responsive">
487 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
488 51c224bc sbeaver
			<thead>
489 2783e408 Renato Botelho
				<tr>
490 51c224bc sbeaver
					<th><?=gettext("Domain")?></th>
491
					<th><?=gettext("IP")?></th>
492
					<th><?=gettext("Description")?></th>
493
					<th></th>
494 2783e408 Renato Botelho
				</tr>
495 51c224bc sbeaver
			</thead>
496
497
			<tbody>
498
<?php
499
$i = 0;
500
foreach ($a_domainOverrides as $doment):
501
?>
502 2783e408 Renato Botelho
				<tr>
503 51c224bc sbeaver
					<td>
504 c8a7d17c NOYB
						<?=$doment['domain']?>&nbsp;
505 51c224bc sbeaver
					</td>
506
					<td>
507
						<?=$doment['ip']?>&nbsp;
508
					</td>
509
					<td>
510
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
511
					</td>
512
					<td>
513 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
514
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
515 51c224bc sbeaver
					</td>
516 2783e408 Renato Botelho
				</tr>
517 51c224bc sbeaver
<?php
518
	$i++;
519
endforeach;
520
?>
521
			</tbody>
522
		</table>
523
	</div>
524
</div>
525
526 c10cb196 Stephen Beaver
<nav class="action-buttons">
527 782922c2 Stephen Beaver
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
528 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
529 782922c2 Stephen Beaver
		<?=gettext('Add')?>
530
	</a>
531 51c224bc sbeaver
</nav>
532 782922c2 Stephen Beaver
533 35681930 Stephen Beaver
<div class="infoblock">
534 782922c2 Stephen Beaver
	<?=print_info_box(sprintf(gettext("If the DNS Resolver is enabled, the DHCP".
535
		" service (if enabled) will automatically serve the LAN IP".
536
		" address as a DNS server to DHCP clients so they will use".
537 520ee1d0 Phil Davis
		" the DNS Resolver. If Forwarding is enabled, the DNS Resolver will use the DNS servers".
538 782922c2 Stephen Beaver
		" entered in %sSystem: General setup%s".
539 520ee1d0 Phil Davis
		" or those obtained via DHCP or PPP on WAN if &quot;Allow".
540 782922c2 Stephen Beaver
		" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
541 85d29bf5 Stephen Beaver
		" is checked."), '<a href="system.php">', '</a>'), 'info', false)?>
542 782922c2 Stephen Beaver
</div>
543 82afb104 Stephen Beaver
544 6f65dc19 Chris Buechler
<?php include("foot.inc");