Skip to content

Commit c431d1d

Browse files
authored
Update flow.md
1 parent 9939f91 commit c431d1d

1 file changed

Lines changed: 51 additions & 61 deletions

File tree

  • content/learning-paths/servers-and-cloud-computing/cca-kata

content/learning-paths/servers-and-cloud-computing/cca-kata/flow.md

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ weight: 3 # 1 is first, 2 is second, etc.
88
layout: "learningpathall"
99
---
1010
## Overview
11-
In this section you will
11+
In this section you will:
1212

13-
- run the **Trustee services** (AS, KBS, RVPS) and a local docker image registry.
14-
- publish an encrypted docker image.
15-
- on **Arm FVP** you will start a confidential container using the encrypted image and confirm that it runs in a **CCA realm**.
13+
* Start the Trustee services (AS, KBS, RVPS) along with a local Docker registry.
14+
* Publish an encrypted container image to the local registry.
15+
* Launch a Confidential Container on the Arm FVP using the encrypted image and verify it runs inside an Arm CCA Realm.
1616

1717
## Install dependencies
1818

@@ -39,7 +39,7 @@ Install Git and Docker packages:
3939
sudo apt-get install -y git docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4040
```
4141

42-
Add your user name to the Docker group (open a new shell after this so the change takes effect):
42+
Add your user name to the Docker group (open a new shell afterwards so the change takes effect):
4343
``` bash
4444
sudo usermod -aG docker $USER
4545
newgrp docker
@@ -52,28 +52,28 @@ Clone the **kata** branch of the **cca-trustee** repository:
5252
git clone -b kata https://github.com/ArmDeveloperEcosystem/cca-trustee.git
5353
```
5454

55-
This repository contains configuration to run Trustee services (KBS, AS, RVPS, keyprovider) with CCA attestation support as a simple cluster. The configuration is based on the recommended settings from [KBS Cluster](https://github.com/confidential-containers/trustee/blob/main/kbs/docs/cluster.md).
55+
This repository includes a Docker Compose configuration that starts Trustee services (KBS, AS, RVPS, and a key provider) with Arm CCA attestation support as a simple local cluster. The configuration follows the recommended approach described in the Trustee documentation for running a [KBS Cluster](https://github.com/confidential-containers/trustee/blob/main/kbs/docs/cluster.md).
5656

57-
Additional Learning Pathspecific changes include:
57+
This Learning Path also applies a few environment-specific changes, including:
5858

59-
- External Linaro CCA verifier in the AS configuration
59+
- An external Linaro CCA verifier configured in the Attestation Service (AS)
6060

61-
- Attestation policy with CCA rules
61+
- An attestation policy containing CCA rules
6262

63-
- An **affirming** resource policy
63+
- An affirming resource policy
6464

65-
- Docker registry service
65+
- A local Docker registry service
6666

67-
- A shared Docker network for all containers in this demo
67+
- A shared Docker network used by all services in this demo
6868

69-
Go into the **cca-trustee** directory and generate a self-signed certificate for the docker registry service:
69+
Change into the cca-trustee directory and generate a self-signed certificate for the local docker registry:
7070
``` bash
7171
cd cca-trustee
7272

7373
openssl req -x509 -days 365 -config config/registry.cnf -keyout config/registry.key -out config/registry.crt
7474
```
7575

76-
Start the Trustee services Docker containers (as detached services):
76+
Start the Trustee services as detached containers:
7777
``` bash { output_lines = "2-9" }
7878
docker compose up -d
7979
✔ Network cca-trustee Created
@@ -86,28 +86,26 @@ docker compose up -d
8686
✔ Container cca-trustee-kbs-client-1 Created
8787
```
8888

89-
While running the demo you can also check logs of the Trustee services in this terminal:
89+
To view logs while running the demo:
9090
``` bash
9191
docker compose logs <service>
9292
```
93-
Where **service** is either **as**, **kbs** or **rvps**.
93+
Where <service> is one of as, kbs or rvps.
9494

95-
## Publish an encrypted docker image
95+
## Publish an encrypted container image
9696

97-
Generate an image encryption key:
97+
Generate a 32-byte image encryption key:
9898
``` bash
9999
head -c 32 /dev/urandom | openssl enc >image.key
100100
```
101+
Learn more about how the attestation result is used to evaluate the trustworthiness of a CCA realm and how attestation policy gates secrets release in the ["Run an end-to-end Attestation with Arm CCA and Trustee"](/learning-paths/servers-and-cloud-computing/cca-trustee) Learning Path.
101102

102-
Publish the encryption key as a KBS secret resource. This resource can be obtained only with an attestation token with **affirming** status.
103-
104-
Learn more about how the attestation result is used to evaluate the trustworthiness of a CCA realm and how attestation policy gates secrets release in
105-
["Run an end-to-end Attestation with Arm CCA and Trustee"](/learning-paths/servers-and-cloud-computing/cca-trustee)
103+
Publish the encryption key as a KBS secret resource. This resource is only released when the requester presents an attestation token with affirming status.
106104
``` bash
107105
./publish-key.sh
108106
```
109107

110-
Encrypt a **busybox** docker image with the published key and push it into the local docker registry with **busybox_encrypted** name:
108+
Encrypt the **busybox** image using the published key, then push it to the local registry as **busybox_encrypted**:
111109
``` bash { output_lines = "2-9" }
112110
./encrypt_image.sh
113111
Encrypting docker://busybox image with busybox_encrypted name
@@ -119,12 +117,12 @@ Writing manifest to image destination
119117
Inspecting MIMEType of docker://registry:5000/busybox_encrypted image
120118
"MIMEType": "application/vnd.oci.image.layer.v1.tar+gzip+encrypted",
121119
```
122-
By inspecting MIMEType of the published image you can see that it is encrypted.
120+
The published image layers use an encrypted OCI layer media type, confirming that the image has been encrypted.
123121

124122
{{% notice Encryption key note %}}
125-
Annotations data for an encrypted image contains a path to the key which Confidential Containers workload needs to obtain to decrypt the image.
123+
Encrypted images include annotations that describe where the guest should retrieve the key required for decryption.
126124

127-
You can check it with this command
125+
You can inspect the key identifier (kid) with:
128126
``` bash { output_lines = "4" }
129127
docker compose exec keyprovider skopeo inspect docker://registry:5000/busybox_encrypted \
130128
| jq -r '.LayersData[0].Annotations."org.opencontainers.image.enc.keys.provider.attestation-agent"' \
@@ -134,23 +132,21 @@ docker compose exec keyprovider skopeo inspect docker://registry:5000/busybox_en
134132
{{% /notice %}}
135133

136134
{{% notice Docker image note %}}
137-
**encrypt_image.sh** uses [skopeo](https://github.com/containers/skopeo) in the Trustee **keyprovider** container to pull, encrypt and push docker images.
138-
Without parameters it encrypts **busybox** docker image which will be used in this Learning Path.
139-
You can use this script to encrypt other docker images as well. For example with this command it will encrypt
140-
**alpine** docker image and push it into the local docker registry with **alpine_encrypted** name.
135+
**encrypt_image.sh** uses [skopeo](https://github.com/containers/skopeo) inside the Trustee keyprovider container to pull, encrypt, and push images.
136+
By default it encrypts busybox, which is used throughout this Learning Path. You can also encrypt other images. For example, this command encrypts **alpine** and pushes it as **alpine_encrypted**:
141137

142138
``` bash
143139
./encrypt_image.sh alpine
144140
```
145141
{{% /notice %}}
146142

147-
You have prepared infrastructure and ready to start Confidential Containers in CCA realm.
143+
At this point, the host-side infrastructure is running and the encrypted image is available from the local registry.
148144

149145
## Launch an FVP
150146

151-
With the Trustee Services running in one terminal, open up a new terminal in which you will run Confidential Containers.
147+
With the Trustee services running in one terminal, open a second terminal for the Confidential Containers environment.
152148

153-
Pull the Docker image with the pre-built FVP, and then run the container connected to the same Docker network:
149+
Pull the pre-built FVP container image and run it on the same Docker network:
154150

155151
```bash
156152
docker pull armswdev/cca-learning-path:cca-simulation-with-kata-v3
@@ -159,28 +155,27 @@ docker pull armswdev/cca-learning-path:cca-simulation-with-kata-v3
159155
docker run --rm -it --network cca-trustee armswdev/cca-learning-path:cca-simulation-with-kata-v3
160156
```
161157

162-
Within your running container, launch the **run-cca-fvp.sh** script to run the Arm CCA pre-built binaries on the FVP:
158+
Inside your running container, launch the `run-cca-fvp.sh` script to run the Arm CCA pre-built binaries on the FVP:
163159

164160
```bash
165161
./run-cca-fvp.sh
166162
```
167163

168-
The **run-cca-fvp.sh** script uses the **screen** command to connect to the different UARTs in the FVP.
164+
The `run-cca-fvp.sh` script uses the `screen` command to connect to the different UARTs in the FVP.
169165

170-
When the host Linux boots, уnter root as the username:
166+
When the host Linux boots, enter root as the username:
171167
```output
172168
173169
Welcome to the CCA host
174170
host login: root
175171
(host) #
176172
```
177173

178-
## Inject the local docker registry self-signed certificate
174+
## Inject the local Docker registry certificate
179175

180-
The local docker registry service was deployed with a self-signed certificate.
181-
To trust this certificate it needs to be added into the CA certificates list in the guest VM image.
176+
The local registry is configured with a self-signed TLS certificate. To allow the guest VM to trust the registry, add this certificate to the guest image’s CA certificate store.
182177

183-
Inject the local docker repository certificate into the image:
178+
Inject the registry certificate into the guest filesystem image:
184179
``` bash { output_lines = "2-6" }
185180
inject_registry_cert.sh
186181

@@ -192,12 +187,11 @@ inject_registry_cert.sh
192187

193188
## Calculate Realm Initial Measurement (RIM)
194189

195-
For a successful attestation of your CCA realm you need to provide the Trustee Reference Values Provider Service (RVPS) with a known good reference value.
190+
To validate the guest during attestation, the Trustee Reference Values Provider Service (RVPS) must be configured with a known-good reference value for the Realm.
196191

197-
In a production environment, the known good reference value is generated using a deployment-specific process.
198-
This Learning Path includes **rim_calc.sh** script which:
199-
- Runs qemu-system-aarch64-cca-experimental (used by Kata containers to run a guest VM in Arm CCA realm) to dump Device Tree into a file.
200-
- Checks Kata shim configuration file for guest VM delpoyment parameters.
192+
In production, reference values are generated as part of a deployment-specific build and release process. This Learning Path includes a helper script, `rim_calc.sh`, which:
193+
- Runs qemu-system-aarch64-cca-experimental (used by Kata containers to launch a guest VM inside an Arm CCA realm) to dump the guest Device Tree into a file.
194+
- Reads the Kata shim configuration to capture guest deployment parameters
201195
- Uses ["cca-realm-measurements"](https://github.com/veraison/cca-realm-measurements) to calculate the realm initial measurement (RIM).
202196

203197
Run the script:
@@ -216,24 +210,23 @@ Realm Extensible Measurements (REMs) are not used for attestation in this Learni
216210

217211
## Endorse Realm Initial Measurement (RIM)
218212

219-
In the terminal where you started Trustee services, run **endorse-rim.sh** script with the RIM as a parameter:
213+
In the terminal where you started Trustee services, run `endorse-rim.sh` and pass the RIM value:
220214

221215
```bash { output_lines = "2-3" }
222216
./endorse-rim.sh "rBD3xqcqqYHrjZ1Tu9aMWqFmwBgwT+NvLxg9jsozZm9rMDhjcaEM5LOQ+qJs+SLdG1jyco33EDuJ8+1/oMdFIQ=="
223217

224218
Reference Values Updated
225219
```
226220

227-
## Launch a Confidential container in CCA realm
221+
## Launch a Confidential Container in an Arm CCA realm
228222

229-
Reduce amount of kernel messages printed to console:
223+
Reduce the verbosity of kernel messages printed to the console:
230224
``` bash
231225
dmesg -n 4
232226
```
233227

234-
Run a confidential container from the **busybox_encrypted** image and check its kernel version and RME kernel messages.
235-
Because the container is run in CCA realm on emulated environment (Fixed Virtual Platform (FVP)), it will take some time to launch, be patient.
236-
Depending on the machine you run this Learning Path on it might take between 8 and 15 minutes to run a container.
228+
Run a Confidential Container from the **busybox_encrypted** image and verify both the kernel version and Arm RME-related kernel messages.
229+
Because this runs on an emulated platform (Arm FVP), container startup can take several minutes depending on the host machine.
237230

238231
``` bash { output_lines = "5-9" }
239232
nerdctl --snapshotter nydus run --runtime io.containerd.kata.v2 \
@@ -247,14 +240,14 @@ RME kernel message:
247240
[ 0.000000] RME: Using RSI version 1.0
248241
```
249242

250-
Verify that the FVP kernel version is different to the Confidential Container version:
243+
Verify that the host kernel version differs from the Confidential Container guest kernel:
251244
``` bash { output_lines = "2" }
252245
uname -a
253246
Linux host 6.15.0-rc1-g916aeec68dd4 #1 SMP PREEMPT @1764597323 aarch64 GNU/Linux
254247
```
255248

256249
{{% notice Nydus snapshotter messages note %}}
257-
When you run a confidential container you will see messages from Nydus snapshotter when it loads container snapshot.
250+
When launching a Confidential Container, you may see progress output from the Nydus snapshotter while it prepares the snapshot. For example:
258251
```
259252
registry:5000/busybox_encrypted:latest: resolving |--------------------------------------|
260253
elapsed: 0.1 s total: 0.0 B (0.0 B/s)
@@ -271,13 +264,12 @@ These messages can be ignored. The docker image will be downloaded by **image-rs
271264
{{% /notice %}}
272265

273266
{{% notice Failed attestation note %}}
274-
If you forget to endorse RIM for your environment or make a mistake doing that, then CCA realm attestation would fail.
275-
In this case you will see an image decryption error when starting a confidential container with an encrypted image.
267+
If the RIM is not endorsed (or the wrong value is configured), attestation will fail and the guest will be unable to retrieve the decryption key. In this case, container startup fails with an image decryption error:
276268
```
277269
FATA[0189] failed to create shim task: rpc status: Status { code: INTERNAL, message: "[CDH] [ERROR]: Image Pull error: Failed to pull image registry:5000/busybox_encrypted from all mirror/mapping locations or original location: image: registry:5000/busybox_encrypted:latest, error: Errors happened when pulling image: Failed to decrypt layer: Failed to decrypt the image layer, please ensure that the decryption key is placed and correct", details: [], special_fields: SpecialFields { unknown_fields: UnknownFields { fields: None }, cached_size: CachedSize { size: 0 } } }
278270
```
279271

280-
By checking KBS logs (in the terminal where you run Trustee services) you could see that the encryption key couldn't be obtained because of an AS policy:
272+
Checking the KBS logs (in the terminal running Trustee services) shows the request was denied by policy:
281273
``` bash { output_lines = "2-5" }
282274
docker compose logs kbs
283275

@@ -287,18 +279,16 @@ kbs-1 | [2025-12-08T12:25:40Z ERROR kbs::error] PolicyDeny
287279
```
288280
{{% /notice %}}
289281

290-
You have successfully run a confidential container with Arm CCA using an encrypted image.
282+
You have now successfully launched a Confidential Container in an Arm CCA Realm using an encrypted container image.
291283

292284
{{% notice Unencrypted docker images note %}}
293-
In this Learning Path environment you can also run confidential containers in Arm CCA realm from any unencrypted docker images.
294-
Please notice that you need to define the **annotation** parameter so **image-rs** knows where to pull the image from.
295-
For example:
285+
In this Learning Path environment, you can also run Confidential Containers from unencrypted images. You still need to set the `io.kubernetes.cri.image-name` annotation so **image-rs** knows where to pull the image from. For example:
296286
```
297287
nerdctl run --runtime io.containerd.kata.v2 --rm -it --annotation io.kubernetes.cri.image-name=alpine:latest alpine sh
298288
```
299289
{{% /notice %}}
300290

301-
You can stop all Trustee containers with:
291+
Stop all Trustee service containers with:
302292
```bash
303293
docker compose down
304294
```

0 commit comments

Comments
 (0)