Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/security.acme: Only chmod/chown certificate files when changed. #95498

Closed
wants to merge 1 commit into from

Conversation

pstn
Copy link
Contributor

@pstn pstn commented Aug 15, 2020

Motivation for this change

chmod and chowns currently don't set KEY_CHANGED, this breaks setups like mine that rely on chowns in postRun. I made it so that chmod/chown now properly report Changes and therefore trigger a postRun hook call.

Ping @mweinelt since you made the last major logic change here.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mweinelt
Copy link
Member

PostRun being conditional on KEY_CHANGED was introduced in 8e88b8d by @immae.

This seems like a reasonable change, but I would kindly defer to the @NixOS/acme team.

@mweinelt mweinelt requested a review from a team August 15, 2020 12:36
@pstn
Copy link
Contributor Author

pstn commented Aug 15, 2020

Reflecting on these changes, it might be nice to have a way to disable this behavior entirely to not trigger postRun and file watchers unnecessarily. Alternatively, chowning/chmoding more freely could be a feature of this module. I don't see why a user that uses the cert needs to be the one that generates the cert.

@pstn
Copy link
Contributor Author

pstn commented Aug 15, 2020

I'm now of the opinion that this is a bad way to fix this since it leads to a lot of unnecessary file changes. A better PR is incoming.

@pstn pstn closed this Aug 15, 2020
@m1cr0man
Copy link
Contributor

I've incorporated some reliable chown/chmodding into #91121, which means that permissions will always be what they should be when the postRun runs, and when KEY_CHANGED is true. I would appreciate a review/test on that PR to see if it fits your use case too.

@pstn
Copy link
Contributor Author

pstn commented Aug 16, 2020

Ah, yes. This is along the lines of what I came to the conclusion is actually needed. I'll have a look at it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants