summaryrefslogtreecommitdiff
path: root/src/conf_mode/system-login.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-09-27 11:32:42 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-09-28 13:21:18 +0000
commitee2dc735e02930ac46c6ccc96dc5486ab96179e5 (patch)
tree129263100c11e8cd35b87c403311203329887cd0 /src/conf_mode/system-login.py
parent5fe0e9c163ee2f8229e298fc20dbfe6746c2cdcc (diff)
downloadvyos-1x-ee2dc735e02930ac46c6ccc96dc5486ab96179e5.tar.gz
vyos-1x-ee2dc735e02930ac46c6ccc96dc5486ab96179e5.zip
login: T4715: Auto logout user after inactivity
Ability to terminate interactive sessions (TTY/PTS) after a period of inactivity. set system login timeout '300'
Diffstat (limited to 'src/conf_mode/system-login.py')
-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