main: warn if running with root privileges

Log a warning message if the main process has not dropped the root
privileges, i.e. when the compiled-in user or user specified by the user
directive or -u option is root.
This commit is contained in:
Miroslav Lichvar 2021-02-25 17:04:01 +01:00
parent 8acdb5d1e2
commit 4f878ba144

3
main.c
View file

@ -628,6 +628,9 @@ int main
if (!geteuid() && (pw->pw_uid || pw->pw_gid)) if (!geteuid() && (pw->pw_uid || pw->pw_gid))
SYS_DropRoot(pw->pw_uid, pw->pw_gid, SYS_MAIN_PROCESS); SYS_DropRoot(pw->pw_uid, pw->pw_gid, SYS_MAIN_PROCESS);
if (!geteuid())
LOG(LOGS_WARN, "Running with root privileges");
REF_Initialise(); REF_Initialise();
SST_Initialise(); SST_Initialise();
NSR_Initialise(); NSR_Initialise();