From: Mimi Zohar <zohar@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [LTP v4 4/5] IMA: Add a test to verify measurement of certificate imported into a keyring
Date: Wed, 26 Aug 2020 18:15:42 -0400 [thread overview]
Message-ID: <b58057275ecdc06bb512d39ea46118197f33c33f.camel@linux.ibm.com> (raw)
In-Reply-To: <20200820090824.3033-5-pvorel@suse.cz>
On Thu, 2020-08-20 at 11:08 +0200, Petr Vorel wrote:
> @@ -63,4 +73,50 @@ test1()
> tst_res TPASS "specified keyrings were measured correctly"
> }
>
> +# Create a new keyring, import a certificate into it, and verify
> +# that the certificate is measured correctly by IMA.
> +test2()
> +{
> + tst_require_cmds evmctl keyctl openssl
> +
> + local cert_file="$TST_DATAROOT/x509_ima.der"
> + local keyring_name="key_import_test"
> + local temp_file="file.txt"
> +
> + tst_res TINFO "verify measurement of certificate imported into a keyring"
> +
> + if ! check_ima_policy_content "^measure.*func=KEY_CHECK.*keyrings=.*$keyring_name"; then
> + tst_brk TCONF "IMA policy does not contain $keyring_name keyring"
> + fi
> +
> + KEYRING_ID=$(keyctl newring $keyring_name @s) || \
> + tst_brk TBROK "unable to create a new keyring"
> +
> + if ! tst_is_num $KEYRING_ID; then
> + tst_brk TBROK "unable to parse the new keyring id ('$KEYRING_ID')"
> + fi
> +
Instead of using TST_DATAROOT, which is defined as
"$LTPROOT/datafiles", use LTPROOT directly to define the path to the
cert. Adding the following will allow the test to run from the build
directory.
if [ ! -f $cert_file ]; then
cert_file="$LTPROOT/../datafiles/ima_keys/x509_ima.der"
fi
Mimi
> + evmctl import $cert_file $KEYRING_ID > /dev/null || \
> + tst_brk TBROK "unable to import a certificate into $keyring_name keyring"
> +
next prev parent reply other threads:[~2020-08-26 22:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 9:08 [LTP] [LTP v4 0/5] IMA: verify measurement of certificate imported into a keyring Petr Vorel
2020-08-20 9:08 ` [LTP] [LTP v4 1/5] IMA/ima_keys.sh: Fix policy content check usage Petr Vorel
2020-08-24 17:19 ` Petr Vorel
2020-08-24 17:24 ` Lakshmi Ramasubramanian
2020-08-20 9:08 ` [LTP] [LTP v4 2/5] IMA/ima_keys.sh: Require template=ima-buf, fix grep pattern Petr Vorel
2020-08-20 9:08 ` [LTP] [LTP v4 3/5] IMA: Refactor datafiles directory Petr Vorel
2020-08-28 13:18 ` Petr Vorel
2020-08-28 13:28 ` Petr Vorel
2020-08-28 16:32 ` Mimi Zohar
2020-08-31 7:39 ` Petr Vorel
2020-08-30 16:31 ` Petr Vorel
2020-08-20 9:08 ` [LTP] [LTP v4 4/5] IMA: Add a test to verify measurement of certificate imported into a keyring Petr Vorel
2020-08-26 22:15 ` Mimi Zohar [this message]
2020-08-27 13:23 ` Petr Vorel
2020-08-27 13:55 ` Petr Vorel
2020-08-27 21:34 ` Mimi Zohar
2020-08-27 22:54 ` Petr Vorel
2020-08-27 23:37 ` Mimi Zohar
2020-08-28 6:05 ` Petr Vorel
2020-08-28 11:00 ` Mimi Zohar
2020-08-28 12:40 ` Petr Vorel
2020-08-28 11:19 ` Mimi Zohar
2020-08-28 12:49 ` Petr Vorel
2020-08-28 15:21 ` Mimi Zohar
2020-08-31 10:29 ` Petr Vorel
2020-08-28 10:59 ` Mimi Zohar
2020-08-20 9:08 ` [LTP] [LTP v4 5/5] IMA/ima_keys.sh: Enhance policy checks 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=b58057275ecdc06bb512d39ea46118197f33c33f.camel@linux.ibm.com \
--to=zohar@linux.ibm.com \
--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