IMA: Add support to limit measuring keys
authorLakshmi Ramasubramanian <nramas@linux.microsoft.com>
Wed, 11 Dec 2019 16:47:06 +0000 (08:47 -0800)
committerMimi Zohar <zohar@linux.ibm.com>
Thu, 12 Dec 2019 13:53:50 +0000 (08:53 -0500)
commite9085e0ad38a333012629d815c203155d61ebe7e
tree8b898569b294050174e83abe19dd2e51d0f7d12d
parentcb1aa3823c9280f2bb8218cdb5cb05721e0376b1
IMA: Add support to limit measuring keys

Limit measuring keys to those keys being loaded onto a given set of
keyrings only and when the user id (uid) matches if uid is specified
in the policy.

This patch defines a new IMA policy option namely "keyrings=" that
can be used to specify a set of keyrings. If this option is specified
in the policy for "measure func=KEY_CHECK" then only the keys
loaded onto a keyring given in the "keyrings=" option are measured.

If uid is specified in the policy then the key is measured only if
the current user id matches the one specified in the policy.

Added a new parameter namely "keyring" (name of the keyring) to
process_buffer_measurement(). The keyring name is passed to
ima_get_action() to determine the required action.
ima_match_rules() is updated to check keyring in the policy, if
specified, for KEY_CHECK function.

Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Documentation/ABI/testing/ima_policy
security/integrity/ima/ima.h
security/integrity/ima/ima_api.c
security/integrity/ima/ima_appraise.c
security/integrity/ima/ima_asymmetric_keys.c
security/integrity/ima/ima_main.c
security/integrity/ima/ima_policy.c