]> git.baikalelectronics.ru Git - kernel.git/commit
l2tp: Allow management of tunnels and session in user namespace
authorMichael Weiß <michael.weiss@aisec.fraunhofer.de>
Tue, 7 Apr 2020 11:11:48 +0000 (13:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Apr 2020 07:04:44 +0000 (09:04 +0200)
commitcfb4d678566c8fd29d9dc934c9fce4f07d6153c6
tree4b4993d969c5b2b7d5258f69ad784c9de62a6c17
parent3fe8f7935a6968c0acc5e57fe58e006a17c4ae20
l2tp: Allow management of tunnels and session in user namespace

[ Upstream commit ec19b5445d15ad523f6fc6e24bddaa9d3747134a ]

Creation and management of L2TPv3 tunnels and session through netlink
requires CAP_NET_ADMIN. However, a process with CAP_NET_ADMIN in a
non-initial user namespace gets an EPERM due to the use of the
genetlink GENL_ADMIN_PERM flag. Thus, management of L2TP VPNs inside
an unprivileged container won't work.

We replaced the GENL_ADMIN_PERM by the GENL_UNS_ADMIN_PERM flag
similar to other network modules which also had this problem, e.g.,
openvswitch (commit 8924be6e5426 "openvswitch: allow management from
inside user namespaces") and nl80211 (commit 9b4fe9101e013 "nl80211:
Allow privileged operations from user namespaces").

I tested this in the container runtime trustm3 (trustm3.github.io)
and was able to create l2tp tunnels and sessions in unpriviliged
(user namespaced) containers using a private network namespace.
For other runtimes such as docker or lxc this should work, too.

Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/l2tp/l2tp_netlink.c