-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Improved attestation verification #96
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
Conversation
42512e3 to
1742e2e
Compare
| @lru_cache(maxsize=1) | ||
| def load_sev_library() -> bool: | ||
| """Load the SEV library""" | ||
| return sev.init() |
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.
This seems a bit hacky. I understand you are trying to load it only once. Have you tried to initialize it globally on import? It should be called only once. And you are not checking if the init failed swallowing the error and delaying it to the execution of the attestation.
| @lru_cache(maxsize=1) | |
| def load_sev_library() -> bool: | |
| """Load the SEV library""" | |
| return sev.init() | |
| if not sev.init(): | |
| raise Exception("Failed to load SEV") |
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.
At the moment, I aim at allowing nilAI to run on SEV and non-SEV hosts. If /dev/sev-guest is not available, the idea is that it continues to work, though with fake attestations. That's why we need to make sure an exception is not raised here.
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_attester.py
Outdated
Show resolved
Hide resolved
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_verifier.py
Outdated
Show resolved
Hide resolved
a7d4d0c to
c5c0c6a
Compare
c5c0c6a to
f5fe0a6
Compare
I know this PR touches way too many files, but it wasn’t possible to break it into smaller PRs while keeping everything functional.
This PR introduces support for attestation verification using the official nvtrust library instead of the default Azure library.
To avoid issues caused by the outdated dependencies of nv-trust-attestation-sdk, we have modularized the attestation logic into a separate, standalone package that runs inside a Docker container. nilai-api now interacts with this container via an internal API, ensuring a cleaner and more maintainable integration.
To make it easier to review, here’s what you need to know:
1 .We have removed
packages/verifier. This was a copy of the source from the Azure Confidential GPU library. Since the source was removed, that’s why there are so many lines of code deleted.2. There is a new directory,
nilai-attestation, which includes all the code required for attestation. It is a FastAPI server with a single endpoint at/attestation/report. It is intentionally kept completely separate from the rest of thenilaicode to avoid any dependency conflicts. It is meant to run in the attestation: container in the Docker Compose setup and has its own attestation.Dockerfile.3. Now
nilai-apisimply forwards attestations to the attestation container. It no longer needs to handle any verification itself, so it no longer has any GPU-related dependencies. Thus all the changes tonilai_api/state.py(which was in charge of the attestations before), and now there isnilai_api/attestation/__init__.pywhich forwards a GET request.4. There are other QoL improvements, such as removing the two port bindings from the nilai-api gunicorn.conf.