Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 3.35 KB

policy.md

File metadata and controls

85 lines (64 loc) · 3.35 KB

Attestation Policy (Developing)

CoCo AS provides a flexible policy support based on Rego to facilitate the customized verification rules.

How to Use Policy

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.

gRPC CoCo AS

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

Restful CoCo AS

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

How to Write a Policy (Experimental)

⚠️ Warning: The policy feature is still under development and it might be changed flexibly before we get a stable version.

We will introduce the format of policy by providing some examples to show the use cases.

  1. 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.
  2. An SGX policy. The client want to ensure the mr_signer and mrenclave are both expected value.
  3. A TDX policy. The client want to ensure the TDX module (reflected by tdx.quote.body.mr_seam), guest firmware (reflected by tdx.quote.body.mr_td), kernel (reflected by tdx.ccel.kernel) are all as expected.
  4. A IBM SE policy. The client want to ensure the se.version, se.tag, se.user_data, se.image_phkh and se.attestation_phkh are all expected value.