diff options
author | Christian Breunig <christian@breunig.cc> | 2024-06-24 19:34:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 19:34:05 +0200 |
commit | 0259c4337c80264d5818193a7023e5bd652b36af (patch) | |
tree | 7e8a8f89e20d89a67556a6140f24b474b3ad19ee /src/services/vyos-configd | |
parent | 340e44c59663d2b94e7b1fddb05c49a3ad737938 (diff) | |
parent | 99c81fbe8fa0d6dd257c00a8e7fe1c5e1a15ca72 (diff) | |
download | vyos-1x-0259c4337c80264d5818193a7023e5bd652b36af.tar.gz vyos-1x-0259c4337c80264d5818193a7023e5bd652b36af.zip |
Merge pull request #3719 from vyos/mergify/bp/circinus/pr-3701
configd: T6504: send sudo_user on session init and set env variable (backport #3701)
Diffstat (limited to 'src/services/vyos-configd')
-rwxr-xr-x | src/services/vyos-configd | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/services/vyos-configd b/src/services/vyos-configd index c89c486e5..d92b539c8 100755 --- a/src/services/vyos-configd +++ b/src/services/vyos-configd @@ -179,8 +179,13 @@ def initialization(socket): pid_string = socket.recv().decode("utf-8", "ignore") resp = "pid" socket.send(resp.encode()) + sudo_user_string = socket.recv().decode("utf-8", "ignore") + resp = "sudo_user" + socket.send(resp.encode()) logger.debug(f"config session pid is {pid_string}") + logger.debug(f"config session sudo_user is {sudo_user_string}") + try: session_out = os.readlink(f"/proc/{pid_string}/fd/1") session_mode = 'w' @@ -192,6 +197,8 @@ def initialization(socket): session_out = script_stdout_log session_mode = 'a' + os.environ['SUDO_USER'] = sudo_user_string + try: configsource = ConfigSourceString(running_config_text=active_string, session_config_text=session_string) @@ -266,9 +273,6 @@ if __name__ == '__main__': cfg_group = grp.getgrnam(CFG_GROUP) os.setgid(cfg_group.gr_gid) - os.environ['SUDO_USER'] = 'vyos' - os.environ['SUDO_GID'] = str(cfg_group.gr_gid) - def sig_handler(signum, frame): shutdown() |