CoCo AS provides a flexible policy support based on Rego to facilitate the customized verification rules.
Different token brokers will use the policy engine to evaluate different claims.
The simple token broker only evaluates the claim allowed
while the EAR broker
implements a set of claims described below.
The simple token broker only evaluates one claim, which is allowed
.
Policies that are used with the simple token broker should evaulate
this claim either as true
or false
.
EAR tokens support a more expressive policy result. The EAR broker will evaluate the followig claims. A valid policy must evaluate at least one of the following claims as number between 127 and -127.
instance_identity
configuration
executables
file_system
hardware
runtime_opaque
storage_opaque
sourced_data
These dimensions can be used to return a detailed, but generic description of the TCB of the attester. More information about these trust claims, including what the numerical values of the claims represent, can be found here.
AS policies will be provide data
and input
. data.reference
points to a dictionary of reference
values provided by the RVPS.
input
are the TCB claims generated by the verifier.
See the default policy for an example.
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 assigns multiple trust claims based on reference values.
- 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.