Project

General

Profile

Download (17.2 KB) Statistics
| Branch: | Tag: | Revision:
1 7ed0e844 Warren Baker
<?php
2
/*
3 c5d81585 Renato Botelho
 * services_unbound.php
4 df6cb8fe Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
7
 * Copyright (c) 2014 Warren Baker (warren@pfsense.org)
8
 * All rights reserved.
9 df6cb8fe Stephen Beaver
 *
10 b12ea3fb Renato Botelho
 * 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 df6cb8fe Stephen Beaver
 *
14 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
15 df6cb8fe Stephen Beaver
 *
16 b12ea3fb Renato Botelho
 * 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 df6cb8fe Stephen Beaver
 */
22 7ed0e844 Warren Baker
23
##|+PRIV
24 0b8328c5 jim-p
##|*IDENT=page-services-dnsresolver
25 5230f468 jim-p
##|*NAME=Services: DNS Resolver
26 7ed0e844 Warren Baker
##|*DESCR=Allow access to the 'Services: DNS Resolver' page.
27
##|*MATCH=services_unbound.php*
28 9c8a7b13 Stephen Beaver
##|-PRIV
29 7ed0e844 Warren Baker
30
require_once("guiconfig.inc");
31
require_once("unbound.inc");
32 4dbcf2fb Renato Botelho
require_once("system.inc");
33 7ed0e844 Warren Baker
34 be11b6f1 Warren Baker
if (!is_array($config['unbound'])) {
35 2783e408 Renato Botelho
	$config['unbound'] = array();
36 be11b6f1 Warren Baker
}
37
38 7ed0e844 Warren Baker
$a_unboundcfg =& $config['unbound'];
39
40 932711c7 Matt Smith
if (!is_array($a_unboundcfg['hosts'])) {
41
	$a_unboundcfg['hosts'] = array();
42 be11b6f1 Warren Baker
}
43
44 932711c7 Matt Smith
$a_hosts =& $a_unboundcfg['hosts'];
45 7ed0e844 Warren Baker
46 932711c7 Matt Smith
if (!is_array($a_unboundcfg['domainoverrides'])) {
47
	$a_unboundcfg['domainoverrides'] = array();
48 be11b6f1 Warren Baker
}
49
50 932711c7 Matt Smith
$a_domainOverrides = &$a_unboundcfg['domainoverrides'];
51 7ed0e844 Warren Baker
52 932711c7 Matt Smith
if (isset($a_unboundcfg['enable'])) {
53 fe9d4894 Renato Botelho
	$pconfig['enable'] = true;
54 be11b6f1 Warren Baker
}
55 932711c7 Matt Smith
if (isset($a_unboundcfg['dnssec'])) {
56 fe9d4894 Renato Botelho
	$pconfig['dnssec'] = true;
57 be11b6f1 Warren Baker
}
58 932711c7 Matt Smith
if (isset($a_unboundcfg['forwarding'])) {
59 fe9d4894 Renato Botelho
	$pconfig['forwarding'] = true;
60 be11b6f1 Warren Baker
}
61 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcp'])) {
62 fe9d4894 Renato Botelho
	$pconfig['regdhcp'] = true;
63 be11b6f1 Warren Baker
}
64 932711c7 Matt Smith
if (isset($a_unboundcfg['regdhcpstatic'])) {
65 fe9d4894 Renato Botelho
	$pconfig['regdhcpstatic'] = true;
66 be11b6f1 Warren Baker
}
67 615ae81f Renato Botelho
68 932711c7 Matt Smith
$pconfig['port'] = $a_unboundcfg['port'];
69
$pconfig['custom_options'] = base64_decode($a_unboundcfg['custom_options']);
70 615ae81f Renato Botelho
71 932711c7 Matt Smith
if (empty($a_unboundcfg['active_interface'])) {
72 2783e408 Renato Botelho
	$pconfig['active_interface'] = array();
73 be11b6f1 Warren Baker
} else {
74 932711c7 Matt Smith
	$pconfig['active_interface'] = explode(",", $a_unboundcfg['active_interface']);
75 be11b6f1 Warren Baker
}
76 51c224bc sbeaver
77 932711c7 Matt Smith
if (empty($a_unboundcfg['outgoing_interface'])) {
78 2783e408 Renato Botelho
	$pconfig['outgoing_interface'] = array();
79 be11b6f1 Warren Baker
} else {
80 932711c7 Matt Smith
	$pconfig['outgoing_interface'] = explode(",", $a_unboundcfg['outgoing_interface']);
81 be11b6f1 Warren Baker
}
82 615ae81f Renato Botelho
83 ca47c065 NOYB
if (empty($a_unboundcfg['system_domain_local_zone_type'])) {
84
	$pconfig['system_domain_local_zone_type'] = "transparent";
85
} else {
86
	$pconfig['system_domain_local_zone_type'] = $a_unboundcfg['system_domain_local_zone_type'];
87
}
88
89 7ed0e844 Warren Baker
if ($_POST) {
90 2783e408 Renato Botelho
	if ($_POST['apply']) {
91
		$retval = services_unbound_configure();
92
		$savemsg = get_std_save_message($retval);
93
		if ($retval == 0) {
94
			clear_subsystem_dirty('unbound');
95 fe9d4894 Renato Botelho
		}
96 2783e408 Renato Botelho
		/* Update resolv.conf in case the interface bindings exclude localhost. */
97
		system_resolvconf_generate();
98 4dbcf2fb Renato Botelho
		/* Start or restart dhcpleases when it's necessary */
99
		system_dhcpleases_configure();
100 2783e408 Renato Botelho
	} else {
101 7aeae838 Matt Smith
		$pconfig = $_POST;
102
		unset($input_errors);
103
104 932711c7 Matt Smith
		if (isset($pconfig['enable']) && isset($config['dnsmasq']['enable'])) {
105
			if ($pconfig['port'] == $config['dnsmasq']['port']) {
106 4bb7c0d1 bruno
				$input_errors[] = gettext("The DNS Forwarder is enabled using this port. Choose a non-conflicting port, or disable the DNS Forwarder.");
107 e92ee598 Phil Davis
			}
108 fe9d4894 Renato Botelho
		}
109 615ae81f Renato Botelho
110 7b03ef63 Chris Buechler
		// forwarding mode requires having valid DNS servers
111
		if (isset($pconfig['forwarding'])) {
112
			$founddns = false;
113
			if (isset($config['system']['dnsallowoverride'])) {
114 5e946f38 Chris Buechler
				$dns_servers = get_dns_servers();
115
				if (is_array($dns_servers)) {
116
					foreach ($dns_servers as $dns_server) {
117
						if (!ip_in_subnet($dns_server, "127.0.0.0/8")) {
118 7b03ef63 Chris Buechler
							$founddns = true;
119
						}
120
					}
121
				}
122
			}
123
			if (is_array($config['system']['dnsserver'])) {
124
				foreach ($config['system']['dnsserver'] as $dnsserver) {
125
					if (is_ipaddr($dnsserver)) {
126
						$founddns = true;
127
					}
128
				}
129
			}
130
			if ($founddns == false) {
131
				$input_errors[] = gettext("At least one DNS server must be specified under System>General Setup to enable Forwarding mode.");
132
			}
133
		}
134
135 932711c7 Matt Smith
		if (empty($pconfig['active_interface'])) {
136 4bb7c0d1 bruno
			$input_errors[] = gettext("One or more Network Interfaces must be selected for binding.");
137 932711c7 Matt Smith
		} else if (!isset($config['system']['dnslocalhost']) && (!in_array("lo0", $pconfig['active_interface']) && !in_array("all", $pconfig['active_interface']))) {
138 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.");
139 fe9d4894 Renato Botelho
		}
140 7ed0e844 Warren Baker
141 932711c7 Matt Smith
		if (empty($pconfig['outgoing_interface'])) {
142 4bb7c0d1 bruno
			$input_errors[] = gettext("One or more Outgoing Network Interfaces must be selected.");
143 fe9d4894 Renato Botelho
		}
144 7ed0e844 Warren Baker
145 932711c7 Matt Smith
		if ($pconfig['port'] && !is_port($pconfig['port'])) {
146 359cc8d9 NOYB
			$input_errors[] = gettext("A valid port number must be specified.");
147 fe9d4894 Renato Botelho
		}
148 fff4a9d1 Warren Baker
149 932711c7 Matt Smith
		if (is_array($pconfig['active_interface']) && !empty($pconfig['active_interface'])) {
150
			$display_active_interface = $pconfig['active_interface'];
151
			$pconfig['active_interface'] = implode(",", $pconfig['active_interface']);
152 fe9d4894 Renato Botelho
		}
153 7ed0e844 Warren Baker
154 932711c7 Matt Smith
		$display_custom_options = $pconfig['custom_options'];
155
		$pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options']));
156
157
		if (is_array($pconfig['outgoing_interface']) && !empty($pconfig['outgoing_interface'])) {
158
			$display_outgoing_interface = $pconfig['outgoing_interface'];
159
			$pconfig['outgoing_interface'] = implode(",", $pconfig['outgoing_interface']);
160 fe9d4894 Renato Botelho
		}
161 188609c6 Warren Baker
162 932711c7 Matt Smith
		$test_output = array();
163
		if (test_unbound_config($pconfig, $test_output)) {
164
			$input_errors[] = gettext("The generated config file cannot be parsed by unbound. Please correct the following errors:");
165
			$input_errors = array_merge($input_errors, $test_output);
166
		}
167 7ed0e844 Warren Baker
168 2783e408 Renato Botelho
		if (!$input_errors) {
169 932711c7 Matt Smith
			$a_unboundcfg['enable'] = isset($pconfig['enable']);
170 439ba83c NOYB
			$a_unboundcfg['port'] = $pconfig['port'];
171 932711c7 Matt Smith
			$a_unboundcfg['dnssec'] = isset($pconfig['dnssec']);
172
			$a_unboundcfg['forwarding'] = isset($pconfig['forwarding']);
173
			$a_unboundcfg['regdhcp'] = isset($pconfig['regdhcp']);
174
			$a_unboundcfg['regdhcpstatic'] = isset($pconfig['regdhcpstatic']);
175
			$a_unboundcfg['active_interface'] = $pconfig['active_interface'];
176
			$a_unboundcfg['outgoing_interface'] = $pconfig['outgoing_interface'];
177 ca47c065 NOYB
			$a_unboundcfg['system_domain_local_zone_type'] = $pconfig['system_domain_local_zone_type'];
178 932711c7 Matt Smith
			$a_unboundcfg['custom_options'] = $pconfig['custom_options'];
179
180 4bb7c0d1 bruno
			write_config(gettext("DNS Resolver configured."));
181 2783e408 Renato Botelho
			mark_subsystem_dirty('unbound');
182
		}
183 932711c7 Matt Smith
184
		$pconfig['active_interface'] = $display_active_interface;
185
		$pconfig['outgoing_interface'] = $display_outgoing_interface;
186
		$pconfig['custom_options'] = $display_custom_options;
187 2783e408 Renato Botelho
	}
188 7ed0e844 Warren Baker
}
189
190 c154cd7d NOYB
if ($pconfig['custom_options']) {
191
	$customoptions = true;
192
} else {
193
	$customoptions = false;
194
}
195
196 f2bc186f Warren Baker
if ($_GET['act'] == "del") {
197 2783e408 Renato Botelho
	if ($_GET['type'] == 'host') {
198
		if ($a_hosts[$_GET['id']]) {
199
			unset($a_hosts[$_GET['id']]);
200
			write_config();
201
			mark_subsystem_dirty('unbound');
202
			header("Location: services_unbound.php");
203
			exit;
204
		}
205
	} elseif ($_GET['type'] == 'doverride') {
206
		if ($a_domainOverrides[$_GET['id']]) {
207
			unset($a_domainOverrides[$_GET['id']]);
208
			write_config();
209
			mark_subsystem_dirty('unbound');
210
			header("Location: services_unbound.php");
211
			exit;
212
		}
213
	}
214 f2bc186f Warren Baker
}
215
216 7aeae838 Matt Smith
function build_if_list($selectedifs) {
217 51c224bc sbeaver
	$interface_addresses = get_possible_listen_ips(true);
218
	$iflist = array('options' => array(), 'selected' => array());
219
220 4bb7c0d1 bruno
	$iflist['options']['all']	= gettext("All");
221 7aeae838 Matt Smith
	if (empty($selectedifs) || empty($selectedifs[0]) || in_array("all", $selectedifs)) {
222 7275a7a2 Stephen Beaver
		array_push($iflist['selected'], "all");
223 7aeae838 Matt Smith
	}
224 51c224bc sbeaver
225
	foreach ($interface_addresses as $laddr => $ldescr) {
226
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
227
228 20db3e1a Phil Davis
		if ($selectedifs && in_array($laddr, $selectedifs)) {
229 51c224bc sbeaver
			array_push($iflist['selected'], $laddr);
230 20db3e1a Phil Davis
		}
231 51c224bc sbeaver
	}
232
233
	unset($interface_addresses);
234
235
	return($iflist);
236
}
237
238 c8f6b745 k-paulius
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General Settings"));
239 db88a3a2 Phil Davis
$shortcut_section = "resolver";
240 7ed0e844 Warren Baker
241 51c224bc sbeaver
include_once("head.inc");
242 7ed0e844 Warren Baker
243 20db3e1a Phil Davis
if ($input_errors) {
244 51c224bc sbeaver
	print_input_errors($input_errors);
245 20db3e1a Phil Davis
}
246 51c224bc sbeaver
247 20db3e1a Phil Davis
if ($savemsg) {
248 51c224bc sbeaver
	print_info_box($savemsg, 'success');
249 20db3e1a Phil Davis
}
250 51c224bc sbeaver
251 7aeae838 Matt Smith
if (is_subsystem_dirty('unbound')) {
252 359cc8d9 NOYB
	print_apply_box(gettext("The DNS resolver configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
253 7aeae838 Matt Smith
}
254
255 51c224bc sbeaver
$tab_array = array();
256 c8f6b745 k-paulius
$tab_array[] = array(gettext("General Settings"), true, "services_unbound.php");
257
$tab_array[] = array(gettext("Advanced Settings"), false, "services_unbound_advanced.php");
258 51c224bc sbeaver
$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 d5a9e030 NOYB
	'number',
276 3e568739 NOYB
	$pconfig['port'],
277
	['placeholder' => '53']
278 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.');
279
280 7aeae838 Matt Smith
$activeiflist = build_if_list($pconfig['active_interface']);
281 51c224bc sbeaver
282
$section->addInput(new Form_Select(
283
	'active_interface',
284
	'Network Interfaces',
285 7aeae838 Matt Smith
	$activeiflist['selected'],
286
	$activeiflist['options'],
287 51c224bc sbeaver
	true
288 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. ' .
289 51c224bc sbeaver
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
290
291 7aeae838 Matt Smith
$outiflist = build_if_list($pconfig['outgoing_interface']);
292
293 51c224bc sbeaver
$section->addInput(new Form_Select(
294
	'outgoing_interface',
295
	'Outgoing Network Interfaces',
296 7aeae838 Matt Smith
	$outiflist['selected'],
297
	$outiflist['options'],
298 51c224bc sbeaver
	true
299 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.');
300 51c224bc sbeaver
301 ca47c065 NOYB
$section->addInput(new Form_Select(
302
	'system_domain_local_zone_type',
303
	'System Domain Local Zone Type',
304
	$pconfig['system_domain_local_zone_type'],
305 9a83872f NOYB
	unbound_local_zone_types()
306 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.');
307
308 51c224bc sbeaver
$section->addInput(new Form_Checkbox(
309
	'dnssec',
310
	'DNSSEC',
311
	'Enable DNSSEC Support',
312
	$pconfig['dnssec']
313
));
314
315
$section->addInput(new Form_Checkbox(
316
	'forwarding',
317
	'DNS Query Forwarding',
318
	'Enable Forwarding Mode',
319
	$pconfig['forwarding']
320
));
321
322
$section->addInput(new Form_Checkbox(
323
	'regdhcp',
324
	'DHCP Registration',
325
	'Register DHCP leases in the DNS Resolver',
326
	$pconfig['regdhcp']
327
))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered'.
328
					' in the DNS Resolver, so that their name can be resolved.'.
329 0cb4d4a6 NOYB
					' The domain in %sSystem: General Setup%s should also be set to the proper value.','<a href="system.php">','</a>'));
330 51c224bc sbeaver
331
$section->addInput(new Form_Checkbox(
332
	'regdhcpstatic',
333
	'Static DHCP',
334
	'Register DHCP static mappings in the DNS Resolver',
335
	$pconfig['regdhcpstatic']
336 359cc8d9 NOYB
))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be resolved. '.
337 0cb4d4a6 NOYB
					'The domain in %sSystem: General Setup%s should also be set to the proper value.','<a href="system.php">','</a>'));
338 51c224bc sbeaver
339 2c95f1cd Phil Davis
$btnadv = new Form_Button(
340
	'btnadvcustom',
341 faab522f Renato Botelho
	'Custom options',
342 3314e626 jim-p
	null,
343
	'fa-cog'
344 51c224bc sbeaver
);
345
346 49d3b157 NOYB
$btnadv->setAttribute('type','button')->addClass('btn-info btn-sm');
347 51c224bc sbeaver
348
$section->addInput(new Form_StaticText(
349 2c95f1cd Phil Davis
	'Display Custom Options',
350
	$btnadv
351 51c224bc sbeaver
));
352
353 1fcfea39 Stephen Beaver
$section->addInput(new Form_Textarea (
354 51c224bc sbeaver
	'custom_options',
355
	'Custom options',
356
	$pconfig['custom_options']
357 e78ecb96 NOYB
))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline.');
358 51c224bc sbeaver
359
$form->add($section);
360
print($form);
361
?>
362 932711c7 Matt Smith
363 8fd9052f Colin Fleming
<script type="text/javascript">
364 51c224bc sbeaver
//<![CDATA[
365 20db3e1a Phil Davis
events.push(function() {
366 51c224bc sbeaver
367 2c95f1cd Phil Davis
	// Show advanced custom options ==============================================
368
	var showadvcustom = false;
369
370
	function show_advcustom(ispageload) {
371
		var text;
372
		// On page load decide the initial state based on the data.
373
		if (ispageload) {
374 28e3d579 NewEraCracker
			showadvcustom = <?=($customoptions ? 'true' : 'false');?>;
375 2c95f1cd Phil Davis
		} else {
376
			// It was a click, swap the state.
377
			showadvcustom = !showadvcustom;
378
		}
379
380
		hideInput('custom_options', !showadvcustom);
381
382
		if (showadvcustom) {
383
			text = "<?=gettext('Hide Custom Options');?>";
384
		} else {
385
			text = "<?=gettext('Display Custom Options');?>";
386
		}
387
		$('#btnadvcustom').html('<i class="fa fa-cog"></i> ' + text);
388
	}
389
390 d3a3eef0 Francisco Cavalcante
	// If the enable checkbox is not checked, hide all inputs
391
	function hideGeneral() {
392 51c224bc sbeaver
		var hide = ! $('#enable').prop('checked');
393
394 d3a3eef0 Francisco Cavalcante
		hideMultiClass('general', hide);
395
		hideInput('port', hide);
396
		hideSelect('system_domain_local_zone_type', hide);
397
		hideCheckbox('dnssec', hide);
398
		hideCheckbox('forwarding', hide);
399
		hideCheckbox('regdhcp', hide);
400
		hideCheckbox('regdhcpstatic', hide);
401 2c95f1cd Phil Davis
		hideInput('btnadvcustom', hide);
402
		hideInput('custom_options', hide || !showadvcustom);
403 51c224bc sbeaver
	}
404
405 2c95f1cd Phil Davis
	// Un-hide additional controls
406
	$('#btnadvcustom').click(function(event) {
407
		show_advcustom();
408 51c224bc sbeaver
	});
409
410 d3a3eef0 Francisco Cavalcante
	// When 'enable' is clicked, disable/enable the following hide inputs
411 51c224bc sbeaver
	$('#enable').click(function() {
412 d3a3eef0 Francisco Cavalcante
		hideGeneral();
413 51c224bc sbeaver
	});
414
415
	// On initial load
416 20db3e1a Phil Davis
	if ($('#custom_options').val().length == 0) {
417 df6cb8fe Stephen Beaver
		hideInput('custom_options', true);
418
	}
419
420 d3a3eef0 Francisco Cavalcante
	hideGeneral();
421 2c95f1cd Phil Davis
	show_advcustom(true);
422 51c224bc sbeaver
423
});
424
//]]>
425
</script>
426
427
<div class="panel panel-default">
428 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
429 51c224bc sbeaver
	<div class="panel-body table-responsive">
430 1c10ce97 PiBa-NL
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
431 51c224bc sbeaver
			<thead>
432 2783e408 Renato Botelho
				<tr>
433 51c224bc sbeaver
					<th><?=gettext("Host")?></th>
434
					<th><?=gettext("Domain")?></th>
435
					<th><?=gettext("IP")?></th>
436
					<th><?=gettext("Description")?></th>
437 21d973b2 Phil Davis
					<th><?=gettext("Actions")?></th>
438 2783e408 Renato Botelho
				</tr>
439 51c224bc sbeaver
			</thead>
440
			<tbody>
441
<?php
442
$i = 0;
443
foreach ($a_hosts as $hostent):
444
?>
445 2783e408 Renato Botelho
				<tr>
446 51c224bc sbeaver
					<td>
447 c8a7d17c NOYB
						<?=$hostent['host']?>
448 51c224bc sbeaver
					</td>
449
					<td>
450 c8a7d17c NOYB
						<?=$hostent['domain']?>
451 51c224bc sbeaver
					</td>
452
					<td>
453 de038a27 Stephen Beaver
						<?=$hostent['ip']?>
454 51c224bc sbeaver
					</td>
455
					<td>
456
						<?=htmlspecialchars($hostent['descr'])?>
457
					</td>
458
					<td>
459 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" href="services_unbound_host_edit.php?id=<?=$i?>"></a>
460
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>" href="services_unbound.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
461 51c224bc sbeaver
					</td>
462 2783e408 Renato Botelho
				</tr>
463 51c224bc sbeaver
464
<?php
465
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
466
		foreach ($hostent['aliases']['item'] as $alias):
467
?>
468 2783e408 Renato Botelho
				<tr>
469 51c224bc sbeaver
					<td>
470 c8a7d17c NOYB
						<?=$alias['host']?>
471 51c224bc sbeaver
					</td>
472
					<td>
473 c8a7d17c NOYB
						<?=$alias['domain']?>
474 51c224bc sbeaver
					</td>
475
					<td>
476 4bb7c0d1 bruno
						<?=gettext("Alias for ");?><?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
477 51c224bc sbeaver
					</td>
478
					<td>
479 39bd0b51 Stephen Beaver
						<i class="fa fa-angle-double-right text-info"></i>
480 51c224bc sbeaver
						<?=htmlspecialchars($alias['description'])?>
481
					</td>
482
					<td>
483 1c10ce97 PiBa-NL
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_unbound_host_edit.php?id=<?=$i?>"></a>
484 51c224bc sbeaver
					</td>
485 2783e408 Renato Botelho
				</tr>
486 51c224bc sbeaver
<?php
487
		endforeach;
488
	endif;
489
	$i++;
490
endforeach;
491
?>
492
			</tbody>
493
		</table>
494
	</div>
495
</div>
496
497 c10cb196 Stephen Beaver
<nav class="action-buttons">
498 782922c2 Stephen Beaver
	<a href="services_unbound_host_edit.php" class="btn btn-sm btn-success">
499 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
500 782922c2 Stephen Beaver
		<?=gettext('Add')?>
501
	</a>
502 51c224bc sbeaver
</nav>
503
504
<div class="panel panel-default">
505 f17594c7 Sjon Hortensius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
506 51c224bc sbeaver
	<div class="panel-body table-responsive">
507 1c10ce97 PiBa-NL
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
508 51c224bc sbeaver
			<thead>
509 2783e408 Renato Botelho
				<tr>
510 51c224bc sbeaver
					<th><?=gettext("Domain")?></th>
511
					<th><?=gettext("IP")?></th>
512
					<th><?=gettext("Description")?></th>
513 21d973b2 Phil Davis
					<th><?=gettext("Actions")?></th>
514 2783e408 Renato Botelho
				</tr>
515 51c224bc sbeaver
			</thead>
516
517
			<tbody>
518
<?php
519
$i = 0;
520
foreach ($a_domainOverrides as $doment):
521
?>
522 2783e408 Renato Botelho
				<tr>
523 51c224bc sbeaver
					<td>
524 c8a7d17c NOYB
						<?=$doment['domain']?>&nbsp;
525 51c224bc sbeaver
					</td>
526
					<td>
527
						<?=$doment['ip']?>&nbsp;
528
					</td>
529
					<td>
530
						<?=htmlspecialchars($doment['descr'])?>&nbsp;
531
					</td>
532
					<td>
533 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_unbound_domainoverride_edit.php?id=<?=$i?>"></a>
534
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_unbound.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
535 51c224bc sbeaver
					</td>
536 2783e408 Renato Botelho
				</tr>
537 51c224bc sbeaver
<?php
538
	$i++;
539
endforeach;
540
?>
541
			</tbody>
542
		</table>
543
	</div>
544
</div>
545
546 c10cb196 Stephen Beaver
<nav class="action-buttons">
547 782922c2 Stephen Beaver
	<a href="services_unbound_domainoverride_edit.php" class="btn btn-sm btn-success">
548 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
549 782922c2 Stephen Beaver
		<?=gettext('Add')?>
550
	</a>
551 51c224bc sbeaver
</nav>
552 782922c2 Stephen Beaver
553 35681930 Stephen Beaver
<div class="infoblock">
554 f6aebbcc NewEraCracker
	<?php print_info_box(sprintf(gettext("If the DNS Resolver is enabled, the DHCP".
555 782922c2 Stephen Beaver
		" service (if enabled) will automatically serve the LAN IP".
556
		" address as a DNS server to DHCP clients so they will use".
557 520ee1d0 Phil Davis
		" the DNS Resolver. If Forwarding is enabled, the DNS Resolver will use the DNS servers".
558 0cb4d4a6 NOYB
		" entered in %sSystem: General Setup%s".
559 520ee1d0 Phil Davis
		" or those obtained via DHCP or PPP on WAN if &quot;Allow".
560 782922c2 Stephen Beaver
		" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
561 f6aebbcc NewEraCracker
		" is checked."), '<a href="system.php">', '</a>'), 'info', false); ?>
562 782922c2 Stephen Beaver
</div>
563 82afb104 Stephen Beaver
564 6f65dc19 Chris Buechler
<?php include("foot.inc");