netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Question] Should `CAP_NET_ADMIN` be needed when opening `/dev/ppp`?
@ 2016-05-01 13:38 Wang Shanker
  2016-05-03 10:12 ` Guillaume Nault
  0 siblings, 1 reply; 8+ messages in thread
From: Wang Shanker @ 2016-05-01 13:38 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

Hi, all.

                                                                               
I’ve recently met some problems when trying to create a pppoe network link 
inside a unprivileged container. There is a uid namespace which maps root 
inside to a normal user outside. There is also a separate net namespace in the 
container. I create a dev node inside the container and set right 
permission.    

However, `/dev/ppp` cannot get opened since the mapped normal user does not 
have `CAP_NET_ADMIN`. The related code is in `drivers/net/ppp/ppp_generic.c`: 
`int ppp_open()` 

```
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))
		return -EPERM;
	return 0;
}
```

I wonder why CAP_NET_ADMIN is needed here, rather than leaving it to the
permission of the device node. If there is no need, I suggest that the 
CAP_NET_ADMIN check be removed. 

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

end of thread, other threads:[~2016-05-03 16:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-01 13:38 [Question] Should `CAP_NET_ADMIN` be needed when opening `/dev/ppp`? Wang Shanker
2016-05-03 10:12 ` Guillaume Nault
2016-05-03 10:35   ` Richard Weinberger
2016-05-03 11:23     ` Hannes Frederic Sowa
2016-05-03 13:08       ` 王邈
2016-05-03 15:51       ` Guillaume Nault
2016-05-03 16:01         ` Hannes Frederic Sowa
2016-05-03 13:40     ` Guillaume Nault

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).