Skip to content

mail-ingest: pin the mailserver certificate when it has expired - #31

Merged
tcoretech merged 1 commit into
hardening/2026-09-26from
fix/mail-ingest-pin-expired-cert
Nov 19, 2026
Merged

tcoretech merged 1 commit into
hardening/2026-09-26from
fix/mail-ingest-pin-expired-cert

Conversation

@tcoretech

@tcoretech tcoretech commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

mail-ingest verifies the mailserver certificate before it logs in (#29). If that certificate has expired, the login fails and inbound stops until it's renewed.

  • When the served certificate has expired, mailserver/secrets.sh records its SHA-256 (DER) fingerprint as MAIL_INGEST_TLS_FINGERPRINT. It clears the value once a valid certificate is served.
  • When the pin is set, mail-ingest trusts exactly that certificate and refuses anything else before sending the password. Otherwise it does normal CA and hostname verification.

Renewing the certificate is still the real fix; the pin only keeps inbound working in the meantime.

Tests: two new unit tests cover a matching pin and a mismatched one. One existing test, test_timestamp_more_than_five_minutes_in_the_future_is_rejected, is timing-sensitive on slow runs (int(time.time()) + 301 can land inside the window).

The mailserver serves the Let's Encrypt certificate Caddy used to renew.
Caddy left the stack and the certificate expired on 13 February, so
mail-ingest's verified STARTTLS fails and it will not log in.

While the certificate is expired, mailserver's secrets.sh records its
SHA-256 fingerprint and mail-ingest trusts exactly that certificate,
ignoring CA, name and dates. Any other certificate is refused before the
password is sent. Once a valid certificate is served the pin is cleared and
normal verification applies again, so renewal needs no change here.
@tcoretech
tcoretech merged commit 21b38a5 into hardening/2026-09-26 Nov 19, 2026
@tcoretech
tcoretech deleted the fix/mail-ingest-pin-expired-cert branch November 19, 2026 02:22
@tcoretech tcoretech changed the title mail-ingest: pin the mailserver certificate while it is expired mail-ingest: pin the mailserver certificate when it has expired Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant