mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-06 01:40:19 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
7aeed796c8
commit
65a884beba
1 file changed
+4
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user