2021-11-16 16:51:42 -05:00
|
|
|
#!/bin/bash
|
|
|
|
#########################################################################################
|
|
|
|
# HIRS ACA Policy System Tests
|
|
|
|
#
|
|
|
|
#########################################################################################
|
|
|
|
testResult=false
|
|
|
|
totalTests=0;
|
|
|
|
failedTests=0;
|
|
|
|
|
|
|
|
# Start ACA Policy Tests
|
2022-02-03 16:03:15 -05:00
|
|
|
# provisionTpm2 takes 1 parameter (the expected result): "pass" or "fail"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 1: Test ACA default policy ###"
|
2022-01-10 16:56:27 -05:00
|
|
|
setPlatformCerts "laptop" "empty"
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "pass"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 2: Test EK cert Only Validation Policy without a EK Issuer Cert in the trust store ###"
|
2021-11-17 11:33:44 -05:00
|
|
|
setPolicyEkOnly
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "fail"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 3: Test EK Only Validation Policy ###"
|
2021-11-16 16:51:42 -05:00
|
|
|
uploadTrustedCerts
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "pass"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 4: Test PC Validation Policy with no PC ###"
|
2021-11-16 16:51:42 -05:00
|
|
|
setPolicyEkPc_noAttCheck
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "fail"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 5: Test FW and PC Validation Policy with no PC ###"
|
2021-11-16 16:51:42 -05:00
|
|
|
setPolicyEkPcFw
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "fail"
|
2021-11-16 16:51:42 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 6: Test PC Validation Policy with valid PC ###"
|
2022-01-10 13:36:38 -05:00
|
|
|
clearAcaDb
|
|
|
|
setPolicyEkPc
|
|
|
|
uploadTrustedCerts
|
|
|
|
setPlatformCerts "laptop" "default"
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "pass"
|
2022-01-10 13:36:38 -05:00
|
|
|
|
2022-01-26 12:08:29 -05:00
|
|
|
writeToLogs "### ACA POLICY TEST 7: Test PC with RIM Validation Policy with valid PC and RIM ###"
|
2022-01-25 10:54:54 -05:00
|
|
|
setPolicyEkPcFw
|
2022-02-17 12:02:49 -05:00
|
|
|
setRims "laptop" "default" "none"
|
2022-01-26 12:08:29 -05:00
|
|
|
provisionTpm2 "pass"
|
2022-01-25 10:54:54 -05:00
|
|
|
|
2021-11-16 16:51:42 -05:00
|
|
|
# Process Test Results, any single failure will send back a failed result.
|
|
|
|
if [[ $failedTests != 0 ]]; then
|
|
|
|
export TEST_STATUS=1;
|
|
|
|
echo "**** $failedTests out of $totalTests ACA Policy Tests Failed! ****"
|
|
|
|
else
|
|
|
|
echo "**** $totalTests ACA Policy Tests Passed! ****"
|
|
|
|
fi
|