From a80f8586434e6208302463d33ab37fd9f44ae8aa Mon Sep 17 00:00:00 2001 From: tegwick Date: Sun, 18 Oct 2026 11:11:58 +0200 Subject: [PATCH] MAS-WP-0003-T03: optional Scaleway TEM relay for replies; unchroot Postfix Port 25 outbound is blocked on railiance01, so replies need an authenticated submission relay. Enabled only when Secret mas-relay is mounted; otherwise non-local mail is refused at RCPT time instead of queueing. Co-Authored-By: Claude Opus 5.5 Assistant: claude-code Assistant-Model: opus Assistant-Process: 252470@bnt-lap001 Assistant-Session: ad628c8f-4be2-4979-94c9-76c7ed6f8241 --- deploy/railiance/Dockerfile | 2 +- deploy/railiance/entrypoint.sh | 26 +++++++++++++++++++-- deploy/railiance/manifests.yaml | 10 +++++++- workplans/MAS-WP-0003-provider-live-test.md | 12 +++++++++- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/deploy/railiance/Dockerfile b/deploy/railiance/Dockerfile index 79c7708..1724228 100644 --- a/deploy/railiance/Dockerfile +++ b/deploy/railiance/Dockerfile @@ -2,7 +2,7 @@ # Build from the repo root: docker build -f deploy/railiance/Dockerfile . FROM debian:bookworm-slim RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - postfix python3 python3-jsonschema ssl-cert ca-certificates && rm -rf /var/lib/apt/lists/* + postfix libsasl2-modules python3 python3-jsonschema ssl-cert ca-certificates && rm -rf /var/lib/apt/lists/* RUN useradd -r -s /usr/sbin/nologin mas COPY mas_core /app/mas_core COPY mas_gateway /app/mas_gateway diff --git a/deploy/railiance/entrypoint.sh b/deploy/railiance/entrypoint.sh index 5b1018b..2717d76 100644 --- a/deploy/railiance/entrypoint.sh +++ b/deploy/railiance/entrypoint.sh @@ -41,6 +41,28 @@ postconf -e \ "smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem" \ "smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key" \ "inet_protocols=ipv4" "compatibility_level=3.6" +# start-fg does not populate the chroot (no resolv.conf), so DNS fails inside +# it: client rDNS shows "unknown" and a relayhost would not resolve. The +# container already isolates Postfix, so run the daemons unchrooted. +postconf -F '*/*/chroot = n' + +# Outbound replies (reply test). Port 25 out is blocked on railiance01, so +# replies go through an authenticated submission relay, and only when its +# credentials are mounted. Only loopback (the ticket service) may relay. +# Without a relay all non-local mail fails fast instead of queueing. +SMTP_ARG="" +if [ -n "$MAS_RELAY" ] && [ -s /etc/mas-relay/username ]; then + printf '%s %s:%s\n' "$MAS_RELAY" "$(cat /etc/mas-relay/username)" \ + "$(cat /etc/mas-relay/password)" > /etc/postfix/sasl_passwd + chmod 600 /etc/postfix/sasl_passwd && postmap /etc/postfix/sasl_passwd + postconf -e "relayhost=$MAS_RELAY" "smtp_sasl_auth_enable=yes" \ + "smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd" \ + "smtp_sasl_security_options=noanonymous" "smtp_tls_security_level=secure" \ + "smtp_tls_CApath=/etc/ssl/certs" + SMTP_ARG="--smtp 127.0.0.1:25" +else + postconf -e "default_transport=error:5.7.1 outbound mail disabled" +fi cat >> /etc/postfix/master.cf <