]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Keep retained capabilities even when switching user/group 11761/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 5 Jul 2022 15:48:14 +0000 (17:48 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 5 Jul 2022 15:48:14 +0000 (17:48 +0200)
commitab083b9b29e3a1e1a09e97917e99ccca9d53c1d1
treef22f6784567d97d07fc762f9247c1b196555e164
parentcc2371c6d5dbfe40a6ab21e06f0d979ef127472f
dnsdist: Keep retained capabilities even when switching user/group

On Linux, we support retaining some capabilities if we are running
as root (eeew) or as an unprivileged user with ambiant capabilities,
but we did not yet support keeping these if we were started as root
but then switched to a different user ID and/or group ID.
This commit uses `PR_SET_KEEPCAPS`, when available, to do just that,
to be able to retain the capabilities we need without running as a
fully privileged users even when we cannot easily use ambiant
capabilities.
pdns/capabilities.cc
pdns/capabilities.hh
pdns/dnsdist.cc