apomesh-pki
The PKI plane — apomesh’s native, org-grade certificate authority. A deployment gains an org-grain trust domain with its own issuing CA that mints short-lived leaf certificates carrying SPIFFE-style identity URIs, and exports/parses trust bundles so two deployments can federate over mutual TLS. It backs three surfaces: the dev-stack’s gRPC mTLS material, the A2A mutual-TLS federation plane, and edge-worker bootstrap enrollment.
Design lineage: SPIFFE/SPIRE, implemented natively — trust domain = org,
spiffe://<domain>/node/<id> and .../tenant/<id> SAN URIs = the node
and tenant grains, short-lived leaves, trust bundles for cross-domain
federation. The existing SubjectAltNameUri mTLS extraction consumes
these URIs unchanged.
Position in the workspace
Section titled “Position in the workspace”- Layer: a leaf crate beside the substrate — it owns cert
minting, which the substrate deliberately does not.
rcgenis a production dependency of this crate only (“operators bring their own” no longer holds — the platform can mint). - Depends on: no apomesh crates (rcgen, x509-parser, rustls, time). A true leaf.
- Consumed by:
apomesh-a2a-client (the
outbound peer trust anchors),
apomesh-orchestrator (live
mutual_tlsadmission mints per-tenant client identities; worker enrollment mints node certs), the orchestrator binary (loads the org CA, serves the federation listener), and the dev-stack minting bin.
What it owns
Section titled “What it owns”- Identity vocabulary (
identity):TrustDomain(a validated, DNS-name-shaped org identifier) andIdentityUri— build and parse the two grains (IdentityUri::node,IdentityUri::tenant) with typedIdentityError. The rendered URI is exactly what the substrate’sSubjectAltNameUri{prefix}mTLS rule strips to an id. - The org CA (
ca):CaAuthority—generatea self-signed org CA for a trust domain,from_pemto import a BYO CA,persist/loada config-pointed identity directory (the key written0600), andca_cert_pemto export the public cert. The signing key never renders inDebug. - Leaf issuance (
issue): org-CA-signed leaves for the server, node-client, and tenant-client shapes, with a configurableValidity(short-lived by default —Validity::short_lived);IssuedIdentityexposes the public cert PEM and, through the single auditedexpose_key_pem, the private key. - Trust bundles + rotation (
bundle,issue):TrustBundle—from_authorityexports the org’s public CA material,from_pem/root_storeparses a peer’s bundle into arustls::RootCertStorefail-closed: any non-certificate section rejects the whole bundle, and a certificate that is not a usable CA isInvalidAnchor— no basic-constraints extension, orcA: false, is refused, because absence is not an assertion and the fail-closed reading of “is this a CA?” is no. Without that check an ordinary end-entity leaf pasted into a peer’s trust anchors is accepted as a root;needs_renewal+reissue(fresh-key rotation, since identity pins to the SAN URI + CA chain, never the key). - Dev-stack minting (
devstack):mint_dev_stackcomposes the above into the exact CA + server + worker cert set the local stack’s[auth.tls]config reads — theapomesh-pki mint-dev-stackbin that retireddeploy/local/certs/generate.sh.
Related
Section titled “Related”- Build: Agent2Agent (A2A) — configuring mutual-TLS peers and the federation listener.
- Concepts: Agent federation — how mutual-TLS trust composes with the delegation and inbound planes.
- Reference:
apomesh-a2a-client — the
outbound client that pins peer trust anchors from a
TrustBundle.