Skip to content

Commit 8b9c7ec

Browse files
committed
Explain measurements file
1 parent 057f279 commit 8b9c7ec

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

README.md

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,66 @@
33

44
This is a work-in-progress crate designed to be an alternative to [`cvm-reverse-proxy`](https://github.com/flashbots/cvm-reverse-proxy).
55

6-
It has three commands:
7-
- `server` - run a proxy server, which accepts TLS connections from a proxy client, sends an attestation and then forwards traffic to a target CVM service.
8-
- `client` - run a proxy client, which accepts connections from elsewhere, connects to and verifies the attestation from the proxy server, and then forwards traffic to it over TLS.
9-
- `get-tls-cert` - connects to a proxy-server, verify the attestation, and if successful write the server's PEM-encoded TLS certificate chain to standard out. This can be used to make subsequent connections to services using this certificate over regular TLS.
6+
It has three subcommands:
7+
- `attested-tls-proxy server` - run a proxy server, which accepts TLS connections from a proxy client, sends an attestation and then forwards traffic to a target CVM service.
8+
- `attested-tls-proxy client` - run a proxy client, which accepts connections from elsewhere, connects to and verifies the attestation from the proxy server, and then forwards traffic to it over TLS.
9+
- `attested-tls-proxy get-tls-cert` - connects to a proxy-server, verify the attestation, and if successful write the server's PEM-encoded TLS certificate chain to standard out. This can be used to make subsequent connections to services using this certificate over regular TLS.
1010

1111
Unlike `cvm-reverse-proxy`, this uses post-handshake remote-attested TLS, meaning regular CA-signed TLS certificates can be used.
1212

13-
This repo shares some code with [ameba23/attested-channels](https://github.com/ameba23/attested-channels) and may eventually be merged with that crate.
1413

15-
## Measurement headers
14+
### Overview
1615

17-
When attestation is validated successfully, the following values are injected into the request / response headers:
16+
This is a reverse HTTP proxy allowing a normal HTTP client to communicate with a normal HTTP server over a remote-attested TLS channel, by tunneling requests through a proxy-client and proxy-server.
17+
18+
This works as follows:
19+
1. The source HTTP client (eg: curl or a web browser) makes an HTTP request to a proxy-client instance running locally.
20+
2. The proxy-client forwards the request to a proxy-server instance over a remote-attested TLS channel.
21+
3. The proxy-server forwards the request to the target service over regular HTTP.
22+
4. The response from the target service is sent back to the source client, via the proxy-server and proxy-client.
23+
24+
One or both of the proxy-client and proxy-server may be running in a confidential environment and provide attestations which will be verified by the remote party. Verification is configured by a measurements file, and attestation generation is configured by specifying an attestation type when starting the proxy client or server.
25+
26+
### Measurements File
27+
28+
Accepted measurements for the remote party are specified in a JSON file containing an array of objects, each of which specifies an accepted attestation type and set of measurements.
29+
30+
These object have the following fields:
31+
- `measurement_id` - a name used to describe the entry. For example the name and version of the CVM OS image that these measurements correspond to.
32+
- `attestation_type` - one of the attestation types (confidential computing platforms) described below.
33+
- `measurements` - an object with fields referring to the five measurement registers.
34+
35+
Example:
36+
37+
```JSON
38+
[
39+
{
40+
"measurement_id": "dcap-tdx-example",
41+
"attestation_type": "dcap-tdx",
42+
"measurements": {
43+
"0": {
44+
"expected": "47a1cc074b914df8596bad0ed13d50d561ad1effc7f7cc530ab86da7ea49ffc03e57e7da829f8cba9c629c3970505323"
45+
},
46+
"1": {
47+
"expected": "da6e07866635cb34a9ffcdc26ec6622f289e625c42c39b320f29cdf1dc84390b4f89dd0b073be52ac38ca7b0a0f375bb"
48+
},
49+
"2": {
50+
"expected": "a7157e7c5f932e9babac9209d4527ec9ed837b8e335a931517677fa746db51ee56062e3324e266e3f39ec26a516f4f71"
51+
},
52+
"3": {
53+
"expected": "e63560e50830e22fbc9b06cdce8afe784bf111e4251256cf104050f1347cd4ad9f30da408475066575145da0b098a124"
54+
},
55+
"4": {
56+
"expected": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
57+
}
58+
}
59+
}
60+
]
61+
```
62+
63+
### Measurement Headers
64+
65+
When attestation is validated successfully, the following values are injected into the request / response headers making them available to the source client and/or target service:
1866

1967
Header name: `X-Flashbots-Measurement`
2068

@@ -37,3 +85,4 @@ One of `none`, `dummy`, `azure-tdx`, `qemu-tdx`, `gcp-tdx`.
3785

3886
These aim to match the header formatting used by `cvm-reverse-proxy`.
3987

88+
## Protocol Specification

test-assets/measurements.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"measurement_id": "dcap-tdx-dummy",
3+
"measurement_id": "dcap-tdx-example",
44
"attestation_type": "dcap-tdx",
55
"measurements": {
66
"0": {

0 commit comments

Comments
 (0)