public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: THOBY Simon <Simon.THOBY@viveris.fr>,
	"dmitry.kasatkin@gmail.com" <dmitry.kasatkin@gmail.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	BARVAUX Didier <Didier.BARVAUX@viveris.fr>
Subject: Re: [PATCH v8 6/6] IMA: prevent SETXATTR_CHECK policy rules with unavailable algorithms
Date: Mon, 16 Aug 2021 18:20:26 -0400	[thread overview]
Message-ID: <aa0c635a090ff6849c4334566d6721ee036c491f.camel@linux.ibm.com> (raw)
In-Reply-To: <20210816081056.24530-7-Simon.THOBY@viveris.fr>

On Mon, 2021-08-16 at 08:11 +0000, THOBY Simon wrote:
> SETXATTR_CHECK poliy rules assume that any algorithm listed in the
> 'appraise_algos' flag must be accepted when performing setxattr()
> on the security.ima xattr.
> However nothing checks that they are available in the current kernel.
> A userland application could hash a file with a digest that the kernel
> wouldn't be able to verify. However, if SETXATTR_CHECK is not in use,
> the kernel already forbids that xattr write.

I assume the above couple of sentences are a continuation of the
previous paragraph and concatenated them.  If it really is meant to be
a separate paragraph a blank line needs to separate them.

> 
> Verify that algorithms listed in appraise_algos are available to the
> current kernel and reject the policy update otherwise. This will fix
> the inconsistency between SETXATTR_CHECK and non-SETXATTR_CHECK
> behaviors.
> 
> That filtering is only performed in ima_parse_appraise_algos() when
> updating policies so that we do not have to pay the price of allocating
> a hash object every time validate_hash_algo() is called in
> ima_inode_setxattr().
> 
> Signed-off-by: THOBY Simon <Simon.THOBY@viveris.fr>

Thanks, Simon.  Before pushing out the entire patch set, including this
one, to next-integrity-testing branch,  I reverted the tag re-ordering, 
fixed the line length of the sample appraise rule, and added the commit
number (for stable) in the patch description.  Please verify.

While testing, I noticed similar support is needed for appended
signatures.  For example, "scripts/sign-file" can be used to sign
kernel modules or the kernel image.

Sample kexec rules:
measure func=KEXEC_KERNEL_CHECK template=ima-modsig
appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig|modsig appraise_algos=sha256

thanks,

Mimi




  reply	other threads:[~2021-08-16 22:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  8:10 [PATCH v8 0/6] IMA: restrict the accepted digest algorithms for the security.ima xattr THOBY Simon
2021-08-16  8:10 ` [PATCH v8 2/6] IMA: block writes of the security.ima xattr with unsupported algorithms THOBY Simon
2021-08-16  8:10 ` [PATCH v8 1/6] IMA: remove the dependency on CRYPTO_MD5 THOBY Simon
2021-08-16  8:11 ` [PATCH v8 3/6] IMA: add support to restrict the hash algorithms used for file appraisal THOBY Simon
2021-08-16  8:11 ` [PATCH v8 4/6] IMA: add a policy option to restrict xattr hash algorithms on appraisal THOBY Simon
2021-08-16  8:11 ` [PATCH v8 6/6] IMA: prevent SETXATTR_CHECK policy rules with unavailable algorithms THOBY Simon
2021-08-16 22:20   ` Mimi Zohar [this message]
2021-08-17  6:44     ` THOBY Simon
2021-08-16  8:11 ` [PATCH v8 5/6] IMA: introduce a new policy option func=SETXATTR_CHECK THOBY Simon

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=aa0c635a090ff6849c4334566d6721ee036c491f.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=Didier.BARVAUX@viveris.fr \
    --cc=Simon.THOBY@viveris.fr \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    /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