]> git.somenet.org - root/pub/somesible.git/blob - roles/server/mail/postfix/files/default/main.cf
roles/server/mail/postfix
[root/pub/somesible.git] / roles / server / mail / postfix / files / default / main.cf
1 #
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2026 by someone <someone@somenet.org>
7 #
8
9 # Last time we extensively looked at our configuration.
10 compatibility_level=3.6
11
12
13 myhostname = mail.somenet.org
14 myorigin = mail.l
15 mydestination = mail.l, l, localhost, localhost.localdomain
16 mynetworks = 10.0.0.0/8 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
17
18
19 # incoming mail
20 smtpd_tls_chain_files =
21     /etc/ssl/letsencrypt/mail.somenet.org/privkey.pem,
22     /etc/ssl/letsencrypt/mail.somenet.org/fullchain.pem,
23     /etc/ssl/letsencrypt-rsa/mail.somenet.org/privkey.pem,
24     /etc/ssl/letsencrypt-rsa/mail.somenet.org/fullchain.pem
25 smtpd_tls_security_level = may
26 smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
27 smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
28 smtpd_tls_ciphers = high
29 smtpd_tls_mandatory_ciphers = high
30 smtpd_tls_loglevel = 1
31 smtpd_tls_received_header = yes
32 smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
33 smtpd_tls_auth_only = yes
34 # we override this for the "submission" service.
35 smtpd_sasl_auth_enable = no
36 smtpd_sasl_path = smtpd
37 smtpd_banner = $myhostname ESMTP $mail_name
38 smtpd_helo_required = yes
39 # fuck sec consult and their business "ethics".
40 smtpd_forbid_bare_newline = yes
41 smtpd_forbid_unauth_pipelining = yes
42 smtpd_discard_ehlo_keywords = chunking, silent-discard
43
44
45 # header cleanup + transport mapping
46 header_checks = regexp:/etc/postfix/header_checks_in.regexp
47 nested_header_checks =
48 transport_maps = hash:/etc/postfix/transport.map
49 #, hash:/var/lib/sympa/transport.map
50
51
52 # outgoing mail
53 smtp_tls_security_level = may
54 smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
55 smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
56 smtp_tls_ciphers = high
57 smtp_tls_mandatory_ciphers = high
58 smtp_tls_loglevel = 1
59 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
60 smtp_header_checks = regexp:/etc/postfix/header_checks_out.regexp
61
62
63 # tls - use openssl defaults (seem stronger)
64 tls_eecdh_auto_curves =
65 tls_ffdhe_auto_groups =
66 tls_config_file = none
67
68
69 # hosted domains
70 virtual_alias_domains = somenet.org
71 virtual_alias_maps = hash:/etc/postfix/virtual.map
72 #,ldap:/etc/postfix/virtual.ldap
73
74
75 # local delivery
76 mailbox_transport = lmtp:unix:/var/lib/cyrus/socket/lmtp
77 mailbox_size_limit = 209715200
78
79
80 #sympa
81 # todo: flip vmailbox und valias domains?
82 #virtual_mailbox_domains = lists.somenet.org
83 #virtual_mailbox_maps = hash:/etc/postfix/virtual.map, hash:/etc/postfix/transport.map, hash:/var/lib/sympa/transport.map
84
85
86 # random settings
87 biff = no
88 connection_cache_status_update_time = 3600
89 cyrus_sasl_config_path = /etc/postfix/sasl
90 inet_protocols=ipv4
91 message_size_limit = $mailbox_size_limit
92 recipient_delimiter = +
93 tls_preempt_cipherlist = yes
94
95 # take it easy.
96 default_destination_concurrency_limit = 2
97
98 # disable smtputf8 because of cyrus
99 smtputf8_enable = no
100
101
102 #########################################
103 # DONT BE AN OPEN RELAY. RESTRICT STUFF #
104 #########################################
105 smtpd_restriction_classes = HOLD_OK
106 HOLD_OK = check_client_access static:hold, permit
107
108
109 # 1. check every incomming connecting.
110 # we use master.cf to overridden this for the "submission" service to always require authentication:
111 #   smtpd_client_restrictions = permit_sasl_authenticated, reject
112 # we merge that into recipient and relay restrictions - no need to check everything multiple times.
113 #smtpd_client_restrictions =
114 #    permit_mynetworks,
115 #    permit_sasl_authenticated,
116 #    reject_unknown_client_hostname,
117 #    permit
118
119
120 # 2. check the helo of the incomming connection.
121 # we merge that into recipient and relay restrictions - no need to check everything multiple times.
122 # smtpd_helo_restrictions =
123 #    permit_mynetworks,
124 #    permit_sasl_authenticated,
125 #    reject_invalid_helo_hostname,
126 #    reject_unknown_helo_hostname,
127 #    permit
128
129
130 # 3. checks run after a connection issues "MAIL FROM"
131 # we merge that into recipient and relay restrictions - no need to check everything multiple times.
132 # smtpd_sender_restrictions =
133 #    check_sender_access regexp:/etc/postfix/sender_restrictions.regexp,
134 #    permit_mynetworks,
135 #    permit_sasl_authenticated,
136 #    reject_non_fqdn_sender,
137 #    reject_unknown_sender_domain,
138 #    permit
139
140
141 # 4a. checks run after a connection issues "RCPT TO"
142 smtpd_recipient_restrictions =
143     check_sender_access    regexp:/etc/postfix/rcpt_sender.regexp,
144     check_recipient_access regexp:/etc/postfix/rcpt_recipient.regexp,
145     permit_mynetworks,
146     permit_sasl_authenticated,
147     permit_auth_destination,
148     reject_invalid_helo_hostname,
149     reject_unauth_pipelining,
150     reject_unauth_destination,
151     reject_non_fqdn_sender,
152     reject_non_fqdn_recipient,
153     reject_unknown_client_hostname,
154     reject_unknown_helo_hostname,
155     reject_unknown_sender_domain,
156     reject_unknown_recipient_domain,
157     permit
158
159
160 # 4b. same as smtpd_recipient_restrictions but diffrent.
161 smtpd_relay_restrictions =
162     check_sender_access    regexp:/etc/postfix/rel_sender.regexp,
163     check_recipient_access regexp:/etc/postfix/rel_recipient.regexp,
164     check_sender_access    regexp:/etc/postfix/rcpt_sender.regexp,
165     check_recipient_access regexp:/etc/postfix/rcpt_recipient.regexp,
166     permit_mynetworks,
167     permit_sasl_authenticated,
168     permit_auth_destination,
169     reject_invalid_helo_hostname,
170     reject_unauth_pipelining,
171     reject_unauth_destination,
172     reject_non_fqdn_sender,
173     reject_non_fqdn_recipient,
174     reject_unknown_client_hostname,
175     reject_unknown_helo_hostname,
176     reject_unknown_sender_domain,
177     reject_unknown_recipient_domain,
178     permit
179
180
181 # 5. checks run after a connection issues "RCPT TO"
182 # we merge that into recipient and relay restrictions - no need to check everything multiple times.
183 # smtpd_data_restrictions =
184 #    permit_mynetworks,
185 #    permit_sasl_authenticated,
186 #    reject_unauth_pipelining,
187 #    permit