tweak email
[ansible.git] / roles / postfix / templates / main.cf
1 # local delivery: aliases only
2 alias_maps = hash:/etc/aliases
3 local_recipient_maps = $alias_maps
4 # only consider ourselves local
5 mynetworks_style = host
6 {% if postfix.mynetworks is defined %}
7 mynetworks = {{ postfix.mynetworks }}
8 {% endif %}
9
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
24 smtp_tls_loglevel = 1
25 {% if not(postfix.relay_host is defined) %}
26 smtp_tls_security_level = dane
27 smtp_dns_support_level = dnssec
28 {% endif %}
29
30 {% if postfix.relay_host is defined %}
31 # Relay everything
32 default_transport = smtp:{{ postfix.relay_host }}
33 {% if postfix.relay_client_cert is defined %}
34 # Enforce relay encryption
35 smtp_tls_cert_file=$config_directory/{{ postfix.relay_client_cert }}.crt
36 smtp_tls_key_file=$config_directory/{{ postfix.relay_client_cert }}.key
37 smtp_tls_security_level = encrypt
38 {% endif %}
39 {% endif %}
40
41 {% if postfix.postscreen is defined and postfix.postscreen %}
42 # postscreen config
43 postscreen_dnsbl_threshold = 3
44 postscreen_dnsbl_whitelist_threshold = -2
45 postscreen_dnsbl_sites =
46         ix.dnsbl.manitu.net*2 sbl-xbl.spamhaus.org*2
47         bl.spamcop.net dnsbl.sorbs.net bl.mailspike.net
48         swl.spamhaus.org*-2 list.dnswl.org=127.0.[0..255].[0..254]*-2
49 postscreen_greet_action = enforce
50 postscreen_dnsbl_action = enforce
51 postscreen_pipelining_enable = yes
52 postscreen_non_smtp_command_enable = yes
53 postscreen_bare_newline_enable = yes
54 {% endif %}
55
56 # control relay access
57 smtpd_relay_restrictions = permit_mynetworks, permit_tls_clientcerts,
58     # allow nobody else
59     defer_unauth_destination
60 # spam-protection restrictions
61 smtpd_helo_required = yes
62 smtpd_recipient_restrictions = permit_mynetworks, permit_tls_clientcerts,
63     # check everybody else
64     reject_unauth_pipelining,
65     reject_invalid_helo_hostname,
66     reject_non_fqdn_recipient,
67     reject_non_fqdn_sender,
68
69 # misc
70 smtpd_delay_reject = yes
71 disable_vrfy_command = yes
72 recipient_delimiter = +
73 delay_warning_time = 4h
74 message_size_limit = 21384000
75 append_dot_mydomain = no