-
Notifications
You must be signed in to change notification settings - Fork 6
Near #147
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
base: master
Are you sure you want to change the base?
Near #147
Changes from all commits
2501dec
be95341
4ba1129
e74392b
21049fa
7c0f738
876f8ed
ad118ef
2f7148c
b99a904
fed7b84
2463985
ddc5aa5
641c7bb
c2de548
0a14c59
0486b4d
e849c66
78013dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1328,6 +1328,134 @@ sudo systemctl restart vsock-tinfoil-router-inf9.service | |
| sudo systemctl restart vsock-tinfoil-router-inf10.service | ||
| ``` | ||
|
|
||
| ## Vsock Near.AI proxies | ||
| Create vsock proxy services so that the enclave can talk to Near.AI and its attestation dependencies (NVIDIA NRAS for GPU attestation and Intel PCS for TDX DCAP collateral). | ||
|
|
||
| First configure the endpoints into their allowlist: | ||
|
|
||
| ```sh | ||
| sudo vim /etc/nitro_enclaves/vsock-proxy.yaml | ||
| ``` | ||
|
|
||
| Add these lines: | ||
| ``` | ||
| - {address: cloud-api.near.ai, port: 443} | ||
| - {address: nras.attestation.nvidia.com, port: 443} | ||
| - {address: api.trustedservices.intel.com, port: 443} | ||
| - {address: certificates.trustedservices.intel.com, port: 443} | ||
| ``` | ||
|
|
||
| Restart the nitro vsock proxy service: | ||
| ``` | ||
| sudo systemctl restart nitro-enclaves-vsock-proxy.service | ||
| ``` | ||
|
|
||
| #### Near.AI Cloud API | ||
| ```sh | ||
| sudo vim /etc/systemd/system/vsock-near-cloud-api-proxy.service | ||
| ``` | ||
|
|
||
| Add the following content: | ||
| ``` | ||
| [Unit] | ||
| Description=Vsock Near.AI Cloud API Proxy Service | ||
| After=network.target | ||
|
|
||
| [Service] | ||
| User=root | ||
| ExecStart=/usr/bin/vsock-proxy 8042 cloud-api.near.ai 443 | ||
| Restart=always | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| ``` | ||
|
|
||
| #### NVIDIA NRAS (GPU Attestation) | ||
| ```sh | ||
| sudo vim /etc/systemd/system/vsock-near-nras-proxy.service | ||
| ``` | ||
|
|
||
| Add the following content: | ||
| ``` | ||
| [Unit] | ||
| Description=Vsock NVIDIA NRAS Proxy Service | ||
| After=network.target | ||
|
|
||
| [Service] | ||
| User=root | ||
| ExecStart=/usr/bin/vsock-proxy 8043 nras.attestation.nvidia.com 443 | ||
| Restart=always | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| ``` | ||
|
|
||
| #### Intel PCS (DCAP Collateral) | ||
| ```sh | ||
| sudo vim /etc/systemd/system/vsock-near-intel-pcs-proxy.service | ||
| ``` | ||
|
|
||
| Add the following content: | ||
| ``` | ||
| [Unit] | ||
|
Comment on lines
+1341
to
+1400
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. Add language tags to new fenced code blocks. The new fenced blocks in this section omit language identifiers, which triggers MD040 and makes rendering/tooling less reliable. Add appropriate tags (e.g., Proposed change-```
+```yaml
- {address: cloud-api.near.ai, port: 443}
- {address: nras.attestation.nvidia.com, port: 443}
- {address: api.trustedservices.intel.com, port: 443}... ... [Service] [Install] Verify each finding against the current code and only fix it if needed. In |
||
| Description=Vsock Intel PCS Proxy Service | ||
| After=network.target | ||
|
|
||
| [Service] | ||
| User=root | ||
| ExecStart=/usr/bin/vsock-proxy 8044 api.trustedservices.intel.com 443 | ||
| Restart=always | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| ``` | ||
|
|
||
| #### Intel Certificates (Root CA CRL) | ||
| ```sh | ||
| sudo vim /etc/systemd/system/vsock-near-intel-certs-proxy.service | ||
| ``` | ||
|
|
||
| Add the following content: | ||
| ``` | ||
| [Unit] | ||
| Description=Vsock Intel Certificates Proxy Service | ||
| After=network.target | ||
|
|
||
| [Service] | ||
| User=root | ||
| ExecStart=/usr/bin/vsock-proxy 8045 certificates.trustedservices.intel.com 443 | ||
| Restart=always | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| ``` | ||
|
|
||
| Activate all the services: | ||
|
|
||
| ```sh | ||
| sudo systemctl daemon-reload | ||
| sudo systemctl enable vsock-near-cloud-api-proxy.service | ||
| sudo systemctl start vsock-near-cloud-api-proxy.service | ||
| sudo systemctl status vsock-near-cloud-api-proxy.service | ||
| sudo systemctl enable vsock-near-nras-proxy.service | ||
| sudo systemctl start vsock-near-nras-proxy.service | ||
| sudo systemctl status vsock-near-nras-proxy.service | ||
| sudo systemctl enable vsock-near-intel-pcs-proxy.service | ||
| sudo systemctl start vsock-near-intel-pcs-proxy.service | ||
| sudo systemctl status vsock-near-intel-pcs-proxy.service | ||
| sudo systemctl enable vsock-near-intel-certs-proxy.service | ||
| sudo systemctl start vsock-near-intel-certs-proxy.service | ||
| sudo systemctl status vsock-near-intel-certs-proxy.service | ||
| ``` | ||
|
|
||
| If you need to restart these services: | ||
| ```sh | ||
| sudo systemctl restart vsock-near-cloud-api-proxy.service | ||
| sudo systemctl restart vsock-near-nras-proxy.service | ||
| sudo systemctl restart vsock-near-intel-pcs-proxy.service | ||
| sudo systemctl restart vsock-near-intel-certs-proxy.service | ||
| ``` | ||
|
|
||
| ## KMS Key | ||
|
|
||
| You need to create an AWS KMS key that the enclave can encrypt/decrypt things to. Name it according to your environment: | ||
|
|
@@ -1699,6 +1827,27 @@ INSERT INTO enclave_secrets (key, value) | |
| VALUES ('os_flags_base_url', decode('your_base64_string', 'base64')); | ||
| ``` | ||
|
|
||
| #### Near.AI API Key | ||
|
|
||
| After the DB is initialized, we need to store the Near.AI Cloud API key encrypted to the enclave KMS key. This key is used for authenticated requests to `cloud-api.near.ai`. | ||
|
|
||
| ```sh | ||
| echo -n "NEAR_API_KEY" | base64 -w 0 | ||
| ``` | ||
|
|
||
| Take that output and encrypt to the KMS key, from a machine that has encrypt access to the key: | ||
|
|
||
| ```sh | ||
| aws kms encrypt --key-id "KEY_ARN" --plaintext "BASE64_KEY" --query CiphertextBlob --output text | ||
| ``` | ||
|
|
||
| Take that encrypted base64 and insert it into the `enclave_secrets` table with key as `near_api_key` and value as the base64. | ||
|
|
||
| ```sql | ||
| INSERT INTO enclave_secrets (key, value) | ||
| VALUES ('near_api_key', decode('your_base64_string', 'base64')); | ||
| ``` | ||
|
|
||
| ## Secrets Manager | ||
|
|
||
| ### Postgresql | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "HashAlgorithm": "Sha384 { ... }", | ||
| "PCR0": "a8ac79f4e3e57813727cc0c424ecdd7a50f6774e4e79e162f8a96f294293c9f7db4d160dab36e7f5fb642f7fa12cf6f3", | ||
| "PCR0": "07331a85d922e9d33b8bea190427e962a77e6f65425ff99e8545e4ce7ca1f4a637cf10b8f84eb0701bdebb7ae6ff181c", | ||
| "PCR1": "f004075c672258b499f8e88d59701031a3b451f65c7de60c81d09da2b0799272675481ec390527594dd7069cb7de59d7", | ||
| "PCR2": "bb1579a2089477c38f152701cd7c3e398d8c37f98aebc6d60d8d2c2ed3671e7cededae1bdf61c211d37dd3094f4ba5f3" | ||
| "PCR2": "af52809711e969c13b2d93ae5bed02008b9af021d35419be7047196d6731dff9d6dbdaf3609e55770a5da450dffead28" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "HashAlgorithm": "Sha384 { ... }", | ||
| "PCR0": "4403544d28e867b9e2e4ae7ee881db9f9d75a2cbdd64ab31d413dfbc9ca36b0e6e7416fb4abfb852b0051ad2d3fd2734", | ||
| "PCR0": "fffbfb0cbe63a5a3f54a8bb38b727e8e93bfe58dd3d82d0c4d8b80022f960d2c5c688be01f7d989032e1f439166c77dc", | ||
| "PCR1": "f004075c672258b499f8e88d59701031a3b451f65c7de60c81d09da2b0799272675481ec390527594dd7069cb7de59d7", | ||
| "PCR2": "5fac6ea109cda1791a579bbd5f973b51d40bf53af409afd098dd8aa88ebafcd5d53b1bbb5c3a8a0855e26c9b1278c32c" | ||
| "PCR2": "f6b83a784d35cc136851ead7f54bb4524af81b28d0cae7397bf6b4568937570d941242685787b7f0dea5c2d4f75b7627" | ||
| } |
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.
Fix heading level jump (use
###under the##section).#### Near.AI Cloud APIintroduces a two‑level jump from##, which breaks heading hierarchy. Switch these####headers to###in this section.Proposed change
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 1352-1352: Heading levels should only increment by one level at a time
Expected: h3; Actual: h4
(MD001, heading-increment)
[warning] 1358-1358: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 1378-1378: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents