10 Commits

Author SHA1 Message Date
mnovak 25d4875b38 [docs] Roadmap: Phase 4 status and handover 2026-11-22 19:31:18 +01:00
mnovak 5023575680 [fabrica] Release pin (QC round 2): verifiers build the tagged commit (flake rev and docs); the commit the pin names is kept for the record, must hold the recorded source tree when present, and is published unchecked when absent 2026-11-22 19:29:28 +01:00
mnovak ea1ec11cd1 [fabrica] Release pin, tests first (QC round 2): a forged pinned commit is refused, a rebased-away one is accepted with the tagged commit as the build reference (red) 2026-11-22 19:28:52 +01:00
mnovak 1905ff81ce [bench] Conformance rerun with the slow-client probes: both engines drop a TLS handshake that never starts at 60 s; Ianitor drops an endless HTTP/2 header block in 2.5 s, Caddy keeps it open; Caddy's version recorded (v2.11.7) 2026-11-22 19:19:50 +01:00
mnovak 3ca88e26cc [deploy] Proxy socket: the option says X-Forwarded-Proto is always https there (HTTPS fronts only) 2026-11-22 19:05:25 +01:00
mnovak d058a72ed2 [tests] Fuzz: one fixed credentials folder, rewritten by each run, instead of one per process 2026-11-22 19:05:03 +01:00
mnovak facf4422c8 [bench] Conformance: the slow-client probes (a TLS handshake that never starts, an HTTP/2 header block that never ends) against both engines, and Caddy's real version from the binary's build info 2026-11-22 19:04:59 +01:00
mnovak 142f0bedf7 [fabrica] Release: the pin gate's own tests run before the pin step; python3 in the ci shell for the slow-client probes 2026-11-22 19:04:56 +01:00
mnovak 7f733102bf [control] Start and resolver (QC nits): the live tree goes through the same rules as an apply before control writes it to the engines, and a guard frees an edge name lookup's entry and thread on every way out, a panic included 2026-11-22 19:04:47 +01:00
mnovak 6f259e410a [edge] Resolver and control start, tests first (QC nits): a lookup thread that panics must not leave its name stuck, and a kept tree that breaks a changed [ui] config is not written to the engines at start (red) 2026-11-22 19:04:35 +01:00
29 changed files with 638 additions and 379 deletions
+3 -1
View File
@@ -33,8 +33,10 @@ steps:
needs: [check, test]
run: node apps/web/scripts/shots.mjs
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
- id: pin-test
run: node --test scripts/release-pin.test.mjs
- id: pin
needs: [version]
needs: [version, pin-test]
run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }}
artifacts: ["target/nix/ianitor-nix.json"]
- id: approve
+2 -1
View File
@@ -26,7 +26,8 @@ node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry
scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci)
tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions
scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results
scripts/nix-pin.sh # reproducible build check; writes .fabrica/nix/pin.json before a tag
scripts/nix-pin.sh # rebuild check of the outputs; writes .fabrica/nix/pin.json before a tag
node --test scripts/release-pin.test.mjs # the release's pin gate (a pin must be of the tagged code)
nix build .#ianitor
nix flake check # includes NixOS VM tests (Linux + KVM)
+1 -1
View File
@@ -80,7 +80,7 @@ support is best effort), Caddy and Pebble on PATH: `nix develop .#ci`.
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 pinned commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked
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.
+8
View File
@@ -76,6 +76,14 @@ keep the comparison honest, not to choose an engine.
| Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) |
| Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) |
Slow clients (QC phase 4, `tests/support/probes`, rerun 2026-11-22 with Caddy's version now read from its build
info, `conformance/run.json`):
| | A TLS handshake that never starts | An HTTP/2 header block, one CONTINUATION byte every 0.5 s |
| :-- | :-- | :-- |
| Ianitor | closed after 60 s | closed after 2.5 s (GOAWAY, ENHANCE_YOUR_CALM) |
| Caddy 2.11.7 | closed after 60 s | **still open** after 75 s (the probe's limit; QC saw 150 s) |
Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several
SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than
`trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test
+1 -1
View File
@@ -310,5 +310,5 @@ Hypertext Transfer Protocol Version 2 (HTTP/2)
6.10. CONTINUATION
1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
✔ 1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
✔ 1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
+1
View File
@@ -0,0 +1 @@
h2 22513: STILL OPEN after 75s; frames [(4, 0, '0005001000000003'), (8, 0, '000f0001'), (4, 1, '')]
+1
View File
@@ -0,0 +1 @@
idle 22513: closed after 60.0s (b'')
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,5 +1,5 @@
Start 2026-11-18 18:02:54 -->> 127.0.0.1:30028 (localhost) <<--
Start 2026-11-22 19:16:53 -->> 127.0.0.1:22513 (localhost) <<--
A record via: supplied IP "127.0.0.1"
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
@@ -82,15 +82,15 @@ TLSv1.3 (no server order, thus listed by strength)
Server key size EC 256 bits (curve P-256)
Server key usage Digital Signature
Server extended key usage TLS Web Server Authentication
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20)
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA
Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
subjectAltName (SAN) localhost
Trust (hostname) Ok via SAN and CN (SNI mandatory)
Chain of trust Ok
EV cert (experimental) no
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
>= 10 years is way too long
ETS/"eTLS", visibility info not present
Certificate Revocation List --
@@ -192,6 +192,6 @@ TLSv1.3 (no server order, thus listed by strength)
Final Score 96
Overall Grade A+
Done 2026-11-18 18:05:17 [ 150s] -->> 127.0.0.1:30028 (localhost) <<--
Done 2026-11-22 19:18:22 [ 95s] -->> 127.0.0.1:22513 (localhost) <<--
+1 -1
View File
@@ -257,5 +257,5 @@ HPACK: Header Compression for HTTP/2
5: Sends a SETTINGS frame with unknown identifier
✔ 5: Sends a SETTINGS frame with unknown identifier
6.5.3. Settings Synchronization
6.5.3. Settings Synchronization
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
+1
View File
@@ -0,0 +1 @@
h2 28753: closed after 2.5s; frames from server [(4, 0, '0003000000640006'), (4, 1, ''), (7, 0, '000000000000000b')]
+1
View File
@@ -0,0 +1 @@
idle 28753: closed after 60.0s (b'')
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,5 +1,5 @@
Start 2026-11-18 18:00:21 -->> 127.0.0.1:24056 (localhost) <<--
Start 2026-11-22 19:13:48 -->> 127.0.0.1:28753 (localhost) <<--
A record via: supplied IP "127.0.0.1"
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
@@ -81,15 +81,15 @@ TLSv1.3 (no server order, thus listed by strength)
Server key size EC 256 bits (curve P-256)
Server key usage Digital Signature
Server extended key usage TLS Web Server Authentication
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20)
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA
Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
subjectAltName (SAN) localhost
Trust (hostname) Ok via SAN and CN (SNI mandatory)
Chain of trust Ok
EV cert (experimental) no
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
>= 10 years is way too long
ETS/"eTLS", visibility info not present
Certificate Revocation List --
@@ -191,6 +191,6 @@ TLSv1.3 (no server order, thus listed by strength)
Final Score 96
Overall Grade A+
Done 2026-11-18 18:02:27 [ 131s] -->> 127.0.0.1:24056 (localhost) <<--
Done 2026-11-22 19:15:25 [ 103s] -->> 127.0.0.1:28753 (localhost) <<--
+1 -1
View File
@@ -1 +1 @@
{"build":"release","caddy_version":"unknown","edge_threads":2}
{"build":"release","caddy_version":"v2.11.7 (go install; /root/go/bin/caddy: go1.26.8)","edge_threads":2}
+34 -14
View File
@@ -678,6 +678,25 @@ impl Control {
errors: fe,
}
})?;
self.policy(&model)?;
Ok(Plan {
kind,
verb: host_verb(kind),
summary,
hosts,
target,
model,
attempted,
undo_of,
restore_of,
effect,
})
}
/// What control allows beyond core's schema, for every tree it applies and for the live
/// tree at start: the UI proof only on the [ui] host, a socket upstream only there and only
/// to control's own UI socket.
fn policy(&self, model: &ianitor_core::Model) -> Result<(), Fail> {
// The UI proof belongs to the [ui] host only (core already demands forward-auth for it).
let ui_host = self.cfg.ui.as_ref().and_then(|u| u.hostname.as_deref());
// A socket upstream likewise: only the [ui] host, and only control's own UI socket (a
@@ -717,8 +736,8 @@ impl Control {
}
for h in model.hosts() {
let proof = h.request_headers.iter().any(|r| {
matches!(r, ianitor_core::HeaderRule::Set { value: ianitor_core::HeaderValue::Secret(s), .. } if s.as_str() == ianitor_core::UI_PROOF_SECRET)
});
matches!(r, ianitor_core::HeaderRule::Set { value: ianitor_core::HeaderValue::Secret(s), .. } if s.as_str() == ianitor_core::UI_PROOF_SECRET)
});
if proof && ui_host != Some(h.hostname.as_str()) {
let p = messages::params([("hostname", h.hostname.to_string())]);
let fe = FieldError {
@@ -738,18 +757,7 @@ impl Control {
});
}
}
Ok(Plan {
kind,
verb: host_verb(kind),
summary,
hosts,
target,
model,
attempted,
undo_of,
restore_of,
effect,
})
Ok(())
}
fn compile(&self, model: &ianitor_core::Model) -> Result<(String, String), Fail> {
@@ -1794,6 +1802,18 @@ impl Control {
return;
}
};
// A tree kept under an earlier control.toml may break today's rules (a changed [ui]
// hostname or socket): it is not written to the engines, and the reason is logged; the
// engines keep the last files written. The next apply is refused for the same reason.
if let Err(f) = self.policy(&model) {
let detail = f
.errors
.first()
.map(|e| e.message.clone())
.unwrap_or_else(|| f.reason.message.clone());
log::error!(target: "ianitor::control", "the routes repository breaks control's rules ({detail}); the engines keep the files they have");
return;
}
let Ok((edge_text, caddy_text)) = self.compile(&model) else {
return;
};
+54
View File
@@ -385,6 +385,60 @@ url = \"{}\"
assert!(r.text().contains("\"hosts\""), "{}", r.text());
}
/// QC phase 4 (nit): a tree kept under one `[ui] socket` and read at start under another
/// is not written to the engines; the reason is logged.
#[tokio::test(flavor = "multi_thread")]
async fn a_kept_socket_upstream_that_breaks_a_changed_config_is_not_written_at_start() {
let auth = MockAuthelia::start().await;
let site = format!(
"secrets = [\"ui-proof\"]
[forward_auth]
url = \"{}\"
",
auth.url()
);
let (mut env, sock) = socket_env(site, "a.test").await;
let host = json!({"host": {
"hostname": "a.test", "upstreams": [format!("unix:{}", sock.display())],
"tls": "domi", "auth": "forward-auth",
"request_headers": [{"action": "set", "name": "X-Ianitor-Proof", "secret": "ui-proof"}]
}});
let rec = env.apply("POST", "/api/v1/hosts", Some(host)).await;
assert_eq!(
rec["state"],
"kept",
"{rec}
{}",
env.control_log()
);
env.kill_control();
// A marker in place of edge.json: a start that writes the tree to the engines replaces it.
let before = b"{\"marker\": \"left by the test\"}\n".to_vec();
std::fs::write(env.dir.join("edge/edge.json"), &before).unwrap();
let moved = env.dir.join("ui-moved.sock");
let text = std::fs::read_to_string(env.config_path())
.unwrap()
.replace(&sock.display().to_string(), &moved.display().to_string());
std::fs::write(env.config_path(), text).unwrap();
env.start_control(None);
for _ in 0..100 {
if env.control_log().contains("breaks control's rules") {
break;
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
assert!(
env.control_log().contains("breaks control's rules"),
"{}",
env.control_log()
);
assert_eq!(
std::fs::read(env.dir.join("edge/edge.json")).unwrap(),
before,
"the tree was not written to the engines"
);
}
/// QC: signed in at Authelia (alice) but the client also sends a proof guess: edge must
/// replace, not append, the proof; and Remote-User must be Authelia's.
#[tokio::test(flavor = "multi_thread")]
+45 -2
View File
@@ -130,12 +130,28 @@ impl Resolver {
.spawn({
let key = key.clone();
move || {
// Removes the name's entry and frees the thread's place on every way out, a
// panic in the resolver included: the next request for the name starts a
// new lookup instead of joining a dead one.
struct Done {
inflight: Arc<Inflight>,
key: (String, u16),
_permit: OwnedSemaphorePermit,
}
impl Drop for Done {
fn drop(&mut self) {
lock(&self.inflight).remove(&self.key);
}
}
let _done = Done {
inflight,
key: key.clone(),
_permit: permit,
};
let answer = lookup(&key.0, key.1)
.map(Arc::new)
.map_err(|e| (e.kind(), e.to_string()));
let _ = tx.send(Some(answer));
lock(&inflight).remove(&key);
drop(permit);
}
});
if let Err(e) = spawned {
@@ -258,6 +274,33 @@ mod tests {
assert_eq!(started.load(Ordering::SeqCst), 1);
}
/// QC phase 4 (nit): a lookup thread that panics must not leave its name stuck on a dead
/// lookup; the next request for it starts a new one.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn a_panicking_lookup_does_not_poison_its_name() {
let calls = Arc::new(AtomicUsize::new(0));
let c = calls.clone();
let r = Resolver::new(1, move |_, port| {
if c.fetch_add(1, Ordering::SeqCst) == 0 {
panic!("resolver library bug");
}
Ok(vec![SocketAddr::from(([127, 0, 0, 1], port))])
});
assert!(r.resolve("flaky.test", 80, SHORT).await.is_err());
let mut got = None;
for _ in 0..50 {
match r.resolve("flaky.test", 80, SHORT).await {
Ok(a) => {
got = Some(a);
break;
}
Err(_) => tokio::time::sleep(Duration::from_millis(20)).await,
}
}
assert_eq!(got.unwrap(), vec![SocketAddr::from(([127, 0, 0, 1], 80))]);
assert_eq!(calls.load(Ordering::SeqCst), 2);
}
#[tokio::test]
async fn literals_empty_answers_and_errors() {
let r = Resolver::new(1, |host, _| match host {
+2 -1
View File
@@ -163,7 +163,8 @@ in
a Unix socket (${proxySocket}, 0660, group ianitor-proxy) on which edge (or the Caddy
fallback) serves the HTTPS hosts in plain HTTP to a front proxy that terminated TLS,
such as Caddy beside Ianitor. Only that group can connect, so its X-Forwarded-For is
believed; no loopback TCP port is involved'';
believed; no loopback TCP port is involved. Edge sends X-Forwarded-Proto: https for every
request on it, so it is for a front proxy that serves HTTPS only'';
users = mkOption {
type = types.listOf types.str;
default = [ ];
+21 -1
View File
@@ -165,11 +165,31 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit
| 1 Core and engine | Done | Merged to main 2026-11-07. Tests run in WSL2; ACME checked only against Pebble. The Let's Encrypt staging check moved to phase 3 (Mark, 2026-11-07). |
| 2 Control plane | Done | Merged to main 2026-11-07 (PR 3): routes repo, journaled apply with trial/watch/revert, undo, restore, share links, API tokens, REST API + OpenAPI, `--dev`. Four QC rounds; every finding fixed or listed in Handover. Real Gitea, systemd credentials and Authelia not exercised. |
| 3 Web UI, PKI, NixOS | Built and merged; Done criteria pending Mark | Merged to main 2026-11-08 (PR 5): web UI (murex palette), Domi CA and device mTLS, UI sign-in behind Authelia, runtime engine switch with changes under Caddy, NixOS flake, module and VM tests. Click smoke test green. Not yet done: VM tests run on a KVM host, Mark's nixos-rebuild on the staging mirror, deploy/test-access.sh there, the LE staging check. |
| 4 Hardening and release | Started: the release kit | A `v*` tag's Gitea release carries the notes and screenshots of the web UI under a signed SHA256SUMS (docs/release.md, 2026-11-09). The rest of phase 4 is not started; known gaps carried here: see Handover. |
| 4 Hardening and release | Built and merged; Done criteria pending Mark | Merged to main 2026-11-22 (PR 10): hardening backlog (header deadline, own resolver, pipelining, proxy socket for edge beside Caddy, control UI socket), all five test layers runnable (fuzz, h2spec/testssl, bench vs Caddy committed as data), Artifex `layers` and `verify-nix` pipelines, a release pin that cannot name other code, README, support.md, launch drafts. Not yet done: the first Nix pin and the VM tests (need a machine with Nix and KVM), a pipeline run, signed v1.0.0, the GitHub mirror (later), the two-week run beside Caddy. |
## 10. Handover
(Rewritten at the end of every session: what changed, what was not verified, which build is deployed, the next step.)
**2026-11-22: Phase 4, hardening and release.**
- **Changed:**
- Edge: a 60 s header deadline (slowloris), lookups on its own bounded resolver threads with one lookup per name, pipelining on both listeners, a proxy socket (`/run/ianitor-proxy/edge.sock`, sticky 3770) on which edge trusts Caddy's X-Forwarded-For, and `unix:` upstreams with a strict charset.
- Control: the UI API also on `/run/ianitor-control/ui.sock` (G14 option b); the UI proof is honoured only there. A route may use a socket upstream only as the `[ui]` host on control's own socket; checked at every change and at start.
- Test layers: tests/fuzz (5 cargo-fuzz targets, crashes replayed in cargo test), scripts/conformance.sh (h2spec, testssl.sh, slow-client probes), scripts/bench.sh with results in bench/; `ianitor-pair` runs both engines side by side.
- Fabrica: `layers.yaml` (all five layers, NixOS runner with KVM), `verify-nix.yaml`, and a release `pin` step: `nix-pin.sh` records the commit, its source tree and nixpkgs; the release refuses a pin whose source differs from the tag's, and verifiers build the tagged commit (docs/verify.md).
- README, docs/support.md (Adopt a red panda; RPN route pending Mark, §8.7), docs/launch/ drafts, the GitHub mirror steps for later (docs/release.md). CLAUDE.md: WSL is Ubuntu now, and the disk rule (never C: or D:).
- Results (WSL2 Ubuntu, release build): h2spec Ianitor 144/145, 0 failed (Caddy 2.11.7: 4 failed); testssl.sh A+ both; HTTP/2 slow header block closed by edge after 2.5 s, still open on Caddy at 75 s; fuzz 5x60 s, no crash. Load (one noisy run): Caddy ahead on HTTP/1.1 under load (about 2x with all cores), new TLS connections and the redirect; Ianitor ahead on HTTP/2 at 1 and 64 connections and on memory.
- Tests: core 108, edge 71, control 78, diff 4, fuzz 4, testkit 2 (267); release-pin node test 7; vitest 21; svelte-check clean; hook self-test 55. Two QC rounds; every finding fixed.
- **Deployed:** nothing. The server is unchanged.
- **Not verified:**
- The first Nix pin (`scripts/nix-pin.sh`, needs Nix; the Nix installer was refused in WSL). Until it exists, the release refuses every tag.
- The VM tests, now five with `vm-sockets` (no KVM); the module changes (`edge.proxySocket`, `ui.socket`, sticky directory, `proxySocket.services`) were never evaluated.
- Caddy from nixpkgs (the suites ran against a `go install` build of v2.11.7); NixOS's Caddy restarting when its groups change.
- The Artifex pipelines (never run; the NixOS runner's host needs nested KVM).
- The domi-release key id in docs/verify.md, against Custos.
- **Known gaps:** a kept tree that a changed `[ui]` config breaks is reported only in the log at start; X-Forwarded-Proto on the proxy socket is always https (HTTPS fronts only); the old `apply_sequence` flake did not recur in 18 runs, cause unknown.
- **Needs Mark:** confirm §8.7 (RPN route; e-mail RPN about a receipt for a non-US donor before the first remittance); install Nix in WSL or run `scripts/nix-pin.sh` on a machine with Nix; a KVM machine for `nix flake check`; the Phase 3 staging deploy; approve the proposed app icon and decide on the PWA (design canvas "Ianitor Domi - All screens"); delete F: ab-ro (a clean Fabrica clone left by the build).
- **Next step:** Mark's staging deploy and the first Nix pin; then the `layers` pipeline, then tag v1.0.0.
**2026-11-17: The Domi CA moved to the shared crate domi-pki (Fabrica docs/32_coherence.md, T3a).**
- **Changed:** `crates/core/src/pki.rs` is now Ianitor's view of [domi-pki](https://gitea.marek-novak.cz/mnovak/domi-pki)
v1.0.0 (git tag in Cargo.toml): the same public API, the same error messages and the same encrypted-key format
+1 -1
View File
@@ -38,7 +38,7 @@ how it is run, not for a number.
## Verifiable, and signed
Every release is a `SHA256SUMS` signed through Custos with my release key, over the notes, screenshots of the UI,
and the NAR hashes of the Nix build. Rebuild the pinned commit and compare (docs/verify.md tells you how).
and the NAR hashes of the Nix build. Rebuild the tagged commit and compare (docs/verify.md tells you how).
[Before posting: say "reproducible" only once two independent builds have matched; until then, what is checked is
one rebuild of the output derivations, with dependencies from the binary cache.]
+2 -2
View File
@@ -22,13 +22,13 @@ are on every step's PATH).
| `check`, `test` | `svelte-check` and the vitest click smoke test of the web UI the shots show | |
| `notes` | `fabrica notes` (the range since the previous `v*` tag; the first release covers the whole history) | `target/notes/release-notes.md`, `release-notes.json` |
| `shots` | `node apps/web/scripts/shots.mjs` (below) | `target/aula/aula-<name>.png`, `aula.json` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, and one made from other code than the tag's; publishes the pinned commit | `target/nix/ianitor-nix.json` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, one made from other code than the tag's, and one naming a present commit of other code; publishes the tagged commit as the build reference | `target/nix/ianitor-nix.json` |
| `approve` | the run's Custos approval, before anything is published | |
| `publish` | the Gitea release of the tag: the notes, the shots, `aula.json` and `ianitor-nix.json`; `sums: domi-release` adds `SHA256SUMS` and `SHA256SUMS.minisig`; `release-notes.md` becomes the release's text | |
**The Nix build is pinned, not shipped.** The Windows runner has no Nix and Fabrica's `SHA256SUMS` covers only the
files of one `publish` step, so the release cannot carry a build made by the NixOS runner. It carries the build's
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the pinned commit and
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the tagged commit and
compares ([verify.md](verify.md)), and the `verify-nix` pipeline does that on every `v*` tag on the NixOS runner.
The `pin` step refuses a pin made from other code than the tag's (its source tree must match), which is the gate:
Fabrica pipelines cannot depend on one another, so `publish` cannot wait for `verify-nix`. What "reproducible"
+9 -6
View File
@@ -3,7 +3,7 @@
Every Ianitor release on Gitea (`vX.Y.Z`) carries `SHA256SUMS` and `SHA256SUMS.minisig`, signed through Custos by
the `domi-release` key, and among the files that `SHA256SUMS` lists, `ianitor-nix.json`: the commit the build was
made from and the NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI).
Ianitor ships no binary download: you build that commit yourself (or your server does, through the NixOS module)
Ianitor ships no binary download: you build the tagged commit yourself (or your server does, through the NixOS module)
and check that you got exactly the bytes the release vouches for.
What is checked, and what is not yet: `scripts/nix-pin.sh` builds each output, then rebuilds the output derivation itself once more (`nix build --rebuild`) and refuses to pin it if the two differ; the dependencies come from the binary cache and are not rebuilt. The `verify-nix` pipeline does the same on the NixOS
@@ -32,8 +32,11 @@ sha256sum -c --ignore-missing SHA256SUMS # every downloaded file: OK
## 2. The build
`ianitor-nix.json` names the commit the hashes were built from (`commit`; the tag's own commit, `taggedCommit`,
differs from it at most by the pin file), the nixpkgs revision of its flake.lock, and the hashes:
`ianitor-nix.json` names the commit to build, `taggedCommit` (also in `flake`), the nixpkgs revision of its
flake.lock, and the hashes. `commit` is where `nix-pin.sh` ran, for the record: the release checks that the tagged
commit holds the same source (they differ at most by the pin file, which no package's source contains), and that
`commit` does too when it is present (`commitChecked`); a pin naming a commit that no longer exists is published
with `commitChecked: false`, and that is fine, because you build `taggedCommit`:
```json
{ "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux",
@@ -43,7 +46,7 @@ differs from it at most by the pin file), the nixpkgs revision of its flake.lock
Build that commit and compare (Linux with Nix and flakes; nothing from Ianitor's own caches is needed):
```sh
c=$(jq -r .commit ianitor-nix.json)
c=$(jq -r .taggedCommit ianitor-nix.json)
for a in ianitor ianitor-web; do
p=$(nix build "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=$c#$a" --no-link --print-out-paths)
got=$(nix path-info --json "$p" | jq -r 'if type == "array" then .[0].narHash else .[].narHash end')
@@ -57,13 +60,13 @@ hash is the content. `nix build --rebuild` builds once more locally and fails if
On a server that uses the NixOS module, the running build is `services.ianitor.package`, normally
`ianitor.packages.x86_64-linux.ianitor` from the flake input pinned in the server's `flake.lock`: if that input's
`rev` is the release's commit, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')`
`rev` is the release's `taggedCommit`, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')`
gives the same NAR hash.
## What this does and does not prove
- **Proves:** the release's notes, screenshots and pin are the ones Mark approved and Custos signed; the code at the
pinned commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of
tagged commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of
the commit).
- **Does not prove:** that the code is good (that is the five test layers' job, ROADMAP §5), nor anything about the
Nix binary cache you build with: a substituted dependency is trusted as Nix trusts it. `nix build --rebuild` and
+2
View File
@@ -49,6 +49,8 @@
oha
nodejs_22
pnpm_11
# the slow-client probes (tests/support/probes)
python3
];
};
});
+13 -1
View File
@@ -18,7 +18,7 @@ set -euo pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
out="$root/bench/conformance"
mkdir -p "$out"
for tool in caddy h2spec jq; do
for tool in caddy h2spec jq; do # and python3 for the slow-client probes, when present
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
done
testssl=$(command -v testssl.sh || command -v testssl || true)
@@ -60,6 +60,18 @@ for engine in ianitor caddy; do
grade=$(jq -r '[.[] | select(.id=="overall_grade")][0].finding // "n/a"' "$out/$engine-testssl.json" 2>/dev/null || echo n/a)
bad=$(jq -r '[.[] | select(.severity=="HIGH" or .severity=="CRITICAL")] | length' "$out/$engine-testssl.json" 2>/dev/null || echo "?")
printf '%-10s %-8s %s\n' "$engine" testssl "grade $grade, $bad findings HIGH or CRITICAL"
# Slow clients (QC phase 4, tests/support/probes): a TLS handshake that never starts, and an
# HTTP/2 header block that never ends; how long each engine keeps them open (75 s at most).
if command -v python3 >/dev/null; then
probes="$root/tests/support/probes"
python3 "$probes/slow.py" 127.0.0.1 "$p" idle 75 localhost >"$out/$engine-slow-idle.txt" 2>&1 &
a=$!
python3 "$probes/h2slow.py" 127.0.0.1 "$p" 75 localhost >"$out/$engine-slow-h2.txt" 2>&1 &
b=$!
wait $a $b || true
printf '%-10s %-8s %s\n' "$engine" slow "$(cut -d';' -f1 "$out/$engine-slow-idle.txt" | head -1); $(cut -d';' -f1 "$out/$engine-slow-h2.txt" | head -1)"
fi
done
# A case Caddy passes and Ianitor fails is a regression against the fallback.
+28 -6
View File
@@ -9,8 +9,12 @@
// The pin is a claim about the code it was built from, so it is refused unless the tagged commit
// holds exactly that code: its source tree (every tracked file except pin.json itself) must be
// the one the pin recorded. That is `git diff --name-only <pinned> <tag>` being empty or only
// pin.json, checked without the pinned commit's history (a runner's clone is shallow). The
// published file names the commit the hashes were built from, not the tag's.
// pin.json, checked without the pinned commit's history (a runner's clone is shallow).
//
// The build reference verifiers use is the tagged commit: it has the pinned source by that check,
// and it surely exists. The commit the pin names is kept for the record only; when its objects
// are here it must hold the recorded source tree too (a forged commit is refused), and when they
// are not (a shallow clone, or a commit rebased away) it is published unchecked.
//
// node scripts/release-pin.mjs <X.Y.Z> <tag> <commit> write target/nix/ianitor-nix.json
// node scripts/release-pin.mjs --source-tree <commit> print that commit's source-tree hash
@@ -86,15 +90,31 @@ if (here !== pin.sourceTree) {
);
}
let commitChecked = false;
try {
git("cat-file", "-e", `${pin.commit}^{commit}`);
commitChecked = true;
} catch {
// Not here: informational only.
}
if (commitChecked && sourceTree(pin.commit) !== pin.sourceTree) {
fail(
`${PIN} names ${pin.commit}, which does not hold the source tree it records: ` +
`the pin was edited by hand; run scripts/nix-pin.sh again`,
);
}
const out = {
name: "Ianitor Domi",
version,
tag,
// The commit the hashes were built from; the tag's own commit differs at most by pin.json.
commit: pin.commit,
// Build this one (docs/verify.md): the tagged commit, whose source the pin is of.
taggedCommit: commit,
flake: `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${commit}`,
// The commit nix-pin.sh ran at, for the record; checked against the source tree when present.
commit: pin.commit,
commitChecked,
sourceTree: pin.sourceTree,
flake: `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${pin.commit}`,
nixpkgs: pin.nixpkgs ?? null,
system: pin.system,
outputs: pin.outputs,
@@ -102,4 +122,6 @@ const out = {
};
mkdirSync(join(repo, "target/nix"), { recursive: true });
writeFileSync(join(repo, "target/nix/ianitor-nix.json"), JSON.stringify(out, null, 2) + "\n");
console.log(`target/nix/ianitor-nix.json: ${version}, built from ${pin.commit}, tagged at ${commit}`);
console.log(
`target/nix/ianitor-nix.json: ${version} at ${commit} (pinned at ${pin.commit}, ${commitChecked ? "checked" : "not here, unchecked"})`,
);
+45 -3
View File
@@ -94,7 +94,7 @@ test("a pin from an older commit, with code changed since: refused", () => {
}
});
test("a pin from the parent where only pin.json changed: accepted, and the pinned commit is published", () => {
test("a pin from the parent where only pin.json changed: accepted; the tagged commit is the build reference", () => {
const r = repo();
try {
r.write("crates/a.rs", "fn a() {}\n");
@@ -104,10 +104,52 @@ test("a pin from the parent where only pin.json changed: accepted, and the pinne
const out = run(r, b);
assert.equal(out.status, 0, out.stdout + out.stderr);
const published = JSON.parse(readFileSync(join(r.dir, "target/nix/ianitor-nix.json"), "utf8"));
assert.equal(published.commit, a, "the pin names the commit it was built from");
assert.equal(published.commit, a, "the commit the pin was made at, for the record");
assert.equal(published.commitChecked, true, "its objects are here, so its tree was checked");
assert.equal(published.taggedCommit, b);
assert.equal(published.tag, "v1.0.0");
assert.match(published.flake, new RegExp(`rev=${a}`));
// Verifiers build the tagged commit: the same source by construction, and it surely exists.
assert.equal(published.flake, `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${b}`);
} finally {
r.done();
}
});
test("a forged commit (present, but another source tree): refused", () => {
const r = repo();
try {
r.write("crates/a.rs", "fn other() {}\n");
const x = r.commit("other code at X");
r.write("crates/a.rs", "fn a() {}\n");
const a = r.commit("code at A");
const pin = JSON.parse(pinFor(r, a));
pin.commit = x; // the tree is A's, the commit named is X
r.write(".fabrica/nix/pin.json", JSON.stringify(pin));
const b = r.commit("pin");
const out = run(r, b);
assert.equal(out.status, 1, out.stdout + out.stderr);
assert.match(out.stderr, /does not hold the source tree/);
} finally {
r.done();
}
});
test("a commit rebased away (absent): accepted, the tagged commit is the build reference", () => {
const r = repo();
try {
r.write("crates/a.rs", "fn a() {}\n");
const a = r.commit("code at A");
const pin = JSON.parse(pinFor(r, a));
pin.commit = "f".repeat(40); // no such object here (rebased away, or a shallow clone)
r.write(".fabrica/nix/pin.json", JSON.stringify(pin));
const b = r.commit("pin");
const out = run(r, b);
assert.equal(out.status, 0, out.stdout + out.stderr);
const published = JSON.parse(readFileSync(join(r.dir, "target/nix/ianitor-nix.json"), "utf8"));
assert.equal(published.taggedCommit, b);
assert.equal(published.commit, "f".repeat(40));
assert.equal(published.commitChecked, false);
assert.equal(published.flake, `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${b}`);
} finally {
r.done();
}
+29 -5
View File
@@ -95,6 +95,34 @@ mod unix {
}
}
/// `caddy version`, or, for a `go install`ed Caddy that says "unknown", its module version
/// from the binary's build info (`go version -m`).
fn caddy_version(caddy: &std::path::Path) -> String {
let out = |cmd: &mut std::process::Command| {
cmd.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default()
};
let v = out(std::process::Command::new(caddy).arg("version"));
if !v.is_empty() && v != "unknown" {
return v;
}
let info = out(std::process::Command::new("go")
.args(["version", "-m"])
.arg(caddy));
info.lines()
.map(|l| l.split_whitespace().collect::<Vec<_>>())
.find(|f| f.len() >= 3 && f[0] == "mod" && f[1] == "github.com/caddyserver/caddy/v2")
.map(|f| {
format!(
"{} (go install; {})",
f[2],
info.lines().next().unwrap_or("").trim()
)
})
.unwrap_or(v)
}
fn addrs(t: &Target) -> serde_json::Value {
json!({ "http": t.http.to_string(), "https": t.https.to_string() })
}
@@ -158,11 +186,7 @@ mod unix {
&caddy2_cfg,
&[("GOMAXPROCS", "2")],
);
let caddy_version = std::process::Command::new(&caddy)
.arg("version")
.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default();
let caddy_version = caddy_version(&caddy);
println!(
"{}",
+2 -1
View File
@@ -105,7 +105,8 @@ fn compile_checked(site: &str, hosts: &[(String, String)]) {
fn creds_dir() -> &'static PathBuf {
static DIR: OnceLock<PathBuf> = OnceLock::new();
DIR.get_or_init(|| {
let d = std::env::temp_dir().join(format!("ianitor-fuzz-creds-{}", std::process::id()));
// One fixed folder, rewritten by every run: nothing piles up in the temp folder.
let d = std::env::temp_dir().join("ianitor-fuzz-creds");
std::fs::create_dir_all(&d).unwrap();
std::fs::write(d.join("api_key"), b"fuzz-secret-value\n").unwrap();
std::fs::write(d.join("ui-proof"), b"fuzz-proof-value\n").unwrap();