From: Timo Sigurdsson Date: Mon, 3 Feb 2020 22:17:17 +0000 (+0100) Subject: init: Fix dropping privileges in nflog runmode X-Git-Tag: suricata-6.0.0-beta1~776 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4531%2Fhead;p=thirdparty%2Fsuricata.git init: Fix dropping privileges in nflog runmode Using the run-as configuration option with the nflog capture method results in the following error during the startup of suricata: [ERRCODE: SC_ERR_NFLOG_BIND(248)] - nflog_bind_pf() for AF_INET failed This is because SCDropMainThreadCaps does not have any capabilities defined for the nflog runmode (unlike other runmodes). Therefore, apply the same capabilities to the nflog runmode that are already defined for the nfqueue runmode. This has been confirmed to allow suricata start and drop its privileges in the nflog runmode. Fixes redmine issue #3265. Signed-off-by: Timo Sigurdsson --- diff --git a/src/util-privs.c b/src/util-privs.c index 5ce6843eb7..bed5889b9a 100644 --- a/src/util-privs.c +++ b/src/util-privs.c @@ -74,9 +74,10 @@ void SCDropMainThreadCaps(uint32_t userid, uint32_t groupid) CAP_NET_ADMIN, CAP_NET_RAW, CAP_SYS_NICE, -1); break; + case RUNMODE_NFLOG: case RUNMODE_NFQ: capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, - CAP_NET_ADMIN, /* needed for nfqueue inline mode */ + CAP_NET_ADMIN, /* needed for nflog and nfqueue inline mode */ CAP_SYS_NICE, -1); break;