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
9 # The configuration file uses a set of rules to generate an
10 # acceptable mail environment for debian.org machines. It deviates
11 # considerably from what could be considered a standard Exim configuration.
13 # This configuration file brings in the necessary information from
14 # other databases stored in /etc/exim4/ and the files distributed by ud-ldap
16 # This file is independent of the local host, it should not be changed
17 # per machine. primary_hostname is used in all places that require per-host
20 # The configuration files in /etc/exim4 are as follows:
21 # locals - This is a list of domains that are considered local. A local
22 # domain is essentially one for which deliveries to /var/mail
23 # will be attempted. The users available for local delivery
24 # come from /etc/passwd and /etc/aliases. Wildcards are not
26 # virtualdomains - This is a list of all virtual domains. A virtual domain
27 # is much like a local domain, execpt that the delivery location
28 # and allowed set of users is controlled by a virtual domain
29 # alias file and not /etc/passwd. Wildcards are permitted
30 # relayhosts - Hostnames that can send any arbitarily addressed mail to
31 # us. This is primarily only useful for emergency 'queue
32 # flushing' operations, but should be populated with a list
33 # of trusted machines. Wildcards are not permitted
34 # bsmtp_domains - Domains that we deliver locally via bsmtp
35 <%- if @is_mailrelay -%>
36 # mailhubdomains - Domains for which we are the MX, but the mail is relayed
37 # elsewhere. This is designed for use with small volume or
38 # restricted machines that need to use a smarthost for mail
39 # traffic. We will relay for them based on ssl cert validation
40 # but we need to teach Exim how to route the mail to them. This is
44 # From /var/lib/misc / UD:
46 # mail-forward.cdb - aliases for @d.o
47 # user-forward.cdb - aliases for @thishost.d.o
49 # Exim's wildcard mechanism is a bit odd in that to say "any address in
50 # debian.org including debian.org" you must use two patterns,
53 # Also you can only place a * before a . and as the first char in a string.
54 # Wildcards always match last so they may be used as a catchall.
56 # Further details can be found in each of the files.
58 # Useful Exim commands:
59 # exim4 -qf - Try sending all messages right now, including frozen ones
60 # exim4 -bt foo@blah - Write what Exim would do if it saw the address
61 # Great for testing virtual domains and forward files
63 # Special Features for users:
64 # .forward-foo - is understood as an extension address for bar-foo@cow.com
65 # .forward-default - is understood to be a catch all for bar-*@cow.com
66 # .procmailrc - with no .forward file invokes procmail for delivery
69 # For virtual domains the first lookup is done against a linear text
70 # database called 'aliases', then .forward files are consulted. Exim
71 # filtering is available for these .forward files only. .forward-default
72 # is the universal catch all for everything not handled.
74 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
75 # will trigger things like rcpt to rate limiting or possibly a reject if
76 # enough hits are triggered).
78 # value is stored in acl_c_scr
80 ######################################################################
81 # MAIN CONFIGURATION SETTINGS #
82 ######################################################################
85 perl_startup = do '/etc/exim4/exim_surbl.pl'
88 # These options specify the Access Control Lists (ACLs) that
89 # are used for incoming SMTP messages - after the RCPT and DATA
90 # commands, respectively.
92 acl_smtp_helo = check_helo
93 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
94 acl_smtp_data = check_message
96 acl_smtp_mime = acl_check_mime
98 acl_smtp_predata = acl_check_predata
100 # accept domain literal syntax in e-mail addresses. To actually make use of
101 # this a router is also required
102 allow_domain_literals = true
104 # This setting defines a named domain list called
105 # local_domains. It will be referenced
106 # later on by the syntax "+local_domains".
107 # Other domain and host lists may follow.
108 # @ is the local FQDN, @[] matches the IP adress of any local interface.
110 domainlist local_domains = @ : \
113 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
115 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
117 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
119 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
121 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
123 domainlist ourself_and_handled = $primary_hostname : +handled_domains
125 localpartlist local_only_users = lsearch;/etc/exim4/localusers
127 localpartlist postmasterish = postmaster : abuse : hostmaster
129 hostlist debianhosts = <; ; 127.0.0.1 ; ::1 ; /var/lib/misc/thishost/debianhosts ; 89.16.166.49 ; 2001:41b8:202:deb:bab5:0:52c3:4b4c
131 hostlist reservedaddrs = 0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/24 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5
133 <%- if @is_mailrelay -%>
134 # Domains we relay for; that is domains that aren't considered local but we
135 # accept mail for them.
136 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
139 tls_certificate = /etc/exim4/ssl/thishost.crt
140 tls_privatekey = /etc/exim4/ssl/thishost.key
141 tls_try_verify_hosts = *
142 tls_verify_certificates = /etc/exim4/ssl/ca.crt
143 tls_crl = /etc/exim4/ssl/ca.crl
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 (disabled upon sgrans request, zobel, 2010-03-16)
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 untrusted_set_sender = *
159 # Some spam scanners (*cough* irritated *cough*) want the Sender field
160 # to exist. Appease them by not actually adding a Sender field.
162 local_from_check = false
164 # Some operating systems use the "gecos" field in the system password file
165 # to hold other information in addition to users' real names. Exim looks up
166 # this field when it is creating "sender" and "from" headers. If these options
167 # are set, Exim uses "gecos_pattern" to parse the gecos field, and then
168 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
171 gecos_pattern = ^([^,:]*)
174 # This tells Exim to immediately discard error messages (ie double bounces).
175 ignore_bounce_errors_after = 0s
177 timeout_frozen_after=14d
179 message_size_limit = 100M
181 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
183 smtp_accept_max = 300
184 smtp_accept_queue = 200
185 smtp_accept_queue_per_connection = 50
186 smtp_accept_reserve = 25
189 smtp_accept_queue = 20
190 smtp_accept_queue_per_connection = 10
191 smtp_accept_reserve = 5
193 smtp_reserve_hosts = +debianhosts
195 split_spool_directory = true
196 check_spool_inodes = 200
197 check_spool_space = 20M
202 message_body_visible = 5000
204 deliver_queue_load_max = 50
206 smtp_load_reserve = 20
209 <%- if scope.lookupvar('::processorcount').to_s != 'undefined' -%>
210 deliver_queue_load_max = <%= [scope.lookupvar('::processorcount').to_i,2].max * 5 %>
211 queue_only_load = <%= [scope.lookupvar('::processorcount').to_i,2].max * 4 %>
213 deliver_queue_load_max = 10
217 queue_list_requires_admin = false
219 <%- if has_variable?("clamd") && @clamd -%>
220 av_scanner = clamd:/var/run/clamav/clamd.ctl
225 out = "daemon_smtp_ports = "
227 if @mail_port # if we have an overridden mail_port
236 ports << @smarthost_port
239 out += ports.uniq.sort.join(" : ")
244 remote_sort_domains = *.debian.org:*.debian.net
246 pipelining_advertise_hosts = !*
247 tls_advertise_hosts = *
248 smtp_enforce_sync = true
250 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation +smtp_protocol_error
252 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
253 {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
254 ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
255 by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
256 (Exim $version_number)\n\t\
257 ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
258 id $message_exim_id${if def:received_for {\n\tfor $received_for}}
262 MAX_SCAN_SIZE = 256000
263 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
264 VSENDERDOMAINDATA = ${lookup{$sender_address_domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
265 WHITELIST = ${if match_domain{$domain}{+virtual_domains}\
266 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}\
267 {${lookup{$local_part}lsearch{${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}{$value}{}}}{}}}\
268 {/etc/exim4/whitelist} } : \
269 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}
270 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
271 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
272 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
273 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \
274 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}
275 <%- if @is_rtmaster -%>
276 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
282 ######################################################################
283 # ACL CONFIGURATION #
284 ######################################################################
288 # There are a few profiles that don't want much smtp time checking of
289 # mail. It's easier to track them in one place
291 accept condition = ${if eq {$acl_m_prf}{PopconMail}}
292 accept condition = ${if eq {$acl_m_prf}{BugsMail}}
297 # Determine the mail profile for this recipient.
298 # An empty string implies no match has been found.
300 warn set acl_m_rprf =
302 warn recipients = survey@popcon.debian.org
303 set acl_m_rprf = PopconMail
305 accept condition = ${if !eq {$acl_m_rprf}{}}
307 warn local_parts = +local_only_users
308 domains = +local_domains
309 hosts = !+debianhosts
310 set acl_m_rprf = localonly
312 <%- if @is_mailrelay -%>
313 warn local_parts = +local_only_users
314 domains = +mailhubdomains
315 hosts = !+debianhosts
316 set acl_m_rprf = localonly
319 accept condition = ${if !eq {$acl_m_rprf}{}}
321 <%- if @is_rtmaster -%>
322 warn domains = rt.debian.org
323 set acl_m_rprf = RTMail
325 accept condition = ${if !eq {$acl_m_rprf}{}}
328 <%- if @is_bugsmx -%>
329 warn domains = bugs.debian.org
330 set acl_m_rprf = BugsMail
332 accept condition = ${if !eq {$acl_m_rprf}{}}
335 <%- if @is_packagesmaster -%>
336 warn domains = packages.debian.org
337 set acl_m_rprf = PackagesMail
339 accept condition = ${if !eq {$acl_m_rprf}{}}
342 <%- if @is_packagesqamaster -%>
343 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
344 set acl_m_rprf = PTSOwner
346 accept condition = ${if !eq {$acl_m_rprf}{}}
349 domains = packages.qa.debian.org
350 condition = ${if match{$local_part}{\N^bounces+\N}}
351 set acl_m_rprf = PTSListBounce
353 accept condition = ${if !eq {$acl_m_rprf}{}}
355 warn domains = packages.qa.debian.org
356 set acl_m_rprf = PTSMail
358 accept condition = ${if !eq {$acl_m_rprf}{}}
361 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
362 set acl_m_rprf = DBSignedMail
364 accept condition = ${if !eq {$acl_m_rprf}{}}
366 warn domains = +virtual_domains
367 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
368 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
369 set acl_m_rprf = markup
371 accept condition = ${if !eq {$acl_m_rprf}{}}
373 warn domains = +virtual_domains
374 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
375 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
376 set acl_m_rprf = blackhole
378 accept condition = ${if !eq {$acl_m_rprf}{}}
380 warn domains = +virtual_domains
381 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
382 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{markup}}
383 set acl_m_rprf = markup
385 accept condition = ${if !eq {$acl_m_rprf}{}}
387 warn domains = +virtual_domains
388 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
389 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{blackhole}}
390 set acl_m_rprf = blackhole
392 accept condition = ${if !eq {$acl_m_rprf}{}}
394 warn domains = +local_domains
395 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
396 set acl_m_rprf = markup
398 accept condition = ${if !eq {$acl_m_rprf}{}}
400 warn domains = +local_domains
401 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
402 set acl_m_rprf = blackhole
404 accept condition = ${if !eq {$acl_m_rprf}{}}
406 warn set acl_m_rprf = normal
412 warn set acl_c_scr = 0
414 <%- if @is_mailrelay -%>
415 accept verify = certificate
418 <%- unless @use_smarthost -%>
419 # These are in HELO acl so that they are only run once. They increment a counter,
420 # so we don't want it to increment per rcpt to.
422 warn dnslists = list.dnswl.org&0.0.0.3
423 log_message = Hit on list.dnswl.org for $sender_host_address
424 set acl_c_scr = ${eval:$acl_c_scr-30}
426 warn dnslists = list.dnswl.org&0.0.0.2
427 log_message = Hit on list.dnswl.org for $sender_host_address
428 set acl_c_scr = ${eval:$acl_c_scr-20}
430 warn dnslists = list.dnswl.org
431 log_message = Hit on list.dnswl.org for $sender_host_address
432 set acl_c_scr = ${eval:$acl_c_scr-10}
434 warn condition = ${if isip {$sender_helo_name}}
435 log_message = remote host used IP address in HELO/EHLO greeting
436 set acl_c_scr = ${eval:$acl_c_scr+20}
438 warn !hosts = +debianhosts
439 condition = ${if eq{$host_lookup_failed}{1}}
440 set acl_c_scr = ${eval:$acl_c_scr+20}
442 warn !hosts = +debianhosts
443 condition = ${if eq{$host_lookup_failed}{0}}
444 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}}
445 set acl_c_scr = ${eval:$acl_c_scr+20}
447 warn !hosts = +debianhosts
448 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}}
449 set acl_c_scr = ${eval:$acl_c_scr+20}
451 warn !hosts = +debianhosts
452 dnslists = dul.dnsbl.sorbs.net
453 set acl_c_scr = ${eval:$acl_c_scr+15}
455 # If the sender's helo name is empty, the message will be rejected later
456 # because the helo is empty. If the rDNS lookup failed, we are already
457 # going to greylist them, so no sense worrying about it here. Finally,
458 # if rDNS does not match helo name (both lower cased first), greylist.
460 warn !hosts = +debianhosts
461 condition = ${if !eq {$host_lookup_failed}{1}}
462 condition = ${if def:sender_helo_name}
463 condition = ${if !eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}}
464 log_message = HELO doesn't match rDNS
465 set acl_c_scr = ${eval:$acl_c_scr+8}
468 # matches 098325879 - looks fishy
470 warn condition = ${if and { \
471 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
472 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
475 log_message = non-FQDN HELO
476 set acl_c_scr = ${eval:$acl_c_scr+12}
478 # Matches DOMAIN99.com - looks bad
480 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
481 log_message = SHOUTING HELO
482 set acl_c_scr = ${eval:$acl_c_scr+7}
484 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
485 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
486 # naive test, so it's not worth much
488 warn condition = ${if !match {${lc:$sender_helo_name}}{smtp}}
489 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
490 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
491 log_message = random HELO
492 set acl_c_scr = ${eval:$acl_c_scr+5}
495 drop !hosts = +debianhosts
496 log_message = mail from non-d.o host
497 message = Interesting. I doubt that should have happened.
500 # Implicit, but simpler to just say it
503 #!!# ACL that is used after the RCPT command on the submission port
506 accept hosts = +debianhosts
508 <%- if @is_mailrelay -%>
509 accept verify = certificate
512 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
513 # This is a rough pass at preventing address harvesting or other mail blasts.
515 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
516 message = Too many bad recipients, try again later
517 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
520 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
521 !hosts = +debianhosts
522 message = sorry, only 5 reports per hour for submission
524 accept domains = +local_domains
529 <%- if @is_mailrelay -%>
530 accept domains = +mailhubdomains
532 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
535 accept domains = +submission_domains
539 deny message = relay not permitted
541 #!!# ACL that is used after the RCPT command
544 <%- if @is_mailrelay -%>
545 accept verify = certificate
548 accept hosts = <; ::1 ; 127.0.0.1 ; @
549 warn acl = acl_getprofile
550 condition = ${if eq{$acl_m_prf}{}}
551 set acl_m_prf = $acl_m_rprf
553 defer condition = ${if !eq{$acl_m_prf}{$acl_m_rprf}}
554 message = Different profile, please retry
555 log_message = Only one profile at a time, please
557 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
558 # This is a rough pass at preventing address harvesting or other mail blasts.
560 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
561 !acl = acl_spamlovers
562 message = Too many bad recipients, try again later
563 !hosts = +debianhosts
564 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
566 # Dump spambots that are so stupid they say helo as our IP address
568 drop !hosts = +debianhosts
569 !acl = acl_spamlovers
570 condition = ${if eq {$sender_helo_name}{$interface_address}}
571 message = HELO mismatch Forged HELO for ($sender_helo_name)
573 # Also for spambots that say helo as us or one of our domains
575 drop !hosts = +debianhosts
576 !acl = acl_spamlovers
577 condition = ${if match_domain{$sender_helo_name}{+ourself_and_handled}}
578 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
579 message = HELO mismatch Forged HELO for ($sender_helo_name)
581 # This logic gives you a list of commonly forged domains in helo to reject against
583 warn set acl_m_frg = ${lookup{$sender_helo_name} \
584 nwildlsearch{/etc/exim4/helo-check} \
585 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
587 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
588 # say helo as a name in the list but we can't look them up
590 defer !hosts = +debianhosts
591 !acl = acl_spamlovers
592 condition = ${if !eq{$acl_m_frg}{}}
593 condition = ${if eq{$sender_host_name}{}}
594 condition = ${if !eq{$host_lookup_failed}{1}}
595 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
597 # If DNS works, go ahead and reject them
599 drop !hosts = +debianhosts
600 !acl = acl_spamlovers
601 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}}
602 message = HELO mismatch Forged HELO for ($sender_helo_name)
604 # disabled accounts don't even get local mail.
605 deny domains = +virtual_domains
606 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}\
607 {${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{true}{false}}}\
609 message = ${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{$value}}
611 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
612 domains = +local_domains
613 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
615 deny domains = +virtual_domains
616 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
617 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
619 hosts = !+debianhosts
620 message = mail for <$local_part@$domain> only accepted from debian.org machines
622 # Accept if the source is local SMTP (i.e. not over TCP/IP).
623 # We do this by testing for an empty sending host field.
626 deny domains = +handled_domains
627 local_parts = ^[.] : ^.*[@%!/|]
629 deny domains = !+handled_domains
630 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
632 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
633 sender_domains= +local_domains
634 hosts = !+debianhosts
635 message = mail from <$sender_address> not allowed externally
637 deny sender_domains= +virtual_domains
638 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}}
639 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}{true}}
640 hosts = !+debianhosts
641 message = mail from <$sender_address> not allowed externally
643 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}}
644 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}}
645 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}{true}}
646 message = no mail should ever come from <$sender_address>
648 warn condition = ${if eq{$acl_m_prf}{localonly}}
649 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
651 <%- if @is_packagesmaster -%>
652 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
653 condition = ${if eq {$sender_address}{$local_part@$domain}}
654 message = X-Packages-FromTo-Same: yes
657 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
660 defer !hosts = +debianhosts
661 condition = ${if !eq {$acl_m_prf}{PopconMail}}
662 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
663 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
664 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
666 <%- if has_variable?("policydweight") && @policydweight -%>
667 # Check with policyd-weight
668 warn !hosts = +debianhosts
669 condition = ${if !eq {$acl_m_prf}{PopconMail}}
670 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
671 {request=smtpd_access_policy\n\
672 protocol_state=RCPT\n\
673 protocol_name=${uc:$received_protocol}\n\
674 helo_name=$sender_helo_name\n\
675 queue_id=$message_exim_id\n\
676 sender=$sender_address\n\
677 recipient=$local_part@$domain\n\
678 recipient_count=$rcpt_count\n\
679 client_address=$sender_host_address\n\
680 client_name=$sender_host_name\n\
681 reverse_client_name=$sender_host_name\n\
682 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
683 {20s}{\n}{socket failure}}
685 # Defer on socket error
686 defer !hosts = +debianhosts
687 condition = ${if !eq {$acl_m_prf}{PopconMail}}
688 condition = ${if eq{$acl_m_pw}{socket failure}}
689 message = Cannot connect to policyd-weight. Please try again later.
691 # Set proposed action to $acl_m_act and message to $acl_m_mes
692 warn !hosts = +debianhosts
693 condition = ${if !eq {$acl_m_prf}{PopconMail}}
694 set acl_m_mes = ${extract{action}{$acl_m_pw}}
695 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
697 # Add X-policyd-weight header line to message
698 warn !hosts = +debianhosts
699 condition = ${if !eq {$acl_m_prf}{PopconMail}}
701 condition = ${if eq{$acl_m_act}{PREPEND}}
703 # Write log message, if policyd-weight can't run checks
704 warn !hosts = +debianhosts
705 condition = ${if !eq {$acl_m_prf}{PopconMail}}
706 log_message = policyd-weight message: $acl_m_mes
707 condition = ${if eq{$acl_m_act}{DUNNO}}
709 # Deny mails which policyd-weight thinks are spam
710 deny !hosts = +debianhosts
711 condition = ${if !eq {$acl_m_prf}{PopconMail}}
712 message = policyd-weight said: $acl_m_mes
713 condition = ${if eq{$acl_m_act}{550}}
715 # Defer messages when policyd-weight suggests so.
716 defer !hosts = +debianhosts
717 condition = ${if !eq {$acl_m_prf}{PopconMail}}
718 message = policyd-weight said: $acl_m_mes
719 condition = ${if eq{$acl_m_act}{450}}
722 <%- if @is_rtmaster -%>
723 warn condition = ${if eq{$acl_m_prf}{RTMail}}
724 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}{match{$local_part}{3520}}{match{$local_part}{3645}}} {RTMailRecipientHasSubaddress}}}}
725 # temporary hack because weasel screwed up and gave people an rt-3520@ address, which doesn't really work normally. and rt-3645
726 #set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
730 <%- if has_variable?("greylistd") && @greylistd -%>
732 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
733 log_message = greylisted.
734 local_parts = ${if match_domain{$domain}{+virtual_domains}\
735 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
736 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
737 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
738 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
740 !hosts = : +debianhosts : WHITELIST : \
741 ${if exists {/etc/greylistd/whitelist-hosts}\
742 {/etc/greylistd/whitelist-hosts}{}} : \
743 ${if exists {/var/lib/greylistd/whitelist-hosts}\
744 {/var/lib/greylistd/whitelist-hosts}{}}
745 condition = ${if !eq {$acl_m_prf}{PopconMail}}
747 domains = +handled_domains
748 condition = ${readsocket{/var/run/greylistd/socket}\
750 $sender_host_address \
752 $local_part@$domain}\
755 <%- elsif has_variable?("postgrey") && @postgrey -%>
756 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
757 # this adds acl_m_grey if there isn't one (so unique per message)
760 !hosts = : +debianhosts : WHITELIST
761 condition = ${if !eq {$acl_m_prf}{PopconMail}}
762 condition = ${if ! def:acl_m_grey}
763 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
765 # and defers the message if postgrey thinks it should be defered ...
768 !hosts = : +debianhosts : WHITELIST
769 condition = ${if !eq {$acl_m_prf}{PopconMail}}
771 domains = +handled_domains
772 local_parts = GREYLIST_LOCAL_PARTS
773 set acl_m_pgr = request=smtpd_access_policy\n\
774 protocol_state=RCPT\n\
775 protocol_name=${uc:$received_protocol}\n\
776 instance=${acl_m_grey}\n\
777 helo_name=${sender_helo_name}\n\
778 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
779 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
781 client_address=${sender_host_address}\n\
783 client_name=${sender_host_name}\n\
784 sender=${sender_address}\n\
785 recipient=$local_part@$domain\n\n
786 set acl_m_pgr = ${sg{\
787 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
788 {5s}{}{action=DUNNO}}\
790 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
791 log_message = greylisted.
792 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
794 # ... or adds a header with information about how long the delay was
797 !hosts = : +debianhosts : WHITELIST
798 condition = ${if !eq {$acl_m_prf}{PopconMail}}
800 domains = +handled_domains
801 local_parts = GREYLIST_LOCAL_PARTS
802 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
803 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
806 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
807 message = I'm terribly sorry, but it seems you have been blacklisted
808 log_message = blacklisted IP
810 deny log_message = <$sender_address> is blacklisted
811 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
812 message = We have blacklisted <$sender_address>. Please stop mailing us
814 accept local_parts = +postmasterish
815 domains = +virtual_domains : +bsmtp_domains
817 <%- unless @use_smarthost -%>
818 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
819 dnslists = ${if match_domain{$domain}{+virtual_domains}\
820 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
821 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
822 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
823 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
824 domains = +handled_domains
825 !hosts = +debianhosts : WHITELIST
828 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
829 dnslists = ${if match_domain{$domain}{+virtual_domains}\
830 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
831 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
832 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
833 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
834 domains = +handled_domains
835 !hosts = +debianhosts : WHITELIST
837 <%- unless @use_smarthost -%>
838 deny domains = +handled_domains
839 local_parts = ${if match_domain{$domain}{+virtual_domains}\
840 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
841 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
842 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}}}} : \
843 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}
844 !hosts = +debianhosts : WHITELIST
845 !verify = sender/callout=90s,maxwait=300s
846 message = "Sender verification failed: $acl_verify_message"
849 <%- if @is_mailrelay -%>
850 accept domains = +mailhubdomains
852 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
855 accept domains = +handled_domains
857 verify = recipient/defer_ok
859 accept hosts = +debianhosts
861 accept authenticated = *
863 deny message = relay not permitted
868 accept verify = certificate
869 accept hosts = +debianhosts
871 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
872 condition = ${if eq {$acl_m_prf}{blackhole}}
873 set acl_m_srb = ${perl{surblspamcheck}}
874 condition = ${if !eq{$acl_m_srb}{false}}
875 log_message = discarded surbl message for $recipients
877 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
878 condition = ${if !eq {$acl_m_prf}{markup}}
879 condition = ${if !eq {$acl_m_prf}{PopconMail}}
880 set acl_m_srb = ${perl{surblspamcheck}}
881 condition = ${if !eq{$acl_m_srb}{false}}
882 log_message = $acl_m_srb
885 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
886 condition = ${if eq {$acl_m_prf}{markup}}
887 set acl_m_srb = ${perl{surblspamcheck}}
888 condition = ${if !eq{$acl_m_srb}{false}}
889 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
895 deny condition = ${if eq{$acl_m_prf}{localonly}}
896 message = mail for $acl_m_lrc is only accepted internally
901 #!!# ACL that is used after the DATA command
904 # Some people put from postmaster@something.debian.org in the From
905 # header. Take their crack pipe away.
906 drop condition = ${if match{${lc:$h_From:}}{\Npostmaster@([^.]+\.)?debian\.org\N}}
908 <%- if @is_rtmaster -%>
909 deny condition = ${if eq {$acl_m_prf}{RTMail}}
910 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
911 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
912 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
913 message = messages to the Request Tracker system require a subject tag or a subaddress
916 <%- if @is_packagesqamaster -%>
917 deny !hosts = +debianhosts
918 condition = ${if eq {$acl_m_prf}{PTSMail}}
919 condition = ${if !def:h_X-PTS-Approved:}
920 message = messages to the PTS require an X-PTS-Approved header
923 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
924 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
925 {!match {$message_body}{PGP SIGNED MESSAGE}} \
926 {!match {$message_body}{PGP SIGNATURE}} \
927 {!match {$header_content-type:}{multipart/signed}} \
928 {!match {$header_content-type:}{pgp}} \
931 message = Mail to this address needs to be PGP-signed
933 accept verify = certificate
934 accept hosts = +debianhosts
936 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
937 !verify = header_syntax
938 message = Invalid header syntax: $acl_verify_message
940 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
941 # postfix's strict_7bit_headers option, but only checks a few common problem
942 # headers, as there doesn't appear to be an easy way to check them all.
944 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
945 {match {$rh_To:}{[\200-\377]}}\
946 {match {$rh_From:}{[\200-\377]}}\
947 {match {$rh_Cc:}{[\200-\377]}}}}
948 condition = ${if !eq {$acl_m_prf}{PopconMail}}
949 message = improper use of 8-bit data in message header: message rejected
952 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}}
953 condition = ${if !eq {$acl_m_prf}{PopconMail}}
954 message = Your mailer is not RFC 2047 compliant: message rejected
956 <%- if has_variable?("clamd") && @clamd -%>
957 discard condition = ${if eq {$acl_m_prf}{blackhole}}
958 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
962 log_message = discarded malware message for $recipients
964 deny condition = ${if !eq {$acl_m_prf}{markup}}
965 condition = ${if !eq {$acl_m_prf}{PopconMail}}
966 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
970 message = malware detected: $malware_name: message rejected
972 warn condition = ${if eq {$acl_m_prf}{markup}}
973 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
977 message = X-malware detected: $malware_name
981 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
982 condition = ${if eq {$acl_m_prf}{blackhole}}
983 set acl_m_srb = ${perl{surblspamcheck}}
984 condition = ${if !eq{$acl_m_srb}{false}}
985 log_message = discarded surbl message for $recipients
987 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
988 condition = ${if !eq {$acl_m_prf}{markup}}
989 condition = ${if !eq {$acl_m_prf}{PopconMail}}
990 set acl_m_srb = ${perl{surblspamcheck}}
991 condition = ${if !eq{$acl_m_srb}{false}}
992 log_message = $acl_m_srb
995 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
996 condition = ${if eq {$acl_m_prf}{markup}}
997 set acl_m_srb = ${perl{surblspamcheck}}
998 condition = ${if !eq{$acl_m_srb}{false}}
999 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1002 # Check header_sender except for survey@popcon.d.o
1003 deny condition = ${if !eq{$acl_m_prf}{PopconMail}}
1004 !verify = header_sender
1005 message = No valid sender found in the From:, Sender: and Reply-to: headers
1007 <%- if @is_packagesmaster -%>
1008 deny message = Congratulations, you scored $spam_score points.
1009 log_message = spam: $spam_score points.
1010 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1012 !verify = certificate
1013 !hosts = +debianhosts
1014 condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1015 spam = pkg_user : true
1016 condition = ${if >{$spam_score_int}{59}}
1023 ######################################################################
1024 # REWRITE CONFIGURATION #
1025 ######################################################################
1031 \N^buildd_(.*)@fasolo\.debian\.org$\N buildd_$1@buildd.debian.org T
1032 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1033 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1034 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1037 #!!#######################################################!!#
1038 #!!# Here follow routers created from the old routers, #!!#
1039 #!!# for handling non-local domains. #!!#
1040 #!!#######################################################!!#
1046 ######################################################################
1047 # ROUTERS CONFIGURATION #
1048 # Specifies how addresses are handled #
1049 ######################################################################
1050 # ORDER DOES MATTER #
1051 # An address is passed to each in turn until it is accepted. #
1052 ######################################################################
1054 <%- if @is_mailrelay -%>
1056 driver = manualroute
1057 domains = +mailhubdomains
1058 transport = remote_smtp
1059 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1060 require_files = /etc/exim4/manualroute
1064 debug_print = "R: bsmtp for $local_part@$domain"
1065 driver = manualroute
1066 domains = +bsmtp_domains
1067 require_files = /etc/exim4/bsmtp
1068 route_list = * ${extract{file}{\
1069 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1073 # This router routes to remote hosts over SMTP by explicit IP address,
1074 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1075 # require this facility, which is why it is enabled by default in Exim.
1077 debug_print = "R: ipliteral for $local_part@$domain"
1079 domains = !+handled_domains
1080 transport = remote_smtp
1081 ignore_target_hosts = +reservedaddrs
1083 <%- if @use_smarthost -%>
1085 debug_print = "R: smarthost for $local_part@$domain"
1086 driver = manualroute
1087 domains = !+handled_domains
1088 transport = remote_smtp_smarthost
1089 route_list = * <%= @smarthost %>
1090 host_find_failed = defer
1091 same_domain_copy_routing = yes
1095 # This router routes to remote hosts over SMTP using a DNS lookup.
1096 # Ignore reserved network responses, including localhost.
1098 debug_print = "R: dnslookup for $local_part@$domain"
1100 domains = !+handled_domains
1101 transport = remote_smtp
1102 ignore_target_hosts = +reservedaddrs
1106 debug_print = "R: postmasterish for $local_part@$domain"
1111 local_parts = +postmasterish
1112 domains = +virtual_domains : +bsmtp_domains
1113 data = debian-admin@debian.org
1114 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1116 # This router handles aliasing using a traditional /etc/aliases file.
1117 # If any of your aliases expand to pipes or files, you will need to set
1118 # up a user and a group for these deliveries to run under. You can do
1119 # this by uncommenting the "user" option below (changing the user name
1120 # as appropriate) and adding a "group" option if necessary.
1123 debug_print = "R: system_aliases for $local_part@$domain"
1127 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1128 domains = +local_domains
1129 file_transport = address_file
1130 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1131 pipe_transport = address_pipe
1132 retry_use_local_part
1134 # This router handles forwarding using traditional .forward files.
1135 # It also allows mail filtering when a forward file starts with the
1136 # string "# Exim filter": to disable filtering, uncomment the "filter"
1137 # option. The check_ancestor option means that if the forward file
1138 # generates an address that is an ancestor of the current one, the
1139 # current one gets passed on instead. This covers the case where A is
1140 # aliased to B and B has a .forward file pointing to A.
1142 # For standard Debian setup of one group per user, it is acceptable---normal
1143 # even---for .forward to be group writable. If you have everyone in one
1144 # group, you should comment out the "modemask" line. Without it, the Exim
1145 # default of 022 will apply, which is probably what you want.
1148 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1153 directory_transport = address_directory
1154 domains = +local_domains
1155 # filter - I have disabled filtering to force users to use .forward-foo files
1156 # or procmail. This will make it easier to move mailers in the future
1158 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1159 # also checks if the .forward-bar exists, if not then it uses
1160 # .forward-default instead.
1161 file = $home/.forward\
1162 ${if eq{}{$local_part_suffix}{}{\
1163 ${if exists {${home}/.forward${local_part_suffix}} \
1164 {${local_part_suffix}}{-default}}\
1167 file_transport = address_file
1168 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1169 local_part_suffix = -*
1170 local_part_suffix_optional
1172 pipe_transport = address_pipe
1173 reply_transport = address_reply
1174 require_files = $home
1175 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1178 # This is a sendmailesque alias file lookup
1180 debug_print = "R: virt_aliases for $local_part@$domain"
1184 data = ${if exists{\
1185 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1186 {${lookup{$local_part}lsearch*{\
1187 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1189 directory_transport = address_directory
1190 domains = +virtual_domains
1191 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1192 cannot_route_message = Unknown user
1193 group = ${extract{group}{VDOMAINDATA}}
1194 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1195 pipe_transport = address_pipe
1196 qualify_preserve_domain
1197 retry_use_local_part
1198 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1199 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1200 user = ${extract{user}{VDOMAINDATA}}
1202 # No direct match, so try doing a regex match if there's an
1205 debug_print = "R: virt_aliases_regex for $local_part$local_part_suffix@$domain"
1209 data = ${if exists{\
1210 ${extract{directory}{VDOMAINDATA}{${value}/aliases.regex}}}\
1211 {${lookup{$local_part}nwildlsearch*{\
1212 ${extract{directory}{VDOMAINDATA}{$value/aliases.regex}}\
1214 directory_transport = address_directory
1215 domains = +virtual_domains
1216 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1217 cannot_route_message = Unknown user
1218 group = ${extract{group}{VDOMAINDATA}}
1219 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1220 pipe_transport = address_pipe
1221 qualify_preserve_domain
1222 retry_use_local_part
1223 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1224 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1225 user = ${extract{user}{VDOMAINDATA}}
1228 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1232 directory_transport = address_directory
1233 domains = +local_domains
1234 # filter - I have disabled filtering to force users to use .forward-foo files
1235 # or procmail. This will make it easier to move mailers in the future
1237 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1238 # also checks if the .forward-bar exists, if not then it uses
1239 # .forward-default instead.
1240 file = $home/.forward\
1241 ${if eq{}{$local_part_suffix}{}{\
1242 ${if exists {${home}/.forward${local_part_suffix}} \
1243 {${local_part_suffix}}{-default}}\
1246 file_transport = address_file
1247 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1248 local_part_suffix = -*
1249 local_part_suffix_optional
1251 pipe_transport = address_pipe
1252 reply_transport = address_reply
1253 require_files = $home
1256 # This delivers to procmail
1258 debug_print = "R: procmail for $local_part@$domain"
1261 domains = +local_domains
1262 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1263 local_part_suffix = -*
1264 local_part_suffix_optional
1267 require_files = $local_part:$home/.procmailrc
1268 transport = procmail_pipe
1269 transport_current_directory = $home
1271 # This driver delivers to the LDAP generated alias file.
1273 debug_print = "R: ldap_aliases for $local_part@$domain"
1277 data = ${if exists{/var/lib/misc/$primary_hostname/user-forward.cdb}\
1278 {${lookup{$local_part}cdb\
1279 {/var/lib/misc/$primary_hostname/user-forward.cdb}}}}
1280 domains = +local_domains
1281 file_transport = address_file
1282 local_part_suffix = -*
1283 local_part_suffix_optional
1284 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1285 pipe_transport = address_pipe
1286 retry_use_local_part
1288 # This director matches local user mailboxes.
1290 debug_print = "R: localuser for $local_part@$domain"
1293 domains = +local_domains
1294 local_part_suffix = -*
1295 local_part_suffix_optional
1296 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1297 # Disable if the user has never logged in
1298 require_files = $home
1299 transport = local_delivery
1302 # Now we begin the Virtual Domain configuration
1303 # Everything before here should apply only to the local domains with a
1306 <%- if @is_packagesmaster -%>
1307 # This router delivers for packages.d.o
1309 debug_print = "R: packages for $local_part@$domain"
1311 file_transport = address_file
1312 pipe_transport = address_pipe
1313 domains = packages.debian.org
1314 require_files = /srv/packages.debian.org/conf/maintainer
1315 data = ${lookup{$local_part}cdb{/srv/packages.debian.org/conf/maintainer.cdb}}
1316 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1317 transport_home_directory = /srv/packages.debian.org/mail
1318 transport_current_directory = /srv/packages.debian.org/mail
1320 retry_use_local_part
1324 <%- if @is_rtmaster -%>
1325 # This router delivers for rt.d.o
1326 rt_force_new_verbose:
1327 debug_print = "R: rt for $local_part+new@$domain"
1329 domains = rt.debian.org
1330 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1331 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1332 local_part_suffix = +new
1333 pipe_transport = rt_pipe
1334 data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1335 headers_remove = Subject
1336 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?is)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1338 # FIXME: figure out how to generalize this approach so that all of the following would work
1339 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1340 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1341 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1342 # requires modification to custom condition in 'scrips'
1343 rt_force_new_quiesce:
1344 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1346 domains = rt.debian.org
1347 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1348 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1349 local_part_suffix = +new-quiesce
1350 pipe_transport = rt_pipe
1351 data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1352 headers_remove = Subject
1353 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?is)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1356 debug_print = "R: rt for $local_part@$domain"
1358 domains = rt.debian.org
1359 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1360 local_parts = ${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1361 local_part_suffix = +*
1362 local_part_suffix_optional
1363 pipe_transport = rt_pipe
1364 data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{${if match{$local_part}{.*-done.*}{correspond-resolve}{correspond}}}}"
1365 headers_remove = Subject
1366 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?i)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1369 # Exim fails the router if it can't change to the user/group for delivery
1370 # during verification. So we have to separate the cases of verifying
1371 # the virts, and delivering to them. blah.
1374 debug_print = "R: virt_direct for $local_part@$domain"
1380 directory_transport = address_directory
1381 domains = +virtual_domains
1382 local_part_suffix = -*
1383 local_part_suffix_optional
1384 file = $home/.forward-\
1385 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1387 file_transport = address_file
1388 pipe_transport = address_pipe
1389 reply_transport = address_reply
1390 retry_use_local_part
1391 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1392 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1395 # This is a qmailesque deliver into a directory of .forward files
1397 debug_print = "R: virt_direct for $local_part@$domain"
1403 directory_transport = address_directory
1404 domains = +virtual_domains
1405 file = $home/.forward-\
1406 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1408 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1409 group = ${extract{group}{VDOMAINDATA}}
1410 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1412 local_part_suffix = -*
1413 local_part_suffix_optional
1414 pipe_transport = address_pipe
1415 reply_transport = address_reply
1416 retry_use_local_part
1417 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1418 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1420 user = ${extract{user}{VDOMAINDATA}}
1421 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1423 # This router delivers to the LDAP generated mail-forward file.
1424 # It's only really useful for debian.org
1426 debug_print = "R: virt_users for $local_part@$domain"
1430 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1431 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1432 user = ${extract{user}{VDOMAINDATA}}
1433 group = ${extract{group}{VDOMAINDATA}}
1434 # Manually construct the forwarding address, preserving the
1435 # local_part_suffix if the remote host is master.
1436 data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}\
1437 {! eq {${lookup{$local_part}cdb\
1438 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1440 {${local_part:${lookup{$local_part}cdb\
1441 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1442 ${if eq {${domain:${lookup{$local_part}cdb\
1443 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}{master.debian.org}{$local_part_suffix} {}}\
1445 ${domain:${lookup{$local_part}cdb\
1446 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}}
1447 domains = +virtual_domains
1448 file_transport = address_file
1449 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1450 pipe_transport = address_pipe
1451 local_part_suffix = -*
1452 local_part_suffix_optional
1453 retry_use_local_part
1455 <%- if @is_bugsmx -%>
1456 # This router delivers for bugs.d.o
1458 debug_print = "R: bugs for $local_part@$domain"
1460 transport = bugs_pipe
1461 domains = bugs.debian.org
1462 cannot_route_message = Unknown or archived bug
1463 require_files = /srv/bugs.debian.org/mail/run-procmail
1465 local_parts = ${if match\
1467 {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|help|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
1468 {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1469 {$local_part}fail}}fail}
1471 ######################################################################
1472 # TRANSPORTS CONFIGURATION #
1473 ######################################################################
1474 # ORDER DOES NOT MATTER #
1475 # Only one appropriate transport is called for each delivery. #
1476 ######################################################################
1481 # This transport is used for local delivery to user mailboxes. On Debian
1482 # systems group mail is used so we can write to the /var/mail
1483 # directory. (The alternative, which most other unixes use, is to deliver
1484 # as the user's own group, into a sticky-bitted directory)
1487 file = /var/mail/${local_part}
1490 no_mode_fail_narrower
1493 # This transport is used for handling pipe addresses generated by alias
1494 # or .forward files. It has a conventional name, since it is not actually
1495 # mentioned elsewhere in this configuration file. (A different name *can*
1496 # be specified via the "address_pipe_transport" option if you really want
1497 # to.) If the pipe generates any standard output, it is returned to the sender
1498 # of the message as a delivery error. Set return_fail_output instead if you
1499 # want this to happen only when the pipe fails to complete normally.
1503 current_directory = ${home}
1504 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1505 EXT=${substr_1:${local_part_suffix}}:\
1506 LOCAL=${local_part}${local_part_suffix}:\
1507 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1511 # This transport is used for handling file addresses generated by alias
1512 # or .forward files. It has a conventional name, since it is not actually
1513 # mentioned elsewhere in this configuration file.
1523 directory_mode = 0770
1524 mode_fail_narrower = false
1526 # This transport is used for handling file addresses generated by alias
1527 # or .forward files if the path ends in "/", which causes it to be treated
1528 # as a directory name rather than a file name. Each message is then delivered
1529 # to a unique file in the directory. If instead you want all such deliveries to
1530 # be in the "maildir" format that is used by some other mail software,
1531 # uncomment the final option below. If this is done, the directory specified
1532 # in the .forward or alias file is the base maildir directory.
1534 # Should you want to be able to specify either maildir or non-maildir
1535 # directory-style deliveries, then you must set up yet another transport,
1536 # called address_directory2. This is used if the path ends in "//" so should
1537 # be the one used for maildir, as the double slash suggests another level
1538 # of directory. In the absence of address_directory2, paths ending in //
1539 # are passed to address_directory.
1549 # This transport is used for handling autoreplies generated by the filtering
1550 # option of the forwardfile director. It has a conventional name, since it
1551 # is not actually mentioned elsewhere in this configuration file.
1555 # This transport is used for delivering messages over SMTP connections.
1559 connect_timeout = 15s
1560 delay_after_cutoff = false
1561 tls_certificate = /etc/exim4/ssl/thishost.crt
1562 tls_privatekey = /etc/exim4/ssl/thishost.key
1564 <%- if @use_smarthost -%>
1565 remote_smtp_smarthost:
1566 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1568 delay_after_cutoff = false
1569 port = <%= @smarthost_port %>
1570 tls_tempfail_tryclear = false
1571 hosts_require_tls = <%= @smarthost %>
1572 tls_certificate = /etc/exim4/ssl/thishost.crt
1573 tls_privatekey = /etc/exim4/ssl/thishost.key
1575 # Send the message to procmail
1578 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}
1580 user = ${local_part}
1589 user = ${extract{user}{\
1590 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1594 <%- if @is_bugsmx -%>
1597 command = /srv/bugs.debian.org/mail/run-procmail
1598 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1599 EXT=${substr_1:${local_part_suffix}}:\
1600 LOCAL=${local_part}${local_part_suffix}:\
1601 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1607 <%- if @is_rtmaster -%>
1609 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1612 environment = EXTENSION=${substr_1:${local_part_suffix}}
1613 allow_commands = /usr/bin/rt-mailgate
1617 ######################################################################
1618 # RETRY CONFIGURATION #
1619 ######################################################################
1621 # This single retry rule applies to all domains and all errors. It specifies
1622 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1623 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1624 # hours, then retries every 8 hours until 4 days have passed since the first
1627 # Domain Error Retries
1628 # ------ ----- -------
1633 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1634 * * senders=: F,2h,10m
1635 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1636 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1638 # End of Exim 4 configuration