1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_advanced_admin.php
|
5
|
part of pfSense
|
6
|
Copyright (C) 2005-2010 Scott Ullrich
|
7
|
Copyright (C) 2008 Shrew Soft Inc
|
8
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
9
|
|
10
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
11
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12
|
All rights reserved.
|
13
|
|
14
|
Redistribution and use in source and binary forms, with or without
|
15
|
modification, are permitted provided that the following conditions are met:
|
16
|
|
17
|
1. Redistributions of source code must retain the above copyright notice,
|
18
|
this list of conditions and the following disclaimer.
|
19
|
|
20
|
2. Redistributions in binary form must reproduce the above copyright
|
21
|
notice, this list of conditions and the following disclaimer in the
|
22
|
documentation and/or other materials provided with the distribution.
|
23
|
|
24
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
25
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
26
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
27
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
28
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
29
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
30
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
31
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
32
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33
|
POSSIBILITY OF SUCH DAMAGE.
|
34
|
*/
|
35
|
/*
|
36
|
pfSense_BUILDER_BINARIES: /usr/bin/killall
|
37
|
pfSense_MODULE: system
|
38
|
*/
|
39
|
|
40
|
##|+PRIV
|
41
|
##|*IDENT=page-system-advanced-admin
|
42
|
##|*NAME=System: Advanced: Admin Access Page
|
43
|
##|*DESCR=Allow access to the 'System: Advanced: Admin Access' page.
|
44
|
##|*MATCH=system_advanced_admin.php*
|
45
|
##|-PRIV
|
46
|
|
47
|
require("guiconfig.inc");
|
48
|
require_once("functions.inc");
|
49
|
require_once("filter.inc");
|
50
|
require_once("shaper.inc");
|
51
|
|
52
|
$pconfig['webguiproto'] = $config['system']['webgui']['protocol'];
|
53
|
$pconfig['webguiport'] = $config['system']['webgui']['port'];
|
54
|
$pconfig['max_procs'] = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 2;
|
55
|
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
|
56
|
$pconfig['disablehttpredirect'] = isset($config['system']['webgui']['disablehttpredirect']);
|
57
|
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
|
58
|
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
|
59
|
$pconfig['nodnsrebindcheck'] = isset($config['system']['webgui']['nodnsrebindcheck']);
|
60
|
$pconfig['nohttpreferercheck'] = isset($config['system']['webgui']['nohttpreferercheck']);
|
61
|
$pconfig['beast_protection'] = isset($config['system']['webgui']['beast_protection']);
|
62
|
$pconfig['pagenamefirst'] = isset($config['system']['webgui']['pagenamefirst']);
|
63
|
$pconfig['loginautocomplete'] = isset($config['system']['webgui']['loginautocomplete']);
|
64
|
$pconfig['althostnames'] = $config['system']['webgui']['althostnames'];
|
65
|
$pconfig['enableserial'] = $config['system']['enableserial'];
|
66
|
$pconfig['serialspeed'] = $config['system']['serialspeed'];
|
67
|
$pconfig['primaryconsole'] = $config['system']['primaryconsole'];
|
68
|
$pconfig['enablesshd'] = $config['system']['enablesshd'];
|
69
|
$pconfig['sshport'] = $config['system']['ssh']['port'];
|
70
|
$pconfig['sshdkeyonly'] = isset($config['system']['ssh']['sshdkeyonly']);
|
71
|
$pconfig['quietlogin'] = isset($config['system']['webgui']['quietlogin']);
|
72
|
|
73
|
$a_cert =& $config['cert'];
|
74
|
|
75
|
$certs_available = false;
|
76
|
if (is_array($a_cert) && count($a_cert))
|
77
|
$certs_available = true;
|
78
|
|
79
|
if (!$pconfig['webguiproto'] || !$certs_available)
|
80
|
$pconfig['webguiproto'] = "http";
|
81
|
|
82
|
if ($_POST) {
|
83
|
|
84
|
unset($input_errors);
|
85
|
$pconfig = $_POST;
|
86
|
|
87
|
/* input validation */
|
88
|
if ($_POST['tcp-port'])
|
89
|
if(!is_port($_POST['tcp-port']))
|
90
|
$input_errors[] = gettext("You must specify a valid webConfigurator port number");
|
91
|
|
92
|
if ($_POST['max_procs'])
|
93
|
if(!is_numericint($_POST['max_procs']) || ($_POST['max_procs'] < 1) || ($_POST['max_procs'] > 500))
|
94
|
$input_errors[] = gettext("Max Processes must be a number 1 or greater");
|
95
|
|
96
|
if ($_POST['alternate-hostnames']) {
|
97
|
$althosts = explode(" ", $_POST['alternate-hostnames']);
|
98
|
foreach ($althosts as $ah)
|
99
|
if (!is_hostname($ah))
|
100
|
$input_errors[] = sprintf(gettext("Alternate hostname %s is not a valid hostname."),htmlspecialchars($ah));
|
101
|
}
|
102
|
|
103
|
if ($_POST['ssh-port'])
|
104
|
if(!is_port($_POST['ssh-port']))
|
105
|
$input_errors[] = gettext("You must specify a valid port number");
|
106
|
|
107
|
if($_POST['authentication-method'] == "yes")
|
108
|
$config['system']['ssh']['sshdkeyonly'] = "enabled";
|
109
|
else if (isset($config['system']['ssh']['sshdkeyonly']))
|
110
|
unset($config['system']['ssh']['sshdkeyonly']);
|
111
|
|
112
|
ob_flush();
|
113
|
flush();
|
114
|
|
115
|
if (!$input_errors) {
|
116
|
|
117
|
if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['protocol']))
|
118
|
$restart_webgui = true;
|
119
|
if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['tcp-port']))
|
120
|
$restart_webgui = true;
|
121
|
if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certificate']))
|
122
|
$restart_webgui = true;
|
123
|
if (update_if_changed("webgui max processes", $config['system']['webgui']['max_procs'], $_POST['max_procs']))
|
124
|
$restart_webgui = true;
|
125
|
|
126
|
if ($_POST['webgui-redirect'] == "yes") {
|
127
|
$config['system']['webgui']['disablehttpredirect'] = true;
|
128
|
$restart_webgui = true;
|
129
|
} else {
|
130
|
unset($config['system']['webgui']['disablehttpredirect']);
|
131
|
$restart_webgui = true;
|
132
|
}
|
133
|
if ($_POST['webgui-login-messages'] == "yes") {
|
134
|
$config['system']['webgui']['quietlogin'] = true;
|
135
|
} else {
|
136
|
unset($config['system']['webgui']['quietlogin']);
|
137
|
}
|
138
|
|
139
|
if($_POST['console-menu'] == "yes")
|
140
|
$config['system']['disableconsolemenu'] = true;
|
141
|
else
|
142
|
unset($config['system']['disableconsolemenu']);
|
143
|
|
144
|
if ($_POST['anti-lockout'] == "yes")
|
145
|
$config['system']['webgui']['noantilockout'] = true;
|
146
|
else
|
147
|
unset($config['system']['webgui']['noantilockout']);
|
148
|
|
149
|
if ($_POST['serial-terminal'] == "yes" || $g['enableserial_force'])
|
150
|
$config['system']['enableserial'] = true;
|
151
|
else
|
152
|
unset($config['system']['enableserial']);
|
153
|
|
154
|
if (is_numericint($_POST['serial-speed']))
|
155
|
$config['system']['serialspeed'] = $_POST['serial-speed'];
|
156
|
else
|
157
|
unset($config['system']['serialspeed']);
|
158
|
|
159
|
if ($_POST['primary-console'])
|
160
|
$config['system']['primaryconsole'] = $_POST['primary-console'];
|
161
|
else
|
162
|
unset($config['system']['primaryconsole']);
|
163
|
|
164
|
if ($_POST['dns-rebind-check'] == "yes")
|
165
|
$config['system']['webgui']['nodnsrebindcheck'] = true;
|
166
|
else
|
167
|
unset($config['system']['webgui']['nodnsrebindcheck']);
|
168
|
|
169
|
if ($_POST['browser-http_referer-enforcement'] == "yes")
|
170
|
$config['system']['webgui']['nohttpreferercheck'] = true;
|
171
|
else
|
172
|
unset($config['system']['webgui']['nohttpreferercheck']);
|
173
|
|
174
|
if ($_POST['beast-attack-protection'] == "yes")
|
175
|
$config['system']['webgui']['beast_protection'] = true;
|
176
|
else
|
177
|
unset($config['system']['webgui']['beast_protection']);
|
178
|
|
179
|
if ($_POST['browser-tab-text'] == "yes")
|
180
|
$config['system']['webgui']['pagenamefirst'] = true;
|
181
|
else
|
182
|
unset($config['system']['webgui']['pagenamefirst']);
|
183
|
|
184
|
if ($_POST['webgui-login-autocomplete'] == "yes")
|
185
|
$config['system']['webgui']['loginautocomplete'] = true;
|
186
|
else
|
187
|
unset($config['system']['webgui']['loginautocomplete']);
|
188
|
|
189
|
if ($_POST['alternate-hostnames'])
|
190
|
$config['system']['webgui']['althostnames'] = $_POST['alternate-hostnames'];
|
191
|
else
|
192
|
unset($config['system']['webgui']['althostnames']);
|
193
|
|
194
|
$sshd_enabled = $config['system']['enablesshd'];
|
195
|
if($_POST['secure-shell-server'])
|
196
|
$config['system']['enablesshd'] = "enabled";
|
197
|
else
|
198
|
unset($config['system']['enablesshd']);
|
199
|
|
200
|
$sshd_keyonly = isset($config['system']['sshdkeyonly']);
|
201
|
if ($_POST['authentication-method'])
|
202
|
$config['system']['sshdkeyonly'] = true;
|
203
|
else
|
204
|
unset($config['system']['sshdkeyonly']);
|
205
|
|
206
|
$sshd_port = $config['system']['ssh']['port'];
|
207
|
if ($_POST['ssh-port'])
|
208
|
$config['system']['ssh']['port'] = $_POST['ssh-port'];
|
209
|
else if (isset($config['system']['ssh']['port']))
|
210
|
unset($config['system']['ssh']['port']);
|
211
|
|
212
|
if (($sshd_enabled != $config['system']['enablesshd']) ||
|
213
|
($sshd_keyonly != $config['system']['sshdkeyonly']) ||
|
214
|
($sshd_port != $config['system']['ssh']['port']))
|
215
|
$restart_sshd = true;
|
216
|
|
217
|
if ($restart_webgui) {
|
218
|
global $_SERVER;
|
219
|
$http_host_port = explode("]", $_SERVER['HTTP_HOST']);
|
220
|
/* IPv6 address check */
|
221
|
if(strstr($_SERVER['HTTP_HOST'], "]")) {
|
222
|
if(count($http_host_port) > 1) {
|
223
|
array_pop($http_host_port);
|
224
|
$host = str_replace(array("[", "]"), "", implode(":", $http_host_port));
|
225
|
$host = "[{$host}]";
|
226
|
} else {
|
227
|
$host = str_replace(array("[", "]"), "", implode(":", $http_host_port));
|
228
|
$host = "[{$host}]";
|
229
|
}
|
230
|
} else {
|
231
|
list($host) = explode(":", $_SERVER['HTTP_HOST']);
|
232
|
}
|
233
|
$prot = $config['system']['webgui']['protocol'];
|
234
|
$port = $config['system']['webgui']['port'];
|
235
|
if ($port)
|
236
|
$url = "{$prot}://{$host}:{$port}/system_advanced_admin.php";
|
237
|
else
|
238
|
$url = "{$prot}://{$host}/system_advanced_admin.php";
|
239
|
}
|
240
|
|
241
|
write_config();
|
242
|
|
243
|
$retval = filter_configure();
|
244
|
$savemsg = get_std_save_message($retval);
|
245
|
|
246
|
if ($restart_webgui)
|
247
|
$savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."),$url);
|
248
|
|
249
|
conf_mount_rw();
|
250
|
setup_serial_port();
|
251
|
// Restart DNS in case dns rebinding toggled
|
252
|
if (isset($config['dnsmasq']['enable']))
|
253
|
services_dnsmasq_configure();
|
254
|
elseif (isset($config['unbound']['enable']))
|
255
|
services_unbound_configure();
|
256
|
conf_mount_ro();
|
257
|
}
|
258
|
}
|
259
|
|
260
|
unset($hwcrypto);
|
261
|
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
|
262
|
if ($fd) {
|
263
|
while (!feof($fd)) {
|
264
|
$dmesgl = fgets($fd);
|
265
|
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
|
266
|
unset($pconfig['beast_protection']);
|
267
|
$disable_beast_option = true;
|
268
|
$hwcrypto = $matches[1];
|
269
|
break;
|
270
|
}
|
271
|
}
|
272
|
fclose($fd);
|
273
|
}
|
274
|
|
275
|
$pgtitle = array(gettext("System"),gettext("Advanced: Admin Access"));
|
276
|
include("head.inc");
|
277
|
|
278
|
if ($input_errors)
|
279
|
print_input_errors($input_errors);
|
280
|
if ($savemsg)
|
281
|
print_info_box($savemsg);
|
282
|
|
283
|
$tab_array = array();
|
284
|
$tab_array[] = array(gettext("Admin Access"), true, "system_advanced_admin.php");
|
285
|
$tab_array[] = array(gettext("Firewall / NAT"), false, "system_advanced_firewall.php");
|
286
|
$tab_array[] = array(gettext("Networking"), false, "system_advanced_network.php");
|
287
|
$tab_array[] = array(gettext("Miscellaneous"), false, "system_advanced_misc.php");
|
288
|
$tab_array[] = array(gettext("System Tunables"), false, "system_advanced_sysctl.php");
|
289
|
$tab_array[] = array(gettext("Notifications"), false, "system_advanced_notifications.php");
|
290
|
display_top_tabs($tab_array);
|
291
|
|
292
|
?><div id="container"><?php
|
293
|
|
294
|
require('classes/Form.class.php');
|
295
|
$form = new Form;
|
296
|
$section = new Form_Section('WebConfigurator');
|
297
|
$group = new Form_Group('Protocol');
|
298
|
|
299
|
$group->add(new Form_Checkbox(
|
300
|
'Protocol',
|
301
|
'HTTP',
|
302
|
($pconfig['webguiproto']=='http'),
|
303
|
'http'
|
304
|
))->displayAsRadio()->setAttribute('data-toggle', 'disable')->setAttribute('data-target', '#ssl-certificate');
|
305
|
|
306
|
$group->add($input = new Form_Checkbox(
|
307
|
'Protocol',
|
308
|
'HTTPS',
|
309
|
($pconfig['webguiproto']=='https'),
|
310
|
'https'
|
311
|
))->displayAsRadio()->setAttribute('data-toggle', 'disable')->setAttribute('data-target', '#ssl-certificate');
|
312
|
|
313
|
$section->add($group);
|
314
|
|
315
|
if (!$certs_available)
|
316
|
{
|
317
|
$input->setAttribute('disabled', 'disabled');
|
318
|
$input->setHelp('No Certificates have been defined. You must '.
|
319
|
'<a href="system_certmanager.php">'. gettext("Create or Import").'</a> '.
|
320
|
'a Certificate before SSL can be enabled.');
|
321
|
} else {
|
322
|
$values = array();
|
323
|
foreach($a_cert as $cert)
|
324
|
$values[ $cert['refid'] ] = $cert['descr'];
|
325
|
|
326
|
$section->addInput($input = new Form_Select(
|
327
|
'SSL Certificate',
|
328
|
$pconfig['ssl-certref'],
|
329
|
$values
|
330
|
));
|
331
|
|
332
|
if ($pconfig['webguiproto'] == 'http')
|
333
|
$input->setAttribute('disabled');
|
334
|
}
|
335
|
|
336
|
$section->addInput(new Form_Input(
|
337
|
'TCP port',
|
338
|
'number',
|
339
|
$config['system']['webgui']['port'],
|
340
|
['min' => 1, 'max' => 65535]
|
341
|
))->setHelp('Enter a custom port number for the webConfigurator '.
|
342
|
'above if you want to override the default (80 for HTTP, 443 '.
|
343
|
'for HTTPS). Changes will take effect immediately after save.');
|
344
|
|
345
|
$section->addInput(new Form_Input(
|
346
|
'Max Processes',
|
347
|
'number',
|
348
|
$pconfig['max_procs']
|
349
|
))->setHelp('Enter the number of webConfigurator processes you '.
|
350
|
'want to run. This defaults to 2. Increasing this will allow more '.
|
351
|
'users/browsers to access the GUI concurrently.');
|
352
|
|
353
|
$section->addInput(new Form_Checkbox(
|
354
|
'WebGUI redirect',
|
355
|
'Disable webConfigurator redirect rule',
|
356
|
$pconfig['disablehttpredirect']
|
357
|
))->setHelp('When this is unchecked, access to the webConfigurator '.
|
358
|
'is always permitted even on port 80, regardless of the listening port configured. '.
|
359
|
'Check this box to disable this automatically added redirect rule.');
|
360
|
|
361
|
$section->addInput(new Form_Checkbox(
|
362
|
'WebGUI Login Autocomplete',
|
363
|
'Enable webConfigurator login autocomplete',
|
364
|
$pconfig['loginautocomplete']
|
365
|
))->setHelp('When this is checked, login credentials for the webConfigurator may '.
|
366
|
'be saved by the browser. While convenient, some security standards require this '.
|
367
|
'to be disabled. Check this box to enable autocomplete on the login form so that '.
|
368
|
'browsers will prompt to save credentials (NOTE: Some browsers do not respect '.
|
369
|
'this option).');
|
370
|
|
371
|
$section->addInput(new Form_Checkbox(
|
372
|
'WebGUI login messages',
|
373
|
'Disable logging of webConfigurator successful logins',
|
374
|
$pconfig['quietlogin']
|
375
|
))->setHelp('When this is checked, successful logins to the webConfigurator will '.
|
376
|
'not be logged.');
|
377
|
|
378
|
if ($config['interfaces']['lan'])
|
379
|
$lockout_interface = "LAN";
|
380
|
else
|
381
|
$lockout_interface = "WAN";
|
382
|
|
383
|
$section->addInput(new Form_Checkbox(
|
384
|
'Anti-lockout',
|
385
|
'Disable webConfigurator anti-lockout rule',
|
386
|
$pconfig['noantilockout']
|
387
|
))->setHelp('When this is '.
|
388
|
'unchecked, access to the webConfigurator on the %s interface is always '.
|
389
|
'permitted, regardless of the user-defined firewall rule set. Check this box to '.
|
390
|
'disable this automatically added rule, so access to the webConfigurator is '.
|
391
|
'controlled by the user-defined firewall rules (ensure you have a firewall rule '.
|
392
|
'in place that allows you in, or you will lock yourself out!)<em>Hint: the "Set interface(s) IP address" '.
|
393
|
'option in the console menu resets this setting as well.</em>', [$lockout_interface]);
|
394
|
|
395
|
$section->addInput(new Form_Checkbox(
|
396
|
'DNS Rebind Check',
|
397
|
'Disable DNS Rebinding Checks',
|
398
|
$pconfig['nodnsrebindcheck']
|
399
|
))->setHelp('When this is unchecked, your system is protected against<a '.
|
400
|
'href=\"http://en.wikipedia.org/wiki/DNS_rebinding\">DNS Rebinding attacks</a>. '.
|
401
|
'This blocks private IP responses from your configured DNS servers. Check this '.
|
402
|
'box to disable this protection if it interferes with webConfigurator access or '.
|
403
|
'name resolution in your environment.');
|
404
|
|
405
|
$section->addInput(new Form_Input(
|
406
|
'Alternate Hostnames',
|
407
|
'text',
|
408
|
htmlspecialchars($pconfig['althostnames'])
|
409
|
))->setHelp('Alternate Hostnames for DNS Rebinding and HTTP_REFERER Checks. Here '.
|
410
|
'you can specify alternate hostnames by which the router may be queried, to '.
|
411
|
'bypass the DNS Rebinding Attack checks. Separate hostnames with spaces.');
|
412
|
|
413
|
$section->addInput(new Form_Checkbox(
|
414
|
'Browser HTTP_REFERER enforcement',
|
415
|
'Disable HTTP_REFERER enforcement check',
|
416
|
$pconfig['nohttpreferercheck']
|
417
|
))->setHelp('When this is unchecked, access to the webConfigurator is protected '.
|
418
|
'against HTTP_REFERER redirection attempts. Check this box to disable this '.
|
419
|
'protection if you find that it interferes with webConfigurator access in certain '.
|
420
|
'corner cases such as using external scripts to interact with this system. More '.
|
421
|
'information on HTTP_REFERER is available from<a target="_blank" '.
|
422
|
'href="http://en.wikipedia.org/wiki/HTTP_referrer">Wikipedia</a>.');
|
423
|
|
424
|
$section->addInput($input = new Form_Checkbox(
|
425
|
'BEAST Attack Protection',
|
426
|
'Mitigate the BEAST SSL Attack',
|
427
|
$pconfig['beast_protection']
|
428
|
))->setHelp('When this is checked, the webConfigurator can mitigate BEAST SSL '.
|
429
|
'attacks. This option is off by default because Hifn accelerators do NOT work '.
|
430
|
'with this option, and the GUI will not function. It is possible that other '.
|
431
|
'accelerators have a similar problem that is not yet known/documented. More '.
|
432
|
'information on BEAST is available from <a target="_blank" '.
|
433
|
'href="https://en.wikipedia.org/wiki/Transport_Layer_Security#BEAST_attack">Wikipedia</a>.');
|
434
|
|
435
|
if ($disable_beast_option)
|
436
|
{
|
437
|
$input->setAttribute('disabled', 'disabled');
|
438
|
$input->setHelp('This option has been automatically disabled because a conflicting '.
|
439
|
'cryptographic accelerator card has been detected (%s).', [$hwcrypto]);
|
440
|
}
|
441
|
|
442
|
$section->addInput(new Form_Checkbox(
|
443
|
'Browser tab text',
|
444
|
'Display page name first in browser tab',
|
445
|
$pconfig['pagenamefirst']
|
446
|
))->setHelp('When this is unchecked, the browser tab shows the host name followed '.
|
447
|
'by the current page. Check this box to display the current page followed by the '.
|
448
|
'host name.');
|
449
|
|
450
|
$form->add($section);
|
451
|
$section = new Form_Section('Secure Shell');
|
452
|
|
453
|
$section->addInput(new Form_Checkbox(
|
454
|
'Secure Shell Server',
|
455
|
'Enable Secure Shell',
|
456
|
isset($pconfig['enablesshd'])
|
457
|
));
|
458
|
|
459
|
$section->addInput(new Form_Checkbox(
|
460
|
'Authentication Method',
|
461
|
'Disable password login for Secure Shell (RSA/DSA key only)',
|
462
|
$pconfig['sshdkeyonly']
|
463
|
))->setHelp('When enabled, authorized keys need to be configured for each<a '.
|
464
|
'href="system_usermanager.php">user</a>that has been granted secure shell '.
|
465
|
'access.');
|
466
|
|
467
|
$section->addInput(new Form_Input(
|
468
|
'SSH port',
|
469
|
'number',
|
470
|
$pconfig['sshport'],
|
471
|
['min' => 1, 'max' => 65535, 'placeholder' => 22]
|
472
|
))->setHelp('Note: Leave this blank for the default of 22.');
|
473
|
|
474
|
|
475
|
if (!$g['enableserial_force'] && ($g['platform'] == "pfSense" || $g['platform'] == "cdrom" || file_exists("/etc/nano_use_vga.txt")))
|
476
|
{
|
477
|
$form->add($section);
|
478
|
$section = new Form_Section('Serial Communications');
|
479
|
|
480
|
$section->addInput(new Form_Checkbox(
|
481
|
'Serial Terminal',
|
482
|
'Enables the first serial port with 115200/8/N/1 by default, or another speed selectable below.',
|
483
|
isset($pconfig['enableserial'])
|
484
|
))->setHelp('Note: This will redirect the console output and messages to '.
|
485
|
'the serial port. You can still access the console menu from the internal video '.
|
486
|
'card/keyboard. A<b>null modem</b>serial cable or adapter is required to use the '.
|
487
|
'serial console.');
|
488
|
|
489
|
$section->addInput(new Form_Select(
|
490
|
'Serial Speed',
|
491
|
$pconfig['serialspeed'],
|
492
|
array(115200, 57600, 38400, 19200, 14400, 9600)
|
493
|
))->setHelp('Allows selection of different speeds for the serial console port.');
|
494
|
|
495
|
$section->addInput(new Form_Select(
|
496
|
'Primary Console',
|
497
|
$pconfig['primaryconsole'],
|
498
|
array(
|
499
|
'serial' => 'Serial Console',
|
500
|
'video' => 'VGA Console',
|
501
|
)
|
502
|
))->setHelp('Select the preferred console if multiple consoles are present. '.
|
503
|
'The preferred console will show pfSense boot script output. All consoles '.
|
504
|
'display OS boot messages, console messages, and the console menu.');
|
505
|
}
|
506
|
|
507
|
$form->add($section);
|
508
|
$section = new Form_Section('Console Options');
|
509
|
|
510
|
$section->addInput(new Form_Checkbox(
|
511
|
'Console menu',
|
512
|
'Password protect the console menu',
|
513
|
$pconfig['disableconsolemenu']
|
514
|
));
|
515
|
|
516
|
$form->add($section);
|
517
|
print $form;
|
518
|
|
519
|
include("foot.inc");
|
520
|
|
521
|
if ($restart_webgui)
|
522
|
echo "<meta http-equiv=\"refresh\" content=\"20;url={$url}\" />";
|
523
|
|
524
|
if ($restart_sshd)
|
525
|
{
|
526
|
killbyname("sshd");
|
527
|
log_error(gettext("secure shell configuration has changed. Stopping sshd."));
|
528
|
|
529
|
if ($config['system']['enablesshd']) {
|
530
|
log_error(gettext("secure shell configuration has changed. Restarting sshd."));
|
531
|
send_event("service restart sshd");
|
532
|
}
|
533
|
}
|
534
|
|
535
|
if ($restart_webgui)
|
536
|
{
|
537
|
ob_flush();
|
538
|
flush();
|
539
|
log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
|
540
|
send_event("service restart webgui");
|
541
|
}
|