From 19cd3ffad4874a812fb5ecbff636e15b0d0a7fc7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 17 May 2026 14:32:38 -0500 Subject: fix(cmail-setup-finish): verify both Bridge ports and dump status on failure The "verifying Bridge is listening" check used a regex `127\.0\.0\.1:(1143|1025)` against `ss -ltn` output. That matches if *either* port is listening, but the success message claims both are. So a half-broken Bridge (IMAP up, SMTP down or vice versa) would pass the check. I split the check into two greps and report which port is missing. When the check fails, the script now also prints the last 10 lines of `systemctl --user status protonmail-bridge` to stderr so the operator sees the service state immediately instead of being told to go run the command themselves. --- scripts/cmail-setup-finish.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/cmail-setup-finish.sh b/scripts/cmail-setup-finish.sh index 3e119f6..704b707 100755 --- a/scripts/cmail-setup-finish.sh +++ b/scripts/cmail-setup-finish.sh @@ -112,10 +112,16 @@ fi # 8. Verify info "verifying Bridge is listening" -if ss -ltn 2>/dev/null | grep -qE '127\.0\.0\.1:(1143|1025)'; then +listening="$(ss -ltn 2>/dev/null || true)" +missing="" +echo "$listening" | grep -q '127\.0\.0\.1:1143' || missing="$missing 1143 (IMAP)" +echo "$listening" | grep -q '127\.0\.0\.1:1025' || missing="$missing 1025 (SMTP)" +if [ -z "$missing" ]; then ok "127.0.0.1:1143 + :1025 LISTEN" else - err "Bridge isn't listening on the expected ports — check 'systemctl --user status protonmail-bridge'" + error_status="$(systemctl --user status protonmail-bridge --no-pager --lines=10 2>&1 || true)" + printf '%s\n' "$error_status" >&2 + err "Bridge isn't listening on:${missing}" fi echo -- cgit v1.2.3