Skip to content

[BUG] saltutil.runner/wheel as the master user fails git_pillar/gitfs: failed to stat '/root/.gitconfig' #69569

Description

@ggiesen

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

  • onedir packaging; master runs as the salt user (3006 default), minion runs as root.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions