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

replace deprecated usage of PermissionsStartOnly (part 1) #59389

Merged
merged 31 commits into from Apr 19, 2019

Conversation

aanderse
Copy link
Member

Motivation for this change

First round of code ready for merging from #56265

ping @flokli

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@aanderse
Copy link
Member Author

@GrahamcOfBorg test clickhouse codicmd etcd ipfs
@GrahamcOfBorg test jackett lidarr mxisd mysql-backup
@GrahamcOfBorg test peerflix radarr smokeping sonarr
@GrahamcOfBorg test vault zookeeper couchdb influxdb

@flokli
Copy link
Contributor

flokli commented Apr 15, 2019

Going through the draft PR, there was some discussion about clickhouse (which had a static data directory anyway) and mpd (with some discussion about thedataDir option exposed - which is why this directory's creation was moved to tmpfiles.d instead of StateDirectory.

We didn't receive any feedback on the changes proposed to the following services/modules:

  • liquidsoap
  • mesos
  • stanchion
  • rss2email
  • rabbitmq
  • nullmailer
  • codimd
  • couchdb
  • jackett
  • ipfs
  • etcd
  • influxdb
  • radarr
  • mysql-backup
  • peerflix
  • smokeping
  • mxisd
  • sonarr
  • zookeeper

Given these are pretty mechanical, and this is unstable, I tend to merge it anyway - it's very granular commits, and we can revert them individually in case of any problems.

@infinisil, what do you think?

@infinisil
Copy link
Member

I think we should double-check these services, but in general I'm fine with merging this soon, the chance of this causing breakage shouldn't be high and the change is quite nice. Considering that systemd-tmpfiles (I think) recursively changes permissions, this might even fix some problems.

@flokli
Copy link
Contributor

flokli commented Apr 17, 2019

@infinisil I did review the services, and they LGTM.

systemd-tmpfiles doesn't change permissions (except if explicitly requested), StateDirectory= etc. only do it in some cases:

Except in case of ConfigurationDirectory=, the innermost specified directories will be owned
by the user and group specified in User= and Group=. If the specified directories already
exist and their owning user or group do not match the configured ones, all files and
directories below the specified directories as well as the directories themselves will have
their file ownership recursively changed to match what is configured. As an optimization, if
the specified directories are already owned by the right user and group, files and
directories below of them are left as-is, even if they do not match what is requested. The
innermost specified directories will have their access mode adjusted to the what is
specified in RuntimeDirectoryMode=, StateDirectoryMode=, CacheDirectoryMode=,
LogsDirectoryMode= and ConfigurationDirectoryMode=.

@aanderse aanderse merged commit 3464b50 into NixOS:master Apr 19, 2019
@aanderse aanderse deleted the issue/53853-1 branch April 19, 2019 00:56
@flokli
Copy link
Contributor

flokli commented Apr 19, 2019

🚀

infinisil added a commit to infinisil/nixpkgs that referenced this pull request Jul 24, 2019
The default for logFile is /var/log/couchdb.log, and the tmpfile rules chown
${dirOf cfg.logFile}, which is just /var/log, to couchdb:couchdb.

This was found by Edes' report on IRC, which looked like

    Detected unsafe path transition /var/log → /var/log/journal during canonicalization of /var/log/journal

While this bug has been present since the initial couchdb module in
62438c0 by @garbas, this wasn't a
problem, because the initial module only created and chowned /var/log
if it didn't exist yet, which can't occur because this gets created in
the initial phases of NixOS startup.

However with the recent move from manual preStart chown scripts to
systemd.tmpfiles.rules in 062efe0 (NixOS#59389),
this chown is suddenly running unconditionally at every system
activation, therefore triggering the above error.
@aanderse
Copy link
Member Author

aanderse commented Sep 3, 2019

@volth That is unfortunate. Sorry for the inconvenience. Given what you said I believe the fix should be to add an additional entry to systemd.tmpfiles.rules: "Z '${cfg.dataDir}' 0700 zookeeper - - -".

If you would be willing to test that would be appreciated.

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

4 participants