Internal PKI: offline root on hardware + per-purpose / per-cluster intermediates #9
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/machine-configs#9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of lab/machine-configs#7. Rewritten 2026-11-11, reasons in the dated comment below.
Framework
Mounts are named
<purpose>[-<zone>]. The purposes arepki-infra,pki-issue,pki-cluster,pki-svc, and the SSH mounts owned by lab/machine-configs#19. The zone isfleet(omitted from the name), a cluster name, or an SSH zone. A mount name encodes purpose and trust zone, never a distribution name.pki-cluster-<c>pluspki-svc-<c>plusauth/kubernetes-<c>, with no new root ceremony.docs/pki.md. lab/iac#47 imports against that file, not against this issue.Shape
pki-infraandauth/kubernetes-thinkare live.pki-cluster-thinklands before the rebuild (#14).pki-svc-thinkandpki-svc-miniland when cert-manager moves to OpenBao issuers, replacing the per-cluster self-signedinternal-root-cathe clusters mint today.Facts
allowed_domainson roles, so a cross-zone refusal test is a role test.pki-infrapathlen: 0, so it cannot sign sub-CAs.pki-issueis what takes the Nano out of cluster onboarding, one more ceremony run.<svc>.<ns>.svc.<cluster>.int.animeteamspeak.moe(lab/clusters#1671) and the recursor delegatesthink.int/mini.intas whole subzones (lab/clusters#1673). Bootstrap-critical names likeopenbao.int...are host-level, sit underintdirectly, and come frompki-infra.Done when
pki-infraintermediate issued, imported after init, OpenBao API TLS live, root in every host's trust store (scripts/pki-ceremony.sh,docs/day0-ceremony.md)pki-issue(pathlen 1)pki-cluster-thinkminted with the full CA set and consumed by #11 at the #14 rebuildpki-svc-thinkandpki-svc-minilive, cert-manager pointed at them throughauth/kubernetes-<cluster>pki-svc-thinkrole refuses a.mini.intname, proven, and apki-svc-minirole signs there finepki-issueandpki-cluster-*(the human only moves the key between ports)docs/pki.mdRelated
#11 (k3s consumes
pki-cluster-think), #14 (rebuild), #19 + lab/iac#49 (SSH mounts), lab/clusters#1671 and #1673 (the DNS subzones this mirrors), lab/iac#47 (tofu imports this shape).Decisions, 2026-11-07.
pki-infracannot be generated inside OpenBao before OpenBao exists, so the ceremony generates it (P-384, 5 years, pathlen 0), signs it with the root, and uses it to sign one API cert per think. It leaves the ceremony as an age-encrypted bundle and is imported into OpenBao'spki-inframount right afterbao operator init; then the bundle is deleted. The root still signs intermediates only./var/lib/openbao-tls/api.key(0400 root, done 2026-11-07), only CSRs left the hosts. SANs set by the ceremony:think-0N,think-0N.int.animeteamspeak.moe,openbao.int.animeteamspeak.moe,localhost, host IP,127.0.0.1. One year.pki-k3s-<cluster>andpki-servicesare generated inside OpenBao later; their CSRs get signed by the token over PKCS#11.Script:
scripts/pki-ceremony.sh <serial> <csr-dir> <out-dir>(main).DRY_RUN=1tested: chains verify, both backups round-trip,/dev/shmclean on exit.Why the body changed, 2026-11-11.
pki-k3s-<cluster>welded a distribution name into the trust plane. mini runs RKE2 today, and the CA set k3s needs (server, client, request-header, etcd peer/server, front-proxy) is what any cluster needs. The unit is the cluster, so the mount ispki-cluster-<name>.pki-servicesshared by every cluster puts a single issuing key over the wholeintzone, where a role slip on one cluster could mint for another. Per-cluster workload CAs (pki-svc-<cluster>) make the CA boundary equal the cluster boundary, the same rule #19 states for SSH.int.animeteamspeak.moe" was fiction. OpenBao's pki engine emits no RFC5280 name constraints at all, enforcement isallowed_domainson roles. The done-when now tests what is really enforced, a cross-zone role refusal.intbreak wildcard routing, one*.intwildcard resolves to one IP and no cluster distinction. lab/clusters#1668/#1671/#1673 settled on<cluster>.int.animeteamspeak.moesubzones delegated at the recursor, so service CAs pin to those same subzones.pki-infrapathlen 0, so it cannot sign sub-CAs. The framework gainspki-issue(pathlen 1, key inside OpenBao) and one more ceremony run, which takes the Nano out of future cluster onboarding.pki-infralive, root in the fleet trust store) are marked done, so #12 and #13 no longer look blocked on them.Decision 2026-11-11: re-sign the root cert with the same Nano 9c key, pathlen UNSET.
Why: the 11-07 root carries pathlen:1 (scripts/pki-ceremony.sh:67). OpenSSL check with the same constraints: root -> CA -> leaf verifies; root -> pki-issue -> pki-svc- -> leaf fails with 'path length constraint exceeded' (error 25). So pki-issue cannot work under the current root cert.
Depth is enforced one level down instead: pki-infra 0 (as is), pki-issue 1, pki-svc- 0, pki-cluster- per-purpose CAs 0, root-signed directly (fits either way). Only the offline touch-gated root key can sign directly under the root, and each intermediate's own pathlen bounds anything below it, so an unset root pathlen widens nothing in practice and never needs another Nano session for depth.
Same key, subject and SKI: everything issued so far (pki-infra, think API certs) keeps validating. The new root.crt replaces machine-configs pki/root.crt, the flux trust-manager Bundle lab-root-ca, and think openbao-snapshot's copy.
Next ceremony run, one sitting: (1) root re-sign, (2) pki-issue from an OpenBao-generated CSR, (3) pki-cluster-think per-purpose CA set for k3s (#11).
Decisions and corrections, 2026-11-11 (second round).
Cluster CAs are signed by pki-issue, not the root. Every device trusts only the lab root either way, so the choice doesn't touch device trust. What it changes is the Nano: root-signed would mean a Nano session per new cluster. k3s keeps its CA keys on the server nodes anyway, so root-signing protected only the moment the CA was created. The "pki-cluster- root-signed" line in the body is superseded. pki-cluster- = per-purpose CAs signed by pki-issue, pathlen 0.
Correction to Facts: OpenBao does emit RFC 5280 name constraints. Tested on OpenBao 2.7.2 (dev server):
sign-intermediatewithpermitted_dns_domainswrites a critical Name Constraints extension.excluded_dns_domainsandpermitted_ip_rangesare accepted and silently dropped. So permitted DNS works, IP ranges and excludes do not. Zone CAs (pki-svc-, pki-cluster-) get constrained at signing. Roleallowed_domainsstays as the second layer.Why it matters: devices trust everything below the root, including k3s CAs whose keys sit on nodes. With constraints, a stolen cluster CA key can't mint a cert any device accepts outside its names. Dry run: leaves for
kubernetes.default.svc.think.int…,localhost,think-01(plus IP SANs) verify;auth.animeteamspeak.moe,google.comand an unlisted nodethink-04fail with "permitted subtree violation".Scripts (
5c7cfd5):scripts/pki-ceremony-2.sh: root re-sign + pki-issue, 2 touches. Runbookdocs/pki-ceremony-2.md.scripts/pki-cluster-ca.sh <cluster>: no Nano. Constraint list inpki/clusters/<cluster>.domains.k8s-hub: once a cluster's server CA chains to the lab root, its BackendTLSPolicy validates against the single
lab-root-caConfigMap. The per-clusterk8s-hub-ca-*KV + ExternalSecret + Bundle chain retires cluster by cluster. Apiserver client trust stays per cluster (never the lab root: k8s maps any trusted client cert to a user).Ceremony done 2026-11-11, after a broken first run. Full log in
docs/pki-ceremony-2.md.0D:97:06:B2:EF:90:2F:5A:FE:71:31:CA:DE:B9:68:91:9F:6E:71:10:76:F4:8D:B9:7D:1E:E8:E8:9F:5C:1B:BA. Same key, SKI and subject DER as the 11-07 cert, pathlen unset. The script copiesrawSubjectfrompki/root-2026-11-07.crt, compares Name DER bytes, and verifies chains with Go (step certificate verify), including think-01's live API cert.pki-issue-2026(iac #55, #56). Its chain ends at the run-2 root.523362f, 7/7, no reboots; pi-02 trust store holds only the run-2 cert), minilab-root-caBundle, thinkopenbao-snapshot. Verified with Go:bao status, the snapshot job (uploaded), the openbao-config runner (NoDrift).Done-when boxes now met: "Next ceremony run issues pki-issue (pathlen 1)" and "Ceremony script covers pki-issue". pki-cluster-* runs online through pki-issue (
scripts/pki-cluster-ca.sh), no Nano needed.