Conversation
| tar -xzvf ${dcap.prebuilt} -C $sourceRoot/external/dcap_source ./prebuilt/ | ||
| tar -xzvf ${dcap.prebuilt} -C $sourceRoot/external/dcap_source/QuoteGeneration ./psw/ | ||
| tar -xzvf ${dcap.prebuilt} -C $sourceRoot/external/dcap_source prebuilt/ | ||
| tar -xzvf ${dcap.prebuilt} -C $sourceRoot/external/dcap_source/QuoteGeneration psw/ |
There was a problem hiding this comment.
For some reason the paths changed slightly between releases and tar fails to extract unless the paths match exactly:
$ tar -tvf /nix/store/wwrz1bajkv340p7168fald0fhm7jghj9-prebuilt_dcap_1.24.tar.gz
drwxr-xr-x bgotowal/intelall 0 2025-10-29 17:07 prebuilt/
drwxr-xr-x bgotowal/intelall 0 2025-10-29 17:07 prebuilt/opa_bin/
-rw------- bgotowal/intelall 227664 2025-10-29 17:07 prebuilt/opa_bin/policy.wasm
drwxr-xr-x bgotowal/intelall 0 2025-10-29 00:44 prebuilt/openssl/
drwxr-xr-x bgotowal/intelall 0 2025-10-29 18:45 prebuilt/openssl/lib/
-rw-r--r-- bgotowal/intelall 9606146 2025-10-29 21:52 prebuilt/openssl/lib/libcrypto.a
drwxr-xr-x bgotowal/intelall 0 2025-10-29 00:41 prebuilt/openssl/lib/linux64/
-rw-r--r-- bgotowal/intelall 9606146 2025-10-29 21:59 prebuilt/openssl/lib/linux64/libcrypto.a
# ...
$ tar -tvf /nix/store/2mxs3avyf51rr8wd1l2lglwllpx43pjb-prebuilt_dcap_1.23.tar.gz
drwxrwxr-x feng/feng 0 2024-09-09 16:20 ./
drwxrwxr-x feng/feng 0 2024-07-10 16:29 ./prebuilt/
drwxrwxr-x feng/feng 0 2024-07-25 17:25 ./prebuilt/opa_bin/
-rw------- feng/feng 227664 2024-07-25 17:25 ./prebuilt/opa_bin/policy.wasm
drwxrwxr-x feng/feng 0 2024-07-10 16:21 ./prebuilt/openssl/
drwxrwxr-x feng/feng 0 2024-07-10 16:21 ./prebuilt/openssl/inc/
drwxrwxr-x feng/feng 0 2024-07-10 16:21 ./prebuilt/openssl/inc/openssl/
-rw-rw-r-- feng/feng 29352 2024-07-10 16:21 ./prebuilt/openssl/inc/openssl/ocsp.h
# ...
|
@marcin-serwin Thanks for the review. All comments should be addressed. |
marcin-serwin
left a comment
There was a problem hiding this comment.
LGTM but I have no experience with running this so I'd prefer to have a second opinion before merging.
|
Needed to rebase on master after a repo-wide finalAttrs refactor commit touched a deleted file ( |
|
cc @haraldh are you still using SGX at all? any chance you could give this a test real quick? Thanks! |
|
sorry, only Sev-SNP and TDX |
This package has been broken and unmaintained since 2024-11, when it broke sometime around the nixos-24.11 release
|
rebased on master |
Updated the
|
On our prod machines, aesmd would always fail the first time after boot, with logs like: `XXX-copy-aesmd-data-files.sh[770]: chown: invalid user: 'aesmd:aesmd'`. Everything would be fine after the next restart, but blocking boot for 15 seconds is definitely annoying. It appears the issue was that we were trying to name the DynamicUser User and Group (aesmd/aesmd) during ExecStartPre, but systemd only creates these right before ExecStart. After playing around with the ExecStartPre script, I finally got it to work correctly. As a bonus, we can also re-add the RootDirectory/chroot hardening. I've also cleaned out the config for the old out-of-tree isgx driver and the old DCAP driver. The kernel has had in-kernel SGX support since 5.11 (~2021/02).
Changes
Update the
sgx-pswpackage to the latest 2.27 release.Fix the
aesmdservice, which broke with the update tosystemd-v257(#356818).Update the
sgx-azure-dcap-clientto 1.13.0 (pre-release), which uses the new v4 Intel PCCS API as the prior v2 and v3 API versions are EOL on 2026-04-30.If possible, it would be nice to backport this to release-25.11, as
sgx-psw/aesmdare currently broken on that release.Previous update PRs:
Quick Glossary:
sgx-psw(Platform SoftWare) provides theaesmdservice (Architecture Enclave Service Manager Daemon), which simplifies running enclaves and getting remote attestation quotes.Testing:
These changes were tested on an SGX-enabled Azure gen2 VM (DCSv3) running NixOS.
Run against real SGX hardware
Make sure you're running on a recent x86-64 Intel CPU, against a somewhat recent kernel with the in-tree kernel SGX driver (any NixOS config in the last few years should cover this).
Check the hardware and kernel setup:
In your NixOS
configuration.nix, add something like:After a
nixos-rebuild switch, check that the devices are configured and theaesmdservice is running:Run a test enclave that exercises remote attestation:
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.