From 4f878ba144dee853405e4a22fc9658c40d37678a Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 25 Feb 2021 17:04:01 +0100 Subject: [PATCH] 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. --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 0e54152..3290d33 100644 --- a/main.c +++ b/main.c @@ -628,6 +628,9 @@ int main if (!geteuid() && (pw->pw_uid || pw->pw_gid)) SYS_DropRoot(pw->pw_uid, pw->pw_gid, SYS_MAIN_PROCESS); + if (!geteuid()) + LOG(LOGS_WARN, "Running with root privileges"); + REF_Initialise(); SST_Initialise(); NSR_Initialise();