System Overview
mero-tee TEE infrastructure — 3 components, 6 endpoints, mutual attestation
High-Level Architecture
The mero-tee system secures Calimero node storage through hardware-attested key management. merod nodes run inside TDX confidential VMs. On boot, each node contacts the KMS to obtain its storage encryption key. The KMS validates the node’s TDX attestation before releasing the key via Phala dstack’s deterministic key derivation.
mero-kms-phala Deep Dive
The KMS is a stateless Rust HTTP service (Axum) that runs inside a TDX enclave alongside Phala dstack. Its sole purpose is to validate remote attestations and release deterministic storage encryption keys.
API Endpoints
Internal Architecture
AppState
Shared Axum state holding Config (from env) and ChallengeStore (InMemory or Redis). The store maps challengeId → (nonce, peerId, expiry).
Policy Engine
On startup, fetches attestation policy from GitHub releases (or env). Policy specifies allowed MRTD, RTMR0–3 values, TCB status allowlists, and profile constraints.
Key Modules
Node Images
The mero-tee/ subfolder contains infrastructure-as-code for building GCP TDX confidential VM images. Packer defines the image, Ansible provisions the OS and merod binary.
Build Profiles
debug
Full SSH access, verbose logging, no read-only filesystem. For local development and testing. Writes a debug RTMR3 event.
developmentdebug-read-only
SSH access but read-only root filesystem. For staging validation. Writes a debug-read-only RTMR3 event.
staginglocked-read-only
No SSH, read-only filesystem, minimal attack surface. For production. Writes a locked-read-only RTMR3 event.
productionEach profile writes a distinct RTMR3 runtime event during boot. The KMS attestation policy specifies which RTMR3 values are acceptable, creating cryptographic cohort separation — a debug node can never obtain production keys.
Build Pipeline
Packer Init
GCP image builder provisions a Confidential VM instance with TDX guest support enabled.
Ansible Provision
Installs merod binary, systemd units, network config, and TDX guest tools. Sets profile marker at /etc/mero-kms/image-profile.
Image Seal
Captures the GCP image. The image hash becomes the MRTD measurement — any tampering changes the measurement and attestation fails.
Attestation Verifier
A public-facing web application that allows anyone to verify the attestation status of a Calimero KMS instance. Built with React and a serverless API backend.
Frontend (React SPA)
User enters a KMS URL. The app calls the verifier API which fetches a quote from the KMS and submits it to Intel Trust Authority for verification. Results are displayed with detailed attestation claims.
Backend (/api/verify)
Serverless function that: (1) calls POST /attest on the target KMS with a fresh nonce, (2) forwards the quote to Intel Trust Authority, (3) validates the ITA JWT response, (4) returns structured verification results.
Verification Chain
Browser → /api/verify
User submits KMS URL with binding data. Serverless function generates a nonce.
Verifier → KMS /attest
Serverless function calls the KMS POST /attest with the nonce.
KMS → dstack
KMS asks dstack to produce a TDX quote binding nonce || report_data.
Verifier → ITA
Quote is forwarded to Intel Trust Authority for cryptographic verification.
ITA → JWT
ITA returns a signed JWT with attestation claims (measurements, TCB level, advisory IDs).
Browser ← Results
Parsed JWT claims are returned to the browser and displayed in a human-readable format.