Skip to content

Commit 8fafc35

Browse files
committed
resolvconf: reliably set group permissions
If `resolvconf` is invoked by a process not running with the resolvconf group as primary group, other processes will run into trouble as files or directories under /run/resolvconf won't have write permissions. This ACL rule ensure that resolvconf files, include new files created by any process, are always accessible by users of the resolvconf group.
1 parent 31eafae commit 8fafc35

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nixos/modules/config/resolvconf.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ in
161161

162162
script = ''
163163
${lib.getExe cfg.package} -u
164-
files=(/run/resolvconf ${lib.escapeShellArgs cfg.subscriberFiles})
165-
chgrp -R resolvconf "''${files[@]}"
166-
chmod -R g=u "''${files[@]}"
164+
chgrp resolvconf ${lib.escapeShellArgs cfg.subscriberFiles}
165+
chmod g=u ${lib.escapeShellArgs cfg.subscriberFiles}
166+
${lib.getExe' pkgs.acl "setfacl"} -R \
167+
-m group:resolvconf:rwx \
168+
-m default:group:resolvconf:rwx \
169+
/run/resolvconf
167170
'';
168171
};
169172

0 commit comments

Comments
 (0)