1 compatibility_level = 2
3 # local delivery: aliases only
4 alias_maps = hash:/etc/aliases
5 local_recipient_maps = $alias_maps
6 {% if postfix.mynetworks is defined %}
7 mynetworks = {{ postfix.mynetworks }}
10 # TLS server parameters
11 smtpd_tls_cert_file=/etc/ssl/mycerts/letsencrypt/live.crt+chain
12 smtpd_tls_key_file=/etc/ssl/private/letsencrypt/live.key
13 smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
14 smtpd_tls_security_level = may
15 smtpd_tls_loglevel = 1
16 smtpd_tls_dh1024_param_file = /etc/ssl/dh2048.pem
17 smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
18 smtpd_tls_ciphers = low
19 smtpd_tls_mandatory_ciphers = high
20 # TLS client parameters
21 smtp_tls_mandatory_protocols = !SSLv2 !SSLv3
22 smtp_tls_ciphers = low
23 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
25 {% if not(postfix.relay_host is defined) %}
26 smtp_tls_security_level = dane
27 smtp_dns_support_level = dnssec
30 {% if postfix.postscreen | default(False) %}
32 postscreen_dnsbl_threshold = 3
33 postscreen_dnsbl_whitelist_threshold = -2
34 postscreen_dnsbl_sites =
35 ix.dnsbl.manitu.net*2 sbl-xbl.spamhaus.org*2
36 bl.spamcop.net dnsbl.sorbs.net bl.mailspike.net
37 swl.spamhaus.org*-2 list.dnswl.org=127.0.[0..255].[0..254]*-2
38 postscreen_greet_action = enforce
39 postscreen_dnsbl_action = enforce
40 postscreen_pipelining_enable = yes
41 postscreen_non_smtp_command_enable = yes
42 postscreen_bare_newline_enable = yes
45 # control relay access
46 smtpd_relay_restrictions = permit_mynetworks, permit_tls_clientcerts,
48 defer_unauth_destination
49 # spam-protection restrictions
50 smtpd_helo_required = yes
51 smtpd_recipient_restrictions = permit_mynetworks, permit_tls_clientcerts,
52 # check everybody else
53 reject_unauth_pipelining,
54 reject_invalid_helo_hostname,
55 reject_non_fqdn_recipient,
56 reject_non_fqdn_sender,
58 {% if postfix.relay_host is defined %}
60 default_transport = smtp:{{ postfix.relay_host }}
61 {% if postfix.relay_client_cert is defined %}
62 # Enforce relay encryption
63 smtp_tls_cert_file=$config_directory/{{ postfix.relay_client_cert }}.crt
64 smtp_tls_key_file=$config_directory/{{ postfix.relay_client_cert }}.key
65 smtp_tls_security_level = encrypt
69 {% if postfix.submission | default(False) %}
71 smtpd_sasl_type = dovecot
72 smtpd_sasl_path = private/auth
75 {% if postfix.relay_client_cert_whitelist is defined %}
76 # allow relay for some TLS-authenticated clients
77 smtpd_tls_ask_ccert = yes
78 smtpd_tls_fingerprint_digest = sha1
79 relay_clientcerts = hash:$config_directory/{{ postfix.relay_client_cert_whitelist }}
82 {% if postfix.virtual_mailbox_domains is defined %}
83 # setup virtual delivery domains, aliases and destinations
84 virtual_mailbox_domains = {{ postfix.virtual_mailbox_domains }}
85 virtual_alias_maps = hash:$config_directory/virtual_alias_map
86 {% if postfix.vmail_mysql_password is defined %}
87 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
90 virtual_mailbox_maps =
91 {% if postfix.vmail_mysql_password is defined %}
92 proxy:mysql:$config_directory/mysql_vmail_users.cf
94 {% if postfix.mailman | default(False) %}
95 hash:/var/lib/mailman/data/virtual-mailman
98 smtpd_sender_login_maps =
99 {% if postfix.vmail_mysql_password is defined %}
100 proxy:mysql:$config_directory/mysql_vmail_users.cf
101 proxy:mysql:$config_directory/mysql_vmail_senders.cf
102 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
105 proxy_read_maps = $virtual_alias_maps $virtual_mailbox_maps $smtpd_sender_login_maps
107 # setup mail routes for virtual mail: all mail ends up being forwarded somewhere
108 virtual_transport = error
109 transport_maps = hash:/etc/postfix/transport_map
110 mailman_destination_recipient_limit = 1
113 {% if postfix.opendkim is defined %}
115 milter_default_action = accept
116 # Path must match opendkim.env
117 smtpd_milters = unix:opendkim/sock
118 non_smtpd_milters = $smtpd_milters
122 smtpd_delay_reject = yes
123 disable_vrfy_command = yes
124 recipient_delimiter = +
125 delay_warning_time = 4h
126 message_size_limit = 21384000