[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220915193221.1728029-13-stefanb@linux.ibm.com>
Date: Thu, 15 Sep 2022 15:32:07 -0400
From: Stefan Berger <stefanb@...ux.ibm.com>
To: linux-integrity@...r.kernel.org
Cc: zohar@...ux.ibm.com, serge@...lyn.com, brauner@...nel.org,
containers@...ts.linux.dev, dmitry.kasatkin@...il.com,
ebiederm@...ssion.com, krzysztof.struczynski@...wei.com,
roberto.sassu@...wei.com, mpeters@...hat.com, lhinds@...hat.com,
lsturman@...hat.com, puiterwi@...hat.com, jejb@...ux.ibm.com,
jamjoom@...ibm.com, linux-kernel@...r.kernel.org,
paul@...l-moore.com, rgb@...hat.com,
linux-security-module@...r.kernel.org, jmorris@...ei.org,
jpenumak@...hat.com, Stefan Berger <stefanb@...ux.ibm.com>
Subject: [PATCH v14 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now
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@...ux.ibm.com>
Acked-by: Christian Brauner <brauner@...nel.org>
Reviewed-by: Mimi Zohar <zohar@...ux.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 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
Powered by blists - more mailing lists