test / test (push) Canceled after 0s
Both reviews were of c171fb5, read-only, given the code and questions.
Found by both, and the one that would have refused ordinary mail from the
first day: a folded From: line - what a mail library makes of a long display
name - did not parse and was refused with 550. The line is unfolded before it
is read. e2e sends one through Postfix now.
Technical (Opus)
- A display name in a charset Go does not convert (windows-1251, koi8-r) was
refused: such a name is passed through unread, only the address is judged.
- The statistics ran between binding the socket and serving it, with a
supervisorctl that has no timeout: they are kept beside the check now and
nothing of them is waited for. A supervisorctl that fails is logged.
- The count of deferred mail followed smtpd's reject lines and so missed a
check that stops answering in the middle of a message, where cleanup
writes them: it is taken at Postfix's warning, the line that names the
socket. The test line for that case had been invented with the wrong
process; it is marked as composed from Postfix's source.
- A card whose figures could not be read showed zeros and "ok": dashes and
"unknown".
- entrypoint removes the sockets a killed container left, which satisfied
the wrapper's wait before the check was listening.
- Outside quoted strings the line may hold one "@" only - a rule that needs
no knowledge of OpenDKIM's parser.
- Comments that still spoke of two sockets, or of a session replaced after a
refusal; the limits of the cards layout on a phone, said where it is defined.
Security (Fable; no Critical or High)
- Another sender's name in an encoded display name passed the second look:
the decoded name is looked at as well.
- A client could arm the deferred counter by sending the socket's name where
Postfix quotes it in a warning: the two warnings are matched from their
first word.
- A refused message wrote a row per recipient: one row, naming the first
recipient and how many more.
- Docs: the check's lookup is stricter than Postfix's for address extensions
and the case of logins, rather than "cannot disagree"; what a display name
looks like to a person is not promised; the timeouts and the 454 at AUTH
stated as they are; "messages" are connections turned away.
Left as found, in the plan: downtime that crosses midnight is booked on the
day of the restart; a message with the null envelope sender leaves a row
without a domain; a log read again after an unclean stop counts again.
Test server, this tree: go vet ok, go test 23 packages ok, make e2e ok (330 s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# Postfix start wrapper: solves the cold-start race where Postfix would try to
|
|
# reach the milter sockets before they are listening.
|
|
#
|
|
# It blocks until the milter sockets — OpenDKIM, the panel's sender check and
|
|
# journal-milter and, with the inbound relay on, its inbound journal milter —
|
|
# are present,
|
|
# then execs `postfix start-fg`. If they are not ready within the
|
|
# timeout it exits non-zero WITHOUT starting Postfix, so supervisord/Docker see
|
|
# an explicit startup failure instead of a relay running blind.
|
|
#
|
|
# This handles cold start only. Once Postfix runs, a milter that does not
|
|
# answer costs what its default_action says (build/postfix-config.sh): mail is
|
|
# deferred for OpenDKIM and the sender check, and passes the journal-milter.
|
|
set -eu
|
|
|
|
OPENDKIM_SOCK="${OPENDKIM_SOCKET:-/run/opendkim/opendkim.sock}"
|
|
JOURNAL_SOCK="${JOURNAL_MILTER_SOCKET:-/run/selfpost/journal.sock}"
|
|
SENDER_SOCK="${SENDER_CHECK_SOCKET:-/run/selfpost/sender.sock}"
|
|
TIMEOUT="${MILTER_WAIT_TIMEOUT:-30}"
|
|
INTERVAL=1
|
|
|
|
SOCKS="$OPENDKIM_SOCK $JOURNAL_SOCK $SENDER_SOCK"
|
|
if [ "${INBOUND_RELAY_ENABLE:-false}" = "true" ]; then
|
|
SOCKS="$SOCKS ${INBOUND_JOURNAL_MILTER_SOCKET:-/run/selfpost/inbound-journal.sock}"
|
|
fi
|
|
|
|
elapsed=0
|
|
for sock in $SOCKS; do
|
|
while [ ! -S "$sock" ]; do
|
|
if [ "$elapsed" -ge "$TIMEOUT" ]; then
|
|
echo "postfix-wrapper: timed out after ${TIMEOUT}s waiting for milter socket $sock" >&2
|
|
exit 1
|
|
fi
|
|
sleep "$INTERVAL"
|
|
elapsed=$((elapsed + INTERVAL))
|
|
done
|
|
echo "postfix-wrapper: milter socket ready: $sock"
|
|
done
|
|
|
|
echo "postfix-wrapper: milter sockets ready, starting postfix"
|
|
exec postfix start-fg
|