-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
coturn: allow use of ports < 1024 #26632
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
Conversation
What about adding |
Ah, I take it coturn does its own privsep so it's not like it'll end up running as root, right? |
I'm not sure what the best practice is here, but I've tested and the server does end up running as |
I wonder about the ownership of |
|
Just to be sure: did you check that while the service was running? The runtime directory is supposed to be tied to the lifetime of the service. |
Anyway, I think @Ralith is better suited to review this |
The RuntimeDirectory is used to store the service's PID file, and absolutely does get touched. I don't have any knowledge of whether it's needed; if you've verified that it works fine without, then it should probably be removed from the config file, too (and tested again). I'm also in favor of a capability approach rather than the big hammer that is root, unless there's some reason that won't work. |
My bad, the |
A possible improvement is to augment ambient capabilities only when configured to use a privileged port. |
Great suggestion @joachifm, I've updated the PR to do this. BTW I'm loving nixops, this kind of thing would have been a pain with ansible! |
Would you prefer that I squished the commits together? |
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.
Looks good, modulo a couple tweaks.
@@ -320,6 +320,11 @@ in { | |||
RuntimeDirectory = "turnserver"; | |||
User = "turnserver"; | |||
Group = "turnserver"; | |||
AmbientCapabilities = |
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.
Looks like a tab snuck into the indentation here.
AmbientCapabilities = | ||
mkIf ( | ||
cfg.listening-port < 1024 || cfg.alt-listening-port < 1024 | ||
|| cfg.tls-listening-port < 1024 || cfg.alt-tls-listening-port < 1024 |
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.
Shouldn't this check cfg.min-port
too?
Thanks, I've fixed both. |
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.
LGTM! You should probably squash, since the original commit is mooted by the new one.
OK, squashed and rebased to latest master |
Sorry to mention this so late, but it just occurred to me that you could create the runtime dir with the appropriate ownership via |
Actually, using |
Merging due to maintainer approval. Thank you. |
Motivation for this change
Using ports 80 and 443 for STUN/TURN has the best chance of passing through strict firewalls. CoTURN needs to start as root in order to bind to these roots
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)