3 ### Basic settings for distorted.org.uk Exim configuration
5 ### (c) 2012 Mark Wooding
8 ###----- Licensing notice ---------------------------------------------------
10 ### This program is free software; you can redistribute it and/or modify
11 ### it under the terms of the GNU General Public License as published by
12 ### the Free Software Foundation; either version 2 of the License, or
13 ### (at your option) any later version.
15 ### This program is distributed in the hope that it will be useful,
16 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ### GNU General Public License for more details.
20 ### You should have received a copy of the GNU General Public License
21 ### along with this program; if not, write to the Free Software Foundation,
22 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 ###--------------------------------------------------------------------------
27 SECTION(global, priv)m4_dnl
28 admin_groups = CONF_admin_groups
29 trusted_groups = CONF_trusted_groups
30 prod_requires_admin = false
32 SECTION(global, logging)m4_dnl
33 log_file_path = : syslog
38 syslog_duplication = false
39 syslog_timestamp = false
41 SECTION(global, daemon)m4_dnl
42 local_interfaces = <; CONF_interfaces
43 extra_local_interfaces = <; 0.0.0.0 ; ::0
45 SECTION(global, resource)m4_dnl
46 deliver_queue_load_max = 8
49 smtp_accept_queue = 32
50 smtp_accept_reserve = 4
51 smtp_load_reserve = 10
52 smtp_reserve_hosts = +trusted
54 SECTION(global, policy)m4_dnl
57 SECTION(global, users)m4_dnl
59 gecos_pattern = ([^,:]*)
61 SECTION(global, incoming)m4_dnl
63 rfc1413_query_timeout = 10s
64 received_header_text = Received: \
65 ${if def:sender_rcvhost \
66 {from $sender_rcvhost\n\t} \
67 {${if def:sender_ident \
68 {from ${quote_local_part:$sender_ident} }}}}\
69 by $primary_hostname \
70 (Exim $version_number)\
71 ${if def:tls_cipher {\n\t} { }}\
72 ${if def:received_protocol \
73 {with $received_protocol \
74 ${if def:tls_cipher {(cipher=$tls_cipher)}}}}\n\t\
75 ${if def:sender_address \
76 {(envelope-from $sender_address\
77 ${if def:authenticated_id \
78 {; auth=${quote_local_part:$authenticated_id}} \
79 {${if and {{def:authenticated_sender} \
80 {match_address{$authenticated_sender} \
81 {*@CONF_master_domain}}} \
82 {; auth=${quote_local_part:\
84 $authenticated_sender}}}}}})\n\t}}\
86 ${if def:received_for {\n\tfor $received_for}}
88 SECTION(global, smtp)m4_dnl
89 smtp_return_error_details = true
90 accept_8bitmime = true
92 SECTION(global, env)m4_dnl
95 SECTION(global, process)m4_dnl
96 extract_addresses_remove_arguments = false
97 headers_charset = utf-8
98 qualify_domain = CONF_master_domain
99 untrusted_set_sender = *
100 local_from_check = false
101 local_sender_retain = true
103 SECTION(global, bounce)m4_dnl
104 delay_warning = 1h : 24h : 2d
106 SECTION(global, tls)m4_dnl
107 tls_certificate = CONF_sysconf_dir/server.certlist
108 tls_privatekey = CONF_sysconf_dir/server.key
109 tls_advertise_hosts = ${if exists {CONF_sysconf_dir/server.key} {*}{}}
110 tls_dhparam = CONF_ca_dir/dh-param-2048.pem
111 tls_require_ciphers = ${if or {{={$received_port}{CONF_submission_port}} \
112 {match_ip {$sender_host_address}{+trusted}}} \
113 {CONF_good_ciphers} \
114 {CONF_acceptable_ciphers}}
115 tls_verify_certificates = CONF_ca_dir/ca.cert
116 tls_verify_hosts = ${if eq{$acl_c_mode}{submission} {} {+allnets}}
119 ###--------------------------------------------------------------------------
120 ### Access control lists.
122 SECTION(global, acl-after)
123 SECTION(global, acl)m4_dnl
125 SECTION(acl, misc)m4_dnl
127 ## Check that the caller's claimed identity is actually plausible.
128 ## This seems like it's a fairly effective filter on spamminess, but
129 ## it's too blunt a tool. Rather than reject, add a warning header.
130 ## Only we can't do this the easy way, so save it up for use in MAIL.
131 ## Also, we're liable to get a subsequent HELO (e.g., after STARTTLS)
132 ## and we should only care about the most recent one.
133 warn set acl_c_helo_warning = false
135 ${if and {{match_ip {$sender_host_address} \
136 {<; 127.0.0.0/8 ; ::1}} \
137 {match_domain {$sender_helo_name} \
138 {localhost : +thishost}}}}
140 ${if exists {CONF_sysconf_dir/helo.conf} \
141 {${lookup {$sender_helo_name} \
143 {CONF_sysconf_dir/helo.conf} \
145 {$sender_host_address} \
148 set acl_c_helo_warning = true
152 SECTION(global, acl)m4_dnl
153 acl_not_smtp_start = not_smtp_start
154 SECTION(acl, misc)m4_dnl
156 ## Record the user's name.
157 warn set acl_c_user = $sender_ident
158 set acl_m_user = $sender_ident
163 SECTION(global, acl)m4_dnl
165 SECTION(acl, mail)m4_dnl
168 ## If we stashed a warning header about HELO from earlier, we should
169 ## add it now. Only don't bother if the client has authenticated
170 ## successfully for submission (because we can't expect mobile
171 ## clients to be properly set up knowing their names), or it's one of
172 ## our own satellites (because they're either properly set up anyway,
173 ## or satellites using us as a smarthost).
174 warn condition = $acl_c_helo_warning
175 !condition = ${if eq{$acl_c_mode}{submission}}
177 WARNING_HEADER(BADHELO,
178 <:Client's HELO doesn't match its IP address.\n\t\
179 helo-name=$sender_helo_name \
180 address=$sender_host_address:>)
182 ## Always allow the empty sender, so that we can receive bounces.
185 ## Ensure that the sender looks valid.
186 require acl = mail_check_sender
188 ## If this is directly from a client then hack on it for a while.
189 warn condition = ${if eq{$acl_c_mode}{submission}}
190 control = submission/sender_retain
192 ## Insist that a local client connect through TLS.
193 deny message = Hosts within CONF_master_domain must use TLS
194 !condition = ${if eq{$acl_c_mode}{submission}}
198 ## Check that a submitted message's sender address is allowable.
199 require acl = mail_check_auth
201 SECTION(acl, mail-tail)m4_dnl
205 SECTION(acl, misc)m4_dnl
208 ## See whether there's a special exception for this sender domain.
209 accept senders = ${LOOKUP_DOMAIN($sender_address_domain,
210 {KV(senders, {$value}{})},
213 ## Ensure that the sender is routable. This is important to prevent
214 ## undeliverable bounces.
215 require message = Invalid sender; \
216 ($sender_verify_failure; $acl_verify_message)
222 SECTION(global, acl)m4_dnl
223 acl_smtp_connect = connect
224 SECTION(acl, connect)m4_dnl
226 SECTION(acl, connect-tail)m4_dnl
227 ## Configure variables according to the submission mode.
228 warn acl = check_submission
234 ## See whether this message needs hacking on.
235 accept !hosts = +thishost
236 !condition = ${if ={$received_port}{CONF_submission_port}}
237 set acl_c_mode = relay
239 ## Remember to apply submission controls.
240 warn set acl_c_mode = submission
245 SECTION(global, acl)m4_dnl
247 SECTION(acl, rcpt)m4_dnl
250 ## Reject if the client isn't allowed to relay and the recipient
251 ## isn't in one of our known domains.
252 require message = Relaying not permitted
255 ## Ensure that the recipient is routable.
256 require message = Invalid recipient \
257 ($recipient_verify_failure; $acl_verify_message)
260 SECTION(acl, misc)m4_dnl
262 ## Accept either if the client is allowed to relay through us, or if
263 ## we're the correct place to send this mail.
265 ## Known clients and authenticated users are OK.
266 accept hosts = CONF_relay_clients
267 accept authenticated = *
269 ## Known domains are OK.
270 accept domains = +public
272 ## Finally, domains in our table are OK, unless they say they aren't.
274 ${if exists{CONF_sysconf_dir/domains.conf} \
275 {partial0-lsearch; CONF_sysconf_dir/domains.conf}}
276 condition = DOMKV(service, {$value}{true})
278 ## Nope, that's not allowed.
281 SECTION(acl, rcpt-tail)m4_dnl
282 ## Everything checks out OK: let this one go through.
285 SECTION(global, acl)m4_dnl
287 SECTION(acl, data)m4_dnl
290 SECTION(acl, data-tail)m4_dnl
293 SECTION(global, acl)m4_dnl
294 acl_smtp_expn = expn_vrfy
295 acl_smtp_vrfy = expn_vrfy
296 SECTION(acl, misc)m4_dnl
298 accept hosts = +trusted
299 deny message = Suck it and see
302 ###--------------------------------------------------------------------------
303 ### Verification of sender address.
305 SECTION(acl, misc)m4_dnl
308 ## If this isn't a submission then it doesn't need checking.
309 accept condition = ${if !eq{$acl_c_mode}{submission}}
311 ## If the caller hasn't formally authenticated, but this is a
312 ## loopback connection, then we can trust identd to tell us the right
313 ## answer. So we should stash the right name somewhere consistent.
314 warn set acl_c_user = $authenticated_id
317 condition = ${if def:sender_ident}
318 set acl_c_user = $sender_ident
320 ## User must be authenticated by now.
321 deny message = Sender not authenticated
322 condition = ${if !def:acl_c_user}
324 ## Set the per-message authentication flag, since we now know that
325 ## there's a sensible value.
326 warn set acl_m_user = $acl_c_user
332 ###--------------------------------------------------------------------------
333 ### Common options for forwarding routers.
335 ## We're pretty permissive here.
336 m4_define(<:FILTER_BASE:>,
344 forbid_blackhole = false
345 check_ancestor = true:>)
347 ## Common options for forwarding routers at verification time.
348 m4_define(<:FILTER_VERIFY:>,
350 user = CONF_filter_user
351 forbid_filter_dlfunc = true
352 forbid_filter_logwrite = true
353 forbid_filter_perl = true
354 forbid_filter_readsocket = true
355 forbid_filter_run = true
356 file_transport = dummy
357 directory_transport = dummy
358 pipe_transport = dummy
359 reply_transport = dummy:>)
361 ## Transports for redirection filters.
362 m4_define(<:FILTER_TRANSPORTS:>,
363 <:file_transport = mailbox
364 directory_transport = maildir
365 pipe_transport = pipe
366 reply_transport = reply:>)
368 m4_define(<:FILTER_ROUTER:>,
375 FILTER_TRANSPORTS<::>$4:>)
378 ###--------------------------------------------------------------------------
381 SECTION(routers, alias)m4_dnl
382 ## Look up the local part in the address map.
387 user = CONF_filter_user
389 local_parts = nwildlsearch; CONF_alias_file
390 data = ${expand:$local_part_data}
391 SECTION(routers, alias-opts)m4_dnl
394 ###--------------------------------------------------------------------------
395 ### Some standard transports.
397 m4_define(<:USER_DELIVERY:>,
398 <:delivery_date_add = true
399 envelope_to_add = true
400 return_path_add = true:>)
402 m4_define(<:APPLY_HEADER_CHANGES:>,
403 <:headers_add = m4_ifelse(<:$1:>, <::>,
405 <:${if def:acl_m_hdradd{$acl_m_hdradd\n}}\
407 headers_remove = m4_ifelse(<:$2:>, <::>,
409 <:${if def:acl_m_hdrrm{$acl_m_hdrrm:}}\
412 SECTION(transports)m4_dnl
413 ## A standard transport for remote delivery. By default, try to do TLS, and
414 ## don't worry too much if it's not very secure: the alternative is sending
415 ## in plaintext anyway. But all of this can be overridden from the
416 ## `domains.conf' file. Annoyingly, the `tls_dh_min_bits' setting isn't
417 ## expanded before use, so we can't set it the obvious way. Instead, encode
418 ## it into the transport name. This is very unpleasant, of course.
422 tls_require_ciphers = CONF_acceptable_ciphers
423 tls_dh_min_bits = 508
424 tls_tempfail_tryclear = true
426 m4_define(<:SMTP_TRANS_DHBITS:>,
430 hosts_require_tls = DOMKV(tls-peer-ca, {*}{})
431 hosts_require_auth = \
432 ${if bool {DOMKV(require-auth, {$value}{false})} {*}{}}
433 tls_certificate = DOMKV(tls-certificate, {${expand:$value}}fail)
434 tls_privatekey = DOMKV(tls-private-key, {${expand:$value}}fail)
435 tls_verify_certificates = DOMKV(tls-peer-ca, {${expand:$value}}fail)
436 tls_require_ciphers = \
438 {${extract {${expand:$value}} \
439 { good = CONF_good_ciphers \
440 any = CONF_acceptable_ciphers } \
442 {${expand:$value}}}} \
443 {CONF_acceptable_ciphers})
445 tls_tempfail_tryclear = true:>)m4_dnl
447 SMTP_TRANS_DHBITS(508)
449 SMTP_TRANS_DHBITS(764)
451 SMTP_TRANS_DHBITS(1020)
453 SMTP_TRANS_DHBITS(2044)
455 ## Transport to a local SMTP server; use TLS and perform client
460 hosts_require_tls = *
461 tls_certificate = CONF_sysconf_dir/client.certlist
462 tls_privatekey = CONF_sysconf_dir/client.key
463 tls_verify_certificates = CONF_ca_dir/ca.cert
464 tls_require_ciphers = CONF_good_ciphers
465 tls_dh_min_bits = 2046
466 tls_tempfail_tryclear = false
467 authenticated_sender_force = true
468 authenticated_sender = \
469 ${if def:acl_m_user {$acl_m_user@CONF_master_domain} \
470 {${if def:authenticated_sender {$authenticated_sender} \
473 ## A standard transport for local delivery.
477 file = /var/mail/$local_part
480 mode_fail_narrower = false
483 ## Transports for user filters.
493 maildir_format = true
500 path = ${if and {{def:home} {exists{$home/bin}}} {$home/bin:} {}}\
501 /usr/local/bin:/usr/local/sbin:\
502 /usr/bin:/usr/sbin:/bin:/sbin
505 return_fail_output = true
508 ## A special dummy transport for use during address verification.
514 ###--------------------------------------------------------------------------
515 ### Retry configuration.
517 SECTION(retry, default)m4_dnl
520 F,2h,15m; G,16h,2h,1.5; F,4d,6h
523 ###----- That's all, folks --------------------------------------------------