Files
nixos-setup/configs/pki/ABOUTME.md
T
2026-09-21 14:38:16 -04:00

34 lines
1.5 KiB
Markdown

# configs/pki/
Public certificates of the lab internal CA. **Public material only** — private
keys live encrypted in `secrets/` (`lab-ca-key.age`, `<name>-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. |
| `<domain>.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/<name>-tls-key.age`
(recipients: `ari` + the `--for` host), and writes `<domain>.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).