eBPF-based security platform
attest: name the failed check behind every verify failure
Daniel Borkmannd7bf7fbfcc7a
diff --git a/testing/t0048-config-attest.sh b/testing/t0048-config-attest.shindex 95c62ce3..9eba24a4 100755--- a/testing/t0048-config-attest.sh+++ b/testing/t0048-config-attest.sh@@ -160,6 +160,13 @@ for document in "$WORK"/bad-*.json; do'done+test_expect_success 'an inconsistent config history names the check it fails' '+ ! verify "$WORK/bad-reordered.json" >"$WORK/reordered-report" 2>/dev/null &&+ grep -qx "FAIL: config: the events are one boot event followed by updates in sequence" \+ "$WORK/reordered-report" &&+ grep -qx "verdict: FAIL" "$WORK/reordered-report"+'+test_expect_success 'pending effects prevent evidence collection despite a measured selection' '! SHIRUDO_TEST_CONFIG_TPM=1 SHIRUDO_TEST_CONFIG_ACTIVATE_FAIL=1 \"$U" "$WORK/config" update C >/dev/null &&diff --git a/util/attest.c b/util/attest.cindex 30890268..679db349 100644--- a/util/attest.c+++ b/util/attest.c@@ -902,6 +902,8 @@ int attest_verify(const char *evidence, size_t len,}rc = shirudo_config_evidence_parse(evidence, len, &config);+ if (rc == -EKEYREJECTED)+ say(&rep, false, "config: the events are one boot event followed by updates in sequence");if (rc)goto out;@@ -1115,6 +1117,9 @@ int attest_verify(const char *evidence, size_t len,branch_written, branch_init, policy);if (rc) {say(&rep, false, "register: cannot compute the signed write policy");+ /* Malformed recorded values are the document's failure, not a parse error. */+ if (rc == -EINVAL)+ rc = -EKEYREJECTED;goto out;}tpm_nv_name(SHIRUDO_NV_INDEX,