From: Austin S Hemmelgarn <ahferroin7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Tobias Markus <tobias-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: "Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
Serge Hallyn
<serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
Andrew Morton
<akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
"Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] userns/capability: Add user namespace capability
Date: Mon, 19 Oct 2015 10:24:59 -0400 [thread overview]
Message-ID: <5624FD3B.2050401@gmail.com> (raw)
In-Reply-To: <5622700C.9090107-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2971 bytes --]
On 2015-10-17 11:58, Tobias Markus wrote:
> Add capability CAP_SYS_USER_NS.
> Tasks having CAP_SYS_USER_NS are allowed to create a new user namespace
> when calling clone or unshare with CLONE_NEWUSER.
>
> Rationale:
>
> Linux 3.8 saw the introduction of unpriviledged user namespaces,
> allowing unpriviledged users (without CAP_SYS_ADMIN) to be a "fake" root
> inside a separate user namespace. Before that, any namespace creation
> required CAP_SYS_ADMIN (or, in practice, the user had to be root).
> Unfortunately, there have been some security-relevant bugs in the
> meantime. Because of the fairly complex nature of user namespaces, it is
> reasonable to say that future vulnerabilties can not be excluded. Some
> distributions even wholly disable user namespaces because of this.
>
> Both options, user namespaces with and without CAP_SYS_ADMIN, can be
> said to represent the extreme end of the spectrum. In practice, there is
> no reason for every process to have the abilitiy to create user
> namespaces. Indeed, only very few and specialized programs require user
> namespaces. This seems to be a perfect fit for the (file) capability
> system: Priviledged users could manually allow only a certain executable
> to be able to create user namespaces by setting a certain capability,
> I'd suggest the name CAP_SYS_USER_NS. Executables completely unrelated
> to user namespaces should and can not create them.
>
> The capability should only be required in the "root" user namespace (the
> user namespace with level 0) though, to allow nested user namespaces to
> work as intended. If a user namespace has a level greater than 0, the
> original process must have had CAP_SYS_USER_NS, so it is "trusted" anyway.
>
> One question remains though: Does this break userspace executables that
> expect being able to create user namespaces without priviledge? Since
> creating user namespaces without CAP_SYS_ADMIN was not possible before
> Linux 3.8, programs should already expect a potential EPERM upon calling
> clone. Since creating a user namespace without CAP_SYS_USER_NS would
> also cause EPERM, we should be on the safe side.
Potentially stupid counter proposal:
Make it CAP_SYS_NS, make it allow access to all namespace types for
non-root/CAP_SYS_ADMIN users, and teach the stuff that's using userns
just to get to mount/pid/net/ipc namespaces to use those instead when
it's something that doesn't really need to think it's running as root.
While this would still add a new capability (which is arguably not a
good thing), the resultant capability would be significantly more useful
for many of the use cases.
Potentially more flame resistant counter proposal:
Write a simple LSM to allow selective usage of namespaces (IIRC, working
LSM stacking is in mainline now). While this is more complicated than
just adding a capability, it is also a lot more resilient from a long
term prospective.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Austin S Hemmelgarn <ahferroin7@gmail.com>
To: Tobias Markus <tobias@miglix.eu>, linux-kernel@vger.kernel.org
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Al Viro <viro@ZenIV.linux.org.uk>,
Serge Hallyn <serge.hallyn@canonical.com>,
Andrew Morton <akpm@linuxfoundation.org>,
Andy Lutomirski <luto@amacapital.net>,
Christoph Lameter <cl@linux.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
linux-security-module@vger.kernel.org, linux-api@vger.kernel.org,
linux-man@vger.kernel.org
Subject: Re: [PATCH] userns/capability: Add user namespace capability
Date: Mon, 19 Oct 2015 10:24:59 -0400 [thread overview]
Message-ID: <5624FD3B.2050401@gmail.com> (raw)
In-Reply-To: <5622700C.9090107@miglix.eu>
[-- Attachment #1: Type: text/plain, Size: 2971 bytes --]
On 2015-10-17 11:58, Tobias Markus wrote:
> Add capability CAP_SYS_USER_NS.
> Tasks having CAP_SYS_USER_NS are allowed to create a new user namespace
> when calling clone or unshare with CLONE_NEWUSER.
>
> Rationale:
>
> Linux 3.8 saw the introduction of unpriviledged user namespaces,
> allowing unpriviledged users (without CAP_SYS_ADMIN) to be a "fake" root
> inside a separate user namespace. Before that, any namespace creation
> required CAP_SYS_ADMIN (or, in practice, the user had to be root).
> Unfortunately, there have been some security-relevant bugs in the
> meantime. Because of the fairly complex nature of user namespaces, it is
> reasonable to say that future vulnerabilties can not be excluded. Some
> distributions even wholly disable user namespaces because of this.
>
> Both options, user namespaces with and without CAP_SYS_ADMIN, can be
> said to represent the extreme end of the spectrum. In practice, there is
> no reason for every process to have the abilitiy to create user
> namespaces. Indeed, only very few and specialized programs require user
> namespaces. This seems to be a perfect fit for the (file) capability
> system: Priviledged users could manually allow only a certain executable
> to be able to create user namespaces by setting a certain capability,
> I'd suggest the name CAP_SYS_USER_NS. Executables completely unrelated
> to user namespaces should and can not create them.
>
> The capability should only be required in the "root" user namespace (the
> user namespace with level 0) though, to allow nested user namespaces to
> work as intended. If a user namespace has a level greater than 0, the
> original process must have had CAP_SYS_USER_NS, so it is "trusted" anyway.
>
> One question remains though: Does this break userspace executables that
> expect being able to create user namespaces without priviledge? Since
> creating user namespaces without CAP_SYS_ADMIN was not possible before
> Linux 3.8, programs should already expect a potential EPERM upon calling
> clone. Since creating a user namespace without CAP_SYS_USER_NS would
> also cause EPERM, we should be on the safe side.
Potentially stupid counter proposal:
Make it CAP_SYS_NS, make it allow access to all namespace types for
non-root/CAP_SYS_ADMIN users, and teach the stuff that's using userns
just to get to mount/pid/net/ipc namespaces to use those instead when
it's something that doesn't really need to think it's running as root.
While this would still add a new capability (which is arguably not a
good thing), the resultant capability would be significantly more useful
for many of the use cases.
Potentially more flame resistant counter proposal:
Write a simple LSM to allow selective usage of namespaces (IIRC, working
LSM stacking is in mainline now). While this is more complicated than
just adding a capability, it is also a lot more resilient from a long
term prospective.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]
next prev parent reply other threads:[~2015-10-19 14:24 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-17 15:58 [PATCH] userns/capability: Add user namespace capability Tobias Markus
2015-10-17 15:58 ` Tobias Markus
[not found] ` <5622700C.9090107-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org>
2015-10-17 20:17 ` Richard Weinberger
2015-10-17 20:17 ` Richard Weinberger
2015-10-18 20:13 ` Tobias Markus
[not found] ` <5623FD86.2030609-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org>
2015-10-18 20:21 ` Richard Weinberger
2015-10-18 20:21 ` Richard Weinberger
[not found] ` <5623FF36.8080800-/L3Ra7n9ekc@public.gmane.org>
2015-10-18 20:41 ` Tobias Markus
2015-10-18 20:41 ` Tobias Markus
2015-10-18 20:48 ` Richard Weinberger
[not found] ` <56240599.3050903-/L3Ra7n9ekc@public.gmane.org>
2015-10-18 21:49 ` Tobias Markus
2015-10-18 21:49 ` Tobias Markus
2015-10-18 22:06 ` Richard Weinberger
2015-10-19 0:28 ` Mike Frysinger
2015-10-19 0:28 ` Mike Frysinger
2015-10-17 21:55 ` Serge E. Hallyn
2015-10-17 21:55 ` Serge E. Hallyn
[not found] ` <20151017215501.GA22900-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2015-10-18 20:13 ` Tobias Markus
2015-10-18 20:13 ` Tobias Markus
[not found] ` <5623FD82.4030902-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org>
2015-10-19 1:41 ` Serge E. Hallyn
2015-10-19 1:41 ` Serge E. Hallyn
[not found] ` <20151019014112.GA1683-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2015-10-19 12:36 ` Yves-Alexis Perez
2015-10-19 12:36 ` Yves-Alexis Perez
[not found] ` <1445258180.4099.18.camel-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2015-10-19 12:48 ` Richard Weinberger
2015-10-19 12:48 ` Richard Weinberger
2015-10-22 20:45 ` Eric W. Biederman
2015-10-22 20:45 ` Eric W. Biederman
2015-10-22 20:45 ` Eric W. Biederman
[not found] ` <87twpi63ai.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2015-10-22 21:02 ` Andy Lutomirski
2015-10-22 21:02 ` Andy Lutomirski
2015-10-22 21:02 ` Andy Lutomirski
[not found] ` <CALCETrWKN+Uzw_TYqVTGatNZ3LT5RbSM1WuYPoXeKQs9Yw_qjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-22 21:44 ` Eric W. Biederman
2015-10-22 21:44 ` Eric W. Biederman
2015-10-22 21:44 ` Eric W. Biederman
2015-10-19 14:24 ` Austin S Hemmelgarn [this message]
2015-10-19 14:24 ` Austin S Hemmelgarn
[not found] ` <5624FD3B.2050401-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-21 18:53 ` Andy Lutomirski
2015-10-21 18:53 ` Andy Lutomirski
[not found] ` <CALCETrWfZ9hXvLPtJnZhU-ZdoUbYNo-QSydMPvP6Q7Rp0oCQaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-21 19:13 ` Austin S Hemmelgarn
2015-10-21 19:13 ` Austin S Hemmelgarn
2015-10-22 17:10 ` Andy Lutomirski
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=5624FD3B.2050401@gmail.com \
--to=ahferroin7-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=tobias-gyUQdkDHmHmHXe+LvDLADg@public.gmane.org \
--cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@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 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.