Re: [PATCH v3 4/5] LSM: Define SELinux function to measure security state

From: Mimi Zohar
Date: Mon Jul 20 2020 - 13:27:06 EST


On Mon, 2020-07-20 at 13:06 -0400, Stephen Smalley wrote:
>
>
> I applied the patch series on top of the next-integrity branch, added
> measure func=LSM_STATE to ima-policy, and booted that kernel. I get
> the following entries in ascii_runtime_measurements, but seemingly
> missing the final field:
>
> 10 8a09c48af4f8a817f59b495bd82971e096e2e367 ima-ng
> sha256:21c3d7b09b62b4d0b3ed15ba990f816b94808f90b76787bfae755c4b3a44cd24
> selinux-state
> 10 e610908931d70990a2855ddb33c16af2d82ce56a ima-ng
> sha256:c8898652afd5527ef4eaf8d85f5fee1d91fcccee34bc97f6e55b96746bedb318
> selinux-policy-hash
>
> Thus, I cannot verify. What am I missing?

Missing is "template=ima-buf" on the policy rule.

Tyler's patch set just added some support for verifying the policy.
ÂRefer to ima_validate_rule(). ÂThere are still some things missing.
ÂFor example, nayna noticed that making sure that asymmetric key
support is enabled. ÂAnother example is requiring "template=" for any
of the buffer measurements. ÂTemplate names can be defined
dynamically, so it will need to support either format:

measure func=KEXEC_CMDLINE template=ima-bufÂ
measure func=KEXEC_CMDLINE template=d-ng|n-ng|buf

Mimi