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 v2 11/12] ima: Introduce template field evmsig and write to field sig as fallback
Date: Thu, 17 Sep 2020 10:25:08 -0400 [thread overview]
Message-ID: <c8d3c70e74e607a4b73239bef1e9db0d304200fc.camel@linux.ibm.com> (raw)
In-Reply-To: <20200904092643.20013-7-roberto.sassu@huawei.com>
Hi Roberto,
On Fri, 2020-09-04 at 11:26 +0200, Roberto Sassu wrote:
> With the patch to accept EVM portable signatures when the
> appraise_type=imasig requirement is specified in the policy, appraisal can
> be successfully done even if the file does not have an IMA signature.
>
> However, remote attestation would not see that a different signature type
> was used, as only IMA signatures can be included in the measurement list.
> This patch solves the issue by introducing the new template field 'evmsig'
> to show EVM portable signatures and by including its value in the existing
> field 'sig' if the IMA signature is not found.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
Thank you! Just a minor comment below.
<snip>
> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
> index c022ee9e2a4e..2c596c2a89cc 100644
> --- a/security/integrity/ima/ima_template_lib.c
> +++ b/security/integrity/ima/ima_template_lib.c
>
> @@ -438,7 +439,7 @@ int ima_eventsig_init(struct ima_event_data *event_data,
> struct evm_ima_xattr_data *xattr_value = event_data->xattr_value;
>
> if ((!xattr_value) || (xattr_value->type != EVM_IMA_XATTR_DIGSIG))
> - return 0;
> + return ima_eventevmsig_init(event_data, field_data);
>
> return ima_write_template_field_data(xattr_value, event_data->xattr_len,
> DATA_FMT_HEX, field_data);
> @@ -484,3 +485,39 @@ int ima_eventmodsig_init(struct ima_event_data *event_data,
> return ima_write_template_field_data(data, data_len, DATA_FMT_HEX,
> field_data);
> }
> +
> +/*
> + * ima_eventevmsig_init - include the EVM portable signature as part of the
> + * template data
> + */
> +int ima_eventevmsig_init(struct ima_event_data *event_data,
> + struct ima_field_data *field_data)
> +{
> + struct evm_ima_xattr_data *xattr_data = NULL;
> + int rc = 0;
> +
> + if (!event_data->file)
> + return 0;
> +
> + if (!(file_inode(event_data->file)->i_opflags & IOP_XATTR))
> + return 0;
> +
> + rc = vfs_getxattr_alloc(file_dentry(event_data->file), XATTR_NAME_EVM,
> + (char **)&xattr_data, 0, GFP_NOFS);
> + if (rc <= 0) {
> + if (!rc || rc == -ENODATA)
> + return 0;
> +
> + return rc;
We're including the EVM signature on a best effort basis to help with
attestation. Do we really care why it failed? Are we going to act on
it?
Mimi
> + }
> +
> + if (xattr_data->type != EVM_XATTR_PORTABLE_DIGSIG) {
> + kfree(xattr_data);
> + return 0;
> + }
> +
> + rc = ima_write_template_field_data((char *)xattr_data, rc, DATA_FMT_HEX,
> + field_data);
> + kfree(xattr_data);
> + return rc;
> +}
next prev parent reply other threads:[~2020-09-17 14:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 9:23 [PATCH v2 00/12] IMA/EVM fixes Roberto Sassu
2020-09-04 9:23 ` [PATCH v2 01/12] ima: Don't ignore errors from crypto_shash_update() Roberto Sassu
2020-09-04 9:23 ` [PATCH v2 02/12] ima: Remove semicolon at the end of ima_get_binary_runtime_size() Roberto Sassu
2020-09-04 9:23 ` [PATCH v2 03/12] evm: Check size of security.evm before using it Roberto Sassu
2020-09-04 9:23 ` [PATCH v2 04/12] evm: Execute evm_inode_init_security() only when the HMAC key is loaded Roberto Sassu
2020-09-16 16:15 ` Mimi Zohar
2020-09-04 9:26 ` [PATCH v2 05/12] evm: Load EVM key in ima_load_x509() to avoid appraisal Roberto Sassu
2020-09-04 9:26 ` [PATCH v2 06/12] evm: Refuse EVM_ALLOW_METADATA_WRITES only if the HMAC key is loaded Roberto Sassu
2020-09-04 9:26 ` [PATCH v2 07/12] evm: Introduce EVM_RESET_STATUS atomic flag Roberto Sassu
2020-09-17 12:01 ` Mimi Zohar
2020-09-17 17:36 ` Roberto Sassu
2020-09-17 17:47 ` Mimi Zohar
2020-09-04 9:26 ` [PATCH v2 08/12] evm: Allow xattr/attr operations for portable signatures if check fails Roberto Sassu
2020-09-17 12:32 ` Mimi Zohar
2020-09-04 9:26 ` [PATCH v2 09/12] evm: Allow setxattr() and setattr() if metadata digest won't change Roberto Sassu
2020-09-17 13:15 ` Mimi Zohar
2020-09-04 9:26 ` [PATCH v2 10/12] ima: Allow imasig requirement to be satisfied by EVM portable signatures Roberto Sassu
2020-09-04 9:26 ` [PATCH v2 11/12] ima: Introduce template field evmsig and write to field sig as fallback Roberto Sassu
2020-09-17 14:25 ` Mimi Zohar [this message]
2020-09-17 15:05 ` Roberto Sassu
2020-09-17 15:55 ` Mimi Zohar
2020-09-04 9:26 ` [PATCH v2 12/12] ima: Don't remove security.ima if file must not be appraised Roberto Sassu
2020-09-16 16:14 ` [PATCH v2 00/12] IMA/EVM fixes Mimi Zohar
2020-09-17 14:33 ` 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=c8d3c70e74e607a4b73239bef1e9db0d304200fc.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).