Description
After #69240 (fix for #67716), saltutil.runner and saltutil.wheel correctly drop to the master's configured user (salt) before running master-side functions. But the privilege drop uses salt.utils.user.chugid(), which changes only the uid/gid and leaves HOME/USER/LOGNAME pointing at the invoking (minion) user, typically root.
Git-backed master functions then read the wrong user's git configuration. With the pygit2/libgit2 provider (the onedir default), opening the cache repo stats $HOME/.gitconfig = /root/.gitconfig, which the unprivileged salt user cannot access:
_pygit2.GitError: /var/cache/salt/master/git_pillar/<id>/_: failed to stat '/root/.gitconfig'
...
salt.exceptions.FileserverConfigError: Failed to load git_pillar
The same applies to the GitPython and (3008+) gitcli providers, which also consult $HOME via the git binary. salt.utils.verify.check_user already sets HOME/USER/LOGNAME from the target user when the daemon drops privileges; the saltutil runas path does not.
Setup
Steps to Reproduce the behavior
On a master+minion where the master user is salt and the minion runs as root, with git_pillar configured:
salt <minion> saltutil.runner git_pillar.update
Expected behavior
The runner runs as the salt user with that user's environment, so git_pillar.update succeeds instead of failing on /root/.gitconfig.
Versions Report
3006.26. Regression introduced by #69240; present wherever that fix is merged forward.
Description
After #69240 (fix for #67716),
saltutil.runnerandsaltutil.wheelcorrectly drop to the master's configured user (salt) before running master-side functions. But the privilege drop usessalt.utils.user.chugid(), which changes only the uid/gid and leavesHOME/USER/LOGNAMEpointing at the invoking (minion) user, typicallyroot.Git-backed master functions then read the wrong user's git configuration. With the pygit2/libgit2 provider (the onedir default), opening the cache repo stats
$HOME/.gitconfig=/root/.gitconfig, which the unprivilegedsaltuser cannot access:The same applies to the GitPython and (3008+)
gitcliproviders, which also consult$HOMEvia the git binary.salt.utils.verify.check_useralready setsHOME/USER/LOGNAMEfrom the target user when the daemon drops privileges; thesaltutilrunas path does not.Setup
saltuser (3006 default), minion runs asroot.Steps to Reproduce the behavior
On a master+minion where the master user is
saltand the minion runs as root, with git_pillar configured:Expected behavior
The runner runs as the
saltuser with that user's environment, sogit_pillar.updatesucceeds instead of failing on/root/.gitconfig.Versions Report
3006.26. Regression introduced by #69240; present wherever that fix is merged forward.