Skip to main content
This page details the security infrastructure governing device identity, mutual TLS (mTLS) authentication, and the high-performance QUIC transport layer used for inter-node communication within the Palyra ecosystem.

Internal Certificate Authority (CA)

Palyra implements a built-in Certificate Authority to manage the lifecycle of identities without external dependencies. The CertificateAuthority class handles the generation of self-signed root certificates and the issuance of short-lived leaf certificates for both clients and servers.

Key Components

Issuance Logic

The CA supports three primary issuance flows:
  1. Client Certificates: Issued for devices with the ClientAuth extended key usage crates/palyra-identity/src/ca.rs#64-78.
  2. Server Certificates: Issued for the daemon’s RPC surfaces with ServerAuth crates/palyra-identity/src/ca.rs#80-86.
  3. SAN-Enabled Certificates: Supports Subject Alternative Names (SANs) for both DNS names and IP addresses, essential for multi-node networking where nodes are addressed by IP crates/palyra-identity/src/ca.rs#88-116.
Sources: crates/palyra-identity/src/ca.rs#1-173

Identity Management and Persistence

The IdentityManager orchestrates the CA, device pairing, and revocation state. It relies on a SecretStore for secure persistence of the CA private key and the identity state bundle.

The Secret Store Layer

Palyra provides two primary implementations of the SecretStore trait:

State Concurrency

To prevent state corruption during concurrent mutations (e.g., multiple CLI commands or daemon tasks), the IdentityManager implements a two-tier locking mechanism:
  1. IDENTITY_STATE_PROCESS_LOCK: A standard Rust Mutex for intra-process synchronization crates/palyra-identity/src/pairing/persistence.rs#39.
  2. Filesystem Lock: A file-based lock (.identity-state.lock) containing PID and timestamp metadata to synchronize across different processes crates/palyra-identity/src/pairing/persistence.rs#80-96.
Sources: crates/palyra-identity/src/store.rs#1-115, crates/palyra-identity/src/pairing/persistence.rs#1-150

Device Pairing Flow

The pairing flow establishes trust between an unauthenticated client and the Palyra gateway. It uses a challenge-response mechanism involving ephemeral X25519 keys.

Pairing Sequence Diagram

Title: Device Pairing Handshake Flow Sources: crates/palyra-identity/src/pairing/handshake.rs#27-148, crates/palyra-identity/src/pairing/persistence.rs#56-66

Key Functions


mTLS Enforcement and Revocation

Once paired, all node communication is protected by mTLS. Palyra implements a RevocationAwareClientVerifier (conceptually managed via MemoryRevocationIndex) to handle real-time certificate invalidation.

Revocation Logic

Configuration Helpers

Sources: crates/palyra-identity/tests/mtls_pairing_flow.rs#114-173

QUIC Transport Layer

Palyra uses the quinn implementation of QUIC for its framed I/O layer (palyra-transport-quic). This provides multiplexed, reliable, and encrypted streams.

Transport Runtime Architecture

Title: QUIC Runtime and Framed I/O Sources: crates/palyra-daemon/src/quic_runtime.rs#1-122, crates/palyra-transport-quic/src/lib.rs

Implementation Details

Supported Methods

The QUIC runtime currently handles: Sources: crates/palyra-daemon/src/quic_runtime.rs#1-200, crates/palyra-transport-quic/tests/transport.rs#45-140