Postfix Configuration and Administration-Handout
Postfix Configuration and Administration-Handout
c
°2007 Patrick Koetter & Ralf Hildebrandt
state-of-mind
LISA’07
Dallas, November 2007
SMTP
SMTP
UUCP LMTP
Postfix
QMQP local
pipe
sendmail
Postfix is a router
Postfix is a firewall
maildrop
sendmail
master
anvil
cleanup trivial-rewrite
resolve
tlsmgr qmgr
bounce/
defer
active deferred
local virtual
smtp/ pipe
lmtp
scache
aliases
virtual
generic
canonical
relocated
transports
Postfix Configuration and Administration
Maps
Typical map names
access
header_checks
body_checks
mime_header_checks
nested_header_checks (obscure)
Postfix Configuration and Administration
Maps
Map Types
Linear Maps
Indexed Maps
Dynamic Maps
Network Maps
[email protected]
[email protected]
subdomain.domain.tld
domain.tld
tld
localpart+extension@
localpart@
no match found
Postfix Configuration and Administration
Maps
Virtual and canonical Map evaluation order
[email protected]
[email protected]
localpart+extension
localpart
@subdomain.domain.tld
no match found
[email protected]
[email protected]
subdomain.domain.tld
domain.tld
tld
*
no match found
Postfix Configuration and Administration
Configuration files
LAN Internet
1122
server certificate
smtpd_tls_security_level = may
smtpd_tls_loglevel = 0
smtpd_tls_received_header = yes
smtpd_tls_key_file = /etc/postfix/smtp.key
smtpd_tls_cert_file = /etc/postfix/smtp.pem
smtpd_tls_CApath = /etc/pki/cacerts/
smtpd_tls_dh1024_param_file = /etc/postfix/dh_1024.pem
smtpd_tls_dh512_param_file = /etc/postfix/dh_512.pem
smtpd_tls_session_cache_database =
btree:/var/spool/postfix/smtpd_scache
smtpd_tls_session_cache_timeout = 10800s
Postfix Configuration and Administration
Transport Layer Security
Client-Side TLS
smtp_tls_security_level = may
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_loglevel = 0
smtp_tls_key_file = /etc/postfix/smtp.key
smtp_tls_cert_file = /etc/postfix/smtp.pem
smtp_tls_CApath = /etc/pki/cacerts/
smtp_tls_session_cache_database =
btree:/var/spool/postfix/smtp_scache
smtp_tls_session_cache_timeout = 10800s
smtpd_tls_ask_ccert = yes
smtpd_recipient_restrictions =
...
permit_mynetworks
check_ccert_access hash:/etc/postfix/relay_certificates
reject_unauth_destination
...
Postfix Configuration and Administration
Multi-domain configurations
What’s in a namespace?
relay_domains = hash:/etc/postfix/relay_domains
per-domain transport
search_base = ou=people,dc=example,dc=com
query_filter = (|(&(mail=%s)(proxy=TRUE))(maildrop=%s))
result_format = mailstore:[%s]
result_attribute = proxyHostname
Moment of evaluation
smtpd_delay_reject = no . . .
} 250 Ok
smtpd_client_restrictions,
smtpd_helo_restrictions, RCPT TO:<[email protected]> smtpd_recipient_restrictions
smtpd_sender_restrictions,
smtpd_recipient_restrictions
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: "Sender" <[email protected]>
To: "Recipient" <[email protected]>
Date: Sat, 17 May 2005 15:24:43 +0200
Order of processing
The order in which single restrictions are listed is important:
Mailclient SMTP
smtpd_client_restrictions
OK, PERMIT
default
REJECT
restriction
OK, PERMIT
OK, PERMIT
smtpd_sender_restrictions
OK, PERMIT
default
REJECT
restriction
OK, PERMIT
OK, PERMIT
smtpd_..._restrictions
OK, PERMIT
default
REJECT
restriction
OK, PERMIT
OK, PERMIT
Postfix Configuration and Administration
Controlling message flow
Policy Services
mailserver
smtpd policyd
cleanup
qmgr
Internet
mailserver mailserver
Email content
Header
Body
Attachment header
Attachment body
Mailserver Mailserver
cleanup
after-filter
smtpd
cleanup
Filter
qmgr
qmgr
Internet Internet
smtpd_milters
non_smtpd_milters
smtpd_milters
This is the most recent addition to Postfix. That way you can
add the buggyness of Sendmail to Postfix.
No really, every milter I touched so far has been crap.
Postfix Configuration and Administration
Controlling message flow
Milters