Message ID | 20230206140253.3755945-13-stefanb@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2252470wrn; Mon, 6 Feb 2023 06:05:28 -0800 (PST) X-Google-Smtp-Source: AK7set+7YhtPIGa0RVgZ+NuTPz0QUue3NdZjQqEecydvGppn4j9qHTHOQp9uECdbKHgKSsjtn9p5 X-Received: by 2002:a17:902:d48a:b0:199:2952:468e with SMTP id c10-20020a170902d48a00b001992952468emr219129plg.55.1675692327731; Mon, 06 Feb 2023 06:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675692327; cv=none; d=google.com; s=arc-20160816; b=Q1Z8dEP+Z1LRZzVeAkZCuUefO3ZP2jf1XJtZz6n54gLfxPu9g9dUmX1dHQjQT9/ktt BpyfX91bDZwHS/pWFvsJA0tXkO1JaMx5ZQM4nu0GgNg+7j/7/l+hu+D+lcAEqqWYdTKU pyF1amgUYGSL93EgCkUvv+s1WeNRdRmMMwyFFNPksWWX5dM6jYCqxp7c7C02US6gMBlG 8mJoD5UYTJP26svpdt5d9RNm2Ke9WuiRoGb6ksgmEbNA0ifH+o4aZTsoK9SAU3OTUEIj qHXQ+mu/Hwg4i83vLCL/gAut0F1jyUyTFs4m0kBESj5EI1cfGShIxa6CWSrIJmqW7Ozv k1HQ== 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=G2M1u732vLr/KEGieyemjxRxAL7h0rIqdLGodGQ85sM=; b=imQyLyeJvxrAQh1DilVZqFXWRBbrFjt9iFACbYpJkI1NZ4ydRil3sI4WiVpk8u8WPN no8Ccj3Qo13O4cwhY3mEAsc2wJZD7d0q0DMDH5H3C1Kat8FQVQymTMOLEgVzpHyJxC0x 32h7J+JnHZUXPLaWCWFHJzkniyE1wMkPfKzExhwm2aBtRA0TH1+YsA44Jv2umF/tcdcP 2FUD87e7pAPlA5PvVbGY1uccP2H6z0RT8IlJ1zPn8Cx2NRGQlcq6/nTGks/c1F8Q0V1u 6delyT2a/d6b7zJ8adyd/9L8YGSFCURwj9Rk4hnoVMY/md/m+9ihmb2FXA92bUuHfKeA DrbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ARtzmG1P; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e5c600b00196486c4eadsi12915903plf.547.2023.02.06.06.05.14; Mon, 06 Feb 2023 06:05:27 -0800 (PST) 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=ARtzmG1P; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjBFOEX (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Mon, 6 Feb 2023 09:04:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjBFODx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Feb 2023 09:03:53 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9921B12863; Mon, 6 Feb 2023 06:03:46 -0800 (PST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 316DqVZT027086; Mon, 6 Feb 2023 14:03:30 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=G2M1u732vLr/KEGieyemjxRxAL7h0rIqdLGodGQ85sM=; b=ARtzmG1PXJ+HdY6N+a0trnhORGOsxamVZWlZ5XWy2CoeWkaus3mEvKNGpvTe9/Y0LPLC qgwfDBAyUkqSuOH+OYPFirAH+Rgjvibx2V5B1T9AQDs1qoFQVbxDwDsW39lqvOX1JtK3 aOlx3CUp4TGpG6RPs/DuDnksHAY6OYFnj8y5KACHF3L24Y4nmOhWmsWcRLDI/ZswHASg 4phJdRH1e3RotXwOHstQg18MzO5zW3APjvBM0MHxezU09sUxx7px0KnDQR5HxAwnSf7Z OQ/HaGE9EAt6ERdDdX0fVoCWw/7oN0m6ypxs/toLXtk9Kax8StDp3g7xSTGaHJVEWofL 3g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nk2tbggd5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 14:03:29 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 316Dr11c000438; Mon, 6 Feb 2023 14:03:28 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 3nk2tbggbs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 14:03:28 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 316C2Oji017708; Mon, 6 Feb 2023 14:03:27 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([9.208.130.101]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3nhf07dq52-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 14:03:27 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 316E3PIF1245876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Feb 2023 14:03:26 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C44945805E; Mon, 6 Feb 2023 14:03:25 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CBA585805B; Mon, 6 Feb 2023 14:03:23 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Feb 2023 14:03:23 +0000 (GMT) From: Stefan Berger <stefanb@linux.ibm.com> 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 <stefanb@linux.ibm.com> Subject: [PATCH v15 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Date: Mon, 6 Feb 2023 09:02:39 -0500 Message-Id: <20230206140253.3755945-13-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230206140253.3755945-1-stefanb@linux.ibm.com> References: <20230206140253.3755945-1-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xDjLcRfslDEyw1eRISdW-HmfMwy-FFU_ X-Proofpoint-GUID: AQwRnKfBzVHDsUZlGQeoGo0HRoXpJj-h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-06_07,2023-02-06_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302060121 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757090758113191949?= X-GMAIL-MSGID: =?utf-8?q?1757090758113191949?= |
Series |
ima: Namespace IMA with audit support in IMA-ns
|
|
Commit Message
Stefan Berger
Feb. 6, 2023, 2:02 p.m. UTC
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 <stefanb@linux.ibm.com> Acked-by: Christian Brauner <brauner@kernel.org> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> --- 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 19aca18db323..2a2c88f7d135 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1912,6 +1912,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; @@ -1933,6 +1944,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;