docs: add the SSH Certificate Flow as its own contract, not folded into #1
Vault's ssh-client-signer mount was undocumented here entirely. Adds it as flow 2/5 rather than merging into Certificate Flow, since the actual mechanism differs (own systemd timer, bypasses Vault Agent's render cycle, only reuses its cached token) - and explains why that distinction matters for debugging. Diagram updated to match: a third data-plane box feeding fleet-wide sshd trust instead of a container.
This commit is contained in:
2 files changed
+34
-8
No files matched your search
@@ -1,13 +1,16 @@
|
||||
# 🔑 Secret Distribution Model
|
||||
|
||||
> [!NOTE]
|
||||
> [`docs/secrets-and-pki.md`](secrets-and-pki.md) covers *what* Vault is and *why* it exists. This doc covers something different and, arguably, harder to get right: the actual contract for how a secret value moves from being written into Vault to being consumed by a running container — and why that contract is deliberately split into four separate flows instead of one universal one.
|
||||
> [`docs/secrets-and-pki.md`](secrets-and-pki.md) covers *what* Vault is and *why* it exists. This doc covers something different and, arguably, harder to get right: the actual contract for how a secret value moves from being written into Vault to being consumed by a running container — and why that contract is deliberately split into five separate flows instead of one universal one.
|
||||
|
||||

|
||||

|
||||
|
||||
## Why Four Flows Instead Of One
|
||||
## Why Five Flows Instead Of One
|
||||
|
||||
The obvious simpler design is one universal "secret goes in, secret comes out" pipeline. It was rejected because the four things being moved genuinely have different risk profiles and different failure tolerances: a certificate expiring is a slow-building problem measured in days; a missing application secret is often an immediate outage; a broken config-distribution push can silently stop *all* of a host's secrets from updating, not just one. Treating them identically would mean either over-engineering the simple cases or under-protecting the risky one. Four flows, each with its own explicit Law/Flow/Failure-behavior contract, is more code to maintain but far easier to reason about when something breaks — anyone debugging an incident knows immediately which contract governs the thing that's wrong.
|
||||
The obvious simpler design is one universal "secret goes in, secret comes out" pipeline. It was rejected because the five things being moved genuinely have different risk profiles and different failure tolerances: a certificate expiring is a slow-building problem measured in days; a missing application secret is often an immediate outage; a broken config-distribution push can silently stop *all* of a host's secrets from updating, not just one; losing the ability to refresh an SSH certificate doesn't break anything immediately, but eventually locks the automation identity out of the fleet entirely. Treating them identically would mean either over-engineering the simple cases or under-protecting the risky ones. Five flows, each with its own explicit Law/Flow/Failure-behavior contract, is more code to maintain but far easier to reason about when something breaks — anyone debugging an incident knows immediately which contract governs the thing that's wrong.
|
||||
|
||||
> [!NOTE]
|
||||
> **Why the SSH Certificate Flow isn't just folded into Certificate Flow** — both issue short-lived Vault-signed credentials, so treating them as one flow looks tempting. They're kept separate because the actual mechanism is genuinely different, not just the credential type: Certificate Flow is triggered and rendered by Vault Agent itself, on Vault Agent's own schedule. The SSH Certificate Flow runs on its own independent systemd timer, calls Vault directly, and only *reuses* Vault Agent's already-authenticated token as a convenience — Vault Agent never renders it and doesn't know it exists. Collapsing them into one contract would hide that difference from exactly the person who needs it most: whoever is debugging why an SSH certificate didn't refresh, who needs to know immediately that the answer isn't "check Vault Agent's logs."
|
||||
|
||||
## 1️⃣ Certificate Flow
|
||||
|
||||
@@ -19,7 +22,30 @@ The obvious simpler design is one universal "secret goes in, secret comes out" p
|
||||
|
||||
**Invariants:** certificates are short-lived and re-issued on Vault Agent's own schedule, never on-demand by the consumer. A host only ever receives certs tagged for its own identity. The private key never traverses the network after issuance.
|
||||
|
||||
## 2️⃣ Application Secret Flow
|
||||
## 2️⃣ SSH Certificate Flow
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **Law** | The automation identity never holds a static, standing-access SSH key. Only a Vault-signed certificate, valid for hours, ever grants it access to a fleet host. |
|
||||
| **Flow** | Its own systemd timer (2h interval) → reuses Vault Agent's already-authenticated token → `vault write ssh-client-signer/sign/sign-ansible` → certificate installed next to the identity's own key on the one host that needs it → every fleet host's sshd trusts the CA directly, no per-host secret involved |
|
||||
| **Failure behavior** | A single missed refresh is harmless — the timer fires every 2 hours against a 6-hour certificate, so there's hours of margin. A sustained outage spanning several missed cycles eventually locks the automation identity out of certificate-based SSH entirely, with no static key to fall back to — an accepted tradeoff, not an oversight (see [`docs/secrets-and-pki.md`](secrets-and-pki.md)) |
|
||||
|
||||
This is the real signed certificate, not a description of one — installed and ready to use, principal and validity window both visible:
|
||||
|
||||
```
|
||||
$ ssh-keygen -Lf /home/ansible/.ssh/auto-cert.pub
|
||||
Type: [email protected] user certificate
|
||||
Signing CA: RSA SHA256:vcGM3I3hc5AYm9ji1lXYBx1yhVuxR3Gj/3CFdRRkjOo (using rsa-sha2-512)
|
||||
Valid: from 2026-09-05T08:55:53 to 2026-09-05T14:56:23
|
||||
Principals:
|
||||
ansible
|
||||
Extensions:
|
||||
permit-port-forwarding
|
||||
```
|
||||
|
||||
**Invariants:** exactly one identity (`ansible`) is ever signed for. Vault's role config enforces this independently of the script that calls it — a compromised or buggy script still can't get a certificate for any other principal. Every host trusts the CA's public key directly; none of them store the automation identity's actual key material at all.
|
||||
|
||||
## 3️⃣ Application Secret Flow
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
@@ -30,7 +56,7 @@ The obvious simpler design is one universal "secret goes in, secret comes out" p
|
||||
> [!WARNING]
|
||||
> The rendered file is owned entirely by Vault Agent. Hand-editing it gets silently overwritten on the next render cycle — and hides the actual source of truth from whoever edited it. This is the single most common way this model gets violated by accident: someone SSHes in to fix a value under time pressure, and the fix silently disappears on the next render.
|
||||
|
||||
## 3️⃣ Configuration Distribution Flow
|
||||
## 4️⃣ Configuration Distribution Flow
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
@@ -55,7 +81,7 @@ $ grep -A4 "service: automation" vault_agent/defaults/main.yml
|
||||
reload_command: "chmod 600 .../registry-token/registry-token"
|
||||
```
|
||||
|
||||
## 4️⃣ Administrative Secret Flow — a deliberately separate, simpler system
|
||||
## 5️⃣ Administrative Secret Flow — a deliberately separate, simpler system
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
|
||||
Reference in new issue
Block a user