linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
	Stefan Berger <stefanb@linux.vnet.ibm.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	containers@lists.linux-foundation.org, lkp@01.org,
	linux-kernel@vger.kernel.org, zohar@linux.vnet.ibm.com,
	tycho@docker.com, James.Bottomley@HansenPartnership.com,
	vgoyal@redhat.com, christian.brauner@mailbox.org,
	amir73il@gmail.com, linux-security-module@vger.kernel.org,
	casey@schaufler-ca.com
Subject: Re: [PATCH v2] xattr: Enable security.capability in user namespaces
Date: Wed, 12 Jul 2017 21:34:25 -0500	[thread overview]
Message-ID: <20170713023425.GA24103@mail.hallyn.com> (raw)
In-Reply-To: <20170713011554.xwmrgkzfwnibvgcu@thunk.org>

Quoting Theodore Ts'o (tytso@mit.edu):
> I'm really confused what problem that is trying to be solved, here,
> but it **feels** really, really wrong.

Hi,

The intro to my original patch might help (or maybe not), as it
has a different motivating text:

http://lkml.org/lkml/2016/11/19/158

We want file capabilities to be supported in unprivileged containers,
so that a piece of software can count on them being available rather
than having to supporting multiple ways of getting+dropping privilege
(for instance, being installed as uid 1000 with cap_net_raw=pe, versus
being installed setuid-root and being expected to do PR_SET_KEEPCAPS
and setuid).

If subuids 10000-20000 are delegated to uid 1001 on the host, and uid
1001 sets up a container with subuid 100000 mapped to container uid 0,
then the container root should be able to write file capabilities
which affect (that is, delegate container root's privilege to) all ids
over which it has privilege (all uids mapped into the container), but
should not have privilege over any uids not mapped into the container.
With regular file capabilities, this is impossible, since any filecap
he writes can then be exercised on the host by uid 1000.

The point of this set (and the ones before it) is to make it so that
the filecap written by the container root is tagged on disk as belonging
to subuid 100000.

> Why do we need to store all of this state on a per-file basis, instead
> of some kind of per-file system or per-container data structure?

This needs to be writeable by an unprivileged user, with no help from
the admin.  AFAICS that rules out per-fs data structure.

Note we are not assuming a filesystem per container.  The typical case
is (for instance) ~/.local/share/lxc/c1/rootfs being the root of
container c1's filesystem.  Mounting a filesystem from inside a user
namespace is still mostly science fiction today.

> And how many of these security.foo@uid=bar xattrs do you expect there
> to be?  How many "foo", and how many "bar"?

For now I'm expecting two foos - security and ima.  The '@uid=bar' is
generic enough that it *can* be re-used for a different kind of
property if we decide to later, but I have no intention of adding
anything.

Casey has mentioned 'smack=', but i think only to keep the option open.
I don't believe he has concrete plans.

> Maybe I missed the full write up, in which case please send me a link
> to the full writeup --- ideally in the form of a design doc that
> explains the problem statement, gives some examples of how it's going
> to be used, what were the other alternatives that were considered, and
> why they were rejected, etc.

As I'd mentioned in an even older patch, http://lkml.org/lkml/2016/5/18/622 ,
I had considered using a completely separate xattr name, but that would
have required invasive userspace changes.

There's no design doc as such, mainly a progressive series of patches to
lkml.  I am very seriously considering writing a paper to detail both
this design and the user ns design in general, as it has become clear
(in unrelated conversations) there is still a lot of confusiong out
there regarding uid namespaces and targeted capabilities.  But it's not
written yet.

-serge

  reply	other threads:[~2017-07-13  2:34 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 15:05 [PATCH v2] Enable namespaced file capabilities Stefan Berger
2017-07-11 15:05 ` [PATCH v2] xattr: Enable security.capability in user namespaces Stefan Berger
2017-07-11 17:12   ` Serge E. Hallyn
2017-07-12  0:15     ` Stefan Berger
2017-07-12  0:47       ` Serge E. Hallyn
2017-07-12  3:45   ` Serge E. Hallyn
2017-07-12 11:35     ` Stefan Berger
2017-07-12 17:32       ` Serge E. Hallyn
2017-07-12  7:59   ` James Morris
2017-07-12 13:25   ` Eric W. Biederman
2017-07-12 17:03     ` Serge E. Hallyn
2017-07-12 22:20       ` James Morris
2017-07-13  0:33         ` Eric W. Biederman
2017-07-13  1:01           ` Serge E. Hallyn
2017-07-12 23:13       ` Eric W. Biederman
2017-07-13  0:43         ` Serge E. Hallyn
2017-07-13  0:44         ` Stefan Berger
2017-07-13  1:15           ` Theodore Ts'o
2017-07-13  2:34             ` Serge E. Hallyn [this message]
2017-07-13 12:11             ` Eric W. Biederman
2017-07-13 16:40               ` Theodore Ts'o
2017-07-13 17:05                 ` Stefan Berger
2017-07-13 17:39                   ` Eric W. Biederman
2017-07-13 19:14                     ` Theodore Ts'o
2017-07-13 19:41                       ` Serge E. Hallyn
2017-07-13 21:17                     ` Serge E. Hallyn
2017-07-18  7:01                   ` James Morris
2017-07-18 12:12                     ` Stefan Berger
2017-07-18 13:26                       ` Eric W. Biederman
2017-07-18 23:13                         ` Serge E. Hallyn
2017-07-13 17:14                 ` Eric W. Biederman
2017-07-13 17:33                   ` Stefan Berger
2017-07-13 17:49                     ` Eric W. Biederman
2017-07-13 19:48                       ` Serge E. Hallyn
2017-07-13 21:12                         ` Eric W. Biederman
     [not found]                       ` <9a3010e5-ca2b-5e7a-656b-fcc14f7bec4e@linux.vnet.ibm.com>
2017-07-14  0:38                         ` Eric W. Biederman
2017-07-14 11:32                           ` Stefan Berger
2017-07-14 12:04                             ` Eric W. Biederman
2017-07-14 12:39                               ` Stefan Berger
2017-07-14 13:34                             ` Serge E. Hallyn
2017-07-14 15:22                               ` Stefan Berger
2017-07-14 17:35                                 ` Serge E. Hallyn
2017-07-14 18:17                                   ` Eric W. Biederman
2017-07-14 18:48                                   ` Mimi Zohar
2017-07-14 18:52                                     ` James Bottomley
2017-07-14 20:03                                       ` Mimi Zohar
2017-07-14 20:39                                         ` James Bottomley
2017-07-14 21:34                                           ` Theodore Ts'o
2017-07-14 23:22                                             ` Eric W. Biederman
2017-07-14 23:29                                           ` Mimi Zohar
2017-07-14 23:53                                           ` Eric W. Biederman
2017-07-14 19:29                                     ` Theodore Ts'o
2017-07-14 19:43                                       ` Mimi Zohar
     [not found]                                   ` <xagsmtp2.20170714182525.6604@vmsdvm4.vnet.ibm.com>
2017-07-14 19:26                                     ` Mimi Zohar
2017-07-15  0:02                                       ` Eric W. Biederman
     [not found]                                       ` <xagsmtp3.20170715001054.9173@uk1vsc.vnet.ibm.com>
2017-07-16 11:25                                         ` Mimi Zohar
2017-07-26  3:00                                       ` Serge E. Hallyn
2017-07-26 13:57                                         ` Mimi Zohar
2017-07-14 17:36                                 ` Eric W. Biederman
2017-07-14 19:22                                   ` Stefan Berger
2017-07-13 21:21                     ` Serge E. Hallyn
2017-07-13 21:13                 ` Serge E. Hallyn
2017-07-12 17:53   ` Vivek Goyal
2017-07-12 19:19     ` Stefan Berger
2017-07-14 23:41   ` Eric W. Biederman
2017-07-15 21:27     ` Stefan Berger
2017-07-17 18:58   ` Vivek Goyal
2017-07-17 20:50     ` Stefan Berger
2017-07-18 11:48       ` Vivek Goyal
2017-07-18 12:05         ` Stefan Berger
2017-07-18 12:30           ` Vivek Goyal
2017-07-18 12:36             ` Vivek Goyal
2017-07-18 13:29               ` Eric W. Biederman
2017-07-18 13:21             ` Stefan Berger
2017-07-18 14:57               ` Vivek Goyal
2017-07-18 16:11                 ` Stefan Berger

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=20170713023425.GA24103@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=amir73il@gmail.com \
    --cc=casey@schaufler-ca.com \
    --cc=christian.brauner@mailbox.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=tycho@docker.com \
    --cc=tytso@mit.edu \
    --cc=vgoyal@redhat.com \
    --cc=zohar@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).