From: Mimi Zohar <zohar@kernel.org>
To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
Cc: Lachlan Sneff <t-josne@linux.microsoft.com>,
Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
balajib@linux.microsoft.com, linux-integrity@vger.kernel.org
Subject: Re: [PATCH v5 2/4] IMA: Add policy related helpers
Date: Thu, 30 Jul 2020 15:50:38 -0400 [thread overview]
Message-ID: <1596138638.25003.6.camel@kernel.org> (raw)
In-Reply-To: <20200727223041.13110-3-pvorel@suse.cz>
On Tue, 2020-07-28 at 00:30 +0200, Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Other than inverting the [ -f $IMA_POLICY ] tests.
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
> New in v5.
>
> .../security/integrity/ima/tests/ima_setup.sh | 39 +++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> index 975ce9cbb..c46f273ab 100644
> --- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> @@ -54,6 +54,45 @@ compute_digest()
> return 1
> }
>
> +check_policy_readable()
> +{
> + if [ -f $IMA_POLICY ]; then
> + tst_res TINFO "missing $IMA_POLICY (reboot or CONFIG_IMA_WRITE_POLICY=y required)"
> + return 1
> + fi
> + cat $IMA_POLICY > /dev/null 2>/dev/null
> +}
> +
> +require_policy_readable()
> +{
> + if [ -f $IMA_POLICY ]; then
> + tst_brk TCONF "missing $IMA_POLICY (reboot or CONFIG_IMA_WRITE_POLICY=y required)"
> + fi
> + if ! check_policy_readable; then
> + tst_brk TCONF "cannot read IMA policy (CONFIG_IMA_READ_POLICY=y required)"
> + fi
> +}
> +
> +check_ima_policy_content()
> +{
> + local pattern="$1"
> + local grep_params="${2--q}"
> +
> + check_policy_readable || return 1
> + grep $grep_params "$pattern" $IMA_POLICY
> +}
> +
> +require_ima_policy_content()
> +{
> + local pattern="$1"
> + local grep_params="${2--q}"
> +
> + require_policy_readable
> + if ! grep $grep_params "$pattern" $IMA_POLICY; then
> + tst_brk TCONF "IMA policy does not specify '$pattern'"
> + fi
> +}
> +
> require_ima_policy_cmdline()
> {
> local policy="$1"
next prev parent reply other threads:[~2020-07-30 19:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 22:30 [PATCH v5 0/4] IMA: kexec cmdline measurement Petr Vorel
2020-07-27 22:30 ` [PATCH v5 1/4] IMA: Rename helper to require_ima_policy_cmdline Petr Vorel
2020-07-27 22:30 ` [PATCH v5 2/4] IMA: Add policy related helpers Petr Vorel
2020-07-30 19:50 ` Mimi Zohar [this message]
2020-07-31 5:26 ` Petr Vorel
2020-07-27 22:30 ` [PATCH v5 3/4] IMA/ima_keys.sh: Fix policy readability check Petr Vorel
2020-07-27 22:30 ` [PATCH v5 4/4] IMA: Add test for kexec cmdline measurement Petr Vorel
2020-07-27 22:42 ` Lachlan Sneff
2020-07-27 23:13 ` Petr Vorel
2020-07-30 20:03 ` [PATCH v5 0/4] IMA: " Mimi Zohar
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=1596138638.25003.6.camel@kernel.org \
--to=zohar@kernel.org \
--cc=balajib@linux.microsoft.com \
--cc=linux-integrity@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=nramas@linux.microsoft.com \
--cc=pvorel@suse.cz \
--cc=t-josne@linux.microsoft.com \
--cc=zohar@linux.vnet.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).