sops-nix icon indicating copy to clipboard operation
sops-nix copied to clipboard

Parent mkDir permissions/ownership

Open cyntheticfox opened this issue 3 years ago • 2 comments

I was having issues with home-manager interacting with sops-nix resulting from the defined parent mkDir behavior.

https://github.com/Mic92/sops-nix/blob/912f9ff41fd9353dec1f783170793699789fe9aa/pkgs/sops-install-secrets/main.go#L203

I was setting up storing my GitHub user credentials for gh by setting path to /home/<user>/.config/gh/hosts.yml, as well as setting up the config in home-manager which loads into /home/<user>/.config/gh/config.yml, but based on the systemd service load-order, sops-nix loads first and creates the parent directory with the permissions and ownership of its running process (i.e. root).

This might be fixable by having the parent directory/directories created with the permissions and/or ownership of their respective parents (recursively).

cyntheticfox avatar Oct 03 '22 12:10 cyntheticfox

This one is tricky to solve. You could use systemd.tmpfile.rules to create the symlink to some other directory instead in the meantime.

Mic92 avatar Oct 09 '22 12:10 Mic92

Just ran into the same issue. Maybe adding an option specifying whether path parent directories should be created as root or as owner user would solve this.

I get one cannot generally assume the parent directories should be created as owner, but in my case (setting private ssh keys in the home directory) this is inevitable...

a-0-dev avatar Jan 08 '23 18:01 a-0-dev