]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Set rspamd user to initialise supplementary groups on reload
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Feb 2019 13:14:30 +0000 (13:14 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Feb 2019 13:14:30 +0000 (13:14 +0000)
Issue: #2693
Closes: #2693
src/libserver/worker_util.c
src/rspamd.c

index e10e25bc0d5b249f819c2e04223fdf94ed82d8c6..a52dd3ccb115a848b5be64aa8387587d8b449ea9 100644 (file)
@@ -513,12 +513,14 @@ rspamd_worker_drop_priv (struct rspamd_main *rspamd_main)
                                        strerror (errno));
                        exit (-errno);
                }
+
                if (rspamd_main->cfg->rspamd_user &&
-                               initgroups (rspamd_main->cfg->rspamd_user, rspamd_main->workers_gid) ==
-                                               -1) {
+                               initgroups (rspamd_main->cfg->rspamd_user,
+                                               rspamd_main->workers_gid) == -1) {
                        msg_err_main ("initgroups failed (%s), aborting", strerror (errno));
                        exit (-errno);
                }
+
                if (setuid (rspamd_main->workers_uid) == -1) {
                        msg_err_main ("cannot setuid to %d (%s), aborting",
                                        (gint) rspamd_main->workers_uid,
index 88b44d77349a44e0e44bd947932c8b2ecf30cafd..85191e9495d288db527a6414de467aa25527489f 100644 (file)
@@ -178,6 +178,7 @@ read_cmd_line (gint *argc, gchar ***argv, struct rspamd_config *cfg)
        else {
                cfg->cfg_name = cfg_names[0];
        }
+
        for (i = 1; i < cfg_num; i++) {
                r = fork ();
                if (r == 0) {
@@ -313,6 +314,9 @@ reread_config (struct rspamd_main *rspamd_main)
                REF_RELEASE (old_cfg);
                msg_info_main ("config has been reread successfully");
                rspamd_map_preload (rspamd_main->cfg);
+
+               rspamd_main->cfg->rspamd_user = rspamd_user;
+               rspamd_main->cfg->rspamd_group = rspamd_group;
        }
 }