Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbeAHRWH (ORCPT + 1 other); Mon, 8 Jan 2018 12:22:07 -0500 Received: from mail-yb0-f194.google.com ([209.85.213.194]:42742 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752396AbeAHRWE (ORCPT ); Mon, 8 Jan 2018 12:22:04 -0500 X-Google-Smtp-Source: ACJfBovM0XOG3YsLrzIQKdJr77Uni8rGpmk/bTEJb3gjvyrv4Z79aaBnvGEJ8xEVMdteVLF/6/En21ktCdBSIXSQtpk= MIME-Version: 1.0 In-Reply-To: <20180108154733.GA29416@mail.hallyn.com> References: <20171205223052.12687-1-mahesh@bandewar.net> <20180108062452.GA21717@mail.hallyn.com> <20180108154733.GA29416@mail.hallyn.com> From: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Date: Mon, 8 Jan 2018 09:21:42 -0800 Message-ID: Subject: Re: [PATCHv3 0/2] capability controlled user-namespaces To: "Serge E. Hallyn" Cc: James Morris , LKML , Netdev , Kernel-hardening , Linux API , Kees Cook , "Eric W . Biederman" , Eric Dumazet , David Miller , Mahesh Bandewar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 8, 2018 at 7:47 AM, Serge E. Hallyn wrote: > Quoting James Morris (james.l.morris@oracle.com): >> On Mon, 8 Jan 2018, Serge E. Hallyn wrote: >> >> > > Also, why do we need the concept of a controlled user-ns at all, if the >> > > default whitelist maintains existing behavior? >> > >> > In past discussions two uses have been brought up: >> > >> > 1. if an 0-day is discovered which is exacerbated by a specific >> > privilege in user namespaces, that privilege could be turned off until a >> > reboot with a fixed kernel is scheduled, without fully disabling all >> > containers. >> > >> > 2. some systems may be specifically designed to run software which >> > only requires a few capabilities in a userns. In that case all others >> > could be disabled. >> > >> >> 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 >> behavior of everything allowed. Then, document the semantics of the >> whitelist in terms of inheritance etc., as a feature of user namespaces, >> not as a "type" of user namespace. > > The problem with making them inheritable is that an adversarial user > can just create a user namespace at boot that sits and waits for an > 0day to be published, then log in and attach to that namespace later, > since it has already inherited the open whitelist. > > It feels like there must be some other approach that doesn't feel as... > band-aid-y as this does, but I'm not sure what. We had a long discussion thread about this approach in the past and many of these points have been discussed there. Serge is to the point in terms of both the points (0-day issue as well as sandbox environment). At this moment we are exposed to those threats and apart from this patch-set I'm not aware of anything that handles it. Of course there are other alternatives that block user-ns creation altogether but blocking user-ns is not a real solution that works in every use-case. I'm open other ideas (if any) that do not block creation of user-ns, but lack of those will keep the 0-day issue lingering especially for environments where 'user-ns creation' is used heavily. 'Controlled-user-ns' jargon is within the kernel-space and is not exposed to the users (we don't have any API to do that), but I used those terms to explain within the kernel-community what this patch-set is trying to do. The user-application does not need nor need to know any of these changes as such. However, this additional knob gives admin an ability to control their behavior in those two circumstances. The default behavior that chose in this patch-set is so that it doesn't cause regression to anyone whatever is their use case is but now admin can set whatever default behavior they wish in the boot-scripts to suite their needs. Thanks, --mahesh..