]> git.ipfire.org Git - thirdparty/openvpn.git/commit
dco: disable DCO if --user specified but unable to retain capabilities
authorTimo Rothenpieler <timo@rothenpieler.org>
Wed, 17 Aug 2022 13:18:17 +0000 (15:18 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 17 Aug 2022 14:08:07 +0000 (16:08 +0200)
commitda31c1654c8534658157cfe9c9de5750ee752608
treed58bdfc32a1d68d04f30ec03dfefca86636ae2f5
parent9b17fed14bc534353d9a5e2d90d902bb093df3c2
dco: disable DCO if --user specified but unable to retain capabilities

If run under network manager, OpenVPN starts with uid=0 and
'--user nm-openvpn', but is lacking the CAP_SETPCAP capabilities
to retain CAP_NET_ADMIN after dropping root privileges.

In DCO mode, OpenVPN must have CAP_NET_ADMIN today, always, otherwise
TLS renegotiation / key rotation will not be possible.

So, check at startup, if --user is specified, if CAP_NET_ADMIN is
permitted and CAP_SETPCAP is available.  If either of the capabilities
is missing, disable DCO.  Traditional tun/tap works with "uid=0 on
tun open, and setuid() afterwards".

Long-Term, get NM to enable OpenVPN to run with CAP_NET_ADMIN.

Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1017379

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Tested-By: Bernhard Schmidt <berni@birkenwald.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220817131817.467-1-timo@rothenpieler.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24952.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dco.c