[relay] F23: quotas (507), NixOS module behind Caddy with TLS and no logs, VM test (unrun) #17
Reference in New Issue
Block a user
Delete Branch "feature/home-relay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
F23 — the relay on a home server (T#8, Amicitia #51). Analysis:
.agents/features/home-relay.md.PROTOCOL.mdsection 8, a new status). A mailbox holds at most 1 000 waiting blobs and 32 MiB. The relay holds what its operator sets: by default 1 GiB, 100 000 mailboxes and 10 000 unclaimed invites. Over a limit the answer is a bare 507, per mailbox only after the post token. Nothing new is stored to count.deploy/nixos/module.nix:services.tabellarius. The relay runs on loopback, sandboxed by systemd, and may talk to localhost only. Caddy sits in front with Let's Encrypt TLS, no access log, no error log, and the forwarding headers removed, so the relay never learns who connected. Refused-connection firewall logging is off by default.deploy/nixos/test.nix(nix flake check): a VM test that a client's address appears nowhere on the server after a session that includes refusals and a 507.deploy/nixos/README.md: how to run it, and what an operator still sees.Adversarial self-review — F23, the home relay
Evidence
cargo test --workspace --locked(Windows)-D warnings), fmt,check-deps.shmutate_quotas.py)--max-bytesignoredNot verified — read this first
services.caddy.logFormat,virtualHosts.<name>.logFormat,testers.runNixOSTest). They neednix flake checkon Linux before anyone relies on them. The first real run is Mark's server. Until then, the claim the proxy logs no address is a design, not a tested fact. CLAUDE.md section 2.4 says a privacy claim without a test is removed from the docs, so the README and analysis say plainly that the VM test has not run yet.https(Amicitia's half of F23).Verdict
The quotas are tested and merge. The deploy files merge as an unrun draft, marked so in their README, so Mark can run them. Findings Q1–Q7 are on their lines.
@@ -150,6 +201,20 @@ impl Store {}let conn = self.conn();Self::authorize(&conn, id, token, Column::Post)?;// After the token: a stranger learns nothing about this mailbox from a 507.Q1 — privacy: 507 after the token. A per-mailbox 507 before the token check would tell anyone who knows a mailbox id that it is busy. The planted bug the mailbox cap checked before the token proves the test sees it.
@@ -235,0 +300,4 @@// Expired invites wait for the hourly purge; they do not count against new ones.let waiting = Self::number(&conn,"SELECT count(*) FROM invites WHERE expiry > ?1",Q2 — expired invites do not count. The hourly purge removes them later. Counting them would let an hour of spam block new invites longer than the 7-day rule says. A planted bug proved the test.
@@ -0,0 +81,4 @@# It talks to Caddy on loopback and to nothing else, even if it had a bug.IPAddressDeny = "any";IPAddressAllow = "localhost";Q6 — defence in depth.
IPAddressDeny=any+IPAddressAllow=localhost: even a compromised relay process cannot open a connection to anywhere but loopback. WithDynamicUser,ProtectSystem=strictand the rest. Unrun (see Not verified).@@ -0,0 +115,4 @@# Caddy's own logger: errors about TLS handshakes or upstreams can name a client's address.# No log is the rule; an operator who needs one turns it on for a while, knowing why.logFormat = ''output discardQ4 — no log at all from Caddy. Not access log off, errors on: Caddy's TLS-handshake and upstream errors can carry a client address. The cost is that an operator debugging a problem must switch logging on, and the README says what that writes.
@@ -0,0 +125,4 @@extraConfig = ''reverse_proxy 127.0.0.1:${toString cfg.port} {# The relay never learns who connected: Caddy adds these by default.header_up -X-Forwarded-ForQ5 — the relay never learns who connected. Caddy adds
X-Forwarded-Forby default; it andX-Real-IPandForwardedare removed. The relay logged nothing anyway; now it does not even receive the address. Not tested: the VM test checks logs, not headers. A header check would need the relay to echo headers, which it must never do.@@ -0,0 +76,4 @@# Nowhere on the server: not in the journal, not under /var/log, not in the relay's data.server.succeed("journalctl --sync")server.fail("journalctl --no-pager -o verbose | grep -F '" + client_ip + "'")Q7 — test honesty. The test greps for the client's address after a session with successes, refusals (404, 400) and a 507. It has no positive control: if the grep could never match (a wrong interface, a different address format), it would pass vacuously. A control that turns Caddy's log on and expects a match is the next thing to add when it first runs on Linux.
@@ -94,6 +94,12 @@ unknown fields. A blob is at most 256 KiB, and a KeyPackage at most 16 KiB.- A wrong token, an unknown id and a malformed id all give the same bare **404**, so nobody can probewhat exists.- **Quotas** *(added 2026-11-16, F23, so a relay can face the internet; `.agents/features/home-relay.md`)*:Q3 — protocol change: a new status, 507. No new field, nothing new stored. Old clients see a non-2xx, which they already treat as try again later. Documented with date and reason, as CLAUDE.md section 3 asks. Abuse is bounded, not prevented: a flood can still fill the caps. Proof of work or invite-only mailbox creation is for a later protocol version.
Merged into
mainwith--no-ffas0e6be38280(remote hash verified). The self-review is review 380 on this PR.Pull request closed