mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-11-29 15:31:53 +00:00
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 <riotcoder@profullstack.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9d6ecea017
commit
7d86e0ad1e
1 changed files with 8 additions and 3 deletions
|
|
@ -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/<acme-dir>/<host>/<host>.{crt,key};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue