Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp316244imm; Wed, 3 Oct 2018 16:59:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV613BL+o8sfqv9CbNLvT62ReLZ5TsCsnSTUS1x6qdkpndkZJ6sYv583lVmFZTFMjeHpYkn00 X-Received: by 2002:a65:41c6:: with SMTP id b6-v6mr3428806pgq.421.1538611185609; Wed, 03 Oct 2018 16:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538611185; cv=none; d=google.com; s=arc-20160816; b=axS4EfkwWmpTzeMZlVG3V2BaR7a45Y42xM8Ui6Rd5eyGYTuht9ibcJIXRCOLqoOkfX wy6LCZXfKy6bM9XO3aSK7DMzOqUdd6ygr6jqQxS/B4wOkweQHF4Kvnv+JKnHJHOOVEr6 XKua+vKlQh09+mdWXoAdZ9hSSIgikLRcVP0EBNftlFltAhuDhxajERyK7ImoKNI51lQe ZXDzqGuCZSx1BpfptJG8nFyJo7r0FhLMTTDNbQG5FohfWBzEVkRCpU/0ybr6pYNUJdom S3fKFMiwzfoatkesL5nJDboB8LQnqyjy2Kh4pbcEu2afVB/J04JNUBqK9OGvD98EWeyi putA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=J8Um7wOTs7+LNqCXjmCPvRDKnDrmMFx46BQc16JWLJk=; b=i1MGKu6BIB598l/0WBbtEsbujzp0Mga0I5nXg6USmqkZ7+lHsipi2CtsqKRTREQ4Up /aEhvOk7ZEKuIh2BjadfIn7ykR7D0du6f46gNKF1fRjikO/MaN4GnwxNhM5KztT5LkQV thWpB7+i1XG4pGP9fHqR8NwFR/TUYkykeQKC5Bshh4+1bMQ2VLh3LHK9fEmJY1Psx1am YrkKaLz5GfopAOOir56S2Ff1qvjKvt0f8EB+W6jvZFSZigjMv97PYjz42eQ97ogvUS3+ POZtxcV3dv5KY16rXHPY8hmVIvmX1fZ/4f0T8WDLAKPUMyi5kj+4dDCzA5y7BqHZTXwv e2IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="XPA0x/gS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6-v6si3053166pls.17.2018.10.03.16.59.29; Wed, 03 Oct 2018 16:59:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="XPA0x/gS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbeJDGuB (ORCPT + 99 others); Thu, 4 Oct 2018 02:50:01 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41464 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbeJDGuB (ORCPT ); Thu, 4 Oct 2018 02:50:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=J8Um7wOTs7+LNqCXjmCPvRDKnDrmMFx46BQc16JWLJk=; b=XPA0x/gSZ+jV3Twd1+agGRzfD +QXFh7rQPKSuXRbDaNFFUmAVUXH2icyhk3JLlBt+pCmaHMCaMA+lMXS7MF1V7962msjge5tdJjTKo CPpAnIUln6mM6xTJWOEuvMfqbDXkDL/61hK3o2hVbH9QUaQTECWnHl6ExISSRFdhAZhT6AedxaWKC cNr5NwSVi5k2hydbBjqLssvq0p0RzT1//CGPFWav8khgiHZw4Tyy1gI6Daurwu+9q/WcjBZEC3wgq rw+0vf/hFxLpm6lxAQXTaViw4otVy+mtZV95ZHH+Aj60POpIS4Up3VyReH/HLHDYF7FLdoX/TP9TV GcbLyhaiA==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7r30-0002db-Da; Wed, 03 Oct 2018 23:59:18 +0000 Subject: Re: [PATCH security-next v4 23/32] selinux: Remove boot parameter To: Kees Cook , James Morris Cc: John Johansen , Jordan Glover , Stephen Smalley , Paul Moore , Casey Schaufler , Tetsuo Handa , "Schaufler, Casey" , linux-security-module , Jonathan Corbet , "open list:DOCUMENTATION" , linux-arch , LKML References: <20181002005505.6112-1-keescook@chromium.org> <809f1cfd-077b-ee58-51ba-b22daf46d12b@tycho.nsa.gov> <5955f5ce-b803-4f58-8b07-54c291e33da5@canonical.com> From: Randy Dunlap Message-ID: <6037a1f0-7af1-9847-91f6-6444f04f5b21@infradead.org> Date: Wed, 3 Oct 2018 16:59:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/3/18 4:55 PM, Kees Cook wrote: > On Wed, Oct 3, 2018 at 2:34 PM, James Morris wrote: >> On Wed, 3 Oct 2018, Kees Cook wrote: >> >>> On Wed, Oct 3, 2018 at 11:28 AM, James Morris wrote: >>>> On Wed, 3 Oct 2018, Kees Cook wrote: >>>> >>>>> On Wed, Oct 3, 2018 at 11:17 AM, James Morris wrote: >>>>>> On Tue, 2 Oct 2018, John Johansen wrote: >>>>>>> To me a list like >>>>>>> lsm.enable=X,Y,Z >>>>>> >>>>>> What about even simpler: >>>>>> >>>>>> lsm=selinux,!apparmor,yama >>>>> >>>>> We're going to have lsm.order=, so I'd like to keep it with a dot >>>>> separator (this makes it more like module parameters, too). You want >>>>> to mix enable/disable in the same string? That implies you'd want >>>>> implicit enabling (i.e. it complements the builtin enabling), which is >>>>> opposite from what John wanted. >>>>> >>>> >>>> Why can't this be the order as well? >>> >>> That was covered extensively in the earlier threads. It boils down to >>> making sure we do not create a pattern of leaving LSMs disabled by >>> default when they are added to the kernel. The v1 series used >>> security= like this: >>> >>> + security= [SECURITY] An ordered comma-separated list of >>> + security modules to attempt to enable at boot. If >>> + this boot parameter is not specified, only the >>> + security modules asking for initialization will be >>> + enabled (see CONFIG_DEFAULT_SECURITY). Duplicate >>> + or invalid security modules will be ignored. The >>> + capability module is always loaded first, without >>> + regard to this parameter. >>> >>> This meant booting "security=apparmor" would disable all the other >>> LSMs, which wasn't friendly at all. So "security=" was left alone (to >>> leave it to only select the "major" LSM: all major LSMs not matching >>> "security=" would be disabled). So I proposed "lsm.order=" to specify >>> the order things were going to be initialized in, but to avoid kernels >>> booting with newly added LSMs forced-off due to not being listed in >>> "lsm.order=", it had to have implicit fall-back for unlisted LSMs. >>> (i.e. anything missing from lsm.order would then follow their order in >>> CONFIG_LSM_ORDER, and anything missing there would fall back to >>> link-time ordering.) However, then the objection was raised that this >>> didn't provide a way to explicitly disable an LSM. So I proposed >>> lsm.enable/disable, and John argued for CONFIG_LSM_ENABLE over >>> CONFIG_LSM_DISABLE. >> >> Ok, but it may end up being clearer, simpler, and thus more secure to just >> have a single way to configure LSM. >> >> For example: >> >> - All LSMs which are built are NOT enabled by default >> >> - You specify enablement and order via a Kconfig: >> >> CONFIG_LSM="selinux,yama" >> >> - This can be entirely overridden by a boot param: >> >> lsm="apparmor,landlock" > > This doesn't work with how SELinux and AppArmor do their bootparams, > unfortunately. (And Paul and Stephen have expressed that the > documented selinux on/off must continue to work.) For example, let's > say you've built an Ubuntu kernel with: > > CONFIG_SELINUX=y > ... > CONFIG_LSM="yama,apparmor" > > (i.e. you want SELinux available, but not enabled, so it's left out of > CONFIG_LSM) > > Then someone boots the system with: > > selinux=1 security=selinux > > In what order does selinux get initialized relative to yama? > (apparmor, flagged as a "legacy major", would have been disabled by > the "security=" not matching it.) > To me, "security=selinux" means SELinux and nothing else, so I think that all of these params are inviting a lot of confusion. Sorry, I don't have a good answer for this. > > The LSM order needs to be defined externally to enablement because > something may become enabled when not listed in the order. > > Now, maybe I misunderstood your earlier suggestion, and what you meant > was to do something like: > > CONFIG_LSM="yama,apparmor,!selinux" > > to mean "put selinux here in the order, but don't enable it". Then the > problem becomes what happens to an LSM that has been built in but not > listed in CONFIG_LSM? > > Related to that, this means that when new LSMs are added, they will > need to be added to any custom CONFIG_LSM= or lsm= parameters. If > that's really how we have to go, I'll accept it, but I think it's a > bit unfriendly. :P > > Another reason I don't like it is because it requires users to know > about all the LSMs to make changes. One LSM can't be added/removed > without specifying ALL of the LSMs. (i.e. there is no trivial way to > enable/disable a single LSM without it growing its own enable/disable > code as in SELinux/AppArmor. I'd hoped to make that easier for both > users and developers.) Again, I can live with it, but I think it's > unfriendly. > > I just want to have a direct I can go that meets all the requirements. > :) I'm fine to ignore my sense of aesthetics if everyone can agree on > the code. -- ~Randy