4.8 KiB
Custos ticket: sign an X.509 CSR with the Domi PKI root after a match-code approval
Status: written, not filed (ROADMAP §6 Phase 3, §8.6). Ianitor uses the manual offline step in pki.md until this exists.
Why
ROADMAP §1.2: the Domi PKI root key lives offline in Custos; the intermediate on the server is renewed yearly "through a Custos match-code approval". Custos (desktop 0.8.0, CustosPublic v0.13.0) has no such operation today:
- The
signop (docs/09_signing.md) signs onlyminisign,manifest,authenticodeandapprovalpayloads. A sign request againstdomi-rootis refused on purpose (apps/desktop/src-tauri/src/signing.rs, test at line 595). domi-rootis the RSA-3072 Household Root for Authenticode. Issuing TLS intermediates from it would mix code signing and TLS trust; the Domi PKI needs its own root.- The only server-reachable path is the factor-service sign mailbox
(
POST /api/sign/requests,GET /api/sign/requests/{id}, docs/09_signing.md:42-51), which carries the existing kinds only.
What Ianitor needs
1. A new key: domi-pki-root
- ECDSA P-256 (what rcgen and every TLS client support; no RSA keygen in ring).
- Self-signed CA certificate, about 10 years,
basicConstraints CA:TRUE, pathLenConstraint 1, key usagekeyCertSign, cRLSign, subjectCN=Domi PKI Root, O=Fabrica Domi. - Created in Custos, or imported once from the file Ianitor's offline CLI made
(
ianitor-control ca init, see pki.md), after which that file is destroyed. - Like the other signing keys: in the vault body member
signing, never an item, never revealed, copied, shared or exported. The public certificate is readable through the existingcertificateop (custos-provision pub domi-pki-root).
2. A new sign kind: x509_csr
Request through the existing sign mailbox (same token, same sealing to a one-time X25519 key, same audit entry):
{ "op": "sign", "namespace": "domi", "key": "domi-pki-root", "kind": "x509_csr",
"csr": "<PEM PKCS#10>",
"profile": "intermediate",
"pub": "<one-time X25519 public key>",
"context": { "service": "ianitor", "host": "<server name>", "request_id": "<Ianitor pki request id>",
"csr_sha256": "<hex>" } }
Answer (sealed, handed out once): { "ok": true, "certificate": "<PEM>", "sha256": "<hex of the DER>" }
or { "ok": false, "error": "refused | expired | out_of_scope | invalid | no_key | denied | locked" }.
Custos must not copy the CSR's extensions. It builds the certificate itself from the
intermediate profile and takes only the subject public key and the subject CN from the CSR:
| Field | Value |
|---|---|
| Subject | CN=<CN from the CSR>; refused unless the CN starts with Ianitor Domi Intermediate |
| Validity | now − 5 min to now + 365 days, never past the root's notAfter |
| basicConstraints | critical, CA:TRUE, pathLenConstraint 0 |
| keyUsage | critical, keyCertSign, cRLSign, digitalSignature |
| Serial | 16 random bytes |
| Signature | ECDSA P-256 / SHA-256 |
It verifies the CSR's own signature (proof of possession) and refuses anything else
(invalid).
3. The approval card
Same flow as release signing (docs/12_hands_off.md §7): a card on the PC, a push to paired
phones, approve with Face ID; 10 minutes, then expired. The card shows:
- "Ianitor on asks for a new Domi intermediate certificate, valid until ."
- The match code: Ianitor's own code, so Mark compares one number on two screens. It is
computed on both sides from the CSR, not from the one-time key:
SHA-256(CSR DER), first 3 bytes, each byte mod 100, as three two-digit groups (47 19 83). Ianitor shows it in the UI banner; Custos shows it on the card. (Custos's usualmatch_code(pub)would also work if Ianitor showed that one instead; either is fine, but it must be one code, the same on both screens.) - Test keys may auto-approve as today;
domi-pki-rootalways asks.
4. Optional, later: device certificates
ROADMAP §4 also says "Device cert: … Issue (approve in Custos)". The device certificate is
signed on the server with the intermediate, so Custos only has to approve, not sign:
a kind approval request with context.kind = "domi_device_cert", name, match_code,
answered with the existing signed approval JSON (domi-approve), which Ianitor verifies
against the domi-approve public key before issuing. No new crypto in Custos.
Done when
custos-sign csr --key domi-pki-root --profile intermediate --csr req.pem(and the mailbox equivalent) returns a certificate thatopenssl verify -CAfile root.pemaccepts, withpathlen:0, after a match-code approval on the phone.- A CSR with another CN, a bad signature or a request for a CA without pathLen 0 is refused.
- An
x509_csrrequest against any other key isout_of_scope.