Skip to content

Commit 368b9f9

Browse files
Release/v2.3.0 (#96)
-Add ability to disable OCSP nonce validation via command line flag -Add configurable RIM and OCSP service URLs -Update documentation with new command line options -Add type hints and improve error handling for URL validation -Added unit tests for OCSP nonce configuration -Refactored all documentation to be self-explanatory --------- Co-authored-by: Shwetha <skalyanarama@nvidia.com>
1 parent 02b2d22 commit 368b9f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+552
-184
lines changed

README.md

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
1-
# nvTrust: NVIDIA Confidential Computing Ancillary Software
1+
# nvTrust: Ancillary Software for NVIDIA Trusted Computing Solutions
22

3-
nvTrust is a repository which contains much of the utilities & tools, open-source code,
4-
and SDKs leveraged when using NVIDIA solutions in trusted environments, such as Confidential Computing.
3+
This repository provides essential resources for implementing and validating Trusted Computing Solutions on NVIDIA hardware. It focuses on attestation, a crucial aspect of ensuring the integrity and security of confidential computing environments.
54

6-
For more information, including documentation, white papers, and videos regarding the Hopper Confidential Computing story, please visit [docs.nvidia.com/confidential-computing/index.html]()
5+
For more information, including documentation, white papers, and videos regarding NVIDIA Confidential Computing, please visit [NVIDIA docs](https://docs.nvidia.com/confidential-computing/index.html).
76

8-
## Early Access Considerations
9-
This branch of nvTrust is currently considered `General Access`.
7+
## Getting Started with Attestation
108

11-
This software release features a software stack targeting a single H100 GPU in passthrough mode with a single session key for encryption and authentication and basic use of the Developer Tools.
9+
To begin using NVIDIA GPU attestation, please refer to [this documentation](./guest_tools/README.md). This guide will walk you through:
1210

13-
Code and data will be confidential up to the limits of the NIST SP800-38D AES-GCM standard, after which the VM should be restarted, which causes a fresh session key to be created.
11+
- Setting up the necessary environment
12+
- Implementing attestation in your applications
13+
- Validating the attestation process
1414

15-
## Release Notes
16-
- Hopper Confidential Compute early access features are supported on NVIDIA Driver Version `550` and later only
17-
- Release Notes may be found [here](https://docs.nvidia.com/confidential-computing/#release-notes).
15+
## Confidential Computing
16+
17+
NVIDIA Confidential Computing offers a solution for securely processing data and code in use, preventing unauthorized users from both access and modification. When running AI training or inference, the data and the code must be protected. Often the input data includes personally identifiable information (PII) or enterprise secrets, and the trained model is highly valuable intellectual property (IP). Confidential computing is the ideal solution to protect both AI models and data.
18+
19+
NVIDIA is at the forefront of confidential computing, collaborating with CPU partners, cloud providers, and independent software vendors (ISVs) to ensure that the change from traditional, accelerated workloads to confidential, accelerated workloads will be smooth and transparent.
20+
21+
For more information, including documentation, white papers, and videos regarding the Hopper Confidential Computing story, please visit [NVIDIA docs](https://docs.nvidia.com/confidential-computing/index.html).
1822

1923
## License
20-
The license for this repository is Apache v2 except where otherwise noted.
21-
## Folder Structure
22-
- **docs** - Collateral relating to Confidential Computing with NVIDIA GPUs
23-
- Release Notes
24-
- Deployment Guide (Walkthrough)
25-
- Hopper Confidential Computing Whitepaper
26-
- Local Verifier Application User Guide
27-
- **guest_tools** - Contains utilities specific to running _within_ a Confidential VM
28-
- Attestation SDK
29-
- Local Attestation Verifiers
30-
- RIM Acquisition Service
31-
- **host_tools** - Contains utilities specific to configuring the GPU's Confidential Computing Modes, as well as sample scripts to create and run a Confidential VM from within the _host_
32-
- GPU CC Mode Setting scripts
33-
- KVM Sample Scripts for launching a CVM
34-
- Staging folders for Deployment Guide found under docs/
35-
- **infrastructure** - Contains the open source, third-party code that was used for validation of our Hopper Confidential Computing Solutions
36-
- KVM source code, including OVMF and QEMU
37-
- Linux source code, along with appropriate GPU-specific patches
38-
- Pointers to original GitHub sources.
24+
25+
This repository is licensed under Apache License v2.0 except where otherwise noted.

guest_tools/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# NVIDIA GPU Attestation Guide
2+
3+
This guide provides a comprehensive overview of NVIDIA GPU Attestation and outlines the steps to implement it in your environment.
4+
5+
## Table of Contents
6+
7+
- [NVIDIA GPU Attestation Guide](#nvidia-gpu-attestation-guide)
8+
- [Table of Contents](#table-of-contents)
9+
- [Pre-requisites](#pre-requisites)
10+
- [Attestation Using SDK - A Primer](#attestation-using-sdk---a-primer)
11+
- [Quick Start](#quick-start)
12+
- [NVIDIA Attestation Service Integration Options](#nvidia-attestation-service-integration-options)
13+
- [Option 1: NVIDIA-Managed Attestation (Most Secure)](#option-1-nvidia-managed-attestation-most-secure)
14+
- [Option 2: Hybrid Attestation](#option-2-hybrid-attestation)
15+
- [Option 3: Customer-Managed Attestation](#option-3-customer-managed-attestation)
16+
- [Comparison of Options](#comparison-of-options)
17+
- [License](#license)
18+
- [Support](#support)
19+
20+
## Pre-requisites
21+
22+
1. Install Attestation SDK using [this guide](./attestation_sdk/README.md). This in turn installs Local GPU Verifier.
23+
2. [Optional] Review the [NVIDIA NGC Status Page](https://status.ngc.nvidia.com/) to ensure NVIDIA Remote Attestation Service (NRAS), RIM Service, and OCSP Service are functional.
24+
25+
## Attestation Using SDK - A Primer
26+
27+
Attestation using the SDK involves three main steps:
28+
29+
1. Add a verifier
30+
31+
```python
32+
client = attestation.Attestation()
33+
client.add_verifier(attestation.Devices.GPU, attestation.Environment.REMOTE, NRAS_URL, "")
34+
```
35+
2. Get GPU Evidence
36+
37+
```python
38+
evidence_list = client.get_evidence()
39+
```
40+
3. Perform Attestation and optionally validate results using a JSON-based Relying Party policy
41+
42+
```python
43+
client.validate_token(JSON_POLICY)
44+
```
45+
46+
## Quick Start
47+
48+
1. Navigate to the `nvtrust/guest_tools/attestation_sdk/tests/end_to_end/hardware` directory.
49+
50+
```bash
51+
cd nvtrust/guest_tools/attestation_sdk/tests/end_to_end/hardware
52+
```
53+
2. Run `RemoteGPUTest.py` or `LocalGPUTest.py`
54+
55+
```bash
56+
python LocalGPUTest.py
57+
# or
58+
python RemoteGPUTest.py
59+
```
60+
61+
## NVIDIA Attestation Service Integration Options
62+
63+
### Option 1: NVIDIA-Managed Attestation (Most Secure)
64+
65+
![Workflow](./docs/images/nras.png)
66+
67+
This model offers the highest level of security and operational simplicity, leveraging NVIDIA's cloud-based attestation services for comprehensive verification.
68+
69+
**Key Components:**
70+
- Local GPU Verifier: Collects evidence from the GPU
71+
- NVIDIA Cloud Services: Remote Attestation, RIM, and OCSP services
72+
73+
**Example:**
74+
```python
75+
# Code snippet from nvtrust/guest_tools/attestation_sdk/tests/end_to_end/hardware/RemoteGPUTest.py
76+
#
77+
client = attestation.Attestation()
78+
client.add_verifier(attestation.Devices.GPU, attestation.Environment.REMOTE, NRAS_URL, "")
79+
evidence_list = client.get_evidence()
80+
client.attest(evidence_list)
81+
```
82+
83+
### Option 2: Hybrid Attestation
84+
85+
![Workflow](./docs/images/hybrid.png)
86+
87+
This model balances local control with cloud-based support, allowing for local comparison & verification of values while still utilizing NVIDIA cloud services.
88+
89+
**Key Components:**
90+
- Local GPU Verifier: Handles both evidence collection and verification
91+
- NVIDIA Cloud Services: NVIDIA RIM and OCSP services
92+
93+
**Example:**
94+
```python
95+
# Code snippet from nvtrust/guest_tools/attestation_sdk/tests/end_to_end/hardware/LocalGPUTest.py
96+
#
97+
client = attestation.Attestation()
98+
client.add_verifier(attestation.Devices.GPU, attestation.Environment.LOCAL, "", "", OCSP_URL, RIM_URL)
99+
evidence_list = client.get_evidence()
100+
client.attest(evidence_list)
101+
```
102+
103+
### Option 3: Customer-Managed Attestation
104+
105+
NVIDIA also offers Trust Outpost, a comprehensive GPU attestation solution for end-to-end GPU attestation designed for high-scale deployments and organizations needing enhanced local control. This on-premises implementation efficiently caches RIM and OCSP data, ideal for environments with strict data sovereignty or air-gapped systems. Access requires appropriate agreements with NVIDIA - please contact [attestation-support@nvidia.com](mailto:attestation-support@nvidia.com) to request participation in the program.
106+
107+
![Workflow](./docs/images/outpost.png)
108+
109+
## Comparison of Options
110+
111+
| Feature | Cloud-Managed | Hybrid | Trust Outpost |
112+
|---------|---------------|--------|-----------------|
113+
| Security Level | Highest | High | High |
114+
| Operational Complexity | Lowest | Moderate | Highest |
115+
| Local Control | Lowest | Moderate | Highest |
116+
| Cloud Dependency | Highest | Moderate | Lowest |
117+
| Best For | Maximum security and simplicity | Balanced approach | Strict control requirements |
118+
119+
## License
120+
121+
This project is licensed under the Apache License 2.0.
122+
123+
# Support
124+
125+
For issues or questions, please [file a bug](https://github.com/NVIDIA/nvtrust/issues). For additional support, contact us at [attestation-support@nvidia.com](mailto:attestation-support@nvidia.com)
126+

guest_tools/attestation_sdk/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ Please execute the following commands to clean up packages that were not install
8080
8181
- Local GPU Attestation
8282
83-
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/LocalGPUTest.py)
83+
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/end_to_end/hardware/LocalGPUTest.py)
8484
8585
- Remote GPU Attestation
8686
87-
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/RemoteGPUTest.py)
87+
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/end_to_end/hardware/RemoteGPUTest.py)
8888
8989
## Switch Attestation
9090
@@ -101,11 +101,11 @@ Please execute the following commands to clean up packages that were not install
101101
102102
- Local nvSwitch Attestation
103103
104-
Refer to the [sample implementation](tests/LocalSwitchTest.py)
104+
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/end_to_end/hardware/LocalSwitchTest.py)
105105
106106
- Remote nvSwitch Attestation
107107
108-
Refer to the [sample implementation](tests/RemoteSwitchTest_v3.py)
108+
Refer to the [sample implementation](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_sdk/tests/end_to_end/hardware/RemoteSwitchTest.py)
109109
110110
## Claims and Troubleshooting information
111111
@@ -135,6 +135,8 @@ v2.1.0 | v3 | 2.0
135135
v2.1.1 | v3 | 2.0
136136
v2.1.2 | v3 | 2.0
137137
v2.1.3 | v3 | 2.0
138+
v2.1.4 | v3 | 2.0
139+
v2.3.0 | v3 | 2.0
138140
139141
More information on claims can be found [here](https://github.com/NVIDIA/nvtrust/blob/main/guest_tools/attestation_troubleshooting_guide.md)
140142
@@ -146,11 +148,13 @@ More information on claims can be found [here](https://github.com/NVIDIA/nvtrust
146148
| Attestation(<-name->) | Create a new Attestation Object used to call other Attestation methods. |
147149
| set_name(<-name->) | Set a name for the Attestation SDK client |
148150
| set_nonce(<-nonce->) | Set a nonce for Attestation |
151+
| set_ocsp_nonce_disabled(<-bool->) | Flag which indicates whether to include a nonce when calling OCSP. Only applicable for local GPU attestation. False by default |
149152
| add_verifier(<-attestation-device-type->, <-local/remote->, <-remote-attestation-service-url->, <-attestation-results-policy->) | Add a specific type of verifier for the client object. The verifier will be invoked during the attest operation |
150153
| get_verifiers() | Retrieves the list of verifiers added to the client object. |
151154
| get_evidence() | Retrieves the list of evidence based on the attestation device (e.g., GPU, switch) and the type of attestation (e.g., local, remote). |
152155
| attest() | Trigger the Attestation for the client object, This uses the Attestation type configured in the add_verifier method |
153156
| get_token() | Retrieves the Attestation token that contains claims corresponding to the Attestation result. |
157+
| get_ocsp_nonce_disabled() | Retrieves the flag which indicates whether a nonce is included when calling OCSP. |
154158
| validate_token(<-attestation-results-policy->) | Validate the Attestation Claims against a policy |
155159
| decode_token(<-jwt-token->) | Decodes the JWT token to claims received by the verifier |
156160
## Attestation SDK configuration

guest_tools/attestation_sdk/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nv-attestation-sdk"
3-
version = "2.1.3"
3+
version = "2.3.0"
44
description = "The Attestation SDK provides developers with a easy to use APIs for implementing attestation capabilities into their applications."
55
authors = ["Karthik Jayaraman <kjayaraman@nvidia.com>"]
66
readme = "README.md"
@@ -22,7 +22,7 @@ xmlschema = "==2.2.3"
2222
pyOpenSSL = "==24.2.1"
2323
PyJWT = "==2.7.0"
2424
nvidia-ml-py = ">=12.535.77"
25-
nv-local-gpu-verifier = "2.1.1"
25+
nv-local-gpu-verifier = "2.3.0"
2626
build = ">=0.7.0"
2727
twine = ">=3.7.1"
2828
pylint = ">=2.9.6"

guest_tools/attestation_sdk/src/nv_attestation_sdk/attestation.py

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import jwt
1515

1616
from nv_attestation_sdk.utils.logging_config import setup_logging, get_logger
17+
from nv_attestation_sdk.utils.config import RIM_SERVICE_URL, OCSP_SERVICE_URL
1718
from .gpu import attest_gpu_local, attest_gpu_remote
1819
from .nvswitch import attest_nvswitch_local, attest_nvswitch_remote
1920
from .utils import claim_utils, local_utils, nras_utils
@@ -80,7 +81,8 @@ class VerifierFields(IntEnum):
8081
URL = 3
8182
POLICY = 4
8283
JWT_TOKEN = 5
83-
84+
OCSP_URL = 6
85+
RIM_URL = 7
8486

8587
class Attestation:
8688
"""
@@ -93,6 +95,8 @@ class Attestation:
9395
_tokens = None
9496
_verifiers = []
9597
_instance = None
98+
_ocsp_nonce_disabled = False
99+
_no_gpu_mode = False
96100

97101
def __new__(cls, name=None):
98102
if cls._instance is None:
@@ -139,10 +143,31 @@ def get_nonce_server(cls) -> str:
139143
str: URL of the nonce server
140144
"""
141145
return cls._nonceServer
146+
147+
@classmethod
148+
def set_ocsp_nonce_disabled(cls, ocsp_nonce_disabled: bool) -> None:
149+
"""Flag which indicates whether to include a nonce when calling OCSP. False by default
150+
151+
Args:
152+
ocsp_nonce_disabled (bool): Flag which indicates whether to include a nonce when calling OCSP
153+
"""
154+
if not isinstance(ocsp_nonce_disabled, bool):
155+
raise ValueError("Incorrect data type for ocsp_nonce_disabled.")
156+
cls._ocsp_nonce_disabled = ocsp_nonce_disabled
157+
158+
@classmethod
159+
def get_ocsp_nonce_disabled(cls) -> bool:
160+
"""Get the flag which indicates whether a nonce is included when calling OCSP.
161+
162+
Returns:
163+
bool: Flag which indicates whether a nonce is included when calling OCSP
164+
"""
165+
return cls._ocsp_nonce_disabled
166+
142167

143168
@classmethod
144169
def add_verifier(
145-
cls, dev: Devices, env: Environment, url: str, evidence: str
170+
cls, dev: Devices, env: Environment, url: str, evidence: str, ocsp_url: str=OCSP_SERVICE_URL, rim_url: str=RIM_SERVICE_URL
146171
) -> None:
147172
"""Add a new verifier for Attestation
148173
@@ -151,6 +176,8 @@ def add_verifier(
151176
env (Environment): Type of Attestation - local, remote etc.
152177
url (str): URL of the Attestation Server for Remote Attestation use cases.
153178
evidence (str): Attestation evidence
179+
ocsp_url (str): URL of the OCSP service to check the revocation status of a certificate
180+
rim_url (str): URL of the RIM service for fetching driver and VBIOS RIM files
154181
"""
155182
verifier_name_mapping = {
156183
(Devices.GPU, Environment.LOCAL): "LOCAL_GPU_CLAIMS",
@@ -161,8 +188,7 @@ def add_verifier(
161188
}
162189

163190
name = verifier_name_mapping.get((dev, env), "UNKNOWN_CLAIMS")
164-
165-
lst = [name, dev, env, url, evidence, ""]
191+
lst = [name, dev, env, url, evidence, "", ocsp_url, rim_url]
166192
cls._verifiers.append(lst)
167193

168194
@classmethod
@@ -182,10 +208,13 @@ def get_verifiers(cls) -> list:
182208
return cls._verifiers
183209

184210
@classmethod
185-
def get_evidence(cls, ppcie_mode: bool = True) -> Tuple[str, List]:
211+
def get_evidence(cls, options=None) -> Tuple[str, List]:
186212
"""
187213
A class method to get evidence for attestation. Returns evidence for the specified verifier.
188214
"""
215+
if options == None:
216+
options = {}
217+
189218
decorative_logger.info("Attestation SDK: Getting Evidence")
190219
nonce = cls.get_nonce() or cls._generate_nonce()
191220
logger.info("Nonce generated: %s", nonce)
@@ -196,14 +225,18 @@ def get_evidence(cls, ppcie_mode: bool = True) -> Tuple[str, List]:
196225
(Devices.SWITCH, Environment.LOCAL): attest_nvswitch_local.get_evidence,
197226
(Devices.SWITCH, Environment.REMOTE): attest_nvswitch_remote.get_evidence,
198227
}
199-
228+
# TODO Add support for no_switch_mode
229+
evidence_options = {
230+
"ppcie_mode": options.get("ppcie_mode", True),
231+
"no_gpu_mode": options.get("no_gpu_mode", False)
232+
}
200233
for verifier in cls._verifiers:
201234
device = verifier[VerifierFields.DEVICE]
202235
environment = verifier[VerifierFields.ENVIRONMENT]
203236
evidence_func = evidence_mapping.get(
204237
(device, environment), cls._unknown_verifier
205238
)
206-
return evidence_func(nonce, ppcie_mode)
239+
return evidence_func(nonce, evidence_options)
207240

208241
logger.error("Unknown verifier - Assuming all is good")
209242
return nonce, []
@@ -245,8 +278,14 @@ def attest(cls, evidence_list) -> bool:
245278
nonce, evidence_list, verifier_url
246279
)
247280
else:
281+
attestation_options = {
282+
"ocsp_nonce_disabled": cls._ocsp_nonce_disabled,
283+
"rim_service_url": verifier[VerifierFields.RIM_URL],
284+
"ocsp_url": verifier[VerifierFields.OCSP_URL]
285+
}
286+
248287
this_result, jwt_token = attestation_func(
249-
nonce, evidence_list
288+
nonce, evidence_list, attestation_options
250289
)
251290
verifier[VerifierFields.JWT_TOKEN] = jwt_token
252291
attest_result = attest_result and this_result

0 commit comments

Comments
 (0)