File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -e
2+
3+ check_status () {
4+ if [ $? -ne 0 ]; then
5+ echo " Error: $1 "
6+ exit 1
7+ fi
8+ }
39
410# Check for the required CPU model parameter
511if [[ -z " $1 " ]]; then
@@ -30,23 +36,22 @@ fetch_retry() {
3036
3137# Verify regular attestation workflow on snp guest
3238snpguest report attestation-report.bin request-data.txt --random
39+ if [[ ! -f attestation-report.bin ]]; then
40+ echo " Error: attestation-report.bin not created."
41+ exit 1
42+ fi
3343snpguest display report attestation-report.bin
34-
44+ check_status " Error: Failed display attestation-report. "
3545
3646# Fetch cert
37- set +e
38- fetch_retry " snpguest fetch ca pem ${cpu_model} ./ -e vcek"
39- if [[ $? -ne 0 ]]; then
40- echo " ok"
41- exit 1
42- fi
47+ fetch_retry " snpguest fetch ca -e vcek pem ./ ${cpu_model} "
48+ check_status " Error: Failed to fetch CA certificate."
4349
44- fetch_retry " snpguest fetch vcek pem ${cpu_model} ./ attestation-report.bin"
45- if [[ $? -ne 0 ]]; then
46- exit 1
47- fi
50+ fetch_retry " snpguest fetch vcek -p ${cpu_model} pem ./ attestation-report.bin"
51+ check_status " Error: Failed to fetch VCEK certificate."
4852
4953# Verify certs
50- set -e
5154snpguest verify certs ./
52- snpguest verify attestation ./ attestation-report.bin
55+ check_status " Error: Failed to verify certificates."
56+ snpguest verify attestation -p ${cpu_model} ./ attestation-report.bin
57+ check_status " Error: Failed to verify attestation."
You can’t perform that action at this time.
0 commit comments