On Fri, May 3, 2024 at 3:06 PM Julian Anastasov <ja@xxxxxx> wrote:>
>
> Hello,
>
> On Thu, 18 Apr 2024, Alexander Mikhalitsyn wrote:
>
> > 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 [1]
> > Link:
> > https://github.com/kubernetes/kubernetes/blob/b722d017a34b300a2284b890448e5a605f21d01e/pkg/proxy/ipvs/proxier.go#L103
> > [2]
> > Link:
> > https://github.com/moby/libnetwork/blob/3797618f9a38372e8107d8c06f6ae199e1133ae8/osl/namespace_linux.go#L682
> > [3]
> >
> > Cc: Stéphane Graber <stgraber@xxxxxxxxxxxx>
> > Cc: Christian Brauner <brauner@xxxxxxxxxx>
> > Cc: Julian Anastasov <ja@xxxxxx>
> > Cc: Simon Horman <horms@xxxxxxxxxxxx>
> > Cc: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> > Cc: Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>
> > Cc: Florian Westphal <fw@xxxxxxxxx>
> > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>
> > ---
> > net/netfilter/ipvs/ip_vs_ctl.c | 21 +++++++++++++++------
> > 1 file changed, 15 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> > index 32be24f0d4e4..c3ba71aa2654 100644
> > --- a/net/netfilter/ipvs/ip_vs_ctl.c
> > +++ b/net/netfilter/ipvs/ip_vs_ctl.c
>
> ...
>
> > @@ -4284,12 +4285,6 @@ static int __net_init
> > ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs)
> > tbl = kmemdup(vs_vars, sizeof(vs_vars), GFP_KERNEL);
> > if (tbl == NULL)
> > return -ENOMEM;
> > -
> > - /* Don't export sysctls to unprivileged users */
> > - if (net->user_ns != &init_user_ns) {
> > - tbl[0].procname = NULL;
> > - ctl_table_size = 0;
> > - }
> > } else
> > tbl = vs_vars;
> > /* Initialize sysctl defaults */
>
> Sorry but you have to send v4 because above if-block was
> changed with net-next commit 635470eb0aa7 from today...
Dear Julian,
sorry about the delay with v4 (just rebased it on top of net-next).
Have just sent it
https://lore.kernel.org/all/20240506141444.145946-1-aleksandr.mikhalitsyn@xxxxxxxxxxxxx
Kind regards,
Alex
>
> Regards
>
> --
> Julian Anastasov <ja@xxxxxx>
|