Files
mnovak c9aa55ec99 [web] Domi UI: the web UI on @domi/ui v1.0.4, vendored (CPAL-1.0), with the Built on Domi credit (PR #14, squashed)
@domi/ui v1.0.4 vendored unchanged in packages/domi-ui by domi-design's tools/vendor.mjs and used as workspace:*, so
the Nix build fetches nothing from Gitea (web.nix sources the folder; fetchPnpmDeps hash from the NixOS runner).
Its fonts, roles (data-domi-room="ianitor", the same hex) and controls replace Ianitor's copies: Button through
Ianitor's adapter (desktop sizes kept), every text field a TextField with its seal, Checkbox, Select, Segmented.
Ianitor's 22 role names renamed to --domi-*. <DomiCredit /> on every screen and in About, with the CPAL section 15
note beside the source link; the README names the vendored package. Disabled buttons are natively disabled.
2026-11-23 00:52:19 +01:00

109 lines
6.7 KiB
Markdown

# 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. CPAL-1.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.
Anyone can rebuild the tagged commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked
so far is narrower than "reproducible": the output derivations are rebuilt once and compared, with dependencies
from the binary cache, and that has not run yet; the first pin needs a machine with Nix.
## 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
[CPAL-1.0](LICENSE), the Common Public Attribution License 1.0, from 2026-11-23. Ianitor 0.2.0 and earlier stay
available under MPL-2.0 to those who received them; from this change on, the code is under CPAL-1.0.
CPAL-1.0 is MPL 1.1 with an attribution clause and a network clause. Whoever runs Ianitor, or a work built on it,
for users (over a network too) shows the credit of LICENSE Exhibit B where those users reach it:
> **Built on Domi** · https://aula.marek-novak.cz · Copyright (c) 2026 Marek Novák
Ianitor's web UI shows it on every screen (in the sidebar, or at the foot of the page on a phone) and in Settings,
About. Using Ianitor over a network counts as distribution (CPAL §15): whoever runs a changed Ianitor for others
makes that source available. This repository is the source of Ianitor itself, linked from Settings, About.
Contains @domi/ui (CPAL-1.0, Copyright (c) 2026 Marek Novák), in `packages/domi-ui`; the rest of this repo is under its
own licence. Pingora is Apache-2.0; Caddy, used only as a separate fallback process, Apache-2.0.