summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-09-28 19:42:50 +0200
committerGitHub <noreply@github.com>2022-09-28 19:42:50 +0200
commit0af970a6d98485812fab887d91d4317fa5c0e417 (patch)
treef7583433fa6276e914cf8ae26b4d84d0f6cc8991 /src
parentd5e84fab2e66fb4452516e3a5adc00c6ed772de1 (diff)
parentee2dc735e02930ac46c6ccc96dc5486ab96179e5 (diff)
downloadvyos-1x-0af970a6d98485812fab887d91d4317fa5c0e417.tar.gz
vyos-1x-0af970a6d98485812fab887d91d4317fa5c0e417.zip
Merge pull request #1561 from sever-sever/T4715
login: T4715: Auto logout user after inactivity
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system-login.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py
index 3dcbc995c..dbd346fe4 100755
--- a/src/conf_mode/system-login.py
+++ b/src/conf_mode/system-login.py
@@ -40,6 +40,7 @@ from vyos import ConfigError
from vyos import airbag
airbag.enable()
+autologout_file = "/etc/profile.d/autologout.sh"
radius_config_file = "/etc/pam_radius_auth.conf"
def get_local_users():
@@ -203,6 +204,13 @@ def generate(login):
if os.path.isfile(radius_config_file):
os.unlink(radius_config_file)
+ if 'timeout' in login:
+ render(autologout_file, 'login/autologout.j2', login,
+ permission=0o755, user='root', group='root')
+ else:
+ if os.path.isfile(autologout_file):
+ os.unlink(autologout_file)
+
return None