Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1243323rwn; Thu, 15 Sep 2022 12:35:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Thj9ZhsHvlMLqK3fJwRKM3o4H+EZpqPqNlKjsGs/fH2Nkh8FfifCdwoEBpCpC94vwp8LD X-Received: by 2002:a05:6402:26cf:b0:451:70af:ecc5 with SMTP id x15-20020a05640226cf00b0045170afecc5mr1146359edd.287.1663270510728; Thu, 15 Sep 2022 12:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663270510; cv=none; d=google.com; s=arc-20160816; b=MluB+x7SNVKLzdRCrB5dEYFhWZD0SWIjM09cZj4pAnhnnwjtXwr/W1Yh0rZatDCeHo 3B+lW174xvnWQr2Zfm/pC1aBe+i1aVhboptUhk1o3sxt36JAwsR8VoO9AxE2JsFeu6jP hVa4xsbtMYM8Zmi71GBtwrJTpd01IIuBSarPdU67MO/tTT7tEpzlynuhhb9XW7xlQZA3 8VLlMuu2pQCzhgs5qKJM84SfXufnaZAbqee+Bph4kez3rO8ejVKgmI9cD3KM0QLhIWNn j4eFgikM7LuFglAPyOQiy2Ij3IrNbOY/WriSxp8IM+IJ7A44gFGHotkZJOgBRs3wfL0G TV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1UYNl1C7PuGQg+256/Y1Bpci7fnwfWgV1fHw2B6kGAE=; b=u3ToMM6zk24XW6Ps98twYLMyVWxavuQEIHs9GfSEjQEIh/mTUaRCy7dVklTE1v4aV5 4XG1YfMTu1KVj6Y5rEHyFEyJ7J7PE3OfABtXqQxs//qQ40cH9xnYTXldqF2MHmjNRlPa ZkG3mQixQeUMB0HZpkzbQcBD9IBR5bso/rddUMWIZiZMX8ZQdvvx0J09v0Sa4z2V8TNk Pd9DlR9A2LmFSY4JuJsVNHNM6/wRXwV35CbQYQte/SxFEJE0Jb4Y0LftqUpe6fmzhkpo ymVALqzjWtz8LIrvPQnuHbY8GIhzkXrUvO5/ElOmytKTKr7f4JmE0WdpsPNvdPqToYBJ 8VrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VS4dZ7+q; 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 di22-20020a170906731600b007307f95bc5dsi16003221ejc.383.2022.09.15.12.34.44; Thu, 15 Sep 2022 12:35:10 -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=VS4dZ7+q; 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 S229544AbiIOTdH (ORCPT + 99 others); Thu, 15 Sep 2022 15:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiIOTdF (ORCPT ); Thu, 15 Sep 2022 15:33:05 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC18F9D12A; Thu, 15 Sep 2022 12:33:04 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28FJWahU038290; Thu, 15 Sep 2022 19:32:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=1UYNl1C7PuGQg+256/Y1Bpci7fnwfWgV1fHw2B6kGAE=; b=VS4dZ7+qZ72oh4x2956gpCHkG+ccSgROyt8NguV0HQpTd0672RhBw0gkpNwvIms2k8Yl GdmXhWqe6Pc05vO4iEySfxWd3t+OoKH7/dQUZPI6fjLTw1o+XNjubBoLQ1heYgtOL36+ KKQaNB3pQnbfGPYyHnVoxR1eggnKBGw8OAJmbqgZKTsuUxpdTwcpIy0gZvU94H481nDH hqrPm41YE9SHj/Ttj46hQRltnxvRwjTlgi6Lu6/NtGjaAgVmIWm3QUeFu6g6llcsRW+h VkPz/oGbT2YqK7nB0Tqn4Gc2f7g+gqQRykXJ3EwEvcLupKQA/ddLWNoKPTg5FP6HoGeo gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jmaa4004c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Sep 2022 19:32:39 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28FJWcJi038370; Thu, 15 Sep 2022 19:32:39 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jmaa4003h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Sep 2022 19:32:38 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28FJK3TM005461; Thu, 15 Sep 2022 19:32:37 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01dal.us.ibm.com with ESMTP id 3jm91qgg4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Sep 2022 19:32:37 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28FJWahs4653628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Sep 2022 19:32:36 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF9BCAE062; Thu, 15 Sep 2022 19:32:36 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3CEDAE05C; Thu, 15 Sep 2022 19:32:36 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 15 Sep 2022 19:32:36 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, serge@hallyn.com, brauner@kernel.org, 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, Stefan Berger Subject: [PATCH v14 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Date: Thu, 15 Sep 2022 15:32:07 -0400 Message-Id: <20220915193221.1728029-13-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220915193221.1728029-1-stefanb@linux.ibm.com> References: <20220915193221.1728029-1-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yomP0ib_mE1-PUbx-1Px4x9dT7tgYfQS X-Proofpoint-ORIG-GUID: rTDpZRYRixe968O2t7PXYB7A2xQWFDJ9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-15_10,2022-09-14_04,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209150119 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 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 18fd19ecb402..e81eebc7d41e 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1865,6 +1865,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: + result = -EINVAL; + goto err_audit; + } + } } if (!result && !ima_validate_rule(entry)) result = -EINVAL; @@ -1886,6 +1897,7 @@ static int ima_parse_rule(struct ima_namespace *ns, "verity rules should include d-ngv2"); } +err_audit: audit_log_format(ab, "res=%d", !result); audit_log_end(ab); return result; -- 2.36.1