From bd8decddc5932ad1d6a6b4bcfacf0f3299d1a947 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 13 Mar 2025 21:54:28 +0300 Subject: [PATCH] nfqws,tpws: separate droproot from dropcaps --- docs/changes.txt | 1 + nfq/nfqws.c | 2 +- nfq/sec.c | 6 +----- tpws/sec.c | 6 +----- tpws/tpws.c | 4 ++++ 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 7ab30ade..d8d88200 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -464,3 +464,4 @@ v70.4 nfqws,tpws: ^ prefix in hostlist to disable subdomain matches nfqws,tpws: optional systemd notify support. compile using 'make systemd' nfqws,tpws: systemd instance templates for nfqws and tpws +nfqws,tpws: separate droproot from dropcaps diff --git a/nfq/nfqws.c b/nfq/nfqws.c index bd6e8b9d..b469fe11 100644 --- a/nfq/nfqws.c +++ b/nfq/nfqws.c @@ -293,7 +293,7 @@ static int nfq_main(void) ssize_t rd; sec_harden(); - if (params.droproot && !droproot(params.uid, params.gid)) + if (params.droproot && !droproot(params.uid, params.gid) || !dropcaps()) return 1; print_id(); if (params.droproot && !test_list_files()) diff --git a/nfq/sec.c b/nfq/sec.c index 71ba1c75..4fabd16a 100644 --- a/nfq/sec.c +++ b/nfq/sec.c @@ -287,7 +287,7 @@ bool can_drop_root(void) { #ifdef __linux__ // has some caps - return checkpcap((1<