# configs/pki/ Public certificates of the lab internal CA. **Public material only** — private keys live encrypted in `secrets/` (`lab-ca-key.age`, `-tls-key.age`), managed with agenix. ## Contents | File | Description | |---|---| | `lab-ca.crt` | Root CA cert (`CN=Skyg Lab CA`). Trusted fleet-wide via `modules/core/lab-ca.nix` (`security.pki.certificateFiles`). | | `lab-ca.srl` | OpenSSL serial counter, written on first `ca issue`. Needed for unique serials — commit it. | | `.crt` | Leaf certs issued for services (e.g. `buzz.app.internal.crt`). | ## Managed by `skyg ca` (bin/lib/cmds.nu) ```sh skyg ca init # one-time: generate the root CA skyg ca issue buzz.app.internal --for minipc1 # mint a leaf for a service ``` - `ca init` encrypts the CA key to `secrets/lab-ca-key.age` (recipient: `ari` only) and writes `lab-ca.crt` here. Refuses to overwrite an existing CA. - `ca issue` decrypts the CA key to `.tmp/`, signs a leaf (SAN = domain, EKU serverAuth, 825 days), encrypts the leaf key to `secrets/-tls-key.age` (recipients: `ari` + the `--for` host), and writes `.crt` here. - Both commands auto-register missing entries in `secrets.nix` — review with `git diff` after running them. Never hand-edit or commit keys here. Re-issuing: delete the leaf cert and re-run `ca issue`. Rotating the CA itself: delete `lab-ca.crt` + `secrets/lab-ca-key.age`, re-run `ca init`, re-issue all leaves, and rebuild every host (fleet trust comes from the committed root cert).