mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-28 21:17:54 +00:00
install logging configuration after relinquishing root privileges
to ensure that log files specified in named.conf are created as the unprivileged user
This commit is contained in:
parent
e0a43acbb7
commit
a8277d18aa
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user