2026-06-03 22:25:38 -04:00
|
|
|
|
# tailwart
|
|
|
|
|
|
|
|
|
|
|
|
> Tailscale × Stalwart. A mailbox with no WAN presence, fronted by a layer-4
|
|
|
|
|
|
> proxy that can live on another machine entirely.
|
|
|
|
|
|
|
|
|
|
|
|
A deliberately over-engineered playground: [Stalwart](https://github.com/stalwartlabs/stalwart)
|
|
|
|
|
|
mail server wired into **Postgres + Redis + Garage S3** at once, deployed as a
|
|
|
|
|
|
Tailscale sidecar, with a separate `caddy-l4` edge that pipes the raw mail ports
|
|
|
|
|
|
over the tailnet. For `infinidim.net`.
|
|
|
|
|
|
|
2026-06-11 19:01:49 -04:00
|
|
|
|
See [CLAUDE.md](./CLAUDE.md) for the architecture and the gotchas, and
|
|
|
|
|
|
[LESSONS.md](./LESSONS.md) for the hard-won symptom→cause→fix notes from
|
|
|
|
|
|
bringing it up (PG races, ACME DNS-01, PROXY-protocol trust, IPv6 egress, …).
|
2026-06-03 22:25:38 -04:00
|
|
|
|
|
|
|
|
|
|
## Layout
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
tailwart/
|
2026-06-11 19:01:49 -04:00
|
|
|
|
├── docker-compose.yml # the mailbox: ts-stalwart sidecar + stalwart (+ IPv6 egress)
|
|
|
|
|
|
├── config/config.json # Stalwart v0.16 bootstrap config — datastore (Postgres) ONLY
|
|
|
|
|
|
├── config/config.toml # dead v0.15-era config, kept as historical reference
|
2026-06-03 22:25:38 -04:00
|
|
|
|
├── caddy/ # the edge: custom Caddy (caddy-l4) layer-4 mail proxy
|
2026-06-03 22:39:33 -04:00
|
|
|
|
│ ├── Dockerfile # pulls prebuilt caddy-l4 binary (caddyserver.com, no local build)
|
2026-06-11 19:01:49 -04:00
|
|
|
|
│ ├── caddy.json # :25/465/587/143/993 mail + :443 SNI fan-out → stalwart over the tailnet
|
2026-06-03 22:25:38 -04:00
|
|
|
|
│ ├── docker-compose.yml # deploy on any public-IP, tailnet, tag:reverse-proxy host
|
|
|
|
|
|
│ └── README.md
|
|
|
|
|
|
├── acl-snippet.hujson # tag:stalwart owner + grants to merge into your policy
|
|
|
|
|
|
├── .env.example # operator surface — copy to .env
|
|
|
|
|
|
└── .gitignore
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-06-11 19:01:49 -04:00
|
|
|
|
> **v0.16 config model:** `config.json` describes *only* where Postgres lives;
|
|
|
|
|
|
> everything else (domains, accounts, listeners, ACME, blob/Redis wiring, proxy
|
|
|
|
|
|
> trust, DKIM, spam) lives **in Postgres**, managed via the web UI or JMAP. The
|
|
|
|
|
|
> old TOML + `%{env}%` macro model is gone — see CLAUDE.md / LESSONS.md.
|
|
|
|
|
|
|
2026-06-03 22:25:38 -04:00
|
|
|
|
## Quickstart
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
cp .env.example .env && $EDITOR .env # fill secrets (see CLAUDE.md prereqs)
|
|
|
|
|
|
|
|
|
|
|
|
# 1. create the stalwart role/db in shared Postgres + the Garage bucket
|
|
|
|
|
|
# (one-off; see CLAUDE.md "Prerequisites")
|
|
|
|
|
|
# 2. admin console: assign tag:stalwart to the OAuth client + paste acl-snippet
|
|
|
|
|
|
# 3. bring up the mailbox (tailnet-only)
|
|
|
|
|
|
docker compose up -d
|
|
|
|
|
|
# 4. bring up the edge (binds public mail ports; can be a different host)
|
|
|
|
|
|
cd caddy && docker compose up -d --build
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Then point `infinidim.net`'s MX at the edge host, add SPF/DKIM/DMARC, and finish
|
|
|
|
|
|
configuration in Stalwart's web admin (`mail.infinidim.net`).
|
|
|
|
|
|
|
|
|
|
|
|
## Status
|
|
|
|
|
|
|
2026-06-11 19:01:49 -04:00
|
|
|
|
Live. Pinned to `stalwartlabs/stalwart:v0.16.7`, booting cleanly against the
|
|
|
|
|
|
shared Postgres/Redis/Garage backends, holding a Let's Encrypt wildcard via
|
|
|
|
|
|
ACME DNS-01 (Spaceship), and relaying outbound over the tailnet (the VPS blocks
|
|
|
|
|
|
all outbound SMTP ports). The container has its own IPv6 egress.
|
|
|
|
|
|
|
|
|
|
|
|
Not yet exposed for inbound IPv6 mail: `mail.infinidim.net` is intentionally
|
|
|
|
|
|
A-only until the edge proxy gains v6 `:25` listeners — publish its `AAAA` and
|
|
|
|
|
|
the v6 listeners together, or senders will try v6 and some won't fall back. See
|
|
|
|
|
|
LESSONS.md.
|