summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmeta-integrity/recipes-core/initrdscripts/files/init.ima6
-rw-r--r--meta-integrity/recipes-core/initrdscripts/initrdscripts-ima.bb2
2 files changed, 5 insertions, 3 deletions
diff --git a/meta-integrity/recipes-core/initrdscripts/files/init.ima b/meta-integrity/recipes-core/initrdscripts/files/init.ima
index f117717..f11ff13 100755
--- a/meta-integrity/recipes-core/initrdscripts/files/init.ima
+++ b/meta-integrity/recipes-core/initrdscripts/files/init.ima
@@ -95,20 +95,22 @@ fi
95[ ! -d "$securityfs_dir/ima" ] && 95[ ! -d "$securityfs_dir/ima" ] &&
96 print_info "IMA is not enabled. Exiting ..." && exit 2 96 print_info "IMA is not enabled. Exiting ..." && exit 2
97 97
98keyring_id=0x`grep '\skeyring\s*\.ima: ' "${ROOT_DIR}/proc/keys" | awk '{ print $1 }'` 98mount --move ${ROOT_DIR}/proc /proc
99 99
100# The trusted IMA certificate /etc/keys/x509_evm.der in initramfs was 100# The trusted IMA certificate /etc/keys/x509_evm.der in initramfs was
101# automatically loaded by kernel already. Here is the opportunity to load 101# automatically loaded by kernel already. Here is the opportunity to load
102# a custom IMA certificate from the real rootfs. 102# a custom IMA certificate from the real rootfs.
103for cert in ${ROOT_DIR}/etc/keys/x509_evm*.der; do 103for cert in ${ROOT_DIR}/etc/keys/x509_evm*.der; do
104 [ ! -s "$cert" ] && continue 104 [ ! -s "$cert" ] && continue
105 name=`basename $cert`
105 106
106 if ! evmctl import "$cert" "$keyring_id" >"${ROOT_DIR}/dev/null"; then 107 if ! keyctl padd asymmetric "$name" %:.ima < $cert > ${ROOT_DIR}/dev/null; then
107 print_critical "Unable to load the custom IMA certificate $cert for IMA appraisal" 108 print_critical "Unable to load the custom IMA certificate $cert for IMA appraisal"
108 else 109 else
109 print_verbose "The custom IMA certificate $cert loaded for IMA appraisal" 110 print_verbose "The custom IMA certificate $cert loaded for IMA appraisal"
110 fi 111 fi
111done 112done
113mount --move /proc ${ROOT_DIR}/proc
112 114
113# Attempt to load the default policy. 115# Attempt to load the default policy.
114[ ! -s "${IMA_POLICY}" ] && IMA_POLICY="${IMA_POLICY}.default" 116[ ! -s "${IMA_POLICY}" ] && IMA_POLICY="${IMA_POLICY}.default"
diff --git a/meta-integrity/recipes-core/initrdscripts/initrdscripts-ima.bb b/meta-integrity/recipes-core/initrdscripts/initrdscripts-ima.bb
index e615e05..b261e9e 100644
--- a/meta-integrity/recipes-core/initrdscripts/initrdscripts-ima.bb
+++ b/meta-integrity/recipes-core/initrdscripts/initrdscripts-ima.bb
@@ -34,7 +34,7 @@ RDEPENDS_${PN} += "\
34 gawk \ 34 gawk \
35 util-linux-mount \ 35 util-linux-mount \
36 util-linux-umount \ 36 util-linux-umount \
37 ima-evm-utils \ 37 keyutils \
38 ima-policy \ 38 ima-policy \
39" 39"
40 40