-
Notifications
You must be signed in to change notification settings - Fork 113
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
Security: Running dhcpcd as non root ? #87
Comments
dhcpcd-9 already supports sandbox techniques for FreeBSD (capsicum), OpenBSD (pledge) and Linux (seccomp). This means that the root owned process doesn't directly handle any input from anything other than non root owned dhcpcd processes. It also does the bare minimum - ie just carry out a pre-defined action from one of the non root processes. You're welcome to try and patch the root process not to run as root though if you can set the right caps for it :) https://github.com/NetworkConfiguration/dhcpcd/blob/master/src/privsep-root.c |
Thanks for your answer :D I don't code in C, so I'll not be able to patch anything unfortunately 😅 |
I had a similar thought here #417 using setpriv. |
As a raw, first experiment, I tried to run the dhcpcd daemon with a runit service that looks like
and it works, although it complains about a bunch of things in the logs:
|
No they are not documented anywhere. Once you have reduced the warnings emitted to zero for all IPv4 and IPv6 operations then I guess everything is covered :) A quick look through a man page suggests these caps: CAP_BPF, CAP_LEASE (for the pidfile), CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_NET_BROADCAST, CAP_NET_RAW (might not be needed in dhcpcd-11), CAP_SETGID, CAP_SETUID, CAP_SYS_CHROOT. It will likely need CAP_SYS_ADMIN, CAP_SYS_RAWIO and CAP_SYS_RESOURCE as well, but that will require some testing. Good luck! |
Thanks for pointing out the list. |
We should be careful with CAP_SETGID, CAP_SETUID, CAP_SYS_CHROOT, CAP_SYS_ADMIN, CAP_SYS_RAWIO as they're considered root-equivalent. While CAP_BPF, CAP_LEASE, CAP_SYS_RESOURCE seem fine, I did not need to include them to reach zero warnings. |
Hello,
I'd wondering, is it possible to run dhcpcd as a non-root user by setting the right caps ? This could be interesting in a security perspective... Thanks :)
The text was updated successfully, but these errors were encountered: