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 # mailhubdomains - Domains for which we are the MX, but the mail is relayed
43 # elsewhere. This is designed for use with small volume or
44 # restricted machines that need to use a smarthost for mail
45 # traffic. We will relay for them based on ssl cert validation
46 # but we need to teach exim how to route the mail to them. This is
48 # The division of files is designed so that all hosts may share rcpthosts
49 # and relayhosts, these could be replicated automatically if necessary.
51 # Exim's wildcard mechanism is a bit odd in that to say "any address in
52 # debian.org including debian.org" you must use two patterns,
55 # Also you can only place a * before a . and as the first char in a string.
56 # Wildcards always match last so they may be used as a catchall.
58 # Further details can be found in each of the files.
60 # Usefull exim commands:
61 # exim4 -qf - Try sending all messages right now, including frozen ones
62 # exim4 -bt foo@blah - Write what exim would do if it saw the address
63 # Great for testing virtual domains and forward files
65 # Special Features for users:
66 # .forward-foo - is understood as an extension address for bar-foo@cow.com
67 # .forward-default - is understood to be a catch all for bar-*@cow.com
68 # .procmailrc - with no .forward file invokes procmail for delivery
71 # For virtual domains the first lookup is done against a linear text
72 # database called 'aliases', then .forward files are consulted. Exim
73 # filtering is available for these .forward files only. .forward-default
74 # is the universal catch all for everything not handled.
76 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
77 # will trigger things like rcpt to rate limiting or possibly a reject if
78 # enough hits are triggered.
80 # value is stored in acl_c1
82 ######################################################################
83 # MAIN CONFIGURATION SETTINGS #
84 ######################################################################
86 # These options specify the Access Control Lists (ACLs) that
87 # are used for incoming SMTP messages - after the RCPT and DATA
88 # commands, respectively.
90 acl_smtp_helo = check_helo
91 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
92 acl_smtp_data = check_message
94 # accept domain literal syntax in e-mail addresses. To actually make use of
95 # this a router is also required
96 allow_domain_literals = true
98 # This setting defines a named domain list called
99 # local_domains. It will be referenced
100 # later on by the syntax "+local_domains".
101 # Other domain and host lists may follow.
102 # @ is the local FQDN, @[] matches the IP adress of any local interface.
104 .include_if_exists /etc/exim4/local-auto.conf
105 .include_if_exists /etc/exim4/local-settings.conf
107 domainlist local_domains = @ : \
110 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
112 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
114 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
116 domainlist handled_domains = +local_domains : +virtual_domains
118 localpartlist local_only_users = lsearch;/etc/exim4/localusers
120 # Domains we relay for; that is domains that aren't considered local but we
121 # accept mail for them.
122 domainlist rcpthosts = partial-lsearch;/etc/exim4/rcpthosts
123 hostlist debianhosts = 127.0.0.1 : net-lsearch;/var/lib/misc/thishost/debianhosts
124 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
126 .ifndef RESERVEDADDRS
127 RESERVEDADDRS = 0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : \
128 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : \
129 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5
132 hostlist reservedaddrs = RESERVEDADDRS
135 tls_certificate = /etc/exim4/ssl/thishost.crt
136 tls_privatekey = /etc/exim4/ssl/thishost.key
137 tls_try_verify_hosts = *
138 tls_verify_certificates = /etc/exim4/ssl/ca.crt
139 tls_crl = /etc/exim4/ssl/ca.crl
142 #system_filter = /etc/exim4/filter
143 #system_filter_file_transport = address_file
145 # The setting below causes Exim to do a reverse DNS lookup on all incoming
146 # IP calls, in order to get the true host name. If you feel this is too
147 # expensive, you can specify the networks for which a lookup is done, or
148 # remove the setting entirely.
150 dns_ipv4_lookup = !localhost
152 # If this option is set, then any process that is running as one of the
153 # listed users may pass a message to Exim and specify the sender's
154 # address using the "-f" command line option, without Exim's adding a
157 #trusted_users = mail
158 #trusted_users = mail : www-data : ${if exists{/home/qa}{qa}{}}
159 untrusted_set_sender = *
161 # Some operating systems use the "gecos" field in the system password file
162 # to hold other information in addition to users' real names. Exim looks up
163 # this field when it is creating "sender" and "from" headers. If these options
164 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
165 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
168 gecos_pattern = ^([^,:]*)
171 # This tells exim to immediately discard error messages (ie double bounces).
172 ignore_bounce_errors_after = 0s
174 timeout_frozen_after=14d
176 message_size_limit = 100M
178 smtp_accept_max = 300
179 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
180 smtp_accept_queue = 200
181 smtp_accept_queue_per_connection = 50
182 smtp_accept_reserve = 25
183 smtp_reserve_hosts = +debianhosts
185 split_spool_directory = true
186 check_spool_inodes = 200
187 check_spool_space = 20M
192 deliver_queue_load_max = 50
194 queue_list_requires_admin = false
200 .ifdef HAVE_USER_DEBBUGS MAIL_RELAY STUPID_FIREWALL
201 daemon_smtp_ports = 25 : 587
205 remote_sort_domains = *.debian.org:*.debian.net
207 pipelining_advertise_hosts = !*
209 tls_advertise_hosts = *
211 smtp_enforce_sync = true
213 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
217 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
218 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
219 ${if exists {/srv/$domain/mail/whitelist}{\
220 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
222 }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
223 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
224 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
225 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
226 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
227 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
228 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
230 ######################################################################
231 # ACL CONFIGURATION #
232 ######################################################################
238 # These are in HELO acl so that they are only run once. They increment a counter,
239 # so we don't want it to increment per rcpt to.
241 warn dnslists = list.dnswl.org&0.0.0.3
242 log_message = Hit on list.dnswl.org for $sender_host_address
243 set acl_c1 = ${eval:$acl_c1-30}
245 warn dnslists = list.dnswl.org&0.0.0.2
246 log_message = Hit on list.dnswl.org for $sender_host_address
247 set acl_c1 = ${eval:$acl_c1-20}
249 warn dnslists = list.dnswl.org
250 log_message = Hit on list.dnswl.org for $sender_host_address
251 set acl_c1 = ${eval:$acl_c1-10}
253 warn condition = ${if isip {$sender_helo_name}{true}{false}}
254 log_message = remote host used IP address in HELO/EHLO greeting
255 set acl_c1 = ${eval:$acl_c1+20}
257 warn !hosts = +debianhosts
258 condition = ${if eq{$host_lookup_failed}{1}}
259 set acl_c1 = ${eval:$acl_c1+20}
261 warn !hosts = +debianhosts
262 condition = ${if eq{$host_lookup_failed}{0}}
263 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}}
264 set acl_c1 = ${eval:$acl_c1+20}
266 warn !hosts = +debianhosts
267 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}}
268 set acl_c1 = ${eval:$acl_c1+20}
270 warn !hosts = +debianhosts
271 dnslists = dul.dnsbl.sorbs.net
272 set acl_c1 = ${eval:$acl_c1+15}
274 # If the sender's helo name is empty, the message will be rejected later
275 # because the helo is empty. If the rDNS lookup failed, we are already
276 # going to greylist them, so no sense worrying about it here. Finally,
277 # if rDNS does not match helo name (both lower cased first), greylist.
279 warn !hosts = +debianhosts
280 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
281 condition = ${if def:sender_helo_name {yes}{no}}
282 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
283 log_message = HELO doesn't match rDNS
284 set acl_c1 = ${eval:$acl_c1+8}
287 # matches 098325879 - looks fishy
289 warn condition = ${if and { \
290 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
291 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
294 log_message = non-FQDN HELO
295 set acl_c1 = ${eval:$acl_c1+12}
297 # Matches DOMAIN99.com - looks bad
299 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
300 log_message = SHOUTING HELO
301 set acl_c1 = ${eval:$acl_c1+7}
303 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
304 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
305 # naive test, so it's not worth much
307 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
308 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
309 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
310 log_message = random HELO
311 set acl_c1 = ${eval:$acl_c1+5}
313 # Implicit, but simpler to just say it
316 #!!# ACL that is used after the RCPT command on the submission port
319 # Accept if the source is local SMTP (i.e. not over TCP/IP).
320 # We do this by testing for an empty sending host field.
322 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
323 # This is a rough pass at preventing addres harvesting or other mail blasts.
326 accept verify = certificate
329 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
330 message = Too many bad recipients, try again later
331 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
334 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
335 message = sorry, only 5 reports per hour for submission
337 accept domains = +submission_domains
339 message = unknown user
342 deny message = relay not permitted
344 #!!# ACL that is used after the RCPT command
348 accept verify = certificate
351 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
352 # This is a rough pass at preventing addres harvesting or other mail blasts.
354 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
355 message = Too many bad recipients, try again later
356 !hosts = +debianhosts
357 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
359 # Dump spambots that are so stupid they say helo as our IP address
361 drop !hosts = +debianhosts
362 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
363 message = HELO mismatch Forged HELO for ($sender_helo_name)
365 # Also for spambots that say helo as us or one of our domains
367 drop !hosts = +debianhosts
368 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
369 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
370 message = HELO mismatch Forged HELO for ($sender_helo_name)
372 # This logic gives you a list of commonly forged domains in helo to reject against
374 warn set acl_m2 = ${lookup{$sender_helo_name} \
375 nwildlsearch{/etc/exim4/helo-check} \
376 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
378 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
379 # say helo as a name in the list but we can't look them up
381 defer !hosts = +debianhosts
382 condition = ${if eq{$acl_m2}{}{no}{yes}}
383 condition = ${if eq{$sender_host_name}{}{yes}{no}}
384 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
385 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
387 # If DNS works, go ahead and reject them
389 drop !hosts = +debianhosts
390 condition = ${if and { {!eq{$acl_m2}{}}{!match{$sender_host_name}{${rxquote:$acl_m2}\N$\N}}}{yes}{no}}
391 message = HELO mismatch Forged HELO for ($sender_helo_name)
393 # disabled accounts don't even get local mail.
394 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
395 domains = +local_domains
396 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
398 deny domains = +virtual_domains
399 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
400 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
402 hosts = !+debianhosts
403 message = mail for <$local_part@$domain> only accepted from debian.org machines
404 # Accept if the source is local SMTP (i.e. not over TCP/IP).
405 # We do this by testing for an empty sending host field.
408 deny domains = +handled_domains
409 local_parts = ^[.] : ^.*[@%!/|]
411 deny domains = !+handled_domains
412 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
414 # forwards mail to @d.o address, even if it's a bounce from master, no reply
415 # from source address; rejecting all mail now.
416 deny recipients = mendoza@debian.org
417 hosts = 65.110.39.147 : 64.39.31.15
418 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
420 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
421 sender_domains= +local_domains : debian.org : debian.net : debian.com
422 hosts = !+debianhosts
423 message = mail from <$sender_address> not allowed externally
425 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
426 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
427 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
428 message = no mail should ever come from <$sender_address>
430 deny local_parts = +local_only_users
431 domains = +local_domains
432 hosts = !+debianhosts
433 message = mail for $local_part is only accepted internally
435 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
436 hosts = !+debianhosts
437 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
439 deny !recipients = survey@popcon.debian.org
442 defer !hosts = +debianhosts
443 condition = ${if >{${eval:$acl_c1}}{0}}
444 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
445 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
448 # Check with policyd-weight - this only works with a version after etch's,
449 # sadly. etch's version attempts to hold the socket open, since that's what
450 # postfix expects. Exim, on the other hand, expects the remote side to close
451 # the socket when it's finished sending data, so it see each transaction as
452 # an incomplete read. I'm sure there's a way we could force exim to do
453 # something sick and clever to force either the interpretation or the socket
454 # closure, but I'm fairly sure it's now worth it, since the backport of
455 # policyd-weight is trivial.
456 warn !hosts = +debianhosts
457 set acl_m9 = ${readsocket{inet:127.0.0.1:12525}\
458 {request=smtpd_access_policy\n\
459 protocol_state=RCPT\n\
460 protocol_name=${uc:$received_protocol}\n\
461 helo_name=$sender_helo_name\n\
462 queue_id=$message_exim_id\n\
463 sender=$sender_address\n\
464 recipient=$local_part@$domain\n\
465 recipient_count=$rcpt_count\n\
466 client_address=$sender_host_address\n\
467 client_name=$sender_host_name\n\
468 reverse_client_name=$sender_host_name\n\
469 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
470 {20s}{\n}{socket failure}}
472 # Defer on socket error
473 defer !hosts = +debianhosts
474 condition = ${if eq{$acl_m9}{socket failure}{yes}{no}}
475 message = Cannot connect to policyd-weight. Please try again later.
477 # Set proposed action to $acl_m8 and message to $acl_m7
478 warn !hosts = +debianhosts
479 set acl_m8 = ${extract{action}{$acl_m9}}
480 set acl_m7 = ${sg{$acl_m9}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
482 # Add X-policyd-weight header line to message
483 warn !hosts = +debianhosts
485 condition = ${if eq{$acl_m8}{PREPEND}{yes}{no}}
487 # Write log message, if policyd-weight can't run checks
488 warn !hosts = +debianhosts
489 log_message = policyd-weight message: $acl_m7
490 condition = ${if eq{$acl_m8}{DUNNO}{yes}{no}}
492 # Deny mails which policyd-weight thinks are spam
493 deny !hosts = +debianhosts
494 message = policyd-weight said: $acl_m7
495 condition = ${if eq{$acl_m8}{550}{yes}{no}}
497 # Defer messages when policyd-weight suggests so.
498 defer !hosts = +debianhosts
499 message = policyd-weight said: $acl_m7
500 condition = ${if eq{$acl_m8}{450}{yes}{no}}
503 warn recipients = survey@popcon.debian.org
504 set acl_m1 = PopconMail
506 warn domains = rt.debian.org
508 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if match{$local_part}{[^+]+\\+\\d+} {RTMailRecipientHasSubaddress}}}}
510 warn domains = packages.qa.debian.org
513 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
514 set acl_m1 = PTSOwner
516 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
517 set acl_m1 = DBSignedMail
520 domains = packages.qa.debian.org
521 condition = ${if match{$local_part}{\N^bounces+\N}}
522 set acl_m1 = PTSListBounce
524 .ifdef USE_GREYLISTING
527 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
528 log_message = greylisted.
529 local_parts = ${if match_domain{$domain}{+virtual_domains}\
530 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
531 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
532 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
533 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
535 !hosts = : +debianhosts : WHITELIST : \
536 ${if exists {/etc/greylistd/whitelist-hosts}\
537 {/etc/greylistd/whitelist-hosts}{}} : \
538 ${if exists {/var/lib/greylistd/whitelist-hosts}\
539 {/var/lib/greylistd/whitelist-hosts}{}}
541 domains = +handled_domains : +rcpthosts
542 condition = ${readsocket{/var/run/greylistd/socket}\
544 $sender_host_address \
546 $local_part@$domain}\
550 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
551 # this adds acl_m4 if there isn't one (so unique per message)
554 !hosts = : +debianhosts : WHITELIST
555 condition = ${if def:acl_m4 {no}{yes}}
556 set acl_m4 = $pid.$tod_epoch.$sender_host_port
558 # and defers the message if postgrey thinks it should be defered ...
561 !hosts = : +debianhosts : WHITELIST
563 domains = +handled_domains : +rcpthosts
564 local_parts = GREYLIST_LOCAL_PARTS
565 set acl_m3 = request=smtpd_access_policy\n\
566 protocol_state=RCPT\n\
567 protocol_name=${uc:$received_protocol}\n\
568 instance=${acl_m4}\n\
569 helo_name=${sender_helo_name}\n\
570 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
571 client_name=${sender_host_name}\n\
572 sender=${sender_address}\n\
573 recipient=$local_part@$domain\n\n
575 ${readsocket{/var/run/postgrey/socket}{$acl_m3}\
576 {5s}{}{action=DUNNO}}\
578 message = ${sg{$acl_m3}{^\\w+\\s*}{}}
579 log_message = greylisted.
580 condition = ${if eq{${uc:${substr{0}{5}{$acl_m3}}}}{DEFER}}
582 # ... or adds a header with information about how long the delay was
585 !hosts = : +debianhosts : WHITELIST
587 domains = +handled_domains : +rcpthosts
588 local_parts = GREYLIST_LOCAL_PARTS
589 condition = ${if eq{${uc:${substr_0_7:$acl_m3}}}{PREPEND}}
590 message = ${sg{$acl_m3}{^\\w+\\s*}{}}
594 accept local_parts = postmaster
595 domains = +handled_domains : +rcpthosts
597 deny log_message = <$sender_address> is blacklisted
598 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
599 message = We have blacklisted <$sender_address>. Please stop mailing us
601 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
602 dnslists = ${if match_domain{$domain}{+virtual_domains}\
603 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
604 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
605 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
606 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
607 domains = +handled_domains : +rcpthosts
608 !hosts = +debianhosts : WHITELIST
610 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
611 dnslists = ${if match_domain{$domain}{+virtual_domains}\
612 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
613 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
614 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
615 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
616 domains = +handled_domains : +rcpthosts
617 !hosts = +debianhosts : WHITELIST
619 deny domains = +handled_domains : +rcpthosts
620 local_parts = ${if match_domain{$domain}{+virtual_domains}\
621 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
622 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
623 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
624 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
625 !hosts = +debianhosts : WHITELIST
626 !verify = sender/callout
628 accept domains = +mailhubdomains
630 message = unknown user
631 verify = recipient/callout,defer_ok
633 accept domains = +handled_domains
635 message = unknown user
636 verify = recipient/defer_ok
638 accept domains = +rcpthosts
640 message = unrouteable address
643 accept hosts = +debianhosts
645 accept authenticated = *
647 deny message = relay not permitted
649 #!!# ACL that is used after the DATA command
651 require verify = header_syntax
652 message = Invalid syntax in the header
654 deny condition = ${if eq {$acl_m1}{RTMail}}
655 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
656 {!match {${lc:$rh_Subject:]}} {\\[rt.debian.org }} \
657 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
658 message = messages to the Request Tracker system require a subject tag or a subaddress
660 deny !hosts = +debianhosts : 217.196.43.134
661 condition = ${if eq {$acl_m1}{PTSMail}}
662 condition = ${if def:h_X-PTS-Approved:{false}{true}}
663 message = messages to the PTS require an X-PTS-Approved header
665 deny condition = ${if match {$message_body}{\Nhttp:\/\/[a-z\.-]+\/video1?.exe\N}}
666 message = Blackisted URI found in body
668 deny condition = ${if eq {$acl_m1}{DBSignedMail}}
669 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
670 {!match {$message_body}{PGP SIGNED MESSAGE}} \
671 {!match {$message_body}{PGP SIGNATURE}} \
672 {!match {$header_content-type:}{multipart/signed}} \
673 {!match {$header_content-type:}{pgp}} \
676 message = Mail to this address needs to be PGP-signed
678 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
679 # postfix's strict_7bit_headers option, but only checks a few common problem
680 # headers, as there doesn't appear to be an easy way to check them all.
682 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
683 {match {$rh_To:}{[\200-\377]}}\
684 {match {$rh_From:}{[\200-\377]}}\
685 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
686 message = improper use of 8-bit data in message header: message rejected
689 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
690 message = Your mailer is not RFC 2047 compliant: message rejected
696 message = malware detected: $malware_name: message rejected
699 deny spam = $value/defer_ok
700 domains = +handled_domains : +rcpthosts
701 message = message got a spam score of $spam_score
702 local_parts = ${if exists {/etc/exim4/sa_users}\
703 {${if match_domain{$domain}{+virtual_domains}\
704 {${lookup{$local_part@$domain}nwildlsearch{/etc/exim4/sa_users}{$local_part}{}}}\
705 {${lookup{$local_part}lsearch{/etc/exim4/sa_users}{$local_part}{}}}}}}
707 # Check header_sender except for survey@popcon.d.o
708 deny condition = ${if eq{$acl_m1}{PopconMail}{false}{true}}
709 !verify = header_sender
710 message = No valid sender found in the From:, Sender: and Reply-to: headers
716 ######################################################################
717 # REWRITE CONFIGURATION #
718 ######################################################################
724 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
725 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
726 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
727 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
728 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
729 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
732 #!!#######################################################!!#
733 #!!# Here follow routers created from the old routers, #!!#
734 #!!# for handling non-local domains. #!!#
735 #!!#######################################################!!#
741 ######################################################################
742 # ROUTERS CONFIGURATION #
743 # Specifies how addresses are handled #
744 ######################################################################
745 # ORDER DOES MATTER #
746 # An address is passed to each in turn until it is accepted. #
747 ######################################################################
751 domains = +mailhubdomains
752 transport = remote_smtp
753 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
754 require_files = /etc/exim4/manualroute
757 debug_print = "R: bsmtp for $local_part@$domain"
759 domains = !+local_domains
760 require_files = /etc/exim4/bsmtp
761 route_list = * ${extract{file}{\
762 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
766 # This router routes to remote hosts over SMTP by explicit IP address,
767 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
768 # require this facility, which is why it is enabled by default in Exim.
770 debug_print = "R: ipliteral for $local_part@$domain"
772 domains = !+handled_domains
773 transport = remote_smtp
774 ignore_target_hosts = +reservedaddrs
778 debug_print = "R: smarthost for $local_part@$domain"
780 domains = !+handled_domains
781 transport = remote_smtp_smarthost
782 route_list = * SMARTHOST
783 host_find_failed = defer
784 same_domain_copy_routing = yes
787 # This router routes to remote hosts over SMTP using a DNS lookup.
788 # Ignore reserved network responses, including localhost.
790 debug_print = "R: dnslookup for $local_part@$domain"
792 domains = !+handled_domains
793 transport = remote_smtp
794 ignore_target_hosts = +reservedaddrs
797 # This allows local delivery to be forced, avoiding alias files and
801 # debug_print = "R: real_local for $local_part@$domain"
804 # domains = lsearch;/etc/exim4/locals
805 # local_part_prefix = real-
806 # transport = local_delivery
808 # This router handles aliasing using a traditional /etc/aliases file.
809 # If any of your aliases expand to pipes or files, you will need to set
810 # up a user and a group for these deliveries to run under. You can do
811 # this by uncommenting the "user" option below (changing the user name
812 # as appropriate) and adding a "group" option if necessary.
815 debug_print = "R: system_aliases for $local_part@$domain"
819 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
820 domains = +local_domains
821 file_transport = address_file
822 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
823 pipe_transport = address_pipe
826 # This router handles forwarding using traditional .forward files.
827 # It also allows mail filtering when a forward file starts with the
828 # string "# Exim filter": to disable filtering, uncomment the "filter"
829 # option. The check_ancestor option means that if the forward file
830 # generates an address that is an ancestor of the current one, the
831 # current one gets passed on instead. This covers the case where A is
832 # aliased to B and B has a .forward file pointing to A.
834 # For standard debian setup of one group per user, it is acceptable---normal
835 # even---for .forward to be group writable. If you have everyone in one
836 # group, you should comment out the "modemask" line. Without it, the exim
837 # default of 022 will apply, which is probably what you want.
840 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
845 directory_transport = address_directory
846 domains = +local_domains
847 # filter - I have disabled filtering to force users to use .forward-foo files
848 # or procmail. This will make it easier to move mailers in the future
850 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
851 # also checks if the .forward-bar exists, if not then it uses
852 # .forward-default instead.
853 file = $home/.forward\
854 ${if eq{}{$local_part_suffix}{}{\
855 ${if exists {${home}/.forward${local_part_suffix}} \
856 {${local_part_suffix}}{-default}}\
859 file_transport = address_file
860 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
861 local_part_suffix = -*
862 local_part_suffix_optional
864 pipe_transport = address_pipe
865 reply_transport = address_reply
866 require_files = $home
867 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
871 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
875 directory_transport = address_directory
876 domains = +local_domains
877 # filter - I have disabled filtering to force users to use .forward-foo files
878 # or procmail. This will make it easier to move mailers in the future
880 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
881 # also checks if the .forward-bar exists, if not then it uses
882 # .forward-default instead.
883 file = $home/.forward\
884 ${if eq{}{$local_part_suffix}{}{\
885 ${if exists {${home}/.forward${local_part_suffix}} \
886 {${local_part_suffix}}{-default}}\
889 file_transport = address_file
890 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
891 local_part_suffix = -*
892 local_part_suffix_optional
894 pipe_transport = address_pipe
895 reply_transport = address_reply
896 require_files = $home
899 # This delivers to procmail
901 debug_print = "R: procmail for $local_part@$domain"
904 domains = +local_domains
905 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
908 require_files = $local_part:$home/.procmailrc
909 transport = procmail_pipe
910 transport_current_directory = $home
912 # This driver delivers to the LDAP generated alias file.
914 debug_print = "R: ldap_aliases for $local_part@$domain"
918 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
919 {${lookup{$local_part}cdb\
920 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
921 domains = +local_domains
922 file_transport = address_file
923 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
924 pipe_transport = address_pipe
927 # This director matches local user mailboxes.
929 debug_print = "R: localuser for $local_part@$domain"
932 domains = +local_domains
933 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
934 # Disable if the user has never logged in
935 require_files = $home
936 transport = local_delivery
939 # Now we begin the Virtual Domain configuration
940 # Everything before here should apply only to the local domains with a
943 # exim4 fails the router if it can't change to the user/group for delivery
944 # during verification. So we have to seperate the cases of verifying
945 # the virts, and delivering to them. blah.
947 # This router delivers for packages.d.o
949 debug_print = "R: packages for $local_part@$domain"
951 file_transport = address_file
952 pipe_transport = address_pipe
953 domains = packages.debian.org
954 require_files = /org/packages.debian.org/conf/maintainer
955 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
956 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
957 transport_home_directory = /org/packages.debian.org/mail
958 transport_current_directory = /org/packages.debian.org/mail
963 .ifdef HAVE_USER_DEBBUGS
964 # This router delivers for bugs.d.o
966 debug_print = "R: bugs for $local_part@$domain"
968 transport = bugs_pipe
969 domains = bugs.debian.org
970 cannot_route_message = Unknown or archived bug
971 require_files = /org/bugs.debian.org/mail/run-procmail
973 local_parts = ${if match\
975 {\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}\
976 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
977 {$local_part}fail}}fail}
980 # This router delivers for rt.d.o
982 debug_print = "R: rt for $local_part@$domain"
984 domains = rt.debian.org
985 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
986 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
987 local_part_suffix = +*
988 local_part_suffix_optional
989 pipe_transport = rt_pipe
990 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}}"
991 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
994 debug_print = "R: virt_aliases for $local_part@$domain"
997 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
998 {${lookup{$local_part}lsearch*{\
999 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1001 directory_transport = address_directory
1002 cannot_route_message = Unknown user
1003 domains = +virtual_domains
1004 file_transport = address_file
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}}
1013 debug_print = "R: virt_direct for $local_part@$domain"
1019 directory_transport = address_directory
1020 domains = +virtual_domains
1021 file = $home/.forward-\
1022 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1024 file_transport = address_file
1025 pipe_transport = address_pipe
1026 reply_transport = address_reply
1027 retry_use_local_part
1028 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1029 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1032 # This is a senmailesque alias file lookup
1034 debug_print = "R: virt_aliases for $local_part@$domain"
1038 data = ${if exists{\
1039 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1040 {${lookup{$local_part}lsearch*{\
1041 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1043 directory_transport = address_directory
1044 domains = +virtual_domains
1045 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1046 cannot_route_message = Unknown user
1047 group = ${extract{group}{VDOMAINDATA}}
1048 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1049 pipe_transport = address_pipe
1050 qualify_preserve_domain
1051 retry_use_local_part
1052 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1053 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1055 user = ${extract{user}{VDOMAINDATA}}
1057 # This is a qmailesque deliver into a directory of .forward files
1059 debug_print = "R: virt_direct for $local_part@$domain"
1065 directory_transport = address_directory
1066 domains = +virtual_domains
1067 file = $home/.forward-\
1068 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1070 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1071 group = ${extract{group}{VDOMAINDATA}}
1072 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1074 pipe_transport = address_pipe
1075 reply_transport = address_reply
1076 retry_use_local_part
1077 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1078 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1080 user = ${extract{user}{VDOMAINDATA}}
1081 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1083 ######################################################################
1084 # TRANSPORTS CONFIGURATION #
1085 ######################################################################
1086 # ORDER DOES NOT MATTER #
1087 # Only one appropriate transport is called for each delivery. #
1088 ######################################################################
1093 # This transport is used for local delivery to user mailboxes. On debian
1094 # systems group mail is used so we can write to the /var/mail
1095 # directory. (The alternative, which most other unixes use, is to deliver
1096 # as the user's own group, into a sticky-bitted directory)
1099 file = /var/mail/${local_part}
1102 no_mode_fail_narrower
1105 # This transport is used for handling pipe addresses generated by alias
1106 # or .forward files. It has a conventional name, since it is not actually
1107 # mentioned elsewhere in this configuration file. (A different name *can*
1108 # be specified via the "address_pipe_transport" option if you really want
1109 # to.) If the pipe generates any standard output, it is returned to the sender
1110 # of the message as a delivery error. Set return_fail_output instead if you
1111 # want this to happen only when the pipe fails to complete normally.
1115 current_directory = ${home}
1116 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1117 EXT=${substr_1:${local_part_suffix}}:\
1118 LOCAL=${local_part}${local_part_suffix}:\
1119 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1123 # This transport is used for handling file addresses generated by alias
1124 # or .forward files. It has a conventional name, since it is not actually
1125 # mentioned elsewhere in this configuration file.
1135 directory_mode = 0770
1136 mode_fail_narrower = false
1138 # This transport is used for handling file addresses generated by alias
1139 # or .forward files if the path ends in "/", which causes it to be treated
1140 # as a directory name rather than a file name. Each message is then delivered
1141 # to a unique file in the directory. If instead you want all such deliveries to
1142 # be in the "maildir" format that is used by some other mail software,
1143 # uncomment the final option below. If this is done, the directory specified
1144 # in the .forward or alias file is the base maildir directory.
1146 # Should you want to be able to specify either maildir or non-maildir
1147 # directory-style deliveries, then you must set up yet another transport,
1148 # called address_directory2. This is used if the path ends in "//" so should
1149 # be the one used for maildir, as the double slash suggests another level
1150 # of directory. In the absence of address_directory2, paths ending in //
1151 # are passed to address_directory.
1161 # This transport is used for handling autoreplies generated by the filtering
1162 # option of the forwardfile director. It has a conventional name, since it
1163 # is not actually mentioned elsewhere in this configuration file.
1167 # This transport is used for delivering messages over SMTP connections.
1171 connect_timeout = 1m
1173 tls_certificate = /etc/exim4/ssl/thishost.crt
1174 tls_privatekey = /etc/exim4/ssl/thishost.key
1177 remote_smtp_smarthost:
1178 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1180 .ifdef SMARTHST_PORT
1181 port = SMARTHST_PORT
1184 tls_tempfail_tryclear = false
1185 tls_certificate = /etc/exim4/ssl/thishost.crt
1186 tls_privatekey = /etc/exim4/ssl/thishost.key
1189 # Send the message to procmail
1192 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1194 user = ${local_part}
1203 user = ${extract{user}{\
1204 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1208 .ifdef HAVE_USER_DEBBUGS
1211 command = /org/bugs.debian.org/mail/run-procmail
1212 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1213 EXT=${substr_1:${local_part_suffix}}:\
1214 LOCAL=${local_part}${local_part_suffix}:\
1215 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1222 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1225 environment = EXTENSION=${substr_1:${local_part_suffix}}
1226 allow_commands = /usr/bin/rt-mailgate
1229 ######################################################################
1230 # RETRY CONFIGURATION #
1231 ######################################################################
1233 # This single retry rule applies to all domains and all errors. It specifies
1234 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1235 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1236 # hours, then retries every 8 hours until 4 days have passed since the first
1239 # Domain Error Retries
1240 # ------ ----- -------
1245 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1246 * * senders=: F,2h,10m
1247 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1248 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1250 # End of Exim 4 configuration