From: Alex Henrie <alexh@vpitech.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH ltp] IMA: Add tests for uid, gid, fowner, and fgroup options
Date: Thu, 9 Sep 2021 18:35:45 -0600 [thread overview]
Message-ID: <20210909183545.a33cb2c25f13eb2a1d7b64ac@vpitech.com> (raw)
In-Reply-To: <YTpswsqlDS5tI7NC@pevik>
On Thu, 9 Sep 2021 22:21:22 +0200
Petr Vorel <pvorel@suse.cz> wrote:
> > Requires "ima: add gid support".
> I haven't test the patch yet, but LTP supports (unlike kselftest) various kernel
> versions. Thus there should be some check to prevent old kernels failing.
> You could certainly wrap new things with if tst_kvcmp. If there is a chance new
> functionality can be detected, we prefer it because various features are
> sometimes backported to enterprise distros' kernels.
>
> Also, adding new test ima_measurements02.sh with TST_MIN_KVER would also work,
> although for IMA tests I usually kept everything in a single file.
I'll add a tst_kvcmp check under the assumption that this feature will
be added before Linux 5.15.
> > +++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
> > @@ -8,6 +8,7 @@
>
> > TST_NEEDS_CMDS="awk cut sed"
> You should add sudo:
>
> TST_NEEDS_CMDS="awk cut sed sudo"
Will do.
> > TST_SETUP="setup"
> > +TST_CLEANUP="cleanup"
> > TST_CNT=3
> > TST_NEEDS_DEVICE=1
>
> > @@ -20,6 +21,13 @@ setup()
> > TEST_FILE="$PWD/test.txt"
> > POLICY="$IMA_DIR/policy"
> > [ -f "$POLICY" ] || tst_res TINFO "not using default policy"
> > +
> > + cat $IMA_POLICY > policy-original
> This might not work if CONFIG_IMA_READ_POLICY is not set. There is
> check_policy_readable() helper in ima_setup.sh. Is it really needed anyway?
It looks like CONFIG_IMA_WRITE_POLICY only makes it possible to add new
rules at runtime, not remove them, so the cleanup code didn't actually
work. I'll remove it.
> > +}
> > +
> > +cleanup()
> > +{
> > + cat policy-original > $IMA_POLICY
> Again, this will not work if CONFIG_IMA_WRITE_POLICY not set.
> And this is very likely not to be set.
The new tests require the policy to be writable. I'll move the
check_policy_writable function from ima_policy.sh to ima_setup.sh and
use it in ima_measurements.sh as well.
Thanks for the feedback,
-Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alex Henrie <alexh@vpitech.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: linux-integrity@vger.kernel.org, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH ltp] IMA: Add tests for uid, gid, fowner, and fgroup options
Date: Thu, 9 Sep 2021 18:35:45 -0600 [thread overview]
Message-ID: <20210909183545.a33cb2c25f13eb2a1d7b64ac@vpitech.com> (raw)
Message-ID: <20210910003545.QHEsVUFWbFdnyknQWWztNJ7HDct3IgzrICFuaxfgJLk@z> (raw)
In-Reply-To: <YTpswsqlDS5tI7NC@pevik>
On Thu, 9 Sep 2021 22:21:22 +0200
Petr Vorel <pvorel@suse.cz> wrote:
> > Requires "ima: add gid support".
> I haven't test the patch yet, but LTP supports (unlike kselftest) various kernel
> versions. Thus there should be some check to prevent old kernels failing.
> You could certainly wrap new things with if tst_kvcmp. If there is a chance new
> functionality can be detected, we prefer it because various features are
> sometimes backported to enterprise distros' kernels.
>
> Also, adding new test ima_measurements02.sh with TST_MIN_KVER would also work,
> although for IMA tests I usually kept everything in a single file.
I'll add a tst_kvcmp check under the assumption that this feature will
be added before Linux 5.15.
> > +++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
> > @@ -8,6 +8,7 @@
>
> > TST_NEEDS_CMDS="awk cut sed"
> You should add sudo:
>
> TST_NEEDS_CMDS="awk cut sed sudo"
Will do.
> > TST_SETUP="setup"
> > +TST_CLEANUP="cleanup"
> > TST_CNT=3
> > TST_NEEDS_DEVICE=1
>
> > @@ -20,6 +21,13 @@ setup()
> > TEST_FILE="$PWD/test.txt"
> > POLICY="$IMA_DIR/policy"
> > [ -f "$POLICY" ] || tst_res TINFO "not using default policy"
> > +
> > + cat $IMA_POLICY > policy-original
> This might not work if CONFIG_IMA_READ_POLICY is not set. There is
> check_policy_readable() helper in ima_setup.sh. Is it really needed anyway?
It looks like CONFIG_IMA_WRITE_POLICY only makes it possible to add new
rules at runtime, not remove them, so the cleanup code didn't actually
work. I'll remove it.
> > +}
> > +
> > +cleanup()
> > +{
> > + cat policy-original > $IMA_POLICY
> Again, this will not work if CONFIG_IMA_WRITE_POLICY not set.
> And this is very likely not to be set.
The new tests require the policy to be writable. I'll move the
check_policy_writable function from ima_policy.sh to ima_setup.sh and
use it in ima_measurements.sh as well.
Thanks for the feedback,
-Alex
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-09-10 0:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 16:51 [LTP] [PATCH linux rebase] ima: add gid support Alex Henrie
2021-09-09 16:51 ` Alex Henrie
2021-09-09 16:51 ` [LTP] [PATCH ltp] IMA: Add tests for uid, gid, fowner, and fgroup options Alex Henrie
2021-09-09 16:51 ` Alex Henrie
2021-09-09 20:21 ` Petr Vorel
2021-09-09 20:21 ` Petr Vorel
2021-09-10 0:35 ` Alex Henrie [this message]
2021-09-10 0:35 ` Alex Henrie
2021-09-10 7:33 ` Petr Vorel
2021-09-10 7:33 ` Petr Vorel
2021-10-04 22:30 ` [LTP] [PATCH linux rebase] ima: add gid support 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=20210909183545.a33cb2c25f13eb2a1d7b64ac@vpitech.com \
--to=alexh@vpitech.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