Skip to content

Commit babfeb9

Browse files
committed
Document protocol
1 parent 8b9c7ec commit babfeb9

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

README.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
# `attested-tls-proxy`
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).
5+
Unlike `cvm-reverse-proxy`, this uses post-handshake remote-attested TLS, meaning regular CA-signed TLS certificates can be used.
56

67
It has three subcommands:
78
- `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.
89
- `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.
910
- `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.
1011

11-
Unlike `cvm-reverse-proxy`, this uses post-handshake remote-attested TLS, meaning regular CA-signed TLS certificates can be used.
12-
13-
14-
### Overview
12+
### How it works
1513

1614
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.
1715

@@ -27,10 +25,12 @@ One or both of the proxy-client and proxy-server may be running in a confidentia
2725

2826
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.
2927

28+
This aims to match the formatting used by `cvm-reverse-proxy`.
29+
3030
These object have the following fields:
3131
- `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.
32+
- `attestation_type` - a string containing one of the attestation types (confidential computing platforms) described below.
33+
- `measurements` - an object with fields referring to the five measurement registers. Field names are the same as for the measurement headers (see below).
3434

3535
Example:
3636

@@ -60,9 +60,13 @@ Example:
6060
]
6161
```
6262

63+
If a path to this file is not given or it contains an empty array, **any** attestation type and **any** measurements will be accepted, **including no attestation**. The measurements can still be checked up-stream by the source client or target service using header injection described below. But it is then up to these external programs to reject unacceptable configurations.
64+
6365
### Measurement Headers
6466

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:
67+
When attestation is validated successfully, the following headers are injected into the HTTP request / response making them available to the source client and/or target service.
68+
69+
These aim to match the header formatting used by `cvm-reverse-proxy`.
6670

6771
Header name: `X-Flashbots-Measurement`
6872

@@ -79,10 +83,32 @@ Header value:
7983

8084
Header name: `X-Flashbots-Attestation-Type`
8185

82-
Header value:
86+
Header value: an attestation type given as a string as described below.
87+
88+
## Attestation Types
8389

84-
One of `none`, `dummy`, `azure-tdx`, `qemu-tdx`, `gcp-tdx`.
90+
These are the attestation type names used in the HTTP headers, and the measurements file, and when specifying a local attestation type with the `--client-attestation-type` or `--server-attestation-type` command line options.
8591

86-
These aim to match the header formatting used by `cvm-reverse-proxy`.
92+
- `none` - No attestation provided
93+
- `dummy` - Forwards the attestation to a remote service (for testing purposes, not yet supported)
94+
- `gcp-tdx` - DCAP TDX on Google Cloud Platform
95+
- `azure-tdx` - TDX on Azure, with MAA (not yet supported)
96+
- `qemu-tdx` - TDX on Qemu (no cloud platform)
97+
- `dcap-tdx` - DCAP TDX (platform not specified)
8798

8899
## Protocol Specification
100+
101+
A proxy-client client will immediately attempt to connect to the given proxy-server.
102+
103+
Proxy-client to proxy-server connections use TLS 1.3.
104+
105+
The protocol name `flashbots-ratls/1` must be given in the TLS configuration for ALPN protocol negotiation during the TLS handshake. Future versions of this protocol will use incrementing version numbers, eg: `flashbots-ratls/2`.
106+
107+
Immediately after the TLS handshake, an attestation exchange is made. The server first provides an attestation message (even if it has the `none` attestation type). The client verifies, if verification is successful it also provides an attestation message and otherwise closes the connection. If the server cannot verify the client's attestation, it closes the connection.
108+
109+
Attestation messages are formatted as follows:
110+
- A 4 byte length prefix - a big endian encoded unsigned 32 bit integer
111+
Simple Concatenated Aggregate Little-Endian
112+
Following a successful attestation exchange, the client can make HTTP requests using HTTP2, and the server will forward them to the target service.
113+
114+
As described above, the server will inject measurement data into the request headers before forwarding them to the target service, and the client will inject measurement data into the response headers before forwarding them to the source client.

0 commit comments

Comments
 (0)