test / test (push) Has been cancelled
Verified the tree against docs/plans/code-review-2026-08.md and finished the tasks that were only partly done, plus two defects the pass introduced. - bcrypt: the setup account was still hashed at DefaultCost (10). The work factor now has one definition, auth.BcryptCost = 12, used everywhere. - rate limiter: protecting blocked buckets from eviction was unbounded — an attacker with many source addresses could grow the map by making each one fail its way to blocked. Blocked buckets are now evicted past maxBuckets * 4, nearest expiry first, logged once per window. Tests cover both halves. - postqueue: the 5s timeout left the output size unbounded; reads are now capped at 4 MiB and report truncation. - spec references: the ~76 `spec N` citations CHANGELOG [0.5.0] claimed were gone are removed from build/, deploy/, the first two migrations and the release workflow, with the affected comment paragraphs re-wrapped. Comments only; shell/YAML/SQL syntax re-checked. - schema-migrations.md: schema section was headed v9 with the chain at v10, and three links pointed at deleted plan files. - internal/configsafe: the shared empty/forbidden-character check behind the OpenDKIM and Postfix config writers; each writer keeps its own forbidden set. - dropped the parseDomainRateLimitForm/parseAppRateLimitForm pass-throughs left behind by the parser merge (only their own tests still called them). - plan doc now carries a status table: what shipped, what was already in place, what was declined (//go:build linux for the /proc reader) and the open CSRF-token question. Not done, each its own phase: typed template data structs, log/slog, DMARC service and handler tests, error-page/corrupted-backup tests, backup re-auth. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
126 lines
3.9 KiB
Plaintext
126 lines
3.9 KiB
Plaintext
; SelfPost process supervision.
|
|
;
|
|
; Start ORDER is enforced by priority=: OpenDKIM, then the panel (which opens
|
|
; the journal-milter socket), then the Postfix wrapper — which additionally
|
|
; blocks until both milter sockets are ready before starting Postfix.
|
|
;
|
|
; If any managed process exhausts its restart retries (FATAL), the crashexit
|
|
; event listener brings the whole container down so Docker's restart policy can
|
|
; recreate it cleanly, rather than lingering with a dead component.
|
|
|
|
[supervisord]
|
|
nodaemon=true
|
|
user=root
|
|
logfile=/dev/null
|
|
logfile_maxbytes=0
|
|
pidfile=/run/supervisord.pid
|
|
loglevel=info
|
|
|
|
; The control socket is reachable by the shared `selfpost` group so the panel
|
|
; (running as the unprivileged `panel` user) can ask supervisord to send
|
|
; OpenDKIM a reload signal after it rewrites the DKIM tables. It is still
|
|
; unreachable by world; only root and the two SelfPost services are in the
|
|
; group. No HTTP auth is configured because access is gated by socket
|
|
; permissions, not the network.
|
|
[unix_http_server]
|
|
file=/run/supervisor.sock
|
|
chown=root:selfpost
|
|
chmod=0770
|
|
|
|
[rpcinterface:supervisor]
|
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
|
|
|
[supervisorctl]
|
|
serverurl=unix:///run/supervisor.sock
|
|
|
|
[program:opendkim]
|
|
command=/usr/sbin/opendkim -f -x /etc/opendkim.conf
|
|
priority=100
|
|
autostart=true
|
|
autorestart=true
|
|
startretries=3
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[program:panel]
|
|
command=/usr/local/bin/panel
|
|
user=panel
|
|
priority=200
|
|
autostart=true
|
|
autorestart=true
|
|
startretries=3
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[program:postfix]
|
|
command=/usr/local/bin/postfix-wrapper.sh
|
|
priority=300
|
|
autostart=true
|
|
autorestart=true
|
|
startretries=3
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
; One-shot reload helper. The panel runs unprivileged and cannot run `postfix
|
|
; reload` itself, and it cannot signal the Postfix master directly: `postfix
|
|
; start-fg` forks a separate master process, so a signal to the supervised
|
|
; foreground process never reaches it (unlike OpenDKIM, which runs in the
|
|
; foreground as the supervised process itself). Instead the panel asks
|
|
; supervisord — over the group-accessible control socket — to run this program,
|
|
; which executes the canonical `postfix reload` as root. autostart is off (it
|
|
; only runs on demand) and a fast, clean exit is expected, so it never trips the
|
|
; crashexit listener.
|
|
[program:postfix-reload]
|
|
command=/usr/sbin/postfix reload
|
|
autostart=false
|
|
autorestart=false
|
|
startsecs=0
|
|
startretries=1
|
|
exitcodes=0
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
; Periodic TLS-certificate refresh. Runs a daily `postfix reload`
|
|
; so certificates the reverse-proxy renews in the read-only mount are picked up.
|
|
; Long-running (it loops), runs as root so it can reload Postfix, and never exits
|
|
; non-zero, so it neither trips the crashexit listener nor needs restarting.
|
|
[program:cert-reload]
|
|
command=/usr/local/bin/postfix-cert-reload.sh
|
|
priority=400
|
|
autostart=true
|
|
autorestart=true
|
|
startsecs=0
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
; Periodic logrotate for /data/log/mail.log (daily, 7-14 files kept in the
|
|
; image). Runs as root so logrotate can read/rotate the log. Exits non-zero when
|
|
; the config is group/other-writable (logrotate would ignore it silently);
|
|
; autorestart surfaces BACKOFF on the Status page.
|
|
[program:logrotate]
|
|
command=/usr/local/bin/logrotate-loop.sh
|
|
priority=400
|
|
autostart=true
|
|
autorestart=true
|
|
startsecs=0
|
|
stdout_logfile=/dev/stdout
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[eventlistener:crashexit]
|
|
command=/usr/local/bin/crashexit.py
|
|
events=PROCESS_STATE_FATAL
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|