From: Rene Herman <rene.herman@home.nl>
To: Bodo Eggert <7eggert@gmx.de>
Cc: Mike Mohr <akihana@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: group ownership of tun devices -- nonfunctional?
Date: Mon, 20 Aug 2007 01:24:20 +0200 [thread overview]
Message-ID: <46C8D124.4030701@home.nl> (raw)
In-Reply-To: <Pine.LNX.4.58.0708192333170.2426@be1.lrz>
On 08/19/2007 11:42 PM, Bodo Eggert wrote:
> On Sun, 19 Aug 2007, Rene Herman wrote:
>
>> On 08/19/2007 06:05 PM, Bodo Eggert wrote:
>>
>>> IMHO the check is broken:
>>>
>>> + if (((tun->owner != -1 &&
>>> + current->euid != tun->owner) ||
>>> + (tun->group != -1 &&
>>> + current->egid != tun->group)) &&
>>> + !capable(CAP_NET_ADMIN))
>>> return -EPERM;
>>>
>>> It should be something like:
>>>
>>> + if (!((tun->owner == tun->owner) ||
>>> + (tun->group == tun->group) ||
>> ???
>
> Argh, I edited asuming the same order of variables. Substitute
> current->e{uid,gid} for one of the sides.
Okay. Just had to ask. That looked so odd...
>>> + capable(CAP_NET_ADMIN)))
>>> return -EPERM;
>
> The intended semantics is If the user is not
> * the allowed user
> or
> * member of the allowed group
> or
> * cabable of CAP_NET_ADMIN
> then error out. I'm asuming
There is a short description of the desired semantics in the link that was
posted:
http://lkml.org/lkml/2007/6/18/228
===
The user now is allowed to send packages if either his euid or his egid
matches the one specified via tunctl (via -u or -g respecitvely). If both
gid and uid are set via tunctl, both have to match.
===
Paraphrasing the original code above, it's saying:
if ((owner_is_set && does_not_match) || (group_is_set && does_not_match))
bugger_off_unless(CAP_NET_ADMIN);
or reverting the logic:
if ((owner_is_unset || does_match) && (group_is_unset || does_match))
good_to_go();
which probably matches the intention -- we're good to go only if the
credentials that are set also match.
Rene.
next prev parent reply other threads:[~2007-08-20 0:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <8Tpwf-3Nb-1@gated-at.bofh.it>
2007-08-19 16:05 ` group ownership of tun devices -- nonfunctional? Bodo Eggert
2007-08-19 16:10 ` Rene Herman
2007-08-19 21:42 ` Bodo Eggert
2007-08-19 23:24 ` Rene Herman [this message]
2007-08-20 11:45 ` Bodo Eggert
2007-08-22 20:42 ` Jeff Dike
2007-08-23 7:13 ` Guido Guenther
2007-08-18 5:56 Mike Mohr
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=46C8D124.4030701@home.nl \
--to=rene.herman@home.nl \
--cc=7eggert@gmx.de \
--cc=akihana@gmail.com \
--cc=linux-kernel@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