Make tmpfiles respect configured group name and document security implications#555
Merged
jrybar-rh merged 2 commits intopolkit-org:mainfrom Mar 6, 2025
Merged
Make tmpfiles respect configured group name and document security implications#555jrybar-rh merged 2 commits intopolkit-org:mainfrom
jrybar-rh merged 2 commits intopolkit-org:mainfrom
Conversation
We allow changing the polkit daemon user through the `-Dpolkitd_user` Meson option. When this is used, the tmpfiles.d config will refer to a non-existent group. For example, NixOS builds polkit with `-Dpolkitd_user=polkituser`. Let’s substitute the `polkitd_user` value into the config. We do not have a separate option for the group name since, by convention, the group name matches the user name. This is also enforced by our `sysusers.d` config: https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html#u
Quoting from <https://www.github.com/polkit-org/polkit/pull/442#issuecomment-2692718825>: > The tmpfiles.d is used to create polkit subdirectory in /etc, because the directory needs specific ownership mode, it needs to be owned by root and only readable by root and polkitd group. This is for security reasons, so that polkit daemon cannot change .rules files in case of getting hijacked. It should have as minimal privileges as possible. The subdirectory is pre-created so no administrator omits to set the appropriate mode and ownership.
vmihalko
approved these changes
Mar 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow up to #442 (comment).
Detailed description and/or reproducer
Make tmpfiles respect configured polkit group name
We allow changing the polkit daemon user through the
-Dpolkitd_userMeson option.When this is used, the tmpfiles.d config will refer to a non-existent group.
For example, NixOS builds polkit with
-Dpolkitd_user=polkituser.Let’s substitute the
polkitd_uservalue into the config.We do not have a separate option for the group name since, by convention,
the group name matches the user name. This is also enforced by our
sysusers.dconfig:https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html#u
Document the security implications for tmpfiles.d entry
Quoting from https://www.github.com/polkit-org/polkit/pull/442#issuecomment-2692718825: