Set the HOME variable to a directory the uid can access

libgit2 will look for $HOME/.gitconfig after dropping root privileges so
this needs to be accessible to the user.
This commit is contained in:
Brian C. Lane 2018-02-12 15:12:01 -08:00
parent 442dc43206
commit a1427b1a31
1 changed files with 2 additions and 0 deletions

View File

@ -215,6 +215,8 @@ if __name__ == '__main__':
os.setgid(gid)
os.setuid(uid)
log.debug("user is now %s:%s", os.getresuid(), os.getresgid())
# Switch to a home directory we can access (libgit2 uses this to look for .gitconfig)
os.environ["HOME"] = server.config["COMPOSER_CFG"].get("composer", "lib_dir")
# Make sure yumbase directories are created
make_yum_dirs(server.config["COMPOSER_CFG"])