Skip to content

Commit

Permalink
powerpc/ima: Define trusted boot policy
Browse files Browse the repository at this point in the history
This patch defines an arch-specific trusted boot only policy and a
combined secure and trusted boot policy.

Signed-off-by: Nayna Jain <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
naynajain authored and mpe committed Nov 12, 2019
1 parent 2702809 commit 1917855
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion arch/powerpc/kernel/ima_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,45 @@ static const char *const secure_rules[] = {
NULL
};

/*
* The "trusted_rules" are enabled only on "trustedboot" enabled systems.
* These rules add the kexec kernel image and kernel modules file hashes to
* the IMA measurement list.
*/
static const char *const trusted_rules[] = {
"measure func=KEXEC_KERNEL_CHECK",
"measure func=MODULE_CHECK",
NULL
};

/*
* The "secure_and_trusted_rules" contains rules for both the secure boot and
* trusted boot. The "template=ima-modsig" option includes the appended
* signature, when available, in the IMA measurement list.
*/
static const char *const secure_and_trusted_rules[] = {
"measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
"measure func=MODULE_CHECK template=ima-modsig",
"appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig|modsig",
#ifndef CONFIG_MODULE_SIG_FORCE
"appraise func=MODULE_CHECK appraise_type=imasig|modsig",
#endif
NULL
};

/*
* Returns the relevant IMA arch-specific policies based on the system secure
* boot state.
*/
const char *const *arch_get_ima_policy(void)
{
if (is_ppc_secureboot_enabled())
return secure_rules;
if (is_ppc_trustedboot_enabled())
return secure_and_trusted_rules;
else
return secure_rules;
else if (is_ppc_trustedboot_enabled())
return trusted_rules;

return NULL;
}

0 comments on commit 1917855

Please sign in to comment.