1 |
04ad7c7c
|
Scott Ullrich
|
<?php
|
2 |
62d01225
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
system.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
04ad7c7c
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 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 |
04ad7c7c
|
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 |
04ad7c7c
|
Scott Ullrich
|
|
14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
1180e4f0
|
Sjon Hortensius
|
this list of conditions and the following disclaimer.
|
16 |
04ad7c7c
|
Scott Ullrich
|
|
17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
1180e4f0
|
Sjon Hortensius
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
04ad7c7c
|
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 |
1d333258
|
Scott Ullrich
|
/*
|
33 |
|
|
pfSense_BUILDER_BINARIES: /bin/kill /usr/bin/tar
|
34 |
64c3b4cd
|
sbeaver
|
pfSense_MODULE: system
|
35 |
1d333258
|
Scott Ullrich
|
*/
|
36 |
5b237745
|
Scott Ullrich
|
|
37 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
38 |
|
|
##|*IDENT=page-system-generalsetup
|
39 |
|
|
##|*NAME=System: General Setup page
|
40 |
|
|
##|*DESCR=Allow access to the 'System: General Setup' page.
|
41 |
|
|
##|*MATCH=system.php*
|
42 |
|
|
##|-PRIV
|
43 |
|
|
|
44 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
45 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
46 |
|
|
require_once("filter.inc");
|
47 |
|
|
require_once("shaper.inc");
|
48 |
5b237745
|
Scott Ullrich
|
|
49 |
|
|
$pconfig['hostname'] = $config['system']['hostname'];
|
50 |
|
|
$pconfig['domain'] = $config['system']['domain'];
|
51 |
2ee8dea1
|
Phil Davis
|
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['system']['dnsserver'];
|
52 |
0d8a219e
|
Scott Ullrich
|
|
53 |
d623f2da
|
Seth Mos
|
$arr_gateways = return_gateways_array();
|
54 |
|
|
|
55 |
|
|
$pconfig['dns1gw'] = $config['system']['dns1gw'];
|
56 |
|
|
$pconfig['dns2gw'] = $config['system']['dns2gw'];
|
57 |
|
|
$pconfig['dns3gw'] = $config['system']['dns3gw'];
|
58 |
|
|
$pconfig['dns4gw'] = $config['system']['dns4gw'];
|
59 |
e180a6e3
|
Scott Ullrich
|
|
60 |
5b237745
|
Scott Ullrich
|
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
|
61 |
|
|
$pconfig['timezone'] = $config['system']['timezone'];
|
62 |
|
|
$pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
|
63 |
|
|
$pconfig['timeservers'] = $config['system']['timeservers'];
|
64 |
f0f7a3eb
|
Scott Ullrich
|
$pconfig['theme'] = $config['system']['theme'];
|
65 |
3e139f90
|
Vinicius Coque
|
$pconfig['language'] = $config['system']['language'];
|
66 |
5b237745
|
Scott Ullrich
|
|
67 |
8ca95ed8
|
jim-p
|
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
|
68 |
|
|
|
69 |
2ee8dea1
|
Phil Davis
|
if (!isset($pconfig['timeupdateinterval'])) {
|
70 |
5b237745
|
Scott Ullrich
|
$pconfig['timeupdateinterval'] = 300;
|
71 |
2ee8dea1
|
Phil Davis
|
}
|
72 |
|
|
if (!$pconfig['timezone']) {
|
73 |
5b237745
|
Scott Ullrich
|
$pconfig['timezone'] = "Etc/UTC";
|
74 |
2ee8dea1
|
Phil Davis
|
}
|
75 |
|
|
if (!$pconfig['timeservers']) {
|
76 |
5b237745
|
Scott Ullrich
|
$pconfig['timeservers'] = "pool.ntp.org";
|
77 |
2ee8dea1
|
Phil Davis
|
}
|
78 |
04ad7c7c
|
Scott Ullrich
|
|
79 |
79eaddf4
|
Renato Botelho
|
$changedesc = gettext("System") . ": ";
|
80 |
62d01225
|
Bill Marquette
|
$changecount = 0;
|
81 |
417c6042
|
Bill Marquette
|
|
82 |
5b237745
|
Scott Ullrich
|
function is_timezone($elt) {
|
83 |
|
|
return !preg_match("/\/$/", $elt);
|
84 |
|
|
}
|
85 |
|
|
|
86 |
2ee8dea1
|
Phil Davis
|
if ($pconfig['timezone'] <> $_POST['timezone']) {
|
87 |
744306c6
|
jim-p
|
filter_pflog_start(true);
|
88 |
aa1ab1da
|
Scott Ullrich
|
}
|
89 |
|
|
|
90 |
5b237745
|
Scott Ullrich
|
exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist);
|
91 |
|
|
$timezonelist = array_filter($timezonelist, 'is_timezone');
|
92 |
|
|
sort($timezonelist);
|
93 |
|
|
|
94 |
77446beb
|
Matthew Grooms
|
$multiwan = false;
|
95 |
7922db8a
|
Seth Mos
|
$interfaces = get_configured_interface_list();
|
96 |
2ee8dea1
|
Phil Davis
|
foreach ($interfaces as $interface) {
|
97 |
|
|
if (interface_has_gateway($interface)) {
|
98 |
77446beb
|
Matthew Grooms
|
$multiwan = true;
|
99 |
7922db8a
|
Seth Mos
|
}
|
100 |
|
|
}
|
101 |
77446beb
|
Matthew Grooms
|
|
102 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
103 |
|
|
|
104 |
c668c964
|
Scott Ullrich
|
$changecount++;
|
105 |
1180e4f0
|
Sjon Hortensius
|
|
106 |
5b237745
|
Scott Ullrich
|
unset($input_errors);
|
107 |
|
|
$pconfig = $_POST;
|
108 |
|
|
|
109 |
|
|
/* input validation */
|
110 |
cfbfd941
|
smos
|
$reqdfields = explode(" ", "hostname domain");
|
111 |
2ee8dea1
|
Phil Davis
|
$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
|
112 |
04ad7c7c
|
Scott Ullrich
|
|
113 |
1e9b4611
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
114 |
04ad7c7c
|
Scott Ullrich
|
|
115 |
2d86ee95
|
Phil Davis
|
if ($_POST['hostname']) {
|
116 |
|
|
if (!is_hostname($_POST['hostname'])) {
|
117 |
|
|
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
|
118 |
|
|
} else {
|
119 |
|
|
if (!is_unqualified_hostname($_POST['hostname'])) {
|
120 |
|
|
$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
5b237745
|
Scott Ullrich
|
}
|
124 |
|
|
if ($_POST['domain'] && !is_domain($_POST['domain'])) {
|
125 |
7465d12c
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
|
126 |
5b237745
|
Scott Ullrich
|
}
|
127 |
d623f2da
|
Seth Mos
|
|
128 |
df4471e2
|
Phil Davis
|
$ignore_posted_dnsgw = array();
|
129 |
|
|
|
130 |
2ee8dea1
|
Phil Davis
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
131 |
d623f2da
|
Seth Mos
|
$dnsname="dns{$dnscounter}";
|
132 |
|
|
$dnsgwname="dns{$dnscounter}gw";
|
133 |
|
|
if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
|
134 |
52acb1ff
|
Phil Davis
|
$input_errors[] = gettext("A valid IP address must be specified for DNS server $dnscounter.");
|
135 |
|
|
} else {
|
136 |
2ee8dea1
|
Phil Davis
|
if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
|
137 |
52acb1ff
|
Phil Davis
|
// A real gateway has been selected.
|
138 |
|
|
if (is_ipaddr($_POST[$dnsname])) {
|
139 |
2ee8dea1
|
Phil Davis
|
if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
|
140 |
52acb1ff
|
Phil Davis
|
$input_errors[] = gettext("You can not specify IPv6 gateway '{$_POST[$dnsgwname]}' for IPv4 DNS server '{$_POST[$dnsname]}'");
|
141 |
|
|
}
|
142 |
2ee8dea1
|
Phil Davis
|
if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
|
143 |
52acb1ff
|
Phil Davis
|
$input_errors[] = gettext("You can not specify IPv4 gateway '{$_POST[$dnsgwname]}' for IPv6 DNS server '{$_POST[$dnsname]}'");
|
144 |
|
|
}
|
145 |
|
|
} else {
|
146 |
df4471e2
|
Phil Davis
|
// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
|
147 |
|
|
$ignore_posted_dnsgw[$dnsgwname] = true;
|
148 |
52acb1ff
|
Phil Davis
|
}
|
149 |
13ea7caa
|
smos
|
}
|
150 |
d623f2da
|
Seth Mos
|
}
|
151 |
5b237745
|
Scott Ullrich
|
}
|
152 |
d623f2da
|
Seth Mos
|
|
153 |
985fc0fb
|
Ermal Lu?i
|
$direct_networks_list = explode(" ", filter_get_direct_networks_list());
|
154 |
c98d28e1
|
Seth Mos
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
155 |
|
|
$dnsitem = "dns{$dnscounter}";
|
156 |
d623f2da
|
Seth Mos
|
$dnsgwitem = "dns{$dnscounter}gw";
|
157 |
c98d28e1
|
Seth Mos
|
if ($_POST[$dnsgwitem]) {
|
158 |
2ee8dea1
|
Phil Davis
|
if (interface_has_gateway($_POST[$dnsgwitem])) {
|
159 |
|
|
foreach ($direct_networks_list as $direct_network) {
|
160 |
|
|
if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
|
161 |
|
|
$input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
|
162 |
c98d28e1
|
Seth Mos
|
}
|
163 |
|
|
}
|
164 |
|
|
}
|
165 |
|
|
}
|
166 |
|
|
}
|
167 |
|
|
|
168 |
5b237745
|
Scott Ullrich
|
$t = (int)$_POST['timeupdateinterval'];
|
169 |
|
|
if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) {
|
170 |
7465d12c
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("The time update interval must be either 0 (disabled) or between 6 and 1440.");
|
171 |
5b237745
|
Scott Ullrich
|
}
|
172 |
8adb814b
|
David P Hilton
|
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
|
173 |
|
|
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
|
174 |
|
|
$_POST['timeservers'] = trim($_POST['timeservers']);
|
175 |
5b237745
|
Scott Ullrich
|
foreach (explode(' ', $_POST['timeservers']) as $ts) {
|
176 |
|
|
if (!is_domain($ts)) {
|
177 |
7465d12c
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
|
178 |
5b237745
|
Scott Ullrich
|
}
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
if (!$input_errors) {
|
182 |
f1a34790
|
N0YB
|
update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
|
183 |
|
|
update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
|
184 |
9eab73da
|
Bill Marquette
|
update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
|
185 |
|
|
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
|
186 |
|
|
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
|
187 |
04ad7c7c
|
Scott Ullrich
|
|
188 |
2ee8dea1
|
Phil Davis
|
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
|
189 |
3e139f90
|
Vinicius Coque
|
$config['system']['language'] = $_POST['language'];
|
190 |
|
|
set_language($config['system']['language']);
|
191 |
|
|
}
|
192 |
|
|
|
193 |
f0f7a3eb
|
Scott Ullrich
|
/* pfSense themes */
|
194 |
2ee8dea1
|
Phil Davis
|
if (!$g['disablethemeselection']) {
|
195 |
1180e4f0
|
Sjon Hortensius
|
update_if_changed("System Theme", $config['theme'], $_POST['theme']);
|
196 |
7321c93c
|
Chris Buechler
|
}
|
197 |
f0f7a3eb
|
Scott Ullrich
|
|
198 |
4fbf63aa
|
Bill Marquette
|
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
|
199 |
52acb1ff
|
Phil Davis
|
$olddnsservers = $config['system']['dnsserver'];
|
200 |
5b237745
|
Scott Ullrich
|
unset($config['system']['dnsserver']);
|
201 |
2ee8dea1
|
Phil Davis
|
if ($_POST['dns1']) {
|
202 |
5b237745
|
Scott Ullrich
|
$config['system']['dnsserver'][] = $_POST['dns1'];
|
203 |
2ee8dea1
|
Phil Davis
|
}
|
204 |
|
|
if ($_POST['dns2']) {
|
205 |
5b237745
|
Scott Ullrich
|
$config['system']['dnsserver'][] = $_POST['dns2'];
|
206 |
2ee8dea1
|
Phil Davis
|
}
|
207 |
|
|
if ($_POST['dns3']) {
|
208 |
93e0800d
|
Scott Ullrich
|
$config['system']['dnsserver'][] = $_POST['dns3'];
|
209 |
2ee8dea1
|
Phil Davis
|
}
|
210 |
|
|
if ($_POST['dns4']) {
|
211 |
93e0800d
|
Scott Ullrich
|
$config['system']['dnsserver'][] = $_POST['dns4'];
|
212 |
2ee8dea1
|
Phil Davis
|
}
|
213 |
04ad7c7c
|
Scott Ullrich
|
|
214 |
07bd3f83
|
Scott Ullrich
|
$olddnsallowoverride = $config['system']['dnsallowoverride'];
|
215 |
20b90e0a
|
Scott Ullrich
|
|
216 |
0d8a219e
|
Scott Ullrich
|
unset($config['system']['dnsallowoverride']);
|
217 |
5b237745
|
Scott Ullrich
|
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
|
218 |
e180a6e3
|
Scott Ullrich
|
|
219 |
2ee8dea1
|
Phil Davis
|
if ($_POST['dnslocalhost'] == "yes") {
|
220 |
8ca95ed8
|
jim-p
|
$config['system']['dnslocalhost'] = true;
|
221 |
2ee8dea1
|
Phil Davis
|
} else {
|
222 |
8ca95ed8
|
jim-p
|
unset($config['system']['dnslocalhost']);
|
223 |
2ee8dea1
|
Phil Davis
|
}
|
224 |
8ca95ed8
|
jim-p
|
|
225 |
e180a6e3
|
Scott Ullrich
|
/* which interface should the dns servers resolve through? */
|
226 |
df4471e2
|
Phil Davis
|
$outdnscounter = 0;
|
227 |
d623f2da
|
Seth Mos
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
228 |
|
|
$dnsname="dns{$dnscounter}";
|
229 |
|
|
$dnsgwname="dns{$dnscounter}gw";
|
230 |
52acb1ff
|
Phil Davis
|
$olddnsgwname = $config['system'][$dnsgwname];
|
231 |
df4471e2
|
Phil Davis
|
|
232 |
2ee8dea1
|
Phil Davis
|
if ($ignore_posted_dnsgw[$dnsgwname]) {
|
233 |
df4471e2
|
Phil Davis
|
$thisdnsgwname = "none";
|
234 |
2ee8dea1
|
Phil Davis
|
} else {
|
235 |
df4471e2
|
Phil Davis
|
$thisdnsgwname = $pconfig[$dnsgwname];
|
236 |
2ee8dea1
|
Phil Davis
|
}
|
237 |
df4471e2
|
Phil Davis
|
|
238 |
|
|
// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
|
239 |
|
|
$config['system'][$dnsgwname] = "none";
|
240 |
|
|
$pconfig[$dnsgwname] = "none";
|
241 |
|
|
$pconfig[$dnsname] = "";
|
242 |
|
|
|
243 |
|
|
if ($_POST[$dnsname]) {
|
244 |
|
|
// Only the non-blank DNS servers were put into the config above.
|
245 |
|
|
// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
|
246 |
|
|
// This keeps the DNS server IP and corresponding gateway "lined up" when the user blanks out a DNS server IP in the middle of the list.
|
247 |
|
|
$outdnscounter++;
|
248 |
|
|
$outdnsname="dns{$outdnscounter}";
|
249 |
|
|
$outdnsgwname="dns{$outdnscounter}gw";
|
250 |
|
|
$pconfig[$outdnsname] = $_POST[$dnsname];
|
251 |
2ee8dea1
|
Phil Davis
|
if ($_POST[$dnsgwname]) {
|
252 |
df4471e2
|
Phil Davis
|
$config['system'][$outdnsgwname] = $thisdnsgwname;
|
253 |
|
|
$pconfig[$outdnsgwname] = $thisdnsgwname;
|
254 |
|
|
} else {
|
255 |
|
|
// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
|
256 |
|
|
unset($config['system'][$outdnsgwname]);
|
257 |
|
|
$pconfig[$outdnsgwname] = "";
|
258 |
|
|
}
|
259 |
d623f2da
|
Seth Mos
|
}
|
260 |
df4471e2
|
Phil Davis
|
if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter-1] != $_POST[$dnsname]))) {
|
261 |
52acb1ff
|
Phil Davis
|
// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
|
262 |
|
|
// Remove the route. Later calls will add the correct new route if needed.
|
263 |
2ee8dea1
|
Phil Davis
|
if (is_ipaddrv4($olddnsservers[$dnscounter-1])) {
|
264 |
52acb1ff
|
Phil Davis
|
mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
|
265 |
2ee8dea1
|
Phil Davis
|
} else {
|
266 |
|
|
if (is_ipaddrv6($olddnsservers[$dnscounter-1])) {
|
267 |
52acb1ff
|
Phil Davis
|
mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
|
268 |
2ee8dea1
|
Phil Davis
|
}
|
269 |
|
|
}
|
270 |
52acb1ff
|
Phil Davis
|
}
|
271 |
d623f2da
|
Seth Mos
|
}
|
272 |
04ad7c7c
|
Scott Ullrich
|
|
273 |
2ee8dea1
|
Phil Davis
|
if ($changecount > 0) {
|
274 |
62d01225
|
Bill Marquette
|
write_config($changedesc);
|
275 |
2ee8dea1
|
Phil Davis
|
}
|
276 |
04ad7c7c
|
Scott Ullrich
|
|
277 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
278 |
3cfdba5f
|
Scott Ullrich
|
$retval = system_hostname_configure();
|
279 |
|
|
$retval |= system_hosts_generate();
|
280 |
|
|
$retval |= system_resolvconf_generate();
|
281 |
2ee8dea1
|
Phil Davis
|
if (isset($config['dnsmasq']['enable'])) {
|
282 |
1e2c8821
|
Warren Baker
|
$retval |= services_dnsmasq_configure();
|
283 |
2ee8dea1
|
Phil Davis
|
} elseif (isset($config['unbound']['enable'])) {
|
284 |
1e2c8821
|
Warren Baker
|
$retval |= services_unbound_configure();
|
285 |
2ee8dea1
|
Phil Davis
|
}
|
286 |
3cfdba5f
|
Scott Ullrich
|
$retval |= system_timezone_configure();
|
287 |
|
|
$retval |= system_ntp_configure();
|
288 |
|
|
|
289 |
2ee8dea1
|
Phil Davis
|
if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
|
290 |
b8292903
|
Ermal
|
$retval |= send_event("service reload dns");
|
291 |
2ee8dea1
|
Phil Davis
|
}
|
292 |
3cfdba5f
|
Scott Ullrich
|
|
293 |
e7d967d8
|
Scott Ullrich
|
// Reload the filter - plugins might need to be run.
|
294 |
0027de0a
|
Ermal Lu?i
|
$retval |= filter_configure();
|
295 |
1180e4f0
|
Sjon Hortensius
|
|
296 |
5b237745
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
297 |
|
|
}
|
298 |
df4471e2
|
Phil Davis
|
|
299 |
|
|
unset($ignore_posted_dnsgw);
|
300 |
5b237745
|
Scott Ullrich
|
}
|
301 |
4df96eff
|
Scott Ullrich
|
|
302 |
2ee8dea1
|
Phil Davis
|
$pgtitle = array(gettext("System"), gettext("General Setup"));
|
303 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
304 |
|
|
|
305 |
41ea4cf3
|
Sjon Hortensius
|
if ($input_errors)
|
306 |
|
|
print_input_errors($input_errors);
|
307 |
|
|
if ($savemsg)
|
308 |
|
|
print_info_box($savemsg);
|
309 |
5b237745
|
Scott Ullrich
|
?>
|
310 |
41ea4cf3
|
Sjon Hortensius
|
<div id="container">
|
311 |
b40bcb23
|
Sjon Hortensius
|
<?php
|
312 |
1180e4f0
|
Sjon Hortensius
|
|
313 |
ad2879b8
|
PiBa-NL
|
require_once('classes/Form.class.php');
|
314 |
b40bcb23
|
Sjon Hortensius
|
$form = new Form;
|
315 |
a32c0623
|
Sjon Hortensius
|
$section = new Form_Section('System');
|
316 |
|
|
$section->addInput(new Form_Input(
|
317 |
a97531c5
|
Sjon Hortensius
|
'hostname',
|
318 |
a32c0623
|
Sjon Hortensius
|
'Hostname',
|
319 |
|
|
'text',
|
320 |
|
|
$pconfig['hostname'],
|
321 |
|
|
['placeholder' => 'pfSense']
|
322 |
|
|
))->setHelp('Name of the firewall host, without domain part');
|
323 |
|
|
$section->addInput(new Form_Input(
|
324 |
a97531c5
|
Sjon Hortensius
|
'domain',
|
325 |
a32c0623
|
Sjon Hortensius
|
'Domain',
|
326 |
|
|
'text',
|
327 |
|
|
$pconfig['domain'],
|
328 |
|
|
['placeholder' => 'mycorp.com, home, office, private, etc.']
|
329 |
|
|
))->setHelp('Do not use \'local\' as a domain name. It will cause local '.
|
330 |
|
|
'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '.
|
331 |
|
|
'local hosts not running mDNS.');
|
332 |
b40bcb23
|
Sjon Hortensius
|
$form->add($section);
|
333 |
|
|
|
334 |
a005a836
|
Sjon Hortensius
|
$section = new Form_Section('DNS server settings');
|
335 |
b40bcb23
|
Sjon Hortensius
|
|
336 |
|
|
for ($i=1; $i<5; $i++)
|
337 |
|
|
{
|
338 |
|
|
if (!isset($pconfig['dns'.$i]))
|
339 |
|
|
continue;
|
340 |
|
|
|
341 |
a005a836
|
Sjon Hortensius
|
$group = new Form_Group('DNS Server');
|
342 |
a97531c5
|
Sjon Hortensius
|
$group->add(new Form_Input('dns['.$i.']', 'DNS Server', 'text', $pconfig['dns'.$i]));
|
343 |
b40bcb23
|
Sjon Hortensius
|
$help = "Enter IP addresses to be used by the system for DNS resolution. " .
|
344 |
|
|
"These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients.";
|
345 |
|
|
|
346 |
|
|
if ($multiwan)
|
347 |
|
|
{
|
348 |
|
|
$options = array('none' => 'none');
|
349 |
|
|
|
350 |
|
|
foreach($arr_gateways as $gwname => $gwitem)
|
351 |
|
|
{
|
352 |
|
|
if((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
|
353 |
|
|
continue;
|
354 |
|
|
}
|
355 |
|
|
if((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
|
356 |
|
|
continue;
|
357 |
|
|
}
|
358 |
1180e4f0
|
Sjon Hortensius
|
|
359 |
b40bcb23
|
Sjon Hortensius
|
$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
|
360 |
|
|
}
|
361 |
1180e4f0
|
Sjon Hortensius
|
|
362 |
a97531c5
|
Sjon Hortensius
|
$group->add(new Form_Select(
|
363 |
|
|
'gateway',
|
364 |
|
|
'Gateway',
|
365 |
|
|
$pconfig['dns'.$i.'gw'],
|
366 |
|
|
$options
|
367 |
|
|
));
|
368 |
1180e4f0
|
Sjon Hortensius
|
|
369 |
b40bcb23
|
Sjon Hortensius
|
$help .= '<br/>'. "In addition, optionally select the gateway for each DNS server. " .
|
370 |
|
|
"When using multiple WAN connections there should be at least one unique DNS server per gateway.";
|
371 |
|
|
}
|
372 |
1180e4f0
|
Sjon Hortensius
|
|
373 |
b40bcb23
|
Sjon Hortensius
|
$group->setHelp($help);
|
374 |
|
|
$section->add($group);
|
375 |
|
|
}
|
376 |
1180e4f0
|
Sjon Hortensius
|
|
377 |
a005a836
|
Sjon Hortensius
|
$section->addInput(new Form_Checkbox(
|
378 |
a97531c5
|
Sjon Hortensius
|
'dnsallowoverride',
|
379 |
b40bcb23
|
Sjon Hortensius
|
'DNS server override',
|
380 |
|
|
'Allow DNS server list to be overridden by DHCP/PPP on WAN',
|
381 |
|
|
$pconfig['dnsallowoverride']
|
382 |
a32c0623
|
Sjon Hortensius
|
))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers'.
|
383 |
|
|
'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
|
384 |
|
|
'the DNS forwarder). However, they will not be assigned to DHCP and PPTP '.
|
385 |
|
|
'VPN clients.'), $g['product_name']));
|
386 |
b40bcb23
|
Sjon Hortensius
|
|
387 |
a005a836
|
Sjon Hortensius
|
$section->addInput(new Form_Checkbox(
|
388 |
a97531c5
|
Sjon Hortensius
|
'dnslocalhost',
|
389 |
b40bcb23
|
Sjon Hortensius
|
'Disable DNS forwarder',
|
390 |
|
|
'Do not use the DNS Forwarder as a DNS server for the firewall',
|
391 |
|
|
$pconfig['dnslocalhost']
|
392 |
a32c0623
|
Sjon Hortensius
|
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS'.
|
393 |
|
|
'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
|
394 |
|
|
'listen on Localhost, so system can use the local DNS service to perform'.
|
395 |
|
|
'lookups. Checking this box omits localhost from the list of DNS servers.');
|
396 |
b40bcb23
|
Sjon Hortensius
|
|
397 |
|
|
$form->add($section);
|
398 |
|
|
|
399 |
a005a836
|
Sjon Hortensius
|
$section = new Form_Section('Localization');
|
400 |
|
|
$section->addInput(new Form_Select(
|
401 |
a97531c5
|
Sjon Hortensius
|
'timezone',
|
402 |
a32c0623
|
Sjon Hortensius
|
'Timezone',
|
403 |
|
|
$pconfig['timezone'],
|
404 |
64c3b4cd
|
sbeaver
|
array_combine($timezonelist, $timezonelist)
|
405 |
a32c0623
|
Sjon Hortensius
|
))->setHelp('Select the location closest to you');
|
406 |
a005a836
|
Sjon Hortensius
|
$section->addInput(new Form_Input(
|
407 |
a97531c5
|
Sjon Hortensius
|
'timeservers',
|
408 |
a32c0623
|
Sjon Hortensius
|
'Timeservers',
|
409 |
|
|
'text',
|
410 |
|
|
$pconfig['timeservers']
|
411 |
|
|
))->setHelp('Use a space to separate multiple hosts (only one required). '.
|
412 |
|
|
'Remember to set up at least one DNS server if you enter a host name here!');
|
413 |
a005a836
|
Sjon Hortensius
|
$section->addInput(new Form_Select(
|
414 |
a97531c5
|
Sjon Hortensius
|
'language',
|
415 |
a32c0623
|
Sjon Hortensius
|
'Language',
|
416 |
|
|
$pconfig['language'],
|
417 |
|
|
get_locale_list()
|
418 |
|
|
))->setHelp('Choose a language for the webConfigurator');
|
419 |
b40bcb23
|
Sjon Hortensius
|
|
420 |
|
|
$form->add($section);
|
421 |
|
|
|
422 |
|
|
print $form;
|
423 |
69f9ff40
|
Sjon Hortensius
|
|
424 |
|
|
include("foot.inc");
|