Secure confidential container environments with remote attestation
PeerPod remote attestation helps ensure confidential containers run in a genuine, untampered confidential computing environment such as Intel TDX by verifying the environment at deployment and on demand at runtime, providing end-to-end protection for sensitive workloads.
How it works
The Trustee service acts as the trust anchor and verifies PeerPod environment integrity at two lifecycle stages: deployment and runtime.
Pre-launch environment verification
Before any image pull or container start, the Attestation Agent inside the confidential VM generates hardware evidence and submits it to the Trustee. The pod proceeds only after the Trustee validates the evidence.
-
An administrator submits a pod manifest to the API server. The kubelet requests a pod sandbox from
containerdvia the Container Runtime Interface (CRI).containerdchecksruntimeClassNameand invokeskata-runtime. -
Kata Remote calls the Alibaba Cloud OpenAPI to launch an ECS TDX confidential VM as the pod.
-
The Attestation Agent inside the VM generates evidence — including hardware signatures — and sends it to the Trustee.
-
After the Trustee validates the evidence, the pod pulls the application image and starts the container.
Runtime remote attestation
Applications inside a PeerPod can prove their environment's integrity to external services, establishing cross-system trust.
-
The application requests a real-time attestation report from
http://127.0.0.1:8006/aa/evidence. -
The application sends the evidence to an external service, which forwards it to its own Trustee for validation, confirming the sender runs in a protected confidential environment.
Prerequisites
Ensure you have:
-
The CAA solution is enabled in your cluster.
-
The Trustee service is installed on a trusted server, with its IP address recorded as your Trustee endpoint. Install on Alibaba Cloud Linux 3:
yum install trustee -yPeerPods must reach this IP to complete remote attestation. Ensure the Trustee's network is routable from the CAA cluster's pod VPC.
-
A security group rule on the Trustee server that allows inbound TCP traffic on port 8080. Set the source based on your network topology:
-
If the CAA cluster and Trustee are in the same VPC, allow traffic from the VPC's CIDR block.
-
If they communicate across VPCs or the internet, allow traffic from the cluster's NAT Gateway egress IP.
-
Verify and deploy a container to a trusted environment
Configure the Trustee and deploy a pod that undergoes remote attestation before launch, ensuring it runs only on verified nodes.
Execution environments:
-
Trustee server: Where you configure policies and verify attestation logs.
-
Local terminal: Where you run
kubectlto deploy the pod.
Configure the Trustee
On the Trustee server, configure two policies: one controlling allowed container images, and one defining what constitutes a trusted hardware environment.
-
Create the container security launch policy. This file is stored as a confidential resource and read during pod startup to trigger remote attestation.
# Create the policy directory mkdir -p /opt/trustee/kbs/repository/default/container-policy # Write a policy that allows all images (for testing only — tighten this before going to production) cat << EOF > /opt/trustee/kbs/repository/default/container-policy/insecure-accept-all { "default": [{"type": "insecureAcceptAnything"}], "transports": {} } EOF -
Create the remote attestation policy. This Rego policy defines what counts as a trusted environment: Intel TDX hardware, identified by TEE type code
81000000and Intel's vendor UUID.cat << EOF > /opt/trustee/attestation-service/policies/opa/default.rego package policy import rego.v1 default executables := 32 default hardware := 97 default configuration := 32 default file_system := 32 ##### ECS TDX PeerPod executables := 3 if { input.tdx } hardware := 2 if { # Verify that the evidence is of the Intel TDX type input.tdx.quote.header.tee_type == "81000000" # Verify the vendor ID input.tdx.quote.header.vendor_id == "939a7233f79c4ca9940a0db3957f0607" } configuration := 2 if { input.tdx } file_system := 2 if { input.tdx } EOF -
Restart the Trustee to apply the policies.
service as restart
Deploy a pod with remote attestation
-
Generate the
initdataconfiguration.initdatapasses the Trustee endpoint to the PeerPod so the Attestation Agent knows where to send evidence.# Replace with your actual Trustee IP address TRUSTEE_SERVICE_ENDPOINT=1.2.3.4 cat <<EOF > initdata.toml version = "0.1.0" algorithm = "sha256" [data] "aa.toml" = ''' [eventlog_config] enable_eventlog = true [token_configs] [token_configs.kbs] url = "http://${TRUSTEE_SERVICE_ENDPOINT}:8080" ''' "cdh.toml" = ''' [kbc] name = "cc_kbc" url = "http://${TRUSTEE_SERVICE_ENDPOINT}:8080" [image] image_security_policy_uri = "kbs:///default/container-policy/insecure-accept-all" ''' EOF # Compress and Base64-encode the initdata initdata=$(cat initdata.toml | gzip | base64 -w0)Importantinitdata.tomlcontains your Trustee endpoint. Strictly control how this file is generated, distributed, and stored.Verify the encoded output with
echo $initdata. -
Create the pod manifest. Write the encoded
initdatastring to the pod'sannotationsfield.cat << EOF > pod.yaml apiVersion: v1 kind: Pod metadata: name: pod-caa-demo annotations: io.katacontainers.config.hypervisor.cc_init_data: ${initdata} spec: runtimeClassName: kata-remote containers: - image: alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest name: hello command: ["sh", "-c", "echo hello && sleep infinity"] EOF -
Deploy the pod.
kubectl apply -f pod.yamlCheck the pod status with
kubectl get po pod-caa-demo. -
Verify attestation on the Trustee server.
journalctl -u as -fThe message
Tdx Verifier/endorsement check passedconfirms the pod passed attestation and runs in a trusted environment.
Fetch and verify environment trustworthiness at runtime
Obtain a real-time attestation report from inside a PeerPod and submit it to an independent verifier.
Execution environments:
-
Local terminal: Where you run
kubectlto interact with the cluster. -
Inside the pod container: Where the application runs. Enter with
kubectl exec -it pod-caa-demo -- sh. -
Verifier server: An independent trusted server with the Trustee service deployed. Reuse an existing Trustee or deploy a new one.
Get remote attestation evidence from the container
(Optional) Add dynamic measurements
Dynamic measurements embed custom runtime data into the attestation report. Standard attestation verifies the environment (the "safe") is intact; dynamic measurements prove the application state (the "contents of the safe") matches expectations.
From inside the container, send a POST request to http://127.0.0.1:8006/aa/aael. The request body fields domain, operation, and content accept customizable printable strings (no spaces). The data is saved to the TDX pod Eventlog and bound to the final attestation report.
# Run this command inside the container
curl -X POST http://127.0.0.1:8006/aa/aael \
-H "Content-Type: application/json" \
-d '{"domain":"test","operation":"test","content":"test"}'
Get the attestation evidence
From inside the container, send a GET request to retrieve attestation evidence for the current TEE.
curl 127.0.0.1:8006/aa/evidence?runtime_data=AAAA
The runtime_data parameter accepts a Base64-encoded nonce provided by the verifier to protect against replay attacks.
The command outputs a JSON string. Copy the entire string (from { to }) for the next steps.
Prepare the verification environment
On the verifier server:
-
(Optional) Install the Trustee if not already installed.
yum install trustee -y -
Create the client-side validation policy at
/opt/trustee/attestation-service/policies/opa/client.rego, using the same scoring rules as the default policy.cat <<EOF > /opt/trustee/attestation-service/policies/opa/client.rego # Policy to verify evidence from the confidential container (TEE) package policy import rego.v1 # --- Default scores --- default executables := 32 default hardware := 97 default configuration := 32 default file_system := 32 # --- Validation rules for Alibaba Cloud ECS TDX PeerPods --- executables := 3 if { input.tdx } hardware := 2 if { # TEE type must be the Intel TDX identifier input.tdx.quote.header.tee_type == "81000000" # Vendor ID must be the official Intel UUID input.tdx.quote.header.vendor_id == "939a7233f79c4ca9940a0db3957f0607" } configuration := 2 if { input.tdx } file_system := 2 if { input.tdx } EOF -
Restart the Trustee to apply the policy.
service as-restful restart
Submit the evidence for verification
-
Save the attestation evidence to a file to avoid issues with special characters.
cat > evidence.jsonPaste the JSON string, then save and exit.
-
Encode the evidence and build the request body.
EVIDENCE=$(cat evidence.json) BASE64EVIDENCE=$(echo ${EVIDENCE} | base64 -w 0 2>/dev/null | tr '+/' '-_' | tr -d '=' ) cat << EOF > request.json { "verification_requests": [ { "tee": "tdx", "evidence": "${BASE64EVIDENCE}" } ], "policy_ids": ["client"] } EOF -
Send a POST request to the Trustee's attestation endpoint on port
50005.curl -k -X POST http://127.0.0.1:50005/attestation \ -i \ -H 'Content-Type: application/json' \ -d @request.jsonThe response contains a
tokenfield with a JSON Web Token (JWT). Copy this token.
Parse and evaluate the result
-
Store the JWT.
# Replace <...> with the actual JWT string (without quotes) TOKEN='<Paste the JWT token here>' -
Extract the trustworthiness scores.
echo $TOKEN | cut -d'.' -f2 | base64 -d | jq '.submods.cpu0."ear.trustworthiness-vector"'Expected output:
base64: invalid input { "configuration": 2, "executables": 3, "file-system": 2, "hardware": 2 }The
base64: invalid inputmessage is harmless. The scores confirm the container runs in a compliant TDX environment.
Apply in production
-
Tighten attestation policies: The examples use permissive policies. In production, write precise Rego policies matching your hardware platform and software stack. Use version control for auditing and change tracking.
-
Protect initdata:
initdata.tomlcontains your Trustee endpoint and may include other sensitive configuration. Strictly control its generation, distribution, and storage.