]> git.ipfire.org Git - thirdparty/systemd.git/commit
execute: don't honour PrivateNetwork() if we lack CAP_NET_ADMIN
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Jun 2023 14:06:29 +0000 (16:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Jun 2023 20:52:13 +0000 (22:52 +0200)
commit5a3627e511aa19339eb9197567ee53a4e1738b54
tree3315f9ab5a7d02418831b7154862ab0eb9c8db0e
parent51d64d8869d1cdc5a7a161e5e2e825e826c4c605
execute: don't honour PrivateNetwork() if we lack CAP_NET_ADMIN

Somehow the Linux kernel allows us to allocate a network namespace if we
possess CAP_SYS_ADMIN but doesn't allow us to configure it, unless we
also have CAP_NET_ADMIN.

Taking that into consideration let's avoid allocating a network
namespace we cannot even configure "lo" in.

This is common case if nspawn is invoked without userns and without
netns, because in that case it will have CAP_SYS_ADMIN but no
CAP_NET_ADMIN.

This also takes down a notch the messages about the automatic
downgrading. These have been LOG_WARNING so far, and I downgraded them
to LOG_NOTICE, since in an environment where CAP_NET_ADMIN is not
available this is really not something to be concerned about, but still
noticable. With that it's still more priorized than regular LOG_INFO.

Fixes: #27292
src/core/execute.c