From ed0ccba64ae8c5f596aa168f6279772397962cd3 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Tue, 23 Jun 2026 09:11:28 +0000 Subject: [PATCH] chore(mailu): pin Docker network subnet to match SUBNET; ignore runtime state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The base compose declares no network, so Docker assigns the default bridge an arbitrary subnet that won't match mailu.env SUBNET — breaking Mailu's internal service auth/relay. Add a docker-compose.override.yml.example that pins the default network to 192.168.203.0/24, and gitignore the live override + Mailu runtime state (mailu.env, certs/, data/). Co-Authored-By: Claude Opus 4.8 --- .gitignore | 6 ++++++ cmd/agentbbs/main.go | 10 ++++++---- deploy/mailu/docker-compose.override.yml.example | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 deploy/mailu/docker-compose.override.yml.example diff --git a/.gitignore b/.gitignore index c4b10e9..ea725d2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,11 @@ *.log .env +# Mailu runtime: secrets, local network override, and state +deploy/mailu/mailu.env +deploy/mailu/docker-compose.override.yml +deploy/mailu/data/ +deploy/mailu/certs/ + # Claude Code local worktrees/state .claude/ diff --git a/cmd/agentbbs/main.go b/cmd/agentbbs/main.go index 26de9c4..e874767 100644 --- a/cmd/agentbbs/main.go +++ b/cmd/agentbbs/main.go @@ -73,9 +73,9 @@ import ( "github.com/profullstack/agentbbs/internal/store" "github.com/profullstack/agentbbs/internal/tor" "github.com/profullstack/agentbbs/plugins/about" - "github.com/profullstack/agentbbs/plugins/hello" "github.com/profullstack/agentbbs/plugins/agentgames" "github.com/profullstack/agentbbs/plugins/arcade" + "github.com/profullstack/agentbbs/plugins/hello" "github.com/profullstack/agentbbs/plugins/members" qryptinviteplugin "github.com/profullstack/agentbbs/plugins/qryptinvite" ) @@ -1339,14 +1339,16 @@ func (a *app) ensureMailbox(u store.User) error { // mailClientFor builds an AgentMail client for a member, connecting to the // self-hosted Mailu backend. IMAP uses Dovecot master-user auth (login -// "*") so the BBS gateway can open any member's mailbox with one +// "*") so the BBS gateway can open any member's mailbox with one // secret; SMTP defaults to the co-located relay (no auth). The client stamps // outgoing mail with the member's @ address. Returns an error // if the IMAP connection/login fails. func (a *app) mailClientFor(su store.User) (*mailbox.Client, error) { - login := su.Name + // Mailu keys mailboxes by full address, so the IMAP login (and the master + // login "*") must use the address, not the bare handle. + login := a.mailAddress(su.Name) if master := os.Getenv("AGENTBBS_MAIL_MASTER_USER"); master != "" { - login = su.Name + "*" + master + login = a.mailAddress(su.Name) + "*" + master } cfg := mailbox.IMAPConfig{ IMAPAddr: env("AGENTBBS_MAIL_IMAP_ADDR", a.mailHost+":993"), diff --git a/deploy/mailu/docker-compose.override.yml.example b/deploy/mailu/docker-compose.override.yml.example new file mode 100644 index 0000000..5f24ee9 --- /dev/null +++ b/deploy/mailu/docker-compose.override.yml.example @@ -0,0 +1,14 @@ +# docker-compose.override.yml — copy to docker-compose.override.yml (gitignored). +# +# The base docker-compose.yml does not declare a network, so Docker would assign +# the project's default bridge an arbitrary subnet. Mailu trusts SUBNET (from +# mailu.env) as its internal network for service-to-service auth and relaying, so +# the real network subnet MUST equal SUBNET or internal auth/relay breaks. This +# override pins the default network to the same subnet you set as SUBNET in +# mailu.env (default 192.168.203.0/24). Compose loads this file automatically. +networks: + default: + driver: bridge + ipam: + config: + - subnet: 192.168.203.0/24