CoCo AS provides a flexible policy support based on Rego to facilitate the customized verification rules.
For both gRPC CoCo AS and Restful CoCo AS, we have a
parameter named policy_ids
to specify which policies to use to enforce the evidence check.
For a running CoCoAS, we can set any new policies.
Let's give some quick guides.
Firstly, start a gRPC CoCo AS
cd attestation-service/tests/e2e
make grpc.pid
Then, set a new policy to the CoCo AS.
We have prepared an example SetPolicy request with policy and policy id example-policy
. The policy should be Base64 URL SAFE NO PAD
encoded.
REQ=$(cat ../../tests/coco-as/policy/grpc-set-policy.json)
grpcurl \
-plaintext \
-import-path ../../protos \
-proto ../../protos/attestation.proto \
-d @ 127.0.0.1:50004 attestation.AttestationService/SetAttestationPolicy <<EOF
$REQ
EOF
Then, we can use the policy to check against an evidence. We use the request to do this.
REQ=$(cat ../../tests/coco-as/policy/check.json)
grpcurl \
-plaintext \
-import-path ../../protos \
-proto ../../protos/attestation.proto \
-d @ 127.0.0.1:50004 attestation.AttestationService/AttestationEvaluate <<EOF
$REQ
EOF
Firstly, start a Restful CoCo AS
cd attestation-service/tests/e2e
make restful.pid
Then, set a new policy to the CoCo AS.
We have prepared an example SetPolicy request with policy and policy id example-policy
. The policy should be Base64 URL SAFE NO PAD
encoded.
curl -k -X POST http://127.0.0.1:8080/policy \
-i \
-H 'Content-Type: application/json' \
-d @../../tests/coco-as/policy/restful-set-policy.json
Then, we can use the policy to check against an evidence. We use the request to do this.
curl -k -X POST http://127.0.0.1:8080/attestation \
-i \
-H 'Content-Type: application/json' \
-d @../../tests/coco-as/policy/check.json
We will introduce the format of policy by providing some examples to show the use cases.
- The default policy. This policy will check whether each entry in the parsed claims generated by the input evidence matches the reference value obtained from RVPS.
- An SGX policy. The client want to ensure the
mr_signer
andmrenclave
are both expected value. - A TDX policy. The client want to ensure the TDX module (reflected by
tdx.quote.body.mr_seam
), guest firmware (reflected bytdx.quote.body.mr_td
), kernel (reflected bytdx.ccel.kernel
) are all as expected. - A IBM SE policy. The client want to ensure the
se.version
,se.tag
,se.user_data
,se.image_phkh
andse.attestation_phkh
are all expected value.