-
Notifications
You must be signed in to change notification settings - Fork 7
COCOS-DOCS-127 - Additional info on aTLS #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
danko-miladinovic
wants to merge
3
commits into
ultravioletrs:main
Choose a base branch
from
danko-miladinovic:intr-atls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,30 @@ | |
|
|
||
| For the relying party to send confidential data or code to the Agent, a secure channel must be established between them. The secure channel is established using attested TLS, which is a TLS connection enriched with the attestation report of the Agent. | ||
|
|
||
| In Cocos, the CVM acts as the server, and the Agent extends the X.509 certificate it uses for TLS with the attestation report. When generating the report, the Agent embeds the hash of its public key into the `report_data` field of the AMD SEV-SNP report. To maintain the freshness of the attestation report, a new certificate is regenerated with every connection, along with a fresh attestation report. | ||
| In the following text, the attestation report will be referred to as Evidence, and it will include the SEV-SNP attestation report and the TDX Quote. | ||
|
|
||
| By combining the TLS certificate along with the attestation report, the relying party (the user of cocos-cli) can be assured that he is talking directly to the Agent inside the TEE, because the attestation report is bound to the certificate and the report has the guarantee of freshness, the relying party knows that the other side of the TLS connection is inside the TEE. | ||
| In Cocos, the CVM acts as the server, and the Agent uses standard X.509 certificates for its TLS connection. In order to bind the Evidence to the TLS connection, the Agent does the following: | ||
|
|
||
| - Generates ephemeral public and private keys for every connection. Thus, ensuring that the Agent is the only one who has access to the private key. | ||
| - Generates a fresh X.509 certificate based on the ephemeral public and private keys. | ||
| - Fetches the Evidence and embeds the public key and a cocos-cli-supplied nonce into the Evidence. The nonce is needed to ensure the Evidence's freshness. | ||
| - Extends the X.509 certificate with the Evidence and self-signs the certificate. | ||
|
|
||
| By embedding the Evidence into the X.509 certificate, the TLS handshake remains unchanged, and cocos-cli needs to verify the Evidence extracted from the TLS certificate. Also, the relying party (the user of cocos-cli) can be assured that they are talking directly to the Agent inside the CVM. Because the Evidence is bound to the X.509 certificate, the Evidence is fresh, and the Agent is the only one with the private key of the X.509 certificate, the relying party has enough proof that it is talking to the Agent. | ||
|
|
||
| The entire process is illustrated in the picture below. The green color represents the trusted part of the system, while the red represents the untrusted part. | ||
|
|
||
|  | ||
|  | ||
|
|
||
|  | ||
|
|
||
| Attested TLS comes in three different forms: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could mention actual source here. |
||
|
|
||
| - Pre-handshake - the Evidence is fetched before the TLS handshake. The problem with this implementation is that the CVM cannot guarantee the Evidence's freshness. | ||
| - Intra-handshake - the Evidence provided during the TLS handshake. Cocos implements this form of TLS. | ||
| - Post-handshake - the Evidence is provided after the TLS handshake. | ||
|
|
||
| The next step is to learn how the cocos-cli transfers the random nonce to the Agent. Cocos uses the standard Go TLS library. The random nonce could be transported using custom TLS extensions, or the TLS random nonce could be extracted from the TLS handshake, but the standard Go TLS library does not allow either of those approaches. To solve this problem, Cosos uses the Server Name Indication (SNI) extension. The SNI is chosen because no servers are running besides the Agent in the CVM. Thus, the SNI was chosen to transport the cocos-cli random nonce needed for Evidence freshness. | ||
|
|
||
| The exact point at which the Agent certificate is sent during the TLS handshake process is shown below. | ||
|
|
||
|
|
@@ -71,8 +88,12 @@ One of the key components of the verification process is the attestation policy. | |
| } | ||
| ``` | ||
|
|
||
| The relying party uses the Cocos CLI to verify the self-signed (or CA-signed) certificate and the attestation report that is part of it. Successful verification proves to the relying party that the CVM is in a good state and that the relying party is indeed communicating with the Agent. | ||
| The relying party uses the Cocos CLI to verify the self-signed certificate and the attestation report that is part of it. Successful verification proves to the relying party that the CVM is in a good state and that the relying party is indeed communicating with the Agent. The Agent can be configured to generate X.509 certificates and have them be signed by the Prism CA. | ||
|
|
||
| The array `pcr_values` represents the expected (golden) PCR values that must match the PCR values in the vTPM attestation report. The `policy` and `root_of_trust` sections describe the reference values for the fields in the SEV-SNP attestation report. | ||
|
|
||
| It is also possible to use mutual attested TLS, which is a combination of mutual TLS and attested TLS. | ||
|
|
||
| ## Potential problems if the user does not use aTLS | ||
|
|
||
| One of the main reasons why attested TLS is important is that it combines TLS and the Evidence of the underlying TEE. By combining the said components, the cocos-cli user can be assured that the other end of the TLS connection is in the CVM. If the confidential computing solution does not implement attested TLS, it could potentially expose the user to the [Cuckoo attack](https://www.usenix.org/legacy/event/hotsec08/tech/full_papers/parno/parno.pdf). In the Cuckoo attack, a malicious administrator or hypervisor can boot two VMs, one CVM and one regular VM. If the Evidence is not bound to the TLS channel, the malicious hypervisor or administrator can direct traffic to the regular VM, and when the user wants to fetch the Evidence, the Evidence can be fetched from the CVM and returned to the user. Thus, the user thinks he is communicating with the CVM, when in fact he is communicating with a regular VM. | ||
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to clarify the exact value of
reportdatathat you use here, with a pointer to the code for someone to audit.