Reference implementation of a basic AWS Nitro Enclaves remote attestation workflow in Go.
This project shows how to:
- accept a request from an external client
- relay that request through a parent EC2 instance
- ask a real Nitro Enclave for a fresh attestation document through vsock
- return that document to the client
- verify the AWS certificate chain, COSE signature, nonce, and PCR values on the client side
The repository is split into three runtime pieces:
client/cmd/requestVerifies a Nitro attestation document returned by the remote host.ec2/cmd/serverRuns on the parent EC2 instance and relays attestation requests to the enclave over vsock.nitro-enclave/cmd/attestationRuns inside the Nitro Enclave, calls the Nitro Security Module (/dev/nsm), and returns a fresh attestation document bound to the client nonce.
The deployed request path is:
client -> EC2 HTTP relay -> vsock -> Nitro Enclave -> NSM attestation document
- Go for the client, EC2 relay, and enclave application
- AWS Nitro Enclaves for enclave isolation and attestation
- VSock for parent-instance to enclave communication
- NSM for enclave attestation document generation
- CBOR and COSE_Sign1 for the attestation document format and signature
- Terraform for the EC2 host and supporting AWS infrastructure
- Devbox for reproducible local tooling
What is already built here:
- real Nitro Enclave attestation generation inside the enclave
- parent EC2 relay over HTTP and vsock
- client-side attestation verification
- Terraform for a low-cost Nitro-capable EC2 host
- SSH-based deployment helpers that can either clone pushed
mainon the EC2 host or rsync the current local working tree there before building and starting the relay plus enclave
What this repository is not trying to be:
- a production-ready confidential computing platform
- a full secret provisioning system after attestation
- a complete abstraction over Nitro Enclaves internals
It is a focused reference implementation for understanding and testing the attestation flow end to end.
Set up the local toolchain:
devbox shell
devbox run check
devbox run testDeploy the parent EC2 host with SSH enabled:
MY_IP=$(curl -fsSL https://checkip.amazonaws.com | tr -d '\n')
devbox run infra:deploy -- \
-var='use_spot=false' \
-var='instance_type=c6g.large' \
-var='ssh_key_name=your-ec2-key-pair-name' \
-var="allowed_ssh_cidr_blocks=[\"${MY_IP}/32\"]"Deploy the pushed main branch onto the parent EC2 host:
EC2_SSH_KEY_PATH=~/.ssh/your-key.pem devbox run ec2:app-deployFor local uncommitted work, sync the current working tree instead:
EC2_SSH_KEY_PATH=~/.ssh/your-key.pem devbox run ec2:app-sync-deployRun the client verifier:
make nitro-root-cert
cd client
EC2_ATTESTATION_URL=$(cd .. && devbox run urls | head -n1) \
AWS_NITRO_ROOT_CERT=../.cache/aws-nitro-root/AWS_NitroEnclaves_Root-G1.pem \
go run ./cmd/requestDestroy the infrastructure when finished:
devbox run infra:destroy