implement outgoing tls reports

we were already accepting, processing and displaying incoming tls reports. now
we start tracking TLS connection and security-policy-related errors for
outgoing message deliveries as well. we send reports once a day, to the
reporting addresses specified in TLSRPT records (rua) of a policy domain. these
reports are about MTA-STS policies and/or DANE policies, and about
STARTTLS-related failures.

sending reports is enabled by default, but can be disabled through setting
NoOutgoingTLSReports in mox.conf.

only at the end of the implementation process came the realization that the
TLSRPT policy domain for DANE (MX) hosts are separate from the TLSRPT policy
for the recipient domain, and that MTA-STS and DANE TLS/policy results are
typically delivered in separate reports. so MX hosts need their own TLSRPT
policies.

config for the per-host TLSRPT policy should be added to mox.conf for existing
installs, in field HostTLSRPT. it is automatically configured by quickstart for
new installs. with a HostTLSRPT config, the "dns records" and "dns check" admin
pages now suggest the per-host TLSRPT record. by creating that record, you're
requesting TLS reports about your MX host.

gathering all the TLS/policy results is somewhat tricky. the tentacles go
throughout the code. the positive result is that the TLS/policy-related code
had to be cleaned up a bit. for example, the smtpclient TLS modes now reflect
reality better, with independent settings about whether PKIX and/or DANE
verification has to be done, and/or whether verification errors have to be
ignored (e.g. for tls-required: no header). also, cached mtasts policies of
mode "none" are now cleaned up once the MTA-STS DNS record goes away.
This commit is contained in:
Mechiel Lukkien
2023-11-09 17:40:46 +01:00
parent df18ca3c02
commit 893a6f8911
58 changed files with 3246 additions and 504 deletions

View File

@ -179,9 +179,10 @@ describe-static" and "mox config describe-domains":
# Do not offer STARTTLS to secure the connection. Not recommended. (optional)
NoSTARTTLS: false
# Do not accept incoming messages if STARTTLS is not active. Can be used in
# combination with a strict MTA-STS policy. A remote SMTP server may not support
# TLS and may not be able to deliver messages. (optional)
# Do not accept incoming messages if STARTTLS is not active. Consider using in
# combination with an MTA-STS policy and/or DANE. A remote SMTP server may not
# support TLS and may not be able to deliver messages. Incoming messages for TLS
# reporting addresses ignore this setting and do not require TLS. (optional)
RequireSTARTTLS: false
# Do not announce the REQUIRETLS SMTP extension. Messages delivered using the
@ -391,6 +392,22 @@ describe-static" and "mox config describe-domains":
# E.g. Postmaster or Inbox.
Mailbox:
# Destination for per-host TLS reports (TLSRPT). TLS reports can be per recipient
# domain (for MTA-STS), or per MX host (for DANE). The per-domain TLS reporting
# configuration is in domains.conf. This is the TLS reporting configuration for
# this host. If absent, no host-based TLSRPT address is configured, and no host
# TLSRPT DNS record is suggested. (optional)
HostTLSRPT:
# Account to deliver TLS reports to. Typically same account as for postmaster.
Account:
# Mailbox to deliver TLS reports to. Recommended value: TLSRPT.
Mailbox:
# Localpart at hostname to accept TLS reports at. Recommended value: tls-reports.
Localpart:
# Mailboxes to create for new accounts. Inbox is always created. Mailboxes can be
# given a 'special-use' role, which are understood by most mail clients. If
# absent/empty, the following mailboxes are created: Sent, Archive, Trash, Drafts
@ -556,6 +573,11 @@ describe-static" and "mox config describe-domains":
# whole days in UTC. (optional)
NoOutgoingDMARCReports: false
# Do not send TLS reports. By default, reports about successful and failed SMTP
# STARTTLS connections are sent to domains if their TLSRPT DNS record requests
# them. Reports covering a 24 hour UTC interval are sent daily. (optional)
NoOutgoingTLSReports: false
# domains.conf
# NOTE: This config file is in 'sconf' format. Indent with tabs. Comments must be