Skip to contentSkip to conversation

98integrity: support validating the IMA policy file signature

PATCH In review Stefan Berger 2 participants 2 messages Oct 13, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 98integrity: support validating the IMA policy file signature

From: Stefan Berger <stefanb-r/[email protected]>

IMA validates file signatures based on the security.ima xattr. As of Linux-4.7, instead of cat'ing the IMA policy into the securityfs policy, the IMA policy pathname can be written, allowing the IMA policy file signature to be validated.

This patch first attempts to write the pathname, but on failure falls back to cat'ing the IMA policy contents .

---
 modules.d/98integrity/ima-policy-load.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
modules.d/98integrity/ima-policy-load.sh +2 -1
index 0061cff..5460d02 100755
@@ -30,7 +30,8 @@ load_ima_policy()
     # check the existence of the IMA policy file
     [ -f "${IMAPOLICYPATH}" ] && {
         info "Loading the provided IMA custom policy";
-        cat ${IMAPOLICYPATH} > ${IMASECDIR}/policy;
+        echo -n "${IMAPOLICYPATH}" > ${IMASECDIR}/policy || \
+            cat "${IMAPOLICYPATH}" > ${IMASECDIR}/policy
     }
 
     return 0
Signature · 1 line
2.7.0

A message that is not in the archive (sent off-list or not yet received): 1476388264-23649-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org