[docs] Bootstrap: merge docs/bootstrap (PR #1)
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# CLAUDE.md — Ianitor Domi
|
||||
|
||||
Ianitor is a reverse proxy built on Cloudflare's Pingora, with a small Domi CA, a web UI and an API.
|
||||
NixOS-native, with Caddy as a tested fallback. MPL-2.0. Plan, decisions and status: docs/ROADMAP.md — read it first.
|
||||
|
||||
## Layout
|
||||
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA. Pure: no I/O, no network.
|
||||
crates/edge Pingora data plane. Reads compiled config, serves traffic. Never decides policy.
|
||||
crates/control API, git routes repo, apply/rollback, share links, PKI flows. Loopback only. Never serves public traffic.
|
||||
apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic.
|
||||
packages/ui shared dark Domi theme.
|
||||
tests/diff same requests against Ianitor and Caddy, responses compared.
|
||||
tests/fuzz cargo-fuzz targets.
|
||||
deploy/nixos NixOS module + VM tests.
|
||||
|
||||
## Commands
|
||||
cargo test --workspace # quote test counts per crate; an exit code alone is not green
|
||||
cargo run -p ianitor-control -- --dev
|
||||
pnpm --filter web dev # 127.0.0.1 only, never --host
|
||||
nix build .#ianitor
|
||||
nix flake check # includes NixOS VM tests (Linux + KVM)
|
||||
|
||||
## Rules
|
||||
- Commits: `[<crate|app>] <Feature>: <one line>`. No AI attribution, no trailers, ever.
|
||||
- Never in git: target/, node_modules/, dist/, binaries, private keys, files over 5 MB. A pre-commit hook enforces it.
|
||||
- $GITEA_TOKEN never echoed or written anywhere. Secrets come only from Custos or systemd credentials, never the Nix store.
|
||||
- ianitor-control and every dev server listen on 127.0.0.1 only; only ianitor-edge binds public ports.
|
||||
- Route files, API bodies, CSRs, headers and share tokens are hostile input: typed Result, no unwrap() on input paths, no swallowed errors.
|
||||
- Every route change goes through the core compiler and the differential tests.
|
||||
- Tests first only where the risk is: parsing, CA, share tokens, forward-auth, apply/rollback, secret injection.
|
||||
- Workflow: branch → Gitea PR via API → short adversarial self-review in the PR body → merge --no-ff → push → verify hashes.
|
||||
- Server changes: prepare the Nix change and show the command; Mark runs nixos-rebuild himself. deploy/test-access.sh must pass.
|
||||
- When reporting done, say which build is deployed and whether it changed visibly.
|
||||
- UI: dark Domi theme, every action ≤ 3 clicks, plain English; Latin only in the brand name.
|
||||
|
||||
## Session end
|
||||
Update the Status table and the Handover section at the bottom of docs/ROADMAP.md. No separate handover file.
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
# Ianitor Domi — roadmap
|
||||
|
||||
*Ianitor* = the doorkeeper: it decides who comes through the door (routing, TLS) and checks credentials (certificates).
|
||||
Legend: [S] sourced · [J] judgment · [M] decided by Mark.
|
||||
|
||||
## 1. Decisions (do not reopen without Mark)
|
||||
1. Scope: internal Domi CA for home-server services and mTLS between Domi apps/devices. Public sites stay on Let's Encrypt. [M]
|
||||
2. Root key offline in Custos; intermediate on the server, renewed yearly through a Custos match-code approval. [M]
|
||||
3. Own proxy on Pingora (Rust, Apache 2.0; HTTP/1, HTTP/2, gRPC, websockets; a library, not a binary). [M] [S blog.cloudflare.com/pingora-open-source]
|
||||
4. Caddy is the fallback: one config model compiled to the Pingora runtime and to Caddy JSON, kept honest by differential tests on every build. [M]
|
||||
5. Web UI only, on the server behind Authelia. API tokens are saved by Mark in Custos; control stores only hashes. [M]
|
||||
6. Routes live in a git repo (private: ianitor-routes), one TOML file per host, schema-validated. Every change is a commit, applied live without nixos-rebuild. Rebuild only for service-level changes (engine, ports, version). [M]
|
||||
7. Two processes: ianitor-edge (data plane) and ianitor-control (API + UI). Traffic keeps flowing if control crashes. [M]
|
||||
8. Own small CA in crates/core using rcgen. No internal ACME server in v1. [M]
|
||||
9. One public MPL-2.0 monorepo on Gitea; read-only GitHub mirror for discovery. Mark's server deployment stays in his NixOS flake. [M]
|
||||
10. Branding: "Ianitor Domi", with "Built, tested and signed by Fabrica Domi" on the repo and release page. [M]
|
||||
11. Support: free source; "Adopt a red panda" — 80% developer, 20% Red Panda Network, remitted yearly with a published receipt. [M]
|
||||
12. Cut-over: only after all five test layers are green and two weeks beside Caddy on low-risk hosts. [M]
|
||||
13. Competitor to watch: Pangolin (tunnelled identity-aware reverse proxy). Our edge: Nix-native history, Domi PKI, friend nodes. [S github.com/fosrl/pangolin] [J]
|
||||
|
||||
## 2. Versions and gates
|
||||
| Version | Contents | Gate question |
|
||||
|:--|:--|:--|
|
||||
| v1 (phases 1–4) | engine, both compilers, control plane, web UI, PKI, NixOS module, five test layers, signed release | Does Ianitor serve two low-risk hosts beside Caddy for two weeks with zero incidents and the differential tests green? |
|
||||
| v1.1 | all hosts on Ianitor; monthly rehearsed switch to Caddy and back | Are all hosts on Ianitor, with the Caddy switch rehearsed monthly? |
|
||||
| v2 | identity gate (passkey/TOTP) replacing Authelia, tunnel via friend node/VPS, one-click Domi templates | Can a family member reach a home service from outside with no open port and no Authelia? |
|
||||
|
||||
## 3. Architecture
|
||||
- Host file fields (v1): hostname, upstreams[], tls = letsencrypt | domi, auth = none | forward-auth,
|
||||
request/response header rules (set/remove; values may reference a named secret), websockets,
|
||||
health check path + interval, share links enabled, access log = off | truncated.
|
||||
- Edge: TLS termination with SNI per host, Let's Encrypt via an ACME crate, upstream health checks, websockets,
|
||||
header rules, forward-auth compatible with Authelia (existing protected services must keep working),
|
||||
graceful reload without dropping connections.
|
||||
- Secrets referenced by header rules load from $CREDENTIALS_DIRECTORY and never appear in logs or responses.
|
||||
- Logging: error log always; access log only per host when enabled, IPv4 truncated to /24, IPv6 to /48, local file only.
|
||||
- Apply: validate → compile → write edge config + Caddy JSON → reload edge → watch health checks 60 s →
|
||||
on failure git-revert, reload, report "reverted" with the reason; otherwise "kept". Concurrent applies are serialised.
|
||||
Undo = revert the last kept commit through the same path. Restore = apply an older tree as a new commit. Push to Gitea after a kept apply.
|
||||
- Share links: HMAC token bound to host + path prefix + expiry (+ optional password hash), validated statelessly by edge;
|
||||
key from systemd credentials; revocation by key rotation or a small deny list.
|
||||
- API: REST + JSON on loopback, OpenAPI generated from code.
|
||||
- CA: root created offline, ~10 years, pathLenConstraint ≥ 1, never on the server. Intermediate ~1 year, key encrypted on the server,
|
||||
password via systemd credentials. Leaf and device mTLS certs issued by control (lifetimes decided and justified in phase 3).
|
||||
Intermediate renewal: control makes a CSR; Custos signs with the root after a match-code approval.
|
||||
- Engine switch: the NixOS module defines ianitor-edge and caddy-fallback (reads the generated Caddy JSON); only one runs;
|
||||
an engine-select unit starts the chosen one at boot from /var/lib/ianitor/engine; control may start/stop only these two
|
||||
units through a polkit rule scoped to exactly them.
|
||||
- NixOS module: services.ianitor.*; everything on loopback except edge; LoadCredential for secrets, asserted not to be store paths.
|
||||
|
||||
## 4. UI (count clicks in every smoke test)
|
||||
Main screen: host list with health dots, engine chip, intermediate-expiry banner, last-apply bar with Undo.
|
||||
| Flow | Clicks |
|
||||
|:--|:--|
|
||||
| Add host: + Host → fill → Apply (auto-kept or auto-reverted) | 2 |
|
||||
| Undo last change | 1 |
|
||||
| Restore: History → pick → Restore | 3 |
|
||||
| Share link: ⋯ → Share → Copy (default expiry 7 d) | 3 |
|
||||
| Switch engine: engine chip → Switch to Caddy | 2 |
|
||||
| Device cert: Certs → + Device → Issue (approve in Custos) | 3 |
|
||||
| Renew intermediate: banner Renew (approve in Custos) | 1 |
|
||||
| API token: ⚙ → API → New token | 3 |
|
||||
|
||||
## 5. Test layers (all run in an Artifex pipeline by phase 4)
|
||||
1. Differential: the same request corpus against Ianitor and Caddy; status, selected headers and body compared.
|
||||
2. Protocol conformance: h2spec, testssl.sh.
|
||||
3. Fuzzing: cargo-fuzz on config parsing, header rules, share tokens; any crash fails the pipeline.
|
||||
4. NixOS VM tests: failed apply auto-reverts; switch to Caddy and back keeps a host reachable; intermediate renewal with a test root; control unreachable from outside loopback.
|
||||
5. Load and soak against Caddy, reproducible from a script; results committed as data, published honestly including where Caddy wins.
|
||||
|
||||
## 6. Phases
|
||||
### Phase 1 — Core and engine
|
||||
Goal: Pingora proxy serving hosts from the validated model; same model compiled to Caddy JSON; differential harness proving parity.
|
||||
First: .gitignore and a pre-commit hook (rejects binaries, private keys, files > 5 MB). Placeholders only for control/web.
|
||||
Tests first: schema rejects unknown fields, missing/duplicate hostnames, bad upstream URLs, undefined secret references;
|
||||
both compilers deterministic (byte-identical output); an injected secret never appears in a response or log;
|
||||
a forward-auth denial never reaches the upstream; the diff harness (≥ 20 seed requests: plain, headers, websocket upgrade,
|
||||
upstream down, auth denied) catches a deliberately broken compiler once.
|
||||
Done: proxies two local test upstreams with Let's Encrypt staging and with a self-signed test cert; diff suite green.
|
||||
|
||||
### Phase 2 — Control plane
|
||||
Goal: ianitor-control edits route files in the git repo, applies with automatic rollback, manages share links and API tokens.
|
||||
Tests first: failed health check reverts the commit and restores the previous edge config; a control crash mid-apply leaves edge
|
||||
on the last good config; share token rejected when expired, wrong path, wrong host, tampered or missing password;
|
||||
requests without a valid token rejected and tokens never logged; concurrent applies serialised.
|
||||
Done: add host, undo, restore and share link work end to end via the API on loopback; curl examples in docs/api.md;
|
||||
diff suite green after every apply.
|
||||
|
||||
### Phase 3 — Web UI, PKI, NixOS
|
||||
Goal: the UI from section 4, the CA flows, the NixOS module with VM tests; Ianitor runs beside Caddy on two low-risk hosts.
|
||||
Tests first: issued chains validate to the root; a leaf cannot sign; expired and wrong-name certs rejected; no root key file
|
||||
in the state dir; a Domi device cert is accepted for mTLS while a self-signed cert with the same subject is rejected;
|
||||
VM tests from section 5 layer 4.
|
||||
If Custos has no CSR-signing operation with match-code approval: stop that part, write the needed operation as a Custos ticket,
|
||||
and document a temporary manual offline signing step.
|
||||
Done: smoke test of every UI flow with clicks counted; VM tests green; Mark has run nixos-rebuild; deploy/test-access.sh passes.
|
||||
|
||||
### Phase 4 — Hardening and release
|
||||
Goal: all five test layers in an Artifex pipeline (strict Fabrica YAML); verifiable Nix build; artefacts signed via Custos,
|
||||
published as Gitea release assets, sha256-pinned; GitHub push mirror.
|
||||
Deliverables: README (what, why Pingora, honest benchmarks, the Caddy fallback, the Fabrica badge, support section);
|
||||
docs/support.md (the red panda model); launch post drafts in docs/launch/ only. Release notes live on the Gitea release.
|
||||
Done: pipeline green; signed v1.0.0 on Gitea; mirror visible on GitHub; the two-week run beside Caddy starts.
|
||||
|
||||
## 7. Out of scope for v1
|
||||
Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sites away from Caddy before the cut-over gate.
|
||||
|
||||
## 8. Open points (resolve at the start of the phase that needs them; record the answer here)
|
||||
1. Pingora TLS backend: rustls vs BoringSSL/OpenSSL — maturity and NixOS packaging. (phase 1)
|
||||
2. Rust ACME crate for Let's Encrypt — maintenance status; pick and justify. (phase 1)
|
||||
3. Does Pingora build on Windows? If not, develop in WSL2 and note it in CLAUDE.md. (phase 1)
|
||||
4. Pingora graceful reload behaviour under load. (phase 2)
|
||||
5. Authelia forward-auth endpoint and headers to mirror exactly. (phase 1)
|
||||
6. Custos CSR-signing operation with match-code approval. (phase 3)
|
||||
7. Red Panda Network donation route for a non-US individual and the receipt they issue. (phase 4, Mark)
|
||||
|
||||
## 9. Status
|
||||
| Phase | State | Notes |
|
||||
|:--|:--|:--|
|
||||
| 1 Core and engine | Not started | |
|
||||
| 2 Control plane | Not started | |
|
||||
| 3 Web UI, PKI, NixOS | Not started | |
|
||||
| 4 Hardening and release | Not started | |
|
||||
|
||||
## 10. Handover
|
||||
(Rewritten at the end of every session: what changed, what was not verified, which build is deployed, the next step.)
|
||||
Reference in New Issue
Block a user