From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: zohar@linux.ibm.com, tusharsu@linux.microsoft.com,
ltp@lists.linux.it, linux-integrity@vger.kernel.org
Subject: Re: [PATCH] IMA: Allow only ima-buf template for key measurement
Date: Fri, 5 Mar 2021 14:10:20 -0800 [thread overview]
Message-ID: <33ba6274-e7ef-27de-b481-5a702136c0df@linux.microsoft.com> (raw)
In-Reply-To: <YEJZIQqa1arYKwK+@pevik>
On 3/5/21 8:15 AM, Petr Vorel wrote:
Hi Petr,
A small change is needed:
In the while loop, for each line of the KEY_CHECK policy, we need to
check if a "template" is specified, and if it is then verify if it is
"ima-buf".
> You need to do:
> while read line; do
> if ! echo $line | grep -q $template; then
> tst_res TCONF "only $template can be specified for $func"
> return 1
> fi
> done < $TST_TMPDIR/policy.txt
> return 0
Please see the change below:
while read line; do
if echo $line | grep -q 'template=' && ! echo $line | grep -q $template
; then
tst_res TCONF "only $template can be specified for $func"
return 1
fi
done < $TST_TMPDIR/policy.txt
return 0
With check_policy_template() moved from ima_setup.sh to ima_keys.sh, the
test works fine
When the policy contains the following
measure func=KEY_CHECK keyrings=key_import_test template=ima-buf
measure func=KEY_CHECK keyrings=.builtin_trusted_keys
the test passes:
ima_keys 1 TINFO: verify key measurement for keyrings and templates
specified in IMA policy
ima_keys 1 TINFO: keyrings: 'key_import_test|\.builtin_trusted_keys'
ima_keys 1 TINFO: templates: 'ima-buf'
ima_keys 1 TPASS: specified keyrings were measured correctly
But if the policy is changed to below:
measure func=KEY_CHECK keyrings=key_import_test template=ima-buf
measure func=KEY_CHECK keyrings=.builtin_trusted_keys template=ima-sig
the test fails as expected.
ima_keys 1 TINFO: verify key measurement for keyrings and templates
specified in IMA policy
ima_keys 1 TCONF: only template=ima-buf can be specified for func=KEY_CHECK
I'll post the updated patch shortly.
thanks,
-lakshmi
next prev parent reply other threads:[~2021-03-05 22:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 20:32 [PATCH] IMA: Allow only ima-buf template for key measurement Lakshmi Ramasubramanian
2021-03-05 16:15 ` Petr Vorel
2021-03-05 19:36 ` Lakshmi Ramasubramanian
2021-03-05 22:10 ` Lakshmi Ramasubramanian [this message]
2021-03-09 9:51 ` Petr Vorel
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=33ba6274-e7ef-27de-b481-5a702136c0df@linux.microsoft.com \
--to=nramas@linux.microsoft.com \
--cc=linux-integrity@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=tusharsu@linux.microsoft.com \
--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).