+Knot Resolver 5.2.0 (2020-0m-dd)
+================================
+
+Improvements
+------------
+- capabilities are no longer constrained when running as root (!1012)
+
+
Knot Resolver 5.1.2 (2020-07-01)
================================
static void drop_capabilities(void)
{
#ifdef ENABLE_CAP_NG
- /* Drop all capabilities. */
+ /* Drop all capabilities when running under non-root user. */
+ if (geteuid() == 0) {
+ kr_log_verbose("[system] running as root, no capabilities dropped\n");
+ return;
+ }
if (capng_have_capability(CAPNG_EFFECTIVE, CAP_SETPCAP)) {
capng_clear(CAPNG_SELECT_BOTH);
if (capng_apply(CAPNG_SELECT_BOTH) < 0) {
kr_log_error("[system] failed to set process capabilities: %s\n",
strerror(errno));
+ } else {
+ kr_log_verbose("[system] all capabilities dropped\n");
}
} else {
- kr_log_info("[system] process not allowed to set capabilities, skipping\n");
+ /* If user() was called, the capabilities were already dropped along with SETPCAP. */
+ kr_log_verbose("[system] process not allowed to set capabilities, skipping\n");
}
#endif /* ENABLE_CAP_NG */
}
* ``CAP_NET_BIND_SERVICE`` is required to bind to well-known ports.
* ``CAP_SETPCAP`` when this capability is available, kresd drops any extra
- privileges after the daemon successfully starts.
+ capabilities after the daemon successfully starts when running as
+ a non-root user.
Running as non-privileged user
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
proccesses have unconstrained access to the complete system at runtime.
While not recommended, it is also possible to run kresd directly as root.
-
-Please note the process will still attempt to drop capabilities after startup.
-Among other things, this means the cache directory should belong to root to
-have write access.