You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-10Lines changed: 36 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,14 @@
2
2
# `attested-tls-proxy`
3
3
4
4
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.
5
6
6
7
It has three subcommands:
7
8
-`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
9
-`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
10
-`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.
10
11
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
15
13
16
14
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
15
@@ -27,10 +25,12 @@ One or both of the proxy-client and proxy-server may be running in a confidentia
27
25
28
26
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
27
28
+
This aims to match the formatting used by `cvm-reverse-proxy`.
29
+
30
30
These object have the following fields:
31
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.
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).
34
34
35
35
Example:
36
36
@@ -60,9 +60,13 @@ Example:
60
60
]
61
61
```
62
62
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
+
63
65
### Measurement Headers
64
66
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`.
66
70
67
71
Header name: `X-Flashbots-Measurement`
68
72
@@ -79,10 +83,32 @@ Header value:
79
83
80
84
Header name: `X-Flashbots-Attestation-Type`
81
85
82
-
Header value:
86
+
Header value: an attestation type given as a string as described below.
87
+
88
+
## Attestation Types
83
89
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.
85
91
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)
87
98
88
99
## 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