summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYunguo Wei <yunguo.wei@windriver.com>2018-10-26 10:16:42 +0800
committerJia Zhang <zhang.jia@linux.alibaba.com>2018-11-07 14:22:47 +0800
commit37a59625e5cc1cebb95427fdbc86826e02d7e065 (patch)
tree95ea9b3fd9fffc08187db6eacd34228130393ee4
parentbf314c0d0c9d38c3d4b8ab4fb0cdfd77cddfa59e (diff)
downloadmeta-secure-core-37a59625e5cc1cebb95427fdbc86826e02d7e065.tar.gz
key-store: rename ima private key and certificate on target
If sample keys are selected, key-store service will deploy IMA private key during first boot, but beople may be confused if we deploy a sample private key like "xxx.crt", so this commit is making sure key/cert on target are consistent with key files on build system. Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
-rw-r--r--meta-integrity/README.md13
-rwxr-xr-xmeta-integrity/recipes-core/initrdscripts/files/init.ima4
-rw-r--r--meta-integrity/recipes-kernel/linux/linux-yocto/ima.cfg2
-rw-r--r--meta-signing-key/recipes-support/key-store/key-store_0.1.bb4
4 files changed, 18 insertions, 5 deletions
diff --git a/meta-integrity/README.md b/meta-integrity/README.md
index 8ffd484..ad17c05 100644
--- a/meta-integrity/README.md
+++ b/meta-integrity/README.md
@@ -110,6 +110,19 @@ default, the sample keys are used for the purpose of development and
110demonstration. Please ensure you know what your risk is to use the sample keys 110demonstration. Please ensure you know what your risk is to use the sample keys
111in your product, because they are completely public. 111in your product, because they are completely public.
112 112
113If sample keys are used, the private IMA key is installed as /etc/keys/x509_ima.key.
114
115A typical signing command is as following:
116
117 # evmctl ima_sign --hashalgo sha256 --key /etc/keys/x509_ima.key --pass=<passowrd> /path/to/file
118or
119
120 # evmctl ima_sign --hashalgo sha256 --key /etc/keys/x509_ima.key --pass=<passowrd> -r /path/to/directory
121
122The following command can be used to verify a file's IMA signature with specified certificate:
123
124 # evmctl ima_verify --key /etc/keys/x509_ima.der /path/to/file
125
113### RPM File Signing 126### RPM File Signing
114The payloads in a RPM are signed by the private key during the build, and each 127The payloads in a RPM are signed by the private key during the build, and each
115IMA signatures for the corresponding payload file will be eventually written 128IMA signatures for the corresponding payload file will be eventually written
diff --git a/meta-integrity/recipes-core/initrdscripts/files/init.ima b/meta-integrity/recipes-core/initrdscripts/files/init.ima
index c663817..8934cfc 100755
--- a/meta-integrity/recipes-core/initrdscripts/files/init.ima
+++ b/meta-integrity/recipes-core/initrdscripts/files/init.ima
@@ -110,10 +110,10 @@ for cert in ${ROOT_DIR}/etc/keys/x509_secondary_*.der; do
110 fi 110 fi
111done 111done
112 112
113# The trusted IMA certificate /etc/keys/x509_evm.der in initramfs was 113# The trusted IMA certificate /etc/keys/x509_ima.der in initramfs was
114# automatically loaded by kernel already. Here is the opportunity to load 114# automatically loaded by kernel already. Here is the opportunity to load
115# a custom IMA certificate from the real rootfs. 115# a custom IMA certificate from the real rootfs.
116for cert in ${ROOT_DIR}/etc/keys/x509_evm*.der; do 116for cert in ${ROOT_DIR}/etc/keys/x509_ima*.der; do
117 [ ! -s "$cert" ] && continue 117 [ ! -s "$cert" ] && continue
118 name=`basename $cert` 118 name=`basename $cert`
119 119
diff --git a/meta-integrity/recipes-kernel/linux/linux-yocto/ima.cfg b/meta-integrity/recipes-kernel/linux/linux-yocto/ima.cfg
index 9cd609b..0d7e66c 100644
--- a/meta-integrity/recipes-kernel/linux/linux-yocto/ima.cfg
+++ b/meta-integrity/recipes-kernel/linux/linux-yocto/ima.cfg
@@ -19,5 +19,5 @@ CONFIG_IMA_APPRAISE_BOOTPARAM=y
19CONFIG_IMA_TRUSTED_KEYRING=y 19CONFIG_IMA_TRUSTED_KEYRING=y
20CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY=y 20CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY=y
21CONFIG_IMA_BLACKLIST_KEYRING=y 21CONFIG_IMA_BLACKLIST_KEYRING=y
22CONFIG_IMA_X509_PATH="/etc/keys/x509_evm.der" 22CONFIG_IMA_X509_PATH="/etc/keys/x509_ima.der"
23# CONFIG_IMA_APPRAISE_SIGNED_INIT is not set 23# CONFIG_IMA_APPRAISE_SIGNED_INIT is not set
diff --git a/meta-signing-key/recipes-support/key-store/key-store_0.1.bb b/meta-signing-key/recipes-support/key-store/key-store_0.1.bb
index f5c3e75..d83b79c 100644
--- a/meta-signing-key/recipes-support/key-store/key-store_0.1.bb
+++ b/meta-signing-key/recipes-support/key-store/key-store_0.1.bb
@@ -24,7 +24,7 @@ SECONDARY_TRUSTED_PRIV_KEY = "${KEY_DIR}/secondary_trusted_key.key"
24MODSIGN_PRIV_KEY = "${KEY_DIR}/modsign_key.key" 24MODSIGN_PRIV_KEY = "${KEY_DIR}/modsign_key.key"
25 25
26# For ${PN}-ima-privkey 26# For ${PN}-ima-privkey
27IMA_PRIV_KEY = "${KEY_DIR}/privkey_evm.crt" 27IMA_PRIV_KEY = "${KEY_DIR}/x509_ima.key"
28 28
29# For ${PN}-system-trusted-cert 29# For ${PN}-system-trusted-cert
30SYSTEM_CERT = "${KEY_DIR}/system_trusted_key.crt" 30SYSTEM_CERT = "${KEY_DIR}/system_trusted_key.crt"
@@ -37,7 +37,7 @@ SECONDARY_TRUSTED_DER_ENC_CERT = "${KEY_DIR}/x509_secondary_system_trusted_key.d
37MODSIGN_CERT = "${KEY_DIR}/modsign_key.crt" 37MODSIGN_CERT = "${KEY_DIR}/modsign_key.crt"
38 38
39# For ${PN}-ima-cert 39# For ${PN}-ima-cert
40IMA_CERT = "${KEY_DIR}/x509_evm.der" 40IMA_CERT = "${KEY_DIR}/x509_ima.der"
41 41
42python () { 42python () {
43 if not (uks_signing_model(d) in "sample", "user"): 43 if not (uks_signing_model(d) in "sample", "user"):