From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Mimi Zohar <zohar@linux.ibm.com>, linux-integrity@vger.kernel.org
Cc: Petr Vorel <pvorel@suse.cz>, Vitaly Chikunov <vt@altlinux.org>,
Bruno Meneguele <bmeneg@redhat.com>
Subject: Re: [ima-evm-utils: PATCH 1/3] Drop the ima_measurement "--verify" option
Date: Fri, 31 Jul 2020 08:31:55 -0700 [thread overview]
Message-ID: <945ffd7c-f42f-2308-281c-19aa6b90983e@linux.microsoft.com> (raw)
In-Reply-To: <20200731141432.668318-2-zohar@linux.ibm.com>
On 7/31/20 7:14 AM, Mimi Zohar wrote:
> While walking the IMA measurement list re-calculating the PCRS,
> ima_measurement should always re-calculate the template data digest
> and verify it against the measurement list value.
>
> This patch removes the "--verify" option.
>
> On success, return 0.
>
> Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
> README | 3 +--
> src/evmctl.c | 23 ++++++++---------------
> 2 files changed, 9 insertions(+), 17 deletions(-)
>
Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> diff --git a/README b/README
> index 73b38a1f35ba..d8b8f404534b 100644
> --- a/README
> +++ b/README
> @@ -31,7 +31,7 @@ COMMANDS
> ima_sign [--sigfile] [--key key] [--pass password] file
> ima_verify file
> ima_hash file
> - ima_measurement [--validate] [--verify] [--verify-sig [--key "key1, key2, ..."]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] file
> + ima_measurement [--validate] [--verify-sig [--key "key1, key2, ..."]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] file
> ima_fix [-t fdsxm] path
> sign_hash [--key key] [--pass password]
> hmac [--imahash | --imasig ] file
> @@ -61,7 +61,6 @@ OPTIONS
> --engine e preload OpenSSL engine e (such as: gost)
> --pcrs file containing TPM pcrs, one per hash-algorithm/bank
> --validate ignore ToMToU measurement violations
> - --verify verify the template data digest
> --verify-sig verify the file signature based on the file hash, both
> stored in the template data.
> -v increase verbosity level
> diff --git a/src/evmctl.c b/src/evmctl.c
> index 448e4a9c8d78..b4d2333fb880 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -1393,7 +1393,6 @@ struct template_entry {
> static uint8_t zero[MAX_DIGEST_SIZE];
>
> static int validate = 0;
> -static int verify = 0;
>
> static int ima_verify_template_hash(struct template_entry *entry)
> {
> @@ -1945,7 +1944,7 @@ static int ima_measurement(const char *file)
>
> struct template_entry entry = { .template = 0 };
> FILE *fp;
> - int verified_template_digest = 0;
> + int invalid_template_digest = 0;
> int err_padded = -1;
> int err = -1;
>
> @@ -2075,11 +2074,9 @@ static int ima_measurement(const char *file)
> pseudo_padded_banks);
>
> /* Recalculate and verify template data digest */
> - if (verify) {
> - err = ima_verify_template_hash(&entry);
> - if (err)
> - verified_template_digest = 1;
> - }
> + err = ima_verify_template_hash(&entry);
> + if (err)
> + invalid_template_digest = 1;
>
> if (is_ima_template)
> ima_show(&entry);
> @@ -2116,7 +2113,7 @@ static int ima_measurement(const char *file)
> log_info("Failed to match per TPM bank or SHA1 padded TPM digest(s).\n");
> }
>
> - if (verified_template_digest) {
> + if (invalid_template_digest) {
> log_info("Failed to verify template data digest.\n");
> err = 1;
> }
> @@ -2486,7 +2483,7 @@ struct command cmds[] = {
> {"ima_verify", cmd_verify_ima, 0, "file", "Verify IMA signature (for debugging).\n"},
> {"ima_setxattr", cmd_setxattr_ima, 0, "[--sigfile file]", "Set IMA signature from sigfile\n"},
> {"ima_hash", cmd_hash_ima, 0, "file", "Make file content hash.\n"},
> - {"ima_measurement", cmd_ima_measurement, 0, "[--validate] [--verify] [--verify-sig [--key key1, key2, ...]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] file", "Verify measurement list (experimental).\n"},
> + {"ima_measurement", cmd_ima_measurement, 0, "[--validate] [--verify-sig [--key key1, key2, ...]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] file", "Verify measurement list (experimental).\n"},
> {"ima_boot_aggregate", cmd_ima_bootaggr, 0, "[file]", "Calculate per TPM bank boot_aggregate digests\n"},
> {"ima_fix", cmd_ima_fix, 0, "[-t fdsxm] path", "Recursively fix IMA/EVM xattrs in fix mode.\n"},
> {"ima_clear", cmd_ima_clear, 0, "[-t fdsxm] path", "Recursively remove IMA/EVM xattrs.\n"},
> @@ -2526,8 +2523,7 @@ static struct option opts[] = {
> {"engine", 1, 0, 139},
> {"xattr-user", 0, 0, 140},
> {"validate", 0, 0, 141},
> - {"verify", 0, 0, 142},
> - {"pcrs", 1, 0, 143},
> + {"pcrs", 1, 0, 142},
> {}
>
> };
> @@ -2709,10 +2705,7 @@ int main(int argc, char *argv[])
> case 141: /* --validate */
> validate = 1;
> break;
> - case 142: /* --verify */
> - verify = 1;
> - break;
> - case 143:
> + case 142:
> if (npcrfile >= MAX_PCRFILE) {
> log_err("too many --pcrfile options\n");
> exit(1);
>
next prev parent reply other threads:[~2020-07-31 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 14:14 [ima-evm-utils: PATCH 0/3] evmctl option improvements Mimi Zohar
2020-07-31 14:14 ` [ima-evm-utils: PATCH 1/3] Drop the ima_measurement "--verify" option Mimi Zohar
2020-07-31 15:31 ` Lakshmi Ramasubramanian [this message]
2020-07-31 14:14 ` [ima-evm-utils: PATCH 2/3] Rename "--validate" to "--ignore-violations" Mimi Zohar
2020-08-01 0:46 ` Lakshmi Ramasubramanian
2020-07-31 14:14 ` [ima-evm-utils: PATCH 3/3] Update the ima_boot_aggregate apsects of the "README" and "help" files Mimi Zohar
2020-07-31 15:33 ` Lakshmi Ramasubramanian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=945ffd7c-f42f-2308-281c-19aa6b90983e@linux.microsoft.com \
--to=nramas@linux.microsoft.com \
--cc=bmeneg@redhat.com \
--cc=linux-integrity@vger.kernel.org \
--cc=pvorel@suse.cz \
--cc=vt@altlinux.org \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).