diff --git a/README.md b/README.md new file mode 100644 index 0000000..b901f14 --- /dev/null +++ b/README.md @@ -0,0 +1,93 @@ +# Ianitor Domi + +[![Built, tested and signed by Fabrica Domi](docs/fabrica-badge.svg)](docs/verify.md) + +*Ianitor* is Latin for the doorkeeper: it decides who comes through the door (routing, TLS) and checks +credentials (certificates). Ianitor Domi is a reverse proxy for a home server, built on Cloudflare's +[Pingora](https://github.com/cloudflare/pingora), with a small certificate authority for your own devices, a web +UI, an API, and a NixOS module. MPL-2.0. + +- **Routes in git.** One TOML file per host in a repository (`hosts/wiki.example.toml`), schema-checked. Every + change is a commit, applied live without `nixos-rebuild`, watched for 60 seconds, and reverted by itself if the + host stops answering. Undo is one click; any older state can be restored. +- **Two processes.** `ianitor-edge` serves traffic and decides nothing; `ianitor-control` (API and UI, loopback + and Unix sockets only) edits the routes and tells edge what to serve. Traffic keeps flowing when control stops. +- **TLS your way.** Let's Encrypt for public names; for everything internal, the Domi CA: the root stays offline, + the intermediate on the server is renewed yearly, device certificates enable mTLS for a host. +- **What a home server needs, and no more.** Forward-auth to Authelia (existing protected services keep working), + header rules whose values can be systemd credentials (never written anywhere), websockets, health checks, + share links (an expiring, optionally password-protected link to one path), a truncated, opt-in visit log. +- **Caddy as the fallback.** The same route model compiles to Caddy JSON too, and one click switches engines at + runtime. Differential tests send the same requests to both on every build, so the fallback stays honest. + +It is one person's project for one home network, published because the approach may be useful to others. It is +not a general-purpose proxy: no HTTP/3, no load-balancing policies beyond round robin over healthy upstreams, no +plugin system. Status, decisions and what is not done: [docs/ROADMAP.md](docs/ROADMAP.md). + +## Why Pingora + +Pingora is a library, not a server: Ianitor owns the request path (host lookup, forward-auth, share links, +header rules, upstream choice) in plain Rust, and gets HTTP/1, HTTP/2, websockets, TLS (rustls) and connection +pooling from code that serves a large share of the web at Cloudflare. A memory-safe data plane with no config +language between the routes and the code was the point; speed was not, and the numbers below say so. + +Caddy is excellent, and Ianitor keeps it as the fallback engine. What Ianitor adds on top is the workflow: routes +as reviewed commits with automatic rollback, a CA for the house, and a UI where every common action takes at most +three clicks. + +## Benchmarks (honest ones) + +Load and soak runs against Caddy 2 on the same machine, the same route and the same upstream +(`scripts/bench.sh`, ROADMAP §5 layer 5). Results are committed as data in [bench/](bench/), with the machine +described beside them; [bench/README.md](bench/README.md) summarises them, including where Caddy wins. Two caveats +apply to every number there: the load generator, the proxies and the upstream share one machine, and edge runs +Pingora with two worker threads (a home server's budget), so Caddy is also measured with `GOMAXPROCS=2`. + +## Install (NixOS) + +```nix +# flake.nix +inputs.ianitor.url = "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git"; +# configuration +imports = [ inputs.ianitor.nixosModules.ianitor ]; +services.ianitor = { + enable = true; + edge.openFirewall = true; + shareLinkKeyFile = "/run/secrets/ianitor-share-link-key"; # never a store path; the module refuses one +}; +``` + +Then `ianitor-control token create --name laptop --config /etc/ianitor/control.toml` for the API, or the web UI +behind Authelia ([docs/api.md](docs/api.md), "Sign-in"). Beside an existing Caddy, edge can sit behind it on a Unix +socket: [docs/deploy/beside-caddy.md](docs/deploy/beside-caddy.md). The CA: [docs/pki.md](docs/pki.md). + +## Tests + +Five layers (ROADMAP §5), all in the `layers` pipeline (`.fabrica/artifex/layers.yaml`): + +| Layer | What | Run it | +| :-- | :-- | :-- | +| 1 Differential | the same request corpus against Ianitor and Caddy, answers compared | `cargo test -p ianitor-diff` | +| 2 Conformance | h2spec and testssl.sh against both engines | `scripts/conformance.sh` | +| 3 Fuzzing | route files, header rules, share tokens, share-link paths, the CA's PEM and CSR parsing | `tests/fuzz/run.sh` | +| 4 NixOS VM tests | rollback, engine switch, CA renewal, loopback-only control, the sockets | `nix flake check` (KVM) | +| 5 Load and soak | against Caddy, results kept as data | `scripts/bench.sh` | + +`cargo test --workspace` runs the unit, integration and layer 1 tests; most of them need Linux (Pingora's Windows +support is best effort), Caddy and Pebble on PATH: `nix develop .#ci`. + +## Releases and verification + +A release is a signed manifest, not a binary: `SHA256SUMS` signed by `domi-release` (through Custos) over the +release notes, screenshots of the UI and `ianitor-nix.json`, the NAR hashes of the Nix build at the tagged commit. +The build is reproducible, so anyone can rebuild the tag and compare: [docs/verify.md](docs/verify.md). + +## Support + +The source is free. If Ianitor is useful to you, you can **adopt a red panda**: support the project, and a fifth of +everything it receives goes to the [Red Panda Network](https://redpandanetwork.org), remitted once a year with the +receipt published. How it works and where it stands: [docs/support.md](docs/support.md). + +## Licence + +[MPL-2.0](LICENSE). Pingora is Apache-2.0; Caddy, used only as a separate fallback process, Apache-2.0. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 86972e6..b758381 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -138,6 +138,25 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit 6. Custos CSR-signing operation with match-code approval. (phase 3) **Answer: Custos has none (desktop 0.8.0, CustosPublic v0.13.0).** Its `sign` op signs only minisign, SHA256SUMS manifests, Authenticode digests and deploy approvals, refuses any request against `domi-root` (the RSA-3072 Authenticode root), and no path takes a CSR. Its server reach is the factor-service sign mailbox (`POST /api/sign/requests`, Bearer sign token, answers sealed to a one-time X25519 key, 5-minute match-code card on the PC with a push to the phone). So, per §6: the operation is written as a ticket, [custos-ticket.md](custos-ticket.md) (a new key `domi-pki-root`, ECDSA P-256; a sign kind `x509_csr` through the same mailbox that builds the intermediate from a fixed profile and takes only the CSR's key and CN; the match code computed from the CSR on both screens), not filed. Until then the intermediate is signed **by hand on the offline machine with openssl** ([pki.md](pki.md); Mark accepted it as a §4 exception, 2026-11-07) and device certificates are approved on the server with `sudo -u ianitor-control ianitor-control pki approve ` (Q5). API tokens: Custos stores them as "Local app credential" items with a `domi-ref`; the intended import is Provisio's `offer` (the server seals the value to the PC's key and Mark accepts a match-code card), or copy and paste in the item editor. [S Custos docs/09_signing.md, 07_domi_identity.md, 10_provisio.md, apps/desktop/src-tauri/src/signing.rs] Configuration_Server findings (domains, Caddy, sops-nix secrets, the two trial hosts): [deploy/beside-caddy.md](deploy/beside-caddy.md). **Mark, 2026-11-08:** production runs Authelia, configured outside Configuration_Server, so forward-auth stays (the admin UI host must be behind it; control refuses the ui-proof header on any other host); the trial hosts flowers.stage and esp32.stage on the hyperv-infra mirror are confirmed; and changes keep working while Caddy serves (applies, Undo and Restore are loaded into Caddy through its admin socket, watched through Caddy and reverted by reloading the previous caddy.json; only share links are off). 7. Red Panda Network donation route for a non-US individual and the receipt they issue. (phase 4, Mark) + **Proposed answer, pending Mark's confirmation (2026-11-10):** once a year, a one-time gift in USD through RPN's + online donation form, by card, as an individual; RPN's online gifts come with a receipt "for your records" by + e-mail, naming RPN as a US 501(c)(3) (EIN 26-1103671). For a larger sum, RPN's 2024 sponsorship sheet also names + bank transfer and check; the transfer details are not on the website and come from the US office + (info@redpandanetwork.org, +1 503 662 8130; mail: 5 Centerpointe Drive, Suite 400, PMB16970706, Lake Oswego, + OR 97035; an older address in Eugene, OR still appears on the planned-giving page). Nothing on the site addresses + donors outside the US: no other currency, no non-US receipt. The receipt is a US tax document; for a Czech donor a + gift to a charity seated outside the EU/EEA is, as far as found, not deductible under §15 of the Czech income + tax act (not confirmed by a source that says so directly; ask the tax office if it matters). RPN's crypto route + via Every.org could not be checked (Every.org answered 429), and one third-party listing says Every.org does not + take gifts for RPN now. Publishing: the e-mailed receipt, personal data blacked out, under + docs/support/receipts/ with a line in docs/support.md. Also found: RPN runs its own "Adopt a red panda" + programme (from USD 60, certificate by e-mail, receipt issued); docs/support.md says the project's model is not + that programme. Before the first remittance, Mark should e-mail info@redpandanetwork.org to confirm that a + receipt is issued to a non-US individual and ask for transfer details. [S redpandanetwork.org/donate, + /adopt, /contact-us, /sample-language-for-your-will-or-trust; RPN_Partnership-Sponsorship_Features_and_Benefits_2024 + (redpandanetwork.org/files/galleries, as quoted by search; the PDF's text could not be extracted here); + gofundme.com/charity/red-panda-network (501(c)(3), EIN); a 2017 RPN e-mail receipt via Classy (receipt number, + amount, date, tax line); finance.cz and vskp.vse.cz on Czech gift deductions] [J] ## 9. Status | Phase | State | Notes | diff --git a/docs/fabrica-badge.svg b/docs/fabrica-badge.svg new file mode 100644 index 0000000..5278a7f --- /dev/null +++ b/docs/fabrica-badge.svg @@ -0,0 +1,10 @@ + + Built, tested and signed by Fabrica Domi + + + + + Fabrica + built, tested and signed by Fabrica Domi + + diff --git a/docs/support.md b/docs/support.md new file mode 100644 index 0000000..8242ee3 --- /dev/null +++ b/docs/support.md @@ -0,0 +1,48 @@ +# Support: adopt a red panda + +Ianitor's source is free (MPL-2.0) and stays free. If it is useful to you and you want to give something back, +the model is the one decided at the start (ROADMAP §1.11): + +- **80%** of what the project receives goes to its developer, for the time Ianitor takes. +- **20%** goes to the [Red Panda Network](https://redpandanetwork.org) (RPN), a conservation charity working in + Nepal's eastern Himalaya, where red pandas live, with community forest guardians, habitat restoration and research. +- **Once a year** the red-panda share is remitted in one payment, and RPN's receipt is **published** (below), so you + can check that it happened and for how much. + +Nothing in Ianitor is locked behind support. + +> **Not to be confused with RPN's own adoption programme.** RPN runs a programme of the same name +> ([redpandanetwork.org/adopt](https://redpandanetwork.org/adopt), from USD 60, a certificate and a gift by email). +> Supporting Ianitor does not make you an RPN adopter and you get nothing from RPN; if you want that, adopt a panda +> there directly. Here, "adopt a red panda" is only the name of this project's support model. + +## Status: the route to RPN is pending + +**How the yearly 20% reaches RPN is proposed, not yet confirmed by Mark** (ROADMAP §8.7). Until it is, this page +promises the split and the published receipt, but not the payment channel. The proposal: + +1. Once a year (the first working week of January), Mark adds up what the project received in the previous calendar + year and takes 20% of it, converted to US dollars at the payment's own rate. +2. He pays it as a **one-time donation through RPN's online donation form** (card, in USD), as an individual donor. + RPN's online gifts and adoptions come with a **receipt for the donor's records**, by email, naming RPN as a US + 501(c)(3) charity (EIN 26-1103671). For a larger sum, RPN's sponsorship material also mentions **bank transfer**; + the details are asked from RPN's US office (info@redpandanetwork.org), as they are not on the website. +3. The receipt is published in `docs/support/receipts/` as `.pdf` (or a text transcript), with + Mark's address, e-mail and card digits blacked out and the date, amount, receipt number and RPN's name and EIN + left readable, plus one line in the table below. The source of the 80/20 sum (what came in, from where, in + totals) is published beside it. + +| Year | Received by the project | 20% to RPN | Paid on | Receipt | +| :-- | --: | --: | :-- | :-- | +| (none yet) | | | | | + +What a donor outside the US should know: RPN's receipt is for US tax purposes. In the Czech Republic, where Ianitor +is made, a gift to a charity seated outside the EU and the EEA is, as far as the research for §8.7 found, not +deductible from the income tax base, so the remittance is made from income already taxed. That is Mark's matter, +not yours: supporting Ianitor is a payment to a developer, not a charitable gift by you. + +## How to support + +Not open yet: the channel for supporters (a sponsor page or a direct transfer) is chosen together with the route to +RPN. Until then, the best support is a bug report, a careful review of the code, or telling someone who runs a home +server.