diff options
author | Christian Breunig <christian@breunig.cc> | 2023-10-03 09:26:33 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-10-03 09:33:16 +0200 |
commit | 64d323299586da646ca847e78255ff2cd8464578 (patch) | |
tree | c0209646ada43b42a321c994daeef1a4f1a7fd5b /src | |
parent | baa12ccf0f6eb092099a9e17444e9efd86a59fcc (diff) | |
download | vyos-1x-64d323299586da646ca847e78255ff2cd8464578.tar.gz vyos-1x-64d323299586da646ca847e78255ff2cd8464578.zip |
login: T5521: home directory owner changed during reboot
During system startup the system-login.py script is invoked by vyos-router
systemd service. As there is no complete configuration available at this
point in time - and the sole purpose of this call is to reset/re-render
the system NSS/PAM configs back to default - it accidently also deleted the
local useraccounts.
Once the VyOS configuration got mounted, users got recreated in alphabetical
order and thus UIDs flipped and the /home suddenely belonged to a different
account.
This commit prevents any mangling with the local userdatabase during VyOS
bootup phase.
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/system-login.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index 87a269499..2cf50cb92 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -28,6 +28,7 @@ from vyos.configverify import verify_vrf from vyos.defaults import directories from vyos.template import render from vyos.template import is_ipv4 +from vyos.utils.boot import boot_configuration_complete from vyos.utils.dict import dict_search from vyos.utils.process import cmd from vyos.utils.process import call @@ -281,8 +282,6 @@ def generate(login): if os.path.isfile(tacacs_nss_config_file): os.unlink(tacacs_nss_config_file) - - # NSS must always be present on the system render(nss_config_file, 'login/nsswitch.conf.j2', login, permission=0o644, user='root', group='root') @@ -306,6 +305,12 @@ def generate(login): def apply(login): + # Script is invoked from vyos-router.service during startup. + # While configuration mounting and so on is not yet complete, + # skip any code that messes with the local user database + if not boot_configuration_complete(): + return None + if 'user' in login: for user, user_config in login['user'].items(): # make new user using vyatta shell and make home directory (-m), |