Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1661674ioo; Sun, 22 May 2022 23:27:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykE5Z2xxDy8iQzKM8lpHtPZAS28/tdyvxU9DQSWgfblZYDIENxpRs8I3Bygi0eG0nfEbTO X-Received: by 2002:a63:7d3:0:b0:3f6:885:cd22 with SMTP id 202-20020a6307d3000000b003f60885cd22mr19289704pgh.143.1653287264821; Sun, 22 May 2022 23:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653287264; cv=none; d=google.com; s=arc-20160816; b=tEkhbIFvhpWIDrkSf6h8kE2coz517+V7v7iS8YrAwd0uJwTxYXfrlj33c+82xW8iMF lw73u70TlKMYG53JiYRnUyXn0Ed3REJj26lqjPe33Fj1axul1qU4WWiMRsgwL0D8B7yj JNqXptahdWN13NvJI6U/4dM1NgUsb2yC5zdM9qxcOp6NhckfJV0VWeMB+Q4fyFXhP59p yAvUn+F3u1v6sbM6D2TPmcGrFBXzLU/NZlyLXlefhHz/vugYLPphFzT0/B9gfIbjggdJ H7vUnOUE1otkWXRJ7V293m8BqnuSjIZ1/VLR3CV+aIvkpNigkgksC+Jm/tQQkg+1LKs+ jxiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=hwZ5KNbFhOBL22IXGn3O9sQeY3SCQYYIg2vGuUvPLCc=; b=hfSLA0C9hQWVUm+XKOt+6yEcxi5W8fwArSjHBBrzI526SZf6CSS2iJ1uCzjbtZObDI mE3x/BMqkaE3tibJ5351DIL2tsrOouG3aleBe37BvFmHwy6AeazY4BQDtJTAM7ath3Jg pj5sOhK3B3k9e7fMjOKi3UksqzRC4YYjTWmXfBe+jdluJ5X7c+NjZBpugtBncyYi3Ole aQZCPTXxKB4SiU7IjrvRxRsW0Wu8TDjXJN5hxgP2oCtNY+MhwwMdbe1FhffGte+TxCF3 57NUW+XlEYbyjui6QH+LVyOt7KN/yD1e2PRU0PFVlvZmFxk1lctWAEbSU75Bh2NC/mj0 nNCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mw7-20020a17090b4d0700b001e043762a1esi4239411pjb.76.2022.05.22.23.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B09899FF6; Sun, 22 May 2022 23:06:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349799AbiEVRit (ORCPT + 99 others); Sun, 22 May 2022 13:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbiEVRir (ORCPT ); Sun, 22 May 2022 13:38:47 -0400 Received: from mail.hallyn.com (mail.hallyn.com [178.63.66.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622B714086; Sun, 22 May 2022 10:38:46 -0700 (PDT) Received: by mail.hallyn.com (Postfix, from userid 1001) id A91883F4; Sun, 22 May 2022 12:38:44 -0500 (CDT) Date: Sun, 22 May 2022 12:38:44 -0500 From: "Serge E. Hallyn" To: Stefan Berger Cc: linux-integrity@vger.kernel.org, zohar@linux.ibm.com, serge@hallyn.com, christian.brauner@ubuntu.com, containers@lists.linux.dev, dmitry.kasatkin@gmail.com, ebiederm@xmission.com, krzysztof.struczynski@huawei.com, roberto.sassu@huawei.com, mpeters@redhat.com, lhinds@redhat.com, lsturman@redhat.com, puiterwi@redhat.com, jejb@linux.ibm.com, jamjoom@us.ibm.com, linux-kernel@vger.kernel.org, paul@paul-moore.com, rgb@redhat.com, linux-security-module@vger.kernel.org, jmorris@namei.org, jpenumak@redhat.com, Christian Brauner Subject: Re: [PATCH v12 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Message-ID: <20220522173844.GA24519@mail.hallyn.com> References: <20220420140633.753772-1-stefanb@linux.ibm.com> <20220420140633.753772-13-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220420140633.753772-13-stefanb@linux.ibm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 20, 2022 at 10:06:19AM -0400, Stefan Berger wrote: > Only accept AUDIT rules for non-init_ima_ns namespaces for now. Reject This sentence gives me trouble - i keep thinking you mean that you'll reject AUDIT rules for init_ima_ns :) Can you rephrase it as something like For non-init_ima_ns namespaces, only accept AUDIT rules for now. :) > all rules that require support for measuring, appraisal, and hashing. > > Signed-off-by: Stefan Berger > Acked-by: Christian Brauner > Reviewed-by: Mimi Zohar > > --- > v9: > - Jump to err_audit when unsupported rules are detected > --- > security/integrity/ima/ima_policy.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c > index 59e4ae5a6361..45a997709200 100644 > --- a/security/integrity/ima/ima_policy.c > +++ b/security/integrity/ima/ima_policy.c > @@ -1812,6 +1812,17 @@ static int ima_parse_rule(struct ima_namespace *ns, > result = -EINVAL; > break; > } > + > + /* IMA namespace only accepts AUDIT rules */ > + if (ns != &init_ima_ns && result == 0) { > + switch (entry->action) { > + case MEASURE: > + case APPRAISE: > + case HASH: So... what about DONT_MEASURE and DONT_APPRAISE? > + result = -EINVAL; > + goto err_audit; > + } > + } > } > if (!result && !ima_validate_rule(entry)) > result = -EINVAL; > @@ -1824,6 +1835,7 @@ static int ima_parse_rule(struct ima_namespace *ns, > check_template_modsig(template_desc); > } > > +err_audit: > audit_log_format(ab, "res=%d", !result); > audit_log_end(ab); > return result; > -- > 2.34.1