From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: handling of supplemental groups with userns
Date: Tue, 22 Sep 2015 17:52:15 -0400 [thread overview]
Message-ID: <20150922215215.GE27286@vapier.lan> (raw)
In-Reply-To: <87d1xafdk8.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2814 bytes --]
On 22 Sep 2015 14:40, Eric W. Biederman wrote:
> Mike Frysinger writes:
> > is it possible to map in supplemental groups in a userns when the user
> > lacks setgid/etc... capabilities in the parent ns ? it doesn't seem
> > like it's currently possible, but is there a reason to not enable it ?
>
> In your unprivileged use scenario, you won't be able to drop
> your supplementary groups so why do you need them mapped?
>
> > basically i have a build tool that i want to isolate a bit, but it
> > requires access to some of my supplemental groups. if i map just
> > my effective uid/gid, the build will fail when it tries to use the
> > chown/chgrp commands (gets back EINVAL).
>
> Yes. That really isn't valid as you are dropping groups. Peculiarly
> enough dropping groups can be a security issue as in some permission
> checks not being a member of a group can give you enhanced access to
> files and directories.
i don't want to drop groups ... i want the exact opposite actually :).
ideally, `id` would have the same output before/after. instead, i get
65534 for all the supplemental groups. these commands work before i
create a new userns and i want them to keep working afterwards:
chgrp 100 foo
chgrp 250 foo
instead, only the first works (since that's my effective gid) and the
second fails (since i'm in that via a supplemental group).
> So to do something like what you want, you need a setuid helper (something
> like newuidmap or newgidmap) to verify that what you are doing is ok
> by local policy.
i know i can get it ahead of time if i have the caps apriori, but that's
not what i want to require. if i had those, then i would generally be
able to simply create the namespaces directly and not bother with userns
in the first place :).
> > my scenario boils down to:
> > - normal unprivileged user (uid=8282)
> > - member of multiple groups (gid=100, getgroups={100,16,250,...})
> > - create a new userns (to get access to other ns like mount/pid)
> > but still have access to existing groups where i'm root
> > - use various features that require caps (new pidns/mntns/etc...)
> > - create another userns and map back non-root users/groups
> > i.e. i switch from 8282 to 0, do what i need, then switch back to 8282.
>
> [snip]
>
> > in the mean time, a "quick" fix might be to change new_idmap_permitted
> > to walk all the extents, and if all the ranges are set to 1, check the
> > supplemental groups in addition to the current egid ?
>
> That allows dropping groups that you could not drop normally and so we
> can't allow it, by default.
if setgroups is set to deny, then it's not possible for me to drop any
groups, and therefore allowing me to map supplemental groups wouldn't be
a problem right ?
-mike
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 205 bytes --]
_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2015-09-22 21:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150922162157.GB27286@vapier.lan>
[not found] ` <20150922162157.GB27286-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2015-09-22 19:40 ` handling of supplemental groups with userns Eric W. Biederman
[not found] ` <87d1xafdk8.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2015-09-22 21:52 ` Mike Frysinger [this message]
[not found] ` <20150922215215.GE27286-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2015-09-29 3:06 ` Mike Frysinger
2015-09-22 16:21 Mike Frysinger
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=20150922215215.GE27286@vapier.lan \
--to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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