Skip to content

Commit ed0ccba

Browse files
ralyodioclaude
andcommitted
chore(mailu): pin Docker network subnet to match SUBNET; ignore runtime state
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 <noreply@anthropic.com>
1 parent 8604ef3 commit ed0ccba

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66
*.log
77
.env
88

9+
# Mailu runtime: secrets, local network override, and state
10+
deploy/mailu/mailu.env
11+
deploy/mailu/docker-compose.override.yml
12+
deploy/mailu/data/
13+
deploy/mailu/certs/
14+
915
# Claude Code local worktrees/state
1016
.claude/

cmd/agentbbs/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ import (
7373
"github.com/profullstack/agentbbs/internal/store"
7474
"github.com/profullstack/agentbbs/internal/tor"
7575
"github.com/profullstack/agentbbs/plugins/about"
76-
"github.com/profullstack/agentbbs/plugins/hello"
7776
"github.com/profullstack/agentbbs/plugins/agentgames"
7877
"github.com/profullstack/agentbbs/plugins/arcade"
78+
"github.com/profullstack/agentbbs/plugins/hello"
7979
"github.com/profullstack/agentbbs/plugins/members"
8080
qryptinviteplugin "github.com/profullstack/agentbbs/plugins/qryptinvite"
8181
)
@@ -1339,14 +1339,16 @@ func (a *app) ensureMailbox(u store.User) error {
13391339

13401340
// mailClientFor builds an AgentMail client for a member, connecting to the
13411341
// self-hosted Mailu backend. IMAP uses Dovecot master-user auth (login
1342-
// "<name>*<master>") so the BBS gateway can open any member's mailbox with one
1342+
// "<addr>*<master>") so the BBS gateway can open any member's mailbox with one
13431343
// secret; SMTP defaults to the co-located relay (no auth). The client stamps
13441344
// outgoing mail with the member's <name>@<mailDomain> address. Returns an error
13451345
// if the IMAP connection/login fails.
13461346
func (a *app) mailClientFor(su store.User) (*mailbox.Client, error) {
1347-
login := su.Name
1347+
// Mailu keys mailboxes by full address, so the IMAP login (and the master
1348+
// login "<addr>*<master>") must use the address, not the bare handle.
1349+
login := a.mailAddress(su.Name)
13481350
if master := os.Getenv("AGENTBBS_MAIL_MASTER_USER"); master != "" {
1349-
login = su.Name + "*" + master
1351+
login = a.mailAddress(su.Name) + "*" + master
13501352
}
13511353
cfg := mailbox.IMAPConfig{
13521354
IMAPAddr: env("AGENTBBS_MAIL_IMAP_ADDR", a.mailHost+":993"),
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# docker-compose.override.yml — copy to docker-compose.override.yml (gitignored).
2+
#
3+
# The base docker-compose.yml does not declare a network, so Docker would assign
4+
# the project's default bridge an arbitrary subnet. Mailu trusts SUBNET (from
5+
# mailu.env) as its internal network for service-to-service auth and relaying, so
6+
# the real network subnet MUST equal SUBNET or internal auth/relay breaks. This
7+
# override pins the default network to the same subnet you set as SUBNET in
8+
# mailu.env (default 192.168.203.0/24). Compose loads this file automatically.
9+
networks:
10+
default:
11+
driver: bridge
12+
ipam:
13+
config:
14+
- subnet: 192.168.203.0/24

0 commit comments

Comments
 (0)