The Anatomy of Modern Email Deliverability
| Protocol | Function | Failure Impact |
|---|---|---|
| SPF (Sender Policy Framework) | Declares which IPs are authorized to send mail for a domain. | Results in soft-fails or outright rejections if unaligned. |
| DKIM (DomainKeys Identified Mail) | Cryptographically signs headers and body to prove message integrity. | Invalid signatures trigger immediate spam classification. |
| DMARC (Domain-based Message Authentication) | Enforces policy based on SPF/DKIM alignment and handles reporting. | 'Reject' policies block spoofed mail entirely; 'none' yields telemetry. |
Hardening Postfix for Maximum Throughput and Security
main.cf configuration must enforce strict submission rules, TLS constraints, and milter integrations for real-time DKIM signing.
Production Postfix main.cf Configuration
TEXT
# Basic Identification
myhostname = mail.enterprise.internal
mydomain = enterprise.internal
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
# Relay and Destination Controls
mydestination = localhost.$mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
# TLS Hardening
smtpd_tls_security_level = encrypt
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_auth_only = yes
tls_high_cipherlist = EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+AES128:+AES256:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS
# Milter Integration for OpenDKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = inet:127.0.0.1:8891
# Rate Limiting and Anti-Abuse
smtpd_client_connection_rate_limit = 10
smtpd_recipient_limit = 50
default_destination_concurrency_limit = 20
default_destination_rate_delay = 1sConfiguring Dovecot IMAP/POP3 and LDA
dovecot.conf isolates authentication mechanics and enforces modern encryption standards:
TEXT
# /etc/dovecot/dovecot.conf snippet
protocols = imap lmtp
auth_mechanisms = plain login
ssl = required
ssl_min_protocol = TLSv1.2
ssl_cipher_list = EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
}
passdb {
driver = pam
}
userdb {
driver = passwd
}main.cf, route deliveries directly to Dovecot's LMTP socket:
TEXT
virtual_transport = lmtp:unix:private/dovecot-lmtpDNS Infrastructure: Implementing Strict DMARC and DKIM
TEXT
; SPF Record (Strictly limiting authorized senders)
@ IN TXT "v=spf1 ip4:192.0.2.50 -all"
; DKIM Selector Record (2048-bit RSA key)
mail._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQFAAOCAQ8AMIIBCgKCAQEAu..."
; DMARC Policy with Aggregate and Forensic Reporting
_dmarc IN TXT "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100"p=reject: Tells receiving servers to silently drop unauthenticated mail.adkim=sandaspf=s: Enforces strict alignment, meaning the header 'From' domain must match the DKIM signing domain and SPF return-path domain exactly.pct=100: Applies the policy to 100 percent of traffic immediately.
Monitoring, Feedback Loops, and Troubleshooting
p=reject DMARC policy, monitoring XML aggregate reports (rua) is critical. Tools like 'Parser for DMARC' or self-hosted scripts parse these reports to identify legitimate services you may have forgotten to authorize.
To verify your local Postfix and OpenDKIM pipeline in real time, inspect your system logs while dispatching a test email:
BASH
tail -f /var/log/mail.log | grep -E 'postfix|opendkim'