Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3779945ioo; Wed, 25 May 2022 08:02:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1qecSVF7L8/1AQLl8w6OCloiXWI+d9vdT5YIhhMfTeWWMPTXLy2OX9NrbwXMDt1fNsU92 X-Received: by 2002:a17:907:970c:b0:6fe:fd7a:9664 with SMTP id jg12-20020a170907970c00b006fefd7a9664mr10264866ejc.99.1653490936331; Wed, 25 May 2022 08:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653490936; cv=none; d=google.com; s=arc-20160816; b=W6GESXUE+v6PeKwle9nxgLwqGtRjzpPqeiVblNXz9usRWtXef0zW+DQnFeZpIL1kD5 looEcn8SWZagbV+h1uoFSNm7MPJb3AFiIHZ+opgGGqV0dhXli+TE5ojiaEiD/PBEhjBZ BvJ57NqNbALXws1FzUnbyWYghI5zusOYczXGrKnqctS1Wi63MTSTEqi8mThTuzn7cwDs Qh+PFmm8i3SFYo3G1ycKRuAmqY1WEWOFhQujZUOdTTjOLFrub+4WABZNVquTELgNPmC0 mrloDY5e6Xr+If9UdHdN4PChcN5l6quWToxh2ncWy/j1odNQETvbhTY6HqaOvbffLe22 irKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hBbcMrX9s6JSpr08mbOB4SZ6XiS2E7eqbNX1M5D5MBY=; b=JSXLk08cr9jpKDtwIGIpxjz7ZjeJFYTk+CRy9UfFmIRIhqG5hePsylT1uDT7/WcZWI FgRVq/MqjS+e8mPNgeDzN6awAjtbKKjA1hHPOsedZD5aeDasbl36qHLu5GHQ1Qsux7zT m8Fr/2W2Gp/4Fpk8SLQyvgVW/SpjcPCsOIoqh0dN40mwSgMlng6jIhfIcWzn6ickpwq+ oGI66cJcVtAaW9APRTyYl6HznxWdTNmeoBibKLWCikwg+4tCjWiwzLwpIERbbCMEZyb4 1cqJLd7hymbb57lrn0ziZqJrq/tYRUMS1AIxkheU7IrXdWfvZyEn86Ii13P4P/Wbn3Og 7x0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AAAByyi9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg15-20020a170907a40f00b006f37ff30509si22713008ejc.508.2022.05.25.08.01.46; Wed, 25 May 2022 08:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AAAByyi9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237864AbiEXN0W (ORCPT + 99 others); Tue, 24 May 2022 09:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237804AbiEXN0M (ORCPT ); Tue, 24 May 2022 09:26:12 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EFC34B9C; Tue, 24 May 2022 06:26:11 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24ODBdAm029873; Tue, 24 May 2022 13:25:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=hBbcMrX9s6JSpr08mbOB4SZ6XiS2E7eqbNX1M5D5MBY=; b=AAAByyi91dHEoGm6NYlZn+wRXYe74rFA7dWvXySO+ATU2V3bumZAlWRKf1gQzvp/8/jf hcpaxosyWSDnSokBRoM4uPK7lVeLDGhUUH9/RpySgvv5XLBP7We/g9IYkTsU4sIFOnK3 f4bi/fvwXZpucg8S9TL43/a1aib1N0iYBTDWGFjO3yW74mIW0I2ASroV65+NkVvNZOvk P72SGcnLaQsHzdSxMldx+7Vb/1briIWwYJtJPwqX27MkfbxbPqJiS99MpqLVmDdHSCpA +X2/S8NZ2lQqhFzb9e60Vz4JLlntJdYOzngVACRgg680c7lV4j+WqgGKQEDB94frkeQR lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g901ggasw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 13:25:35 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24ODCcnT032838; Tue, 24 May 2022 13:25:34 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g901ggasm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 13:25:34 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24ODK0DZ013006; Tue, 24 May 2022 13:25:33 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma03dal.us.ibm.com with ESMTP id 3g6qqa66wf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 13:25:33 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24ODPWEL30277940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 May 2022 13:25:32 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C65E6A054; Tue, 24 May 2022 13:25:32 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B8466A04F; Tue, 24 May 2022 13:25:30 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 24 May 2022 13:25:30 +0000 (GMT) Message-ID: <6c16b3b8-cd3f-4175-9269-2c542f7d4188@linux.ibm.com> Date: Tue, 24 May 2022 09:25:30 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v12 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Content-Language: en-US To: "Serge E. Hallyn" Cc: linux-integrity@vger.kernel.org, zohar@linux.ibm.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 References: <20220420140633.753772-1-stefanb@linux.ibm.com> <20220420140633.753772-13-stefanb@linux.ibm.com> <20220522173844.GA24519@mail.hallyn.com> From: Stefan Berger In-Reply-To: <20220522173844.GA24519@mail.hallyn.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6NFAnCdZijNoZg9U7nT1qmCrXylN8GWD X-Proofpoint-GUID: D-cNVwma8oNMshAs7sKX_m1vlca8muQM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_06,2022-05-23_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205240066 X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 5/22/22 13:38, Serge E. Hallyn wrote: > 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. > I kept the title of the patch but the text now states: For non-init_ima_ns namespaces, only accept AUDIT rules for now. Reject 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? They don't cause IMA to do anything that is not supported at this point so I let them pass. If you set these you still don't get a measurements or appraisal and that's good at this point.. > >> + 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