1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
services_dnsmasq.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
f0fe3d30
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
|
8 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
9 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
10 |
f0fe3d30
|
Scott Ullrich
|
|
11 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
f0fe3d30
|
Scott Ullrich
|
|
14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
f0fe3d30
|
Scott Ullrich
|
|
17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
f0fe3d30
|
Scott Ullrich
|
|
21 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
70edf50d
|
jim-p
|
/*
|
33 |
e6363160
|
sbeaver
|
pfSense_MODULE: dnsforwarder
|
34 |
1d333258
|
Scott Ullrich
|
*/
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-services-dnsforwarder
|
38 |
|
|
##|*NAME=Services: DNS Forwarder page
|
39 |
|
|
##|*DESCR=Allow access to the 'Services: DNS Forwarder' page.
|
40 |
|
|
##|*MATCH=services_dnsmasq.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
44 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
45 |
|
|
require_once("filter.inc");
|
46 |
|
|
require_once("shaper.inc");
|
47 |
4dbcf2fb
|
Renato Botelho
|
require_once("system.inc");
|
48 |
5b237745
|
Scott Ullrich
|
|
49 |
70edf50d
|
jim-p
|
$pconfig['enable'] = isset($config['dnsmasq']['enable']);
|
50 |
5b237745
|
Scott Ullrich
|
$pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']);
|
51 |
6a01ea44
|
Bill Marquette
|
$pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']);
|
52 |
aa994814
|
Andrew Thompson
|
$pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']);
|
53 |
96ea7162
|
N0YB
|
$pconfig['strict_order'] = isset($config['dnsmasq']['strict_order']);
|
54 |
|
|
$pconfig['domain_needed'] = isset($config['dnsmasq']['domain_needed']);
|
55 |
7bdd28fb
|
Phil Davis
|
$pconfig['no_private_reverse'] = isset($config['dnsmasq']['no_private_reverse']);
|
56 |
e6c49e3d
|
jim-p
|
$pconfig['port'] = $config['dnsmasq']['port'];
|
57 |
8f9bffbc
|
Andrew Thompson
|
$pconfig['custom_options'] = $config['dnsmasq']['custom_options'];
|
58 |
5b237745
|
Scott Ullrich
|
|
59 |
b4323f39
|
jim-p
|
$pconfig['strictbind'] = isset($config['dnsmasq']['strictbind']);
|
60 |
966ed611
|
Phil Davis
|
if (!empty($config['dnsmasq']['interface'])) {
|
61 |
79d03c40
|
jim-p
|
$pconfig['interface'] = explode(",", $config['dnsmasq']['interface']);
|
62 |
966ed611
|
Phil Davis
|
} else {
|
63 |
79d03c40
|
jim-p
|
$pconfig['interface'] = array();
|
64 |
966ed611
|
Phil Davis
|
}
|
65 |
b4323f39
|
jim-p
|
|
66 |
966ed611
|
Phil Davis
|
if (!is_array($config['dnsmasq']['hosts'])) {
|
67 |
5b237745
|
Scott Ullrich
|
$config['dnsmasq']['hosts'] = array();
|
68 |
966ed611
|
Phil Davis
|
}
|
69 |
0c2b5df7
|
Scott Ullrich
|
|
70 |
966ed611
|
Phil Davis
|
if (!is_array($config['dnsmasq']['domainoverrides'])) {
|
71 |
70edf50d
|
jim-p
|
$config['dnsmasq']['domainoverrides'] = array();
|
72 |
966ed611
|
Phil Davis
|
}
|
73 |
0c2b5df7
|
Scott Ullrich
|
|
74 |
70edf50d
|
jim-p
|
$a_hosts = &$config['dnsmasq']['hosts'];
|
75 |
0c2b5df7
|
Scott Ullrich
|
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
|
76 |
5b237745
|
Scott Ullrich
|
|
77 |
|
|
if ($_POST) {
|
78 |
|
|
$pconfig = $_POST;
|
79 |
8f9bffbc
|
Andrew Thompson
|
unset($input_errors);
|
80 |
5b237745
|
Scott Ullrich
|
|
81 |
|
|
$config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
|
82 |
|
|
$config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
|
83 |
6a01ea44
|
Bill Marquette
|
$config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
|
84 |
aa994814
|
Andrew Thompson
|
$config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
|
85 |
96ea7162
|
N0YB
|
$config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
|
86 |
|
|
$config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
|
87 |
7bdd28fb
|
Phil Davis
|
$config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
|
88 |
8f9bffbc
|
Andrew Thompson
|
$config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
|
89 |
b4323f39
|
jim-p
|
$config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
|
90 |
8f9bffbc
|
Andrew Thompson
|
|
91 |
06e847a7
|
Chris Buechler
|
if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
|
92 |
966ed611
|
Phil Davis
|
if ($_POST['port'] == $config['unbound']['port']) {
|
93 |
06e847a7
|
Chris Buechler
|
$input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.";
|
94 |
966ed611
|
Phil Davis
|
}
|
95 |
06e847a7
|
Chris Buechler
|
}
|
96 |
e6363160
|
sbeaver
|
|
97 |
|
|
if ($_POST['port']) {
|
98 |
966ed611
|
Phil Davis
|
if (is_port($_POST['port'])) {
|
99 |
e6c49e3d
|
jim-p
|
$config['dnsmasq']['port'] = $_POST['port'];
|
100 |
966ed611
|
Phil Davis
|
} else {
|
101 |
e6c49e3d
|
jim-p
|
$input_errors[] = gettext("You must specify a valid port number");
|
102 |
966ed611
|
Phil Davis
|
}
|
103 |
|
|
} else if (isset($config['dnsmasq']['port'])) {
|
104 |
e6c49e3d
|
jim-p
|
unset($config['dnsmasq']['port']);
|
105 |
966ed611
|
Phil Davis
|
}
|
106 |
e6c49e3d
|
jim-p
|
|
107 |
966ed611
|
Phil Davis
|
if (is_array($_POST['interface'])) {
|
108 |
b4323f39
|
jim-p
|
$config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
|
109 |
966ed611
|
Phil Davis
|
} elseif (isset($config['dnsmasq']['interface'])) {
|
110 |
b4323f39
|
jim-p
|
unset($config['dnsmasq']['interface']);
|
111 |
966ed611
|
Phil Davis
|
}
|
112 |
e6c49e3d
|
jim-p
|
|
113 |
8f9bffbc
|
Andrew Thompson
|
if ($config['dnsmasq']['custom_options']) {
|
114 |
|
|
$args = '';
|
115 |
966ed611
|
Phil Davis
|
foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) {
|
116 |
071f6059
|
jim-p
|
$args .= escapeshellarg("--{$c}") . " ";
|
117 |
966ed611
|
Phil Davis
|
}
|
118 |
8f9bffbc
|
Andrew Thompson
|
exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
|
119 |
966ed611
|
Phil Davis
|
if ($rc != 0) {
|
120 |
8f9bffbc
|
Andrew Thompson
|
$input_errors[] = gettext("Invalid custom options");
|
121 |
966ed611
|
Phil Davis
|
}
|
122 |
8f9bffbc
|
Andrew Thompson
|
}
|
123 |
5b237745
|
Scott Ullrich
|
|
124 |
8f9bffbc
|
Andrew Thompson
|
if (!$input_errors) {
|
125 |
|
|
write_config();
|
126 |
f0fe3d30
|
Scott Ullrich
|
|
127 |
8f9bffbc
|
Andrew Thompson
|
$retval = 0;
|
128 |
|
|
$retval = services_dnsmasq_configure();
|
129 |
|
|
$savemsg = get_std_save_message($retval);
|
130 |
5b237745
|
Scott Ullrich
|
|
131 |
966ed611
|
Phil Davis
|
// Reload filter (we might need to sync to CARP hosts)
|
132 |
8f9bffbc
|
Andrew Thompson
|
filter_configure();
|
133 |
bd5737dc
|
jim-p
|
/* 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 |
020d757a
|
Scott Ullrich
|
|
138 |
966ed611
|
Phil Davis
|
if ($retval == 0) {
|
139 |
8f9bffbc
|
Andrew Thompson
|
clear_subsystem_dirty('hosts');
|
140 |
966ed611
|
Phil Davis
|
}
|
141 |
8f9bffbc
|
Andrew Thompson
|
}
|
142 |
5b237745
|
Scott Ullrich
|
}
|
143 |
|
|
|
144 |
|
|
if ($_GET['act'] == "del") {
|
145 |
70edf50d
|
jim-p
|
if ($_GET['type'] == 'host') {
|
146 |
|
|
if ($a_hosts[$_GET['id']]) {
|
147 |
|
|
unset($a_hosts[$_GET['id']]);
|
148 |
|
|
write_config();
|
149 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
150 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
151 |
|
|
exit;
|
152 |
|
|
}
|
153 |
|
|
}
|
154 |
|
|
elseif ($_GET['type'] == 'doverride') {
|
155 |
|
|
if ($a_domainOverrides[$_GET['id']]) {
|
156 |
|
|
unset($a_domainOverrides[$_GET['id']]);
|
157 |
|
|
write_config();
|
158 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
159 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
160 |
|
|
exit;
|
161 |
|
|
}
|
162 |
|
|
}
|
163 |
5b237745
|
Scott Ullrich
|
}
|
164 |
0c2b5df7
|
Scott Ullrich
|
|
165 |
e6363160
|
sbeaver
|
function build_if_list() {
|
166 |
|
|
$interface_addresses = get_possible_listen_ips(true);
|
167 |
|
|
$iflist = array('options' => array(), 'selected' => array());
|
168 |
|
|
|
169 |
|
|
$iflist['options'][""] = "All";
|
170 |
|
|
if (empty($pconfig['interface']) || empty($pconfig['interface'][0]))
|
171 |
|
|
array_push($iflist['selected'], "");
|
172 |
|
|
|
173 |
|
|
foreach ($interface_addresses as $laddr => $ldescr) {
|
174 |
|
|
$iflist['options'][$laddr] = htmlspecialchars($ldescr);
|
175 |
|
|
|
176 |
|
|
if ($pconfig['interface'] && in_array($laddr, $pconfig['interface']))
|
177 |
|
|
array_push($iflist['selected'], $laddr);
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
unset($interface_addresses);
|
181 |
|
|
|
182 |
|
|
return($iflist);
|
183 |
|
|
}
|
184 |
|
|
|
185 |
7bd5b320
|
Colin Fleming
|
$closehead = false;
|
186 |
966ed611
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("DNS forwarder"));
|
187 |
db88a3a2
|
Phil Davis
|
$shortcut_section = "forwarder";
|
188 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
189 |
0c2b5df7
|
Scott Ullrich
|
|
190 |
e6363160
|
sbeaver
|
if ($input_errors)
|
191 |
|
|
print_input_errors($input_errors);
|
192 |
5b237745
|
Scott Ullrich
|
|
193 |
e6363160
|
sbeaver
|
if ($savemsg)
|
194 |
|
|
print_info_box($savemsg, 'success');
|
195 |
|
|
|
196 |
|
|
if (is_subsystem_dirty('hosts'))
|
197 |
|
|
print_info_box_np(gettext("The DNS forwarder configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
|
198 |
|
|
|
199 |
ad2879b8
|
PiBa-NL
|
require_once('classes/Form.class.php');
|
200 |
e6363160
|
sbeaver
|
|
201 |
fae9a73c
|
sbeaver
|
$form = new Form();
|
202 |
e6363160
|
sbeaver
|
|
203 |
|
|
$section = new Form_Section('General DNS Forwarder Options');
|
204 |
|
|
|
205 |
|
|
$section->addInput(new Form_Checkbox(
|
206 |
|
|
'enable',
|
207 |
|
|
'Enable',
|
208 |
|
|
'Enable DNS forwarder',
|
209 |
|
|
$pconfig['enable']
|
210 |
08d1762e
|
Sjon Hortensius
|
))->toggles('.toggle-dhcp', 'disable');
|
211 |
e6363160
|
sbeaver
|
|
212 |
|
|
$section->addInput(new Form_Checkbox(
|
213 |
|
|
'regdhcp',
|
214 |
|
|
'DHCP Registration',
|
215 |
|
|
'Register DHCP leases in DNS forwarder',
|
216 |
|
|
$pconfig['regdhcp']
|
217 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then machines that specify".
|
218 |
70edf50d
|
jim-p
|
" their hostname when requesting a DHCP lease will be registered".
|
219 |
|
|
" in the DNS forwarder, so that their name can be resolved.".
|
220 |
|
|
" You should also set the domain in %sSystem:".
|
221 |
08d1762e
|
Sjon Hortensius
|
" General setup%s to the proper value.",'<a href="system.php">','</a>'))
|
222 |
|
|
->addClass('toggle-dhcp');
|
223 |
e6363160
|
sbeaver
|
|
224 |
|
|
$section->addInput(new Form_Checkbox(
|
225 |
|
|
'regdhcpstatic',
|
226 |
|
|
'Static DHCP',
|
227 |
|
|
'Register DHCP static mappings in DNS forwarder',
|
228 |
|
|
$pconfig['regdhcpstatic']
|
229 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then DHCP static mappings will ".
|
230 |
70edf50d
|
jim-p
|
"be registered in the DNS forwarder, so that their name can be ".
|
231 |
|
|
"resolved. You should also set the domain in %s".
|
232 |
08d1762e
|
Sjon Hortensius
|
"System: General setup%s to the proper value.",'<a href="system.php">','</a>'))
|
233 |
|
|
->addClass('toggle-dhcp');
|
234 |
e6363160
|
sbeaver
|
|
235 |
|
|
$section->addInput(new Form_Checkbox(
|
236 |
|
|
'dhcpfirst',
|
237 |
|
|
'Prefer DHCP',
|
238 |
|
|
'Resolve DHCP mappings first',
|
239 |
|
|
$pconfig['dhcpfirst']
|
240 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then DHCP mappings will ".
|
241 |
aa994814
|
Andrew Thompson
|
"be resolved before the manual list of names below. This only ".
|
242 |
08d1762e
|
Sjon Hortensius
|
"affects the name given for a reverse lookup (PTR)."))
|
243 |
|
|
->addClass('toggle-dhcp');
|
244 |
e6363160
|
sbeaver
|
|
245 |
08d1762e
|
Sjon Hortensius
|
$group = new Form_Group('DNS Query Forwarding');
|
246 |
|
|
|
247 |
|
|
$group->add(new Form_Checkbox(
|
248 |
e6363160
|
sbeaver
|
'strict_order',
|
249 |
|
|
'DNS Query Forwarding',
|
250 |
|
|
'Query DNS servers sequentially',
|
251 |
|
|
$pconfig['strict_order']
|
252 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
253 |
96ea7162
|
N0YB
|
"query the DNS servers sequentially in the order specified (<i>System - General Setup - DNS Servers</i>), ".
|
254 |
fae9a73c
|
sbeaver
|
"rather than all at once in parallel. ", $g['product_name']));
|
255 |
e6363160
|
sbeaver
|
|
256 |
08d1762e
|
Sjon Hortensius
|
$group->add(new Form_Checkbox(
|
257 |
e6363160
|
sbeaver
|
'domain_needed',
|
258 |
|
|
null,
|
259 |
|
|
'Require domain',
|
260 |
|
|
$pconfig['domain_needed']
|
261 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
262 |
e6363160
|
sbeaver
|
"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ".
|
263 |
fae9a73c
|
sbeaver
|
"If the name is not known from /etc/hosts or DHCP then a \"not found\" answer is returned. ", $g['product_name']));
|
264 |
e6363160
|
sbeaver
|
|
265 |
08d1762e
|
Sjon Hortensius
|
$group->add(new Form_Checkbox(
|
266 |
e6363160
|
sbeaver
|
'no_private_reverse',
|
267 |
|
|
null,
|
268 |
|
|
'Do not forward private reverse lookups',
|
269 |
|
|
$pconfig['no_private_reverse']
|
270 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
271 |
7bdd28fb
|
Phil Davis
|
"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. ".
|
272 |
|
|
"Any entries in the Domain Overrides section forwarding private \"n.n.n.in-addr.arpa\" names to a specific server are still forwarded. ".
|
273 |
fae9a73c
|
sbeaver
|
"If the IP to name is not known from /etc/hosts, DHCP or a specific domain override then a \"not found\" answer is immediately returned. ", $g['product_name']));
|
274 |
e6363160
|
sbeaver
|
|
275 |
08d1762e
|
Sjon Hortensius
|
$section->add($group);
|
276 |
|
|
|
277 |
e6363160
|
sbeaver
|
$section->addInput(new Form_Input(
|
278 |
|
|
'port',
|
279 |
|
|
'Listen Port',
|
280 |
08d1762e
|
Sjon Hortensius
|
'number',
|
281 |
|
|
$pconfig['port'],
|
282 |
|
|
['placeholder' => '53']
|
283 |
e6363160
|
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.');
|
284 |
|
|
|
285 |
|
|
$iflist = build_if_list();
|
286 |
|
|
|
287 |
|
|
$section->addInput(new Form_Select(
|
288 |
|
|
'interface',
|
289 |
|
|
'Interfaces',
|
290 |
|
|
$iflist['selected'],
|
291 |
|
|
$iflist['options'],
|
292 |
|
|
true
|
293 |
|
|
))->setHelp('Interface IPs used by the DNS Forwarder 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. ' .
|
294 |
|
|
'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
|
295 |
|
|
|
296 |
|
|
$section->addInput(new Form_Checkbox(
|
297 |
|
|
'strictbind',
|
298 |
08d1762e
|
Sjon Hortensius
|
'Strict binding',
|
299 |
e6363160
|
sbeaver
|
'Strict interface binding',
|
300 |
|
|
$pconfig['strictbind']
|
301 |
fae9a73c
|
sbeaver
|
))->setHelp('If this option is set, the DNS forwarder will only bind to the interfaces containing the IP addresses selected above, ' .
|
302 |
e6363160
|
sbeaver
|
'rather than binding to all interfaces and discarding queries to other addresses.' . '<br /><br />' .
|
303 |
fae9a73c
|
sbeaver
|
'This option does NOT work with IPv6. If set, dnsmasq will not bind to IPv6 addresses.');
|
304 |
e6363160
|
sbeaver
|
|
305 |
08d1762e
|
Sjon Hortensius
|
$section->addInput(new Form_TextArea(
|
306 |
e6363160
|
sbeaver
|
'custom_options',
|
307 |
|
|
'Custom options',
|
308 |
|
|
$pconfig['custom_options']
|
309 |
08d1762e
|
Sjon Hortensius
|
))->setHelp('Enter any additional options you would like to add to the dnsmasq configuration here, separated by a space or newline')
|
310 |
|
|
->addClass('advanced');
|
311 |
e6363160
|
sbeaver
|
|
312 |
|
|
$form->add($section);
|
313 |
|
|
print($form);
|
314 |
|
|
|
315 |
fae9a73c
|
sbeaver
|
print_info_box(sprintf("If the DNS forwarder is enabled, the DHCP".
|
316 |
e6363160
|
sbeaver
|
" service (if enabled) will automatically serve the LAN IP".
|
317 |
|
|
" address as a DNS server to DHCP clients so they will use".
|
318 |
|
|
" the forwarder. The DNS forwarder will use the DNS servers".
|
319 |
|
|
" entered in %sSystem: General setup%s".
|
320 |
|
|
" or those obtained via DHCP or PPP on WAN if the "Allow".
|
321 |
|
|
" DNS server list to be overridden by DHCP/PPP on WAN"".
|
322 |
|
|
" is checked. If you don't use that option (or if you use".
|
323 |
|
|
" a static IP address on WAN), you must manually specify at".
|
324 |
|
|
" least one DNS server on the %sSystem:".
|
325 |
fae9a73c
|
sbeaver
|
"General setup%s page.",'<a href="system.php">','</a>','<a href="system.php">','</a>'));
|
326 |
e6363160
|
sbeaver
|
?>
|
327 |
|
|
|
328 |
|
|
<div class="panel panel-default">
|
329 |
08d1762e
|
Sjon Hortensius
|
<div class="panel-heading"><h2><?=gettext("Host Overrides")?></h2></div>
|
330 |
e6363160
|
sbeaver
|
<div class="panel-body table-responsive">
|
331 |
|
|
<table class="table table-striped table-hover table-condensed">
|
332 |
|
|
<thead>
|
333 |
70edf50d
|
jim-p
|
<tr>
|
334 |
e6363160
|
sbeaver
|
<th><?=gettext("Host")?></th>
|
335 |
|
|
<th><?=gettext("Domain")?></th>
|
336 |
|
|
<th><?=gettext("IP")?></th>
|
337 |
|
|
<th><?=gettext("Description")?></th>
|
338 |
|
|
<th></th>
|
339 |
70edf50d
|
jim-p
|
</tr>
|
340 |
e6363160
|
sbeaver
|
</thead>
|
341 |
|
|
<tbody>
|
342 |
|
|
<?php
|
343 |
08d1762e
|
Sjon Hortensius
|
foreach ($a_hosts as $i => $hostent):
|
344 |
e6363160
|
sbeaver
|
?>
|
345 |
|
|
<tr>
|
346 |
|
|
<td>
|
347 |
|
|
<?=strtolower($hostent['host'])?>
|
348 |
|
|
</td>
|
349 |
|
|
<td>
|
350 |
|
|
<?=strtolower($hostent['domain'])?>
|
351 |
|
|
</td>
|
352 |
|
|
<td>
|
353 |
08d1762e
|
Sjon Hortensius
|
<?=$hostent['ip']?>
|
354 |
e6363160
|
sbeaver
|
</td>
|
355 |
|
|
<td>
|
356 |
|
|
<?=htmlspecialchars($hostent['descr'])?>
|
357 |
|
|
</td>
|
358 |
|
|
<td>
|
359 |
|
|
<a href="services_dnsmasq_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
|
360 |
|
|
<a href="services_dnsmasq.php?type=host&act=del&id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext('Delete')?></a>
|
361 |
|
|
</td>
|
362 |
|
|
</tr>
|
363 |
|
|
|
364 |
|
|
<?php
|
365 |
|
|
if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
|
366 |
08d1762e
|
Sjon Hortensius
|
foreach ($hostent['aliases']['item'] as $i => $alias):
|
367 |
e6363160
|
sbeaver
|
?>
|
368 |
7bd5b320
|
Colin Fleming
|
<tr>
|
369 |
e6363160
|
sbeaver
|
<td>
|
370 |
|
|
<?=strtolower($alias['host'])?>
|
371 |
|
|
</td>
|
372 |
|
|
<td>
|
373 |
|
|
<?=strtolower($alias['domain'])?>
|
374 |
|
|
</td>
|
375 |
|
|
<td>
|
376 |
|
|
Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
|
377 |
|
|
</td>
|
378 |
|
|
<td>
|
379 |
|
|
<?=htmlspecialchars($alias['description'])?>
|
380 |
|
|
</td>
|
381 |
|
|
<td>
|
382 |
|
|
<a href="services_dnsmasq_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
|
383 |
|
|
</td>
|
384 |
7bd5b320
|
Colin Fleming
|
</tr>
|
385 |
e6363160
|
sbeaver
|
<?php
|
386 |
|
|
endforeach;
|
387 |
|
|
endif;
|
388 |
|
|
endforeach;
|
389 |
|
|
?>
|
390 |
|
|
</tbody>
|
391 |
|
|
</table>
|
392 |
|
|
</div>
|
393 |
|
|
</div>
|
394 |
|
|
|
395 |
|
|
<nav class="action-buttons">
|
396 |
|
|
<a href="services_dnsmasq_edit.php" class="btn btn-sm btn-success"><?=gettext('Add')?></a>
|
397 |
|
|
</nav>
|
398 |
|
|
|
399 |
|
|
<?php
|
400 |
08d1762e
|
Sjon Hortensius
|
print_info_box(gettext("Entries in this section override individual results from the forwarders.") .
|
401 |
|
|
gettext("Use these for changing DNS results or for adding custom DNS records."));
|
402 |
e6363160
|
sbeaver
|
?>
|
403 |
|
|
|
404 |
|
|
<div class="panel panel-default">
|
405 |
08d1762e
|
Sjon Hortensius
|
<div class="panel-heading"><h2><?=gettext("Domain Overrides")?></h2></div>
|
406 |
e6363160
|
sbeaver
|
<div class="panel-body table-responsive">
|
407 |
|
|
<table class="table table-striped table-hover table-condensed">
|
408 |
|
|
<thead>
|
409 |
70edf50d
|
jim-p
|
<tr>
|
410 |
e6363160
|
sbeaver
|
<th><?=gettext("Domain")?></th>
|
411 |
|
|
<th><?=gettext("IP")?></th>
|
412 |
|
|
<th><?=gettext("Description")?></th>
|
413 |
|
|
<th></th>
|
414 |
70edf50d
|
jim-p
|
</tr>
|
415 |
e6363160
|
sbeaver
|
</thead>
|
416 |
|
|
|
417 |
|
|
<tbody>
|
418 |
|
|
<?php
|
419 |
08d1762e
|
Sjon Hortensius
|
foreach ($a_domainOverrides as $i => $doment):
|
420 |
e6363160
|
sbeaver
|
?>
|
421 |
70edf50d
|
jim-p
|
<tr>
|
422 |
e6363160
|
sbeaver
|
<td>
|
423 |
08d1762e
|
Sjon Hortensius
|
<?=strtolower($doment['domain'])?>
|
424 |
e6363160
|
sbeaver
|
</td>
|
425 |
|
|
<td>
|
426 |
08d1762e
|
Sjon Hortensius
|
<?=$doment['ip']?>
|
427 |
e6363160
|
sbeaver
|
</td>
|
428 |
|
|
<td>
|
429 |
08d1762e
|
Sjon Hortensius
|
<?=htmlspecialchars($doment['descr'])?>
|
430 |
e6363160
|
sbeaver
|
</td>
|
431 |
|
|
<td>
|
432 |
|
|
<a href="services_dnsmasq_domainoverride_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
|
433 |
|
|
<a href="services_dnsmasq.php?act=del&type=doverride&id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext('Delete')?></a>
|
434 |
|
|
</td>
|
435 |
70edf50d
|
jim-p
|
</tr>
|
436 |
e6363160
|
sbeaver
|
<?php
|
437 |
|
|
endforeach;
|
438 |
|
|
?>
|
439 |
|
|
</tbody>
|
440 |
7bd5b320
|
Colin Fleming
|
</table>
|
441 |
e6363160
|
sbeaver
|
</div>
|
442 |
|
|
</div>
|
443 |
|
|
|
444 |
|
|
<nav class="action-buttons">
|
445 |
|
|
<a href="services_dnsmasq_domainoverride_edit.php" class="btn btn-sm btn-success"><?=gettext('Add')?></a>
|
446 |
|
|
</nav>
|
447 |
|
|
|
448 |
|
|
<?php
|
449 |
|
|
print_info_box(gettext("Entries in this area override an entire domain, and subdomains, by specifying an".
|
450 |
08d1762e
|
Sjon Hortensius
|
" authoritative DNS server to be queried for that domain."));
|
451 |
e6363160
|
sbeaver
|
|
452 |
|
|
include("foot.inc");
|