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 <