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 not(postfix.relay_host is defined) %}
28 smtp_tls_security_level = dane
29 smtp_dns_support_level = dnssec
32 {% if postfix.postscreen | default(False) %}
34 postscreen_dnsbl_threshold = 3
35 postscreen_dnsbl_whitelist_threshold = -2
36 postscreen_dnsbl_sites =
37 ix.dnsbl.manitu.net*2 sbl-xbl.spamhaus.org*2
38 bl.spamcop.net dnsbl.sorbs.net bl.mailspike.net
39 swl.spamhaus.org*-2 list.dnswl.org=127.0.[0..255].[0..254]*-2
40 postscreen_greet_action = enforce
41 postscreen_dnsbl_action = enforce
42 postscreen_pipelining_enable = yes
43 postscreen_non_smtp_command_enable = yes
44 postscreen_bare_newline_enable = yes
47 # control relay access
48 smtpd_relay_restrictions = permit_mynetworks, permit_tls_clientcerts,
50 defer_unauth_destination
51 # spam-protection restrictions
52 smtpd_helo_required = yes
53 smtpd_recipient_restrictions = permit_mynetworks, permit_tls_clientcerts,
54 # check everybody else
55 reject_unauth_pipelining,
56 reject_invalid_helo_hostname,
57 reject_non_fqdn_recipient,
58 reject_non_fqdn_sender,
60 {% if postfix.relay_host is defined %}
62 default_transport = smtp:{{ postfix.relay_host }}
63 {% if postfix.relay_client_cert is defined %}
64 # Enforce relay encryption
65 smtp_tls_cert_file=$config_directory/{{ postfix.relay_client_cert }}.crt
66 smtp_tls_key_file=$config_directory/{{ postfix.relay_client_cert }}.key
67 smtp_tls_security_level = encrypt
71 {% if postfix.submission | default(False) %}
73 smtpd_sasl_type = dovecot
74 smtpd_sasl_path = private/auth
77 {% if postfix.relay_client_cert_whitelist is defined %}
78 # allow relay for some TLS-authenticated clients
79 smtpd_tls_ask_ccert = yes
80 smtpd_tls_fingerprint_digest = sha1
81 relay_clientcerts = hash:$config_directory/relay_clientcerts
84 # setup virtual delivery domains, aliases and destinations
85 virtual_mailbox_domains =
86 {% if postfix.mailman is defined %} {% for item in postfix.mailman.domains %} {{item}}{% endfor %}{% endif %}
87 {% if postfix.dovecot is defined %} {% for item in postfix.dovecot.domains %} {{item}}{% endfor %}{% endif %}
89 virtual_alias_maps = hash:$config_directory/virtual_alias_map
90 {% if postfix.dovecot is defined %}
91 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
94 virtual_mailbox_maps =
95 {% if postfix.dovecot is defined %}
96 proxy:mysql:$config_directory/mysql_vmail_users.cf
98 {% if postfix.mailman | default(False) %}
99 hash:/var/lib/mailman/data/virtual-mailman
102 smtpd_sender_login_maps =
103 {% if postfix.dovecot is defined %}
104 proxy:mysql:$config_directory/mysql_vmail_users.cf
105 proxy:mysql:$config_directory/mysql_vmail_senders.cf
106 proxy:mysql:$config_directory/mysql_vmail_aliases.cf
109 proxy_read_maps = $virtual_alias_maps $virtual_mailbox_maps $smtpd_sender_login_maps
111 # setup mail routes for virtual mail: all mail ends up being forwarded somewhere
112 virtual_transport = error
113 transport_maps = hash:$config_directory/transport_map
114 {% if postfix.mailman | default(False) %}
115 mailman_destination_recipient_limit = 1
118 {% if postfix.smtp_outgoing is defined %}
119 # send mail via specific IP
120 default_transport = {{ postfix.default_smtp_outgoing }}
121 sender_dependent_default_transport_maps = hash:$config_directory/sender_transport_map
124 {% if postfix.opendkim is defined %}
126 milter_default_action = accept
127 # Path must match opendkim.env
128 smtpd_milters = unix:opendkim/sock
129 non_smtpd_milters = $smtpd_milters
133 smtpd_delay_reject = yes
134 disable_vrfy_command = yes
135 recipient_delimiter = +
136 delay_warning_time = 4h
137 message_size_limit = 21384000