From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] IMA: Allow only ima-buf template for key measurement
Date: Tue, 9 Mar 2021 10:51:19 +0100 [thread overview]
Message-ID: <YEdFF2g6Z1KJiJ5b@pevik> (raw)
In-Reply-To: <33ba6274-e7ef-27de-b481-5a702136c0df@linux.microsoft.com>
Hi Lakshmi,
> 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
Good catch!
> 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
I guess we should update datafiles/ima_keys/keycheck.policy to contain both
lines.
> 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 a lot!
> thanks,
> -lakshmi
Kind regards,
Petr
prev parent reply other threads:[~2021-03-09 9:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 20:32 [LTP] [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
2021-03-09 9:51 ` Petr Vorel [this message]
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=YEdFF2g6Z1KJiJ5b@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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