diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-15 22:02:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-18 20:30:55 -0500 |
commit | 464dc801c76aa0db88e16e8f5f47c6879858b9b2 (patch) | |
tree | cfaf0f43f4ce50669f07031ec42062b4c9a7f985 /net/ipv6/addrconf.c | |
parent | 73f7ef435934e952c1d70d83d69921ea5d1f6bd4 (diff) |
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/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cb803b7bb0d8..b24b4de5cd26 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4735,6 +4735,10 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name, | |||
4735 | t->addrconf_vars[i].extra2 = net; | 4735 | t->addrconf_vars[i].extra2 = net; |
4736 | } | 4736 | } |
4737 | 4737 | ||
4738 | /* Don't export sysctls to unprivileged users */ | ||
4739 | if (net->user_ns != &init_user_ns) | ||
4740 | t->addrconf_vars[0].procname = NULL; | ||
4741 | |||
4738 | snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); | 4742 | snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); |
4739 | 4743 | ||
4740 | t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars); | 4744 | t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars); |