Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp816777pxb; Fri, 22 Apr 2022 11:47:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFKcSrcNLBGzvRq7V0eS5CnFgIK3dFIGJNRbNyuL0Y7Bje+QUDjdqjeqmVjyfOIGIalCQQ X-Received: by 2002:a17:902:7789:b0:156:8b5c:606f with SMTP id o9-20020a170902778900b001568b5c606fmr5722644pll.100.1650653275670; Fri, 22 Apr 2022 11:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650653275; cv=none; d=google.com; s=arc-20160816; b=U6dTUiyLgCOOo/HKK0JrL4R2nVuVk8qWC4B/WipE3ttKN/bn80RAYUfflpCY2Twsy+ xiVgp0vlXyDJFn2xkcXGogrCO6HaoRlCAr6Je4ZnyZrKgBsUfQXLgpzC1HmqD8I0qI/T TjzZ05YAZFxDtlO3EPjwKzgxOLIIuDua3m1K9gNyeL+BKbXW7IN1xKGk3L3Z9pZf6GJ5 JmcQRQD17zsjL/xC01bewCQjt4S8zPKxXcaLpAE7O/Ws2P9npfisZ68RzlzkUWkOTs6/ uKKKQR7KlfzaJfQ1oWFs9ONJU8c+t1uH5I84bPOXatypkvnSYCwNEcV6tENrCrCW8/cf QMOQ== 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=D6Abd+C63wg/G2/sLG/arA2S8ifc24l/nZ1i3OjnEWQ=; b=yM5jvP+5T7RcCSp3kP/3iLJk2OO0vs++kpH3nJHyGQ53k+6hLham6nrEWB8a741u/p U3UO4ZvywDdaUMiK5JkkKvdST9CX7rHefmdYEQQnOL6Vhyf93ay9dAz08wAPBXZ6P9SR Rbv/e5ExddPY+pBfvqG3UUPO9XH3FE1jyqCha5/bvkAQ48b6sI4rj/d6QkG00YkEYWDX K6LhJiTx74vSDRCWkXuJ70gTHvakHFNZa/JZiYJd6t9FUfBH8DU926UwBoZXaKXVSZ9a UtAkciseSsbQk5MG6JVPAd5LYXiHwF5RwkE/TkNFN4TmVGUKiZq7u+kAu3CpPxyb6dX1 xe8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fAFzvrBt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n6-20020a17090ac68600b001d927447c43si211821pjt.99.2022.04.22.11.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:47:55 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fAFzvrBt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4432133E42; Fri, 22 Apr 2022 11:14:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379514AbiDTOLg (ORCPT + 99 others); Wed, 20 Apr 2022 10:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346527AbiDTOKM (ORCPT ); Wed, 20 Apr 2022 10:10:12 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDB5443D8; Wed, 20 Apr 2022 07:07:18 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23KD93sh005941; Wed, 20 Apr 2022 14:06:45 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=D6Abd+C63wg/G2/sLG/arA2S8ifc24l/nZ1i3OjnEWQ=; b=fAFzvrBtCE4iZQb4dDb8lgmcf4GpSFkVJ4qxXKIpZ9DCPZDKh8pH9Kz61++WN8KiJK97 Uq9oHc6NXjlI5TvJ323h6aLn0iXHVXYmXna2YMOIgxOuWM/mAoCVmS58jGcPmtTK2OPQ Y76bKw+vUSY4jq0n0hnWuSojJNwBOr219SYxG+o7toRznzNukxoyfKOyDR5AGK+RsrBi DHaE1pLcDV8aa27rSHI/W8SkbWjpt9PX8cBhEIur8BFxgS73gT86RqraeV7qyX1HK+6a //xjT/d2q1JUANO0hkavCv3/AsN1ndKS953FzSMt1Bf4cofBCHVZT7nvXWCoA6/qcURv jA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fg7rg449j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Apr 2022 14:06:44 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23KDFqD6039254; Wed, 20 Apr 2022 14:06:44 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fg7rg4495-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Apr 2022 14:06:44 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23KE2vHH012748; Wed, 20 Apr 2022 14:06:43 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma04wdc.us.ibm.com with ESMTP id 3ffneactw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Apr 2022 14:06:43 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23KE6gAq16384264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Apr 2022 14:06:42 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93C2EAE05C; Wed, 20 Apr 2022 14:06:42 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77E6AAE063; Wed, 20 Apr 2022 14:06:42 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 20 Apr 2022 14:06:42 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: 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, Stefan Berger , Christian Brauner Subject: [PATCH v12 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Date: Wed, 20 Apr 2022 10:06:19 -0400 Message-Id: <20220420140633.753772-13-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220420140633.753772-1-stefanb@linux.ibm.com> References: <20220420140633.753772-1-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ivrR6t3FH2DYhrqUmmJg83uH9WG3rMyh X-Proofpoint-ORIG-GUID: MWIKpU9q5mLmWhio2RbVLw7z98ZmliVf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-20_04,2022-04-20_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 malwarescore=0 phishscore=0 clxscore=1015 bulkscore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204200081 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE 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 Only accept AUDIT rules for non-init_ima_ns namespaces 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: + 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