diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-16 03:02:59 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-18 20:30:55 -0500 |
commit | 464dc801c76aa0db88e16e8f5f47c6879858b9b2 (patch) | |
tree | cfaf0f43f4ce50669f07031ec42062b4c9a7f985 /net/netfilter/ipvs/ip_vs_lblc.c | |
parent | 73f7ef435934e952c1d70d83d69921ea5d1f6bd4 (diff) | |
download | op-kernel-dev-464dc801c76aa0db88e16e8f5f47c6879858b9b2.zip op-kernel-dev-464dc801c76aa0db88e16e8f5f47c6879858b9b2.tar.gz |
net: Don't export sysctls to unprivileged users
In preparation for supporting the creation of network namespaces
by unprivileged users, modify all of the per net sysctl exports
and refuse to allow them to unprivileged users.
This makes it safe for unprivileged users in general to access
per net sysctls, and allows sysctls to be exported to unprivileged
users on an individual basis as they are deemed safe.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_lblc.c')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index cbd3748..d742aa9 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c @@ -560,6 +560,11 @@ static int __net_init __ip_vs_lblc_init(struct net *net) GFP_KERNEL); if (ipvs->lblc_ctl_table == NULL) return -ENOMEM; + + /* Don't export sysctls to unprivileged users */ + if (net->user_ns != &init_user_ns) + ipvs->lblc_ctl_table[0].procname = NULL; + } else ipvs->lblc_ctl_table = vs_vars_table; ipvs->sysctl_lblc_expiration = DEFAULT_EXPIRATION; @@ -569,7 +574,7 @@ static int __net_init __ip_vs_lblc_init(struct net *net) register_net_sysctl(net, "net/ipv4/vs", ipvs->lblc_ctl_table); if (!ipvs->lblc_ctl_header) { if (!net_eq(net, &init_net)) - kfree(ipvs->lblc_ctl_table); + kfree(ipvs->lblc_ctl_table);\ return -ENOMEM; } |