mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
Shell inactivity timeout (for [t]csh). closes https://github.com/opnsense/core/issues/4936
This commit is contained in:
parent
08dcb63b0d
commit
2eebd08278
@ -3,3 +3,4 @@ motd:/etc/motd
|
||||
sshd.pam:/etc/pam.d/sshd
|
||||
sudoers:/usr/local/etc/sudoers.d/opnsense
|
||||
system.pam:/etc/pam.d/system
|
||||
csh.cshrc:/etc/csh.cshrc
|
||||
|
||||
6
src/opnsense/service/templates/OPNsense/Auth/csh.cshrc
Normal file
6
src/opnsense/service/templates/OPNsense/Auth/csh.cshrc
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
# System-wide .cshrc file for csh(1).
|
||||
{% if not helpers.empty('system.autologout')%}
|
||||
set -r autologout={{system.autologout}}
|
||||
{% endif %}
|
||||
@ -64,6 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig['serialusb'] = isset($config['system']['serialusb']);
|
||||
$pconfig['primaryconsole'] = $config['system']['primaryconsole'];
|
||||
$pconfig['secondaryconsole'] = $config['system']['secondaryconsole'];
|
||||
$pconfig['autologout'] = $config['system']['autologout'];
|
||||
$pconfig['enablesshd'] = $config['system']['ssh']['enabled'];
|
||||
$pconfig['sshport'] = $config['system']['ssh']['port'];
|
||||
$pconfig['sshinterfaces'] = !empty($config['system']['ssh']['interfaces']) ? explode(',', $config['system']['ssh']['interfaces']) : array();
|
||||
@ -106,6 +107,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$input_errors[] = gettext('Session timeout must be an integer value.');
|
||||
}
|
||||
|
||||
if (!empty($pconfig['autologout']) && (!is_numeric($pconfig['autologout']) || $pconfig['autologout'] <= 0)) {
|
||||
$input_errors[] = gettext('Inactivity timeout must be an integer value.');
|
||||
}
|
||||
|
||||
if (!empty($pconfig['authmode'])) {
|
||||
foreach ($pconfig['authmode'] as $auth_mode) {
|
||||
if (!isset($a_authmode[$auth_mode])) {
|
||||
@ -236,6 +241,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
unset($config['system']['webgui']['authmode']);
|
||||
}
|
||||
|
||||
if (!empty($pconfig['autologout'])) {
|
||||
$config['system']['autologout'] = $pconfig['autologout'];
|
||||
} elseif (isset($config['system']['autologout'])) {
|
||||
unset($config['system']['autologout']);
|
||||
}
|
||||
|
||||
/* always store setting to prevent installer auto-start */
|
||||
$config['system']['ssh']['noauto'] = 1;
|
||||
|
||||
@ -873,6 +884,25 @@ $(document).ready(function() {
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="content-box tab-content table-responsive __mb">
|
||||
<table class="table table-striped opnsense_standard_table_form">
|
||||
<tr>
|
||||
<td style="width:22%"><strong><?= gettext('Shell') ?></strong></td>
|
||||
<td style="width:78%"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_autologout" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Inactivity timeout') ?></td>
|
||||
<td>
|
||||
<input name="autologout" type="text" value="<?= $pconfig['autologout'];?>"/>
|
||||
<small><?=gettext("Minutes"); ?></small>
|
||||
<div class="hidden" data-for="help_for_autologout">
|
||||
<?= gettext('When set, defines the number of minutes an ssh or console session might idle before being logged out automatically, only available on [t]csh type shells. '.
|
||||
'Does not affect currently active shells.') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="content-box tab-content table-responsive __mb">
|
||||
<table class="table table-striped opnsense_standard_table_form">
|
||||
<tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user