Skip to content

Commit

Permalink
ima: require signed IMA policy
Browse files Browse the repository at this point in the history
Require the IMA policy to be signed when additional rules can be added.

v1:
- initialize the policy flag
- include IMA_APPRAISE_POLICY in the policy flag

Signed-off-by: Mimi Zohar <[email protected]>
Acked-by: Petko Manolov <[email protected]>
Acked-by: Dmitry Kasatkin <[email protected]>
  • Loading branch information
Mimi Zohar committed Feb 21, 2016
1 parent 19f8a84 commit 95ee08f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions security/integrity/ima/ima_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ static struct ima_rule_entry default_appraise_rules[] = {
{.action = DONT_APPRAISE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC},
{.action = DONT_APPRAISE, .fsmagic = NSFS_MAGIC, .flags = IMA_FSMAGIC},
{.action = DONT_APPRAISE, .fsmagic = CGROUP_SUPER_MAGIC, .flags = IMA_FSMAGIC},
#ifdef CONFIG_IMA_WRITE_POLICY
{.action = APPRAISE, .func = POLICY_CHECK,
.flags = IMA_FUNC | IMA_DIGSIG_REQUIRED},
#endif
#ifndef CONFIG_IMA_APPRAISE_SIGNED_INIT
{.action = APPRAISE, .fowner = GLOBAL_ROOT_UID, .flags = IMA_FOWNER},
#else
Expand Down Expand Up @@ -412,9 +416,12 @@ void __init ima_init_policy(void)
for (i = 0; i < appraise_entries; i++) {
list_add_tail(&default_appraise_rules[i].list,
&ima_default_rules);
if (default_appraise_rules[i].func == POLICY_CHECK)
temp_ima_appraise |= IMA_APPRAISE_POLICY;
}

ima_rules = &ima_default_rules;
ima_update_policy_flag();
}

/* Make sure we have a valid policy, at least containing some rules. */
Expand Down

0 comments on commit 95ee08f

Please sign in to comment.