Re: [PATCH v10 09/12] ima: Implement support for module-style appended signatures
From: Mimi Zohar
Date: Tue May 14 2019 - 08:11:29 EST
Hi Thiago,
On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote:
>
> @@ -326,6 +356,10 @@ int ima_appraise_measurement(enum ima_hooks func,
> ÂÂÂÂÂÂÂÂcase INTEGRITY_UNKNOWN:
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> ÂÂÂÂÂÂÂÂcase INTEGRITY_NOXATTRS:ÂÂÂÂÂÂÂÂ/* No EVM protected xattrs. */
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* It's fine not to have xattrs when using a modsig. */
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (try_modsig)
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* fall through */
> ÂÂÂÂÂÂÂÂcase INTEGRITY_NOLABEL:ÂÂÂÂÂÂÂÂÂ/* No security.evm xattr. */
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcause = "missing-HMAC";
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂgoto out;
> @@ -340,6 +374,14 @@ int ima_appraise_measurement(enum ima_hooks func,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrc = xattr_verify(func, iint, xattr_value, xattr_len, &status,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ &cause);
> Â
> +ÂÂÂÂÂÂÂ/*
> +ÂÂÂÂÂÂÂ * If we have a modsig and either no imasig or the imasig's key isn't
> +ÂÂÂÂÂÂÂ * known, then try verifying the modsig.
> +ÂÂÂÂÂÂÂ */
> +ÂÂÂÂÂÂÂif (status != INTEGRITY_PASS && try_modsig &&
> +ÂÂÂÂÂÂÂÂÂÂ (!xattr_value || rc == -ENOKEY))
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrc = modsig_verify(func, modsig, &status, &cause);
EVM protects other security xattrs, not just security.ima, if they
exist. ÂAs a result, evm_verifyxattr() could pass based on the other
security xattrs.
Mimi
> +
> Âout:
> ÂÂÂÂÂÂÂÂ/*
> ÂÂÂÂÂÂÂÂ * File signatures on some filesystems can not be properly verified.