netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net:ppp: replace too strict capability restriction on opening  /dev/ppp
@ 2016-06-19  5:21 Shanker Wang
  2016-06-19  5:24 ` David Miller
  2016-06-19 10:13 ` Richard Weinberger
  0 siblings, 2 replies; 10+ messages in thread
From: Shanker Wang @ 2016-06-19  5:21 UTC (permalink / raw)
  To: netdev
  Cc: Hannes Frederic Sowa, Richard Weinberger, Guillaume Nault,
	王邈

This patch removes the check for CAP_NET_ADMIN in the initial namespace
when opening /dev/open. Instead, CAP_NET_ADMIN is checked in the user
namespace the net namespace was created so that /dev/ppp cat get opened
in a unprivileged container.

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: Miao Wang <shankerwangmiao@gmail.com>
Signed-off-by: Miao Wang <miao.wang@tuna.tsinghua.edu.cn>
---
drivers/net/ppp/ppp_generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index f572b31..4b3b2b5 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -380,7 +380,7 @@ static int ppp_open(struct inode *inode, struct file *file)
	/*
	 * This could (should?) be enforced by the permissions on /dev/ppp.
	 */
-	if (!capable(CAP_NET_ADMIN))
+	if (!ns_capable(current->nsproxy->net_ns->user_ns, CAP_NET_ADMIN))
		return -EPERM;
	return 0;
}
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] net:ppp: replace too strict capability restriction on opening  /dev/ppp
@ 2016-06-18 23:38 Shanker Wang
  2016-06-20  5:02 ` Andi Kleen
  0 siblings, 1 reply; 10+ messages in thread
From: Shanker Wang @ 2016-06-18 23:38 UTC (permalink / raw)
  To: netdev; +Cc: Hannes Frederic Sowa, Richard Weinberger, Guillaume Nault,
	Miao Wang

This patch removes the check for CAP_NET_ADMIN in the initial namespace
when opening /dev/open. Instead, CAP_NET_ADMIN is checked in the user
namespace the net namespace was created so that /dev/ppp cat get opened
in a unprivileged container.

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: Miao Wang <shankerwangmiao@gmail.com>
Signed-off-by: Miao Wang <shanker@tuna.tsinghua.edu.cn>
---
 drivers/net/ppp/ppp_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index f572b31..4b3b2b5 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -380,7 +380,7 @@ static int ppp_open(struct inode *inode, struct file *file)
 	/*
 	 * This could (should?) be enforced by the permissions on /dev/ppp.
 	 */
-	if (!capable(CAP_NET_ADMIN))
+	if (!ns_capable(current->nsproxy->net_ns->user_ns, CAP_NET_ADMIN))
 		return -EPERM;
 	return 0;
 }
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-07-16  9:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-19  5:21 [PATCH] net:ppp: replace too strict capability restriction on opening /dev/ppp Shanker Wang
2016-06-19  5:24 ` David Miller
2016-06-19  5:31   ` Shanker Wang
2016-06-19 10:13 ` Richard Weinberger
2016-06-19 10:36   ` Shanker Wang
2016-06-19 10:40     ` Richard Weinberger
2016-07-16  9:41       ` Shanker Wang
  -- strict thread matches above, loose matches on Subject: below --
2016-06-18 23:38 Shanker Wang
2016-06-20  5:02 ` Andi Kleen
2016-06-20  6:47   ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).