linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huawei.com>, mjg59@google.com
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com
Subject: Re: [PATCH 08/11] ima: Allow imasig requirement to be satisfied by EVM portable signatures
Date: Mon, 24 Aug 2020 09:02:08 -0400	[thread overview]
Message-ID: <32ef47317871a27f24287e48a2f6ac5a7e552943.camel@linux.ibm.com> (raw)
In-Reply-To: <20200618160458.1579-8-roberto.sassu@huawei.com>

On Thu, 2020-06-18 at 18:04 +0200, Roberto Sassu wrote:
> System administrators can require that all accessed files have a signature
> by specifying appraise_type=imasig in a policy rule.
> 
> Currently, only IMA signatures satisfy this requirement.

Appended signatures may also satisfy this requirement, but are not
applicable as ...

> IMA signatures
> ensure data source authentication for file content and prevent any change.
> EVM signatures instead ensure data source authentication for file metadata.
> Given that the digest or signature of the file content must be included in
> the metadata, EVM signatures provide at least the same guarantees of IMA
> signatures.

^provide the same file data guarantees of IMA signatures, as well as
providing file metadata guarantees.

> 
> This patch lets systems protected with EVM signatures pass appraisal
> verification if the appraise_type=imasig requirement is specified in the
> policy. This facilitates deployment in the scenarios where only EVM
> signatures are available.
> 
> The patch makes the following changes:
> 
> file xattr types:
> security.ima: IMA_XATTR_DIGEST/IMA_XATTR_DIGEST_NG
> security.evm: EVM_XATTR_PORTABLE_DIGSIG
> 
> execve(), mmap(), open() behavior (with appraise_type=imasig):
> before: denied (file without IMA signature, imasig requirement not met)
> after: allowed (file with EVM portable signature, imasig requirement met)
> 
> open(O_WRONLY) behavior (without appraise_type=imasig):
> before: allowed (file without IMA signature, not immutable)
> after: denied (file with EVM portable signature, immutable)
> 
> In addition, similarly to IMA signatures, this patch temporarily allows
> new files without or with incomplete metadata to be opened so that content
> can be written.
> 
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>

After addressing the comments above and below,

Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>

> ---
>  security/integrity/ima/ima_appraise.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> index 21bda264fc30..9505bb390d90 100644
> --- a/security/integrity/ima/ima_appraise.c
> +++ b/security/integrity/ima/ima_appraise.c
> @@ -219,12 +219,16 @@ static int xattr_verify(enum ima_hooks func, struct integrity_iint_cache *iint,
>  		hash_start = 1;
>  		/* fall through */
>  	case IMA_XATTR_DIGEST:
> -		if (iint->flags & IMA_DIGSIG_REQUIRED) {
> -			*cause = "IMA-signature-required";
> -			*status = INTEGRITY_FAIL;
> -			break;
> +		if (*status != INTEGRITY_PASS_IMMUTABLE) {
> +			if (iint->flags & IMA_DIGSIG_REQUIRED) {
> +				*cause = "IMA-signature-required";
> +				*status = INTEGRITY_FAIL;
> +				break;
> +			}
> +			clear_bit(IMA_DIGSIG, &iint->atomic_flags);
> +		} else {
> +			set_bit(IMA_DIGSIG, &iint->atomic_flags);
>  		}
> -		clear_bit(IMA_DIGSIG, &iint->atomic_flags);
>  		if (xattr_len - sizeof(xattr_value->type) - hash_start >=
>  				iint->ima_hash->length)
>  			/*
> @@ -394,6 +398,8 @@ int ima_appraise_measurement(enum ima_hooks func,
>  		cause = "missing-HMAC";
>  		goto out;
>  	case INTEGRITY_FAIL_IMMUTABLE:
> +		set_bit(IMA_DIGSIG, &iint->atomic_flags);
> +		fallthrough;
>  	case INTEGRITY_FAIL:		/* Invalid HMAC/signature. */
>  		cause = "invalid-HMAC";
>  		goto out;
> @@ -437,9 +443,9 @@ int ima_appraise_measurement(enum ima_hooks func,
>  				status = INTEGRITY_PASS;
>  		}
>  
> -		/* Permit new files with file signatures, but without data. */
> +		/* Permit new files marked as immutable, but without data. */

This comment isn't quite right.

>  		if (inode->i_size == 0 && iint->flags & IMA_NEW_FILE &&
> -		    xattr_value && xattr_value->type == EVM_IMA_XATTR_DIGSIG) {
> +		    test_bit(IMA_DIGSIG, &iint->atomic_flags)) {
>  			status = INTEGRITY_PASS;
>  		}
>  



  reply	other threads:[~2020-08-24 13:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200618160329.1263-2-roberto.sassu@huawei.com>
2020-06-18 16:04 ` [PATCH 06/11] evm: Allow setxattr() and setattr() if metadata digest won't change Roberto Sassu
2020-08-24 12:17   ` Mimi Zohar
2020-08-31  8:51     ` Roberto Sassu
2020-06-18 16:04 ` [PATCH 07/11] evm: Set IMA_CHANGE_XATTR/ATTR bit if EVM_ALLOW_METADATA_WRITES is set Roberto Sassu
2020-08-24 12:17   ` Mimi Zohar
2020-09-01  9:08     ` Roberto Sassu
2020-09-01 11:05       ` Mimi Zohar
2020-09-01 11:41         ` Roberto Sassu
2020-09-01 12:55           ` Mimi Zohar
2020-06-18 16:04 ` [PATCH 08/11] ima: Allow imasig requirement to be satisfied by EVM portable signatures Roberto Sassu
2020-08-24 13:02   ` Mimi Zohar [this message]
2020-06-18 16:04 ` [PATCH 09/11] ima: Don't remove security.ima if file must not be appraised Roberto Sassu
2020-08-24 13:02   ` Mimi Zohar
2020-06-18 16:04 ` [PATCH 10/11] ima: Don't ignore errors from crypto_shash_update() Roberto Sassu
2020-08-24 13:02   ` Mimi Zohar
2020-06-18 16:06 ` [PATCH 11/11] ima: Remove semicolon at the end of ima_get_binary_runtime_size() Roberto Sassu

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=32ef47317871a27f24287e48a2f6ac5a7e552943.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=roberto.sassu@huawei.com \
    --cc=silviu.vlasceanu@huawei.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).