-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Add sandboxing and strip privileges on Linux with systemd #378
Comments
Hi @hg , thanks for your suggestion, this is something in our internal roadmap (we will move to the public roadmap) We need to review current and short term needs of the agent and then we will apply. |
I'm too would like to see an official hardened systemd unit file so I'm 100% I won't break something.
Isn't it using wg kernel module though?
I had to do the same on NixOS. |
I can also suggest you to use systemd's DynamicUser and store config file under |
This would solve my current usecase: running netbird via systemd, user level (via |
Could not find a template file online for the systemd service file (would be great if it wouldn't be inside the app to be honest) , so decided to install the systemd service, to check out the generated files. This is
And then I checked out the json file
Changing everything to user level will indeed not work. Apparently the socket is created and used (mandatory), which does not seem to be configurable. As the OP states, it would be great if this could be enhanced. |
I used to patch that, but running under a restricted user will not work these days for other reasons (I don't remember all of the issues I've faced, but one of them was probably intraction with |
For automatic dns with systemd-resolved, this polkit rule needs to be added: polkit.addRule(function(action, subject) {
if((action.id == "org.freedesktop.resolve1.set-dns-servers" ||
action.id == "org.freedesktop.resolve1.set-domains") &&
subject.user == "netbird") {
return polkit.Result.YES;
}
}) Bpf program should also be rebuilt, as it uses bpf_trace_printk, which is privileged, because it might slow down the OS. |
netbird is an awesome project, but I'm not a fan of how the client runs with full privileges without any restrictions at all. Not great for a networked service.
With a few systemd features, we can fix this without any modifications to the project's code.
I've been maintaining an unofficial package for Arch Linux. It has most of the isolation flags enabled (have a look at source files at the bottom of the page):
/home
or/proc
)See more suggestions with:
Ideally the default socket path should be changed to
/var/run/netbird/netbird.sock
because/var/run
typically can only be written by root, and systemd can prepare a subdirectory for you with an appropriate owner (see the patch on AUR). On non-systemd systems it can be created by the installation script.Any interest in adding something like this to the official
.service
so more users benefit from it?The text was updated successfully, but these errors were encountered: