mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Shanker <shankerwangmiao@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [Question] Should `CAP_NET_ADMIN` be needed when opening `/dev/ppp`?
Date: Sun, 1 May 2016 21:38:57 +0800	[thread overview]
Message-ID: <2BEB0C68-EBC6-4A8F-A751-DE8F4A2C9D2C@gmail.com> (raw)

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. 

             reply	other threads:[~2016-05-01 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01 13:38 Wang Shanker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2BEB0C68-EBC6-4A8F-A751-DE8F4A2C9D2C@gmail.com \
    --to=shankerwangmiao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®