Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp58372ybk; Thu, 14 May 2020 16:08:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9oFXVgi7wyjOS3YVJGZ7ZZtpv5CR2diN7YhypbTnrwlHFgmLQSFPq6vy+b8iEx7bopwYf X-Received: by 2002:a17:906:5608:: with SMTP id f8mr361719ejq.190.1589497720887; Thu, 14 May 2020 16:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589497720; cv=none; d=google.com; s=arc-20160816; b=XLcmETdCFssiUq2pV0v8pidc6kNIeLiq69hXcNDUG8JTmiWVnNKitujjiLsEMhwp0M jqh7HfsWhl2svR32loBH/Q/NbqwsthRGuHD8CCKWX8heV8WLwdw9qGr/xqz5TkSXNt3L KvjNli3CHUrNF26Ooay1kbZBVJM22kmrOU6Og1R63wTJb5zPF8eE1N2m7rv7RP3y44fX QDtd1E1MxNC5/d/yUiCOoeB/zj2UHUg/TQh3nM80TXRrYRDDspWnq1E07aLQzijPtmtI NqUuKvf6xkkEt7AZ1l2QPKsRQrCBAikZd5SuHdFuL5RZOh6j+OYPDziaCpFNAttj1T+7 IwHw== 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; bh=MGjjfSqcHvBetGLnQPpq1AWA2UPjOjI5TqB3rvL/1us=; b=rne8CAnaRt7XcTTmKE6cR/GsB3e75Yq3Io7Heu/a6LFh6GDLeDp15Sx8zB31q5QUKq pbqjMcaK+D7aAFzP7WRZG7DLZuK5h4Xysg059Fq0jL1385VTWU4/wcFz5dxC9p/jN2ZF ZvS7U/YGHOOWUoHMYWSo/HMjk5b441zL08znYzk9ZKPvsu2TvD8VRoFiCTXDqp/TN81s abc7RM48cm/rc/ipudgkOh/yHGnWL0zlQj/aICFFj6H1yp8oC3xAp2ftnwDpG9Mxae1r O7/tZQQIA1/2BwbMZVLZlr2Sy2vqIv1iOyNCLvKbpm4snnQ3BQKZBpbOIpKc+cVTGTaS CZCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si123334edo.310.2020.05.14.16.08.17; Thu, 14 May 2020 16:08:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728215AbgENT2T (ORCPT + 99 others); Thu, 14 May 2020 15:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726132AbgENT2T (ORCPT ); Thu, 14 May 2020 15:28:19 -0400 Received: from smtp-8fad.mail.infomaniak.ch (smtp-8fad.mail.infomaniak.ch [IPv6:2001:1600:3:17::8fad]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09427C061A0C for ; Thu, 14 May 2020 12:28:19 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 49NM5Y60DmzlhGVS; Thu, 14 May 2020 21:28:17 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [94.23.54.103]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 49NM5X23j6zljVWn; Thu, 14 May 2020 21:28:16 +0200 (CEST) Subject: Re: [RFC PATCH v3 00/12] Integrity Policy Enforcement LSM (IPE) To: Deven Bowers , agk@redhat.com, axboe@kernel.dk, snitzer@redhat.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, dm-devel@redhat.com, linux-block@vger.kernel.org, jannh@google.com Cc: tyhicks@linux.microsoft.com, pasha.tatashin@soleen.com, sashal@kernel.org, jaskarankhurana@linux.microsoft.com, nramas@linux.microsoft.com, mdsakib@linux.microsoft.com, linux-kernel@vger.kernel.org, corbet@lwn.net References: <20200415162550.2324-1-deven.desai@linux.microsoft.com> <0001755a-6b2a-b13b-960c-eb0b065c8e3c@linux.microsoft.com> <8ba7b15f-de91-40f7-fc95-115228345fce@linux.microsoft.com> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <44fb36ae-959d-4ff7-ed1f-ccfc2e292232@digikod.net> Date: Thu, 14 May 2020 21:28:15 +0200 User-Agent: MIME-Version: 1.0 In-Reply-To: <8ba7b15f-de91-40f7-fc95-115228345fce@linux.microsoft.com> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/05/2020 22:46, Deven Bowers wrote: > > > On 5/11/2020 11:03 AM, Deven Bowers wrote: >> >> >> On 5/10/2020 2:28 AM, Micka?l Sala?n wrote: >> >> [...snip] >> >>>> >>>> Additionally, rules are evaluated top-to-bottom. As a result, any >>>> revocation rules, or denies should be placed early in the file to >>>> ensure >>>> that these rules are evaluated before a rule with "action=ALLOW" is >>>> hit. >>>> >>>> IPE policy is designed to be forward compatible and backwards >>>> compatible, >>>> thus any failure to parse a rule will result in the line being ignored, >>>> and a warning being emitted. If backwards compatibility is not >>>> required, >>>> the kernel commandline parameter and sysctl, ipe.strict_parse can be >>>> enabled, which will cause these warnings to be fatal. >>> >>> Ignoring unknown command may lead to inconsistent beaviors. To achieve >>> forward compatibility, I think it would be better to never ignore >>> unknown rule but to give a way to userspace to known what is the current >>> kernel ABI. This could be done with a securityfs file listing the >>> current policy grammar. >>> >> >> That's a fair point. From a manual perspective, I think this is fine. >> A human-user can interpret a grammar successfully on their own when new >> syntax is introduced. >> >> ?From a producing API perspective, I'd have to think about it a bit >> more. Ideally, the grammar would be structured in such a way that the >> userland >> interpreter of this grammar would not have to be updated once new syntax >> is introduced, avoiding the need to update the userland binary. To do so >> generically ("op=%s") is easy, but doesn't necessarily convey sufficient >> information (what happens when a new "op" token is introduced?). I think >> this may come down to regular expression representations of valid values >> for these tokens, which worries me as regular expressions are incredibly >> error-prone[1]. >> >> I'll see what I can come up with regarding this. > > I have not found a way that I like to expose some kind of grammar > through securityfs that can be understood by usermode to parse the > policy. Here's what I propose as a compromise: > > ????1. I remove the unknown command behavior. This address your > first point about inconsistent behaviors, and effectively removes the > strict_parse sysctl (as it is always enabled). > > ????2. I introduce a versioning system for the properties > themselves. The valid set of properties and their versions > can be found in securityfs, under say, ipe/config in a key=value > format where `key` indicates the understood token, and `value` > indicates their current version. For example: > > ????$ cat $SECURITYFS/ipe/config > ????op=1 > ????action=1 > ????policy_name=1 > ????policy_version=1 > ????dmverity_signature=1 > ????dmverity_roothash=1 > ????boot_verified=1 The name ipe/config sounds like a file to configure IPE. Maybe something like ipe/config_abi or ipe/config_grammar? > > if new syntax is introduced, the version number is increased. > > ????3. The format of those versions are documented as part of > the admin-guide around IPE. If user-mode at that point wants to rip > the documentation formats and correlate with the versioning, then > it fulfills the same functionality as above, with out the complexity > around exposing a parsing grammar and interpreting it on-the-fly. > Many of these are unlikely to move past version 1, however. > > Thoughts? > That seems reasonable.