From d102c7f7c7843bf367a732f121cfc38d078db7f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 19:48:40 +0000 Subject: [PATCH 1/2] Test outbound port 25 from the server in just check just check now connects from the server to Gmail's MX on port 25 over IPv4 and (if the server has an IPv6 route) IPv6, and reports open (220 banner) or BLOCKED, so a provider block (netcup Mail block, UpCloud, Serverspace, OVH anti-spam) is caught right after install instead of when mail goes missing. With relay.enable set, a block is reported as expected. Closes #15 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G22o7QQ17GRtkCqpJNFr9B --- scripts/check.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/check.sh b/scripts/check.sh index bbdee98..c604665 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -40,6 +40,34 @@ else bad "SMTP STARTTLS on port 25 (your own ISP may block outbound port 25)" fi +# Outbound SMTP, tested from the server itself: providers block port 25 +# (netcup's "Mail block" policy, UpCloud, OVH's anti-spam), and nothing else +# would tell you until mail silently stops arriving. +if [[ -f "$KNOWN_HOSTS" ]]; then + echo "Outbound SMTP (from the server)" + # shellcheck disable=SC2046 + results="$(ssh $(ssh_opts) -o ConnectTimeout=10 "root@$name" ' + for family in 4 6; do + if [ $family = 6 ] && [ -z "$(ip -6 route show default)" ]; then echo "6 none"; continue; fi + ip=$(getent ahostsv$family gmail-smtp-in.l.google.com | awk "NR==1{print \$1}") + if [ -z "$ip" ]; then echo "$family none"; continue; fi + banner=$(timeout 10 bash -c "exec 3<>/dev/tcp/$ip/25 && head -c 3 <&3" 2> /dev/null) + echo "$family ${banner:-fail} $ip" + done' 2> /dev/null || echo "ssh failed")" + while read -r family status target; do + case "$status" in + 220) ok "port 25 open over IPv$family (Gmail answered from $target)" ;; + none) [[ "$family" == 6 ]] && ok "no IPv6 route to test (IPv4-only server)" || bad "cannot resolve Gmail's MX over IPv$family" ;; + failed) bad "could not ssh to $name to test outbound SMTP" ;; + *) if tfvars | jq -e .relay.enable > /dev/null 2>&1; then + ok "port 25 over IPv$family is blocked, but relay.enable is set" + else + bad "port 25 to $target (IPv$family) is BLOCKED: ask the provider to open it, or set relay.enable" + fi ;; + esac + done <<< "${results/ssh failed/0 failed}" +fi + for domain in $(setting domains | jq -r '.[]'); do echo "Domain $domain" [[ "$(q MX "$domain")" == "10 $name." ]] && ok "MX -> $name" || bad "MX: '$(q MX "$domain")'" From ff6eb1c1beb6d77d7b35548d2f95b1aef7c35d50 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 19:48:50 +0000 Subject: [PATCH 2/2] check: read relay.enable from settings.nix Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G22o7QQ17GRtkCqpJNFr9B --- scripts/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check.sh b/scripts/check.sh index c604665..910c609 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -59,7 +59,7 @@ if [[ -f "$KNOWN_HOSTS" ]]; then 220) ok "port 25 open over IPv$family (Gmail answered from $target)" ;; none) [[ "$family" == 6 ]] && ok "no IPv6 route to test (IPv4-only server)" || bad "cannot resolve Gmail's MX over IPv$family" ;; failed) bad "could not ssh to $name to test outbound SMTP" ;; - *) if tfvars | jq -e .relay.enable > /dev/null 2>&1; then + *) if [[ "$(setting relay.enable)" == true ]]; then ok "port 25 over IPv$family is blocked, but relay.enable is set" else bad "port 25 to $target (IPv$family) is BLOCKED: ask the provider to open it, or set relay.enable"