ipvs: allow some sysctls in non-init user namespaces
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Mon, 6 May 2024 14:14:44 +0000 (16:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 May 2024 11:22:18 +0000 (12:22 +0100)
commit2b696a2a101d36530227056b43e5c4ec05bcefc2
treecc66ca4e91b0cf0fea6280d6664c888e2ddad406
parent643bb5dbaef7d01f9bcf2a495bef855e81fd5714
ipvs: allow some sysctls in non-init user namespaces

Let's make all IPVS sysctls writtable even when
network namespace is owned by non-initial user namespace.

Let's make a few sysctls to be read-only for non-privileged users:
- sync_qlen_max
- sync_sock_size
- run_estimation
- est_cpulist
- est_nice

I'm trying to be conservative with this to prevent
introducing any security issues in there. Maybe,
we can allow more sysctls to be writable, but let's
do this on-demand and when we see real use-case.

This patch is motivated by user request in the LXC
project [1]. Having this can help with running some
Kubernetes [2] or Docker Swarm [3] workloads inside the system
containers.

Link: https://github.com/lxc/lxc/issues/4278
Link: https://github.com/kubernetes/kubernetes/blob/b722d017a34b300a2284b890448e5a605f21d01e/pkg/proxy/ipvs/proxier.go#L103
Link: https://github.com/moby/libnetwork/blob/3797618f9a38372e8107d8c06f6ae199e1133ae8/osl/namespace_linux.go#L682
Cc: Julian Anastasov <ja@ssi.bg>
Cc: Simon Horman <horms@verge.net.au>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/ipvs/ip_vs_ctl.c