Skip to content

Commit d30e547

Browse files
authored
Merge pull request #1433 from pareenaverma/content_review
CCA Essentials Attestation LP
2 parents b325766 + b03b5c6 commit d30e547

File tree

11 files changed

+416
-69
lines changed

11 files changed

+416
-69
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Run an Attestation with Arm Confidential Compute Architecture (CCA)
3+
4+
minutes_to_complete: 120
5+
6+
who_is_this_for: This is an advanced topic for software developers who want to see a practical example of how attestation is used with Arm's Confidential Computing Architecture (CCA).
7+
8+
learning_objectives:
9+
- Understand how attestation is used with Arm's Confidential Computing Architecture (CCA).
10+
- Deploy a simple workload in a CCA realm on an Armv-A AEM Base FVP (Fixed Virtual Platform) with support for RME extensions.
11+
- Connect the workload with additional software services to create an end-to-end example for using attestation to unlock the confidential processing of data.
12+
13+
prerequisites:
14+
- An AArch64 or x86_64 computer running Linux. You can use cloud instances, refer to the list of [Arm cloud service providers](/learning-paths/servers-and-cloud-computing/csp/).
15+
- Completion of the [Introduction to CCA Attestation with Veraison](/learning-paths/servers-and-cloud-computing/cca-veraison) learning path.
16+
- Completion of the [Run an application in a Realm using the Arm Confidential Computing Architecture (CCA)](learning-paths/servers-and-cloud-computing/cca-container/) learning path.
17+
18+
author_primary: Arnaud de Grandmaison, Paul Howard and Pareena Verma
19+
20+
### Tags
21+
skilllevels: Advanced
22+
subjects: Performance and Architecture
23+
armips:
24+
- Neoverse
25+
operatingsystems:
26+
- Linux
27+
tools_software_languages:
28+
- GCC
29+
- FVP
30+
- RME
31+
- CCA
32+
- Docker
33+
- Veraison
34+
35+
### FIXED, DO NOT MODIFY
36+
# ================================================================================
37+
weight: 1 # _index.md always has weight of 1 to order correctly
38+
layout: "learningpathall" # All files under learning paths have this same wrapper
39+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
40+
---
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
# ================================================================================
3+
# Edit
4+
# ================================================================================
5+
6+
next_step_guidance: >
7+
You now have an understanding of how attestation is used with Arm's Confidential Computing Architecture (CCA). You can also build the complete Arm CCA software stack yourself and validate your applications on an Arm FVP ahead of silicon availability.
8+
9+
# 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended.
10+
11+
recommended_path: "/learning-paths/servers-and-cloud-computing/rme-cca-basics/"
12+
# Link to the next learning path being recommended(For example this could be /learning-paths/servers-and-cloud-computing/mongodb).
13+
14+
15+
# further_reading links to references related to this path. Can be:
16+
# Manuals for a tool / software mentioned (type: documentation)
17+
# Blog about related topics (type: blog)
18+
# General online references (type: website)
19+
20+
further_reading:
21+
- resource:
22+
title: Arm Confidential Compute Architecture
23+
link: https://www.arm.com/architecture/security-features/arm-confidential-compute-architecture
24+
type: website
25+
- resource:
26+
title: Arm Confidential Compute Architecture open source enablement
27+
link: https://www.youtube.com/watch?v=JXrNkYysuXw
28+
type: video
29+
- resource:
30+
title: Learn the architecture - Realm Management Extension
31+
link: https://developer.arm.com/documentation/den0126
32+
type: documentation
33+
- resource:
34+
title: Realm Management Monitor specification
35+
link: https://developer.arm.com/documentation/den0137/latest/
36+
type: documentation
37+
38+
# ================================================================================
39+
# FIXED, DO NOT MODIFY
40+
# ================================================================================
41+
weight: 21 # set to always be larger than the content in this path, and one more than 'review'
42+
title: "Next Steps" # Always the same
43+
layout: "learningpathall" # All files under learning paths have this same wrapper
44+
---
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
# ================================================================================
3+
# Edit
4+
# ================================================================================
5+
6+
# Always 3 questions. Should try to test the reader's knowledge, and reinforce the key points you want them to remember.
7+
# question: A one sentence question
8+
# answers: The correct answers (from 2-4 answer options only). Should be surrounded by quotes.
9+
# correct_answer: An integer indicating what answer is correct (index starts from 0)
10+
# explanation: A short (1-3 sentence) explanation of why the correct answer is correct. Can add additional context if desired
11+
12+
13+
review:
14+
- questions:
15+
question: >
16+
The Arm Confidential Compute Architecture (CCA) is available on all Arm devices.
17+
answers:
18+
- "True"
19+
- "False"
20+
correct_answer: 2
21+
explanation: >
22+
CCA requires the Realm Management Extension (RME) to the Armv9-A architecture, as well as support within the software stack running on the device.
23+
- questions:
24+
question: >
25+
kvmtool supports the creation of Realm guests.
26+
answers:
27+
- "True"
28+
- "False"
29+
correct_answer: 1
30+
explanation: >
31+
kvmtool supports the creation of realm guests that conform with the Arm RME specification.
32+
- questions:
33+
question: >
34+
An application running in the Realm inherits its confidential protection.
35+
answers:
36+
- "True"
37+
- "False"
38+
correct_answer: 1
39+
explanation: >
40+
The guest VM is the realm and an application running in it inherits the confidential protection of the guest VM.
41+
42+
43+
# ================================================================================
44+
# FIXED, DO NOT MODIFY
45+
# ================================================================================
46+
title: "Review" # Always the same title
47+
weight: 20 # Set to always be larger than the content in this path
48+
layout: "learningpathall" # All files under learning paths have this same wrapper
49+
---
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# User change
3+
title: "Overview of the Software Architecture"
4+
5+
weight: 2 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
11+
## Overview
12+
In this learning path you will learn how attestation can control the release of confidential data into a confidential Linux realm for processing.
13+
14+
The role of attestation is to assess whether the target compute environment (the Linux realm, in this case) offers a provable level of confidential isolation. This assessment needs to occur before the realm can be trusted to receive confidential data or algorithms. This use of attestation to judge the trustworthiness of a compute environment, before allowing it to do any processing, is a common pattern in confidential computing. Here, you will learn about this pattern using a minimal set of software components.
15+
16+
## Understanding the key software components
17+
In this learning path, you will make use of a key broker service, or KBS. The role of the KBS is to be a repository for encryption keys or other confidential data resources. A KBS will release such secrets for processing in a confidential computing environment, but only when that environment has proved itself trustworthy through attestation.
18+
19+
The workload that runs inside the realm is a client of the KBS. It calls the KBS to request a secret. The KBS will not return the secret immediately. Instead, it will issue an attestation challenge back to the client. The client must respond with evidence in the form of a [CCA attestation token](/learning-paths/servers-and-cloud-computing/cca-container/cca-container/#obtain-a-cca-attestation-token-from-the-virtual-guest-in-a-realm).
20+
21+
When the KBS receives an attestation token from the realm, it needs to call a verification service that will check the token's cryptographic signature and verify that it denotes a confidential computing platform. As you saw in the [Introduction to CCA Attestation with Veraison learning path](/learning-paths/servers-and-cloud-computing/cca-veraison), Linaro provides such an attestation verifier for use with pre-silicon CCA platforms. This verifier is built from the open-source [Veraison project](https://github.com/veraison). The KBS calls this verifier to obtain an attestation result. The KBS can then use this result to decide whether to release the secrets into the realm for processing.
22+
23+
For additional security, the KBS does not release any secrets in clear text, even after a successful verification of the attestation token. Instead, the realm provides an additional public encryption key to the KBS. This is known as a wrapping key. The KBS will use this public key to encrypt(wrap) the secrets. The client workload inside the realm is then able to use its own private key to unwrap the secrets and use them.
24+
25+
In this learning path example, you will see the secret that is exchanged between the KBS and the realm is a small string value, which the realm will decrypt and echo to its console window once all the attestation steps have succeeded.
26+
27+
For convenience, both the KBS and the client software are packaged in docker containers, which you can execute on any suitable development machine (aarch64 or x86_64). Since the client software runs in a realm, it makes use of the Fixed Virtual Platform (FVP) and the reference software stack for Arm CCA. If you have not yet familiarised yourself with running applications in realms using FVP and the reference software stack, please refer to the [Run an application in a Realm using the Arm Confidential Computing Architecture (CCA)](/learning-paths/servers-and-cloud-computing/cca-container) learning path.
28+
29+
The attestation verification service is hosted by Linaro, so it will not be necessary for you to build or deploy this service yourself.
30+
31+
Shown in this figure below is the software architecture you will construct to run the attestation example in this learning path.
32+
33+
![cca-essentials](cca-essentials.png)
34+
35+
You can now proceed to the next section to run the end-to-end attestation example with the software components and architecture as described.
84.1 KB
Loading
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
# User change
3+
title: "Run an end-to-end Attestation with Arm CCA"
4+
5+
weight: 3 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
11+
## Run the Key Broker Server
12+
13+
The concept of a KBS is a common one in confidential computing, and there are multiple open-source implementations, including the [Trustee](https://github.com/confidential-containers/trustee) from the [CNCF Confidential Containers](https://confidentialcontainers.org/) project. The KBS in this learning path is part of the [Veraison](https://github.com/veraison) project. It has been created specifically for educational purposes and not designed for production use. Its aim is to be small and simple to understand.
14+
15+
First, pull the docker container image with the pre-built KBS and then run the container:
16+
17+
```bash
18+
docker pull armswdev/cca-learning-path:cca-key-broker-v1
19+
docker run --rm -it armswdev/cca-learning-path:cca-key-broker-v1
20+
```
21+
22+
Now within your running docker container, get a list of network interfaces:
23+
24+
```bash
25+
ip -c a
26+
```
27+
28+
The output should look like:
29+
30+
```output
31+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
32+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
33+
inet 127.0.0.1/8 scope host lo
34+
valid_lft forever preferred_lft forever
35+
inet6 ::1/128 scope host
36+
valid_lft forever preferred_lft forever
37+
20: eth0@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
38+
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
39+
inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
40+
valid_lft forever preferred_lft forever
41+
```
42+
Start the key broker server on the `eth0` network interface:
43+
44+
```bash
45+
./keybroker-server -v --addr 172.17.0.2
46+
```
47+
48+
The output should look like:
49+
50+
```output
51+
INFO starting 16 workers
52+
INFO Actix runtime found; starting in Actix runtime
53+
INFO starting service: "actix-web-service-172.17.0.2:8088", workers: 16, listening on: 172.17.0.2:8088
54+
```
55+
56+
With the key broker server running in one terminal, open up a new terminal in which you will run the key broker client.
57+
58+
## Run the Key Broker Client
59+
60+
In a new terminal, pull the docker container image which contains the FVP and pre-built software binaries to run the key broker client in a realm.
61+
62+
```bash
63+
docker pull armswdev/cca-learning-path:cca-simulation-v1
64+
```
65+
66+
Now run this docker container:
67+
```bash
68+
docker run --rm -it armswdev/cca-learning-path:cca-simulation-v1
69+
```
70+
71+
Within you running container, launch the `run-cca-fvp.sh` script to run the Arm CCA pre-built binaries on the FVP:
72+
73+
```bash
74+
./run-cca-fvp.sh
75+
```
76+
The run-cca-fvp.sh script uses the screen command to connect to the different UARTs in the FVP.
77+
78+
You should see the host Linux kernel boot on your terminal. You will be prompted to log in to the host. Enter root as the username:
79+
80+
```output
81+
[ 4.169458] Run /sbin/init as init process
82+
[ 4.273748] EXT4-fs (vda): re-mounted 64d1bcff-5d03-412c-83c6-48ec4253590e r/w. Quota mode: none.
83+
Starting syslogd: OK
84+
Starting klogd: OK
85+
Running sysctl: OK
86+
Starting network: [ 5.254843] smc91x 1a000000.ethernet eth0: link up, 10Mbps, half-duplex, lpa 0x0000
87+
udhcpc: started, v1.36.1
88+
udhcpc: broadcasting discover
89+
udhcpc: broadcasting select for 172.20.51.1, server 172.20.51.254
90+
udhcpc: lease of 172.20.51.1 obtained from 172.20.51.254, lease time 86400
91+
deleting routers
92+
adding dns 172.20.51.254
93+
OK
94+
95+
Welcome to the CCA host
96+
host login: root
97+
(host) #
98+
```
99+
Use kvmtool to launch guest Linux in a Realm:
100+
```bash
101+
cd /cca
102+
./lkvm run --realm --disable-sve --irqchip=gicv3-its --firmware KVMTOOL_EFI.fd -c 1 -m 512 --no-pvtime --force-pci --disk guest-disk.img --measurement-algo=sha256 --restricted_mem
103+
```
104+
You should see the realm boot. After boot up, you will be prompted to log in at the guest Linux prompt. Use root again as the username:
105+
106+
```output
107+
Starting syslogd: OK
108+
Starting klogd: OK
109+
Running sysctl: OK
110+
Starting network: udhcpc: started, v1.36.1
111+
udhcpc: broadcasting discover
112+
udhcpc: broadcasting select for 192.168.33.15, server 192.168.33.1
113+
udhcpc: lease of 192.168.33.15 obtained from 192.168.33.1, lease time 14400
114+
deleting routers
115+
adding dns 172.20.51.254
116+
OK
117+
118+
Welcome to the CCA realm
119+
realm login: root
120+
(realm) #
121+
```
122+
123+
Now run the key broker client application in the realm. Use the endpoint address that the key broker server is listening on in the other terminal:
124+
```bash
125+
cd /cca
126+
./keybroker-app -v --endpoint http://172.17.0.2:8088 skywalker
127+
```
128+
In the command above `skywalker` is the key name that is requested from the key broker server. After some time, you should see the following output:
129+
```
130+
INFO Requesting key named 'skywalker' from the keybroker server with URL http://172.17.0.2:8088/keys/v1/key/skywalker
131+
INFO Challenge (64 bytes) = [0f, ea, c4, e2, 24, 4e, fa, dc, 1d, ea, ea, 3d, 60, eb, a6, 8f, f1, ed, 1a, 07, 35, cb, 5b, 1b, cf, 5b, 21, a4, bc, 14, 65, c2, 21, 3f, bf, 33, a0, b0, 7c, 78, 3a, a6, 32, c6, 34, be, ff, 45, 98, f4, 17, b1, 24, 71, 4f, 9c, 75, 58, 37, 3a, 28, ea, 97, 33]
132+
INFO Submitting evidence to URL http://172.17.0.2:8088/keys/v1/evidence/3974368321
133+
INFO Attestation failure :-( ! AttestationFailure: No attestation result was obtained. No known-good reference values.
134+
```
135+
You can see from the key broker client application output that the `skywalker` key is requested from the key broker server, which did send a challenge. The key broker client application uses the challenge to submit its evidence back to the key broker server, but it gets an attestation failure. This is because the server does not have any known good reference values.
136+
137+
Now look at the key broker server output on the terminal where the server is running. It will look like:
138+
139+
```output
140+
INFO Known-good RIM values are missing. If you trust the client that submitted
141+
evidence for challenge 1302147796, you should restart the keybroker-server with the following
142+
command-line option to populate it with known-good RIM values:
143+
--reference-values <(echo '{ "reference-values": [ "tiA66VOokO071FfsCHr7es02vUbtVH5FpLLqTzT7jps=" ] }')
144+
INFO Evidence submitted for challenge 1302147796: no attestation result was obtained. No known-good reference values.
145+
```
146+
From the server output you will notice that it did create the challenge for the key broker application, but it complains that it has no known good reference values. It does however provide a way to provision the key broker server with known good values if the client is trusted.
147+
In a production environment, the known good reference value would be generated using a deployment specific process, but for demonstration purposes and simplification, you will use the value proposed by the key broker server.
148+
149+
Now go ahead and terminate the running instance of the key broker server(ctrl+C) and restart it with the known good reference value. Notice here that you need to copy the `--reference-values` argument directly from the previous error message reported by the key broker. When running this next command, ensure that you are using exactly that value, for example::
150+
151+
```bash
152+
./keybroker-server -v --addr 172.17.0.2 --reference-values <(echo '{ "reference-values": [ "tiA66VOokO071FfsCHr7es02vUbtVH5FpLLqTzT7jps=" ] }')
153+
```
154+
155+
On the terminal with the running realm, re-run the key broker client application with the exact same command line parameters as before:
156+
157+
```bash
158+
./keybroker-app -v --endpoint http://172.17.0.2:8088 skywalker
159+
```
160+
161+
You should now get a successful attestion as shown:
162+
163+
```output
164+
INFO Requesting key named 'skywalker' from the keybroker server with URL http://172.17.0.2:8088/keys/v1/key/skywalker
165+
INFO Challenge (64 bytes) = [05, 9e, ef, af, 59, e5, 2d, 0f, db, d8, 24, 40, 1e, 0d, 09, c9, d4, 3c, 9e, 99, c5, 64, cf, e6, b9, 20, 29, be, d7, ec, ea, 9a, a3, 91, dc, 16, e6, b7, 0f, 39, 0f, 06, b6, cc, b6, 9f, 0e, 3a, da, 26, 57, 5c, ed, 7f, 11, 1f, 2b, 3c, 9e, aa, 8c, d6, bc, b8]
166+
INFO Submitting evidence to URL http://172.17.0.2:8088/keys/v1/evidence/2828132982
167+
INFO Attestation success :-) ! The key returned from the keybroker is 'May the force be with you.'
168+
```
169+
170+
You have successfully run an end-to-end attestation flow with Arm CCA.
171+
172+
173+
174+

0 commit comments

Comments
 (0)