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 {% if 'letsencrypt' in group_names %}
11 # TLS server parameters
12 smtpd_tls_cert_file=/etc/ssl/mycerts/letsencrypt/live.crt+chain
13 smtpd_tls_key_file=/etc/ssl/private/letsencrypt/live.key
14 smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
15 smtpd_tls_security_level = may
16 smtpd_tls_loglevel = 1
17 smtpd_tls_dh1024_param_file = /etc/ssl/dh2048.pem
18 smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
19 smtpd_tls_ciphers = low
20 smtpd_tls_mandatory_ciphers = high
22 # TLS client parameters
23 smtp_tls_mandatory_protocols = !SSLv2 !SSLv3
24 smtp_tls_ciphers = low
25 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
27 {% if 'unbound' in group_names %}
28 # If there are TLSA records, enforce using encryption
29 smtp_dns_support_level = dnssec
30 smtp_tls_security_level = dane
33 {% if postfix.postscreen | default(False) %}
35 postscreen_dnsbl_threshold = 3
36 postscreen_dnsbl_whitelist_threshold = -2
37 postscreen_dnsbl_sites =
38 ix.dnsbl.manitu.net*2 sbl-xbl.spamhaus.org*2
39 bl.spamcop.net dnsbl.sorbs.net bl.mailspike.net
40 swl.spamhaus.org*-2 list.dnswl.org=127.0.[0..255].[0..254]*-2
41 postscreen_greet_action = enforce
42 postscreen_dnsbl_action = enforce
43 postscreen_pipelining_enable = yes
44 postscreen_non_smtp_command_enable = yes
45 postscreen_bare_newline_enable = yes
48 # control relay access
49 smtpd_relay_restrictions = permit_mynetworks, permit_tls_clientcerts,
51 defer_unauth_destination
52 # spam-protection restrictions
53 smtpd_helo_required = yes
54 smtpd_recipient_restrictions = permit_mynetworks, permit_tls_clientcerts,
55 # check everybody else
56 reject_unauth_pipelining,
57 reject_invalid_helo_hostname,
58 reject_non_fqdn_recipient,
59 reject_non_fqdn_sender,
61 {% if postfix.relay_host is defined %}
63 default_transport = smtp:{{ postfix.relay_host }}
64 {% if postfix.relay_client_cert is defined %}
65 # Enforce relay encryption
66 smtp_tls_cert_file=$config_directory/{{ postfix.relay_client_cert }}.crt
67 smtp_tls_key_file=$config_directory/{{ postfix.relay_client_cert }}.key
68 smtp_tls_security_level = encrypt
72 {% if postfix.submission | default(False) %}
74 smtpd_sasl_type = dovecot
75 smtpd_sasl_path = private/auth
78 {% if postfix.relay_client_cert_whitelist is defined %}
79 # allow relay for some TLS-authenticated clients
80 smtpd_tls_ask_ccert = yes
81 smtpd_tls_fingerprint_digest = sha1
82 relay_clientcerts = hash:$config_directory/relay_clientcerts
85 # setup virtual delivery domains, aliases and destinations
86 virtual_mailbox_domains =
87 {% if postfix.mailman is defined %} {% for item in postfix.mailman.domains %} {{item}}{% endfor %}{% endif %}
88 {% if postfix.dovecot is defined %} {% for item in postfix.dovecot.domains %} {{item}}{% endfor %}{% endif %}
90 virtual_alias_maps = hash:$config_directory/virtual_alias_map
91 {% if postfix.dovecot is defined %}
92 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
95 virtual_mailbox_maps =
96 {% if postfix.dovecot is defined %}
97 proxy:mysql:$config_directory/mysql_vmail_users.cf
99 {% if postfix.mailman | default(False) %}
100 hash:/var/lib/mailman/data/virtual-mailman
103 smtpd_sender_login_maps =
104 {% if postfix.dovecot is defined %}
105 proxy:mysql:$config_directory/mysql_vmail_users.cf
106 proxy:mysql:$config_directory/mysql_vmail_senders.cf
107 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
110 proxy_read_maps = $virtual_alias_maps $virtual_mailbox_maps $smtpd_sender_login_maps
112 # setup mail routes for virtual mail: all mail ends up being forwarded somewhere
113 virtual_transport = error
114 transport_maps = hash:$config_directory/transport_map
115 {% if postfix.mailman | default(False) %}
116 mailman_destination_recipient_limit = 1
119 {% if postfix.smtp_outgoing is defined %}
120 # send mail via specific IP
121 default_transport = {{ postfix.default_smtp_outgoing }}
122 sender_dependent_default_transport_maps = hash:$config_directory/sender_transport_map
125 {% if postfix.opendkim is defined %}
127 milter_default_action = accept
128 # Path must match opendkim.env
129 smtpd_milters = unix:opendkim/sock
130 non_smtpd_milters = $smtpd_milters
134 smtpd_delay_reject = yes
135 disable_vrfy_command = yes
136 recipient_delimiter = +
137 delay_warning_time = 4h
138 message_size_limit = 21384000