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/transmission: handle watch-dir #95522

Merged
merged 1 commit into from Aug 17, 2020
Merged

Conversation

doronbehar
Copy link
Contributor

Motivation for this change

Noticed I got errors with watch-dir ever since hardening. cc @ju1m / @Lassulus .

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.

@ju1m
Copy link
Contributor

ju1m commented Aug 16, 2020

@doronbehar Indeed support for watch-dir is missing, thanks. I cannot test this PR right now, but I suppose that:

  • Because the user's settings may not define it, a default value must be added for watch-dir-enabled.
  • Also, a sensible default like "${cfg.home}/Torrents" or else, may be set for watch-dir.
  • Maybe using BindReadOnlyPaths= (instead of BindPaths=) would be enough for watch-dir to work correctly.
  • A rule r ${cfg.settings.watch-dir}, guarded by cfg.settings.watch-dir-enabled must also be added in transmission-daemon's AppArmor profile.

@doronbehar
Copy link
Contributor Author

Because the user's settings may not define it, a default value must be added for watch-dir-enabled
Also, a sensible default like "${cfg.home}/Torrents" or else, may be set for watch-dir.

There's an upstream default for watch-dir which is "${cfg.home}/watchdir" and it's false by default. I copied most of what you did with incomplete-dir for watch-dir, according to upstream's defaults, so I hope it should be OK now.

Maybe using BindReadOnlyPaths= (instead of BindPaths=) would be enough for watch-dir to work correctly.

No, because after Transmission is adding a torrent, it renames the file with the .added suffix, so it should need write permissions as well.

A rule r ${cfg.settings.watch-dir}, guarded by cfg.settings.watch-dir-enabled must also be added in transmission-daemon's AppArmor profile.

Agreed. I added this plus other checks based on incomplete-dir.

@ju1m
Copy link
Contributor

ju1m commented Aug 16, 2020

@doronbehar Great :) I still can't test it, but it looks like there is a missing ''} in the AppArmor profile there: 42dd740#diff-3b9521332ddaab17070757e70eb2ff9bR421

`watch-dir` was neglected after NixOS#92106 - this change makes using this
setting work.
@doronbehar
Copy link
Contributor Author

Correct. I fixed that and tested the transmission.nix test and it succeeded.

@doronbehar doronbehar changed the title nixos/transmission: add to bindpaths watch-dir if need. nixos/transmission: handle watch-dir Aug 16, 2020
@ju1m
Copy link
Contributor

ju1m commented Aug 16, 2020

Well then, LGTM, thanks for this PR @doronbehar :)

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