Skip to content

Commit

Permalink
fix(integrity): do not enable EVM if there is no key
Browse files Browse the repository at this point in the history
Track when a key is successfully loaded, and return 1 if no key has been
loaded.  This will not enable EVM if there are no keys available in the
system.

Fix #1847

Signed-off-by: Alberto Planas <aplanas@suse.com>
  • Loading branch information
aplanas authored and johannbg committed Jun 21, 2022
1 parent 9d1004a commit 90585c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules.d/98integrity/evm-enable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ load_evm_x509() {
fi
# load the default EVM public key onto the EVM keyring along
# with all the other ones in $EVMKEYSDIR
local key_imported=1
for PUBKEY in ${EVMX509PATH} "${NEWROOT}${EVMKEYSDIR}"/*; do
if [ ! -f "${PUBKEY}" ]; then
if [ "${RD_DEBUG}" = "yes" ]; then
Expand All @@ -110,13 +111,14 @@ load_evm_x509() {
info "integrity: failed to load the EVM X509 cert ${PUBKEY}"
return 1
fi
key_imported=0
done

if [ "${RD_DEBUG}" = "yes" ]; then
keyctl show @u
fi

return 0
return ${key_imported}
}

unload_evm_key() {
Expand Down

0 comments on commit 90585c6

Please sign in to comment.