From ab3346d1877334f2ffecf8be910050b492911924 Mon Sep 17 00:00:00 2001 From: tegwick Date: Sun, 18 Oct 2026 22:38:43 +0200 Subject: [PATCH] MAS-WP-0005-T11: OpenDKIM+OpenDMARC milters; forged A-R stripped by header_checks 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 | 41 +++++++++++++++++++ ...MAS-WP-0004-postfix-integration-profile.md | 8 ++-- workplans/MAS-WP-0005-spec-errata-v0-1-1.md | 23 ++++++++++- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/deploy/railiance/Dockerfile b/deploy/railiance/Dockerfile index 1724228..f5ace6d 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 libsasl2-modules python3 python3-jsonschema ssl-cert ca-certificates && rm -rf /var/lib/apt/lists/* + postfix libsasl2-modules opendkim opendmarc publicsuffix 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 390968e..3e85fd3 100644 --- a/deploy/railiance/entrypoint.sh +++ b/deploy/railiance/entrypoint.sh @@ -67,6 +67,47 @@ if [ -n "$MAS_RELAY" ] && [ -s /etc/mas-relay/username ]; then else postconf -e "default_transport=error:5.7.1 outbound mail disabled" fi + +# Sender authentication (spec 14 item 10). The MTA does SPF/DKIM/DMARC, since +# they need DNS; the gateway only reads Authentication-Results carrying our +# authserv-id. Postfix header_checks drop incoming A-R headers claiming that +# id; header_checks do not see milter-added headers, so only the milters' +# own results survive and a sender cannot forge a pass. (OpenDKIM's +# RemoveARFrom did not remove them in testing.) Annotate only: never reject, +# and accept mail if a milter is down. Loopback (the ticket service's +# replies) is skipped. Both milters run in the foreground: daemonized, +# OpenDKIM died on its first connection in this container. +mkdir -p /run/opendkim /run/opendmarc +chown opendkim:opendkim /run/opendkim && chown opendmarc:opendmarc /run/opendmarc +printf '127.0.0.1\n' > /etc/opendkim-peers +cat > /etc/opendkim.conf < /etc/opendmarc.conf < /etc/postfix/ar_strip.regexp +postconf -e "header_checks=regexp:/etc/postfix/ar_strip.regexp" "smtpd_milters=inet:127.0.0.1:8891,inet:127.0.0.1:8893" "non_smtpd_milters=" \ + "milter_default_action=accept" "milter_protocol=6" + cat >> /etc/postfix/master.cf <