- experiments/postfix-probe: Postfix 3.7 -> pipe -> mas-gateway -> ticket service in Docker; 14 address forms x 5 configurations. 13/14 arrive byte-identical everywhere; quoted "ticket=PR42" is unquoted in transit. Legacy bang/percent rewrites never fire for MAS addresses. - docs/experiment-review.md: Email infrastructure section with results - MAS-WP-0003: provider-side live test on a real subdomain (needs DNS/MX) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 623586@bnt-lap001 Assistant-Session: 10b30928-5b3b-4c11-9934-5ecca07367d8
42 lines
2.2 KiB
Bash
42 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# Repo is mounted read-only at /mas. PROFILE=defaults|mas-safe selects Postfix settings.
|
|
set -e
|
|
cat > /usr/local/bin/mas-gateway <<'SH'
|
|
#!/bin/sh
|
|
exec env PYTHONPATH=/mas python3 -m mas_gateway.main "$@"
|
|
SH
|
|
chmod +x /usr/local/bin/mas-gateway
|
|
|
|
postconf -e "maillog_file=/dev/stdout" "myhostname=mx.probe.test" "mydestination=" \
|
|
"relay_domains=great-service.example" "transport_maps=inline:{great-service.example=mas:}" \
|
|
"mynetworks=0.0.0.0/0" "smtpd_relay_restrictions=permit_mynetworks,reject" \
|
|
"mas_destination_recipient_limit=1" "recipient_delimiter=+" "compatibility_level=3.6"
|
|
# PROFILE: defaults - Postfix defaults; probe client is "remote" (no address rewriting)
|
|
# defaults-local - defaults, but every client gets the local rewrite context
|
|
# mas-safe-local - local rewrite context with swap_bangpath/allow_percent_hack off
|
|
# local-domain - domain served via mydestination (local delivery class), defaults
|
|
# local-domain-safe - local-domain with swap_bangpath/allow_percent_hack off
|
|
case "$PROFILE" in
|
|
local-domain*) postconf -e "relay_domains=" "transport_maps=" "mydestination=great-service.example" \
|
|
"local_transport=mas" "local_recipient_maps=" ;;
|
|
esac
|
|
case "$PROFILE" in
|
|
*-local) postconf -e "local_header_rewrite_clients=static:all" ;;
|
|
esac
|
|
case "$PROFILE" in
|
|
mas-safe*|*-safe) postconf -e "swap_bangpath=no" "allow_percent_hack=no" ;;
|
|
esac
|
|
cat >> /etc/postfix/master.cf <<'CF'
|
|
mas unix - n n - - pipe
|
|
flags=Rq user=mas argv=/usr/local/bin/mas-gateway
|
|
--statute /mas/examples/statute/great-service.example/.well-known/mas
|
|
pipe --app-url http://127.0.0.1:8024/mas-events --recipient ${recipient}
|
|
CF
|
|
# Postfix runs `mas-gateway` as user mas; the service needs a writable DB.
|
|
mkdir -p /var/lib/tickets && chown mas /var/lib/tickets
|
|
su -s /bin/sh mas -c "PYTHONPATH=/mas python3 /mas/examples/ticket_service/ticket_service.py \
|
|
--db /var/lib/tickets/t.sqlite3 --listen 0.0.0.0:8025" &
|
|
python3 /mas/experiments/postfix-probe/capture.py http://127.0.0.1:8025/mas-events &
|
|
echo "PROFILE=${PROFILE:-defaults}"
|
|
postconf swap_bangpath allow_percent_hack recipient_delimiter local_header_rewrite_clients
|
|
exec postfix start-fg
|