Files
nixfiles/docs/sites/colony/shill/containers/middleman.md
T
jackos1998andClaude Opus 5.5 2519c3c86c nixos/palace: Run slop-broker for agents
`slop-cannon`'s agents reach the broker on `palace` through a vsock
device, under an `agent` policy: box queries run without asking,
`slop ssh` asks (offering 5 min and 1 h leases), and so do deploys.
The deploy key moves to `palace` as an age secret for the broker, so
the VM never holds it, and `AGENTS.md` points agents there at `slop`.

`palace` runs the builder itself, as `slop-broker-build`, reached over
SSH like a separate box and fetching `dev/nixfiles` with a read-only
deploy key, so `slop-cannon` shrinks to 24 GiB. `slop build` pushes
into Harmonia's store on `object` with a key of the broker's own,
which can only speak the store protocol and add GC roots there.
Agents' use of the builder asks, unless the commit is already on
`master`. Builds run agent-written Nix, so they only reach the
Internet, like `lan-untrusted`, and `nix-daemon` is limited so they
can't starve the VMs.

The approvals web app listens on `palace` for `middleman` only, the
one client the firewall lets in, which publishes it at
`approve.slop.nul.ie`. Approvers sign in with Pocket ID, and deploys
to the routers need a fresh passkey.

The broker's SSH targets are the deploy-rs nodes on `master`, which
the builder reads there, so agents can't add or redirect one.

With the broker gating what needs credentials, `slop-cannon`'s agents
are permissive by default: Claude bypasses permission prompts and
Codex runs without approvals or its sandbox, with matching Paseo
profiles. The deny rules for raw `deploy` and `ssh-machine` stay as
steers towards `slop`; the ones for `.keys/` go, since the VM's
checkout only has the committed public keys there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00

8.6 KiB

middleman

The front-end reverse proxy for the colony's public web services — the single ingress that estuary DNATs HTTP/HTTPS (and Matrix federation on :8448) to. Terminates TLS with wildcard certificates it issues itself, provides nginx-sso for gated vhosts, and runs the Pocket ID identity provider, a librespeed backend and a Paseo relay.

  • Source: shill/containers/middleman/ (default.nix, vhosts.nix)
  • Host: NixOS container on shill (my.containers ephemeral nspawn on the ctrs bridge; bind-mounts /mnt/media read-only for the static file vhosts)
  • nixpkgs: mine

Role

nginx

The reverse proxy enables vts, fancyindex, Brotli, kTLS and a proxy cache. Its dynamic resolver points at estuary, allowing upstreams named under ams1.int.nul.ie to resolve again at runtime. All vhosts live in vhosts.nix. nginx also waits for colony-psql through systemdAwaitPostgres, avoiding an early-boot DNS stall.

ACME

middleman issues certificates for its own vhosts; it is not a shared CA for other boxes.

  • ams1.int.nul.ie and its wildcard use a lego exec challenge that SSHes to pdns-file-records@estuary-vm. This is the default useACMEHost certificate internally.
  • nul.ie, *.nul.ie, *.s3.nul.ie and *.slop.nul.ie (for slop-broker previews) use Cloudflare DNS. A postRun hook copies renewed material to the mail VM and runs mailcow-ssl-reload there.
  • Renewal reloads nginx; the acme group owns the secret files and includes the nginx user.

nginx-sso

The generic SSO instance at sso.nul.ie uses Google OAuth by default and also offers a simple username/password provider. Its cookie domain is .nul.ie; gated vhosts include the generated server-generic.conf / location-generic.conf snippets from /etc/nginx/includes/sso/.

Pocket ID

Pocket ID (services.pocket-id) is a passkey-only OpenID Connect provider at id.nul.ie, for apps that sign in with OIDC (first the slop-broker approvals web app, see slop-broker.md). It is meant to replace nginx-sso's Google sign-in later, with oauth2-proxy in front of apps that lack OIDC.

  • Listens on 127.0.0.1:1411 behind nginx and keeps its SQLite database in /var/lib/pocket-id (persisted by my.tmproot). The middleman/pocket-id-encryption-key secret encrypts it.
  • The first admin is created at /setup; nginx only allows that page and its API from internal networks (lib.my.c.internalNets). Further users are added from the admin UI.

librespeed

The frontend and backend are published as speed.nul.ie and librespeed.ams1.int.nul.ie, both proxied to localhost:8989.

Paseo relay

paseo-relay (the my.paseo-relay module, package pkgs/paseo-relay.nix) relays end-to-end encrypted traffic between Paseo daemons and the Paseo app, in place of Paseo's hosted relay.

  • Single node with no Erlang distribution, listening on 127.0.0.1:4000 and published as paseo-relay.nul.ie. It keeps no state, so a restart only drops connections.
  • The relay can't read or forge messages, so the vhost is open to the world. Its Prometheus /metrics is not exposed; /health and /ready are.
  • slop.nul.ie serves Paseo's web app as static files, taken from the same patched Paseo package as the daemon. Pairing links from our daemon point there, and the app connects through the relay, so nothing from paseo.sh is needed in the browser.

Network assignments

See the consolidated network assignments table (this box: middleman).

The firewall allows http, https and 8448 (Matrix federation). A small nftables SNAT rule rewrites outbound IPv6 to the container's own address on host0.

Published vhosts

Everything is under *.nul.ie with the public wildcard cert unless noted; defaults applied to all vhosts are onlySSL, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (generic instance).

Host Upstream Notes
nul.ie (_, default) static landing page (index.html, CV PDF, SSH pubkey); serves Matrix .well-knowns and redirects webfinger/nodeinfo/host-meta → toot.nul.ie, atproto-did → pds.nul.ie; forceSSL (plain HTTP redirects to HTTPS)
localhost — loopback-only VTS status page at /status (scraped by netdata); plain HTTP
sso.nul.ie localhost:8082 nginx-sso endpoint
id.nul.ie localhost:1411 Pocket ID; /setup only from internal networks
netdata-colony.nul.ie <host>.ams1.int.nul.ie:19999 netdata fan-out over vm, fw, ctr, oci, http, jackflix-ctr, chatterbox-ctr, colony-psql-ctr; SSO
pass.nul.ie vaultwarden-ctr:8080 vaultwarden; /notifications/hub proxied with websockets
matrix.nul.ie chatterbox-ctr:8008 chatterbox Synapse client + federation; also listens on :8448 as federation default_server; = / redirects to Element; serves Matrix .well-knowns
element.nul.ie static element-web Element configured for the nul.ie homeserver
torrents.nul.ie jackflix-ctr:9091 Transmission (jackflix); SSO
jackett.nul.ie jackflix-ctr:9117 SSO
radarr.nul.ie jackflix-ctr:7878 SSO; websockets
sonarr.nul.ie jackflix-ctr:8989 SSO; websockets
gib.nul.ie jackflix-ctr:5055 Jellyseerr requests
jackflix.nul.ie jackflix-ctr:8096 Jellyfin; /socket websockets; / redirects to /web/
toot.nul.ie toot-ctr:80 Mastodon — upstream currently disabled, see toot
pds.nul.ie toot-ctr:3000 Bluesky PDS (toot); websockets
stuff.nul.ie jackflix-ctr:3923 copyparty
public.nul.ie (+ alias p.nul.ie) static /mnt/media/public fancyindex file listing; addSSL so plain HTTP also works
mc-map.nul.ie simpcraft-oci:8100 Minecraft map (OCI container on whale2)
mc-rail.nul.ie simpcraft-oci:3876 Minecraft railway map (whale2)
mc-map-kink.nul.ie kinkcraft-oci:8100 Minecraft map (whale2)
speed.nul.ie localhost:8989 librespeed
librespeed.ams1.int.nul.ie localhost:8989 librespeed on the internal domain (internal wildcard cert)
paseo-relay.nul.ie localhost:4000 Paseo relay; websockets with long timeouts; /metrics blocked
slop.nul.ie static Paseo web app falls back to index.html; precompressed files served as-is
approve.slop.nul.ie palace.h.nul.ie:8095 slop-broker's approvals web app, which handles sign-in itself (Pocket ID)
md.nul.ie object-ctr:3000 HedgeDoc; websockets
pb.nul.ie object-ctr:8088 wastebin
photos.nul.ie jackflix-ctr:2342 PhotoPrism; websockets
pront.nul.ie stream-hi.h.nul.ie:5000 OctoPrint on the home network (stream); /webcam/ → :5050; SSO
hass.nul.ie hass-ctr.h.nul.ie:8123 Home Assistant (home network); websockets
hass-john.nul.ie john-valorant-tun.ams1.int.nul.ie:8123 remote Home Assistant over the point-to-point tunnel; websockets
minio.nul.ie object-ctr:9001 MinIO console; /ws websockets
s3.nul.ie (+ *.s3.nul.ie) object-ctr:9000 MinIO S3 API (virtual-host style via the *.s3 wildcard cert); /gitea/packages/ has a hack forcing the correct Content-Type for Docker image manifests
nix-cache.nul.ie object-ctr:5000 Harmonia Nix binary cache; .narinfo/nar//serve/ paths get immutable Cache-Control/Expires headers

Notable config files