diff options
author | Christian Breunig <christian@breunig.cc> | 2023-06-21 23:17:14 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-06-21 23:17:14 +0200 |
commit | 2128dc0ddf6b921f440067d7b862f30d9fad0cb2 (patch) | |
tree | 543ec7ce6f169abcf0df290bf20d7f25c0245acb /src/conf_mode | |
parent | 3f197566f957cb0e354a474bccee0aefd62b33be (diff) | |
download | vyos-1x-2128dc0ddf6b921f440067d7b862f30d9fad0cb2.tar.gz vyos-1x-2128dc0ddf6b921f440067d7b862f30d9fad0cb2.zip |
tacacs: T141: support calling system-login.py from vyos-router startup script
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/system-login.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index fbb013cf3..aefab8401 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -107,9 +107,13 @@ def get_config(config=None): def verify(login): if 'rm_users' in login: - cur_user = os.environ['SUDO_USER'] - if cur_user in login['rm_users']: - raise ConfigError(f'Attempting to delete current user: {cur_user}') + # This check is required as the script is also executed from vyos-router + # init script and there is no SUDO_USER environment variable available + # during system boot. + if 'SUDO_USER' in os.environ: + cur_user = os.environ['SUDO_USER'] + if cur_user in login['rm_users']: + raise ConfigError(f'Attempting to delete current user: {cur_user}') if 'user' in login: system_users = getpwall() |