Files
bongo/docs/tls.md
T
Mario Fetka cf88aa3a9b
Debian Trixie package bundle / packages (push) Successful in 14m54s
Enforce SMTP MTA-STS destination policies
2026-07-21 08:36:33 +02:00

4.4 KiB

TLS policy

Bongo offers TLS 1.3 and TLS 1.2 by default. Older protocol versions are only available on listeners whose explicit legacy-TLS option is enabled. Keep those listeners restricted to trusted legacy networks; do not expose them directly to the Internet.

The SMTP delivery agent uses opportunistic STARTTLS. When a peer offers STARTTLS, it encrypts the connection. outbound_tls_verify additionally verifies the certificate chain against the system trust store and verifies the connected MX or configured LMTP host name. It defaults to false, because public Internet MX servers cannot universally be assumed to have a usable public-PKI certificate. Enable it for a closed set of known destinations.

outbound_tls_required defaults to false, so delivery remains possible to SMTP servers which do not offer STARTTLS. Enabling it defers mail instead of sending plaintext. It is a global policy and should only be enabled when every configured destination is known to support TLS.

outbound_dane_enabled defaults to true. RFC 7672 DANE is activated only when both the MX and the address used for the connection were authenticated by DNSSEC and the TLSA lookup is independently DNSSEC-validated by GnuTLS/libdane. A secure usable DANE-EE(3) or DANE-TA(2) record makes STARTTLS and DANE authentication mandatory; DANE-TA also checks the MX and original next-hop names. PKIX-TA(0) and PKIX-EE(1) records do not become SMTP DANE trust anchors. A secure TLSA RRset containing no usable SMTP records still makes TLS mandatory. Bogus or indeterminate DNSSEC results defer delivery. Insecure DNS or securely proven TLSA absence leaves the existing opportunistic STARTTLS policy in place.

outbound_mta_sts_enabled also defaults to true. When DANE is inactive, Bongo discovers the RFC 8461 policy at _mta-sts.<domain>, downloads it only over certificate-validated HTTPS, and keeps the validated policy in outbound_mta_sts_cache_directory. An enforce policy permits only listed MX hosts and requires authenticated TLS 1.2 or newer; policy, certificate, STARTTLS, and handshake failures defer delivery without a plaintext retry. A testing policy records the same failures without changing delivery. A valid cached policy remains authoritative through its max_age when DNS discovery or HTTPS refresh temporarily fails. DANE always takes precedence over MTA-STS.

The resolver named in resolv.conf must therefore be a trusted validating resolver reached over a trusted local path; Bongo must not trust an AD bit received from an untrusted network resolver. GnuTLS/libdane also needs its DNSSEC root trust anchor installed by the operating system.

External-account collection and submission use libcurl and independently verify certificates and host names by default. See external-accounts.md for the credential and provider policy.

Initial setup stores the default certificate and key as /etc/bongo/ssl.d/server.crt and /etc/bongo/ssl.d/server.key. The key is root-owned, group-readable by Bongo, and never world-readable. Setup creates a 3072-bit RSA self-signed certificate only when no pair exists. A complete existing pair is parsed and checked for a matching key before reuse; unsafe, invalid, or incomplete material fails closed.

The bongoworker ACME job implements RFC 8555 directly. It honors CA Retry-After limits and renewal information, writes candidate material first, validates the complete certificate/key pair, then deploys it atomically and signals the manager to reload TLS listeners. HTTP-01 is the default. DNS-01 publishes base64url(SHA-256(keyAuthorization)), waits for the exact TXT value through ldns, and removes only the value created for that authorization.

For DNS-01, /etc/bongo/acme.d/providers selects the longest matching zone. Use type: "nsupdate" for the native RFC 2136 adapter; rfc2136 is an alias. No external nsupdate process is used. The adapter supports SOA-primary discovery, explicit IPv4/IPv6 or host-name servers, non-default ports, and TSIG HMAC algorithms. Delegated CNAME challenges use match_zone, challenge_alias, and the provider's target zone. Installed examples are in /usr/share/bongo/examples/acme.

bongo-admin migrate moves the historical osslcert.pem and osslpriv.pem pair from the state database directory into ssl.d only when both files are present and the destination is empty. ACME deployments should atomically install a complete pair and reload or restart the affected Bongo agents.