From 65a884beba0e8cac5bf05587e38d05abf6b2d0a3 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 8 Oct 2026 13:32:50 +0200 Subject: [PATCH] test(web-app-stalwart): require the relay denial code in the CLI probe The unauthenticated half of the relay probe passed on any 5xx answer. A server that refused the recipient for another reason would have counted as "relay denied". It now requires 550, the code Stalwart gives for a denied relay. Co-Authored-By: Claude Opus 5.5 (1M context) --- roles/web-app-stalwart/files/test/probe_mail.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/web-app-stalwart/files/test/probe_mail.py b/roles/web-app-stalwart/files/test/probe_mail.py index 9b859d87bf..11b280b121 100755 --- a/roles/web-app-stalwart/files/test/probe_mail.py +++ b/roles/web-app-stalwart/files/test/probe_mail.py @@ -41,6 +41,7 @@ TIMEOUT = 60 MAILBOXES = ("INBOX", "Junk Mail") EXTERNAL_RECIPIENT = "relay-probe@example.org" +RELAY_DENIED = 550 def unverified_context() -> ssl.SSLContext: @@ -62,10 +63,10 @@ def relay(host: str, sender: str, password: str) -> int: smtp.ehlo() smtp.mail(sender) anonymous, _ = smtp.rcpt(EXTERNAL_RECIPIENT) - if anonymous < 500: + if anonymous != RELAY_DENIED: print( - f"open relay: an unauthenticated session got {anonymous} " - f"for {EXTERNAL_RECIPIENT}", + f"relay not denied: an unauthenticated session got {anonymous} " + f"for {EXTERNAL_RECIPIENT}, expected {RELAY_DENIED}", file=sys.stderr, ) return 1