diff options
author | Lakshmi Ramasubramanian <nramas@linux.microsoft.com> | 2019-12-11 08:47:07 -0800 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2019-12-12 08:53:50 -0500 |
commit | 2b60c0ecedf8d43b35a3c8554e72e8daca93fbcf (patch) | |
tree | f915be6917614dd8cb67d9aae697740551b35f73 /init | |
parent | e9085e0ad38a333012629d815c203155d61ebe7e (diff) | |
download | linux-2b60c0ecedf8d43b35a3c8554e72e8daca93fbcf.tar.gz linux-2b60c0ecedf8d43b35a3c8554e72e8daca93fbcf.tar.bz2 linux-2b60c0ecedf8d43b35a3c8554e72e8daca93fbcf.zip |
IMA: Read keyrings= option from the IMA policy
Read "keyrings=" option, if specified in the IMA policy, and store in
the list of IMA rules when the configured IMA policy is read.
This patch defines a new policy token enum namely Opt_keyrings
and an option flag IMA_KEYRINGS for reading "keyrings=" option
from the IMA policy.
Updated ima_parse_rule() to parse "keyrings=" option in the policy.
Updated ima_policy_show() to display "keyrings=" option.
The following example illustrates how key measurement can be verified.
Sample "key" measurement rule in the IMA policy:
measure func=KEY_CHECK uid=0 keyrings=.ima|.evm template=ima-buf
Display "key" measurement in the IMA measurement list:
cat /sys/kernel/security/ima/ascii_runtime_measurements
10 faf3...e702 ima-buf sha256:27c915b8ddb9fae7214cf0a8a7043cc3eeeaa7539bcb136f8427067b5f6c3b7b .ima 308202863082...4aee
Verify "key" measurement data for a key added to ".ima" keyring:
cat /sys/kernel/security/integrity/ima/ascii_runtime_measurements | grep -m 1 "\.ima" | cut -d' ' -f 6 | xxd -r -p |tee ima-cert.der | sha256sum | cut -d' ' -f 1
The output of the above command should match the template hash
of the first "key" measurement entry in the IMA measurement list for
the key added to ".ima" keyring.
The file namely "ima-cert.der" generated by the above command
should be a valid x509 certificate (in DER format) and should match
the one that was used to import the key to the ".ima" keyring.
The certificate file can be verified using openssl tool.
Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions