1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 14:43:37 +02:00

ima-evm-utils: output specific "unknown keyid" file msg based on log level

When the IMA measurement list contains file signatures, the file
signatures are verified either by calculating the local file data hash
or based on the file hash contained in the measurement list.  In either
case a list of trusted public keys needs to be provided.

In addition to the list of known/unknown public keys needed to verify
the measurement list being output, the specific files signed by an
unknown public key are output as well.

Output the individual "unknown keyid" file messages based on log level.

Example 1: "ima_measurement" list of known/unknown public keys

Verify the provided IMA measurement list against the provided TPM 1.2
PCRs.
--validate: ignore measurement violations.
--verify: calculate and verify the template digest against the template
data.
--verify-sig: verify the file signature against the file hash stored
in the template data.

$ evmctl ima_measurement /tmp/local_binary_runtime_measurements --pcrs
/tmp/local_pcrs_new --validate --verify --verify-sig
key 1: 14c2d147 /etc/keys/x509_evm.der
key 2: 6e6c1046 (unknown keyid)
key 3: c4e2426e (unknown keyid)
Matched per TPM bank calculated digest(s).

Example 2: verbose mode (-v) includes specific unknown files.

/usr/bin/evmctl: verification failed: unknown keyid 6e6c1046

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
This commit is contained in:
Mimi Zohar 2020-07-17 19:14:28 -04:00
parent 9b5a1e7b1d
commit ee43312f74

View File

@ -512,6 +512,7 @@ static int verify_hash_v2(const char *file, const unsigned char *hash, int size,
if (!pkey) { if (!pkey) {
uint32_t keyid = hdr->keyid; uint32_t keyid = hdr->keyid;
if (imaevm_params.verbose > LOG_INFO)
log_info("%s: verification failed: unknown keyid %x\n", log_info("%s: verification failed: unknown keyid %x\n",
file, __be32_to_cpup(&keyid)); file, __be32_to_cpup(&keyid));
return -1; return -1;