All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: netdev <netdev@vger.kernel.org>
Cc: Guido Guenther <agx@sigxcpu.org>
Subject: Re: Allow group ownership of TUN/TAP devices.
Date: Mon, 02 Feb 2009 17:44:34 +0300	[thread overview]
Message-ID: <498706D2.5070003@msgid.tls.msk.ru> (raw)
In-Reply-To: <498700CD.2030403@msgid.tls.msk.ru>

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

Michael Tokarev wrote:
[]
> 2, and this is the main one: How about supplementary groups?
> 
> Here I have a valid usage case: a group of testers running various
> versions of windows using KVM (kernel virtual machine), 1 at a time,
> to test some software.  kvm is set up to use bridge with a tap device
> (there should be a way to connect to the machine).  Anyone on that group
> has to be able to start/stop the virtual machines.
> 
> My first attempt - pretty obvious when I saw -g option of tunctl - is
> to add group ownership for the tun device and add a supplementary group
> to each user (their primary group should be different).  But that fails,
> since kernel only checks for egid, not any other group ids.
> 
> What's the reasoning to not allow supplementary groups and to only check
> for egid?

Like this.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Thanks!

/mjt


[-- Attachment #2: tun-allow-supplementary-groups.diff --]
[-- Type: text/x-patch, Size: 444 bytes --]

--- linux-2.6.28/drivers/net/tun.c.orig	2008-12-25 02:26:37.000000000 +0300
+++ linux-2.6.28/drivers/net/tun.c	2009-02-02 17:33:02.000000000 +0300
@@ -714,7 +714,7 @@ static int tun_set_iff(struct net *net, 
 		if (((tun->owner != -1 &&
 		      current->euid != tun->owner) ||
 		     (tun->group != -1 &&
-		      current->egid != tun->group)) &&
+		      !in_egroup_p(tun->group))) &&
 		     !capable(CAP_NET_ADMIN))
 			return -EPERM;
 	}

  reply	other threads:[~2009-02-02 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 14:18 Allow group ownership of TUN/TAP devices Michael Tokarev
2009-02-02 14:44 ` Michael Tokarev [this message]
2009-02-03  7:35   ` David Miller
2009-02-05 10:54 ` Guido Günther
2009-03-24 18:10   ` Michael Tokarev

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=498706D2.5070003@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=agx@sigxcpu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.