Commit a8277d18 authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

install logging configuration after relinquishing root privileges

to ensure that log files specified in named.conf are created as
the unprivileged user
parent e0a43acb
......@@ -1292,8 +1292,18 @@ load_configuration(const char *filename, ns_server_t *server,
server->tkeyctx = t;
}
/*
* Relinquish root privileges.
*/
if (first_time)
ns_os_changeuser(ns_g_username);
/*
* Configure the logging system.
*
* Do this after changing UID to make sure that any log
* files specified in named.conf get created by the
* unprivileged user, not root.
*/
if (ns_g_logstderr) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
......@@ -1322,9 +1332,6 @@ load_configuration(const char *filename, ns_server_t *server,
}
}
if (first_time)
ns_os_changeuser(ns_g_username);
if (dns_c_ctx_getpidfilename(cctx, &pidfilename) ==
ISC_R_NOTFOUND)
pidfilename = ns_g_defaultpidfile;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment