Create an option for saving connected users across reboot

Implement redmine #5644
This commit is contained in:
Augustin-FL 2019-01-12 03:21:59 +01:00
parent 1d8a8f66e8
commit 445c97fcf3
No known key found for this signature in database
GPG Key ID: 07C2BC8C948B0D9A
2 changed files with 17 additions and 4 deletions

View File

@ -2105,15 +2105,18 @@ function system_reboot_sync($reroot=false) {
}
function system_reboot_cleanup() {
global $config, $cpzone, $cpzoneid;
global $config, $g, $cpzone;
mwexec("/usr/local/bin/beep.sh stop");
require_once("captiveportal.inc");
if (is_array($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpzone=>$cp) {
/* send Accounting-Stop packet for all clients, termination cause 'Admin-Reboot' */
$cpzoneid = $cp['zoneid'];
captiveportal_radius_stop_all(7); // Admin-Reboot
if (!isset($cp['preservedb'])) {
/* send Accounting-Stop packet for all clients, termination cause 'Admin-Reboot' */
captiveportal_radius_stop_all(7); // Admin-Reboot
unlink_if_exists("{$g['vardb_path']}/captiveportal{$cpzone}.db");
captiveportal_free_dnrules();
}
/* Send Accounting-Off packet to the RADIUS server */
captiveportal_send_server_accounting('off');
}

View File

@ -151,6 +151,7 @@ if ($a_cp[$cpzone]) {
$pconfig['radmac_secret'] = $a_cp[$cpzone]['radmac_secret'];
$pconfig['radmac_fallback'] = isset($a_cp[$cpzone]['radmac_fallback']);
$pconfig['reauthenticate'] = isset($a_cp[$cpzone]['reauthenticate']);
$pconfig['preservedb'] = isset($a_cp[$cpzone]['preservedb']);
$pconfig['reauthenticateacct'] = $a_cp[$cpzone]['reauthenticateacct'];
$pconfig['httpslogin_enable'] = isset($a_cp[$cpzone]['httpslogin']);
$pconfig['httpsname'] = $a_cp[$cpzone]['httpsname'];
@ -353,6 +354,7 @@ if ($_POST['save']) {
$newcp['localauth_priv'] = isset($_POST['localauth_priv']);
$newcp['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
$newcp['reauthenticate'] = $_POST['reauthenticate'] ? true : false;
$newcp['preservedb'] = $_POST['preservedb'] ? true : false;
$newcp['radmac_secret'] = $_POST['radmac_secret'] ? $_POST['radmac_secret'] : false;
$newcp['radmac_fallback'] = $_POST['radmac_fallback'] ? true : false;
$newcp['reauthenticateacct'] = $_POST['reauthenticateacct'];
@ -633,6 +635,13 @@ $section->addInput(new Form_Input(
$pconfig['blockedmacsurl']
))->setHelp('Blocked MAC addresses will be redirected to this URL when attempting access.');
$section->addInput(new Form_Checkbox(
'preservedb',
'Preserve users database',
'Preserve connected users across reboot',
$pconfig['preservedb']
))->setHelp("If enabled, connected users won't be disconnected during a pfSense reboot.");
$section->addInput(new Form_Checkbox(
'noconcurrentlogins',
'Concurrent user logins',
@ -1178,6 +1187,7 @@ events.push(function() {
hideInput('preauthurl', hide);
hideInput('redirurl', hide);
hideInput('blockedmacsurl', hide);
hideCheckbox('preservedb', hide);
hideCheckbox('noconcurrentlogins', hide);
hideCheckbox('nomacfilter', hide);
hideCheckbox('passthrumacadd', hide);