Security model
fail-closed by construction: transport encryption → authentication → authorization → rate limiting → audit. Nothing in the default configuration is left open.
Threat model, in one paragraph
(a) Anonymous probers get /healthz and 401s — with a tight per-IP sliding window so port scans can't fan out. (b) Limited key holders get exactly their role; viewers read, operators produce/consume, federation peers call only federation RPCs. (c) A compromised cluster node can't reach mesh RPCs without a cluster-CA cert, and its keys aren't admin. (d) OS-root insiders are out of scope (the audit log is append-only for external callers, not tamper-evident to root). Encryption at rest: opt-in AES-256-GCM per segment frame via -encryption-key-file (ADR-021; key loss = data loss). Not defended: FIPS-validated modules, KMS/HSM envelope encryption, automated rotation — files are 0600 under a 0700 dir.
Layer 1 — transport encryption
- Client surface (HTTP admin, client gRPC): optional TLS; enable with
-tls-cert/-tls-key(one cert, both listeners, min TLS 1.2, SANs must cover dial targets). No client certs — bearer keys authenticate instead. - Mesh surface (Replica/Quorum/Federation): mutual TLS, mandatory. Dedicated listener on
grpc+10; node certs issued from a cluster CA at first start; peers verify each other against the expected node ID. No flag disables it. - The client and mesh planes are independent — you can leave client TLS off inside a trusted segment while mesh mTLS still binds all node-to-node traffic.
Layer 2 — authentication & authorization
API keys are bearer tokens, SHA-256-hashed at rest in __api_keys, shown once at mint, revocable. Roles compose additively: viewer operator admin federation (federation keys open only FederationService — nothing else, not even admin reads).
| Surface | Before any handler runs | Refused caller sees |
|---|---|---|
| HTTP | Hardening middleware (CSP, frame-ancestors 'none', no-store) → bearer verify → role check → rate limit → CIDR allowlist | 401 / 403 |
| gRPC | logging → bearer verify → per-RPC role table → rate limit → CIDR | UNAUTHENTICATED / PERMISSION_DENIED / RESOURCE_EXHAUSTED |
| Mesh | TLS itself — client cert signed by the cluster CA | handshake failure |
/healthz | nothing | always 200 |
Layer 3 — rate limits, allowlists, audit, filesystem
- Per-key token bucket (
-rate, 100 ops/s default) at both edges. - Per-IP sliding window (
-anon-rate, 20/min default) for anonymous traffic — probes and refusals alike. - Per-key CIDR allowlists at mint; mismatch ⇒ 403 + audit entry
authz-refused:ip-not-allowed. - Dir mode check:
-dir-mode-check(default on) refuses startup over loose permissions. - Audit: every admin mutation + refusal, every mode, append-only, bounded by
-audit-max-bytes(default 64 MiB/process), rotation operator-driven.
Bootstrap & secret handling
sequenceDiagram
participant Op as Operator
participant F as firnd (first boot)
Op->>F: fresh install, zero keys
F-->>Op: stderr prints BOOTSTRAP TOKEN once
Op->>F: POST /apikeys with Bearer token, body name root role admin
F-->>Op: 201 plus plaintext key (shown once, never stored)
Note over Op,F: token is void from the next request onward
- Federation keys are created on the serving cluster, pasted out-of-band into the peer — material never crosses a wire and never lives on disk anywhere hostile.
- Node certs come from a CA that never leaves operator custody; nodes get certs, never the CA key.
firn-clireads keys from-api-key/FIRN_API_KEYonly — never config files, never echoed.
Artifact trust (supply chain)
# integrity + provenance for any release tarball gh release download v0.6.0 --repo rahulkj/firn --pattern 'firn-v0.6.0-linux-amd64.tar.gz' --pattern 'SHA256SUMS' shasum -a 256 -c SHA256SUMS gh attestation verify firn-v0.6.0-linux-amd64.tar.gz --repo rahulkj/firn # every release additionally ships: sbom.spdx.json (anchore) + provenance.sigstore.jsonl (offline bundle) # CI gates: golangci-lint, go test, distribution job with grype fail-on-critical
Honest limits
- Audit on non-holder nodes: mutations that need no internal write (topic creates via quorum, authz refusals) are not audited remotely — they log to stderr. Run admin traffic through the holder, or scrape every node.
- Encryption at rest is opt-in (
-encryption-key-file, ADR-021); no FIPS, no KMS/HSM envelope encryption, no external audit — see ADR-011/ADR-021 non-goals. - Security review of this codebase by an external party: none yet. The threat model is documented for your review; the storage code path specifically demands human eyes before production use.