From 7d86e0ad1e75a5e43e9f7692535c10efb08539f5 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 5 Oct 2026 21:55:46 -0700 Subject: [PATCH] fix(mailu): cert refresh no longer dies silently on OpenSSL 3.5 (#140) On the new bbs box (Ubuntu 26.04, OpenSSL 3.5.5) agentbbs-mailu-certs failed on every run with a bare exit 1. `openssl s_client -quiet` prints no certificate there, so `openssl x509` read nothing, the probe pipeline failed under pipefail, and the `on_wire=$(served_not_after)` assignment ended the script under set -e before it logged anything. Drop -quiet, and make the probe best-effort with `|| true` so a failed read-back can never be what fails the run. Without this fix, Caddy's next renewal of mail.profullstack.com would never reach Mailu, the same way join@ codes broke on 2026-09-13. Tested on the box: exits 0, "already current (expires Nov 12 2026)". Co-authored-by: riotcoder Co-authored-by: Claude Opus 5.5 --- deploy/mailu/refresh-certs.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy/mailu/refresh-certs.sh b/deploy/mailu/refresh-certs.sh index 59e1237..39b2818 100755 --- a/deploy/mailu/refresh-certs.sh +++ b/deploy/mailu/refresh-certs.sh @@ -34,12 +34,17 @@ cert_not_after() { # notAfter of the cert the running relay serves over STARTTLS, or empty if the # probe can't be made (openssl missing, port closed, Mailu down). +# +# No -quiet: OpenSSL 3.5 (Ubuntu 26.04) then prints no certificate at all, so +# x509 read nothing, the pipeline failed under pipefail, and the assignment that +# calls this killed the whole script with a bare exit 1 before it said a word. +# The probe is best-effort, so it must never be what fails the run. served_not_after() { command -v openssl >/dev/null 2>&1 || return 0 - printf 'QUIT\r\n' \ - | timeout 10 openssl s_client -quiet -starttls smtp \ + { printf 'QUIT\r\n' \ + | timeout 10 openssl s_client -starttls smtp \ -connect "$PROBE_ADDR" -servername "$MAIL_HOST" 2>/dev/null \ - | openssl x509 -noout -enddate 2>/dev/null | sed 's/^notAfter=//' + | openssl x509 -noout -enddate 2>/dev/null | sed 's/^notAfter=//'; } || true } # Caddy stores certs under certificates///.{crt,key};