chiark / gitweb /
Add support for ConditionSecurity=ima
authorAuke Kok <auke-jan.h.kok@intel.com>
Sat, 11 May 2013 20:40:08 +0000 (13:40 -0700)
committerAuke Kok <auke-jan.h.kok@intel.com>
Sat, 11 May 2013 20:42:55 +0000 (13:42 -0700)
Just as with SMACK, we don't really know if a policy has been
loaded or not, as the policy interface is write-only. Assume
therefore that if ima is present in securityfs that it is
enabled.

Update the man page to reflect that "ima" is a valid option
now as well.

TODO
man/systemd.unit.xml
src/core/condition.c

diff --git a/TODO b/TODO
index 8d4b937a5a505ec0d034a56594820876648ce77f..9b276746f106de06241ffe9581bcb3a829c02510 100644 (file)
--- a/TODO
+++ b/TODO
@@ -456,8 +456,6 @@ Features:
 
 * ExecOnFailure=/usr/bin/foo
 
-* ConditionSecurity= should learn about IMA and SMACK
-
 * udev:
   - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n)
   - move to LGPL
index c56837a6e53c0650645ed1d035ba132882372c90..5ab988178de3e9f4cc388a79bc1ac71b514bae2c 100644 (file)
                                 <para><varname>ConditionSecurity=</varname>
                                 may be used to check whether the given
                                 security module is enabled on the
-                                system.  Currently the only recognized
+                                system. Currently the recognized values
                                 values are <varname>selinux</varname>,
-                                <varname>apparmor</varname>, and
+                                <varname>apparmor</varname>,
+                                <varname>ima</varname> and
                                 <varname>smack</varname>.
                                 The test may be negated by prepending
                                 an exclamation
index abed4e5bf07be9950ebf80a51357a882c1ee3868..4293d6d1f190e7b386d2fa4e0a61d6f669283756 100644 (file)
@@ -164,6 +164,8 @@ static bool test_security(const char *parameter) {
 #endif
         if (streq(parameter, "apparmor"))
                 return access("/sys/kernel/security/apparmor/", F_OK) == 0;
+        if (streq(parameter, "ima"))
+                return access("/sys/kernel/security/ima/", F_OK) == 0;
         if (streq(parameter, "smack"))
                 return access("/sys/fs/smackfs", F_OK) == 0;
         return false;