-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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: fixes #258793 #267319
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be to only BindReadOnlyPaths="/run/systemd/resolve" when services.resolved.enable == true, but IMHO it's too much a special case
Makes sense, that also doesn't scale when lots of modules are interacting with each other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested but seems like a reasonable solution.
@GrahamcOfBorg test transmission bittorrent |
PrivateMounts = mkDefault true; | ||
PrivateNetwork = mkDefault false; | ||
PrivateTmp = true; | ||
PrivateUsers = true; | ||
PrivateUsers = mkDefault true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required, people can use lib.mkForce to overwrite any of those values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes for a more friendly user interface though. IMO the nixos modules should be considered opinionated defaults at best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's my rationale here. mkDefault
gives a hint that a user may want to change them, but that security is by default (as openFirewall
defaults to false
for almost every service).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still hides it away from the user, and they actively have to find the service file to discover this + it's not even sure it makes a difference for their setup. It's quite a small hint.
I'm not sure this PR will change much, as having to use Which as far as I know, is a issue that should be dealt with somewhere else, and more broadly for nixpkgs itself. :) |
I am the main culprit for pushing those hardening settings, I am sorry it bothers you. There was almost no other hardening example to follow in Nixpkgs at the time, so I did what I thought was best to provide a more secure To my mind, enabling hardening by default is best achieved by using Maybe some lower level options could be removed to let the systemd logic apply them or not depending on the setting of more high-level options, but this is a huge cognitive overhead and a burden to check when changing them, so I prefer to set them all as shown by the best
See for instance #270637 |
Sadly I can't add much to your reply, the reasoning makes sense, but at the same time the comment from #270637, is what I lean towards.
I don't think systemd-analyze is the golden standard, or should be used for these cases. And using Having a single option which is something like That said, I appreciate all the effort you've put into it, I'm just questioning if |
Tools to help for that:
Since such global option is considered useful by you, maybe you could propose it in another PR, I guess it could be made a
I do agree and hope that |
I'm merging this, as the arguments presented for this change have satisfied me as well, and the debate has stopped long ago. |
I still don't think it makes any sense. Now we have |
Description of changes
This should fix #258793 (not tested by me).
An alternative would be to only
BindReadOnlyPaths="/run/systemd/resolve"
whenservices.resolved.enable == true
, but IMHO it's too much a special case, for too little added security (/run/*
is still restricted through Unix perms).Things done
BindPaths=
instead ofBindReadOnlyPaths=
for/run
. Transmission may need to read in the host's /run (eg./run/systemd/resolve
) or write in its private/run
(eg./run/host
).mkDefault
s to ease the custom settings of a user reporting they had to disablePrivateMounts=
andPrivateUsers=
.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)