All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: "Mahesh Bandewar (महेश बंडेवार)" <maheshb@google.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	James Morris <james.l.morris@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>,
	Kernel-hardening <kernel-hardening@lists.openwall.com>,
	Linux API <linux-api@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Eric Dumazet <edumazet@google.com>,
	David Miller <davem@davemloft.net>,
	Mahesh Bandewar <mahesh@bandewar.net>
Subject: [kernel-hardening] Re: [PATCHv3 0/2] capability controlled user-namespaces
Date: Mon, 8 Jan 2018 12:36:10 -0600	[thread overview]
Message-ID: <20180108183610.GA562@mail.hallyn.com> (raw)
In-Reply-To: <CAF2d9jgar8J+mQjUfF=+XdvrcS=RvtOpKysxOiZkG-rXgm0KVw@mail.gmail.com>

Quoting Mahesh Bandewar (महेश बंडेवार) (maheshb@google.com):
> On Mon, Jan 8, 2018 at 10:11 AM, Serge E. Hallyn <serge@hallyn.com> wrote:
> > Quoting Mahesh Bandewar (महेश बंडेवार) (maheshb@google.com):
> >> On Mon, Jan 8, 2018 at 7:47 AM, Serge E. Hallyn <serge@hallyn.com> wrote:
> >> > Quoting James Morris (james.l.morris@oracle.com):
> >> >> On Mon, 8 Jan 2018, Serge E. Hallyn wrote:
> >> >> I meant in terms of "marking" a user ns as "controlled" type -- it's
> >> >> unnecessary jargon from an end user point of view.
> >> >
> >> > Ah, yes, that was my point in
> >> >
> >> > http://lkml.iu.edu/hypermail/linux/kernel/1711.1/01845.html
> >> > and
> >> > http://lkml.iu.edu/hypermail/linux/kernel/1711.1/02276.html
> >> >
> >> >> This may happen internally but don't make it a special case with a
> >> >> different name and don't bother users with internal concepts: simply
> >> >> implement capability whitelists with the default having equivalent
> >
> > So the challenge is to have unprivileged users be contained, while
> > allowing trusted workloads in containers created by a root user to
> > bypass the restriction.
> >
> > Now, the current proposal actually doesn't support a root user starting
> > an application that it doesn't quite trust in such a way that it *is*
> > subject to the whitelist.
> 
> Well, this is not hard since root process can spawn another process
> and loose privileges before creating user-ns to be controlled by the
> whitelist.

It would have to drop cap_sys_admin for the container to be marked as
"controlled", which may prevent the container runtime from properly starting
the container.

> You need an ability to preserve the creation of user-namespaces that
> exhibit 'the uncontrolled behavior' and only trusted/privileged (root)
> user should have it which is maintained here.
> 
> > Which is unfortunate.  But apart from using
> > ptags or a cgroup, I can't think of a good way to get us everything we
> > want:
> >
> > 1. unprivileged users always restricted
> > 2. existing unprivileged containers become restricted when whitelist
> > is enabled
> > 3. privileged users are able to create containers which are not restricted
> 
> all this is achieved by the patch-set without any changes to the
> application with the above knob.
> 
> > 4. privileged users are able to create containers which *are* restricted
> >
> With this patch-set; the root user process can fork another process
> with less privileges before creating a user-ns if the exec-ed process
> cannot be trusted. So there is a way with little modification as
> opposed to nothing available at this moment for this scenario.

WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serge@hallyn.com>
To: "Mahesh Bandewar (महेश बंडेवार)" <maheshb@google.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	James Morris <james.l.morris@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>,
	Kernel-hardening <kernel-hardening@lists.openwall.com>,
	Linux API <linux-api@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Eric Dumazet <edumazet@google.com>,
	David Miller <davem@davemloft.net>,
	Mahesh Bandewar <mahesh@bandewar.net>
Subject: Re: [PATCHv3 0/2] capability controlled user-namespaces
Date: Mon, 8 Jan 2018 12:36:10 -0600	[thread overview]
Message-ID: <20180108183610.GA562@mail.hallyn.com> (raw)
In-Reply-To: <CAF2d9jgar8J+mQjUfF=+XdvrcS=RvtOpKysxOiZkG-rXgm0KVw@mail.gmail.com>

Quoting Mahesh Bandewar (महेश बंडेवार) (maheshb@google.com):
> On Mon, Jan 8, 2018 at 10:11 AM, Serge E. Hallyn <serge@hallyn.com> wrote:
> > Quoting Mahesh Bandewar (महेश बंडेवार) (maheshb@google.com):
> >> On Mon, Jan 8, 2018 at 7:47 AM, Serge E. Hallyn <serge@hallyn.com> wrote:
> >> > Quoting James Morris (james.l.morris@oracle.com):
> >> >> On Mon, 8 Jan 2018, Serge E. Hallyn wrote:
> >> >> I meant in terms of "marking" a user ns as "controlled" type -- it's
> >> >> unnecessary jargon from an end user point of view.
> >> >
> >> > Ah, yes, that was my point in
> >> >
> >> > http://lkml.iu.edu/hypermail/linux/kernel/1711.1/01845.html
> >> > and
> >> > http://lkml.iu.edu/hypermail/linux/kernel/1711.1/02276.html
> >> >
> >> >> This may happen internally but don't make it a special case with a
> >> >> different name and don't bother users with internal concepts: simply
> >> >> implement capability whitelists with the default having equivalent
> >
> > So the challenge is to have unprivileged users be contained, while
> > allowing trusted workloads in containers created by a root user to
> > bypass the restriction.
> >
> > Now, the current proposal actually doesn't support a root user starting
> > an application that it doesn't quite trust in such a way that it *is*
> > subject to the whitelist.
> 
> Well, this is not hard since root process can spawn another process
> and loose privileges before creating user-ns to be controlled by the
> whitelist.

It would have to drop cap_sys_admin for the container to be marked as
"controlled", which may prevent the container runtime from properly starting
the container.

> You need an ability to preserve the creation of user-namespaces that
> exhibit 'the uncontrolled behavior' and only trusted/privileged (root)
> user should have it which is maintained here.
> 
> > Which is unfortunate.  But apart from using
> > ptags or a cgroup, I can't think of a good way to get us everything we
> > want:
> >
> > 1. unprivileged users always restricted
> > 2. existing unprivileged containers become restricted when whitelist
> > is enabled
> > 3. privileged users are able to create containers which are not restricted
> 
> all this is achieved by the patch-set without any changes to the
> application with the above knob.
> 
> > 4. privileged users are able to create containers which *are* restricted
> >
> With this patch-set; the root user process can fork another process
> with less privileges before creating a user-ns if the exec-ed process
> cannot be trusted. So there is a way with little modification as
> opposed to nothing available at this moment for this scenario.

  reply	other threads:[~2018-01-08 18:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 22:30 [kernel-hardening] [PATCHv3 0/2] capability controlled user-namespaces Mahesh Bandewar
2017-12-05 22:30 ` Mahesh Bandewar
2017-12-27 17:09 ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2017-12-27 17:09   ` Mahesh Bandewar (महेश बंडेवार)
2017-12-27 17:09   ` Mahesh Bandewar (महेश बंडेवार)
2017-12-27 20:23   ` [kernel-hardening] " Michael Kerrisk (man-pages)
2017-12-27 20:23     ` Michael Kerrisk (man-pages)
2017-12-28  0:45     ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2017-12-28  0:45       ` Mahesh Bandewar (महेश बंडेवार)
2017-12-30  8:50       ` [kernel-hardening] " Michael Kerrisk (man-pages)
2017-12-30  8:50         ` Michael Kerrisk (man-pages)
2017-12-30  8:50         ` Michael Kerrisk (man-pages)
2018-01-03  1:35         ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-03  1:35           ` Mahesh Bandewar (महेश बंडेवार)
2017-12-30  8:31   ` [kernel-hardening] " James Morris
2017-12-30  8:31     ` James Morris
2018-01-03  1:30     ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-03  1:30       ` Mahesh Bandewar (महेश बंडेवार)
2018-01-08  0:35       ` [kernel-hardening] " James Morris
2018-01-08  0:35         ` James Morris
2018-01-08  6:24         ` [kernel-hardening] " Serge E. Hallyn
2018-01-08  6:24           ` Serge E. Hallyn
2018-01-08  9:51           ` [kernel-hardening] " James Morris
2018-01-08  9:51             ` James Morris
2018-01-08 15:47             ` [kernel-hardening] " Serge E. Hallyn
2018-01-08 15:47               ` Serge E. Hallyn
2018-01-08 15:47               ` Serge E. Hallyn
2018-01-08 17:21               ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-08 17:21                 ` Mahesh Bandewar (महेश बंडेवार)
2018-01-08 18:11                 ` [kernel-hardening] " Serge E. Hallyn
2018-01-08 18:11                   ` Serge E. Hallyn
2018-01-08 18:11                   ` Serge E. Hallyn
2018-01-08 18:24                   ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-08 18:24                     ` Mahesh Bandewar (महेश बंडेवार)
2018-01-08 18:36                     ` Serge E. Hallyn [this message]
2018-01-08 18:36                       ` Serge E. Hallyn
2018-01-08 18:55                       ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-08 18:55                         ` Mahesh Bandewar (महेश बंडेवार)
2018-01-09 22:28                         ` [kernel-hardening] " Serge E. Hallyn
2018-01-09 22:28                           ` Serge E. Hallyn
2018-01-10  2:08                           ` [kernel-hardening] " Mahesh Bandewar (महेश बंडेवार)
2018-01-10  2:08                             ` Mahesh Bandewar (महेश बंडेवार)
2018-01-10  2:08                             ` Mahesh Bandewar (महेश बंडेवार)

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=20180108183610.GA562@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=james.l.morris@oracle.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahesh@bandewar.net \
    --cc=maheshb@google.com \
    --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.