Verifying the attestation process
To verify the attestation process, run the signed image (workload) in the deployed OpenShift sandboxed containers cluster. If the workload runs successfully, it confirms a successful key exchange between the SE-enabled PeerPod VM and the Trustee.
The following section explains the verification process using BusyBox as a sample workload.
Procedure
- Create a
initdata.tomlfile using theencrypted_contractgenerated in the earlier step:$ cat << EOF > initdata.toml algorithm = "sha384" version = "0.1.0" [data] "aa.toml" = ''' [token_configs] [token_configs.coco_as] url = 'https://<CCRV_KBS_IP>:8080' (1) [token_configs.kbs] url = 'https://<CCRV_KBS_IP>:8080' cert = """ <localhost.crt> """ ''' "cdh.toml" = ''' socket = 'unix:///run/confidential-containers/cdh.sock' credentials = [] [kbc] name = 'cc_kbc' url = 'https://<CCRV_KBS_IP>:8080' kbs_cert = """ <localhost.crt> """ [image] image_security_policy_uri = 'kbs:///default/security-policy/osc' ''' "policy.rego" = ''' package agent_policy import future.keywords.in import future.keywords.every import input default CopyFileRequest := true default CreateContainerRequest := true default CreateSandboxRequest := true default DestroySandboxRequest := true default ExecProcessRequest := true default GetOOMEventRequest := true default GuestDetailsRequest := true default OnlineCPUMemRequest := true default PullImageRequest := true default ReadStreamRequest := true default RemoveContainerRequest := true default RemoveStaleVirtiofsShareMountsRequest := true default SignalProcessRequest := true default StartContainerRequest := true default StatsContainerRequest := true default TtyWinResizeRequest := true default UpdateEphemeralMountsRequest := true default UpdateInterfaceRequest := true default UpdateRoutesRequest := true default WaitProcessRequest := true default WriteStreamRequest := true ''' EOF1: Specify the LPAR IP where trustee would be provisioned on CCRV.
- Encode the
initdata.tomlfile with initdata annotation:$ initdata_annotation=$(cat "initdata.toml" | base64 -w 0) - Deploy a sample workload
busybox.yaml:
$ cat << EOF > busybox.yaml apiVersion: v1 kind: Pod metadata: name: busybox namespace: default labels: run: busybox annotations: io.katacontainers.config.runtime.cc_init_data: ${initdata_annotation} spec: runtimeClassName: kata-remote restartPolicy: Never containers: - name: busybox image: quay.io/<username>/busybox EOF - Create the pod by running the following
command:
$ oc create -f busybox.yaml - Log in to the pod by running the following
command:
$ oc exec -it busybox -n default -- /bin/sh - Check if the pod is running by running the following command:
Example output$ oc create -f busybox.yamlbusybox 1/1 Running 0 101s - Get the secret key by running the following command:
Example output$ oc exec -it busybox -n default -- wget http://127.0.0.1:8006/cdh/resource/default/busybox/keyConnecting to 127.0.0.1:8006 (127.0.0.1:8006) saving to 'key' key 100% |*******************************************| 8 0:00:00 ETA 'key' saved - Display the
keyvalue by running the following command:
Example output$ cat keymykey