openship icon indicating copy to clipboard operation
openship copied to clipboard

[Bug] Mail health check: three false positives (SpamAssassin daemon, desktop-resolver DNS scan, DKIM baseline)

Open tizerluo opened this issue 4 months ago • 1 comments

Summary

The mail server's 健康状态 / Health tab flags four problems, but after verifying each one on the server, three of them are false positives in the health check itself (the fourth, missing PTR, is a genuine and correctly-reported gap). Details below with evidence.

False positive 1 — "SpamAssassin not installed"

The check looks for a standalone spamassassin systemd unit, which indeed doesn't exist — but that's the standard iRedMail architecture: SpamAssassin runs inside amavisd-new, not as a separate daemon. Spam scoring is verifiably working; amavis log lines on the same server show SA scores and test lists for every message, e.g.:

Passed CLEAN {RelayedInbound}, ... Hits: 1.073, ... Tests: [DKIM_SIGNED=0.1, DKIM_VALID=-0.1, ...]

Expected: the check should probe SA-through-Amavis (e.g. presence of @bypass_spam_checks_maps config / SA version via amavisd, or a scored test message) instead of looking for spamassassin.service.

False positive 2 — A / AAAA "resolves to the wrong address"

The DNS scan runs on the desktop through the local system resolver. On machines behind a fake-IP proxy (Clash / sing-box — common on macOS), the resolver returns synthetic addresses, which is exactly what the UI showed:

  • A: expected 96.9.210.140, got 198.18.1.202 (198.18.0.0/15 = fake-IP pool)
  • AAAA: expected 2402:a7c0:8100:a017::8db:a, got fdfe:dcba:9876::11a (ULA fake range)

Querying the authoritative nameservers via DNS-over-HTTPS shows both records are exactly the expected values — the zone is correct, the measurement is polluted.

Expected: run the DNS scan server-side, or resolve via DoH against the zone's authoritative NS, rather than trusting the desktop's resolver.

False positive 3 — "DKIM TXT doesn't match the key generated at install"

We extracted the public key from the server's actual DKIM private key (/var/lib/dkim/<domain>.pem):

openssl rsa -in /var/lib/dkim/<domain>.pem -pubout -outform DER | openssl base64 -A

and compared it byte-for-byte with the TXT record published at dkim._domainkey.<domain>: identical, all 392 base64 characters. DKIM also verifies in real mail flow (receivers report DKIM_VALID / dkim:AUTHOR). So the install-time baseline the check compares against is wrong, or the comparison doesn't normalize whitespace/line-splitting in multi-string TXT records.

The one genuine finding

PTR missing — correctly reported. 96.9.210.140 has no rDNS. Impact is low here because all outbound mail relays through Amazon SES, but the report itself is accurate and useful.

Additional observations (not health-check items, hit during the same deployment)

  • Installer prompts have no CLI response channel. When the installer hits an interactive gate (e.g. edge_conflict when ports 80/443 are taken), the CLI can only wait for the 5-minute timeout and fail. The response endpoint POST /api/system/install/respond exists and works (we answered the prompt via curl), but it isn't surfaced in the CLI or docs.
  • iRedMail disables UFW during install and the wizard doesn't re-enable it afterwards — the server is left without a firewall until the operator notices.
  • POST /api/system/check is undocumented — we located it via strings in the openship-api binary after the intuitive routes (/api/system/servers/:id/check, /api/system/servers/check) returned 404.

Environment

  • OpenShip desktop v0.3.0 on macOS (local resolver behind a fake-IP proxy)
  • Mail server: Ubuntu 26.04 LTS, iRedMail 1.8.1 deployed by the OpenShip Email app, Amavis 2.13.0

Happy to re-run any check against our live server if useful.

tizerluo avatar Jul 26 '26 09:07 tizerluo

Reviewed against current main, including the additional observations. The reported code defects are already addressed:

  • Standalone spamd is informational: Amavis supplies the filtering pipeline, so a missing standalone daemon does not mark it unhealthy.
  • DNS checks query public resolvers. Fake-IP A/AAAA answers are reported as unknown, rather than falsely blaming the published zone.
  • DKIM matching normalizes whitespace and split TXT strings while continuing to flag a different key.
  • The current mail installer runs the mail engine in its container and opens required ports through the existing host firewall; it no longer runs iRedMail.sh on the host. This does not retroactively restore firewall settings changed by an old installation.
  • Interactive gates can be answered with openship server install-respond <sessionId> --action <action>. openship server check <serverId> and the underlying /api/system/check endpoint are documented.

The DNS, health and firewall regression suites pass. Closing this historical report; an incorrect current-server DKIM baseline would need a new reproduction with the expected/public values redacted to their hashes, rather than changing working DNS records.

Hydralerne avatar Sep 16 '26 04:09 Hydralerne