ima: require signature based appraisal
authorDmitry Kasatkin <d.kasatkin@samsung.com>
Wed, 5 Nov 2014 15:01:16 +0000 (17:01 +0200)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Tue, 18 Nov 2014 04:12:01 +0000 (23:12 -0500)
This patch provides CONFIG_IMA_APPRAISE_SIGNED_INIT kernel configuration
option to force IMA appraisal using signatures. This is useful, when EVM
key is not initialized yet and we want securely initialize integrity or
any other functionality.

It forces embedded policy to require signature. Signed initialization
script can initialize EVM key, update the IMA policy and change further
requirement of everything to be signed.

Changes in v3:
* kernel parameter fixed to configuration option in the patch description

Changes in v2:
* policy change of this patch separated from the key loading patch

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
security/integrity/ima/Kconfig
security/integrity/ima/ima_policy.c

index b0840f9a552ffbb3e363ac95a8a08f2275d0c0c2..b80a93ec1ccc518cbeb35d5169a693ccfac8bd69 100644 (file)
@@ -149,3 +149,10 @@ config IMA_X509_PATH
        default "/etc/keys/x509_ima.der"
        help
           This option defines IMA X509 certificate path.
+
+config IMA_APPRAISE_SIGNED_INIT
+       bool "Require signed user-space initialization"
+       depends on IMA_LOAD_X509
+       default n
+       help
+          This option requires user-space init to be signed.
index 0d14d25918051c5e8119e4a357639c5822b67f03..d1eefb9d65fb2bb457c280103ed9913fc4ade255 100644 (file)
@@ -100,7 +100,13 @@ static struct ima_rule_entry default_appraise_rules[] = {
        {.action = DONT_APPRAISE, .fsmagic = SECURITYFS_MAGIC, .flags = IMA_FSMAGIC},
        {.action = DONT_APPRAISE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC},
        {.action = DONT_APPRAISE, .fsmagic = CGROUP_SUPER_MAGIC, .flags = IMA_FSMAGIC},
+#ifndef CONFIG_IMA_APPRAISE_SIGNED_INIT
        {.action = APPRAISE, .fowner = GLOBAL_ROOT_UID, .flags = IMA_FOWNER},
+#else
+       /* force signature */
+       {.action = APPRAISE, .fowner = GLOBAL_ROOT_UID,
+        .flags = IMA_FOWNER | IMA_DIGSIG_REQUIRED},
+#endif
 };
 
 static LIST_HEAD(ima_default_rules);