2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
6 # This is the main exim4 configuration file based on the 28.08.05 version by
8 # It is hand crafted, do not replace with anything generated by a config
10 # It is installed as part of the debian.org package -- don't edit this file
12 # The configuration file uses a set of macros and rules to generate an
13 # acceptable mail environment for debian.org machines. It deviates
14 # considerably from what could be considered a standard exim configuration.
16 # This configuration file brings in the necessary information from
17 # other databases stored in /etc/exim/ right now these are linear text
20 # This file is independent of the local host, it should not be changed
21 # per machine. primary_hostname is used in all places that require per-host
24 # The configuration files in /etc/exim are as follows:
25 # locals - This is a list of domains that are considered local. A local
26 # domain is essential one that deliveries to /var/mail
27 # will be attempted. The users available for local delivery
28 # comes from /etc/passwd and /etc/aliases. Wildcards are not
30 # virtualdomains - This is a list of all virtual domains. A virtual domain
31 # is much like a local domain, execpt that the delivery location
32 # and allowed set of users is controlled by a virtual domain
33 # alias file and not /etc/passwd. Wildcards are permitted
34 # rcpthosts - recipient hosts or relay domains. This is a list of
35 # all hosts that we mail exchange for. All domains that list
36 # this host in their MX records should be listed here. Wildcards
38 # relayhosts - Hostnames that can send any arbitarily addressed mail to
39 # us. This is primarily only usefull for emergancy 'queue
40 # flushing' operations, but should be populated with a list
41 # of trusted machines. Wildcards are not permitted
42 # The division of files is designed so that all hosts may share rcpthosts
43 # and relayhosts, these could be replicated automatically if necessary.
45 # Exim's wildcard mechanism is a bit odd in that to say "any address in
46 # debian.org including debian.org" you must use two patterns,
49 # Also you can only place a * before a . and as the first char in a string.
50 # Wildcards always match last so they may be used as a catchall.
52 # Further details can be found in each of the files.
54 # Usefull exim commands:
55 # exim4 -qf - Try sending all messages right now, including frozen ones
56 # exim4 -bt foo@blah - Write what exim would do if it saw the address
57 # Great for testing virtual domains and forward files
59 # Special Features for users:
60 # .forward-foo - is understood as an extension address for bar-foo@cow.com
61 # .forward-default - is understood to be a catch all for bar-*@cow.com
62 # .procmailrc - with no .forward file invokes procmail for delivery
65 # For virtual domains the first lookup is done against a linear text
66 # database called 'aliases', then .forward files are consulted. Exim
67 # filtering is available for these .forward files only. .forward-default
68 # is the universal catch all for everything not handled.
70 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
71 # will trigger things like rcpt to rate limiting or possibly a reject if
72 # enough hits are triggered.
74 # value is stored in acl_c1
76 ######################################################################
77 # MAIN CONFIGURATION SETTINGS #
78 ######################################################################
80 # These options specify the Access Control Lists (ACLs) that
81 # are used for incoming SMTP messages - after the RCPT and DATA
82 # commands, respectively.
84 acl_smtp_helo = check_helo
85 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
86 acl_smtp_data = check_message
88 # accept domain literal syntax in e-mail addresses. To actually make use of
89 # this a router is also required
90 allow_domain_literals = true
92 # This setting defines a named domain list called
93 # local_domains. It will be referenced
94 # later on by the syntax "+local_domains".
95 # Other domain and host lists may follow.
96 # @ is the local FQDN, @[] matches the IP adress of any local interface.
98 .include_if_exists /etc/exim4/local-auto.conf
99 .include_if_exists /etc/exim4/local-settings.conf
101 domainlist local_domains = @ : \
104 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
106 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
108 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
110 domainlist handled_domains = +local_domains : +virtual_domains
112 localpartlist local_only_users = lsearch;/etc/exim4/localusers
114 # Domains we relay for; that is domains that aren't considered local but we
115 # accept mail for them.
116 domainlist rcpthosts = partial-lsearch;/etc/exim4/rcpthosts
117 hostlist debianhosts = 127.0.0.1 : net-lsearch;/var/lib/misc/thishost/debianhosts
119 .ifndef RESERVEDADDRS
120 RESERVEDADDRS = 0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : \
121 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : \
122 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5
125 hostlist reservedaddrs = RESERVEDADDRS
127 tls_certificate = /etc/exim4/ssl/thishost.crt
128 tls_privatekey = /etc/exim4/ssl/thishost.key
130 tls_try_verify_hosts = *
131 tls_verify_certificates = /etc/exim4/ssl/client_certs.pem
134 #system_filter = /etc/exim4/filter
135 #system_filter_file_transport = address_file
137 # The setting below causes Exim to do a reverse DNS lookup on all incoming
138 # IP calls, in order to get the true host name. If you feel this is too
139 # expensive, you can specify the networks for which a lookup is done, or
140 # remove the setting entirely.
142 dns_ipv4_lookup = !localhost
144 # If this option is set, then any process that is running as one of the
145 # listed users may pass a message to Exim and specify the sender's
146 # address using the "-f" command line option, without Exim's adding a
149 #trusted_users = mail
150 #trusted_users = mail : www-data : ${if exists{/home/qa}{qa}{}}
151 untrusted_set_sender = *
153 # Some operating systems use the "gecos" field in the system password file
154 # to hold other information in addition to users' real names. Exim looks up
155 # this field when it is creating "sender" and "from" headers. If these options
156 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
157 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
160 gecos_pattern = ^([^,:]*)
163 # This tells exim to immediately discard error messages (ie double bounces).
164 ignore_bounce_errors_after = 0s
166 timeout_frozen_after=14d
168 message_size_limit = 100M
170 smtp_accept_max = 300
171 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
172 smtp_accept_queue = 200
173 smtp_accept_queue_per_connection = 50
174 smtp_accept_reserve = 25
175 smtp_reserve_hosts = +debianhosts
177 split_spool_directory = true
178 check_spool_inodes = 200
179 check_spool_space = 20M
184 deliver_queue_load_max = 50
186 queue_list_requires_admin = false
192 .ifdef HAVE_USER_DEBBUGS
193 daemon_smtp_ports = 25 : 587
197 remote_sort_domains = *.debian.org:*.debian.net
199 pipelining_advertise_hosts = !*
200 tls_advertise_hosts = *
201 smtp_enforce_sync = true
203 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
207 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
208 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
209 ${if exists {/srv/$domain/mail/whitelist}{\
210 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
212 }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
213 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
214 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
215 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
216 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
217 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
218 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
220 ######################################################################
221 # ACL CONFIGURATION #
222 ######################################################################
228 # These are in HELO acl so that they are only run once. They increment a counter,
229 # so we don't want it to increment per rcpt to.
231 warn dnslists = list.dnswl.org&0.0.0.3
232 log_message = Hit on list.dnswl.org for $sender_host_address
233 set acl_c1 = ${eval:$acl_c1-30}
235 warn dnslists = list.dnswl.org&0.0.0.2
236 log_message = Hit on list.dnswl.org for $sender_host_address
237 set acl_c1 = ${eval:$acl_c1-20}
239 warn dnslists = list.dnswl.org
240 log_message = Hit on list.dnswl.org for $sender_host_address
241 set acl_c1 = ${eval:$acl_c1-10}
243 warn condition = ${if isip {$sender_helo_name}{true}{false}}
244 log_message = remote host used IP address in HELO/EHLO greeting
245 set acl_c1 = ${eval:$acl_c1+20}
247 warn !hosts = +debianhosts
248 condition = ${if eq{$host_lookup_failed}{1}}
249 set acl_c1 = ${eval:$acl_c1+20}
251 warn !hosts = +debianhosts
252 condition = ${if eq{$host_lookup_failed}{0}}
253 condition = ${if match{$sender_host_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
254 set acl_c1 = ${eval:$acl_c1+20}
256 warn !hosts = +debianhosts
257 condition = ${if match{$sender_helo_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
258 set acl_c1 = ${eval:$acl_c1+20}
260 warn !hosts = +debianhosts
261 dnslists = dul.dnsbl.sorbs.net
262 set acl_c1 = ${eval:$acl_c1+15}
264 # If the sender's helo name is empty, the message will be rejected later
265 # because the helo is empty. If the rDNS lookup failed, we are already
266 # going to greylist them, so no sense worrying about it here. Finally,
267 # if rDNS does not match helo name (both lower cased first), greylist.
269 warn !hosts = +debianhosts
270 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
271 condition = ${if def:sender_helo_name {yes}{no}}
272 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
273 log_message = HELO doesn't match rDNS
274 set acl_c1 = ${eval:$acl_c1+8}
277 # matches 098325879 - looks fishy
279 warn condition = ${if and { \
280 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
281 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
284 log_message = non-FQDN HELO
285 set acl_c1 = ${eval:$acl_c1+12}
287 # Matches DOMAIN99.com - looks bad
289 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
290 log_message = SHOUTING HELO
291 set acl_c1 = ${eval:$acl_c1+7}
293 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
294 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
295 # naive test, so it's not worth much
297 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
298 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
299 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
300 log_message = random HELO
301 set acl_c1 = ${eval:$acl_c1+5}
303 # Implicit, but simpler to just say it
306 #!!# ACL that is used after the RCPT command on the submission port
309 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
310 # This is a rough pass at preventing addres harvesting or other mail blasts.
312 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
313 message = Too many bad recipients, try again later
314 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
317 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
318 message = sorry, only 5 reports per hour for submission
320 accept domains = +submission_domains
322 message = unknown user
325 deny message = relay not permitted
327 #!!# ACL that is used after the RCPT command
330 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
331 # This is a rough pass at preventing addres harvesting or other mail blasts.
333 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
334 message = Too many bad recipients, try again later
335 !hosts = +debianhosts
336 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
338 # Dump spambots that are so stupid they say helo as our IP address
340 drop !hosts = +debianhosts
341 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
342 message = HELO mismatch Forged HELO for ($sender_helo_name)
344 # Also for spambots that say helo as us or one of our domains
346 drop !hosts = +debianhosts
347 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
348 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
349 message = HELO mismatch Forged HELO for ($sender_helo_name)
351 # This logic gives you a list of commonly forged domains in helo to reject against
353 warn set acl_m2 = ${lookup{$sender_helo_name} \
354 nwildlsearch{/etc/exim4/helo-check} \
355 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
357 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
358 # say helo as a name in the list but we can't look them up
360 defer !hosts = +debianhosts
361 condition = ${if eq{$acl_m2}{}{no}{yes}}
362 condition = ${if eq{$sender_host_name}{}{yes}{no}}
363 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
364 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
366 # If DNS works, go ahead and reject them
368 drop !hosts = +debianhosts
369 condition = ${if and { {!eq{$acl_m2}{}}{!match{$sender_host_name}{${rxquote:$acl_m2}\N$\N}}}{yes}{no}}
370 message = HELO mismatch Forged HELO for ($sender_helo_name)
372 # disabled accounts don't even get local mail.
373 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
374 domains = +local_domains
375 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
377 deny domains = +virtual_domains
378 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
379 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
381 hosts = !+debianhosts
382 message = mail for <$local_part@$domain> only accepted from debian.org machines
383 # Accept if the source is local SMTP (i.e. not over TCP/IP).
384 # We do this by testing for an empty sending host field.
387 deny domains = +handled_domains
388 local_parts = ^[.] : ^.*[@%!/|]
390 deny domains = !+handled_domains
391 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
393 # forwards mail to @d.o address, even if it's a bounce from master, no reply
394 # from source address; rejecting all mail now.
395 deny recipients = mendoza@debian.org
396 hosts = 65.110.39.147 : 64.39.31.15
397 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
399 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
400 sender_domains= +local_domains : debian.org : debian.net : debian.com
401 hosts = !+debianhosts
402 message = mail from <$sender_address> not allowed externally
404 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
405 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
406 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
407 message = no mail should ever come from <$sender_address>
409 deny local_parts = +local_only_users
410 domains = +local_domains
411 hosts = !+debianhosts
412 message = mail for $local_part is only accepted internally
414 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
415 hosts = !+debianhosts
416 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
418 deny !recipients = survey@popcon.debian.org
421 defer !hosts = +debianhosts
422 condition = ${if >{${eval:$acl_c1}}{0}}
423 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
424 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
427 # Check with policyd-weight - this only works with a version after etch's,
428 # sadly. etch's version attempts to hold the socket open, since that's what
429 # postfix expects. Exim, on the other hand, expects the remote side to close
430 # the socket when it's finished sending data, so it see each transaction as
431 # an incomplete read. I'm sure there's a way we could force exim to do
432 # something sick and clever to force either the interpretation or the socket
433 # closure, but I'm fairly sure it's now worth it, since the backport of
434 # policyd-weight is trivial.
435 warn !hosts = +debianhosts
436 set acl_m9 = ${readsocket{inet:127.0.0.1:12525}\
437 {request=smtpd_access_policy\n\
438 protocol_state=RCPT\n\
439 protocol_name=${uc:$received_protocol}\n\
440 helo_name=$sender_helo_name\n\
441 queue_id=$message_exim_id\n\
442 sender=$sender_address\n\
443 recipient=$local_part@$domain\n\
444 recipient_count=$rcpt_count\n\
445 client_address=$sender_host_address\n\
446 client_name=$sender_host_name\n\
447 reverse_client_name=$sender_host_name\n\
448 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
449 {20s}{\n}{socket failure}}
451 # Defer on socket error
452 defer !hosts = +debianhosts
453 condition = ${if eq{$acl_m9}{socket failure}{yes}{no}}
454 message = Cannot connect to policyd-weight. Please try again later.
456 # Set proposed action to $acl_m8 and message to $acl_m7
457 warn !hosts = +debianhosts
458 set acl_m8 = ${extract{action}{$acl_m9}}
459 set acl_m7 = ${sg{$acl_m9}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
461 # Add X-policyd-weight header line to message
462 warn !hosts = +debianhosts
464 condition = ${if eq{$acl_m8}{PREPEND}{yes}{no}}
466 # Write log message, if policyd-weight can't run checks
467 warn !hosts = +debianhosts
468 log_message = policyd-weight message: $acl_m7
469 condition = ${if eq{$acl_m8}{DUNNO}{yes}{no}}
471 # Deny mails which policyd-weight thinks are spam
472 deny !hosts = +debianhosts
473 message = policyd-weight said: $acl_m7
474 condition = ${if eq{$acl_m8}{550}{yes}{no}}
476 # Defer messages when policyd-weight suggests so.
477 defer !hosts = +debianhosts
478 message = policyd-weight said: $acl_m7
479 condition = ${if eq{$acl_m8}{450}{yes}{no}}
482 warn recipients = survey@popcon.debian.org
483 set acl_m1 = PopconMail
485 warn domains = rt.debian.org
487 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if match{$local_part}{[^+]+\\+\\d+} {RTMailRecipientHasSubaddress}}}}
489 warn domains = packages.qa.debian.org
492 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
493 set acl_m1 = PTSOwner
495 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
496 set acl_m1 = DBSignedMail
499 domains = packages.qa.debian.org
500 condition = ${if match{$local_part}{\N^bounces+\N}}
501 set acl_m1 = PTSListBounce
503 .ifdef USE_GREYLISTING
506 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
507 log_message = greylisted.
508 local_parts = ${if match_domain{$domain}{+virtual_domains}\
509 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
510 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
511 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
512 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
514 !hosts = : +debianhosts : WHITELIST : \
515 ${if exists {/etc/greylistd/whitelist-hosts}\
516 {/etc/greylistd/whitelist-hosts}{}} : \
517 ${if exists {/var/lib/greylistd/whitelist-hosts}\
518 {/var/lib/greylistd/whitelist-hosts}{}}
520 domains = +handled_domains : +rcpthosts
521 condition = ${readsocket{/var/run/greylistd/socket}\
523 $sender_host_address \
525 $local_part@$domain}\
529 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
530 # this adds acl_m4 if there isn't one (so unique per message)
533 !hosts = : +debianhosts : WHITELIST
534 condition = ${if def:acl_m4 {no}{yes}}
535 set acl_m4 = $pid.$tod_epoch.$sender_host_port
537 # and defers the message if postgrey thinks it should be defered ...
540 !hosts = : +debianhosts : WHITELIST
542 domains = +handled_domains : +rcpthosts
543 local_parts = GREYLIST_LOCAL_PARTS
544 set acl_m3 = request=smtpd_access_policy\n\
545 protocol_state=RCPT\n\
546 protocol_name=${uc:$received_protocol}\n\
547 instance=${acl_m4}\n\
548 helo_name=${sender_helo_name}\n\
549 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
550 client_name=${sender_host_name}\n\
551 sender=${sender_address}\n\
552 recipient=$local_part@$domain\n\n
554 ${readsocket{/var/run/postgrey/socket}{$acl_m3}\
555 {5s}{}{action=DUNNO}}\
557 message = ${sg{$acl_m3}{^\\w+\\s*}{}}
558 log_message = greylisted.
559 condition = ${if eq{${uc:${substr{0}{5}{$acl_m3}}}}{DEFER}}
561 # ... or adds a header with information about how long the delay was
564 !hosts = : +debianhosts : WHITELIST
566 domains = +handled_domains : +rcpthosts
567 local_parts = GREYLIST_LOCAL_PARTS
568 condition = ${if eq{${uc:${substr_0_7:$acl_m3}}}{PREPEND}}
569 message = ${sg{$acl_m3}{^\\w+\\s*}{}}
573 accept local_parts = postmaster
574 domains = +handled_domains : +rcpthosts
576 deny log_message = <$sender_address> is blacklisted
577 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
578 message = We have blacklisted <$sender_address>. Please stop mailing us
580 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
581 dnslists = ${if match_domain{$domain}{+virtual_domains}\
582 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
583 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
584 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
585 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
586 domains = +handled_domains : +rcpthosts
587 !hosts = +debianhosts : WHITELIST
589 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
590 dnslists = ${if match_domain{$domain}{+virtual_domains}\
591 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
592 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
593 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
594 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
595 domains = +handled_domains : +rcpthosts
596 !hosts = +debianhosts : WHITELIST
598 deny domains = +handled_domains : +rcpthosts
599 local_parts = ${if match_domain{$domain}{+virtual_domains}\
600 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
601 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
602 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
603 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
604 !hosts = +debianhosts : WHITELIST
605 !verify = sender/callout
607 accept domains = +handled_domains
609 message = unknown user
610 verify = recipient/defer_ok
612 accept domains = +rcpthosts
614 message = unrouteable address
617 accept hosts = +debianhosts
619 accept authenticated = *
621 deny message = relay not permitted
623 #!!# ACL that is used after the DATA command
625 require verify = header_syntax
626 message = Invalid syntax in the header
628 deny condition = ${if eq {$acl_m1}{RTMail}}
629 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
630 {!match {${lc:$rh_Subject:]}} {\\[rt.debian.org }} \
631 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
632 message = messages to the Request Tracker system require a subject tag or a subaddress
634 deny !hosts = +debianhosts : 217.196.43.134
635 condition = ${if eq {$acl_m1}{PTSMail}}
636 condition = ${if def:h_X-PTS-Approved:{false}{true}}
637 message = messages to the PTS require an X-PTS-Approved header
639 deny condition = ${if match {$message_body}{\Nhttp:\/\/[a-z\.-]+\/video1?.exe\N}}
640 message = Blackisted URI found in body
642 deny condition = ${if eq {$acl_m1}{DBSignedMail}}
643 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
644 {!match {$message_body}{PGP SIGNED MESSAGE}} \
645 {!match {$message_body}{PGP SIGNATURE}} \
646 {!match {$header_content-type:}{multipart/signed}} \
647 {!match {$header_content-type:}{pgp}} \
650 message = Mail to this address needs to be PGP-signed
652 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
653 # postfix's strict_7bit_headers option, but only checks a few common problem
654 # headers, as there doesn't appear to be an easy way to check them all.
656 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
657 {match {$rh_To:}{[\200-\377]}}\
658 {match {$rh_From:}{[\200-\377]}}\
659 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
660 message = improper use of 8-bit data in message header: message rejected
663 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
664 message = Your mailer is not RFC 2047 compliant: message rejected
670 message = malware detected: $malware_name: message rejected
673 deny spam = $value/defer_ok
674 domains = +handled_domains : +rcpthosts
675 message = message got a spam score of $spam_score
676 local_parts = ${if exists {/etc/exim4/sa_users}\
677 {${if match_domain{$domain}{+virtual_domains}\
678 {${lookup{$local_part@$domain}nwildlsearch{/etc/exim4/sa_users}{$local_part}{}}}\
679 {${lookup{$local_part}lsearch{/etc/exim4/sa_users}{$local_part}{}}}}}}
681 # Check header_sender except for survey@popcon.d.o
682 deny condition = ${if eq{$acl_m1}{PopconMail}{false}{true}}
683 !verify = header_sender
684 message = No valid sender found in the From:, Sender: and Reply-to: headers
690 ######################################################################
691 # REWRITE CONFIGURATION #
692 ######################################################################
698 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
699 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
700 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
701 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
702 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
703 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
706 #!!#######################################################!!#
707 #!!# Here follow routers created from the old routers, #!!#
708 #!!# for handling non-local domains. #!!#
709 #!!#######################################################!!#
715 ######################################################################
716 # ROUTERS CONFIGURATION #
717 # Specifies how addresses are handled #
718 ######################################################################
719 # ORDER DOES MATTER #
720 # An address is passed to each in turn until it is accepted. #
721 ######################################################################
724 debug_print = "R: bsmtp for $local_part@$domain"
726 domains = !+local_domains
727 require_files = /etc/exim4/bsmtp
728 route_list = * ${extract{file}{\
729 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
733 # This router routes to remote hosts over SMTP by explicit IP address,
734 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
735 # require this facility, which is why it is enabled by default in Exim.
737 debug_print = "R: ipliteral for $local_part@$domain"
739 domains = !+handled_domains
740 transport = remote_smtp
741 ignore_target_hosts = +reservedaddrs
743 # This router routes to remote hosts over SMTP using a DNS lookup.
744 # Ignore reserved network responses, including localhost.
746 debug_print = "R: dnslookup for $local_part@$domain"
748 domains = !+handled_domains
749 transport = remote_smtp
750 ignore_target_hosts = +reservedaddrs
753 # This allows local delivery to be forced, avoiding alias files and
757 # debug_print = "R: real_local for $local_part@$domain"
760 # domains = lsearch;/etc/exim4/locals
761 # local_part_prefix = real-
762 # transport = local_delivery
764 # This router handles aliasing using a traditional /etc/aliases file.
765 # If any of your aliases expand to pipes or files, you will need to set
766 # up a user and a group for these deliveries to run under. You can do
767 # this by uncommenting the "user" option below (changing the user name
768 # as appropriate) and adding a "group" option if necessary.
771 debug_print = "R: system_aliases for $local_part@$domain"
775 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
776 domains = +local_domains
777 file_transport = address_file
778 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
779 pipe_transport = address_pipe
782 # This router handles forwarding using traditional .forward files.
783 # It also allows mail filtering when a forward file starts with the
784 # string "# Exim filter": to disable filtering, uncomment the "filter"
785 # option. The check_ancestor option means that if the forward file
786 # generates an address that is an ancestor of the current one, the
787 # current one gets passed on instead. This covers the case where A is
788 # aliased to B and B has a .forward file pointing to A.
790 # For standard debian setup of one group per user, it is acceptable---normal
791 # even---for .forward to be group writable. If you have everyone in one
792 # group, you should comment out the "modemask" line. Without it, the exim
793 # default of 022 will apply, which is probably what you want.
796 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
801 directory_transport = address_directory
802 domains = +local_domains
803 # filter - I have disabled filtering to force users to use .forward-foo files
804 # or procmail. This will make it easier to move mailers in the future
806 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
807 # also checks if the .forward-bar exists, if not then it uses
808 # .forward-default instead.
809 file = $home/.forward\
810 ${if eq{}{$local_part_suffix}{}{\
811 ${if exists {${home}/.forward${local_part_suffix}} \
812 {${local_part_suffix}}{-default}}\
815 file_transport = address_file
816 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
817 local_part_suffix = -*
818 local_part_suffix_optional
820 pipe_transport = address_pipe
821 reply_transport = address_reply
822 require_files = $home
823 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
827 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
831 directory_transport = address_directory
832 domains = +local_domains
833 # filter - I have disabled filtering to force users to use .forward-foo files
834 # or procmail. This will make it easier to move mailers in the future
836 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
837 # also checks if the .forward-bar exists, if not then it uses
838 # .forward-default instead.
839 file = $home/.forward\
840 ${if eq{}{$local_part_suffix}{}{\
841 ${if exists {${home}/.forward${local_part_suffix}} \
842 {${local_part_suffix}}{-default}}\
845 file_transport = address_file
846 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
847 local_part_suffix = -*
848 local_part_suffix_optional
850 pipe_transport = address_pipe
851 reply_transport = address_reply
852 require_files = $home
855 # This delivers to procmail
857 debug_print = "R: procmail for $local_part@$domain"
860 domains = +local_domains
861 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
864 require_files = $local_part:$home/.procmailrc
865 transport = procmail_pipe
866 transport_current_directory = $home
868 # This driver delivers to the LDAP generated alias file.
870 debug_print = "R: ldap_aliases for $local_part@$domain"
874 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
875 {${lookup{$local_part}cdb\
876 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
877 domains = +local_domains
878 file_transport = address_file
879 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
880 pipe_transport = address_pipe
883 # This director matches local user mailboxes.
885 debug_print = "R: localuser for $local_part@$domain"
888 domains = +local_domains
889 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
890 # Disable if the user has never logged in
891 require_files = $home
892 transport = local_delivery
895 # Now we begin the Virtual Domain configuration
896 # Everything before here should apply only to the local domains with a
899 # exim4 fails the router if it can't change to the user/group for delivery
900 # during verification. So we have to seperate the cases of verifying
901 # the virts, and delivering to them. blah.
903 # This router delivers for packages.d.o
905 debug_print = "R: packages for $local_part@$domain"
907 file_transport = address_file
908 pipe_transport = address_pipe
909 domains = packages.debian.org
910 require_files = /org/packages.debian.org/conf/maintainer
911 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
912 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
913 transport_home_directory = /org/packages.debian.org/mail
914 transport_current_directory = /org/packages.debian.org/mail
919 .ifdef HAVE_USER_DEBBUGS
920 # This router delivers for bugs.d.o
922 debug_print = "R: bugs for $local_part@$domain"
924 transport = bugs_pipe
925 domains = bugs.debian.org
926 cannot_route_message = Unknown or archived bug
927 require_files = /org/bugs.debian.org/mail/run-procmail
929 local_parts = ${if match\
931 {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
932 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
933 {$local_part}fail}}fail}
936 # This router delivers for rt.d.o
938 debug_print = "R: rt for $local_part@$domain"
940 domains = rt.debian.org
941 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
942 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
943 local_part_suffix = +*
944 local_part_suffix_optional
945 pipe_transport = rt_pipe
946 data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
947 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
950 debug_print = "R: virt_aliases for $local_part@$domain"
953 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
954 {${lookup{$local_part}lsearch*{\
955 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
957 directory_transport = address_directory
958 cannot_route_message = Unknown user
959 domains = +virtual_domains
960 file_transport = address_file
961 pipe_transport = address_pipe
962 qualify_preserve_domain
964 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
965 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
969 debug_print = "R: virt_direct for $local_part@$domain"
975 directory_transport = address_directory
976 domains = +virtual_domains
977 file = $home/.forward-\
978 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
980 file_transport = address_file
981 pipe_transport = address_pipe
982 reply_transport = address_reply
984 router_home_directory = ${extract{directory}{VDOMAINDATA}}
985 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
988 # This is a senmailesque alias file lookup
990 debug_print = "R: virt_aliases for $local_part@$domain"
995 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
996 {${lookup{$local_part}lsearch*{\
997 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
999 directory_transport = address_directory
1000 domains = +virtual_domains
1001 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1002 cannot_route_message = Unknown user
1003 group = ${extract{group}{VDOMAINDATA}}
1004 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1005 pipe_transport = address_pipe
1006 qualify_preserve_domain
1007 retry_use_local_part
1008 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1009 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1011 user = ${extract{user}{VDOMAINDATA}}
1013 # This is a qmailesque deliver into a directory of .forward files
1015 debug_print = "R: virt_direct for $local_part@$domain"
1021 directory_transport = address_directory
1022 domains = +virtual_domains
1023 file = $home/.forward-\
1024 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1026 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1027 group = ${extract{group}{VDOMAINDATA}}
1028 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1030 pipe_transport = address_pipe
1031 reply_transport = address_reply
1032 retry_use_local_part
1033 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1034 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1036 user = ${extract{user}{VDOMAINDATA}}
1037 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1039 ######################################################################
1040 # TRANSPORTS CONFIGURATION #
1041 ######################################################################
1042 # ORDER DOES NOT MATTER #
1043 # Only one appropriate transport is called for each delivery. #
1044 ######################################################################
1049 # This transport is used for local delivery to user mailboxes. On debian
1050 # systems group mail is used so we can write to the /var/mail
1051 # directory. (The alternative, which most other unixes use, is to deliver
1052 # as the user's own group, into a sticky-bitted directory)
1055 file = /var/mail/${local_part}
1058 no_mode_fail_narrower
1061 # This transport is used for handling pipe addresses generated by alias
1062 # or .forward files. It has a conventional name, since it is not actually
1063 # mentioned elsewhere in this configuration file. (A different name *can*
1064 # be specified via the "address_pipe_transport" option if you really want
1065 # to.) If the pipe generates any standard output, it is returned to the sender
1066 # of the message as a delivery error. Set return_fail_output instead if you
1067 # want this to happen only when the pipe fails to complete normally.
1071 current_directory = ${home}
1072 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1073 EXT=${substr_1:${local_part_suffix}}:\
1074 LOCAL=${local_part}${local_part_suffix}:\
1075 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1079 # This transport is used for handling file addresses generated by alias
1080 # or .forward files. It has a conventional name, since it is not actually
1081 # mentioned elsewhere in this configuration file.
1091 directory_mode = 0770
1092 mode_fail_narrower = false
1094 # This transport is used for handling file addresses generated by alias
1095 # or .forward files if the path ends in "/", which causes it to be treated
1096 # as a directory name rather than a file name. Each message is then delivered
1097 # to a unique file in the directory. If instead you want all such deliveries to
1098 # be in the "maildir" format that is used by some other mail software,
1099 # uncomment the final option below. If this is done, the directory specified
1100 # in the .forward or alias file is the base maildir directory.
1102 # Should you want to be able to specify either maildir or non-maildir
1103 # directory-style deliveries, then you must set up yet another transport,
1104 # called address_directory2. This is used if the path ends in "//" so should
1105 # be the one used for maildir, as the double slash suggests another level
1106 # of directory. In the absence of address_directory2, paths ending in //
1107 # are passed to address_directory.
1117 # This transport is used for handling autoreplies generated by the filtering
1118 # option of the forwardfile director. It has a conventional name, since it
1119 # is not actually mentioned elsewhere in this configuration file.
1123 # This transport is used for delivering messages over SMTP connections.
1127 connect_timeout = 1m
1128 tls_tempfail_tryclear = true
1129 tls_certificate = /etc/exim4/ssl/thishost.crt
1130 tls_privatekey = /etc/exim4/ssl/thishost.key
1132 # Send the message to procmail
1135 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1137 user = ${local_part}
1146 user = ${extract{user}{\
1147 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1151 .ifdef HAVE_USER_DEBBUGS
1154 command = /org/bugs.debian.org/mail/run-procmail
1155 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1156 EXT=${substr_1:${local_part_suffix}}:\
1157 LOCAL=${local_part}${local_part_suffix}:\
1158 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1165 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1168 environment = EXTENSION=${substr_1:${local_part_suffix}}
1169 allow_commands = /usr/bin/rt-mailgate
1172 ######################################################################
1173 # RETRY CONFIGURATION #
1174 ######################################################################
1176 # This single retry rule applies to all domains and all errors. It specifies
1177 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1178 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1179 # hours, then retries every 8 hours until 4 days have passed since the first
1182 # Domain Error Retries
1183 # ------ ----- -------
1188 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1189 * * senders=: F,2h,10m
1190 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1191 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1193 # End of Exim 4 configuration