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 # submission-domains - Domains for which mail will be accepted via the
37 <%- if @is_mailrelay -%>
38 # mailhubdomains - Domains for which we are the MX, but the mail is relayed
39 # elsewhere. This is designed for use with small volume or
40 # restricted machines that need to use a smarthost for mail
41 # traffic. We will relay for them based on ssl cert validation
42 # but we need to teach Exim how to route the mail to them. This is
46 # From /var/lib/misc / UD:
48 # mail-forward.cdb - aliases for @d.o
49 # user-forward.cdb - aliases for @thishost.d.o
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 # Useful 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_c_scr
82 ######################################################################
83 # MAIN CONFIGURATION SETTINGS #
84 ######################################################################
87 perl_startup = do '/etc/exim4/exim_surbl.pl'
90 # These options specify the Access Control Lists (ACLs) that
91 # are used for incoming SMTP messages - after the RCPT and DATA
92 # commands, respectively.
94 acl_smtp_helo = check_helo
95 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
96 acl_smtp_data = check_message
98 acl_smtp_mime = acl_check_mime
100 acl_smtp_predata = acl_check_predata
102 # accept domain literal syntax in e-mail addresses. To actually make use of
103 # this a router is also required
104 allow_domain_literals = true
106 # This setting defines a named domain list called
107 # local_domains. It will be referenced
108 # later on by the syntax "+local_domains".
109 # Other domain and host lists may follow.
110 # @ is the local FQDN, @[] matches the IP adress of any local interface.
112 domainlist local_domains = @ : \
115 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
117 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
119 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
121 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
123 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
125 domainlist ourself_and_handled = $primary_hostname : +handled_domains
127 localpartlist local_only_users = lsearch;/etc/exim4/localusers
129 localpartlist postmasterish = postmaster : abuse : hostmaster
131 hostlist debianhosts = <; ; 127.0.0.1 ; ::1 ; /var/lib/misc/thishost/debianhosts
133 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
135 domainlist google_mxen = aspmx.l.google.com : gmail-smtp-in.l.google.com
136 domainlist single_domain_mx = +google_mxen
138 <%- if @is_mailrelay -%>
139 # Domains we relay for; that is domains that aren't considered local but we
140 # accept mail for them.
141 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
144 tls_certificate = /etc/exim4/ssl/thishost.crt
145 tls_privatekey = /etc/exim4/ssl/thishost.key
146 tls_try_verify_hosts = *
147 tls_verify_certificates = /etc/exim4/ssl/ca.crt
148 tls_crl = /etc/exim4/ssl/ca.crl
150 # The setting below causes Exim to do a reverse DNS lookup on all incoming
151 # IP calls, in order to get the true host name. If you feel this is too
152 # expensive, you can specify the networks for which a lookup is done, or
153 # remove the setting entirely.
155 # dns_ipv4_lookup = !localhost (disabled upon sgrans request, zobel, 2010-03-16)
157 # If this option is set, then any process that is running as one of the
158 # listed users may pass a message to Exim and specify the sender's
159 # address using the "-f" command line option, without Exim's adding a
162 untrusted_set_sender = *
164 # Some spam scanners (*cough* irritated *cough*) want the Sender field
165 # to exist. Appease them by not actually adding a Sender field.
167 local_from_check = false
169 # Some operating systems use the "gecos" field in the system password file
170 # to hold other information in addition to users' real names. Exim looks up
171 # this field when it is creating "sender" and "from" headers. If these options
172 # are set, Exim uses "gecos_pattern" to parse the gecos field, and then
173 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
176 gecos_pattern = ^([^,:]*)
179 # This tells Exim to immediately discard error messages (ie double bounces).
180 ignore_bounce_errors_after = 0s
182 timeout_frozen_after=14d
184 message_size_limit = 100M
186 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
188 smtp_accept_max = 300
189 smtp_accept_queue = 200
190 smtp_accept_queue_per_connection = 50
191 smtp_accept_reserve = 25
194 smtp_accept_queue = 20
195 smtp_accept_queue_per_connection = 10
196 smtp_accept_reserve = 5
198 smtp_reserve_hosts = +debianhosts
200 split_spool_directory = true
201 check_spool_inodes = 200
202 check_spool_space = 20M
207 message_body_visible = 5000
209 deliver_queue_load_max = 50
211 smtp_load_reserve = 20
214 <%- if scope.lookupvar('::processorcount').to_s != 'undefined' -%>
215 deliver_queue_load_max = <%= [scope.lookupvar('::processorcount').to_i,2].max * 5 %>
216 queue_only_load = <%= [scope.lookupvar('::processorcount').to_i,2].max * 4 %>
218 deliver_queue_load_max = 10
222 queue_list_requires_admin = false
224 <%- if has_variable?("clamd") && @clamd -%>
225 av_scanner = clamd:/var/run/clamav/clamd.ctl
230 out = "daemon_smtp_ports = "
232 if @mail_port # if we have an overridden mail_port
241 ports << @smarthost_port
244 out += ports.uniq.sort.join(" : ")
249 remote_sort_domains = *.debian.org:*.debian.net
251 pipelining_advertise_hosts = !*
252 tls_advertise_hosts = *
253 smtp_enforce_sync = true
255 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation +smtp_protocol_error
257 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
258 {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
259 ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
260 by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
261 (Exim $version_number)\n\t\
262 ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
263 id $message_exim_id${if def:received_for {\n\tfor $received_for}}
267 MAX_SCAN_SIZE = 256000
268 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
269 VSENDERDOMAINDATA = ${lookup{$sender_address_domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
270 WHITELIST = ${if match_domain{$domain}{+virtual_domains}\
271 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}\
272 {${lookup{$local_part}lsearch{${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}{$value}{}}}{}}}\
273 {/etc/exim4/whitelist} } : \
274 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}
275 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
276 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
277 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
278 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \
279 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}
280 <%- if @is_rtmaster -%>
281 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
287 ######################################################################
288 # ACL CONFIGURATION #
289 ######################################################################
293 # There are a few profiles that don't want much smtp time checking of
294 # mail. It's easier to track them in one place
296 accept condition = ${if eq {$acl_m_prf}{PopconMail}}
297 accept condition = ${if eq {$acl_m_prf}{BugsMail}}
302 # Determine the mail profile for this recipient.
303 # An empty string implies no match has been found.
305 warn set acl_m_rprf =
307 warn recipients = survey@popcon.debian.org
308 set acl_m_rprf = PopconMail
310 accept condition = ${if !eq {$acl_m_rprf}{}}
312 warn local_parts = +local_only_users
313 domains = +local_domains
314 hosts = !+debianhosts
315 set acl_m_rprf = localonly
317 <%- if @is_mailrelay -%>
318 warn local_parts = +local_only_users
319 domains = +mailhubdomains
320 hosts = !+debianhosts
321 set acl_m_rprf = localonly
324 accept condition = ${if !eq {$acl_m_rprf}{}}
326 <%- if @is_rtmaster -%>
327 warn domains = rt.debian.org
328 set acl_m_rprf = RTMail
330 accept condition = ${if !eq {$acl_m_rprf}{}}
333 <%- if @is_bugsmx -%>
334 warn domains = bugs.debian.org
335 set acl_m_rprf = BugsMail
337 accept condition = ${if !eq {$acl_m_rprf}{}}
340 <%- if @is_packagesmaster -%>
341 warn domains = packages.debian.org
342 set acl_m_rprf = PackagesMail
344 accept condition = ${if !eq {$acl_m_rprf}{}}
347 <%- if @is_packagesqamaster -%>
348 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
349 set acl_m_rprf = PTSOwner
351 accept condition = ${if !eq {$acl_m_rprf}{}}
354 domains = packages.qa.debian.org
355 condition = ${if match{$local_part}{\N^bounces+\N}}
356 set acl_m_rprf = PTSListBounce
358 accept condition = ${if !eq {$acl_m_rprf}{}}
360 warn domains = packages.qa.debian.org
361 set acl_m_rprf = PTSMail
363 accept condition = ${if !eq {$acl_m_rprf}{}}
366 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
367 set acl_m_rprf = DBSignedMail
369 accept condition = ${if !eq {$acl_m_rprf}{}}
371 warn domains = +virtual_domains
372 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
373 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
374 set acl_m_rprf = markup
376 accept condition = ${if !eq {$acl_m_rprf}{}}
378 warn domains = +virtual_domains
379 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
380 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
381 set acl_m_rprf = blackhole
383 accept condition = ${if !eq {$acl_m_rprf}{}}
385 warn domains = +virtual_domains
386 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
387 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{markup}}
388 set acl_m_rprf = markup
390 accept condition = ${if !eq {$acl_m_rprf}{}}
392 warn domains = +virtual_domains
393 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
394 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{blackhole}}
395 set acl_m_rprf = blackhole
397 accept condition = ${if !eq {$acl_m_rprf}{}}
399 warn domains = +local_domains
400 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
401 set acl_m_rprf = markup
403 accept condition = ${if !eq {$acl_m_rprf}{}}
405 warn domains = +local_domains
406 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
407 set acl_m_rprf = blackhole
409 accept condition = ${if !eq {$acl_m_rprf}{}}
411 warn set acl_m_rprf = normal
417 warn set acl_c_scr = 0
419 <%- if @is_mailrelay -%>
420 accept verify = certificate
423 <%- unless @use_smarthost -%>
424 # These are in HELO acl so that they are only run once. They increment a counter,
425 # so we don't want it to increment per rcpt to.
427 warn dnslists = list.dnswl.org&0.0.0.3
428 log_message = Hit on list.dnswl.org for $sender_host_address
429 set acl_c_scr = ${eval:$acl_c_scr-30}
431 warn dnslists = list.dnswl.org&0.0.0.2
432 log_message = Hit on list.dnswl.org for $sender_host_address
433 set acl_c_scr = ${eval:$acl_c_scr-20}
435 warn dnslists = list.dnswl.org
436 log_message = Hit on list.dnswl.org for $sender_host_address
437 set acl_c_scr = ${eval:$acl_c_scr-10}
439 warn condition = ${if isip {$sender_helo_name}}
440 log_message = remote host used IP address in HELO/EHLO greeting
441 set acl_c_scr = ${eval:$acl_c_scr+20}
443 warn !hosts = +debianhosts
444 condition = ${if eq{$host_lookup_failed}{1}}
445 set acl_c_scr = ${eval:$acl_c_scr+20}
447 warn !hosts = +debianhosts
448 condition = ${if eq{$host_lookup_failed}{0}}
449 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}}
450 set acl_c_scr = ${eval:$acl_c_scr+20}
452 warn !hosts = +debianhosts
453 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}}
454 set acl_c_scr = ${eval:$acl_c_scr+20}
456 warn !hosts = +debianhosts
457 dnslists = dul.dnsbl.sorbs.net
458 set acl_c_scr = ${eval:$acl_c_scr+15}
460 # If the sender's helo name is empty, the message will be rejected later
461 # because the helo is empty. If the rDNS lookup failed, we are already
462 # going to greylist them, so no sense worrying about it here. Finally,
463 # if rDNS does not match helo name (both lower cased first), greylist.
465 warn !hosts = +debianhosts
466 condition = ${if !eq {$host_lookup_failed}{1}}
467 condition = ${if def:sender_helo_name}
468 condition = ${if !eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}}
469 log_message = HELO doesn't match rDNS
470 set acl_c_scr = ${eval:$acl_c_scr+8}
473 # matches 098325879 - looks fishy
475 warn condition = ${if and { \
476 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
477 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
480 log_message = non-FQDN HELO
481 set acl_c_scr = ${eval:$acl_c_scr+12}
483 # Matches DOMAIN99.com - looks bad
485 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
486 log_message = SHOUTING HELO
487 set acl_c_scr = ${eval:$acl_c_scr+7}
489 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
490 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
491 # naive test, so it's not worth much
493 warn condition = ${if !match {${lc:$sender_helo_name}}{smtp}}
494 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
495 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
496 log_message = random HELO
497 set acl_c_scr = ${eval:$acl_c_scr+5}
500 drop !hosts = +debianhosts
501 log_message = mail from non-d.o host
502 message = Interesting. I doubt that should have happened.
505 # Implicit, but simpler to just say it
508 #!!# ACL that is used after the RCPT command on the submission port
511 accept hosts = +debianhosts
513 <%- if @is_mailrelay -%>
514 accept verify = certificate
517 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
518 # This is a rough pass at preventing address harvesting or other mail blasts.
520 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
521 message = Too many bad recipients, try again later
522 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
525 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
526 !hosts = +debianhosts
527 message = sorry, only 5 reports per hour for submission
529 accept domains = +local_domains
534 <%- if @is_mailrelay -%>
535 accept domains = +mailhubdomains
537 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
540 accept domains = +submission_domains
544 deny message = relay not permitted
546 #!!# ACL that is used after the RCPT command
549 <%- if @is_mailrelay -%>
550 accept verify = certificate
553 accept hosts = <; ::1 ; 127.0.0.1 ; @
554 warn acl = acl_getprofile
555 condition = ${if eq{$acl_m_prf}{}}
556 set acl_m_prf = $acl_m_rprf
558 defer condition = ${if !eq{$acl_m_prf}{$acl_m_rprf}}
559 message = Different profile, please retry
560 log_message = Only one profile at a time, please
562 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
563 # This is a rough pass at preventing address harvesting or other mail blasts.
565 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
566 !acl = acl_spamlovers
567 message = Too many bad recipients, try again later
568 !hosts = +debianhosts
569 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
571 # Dump spambots that are so stupid they say helo as our IP address
573 drop !hosts = +debianhosts
574 !acl = acl_spamlovers
575 condition = ${if eq {$sender_helo_name}{$interface_address}}
576 message = HELO mismatch Forged HELO for ($sender_helo_name)
578 # Also for spambots that say helo as us or one of our domains
580 drop !hosts = +debianhosts
581 !acl = acl_spamlovers
582 condition = ${if match_domain{$sender_helo_name}{+ourself_and_handled}}
583 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
584 message = HELO mismatch Forged HELO for ($sender_helo_name)
586 # This logic gives you a list of commonly forged domains in helo to reject against
588 warn set acl_m_frg = ${lookup{$sender_helo_name} \
589 nwildlsearch{/etc/exim4/helo-check} \
590 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
592 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
593 # say helo as a name in the list but we can't look them up
595 defer !hosts = +debianhosts
596 !acl = acl_spamlovers
597 condition = ${if !eq{$acl_m_frg}{}}
598 condition = ${if eq{$sender_host_name}{}}
599 condition = ${if !eq{$host_lookup_failed}{1}}
600 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
602 # If DNS works, go ahead and reject them
604 drop !hosts = +debianhosts
605 !acl = acl_spamlovers
606 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}}
607 message = HELO mismatch Forged HELO for ($sender_helo_name)
609 # disabled accounts don't even get local mail.
610 deny domains = +virtual_domains
611 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}\
612 {${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{true}{false}}}\
614 message = ${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{$value}}
616 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
617 domains = +local_domains
618 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
620 deny domains = +virtual_domains
621 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
622 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
624 hosts = !+debianhosts
625 message = mail for <$local_part@$domain> only accepted from debian.org machines
627 # Accept if the source is local SMTP (i.e. not over TCP/IP).
628 # We do this by testing for an empty sending host field.
631 deny domains = +handled_domains
632 local_parts = ^[.] : ^.*[@%!/|]
634 deny domains = !+handled_domains
635 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
637 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
638 sender_domains= +local_domains
639 hosts = !+debianhosts
640 message = mail from <$sender_address> not allowed externally
642 deny sender_domains= +virtual_domains
643 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}}
644 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}{true}}
645 hosts = !+debianhosts
646 message = mail from <$sender_address> not allowed externally
648 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}}
649 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}}
650 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}{true}}
651 message = no mail should ever come from <$sender_address>
653 warn condition = ${if eq{$acl_m_prf}{localonly}}
654 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
656 <%- if @is_packagesmaster -%>
657 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
658 condition = ${if eq {$sender_address}{$local_part@$domain}}
659 message = X-Packages-FromTo-Same: yes
662 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
665 defer !hosts = +debianhosts
666 condition = ${if !eq {$acl_m_prf}{PopconMail}}
667 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
668 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
669 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
671 <%- if has_variable?("policydweight") && @policydweight -%>
672 # Check with policyd-weight
673 warn !hosts = +debianhosts
674 condition = ${if !eq {$acl_m_prf}{PopconMail}}
675 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
676 {request=smtpd_access_policy\n\
677 protocol_state=RCPT\n\
678 protocol_name=${uc:$received_protocol}\n\
679 helo_name=$sender_helo_name\n\
680 queue_id=$message_exim_id\n\
681 sender=$sender_address\n\
682 recipient=$local_part@$domain\n\
683 recipient_count=$rcpt_count\n\
684 client_address=$sender_host_address\n\
685 client_name=$sender_host_name\n\
686 reverse_client_name=$sender_host_name\n\
687 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
688 {20s}{\n}{socket failure}}
690 # Defer on socket error
691 defer !hosts = +debianhosts
692 condition = ${if !eq {$acl_m_prf}{PopconMail}}
693 condition = ${if eq{$acl_m_pw}{socket failure}}
694 message = Cannot connect to policyd-weight. Please try again later.
696 # Set proposed action to $acl_m_act and message to $acl_m_mes
697 warn !hosts = +debianhosts
698 condition = ${if !eq {$acl_m_prf}{PopconMail}}
699 set acl_m_mes = ${extract{action}{$acl_m_pw}}
700 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
702 # Add X-policyd-weight header line to message
703 warn !hosts = +debianhosts
704 condition = ${if !eq {$acl_m_prf}{PopconMail}}
706 condition = ${if eq{$acl_m_act}{PREPEND}}
708 # Write log message, if policyd-weight can't run checks
709 warn !hosts = +debianhosts
710 condition = ${if !eq {$acl_m_prf}{PopconMail}}
711 log_message = policyd-weight message: $acl_m_mes
712 condition = ${if eq{$acl_m_act}{DUNNO}}
714 # Deny mails which policyd-weight thinks are spam
715 deny !hosts = +debianhosts
716 condition = ${if !eq {$acl_m_prf}{PopconMail}}
717 message = policyd-weight said: $acl_m_mes
718 condition = ${if eq{$acl_m_act}{550}}
720 # Defer messages when policyd-weight suggests so.
721 defer !hosts = +debianhosts
722 condition = ${if !eq {$acl_m_prf}{PopconMail}}
723 message = policyd-weight said: $acl_m_mes
724 condition = ${if eq{$acl_m_act}{450}}
727 <%- if @is_rtmaster -%>
728 warn condition = ${if eq{$acl_m_prf}{RTMail}}
729 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}}}}
730 # temporary hack because weasel screwed up and gave people an rt-3520@ address, which doesn't really work normally. and rt-3645
731 #set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
735 <%- if has_variable?("greylistd") && @greylistd -%>
737 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
738 log_message = greylisted.
739 local_parts = ${if match_domain{$domain}{+virtual_domains}\
740 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
741 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
742 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
743 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
745 !hosts = : +debianhosts : WHITELIST : \
746 ${if exists {/etc/greylistd/whitelist-hosts}\
747 {/etc/greylistd/whitelist-hosts}{}} : \
748 ${if exists {/var/lib/greylistd/whitelist-hosts}\
749 {/var/lib/greylistd/whitelist-hosts}{}}
750 condition = ${if !eq {$acl_m_prf}{PopconMail}}
752 domains = +handled_domains
753 condition = ${readsocket{/var/run/greylistd/socket}\
755 $sender_host_address \
757 $local_part@$domain}\
760 <%- elsif has_variable?("postgrey") && @postgrey -%>
761 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
762 # this adds acl_m_grey if there isn't one (so unique per message)
765 !hosts = : +debianhosts : WHITELIST
766 condition = ${if !eq {$acl_m_prf}{PopconMail}}
767 condition = ${if ! def:acl_m_grey}
768 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
770 # and defers the message if postgrey thinks it should be defered ...
773 !hosts = : +debianhosts : WHITELIST
774 condition = ${if !eq {$acl_m_prf}{PopconMail}}
776 domains = +handled_domains
777 local_parts = GREYLIST_LOCAL_PARTS
778 set acl_m_pgr = request=smtpd_access_policy\n\
779 protocol_state=RCPT\n\
780 protocol_name=${uc:$received_protocol}\n\
781 instance=${acl_m_grey}\n\
782 helo_name=${sender_helo_name}\n\
783 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
784 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
786 client_address=${sender_host_address}\n\
788 client_name=${sender_host_name}\n\
789 sender=${sender_address}\n\
790 recipient=$local_part@$domain\n\n
791 set acl_m_pgr = ${sg{\
792 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
793 {5s}{}{action=DUNNO}}\
795 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
796 log_message = greylisted.
797 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
799 # ... or adds a header with information about how long the delay was
802 !hosts = : +debianhosts : WHITELIST
803 condition = ${if !eq {$acl_m_prf}{PopconMail}}
805 domains = +handled_domains
806 local_parts = GREYLIST_LOCAL_PARTS
807 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
808 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
811 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
812 message = I'm terribly sorry, but it seems you have been blacklisted
813 log_message = blacklisted IP
815 deny log_message = <$sender_address> is blacklisted
816 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
817 message = We have blacklisted <$sender_address>. Please stop mailing us
819 accept local_parts = +postmasterish
820 domains = +virtual_domains : +bsmtp_domains
822 <%- unless @use_smarthost -%>
823 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
824 dnslists = ${if match_domain{$domain}{+virtual_domains}\
825 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
826 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
827 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
828 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
829 domains = +handled_domains
830 !hosts = +debianhosts : WHITELIST
833 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
834 dnslists = ${if match_domain{$domain}{+virtual_domains}\
835 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
836 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
837 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
838 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
839 domains = +handled_domains
840 !hosts = +debianhosts : WHITELIST
842 <%- unless @use_smarthost -%>
843 deny domains = +handled_domains
844 local_parts = ${if match_domain{$domain}{+virtual_domains}\
845 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
846 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
847 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}}}} : \
848 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}
849 !hosts = +debianhosts : WHITELIST
850 !verify = sender/callout=90s,maxwait=300s
851 message = "Sender verification failed: $acl_verify_message"
854 <%- if @is_mailrelay -%>
855 accept domains = +mailhubdomains
857 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
860 accept domains = +handled_domains
862 verify = recipient/defer_ok
864 accept hosts = +debianhosts
866 accept authenticated = *
868 deny message = relay not permitted
873 accept verify = certificate
874 accept hosts = +debianhosts
876 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
877 condition = ${if eq {$acl_m_prf}{blackhole}}
878 set acl_m_srb = ${perl{surblspamcheck}}
879 condition = ${if !eq{$acl_m_srb}{false}}
880 log_message = discarded surbl message for $recipients
882 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
883 condition = ${if !eq {$acl_m_prf}{markup}}
884 condition = ${if !eq {$acl_m_prf}{PopconMail}}
885 set acl_m_srb = ${perl{surblspamcheck}}
886 condition = ${if !eq{$acl_m_srb}{false}}
887 log_message = $acl_m_srb
890 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
891 condition = ${if eq {$acl_m_prf}{markup}}
892 set acl_m_srb = ${perl{surblspamcheck}}
893 condition = ${if !eq{$acl_m_srb}{false}}
894 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
900 deny condition = ${if eq{$acl_m_prf}{localonly}}
901 message = mail for $acl_m_lrc is only accepted internally
906 #!!# ACL that is used after the DATA command
909 # Some people put from postmaster@something.debian.org in the From
910 # header. Take their crack pipe away.
911 drop condition = ${if match{${lc:$h_From:}}{\Npostmaster@([^.]+\.)?debian\.org\N}}
913 <%- if @is_rtmaster -%>
914 deny condition = ${if eq {$acl_m_prf}{RTMail}}
915 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
916 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
917 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
918 message = messages to the Request Tracker system require a subject tag or a subaddress
921 <%- if @is_packagesqamaster -%>
922 deny !hosts = +debianhosts
923 condition = ${if eq {$acl_m_prf}{PTSMail}}
924 condition = ${if !def:h_X-PTS-Approved:}
925 message = messages to the PTS require an X-PTS-Approved header
928 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
929 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
930 {!match {$message_body}{PGP SIGNED MESSAGE}} \
931 {!match {$message_body}{PGP SIGNATURE}} \
932 {!match {$header_content-type:}{multipart/signed}} \
933 {!match {$header_content-type:}{pgp}} \
936 message = Mail to this address needs to be PGP-signed
938 accept verify = certificate
939 accept hosts = +debianhosts
941 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
942 !verify = header_syntax
943 message = Invalid header syntax: $acl_verify_message
945 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
946 # postfix's strict_7bit_headers option, but only checks a few common problem
947 # headers, as there doesn't appear to be an easy way to check them all.
949 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
950 {match {$rh_To:}{[\200-\377]}}\
951 {match {$rh_From:}{[\200-\377]}}\
952 {match {$rh_Cc:}{[\200-\377]}}}}
953 condition = ${if !eq {$acl_m_prf}{PopconMail}}
954 message = improper use of 8-bit data in message header: message rejected
957 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}}
958 condition = ${if !eq {$acl_m_prf}{PopconMail}}
959 message = Your mailer is not RFC 2047 compliant: message rejected
961 <%- if has_variable?("clamd") && @clamd -%>
962 discard condition = ${if eq {$acl_m_prf}{blackhole}}
963 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
967 log_message = discarded malware message for $recipients
969 deny condition = ${if !eq {$acl_m_prf}{markup}}
970 condition = ${if !eq {$acl_m_prf}{PopconMail}}
971 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
975 message = malware detected: $malware_name: message rejected
977 warn condition = ${if eq {$acl_m_prf}{markup}}
978 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
982 message = X-malware detected: $malware_name
986 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
987 condition = ${if eq {$acl_m_prf}{blackhole}}
988 set acl_m_srb = ${perl{surblspamcheck}}
989 condition = ${if !eq{$acl_m_srb}{false}}
990 log_message = discarded surbl message for $recipients
992 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
993 condition = ${if !eq {$acl_m_prf}{markup}}
994 condition = ${if !eq {$acl_m_prf}{PopconMail}}
995 set acl_m_srb = ${perl{surblspamcheck}}
996 condition = ${if !eq{$acl_m_srb}{false}}
997 log_message = $acl_m_srb
1000 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1001 condition = ${if eq {$acl_m_prf}{markup}}
1002 set acl_m_srb = ${perl{surblspamcheck}}
1003 condition = ${if !eq{$acl_m_srb}{false}}
1004 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1007 # Check header_sender except for survey@popcon.d.o
1008 deny condition = ${if !eq{$acl_m_prf}{PopconMail}}
1009 !verify = header_sender
1010 message = No valid sender found in the From:, Sender: and Reply-to: headers
1012 <%- if @is_packagesmaster -%>
1013 deny message = Congratulations, you scored $spam_score points.
1014 log_message = spam: $spam_score points.
1015 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1017 !verify = certificate
1018 !hosts = +debianhosts
1019 condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1020 spam = pkg_user : true
1021 condition = ${if >{$spam_score_int}{59}}
1028 ######################################################################
1029 # REWRITE CONFIGURATION #
1030 ######################################################################
1036 \N^buildd_(.*)@fasolo\.debian\.org$\N buildd_$1@buildd.debian.org T
1037 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1038 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1039 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1042 #!!#######################################################!!#
1043 #!!# Here follow routers created from the old routers, #!!#
1044 #!!# for handling non-local domains. #!!#
1045 #!!#######################################################!!#
1051 ######################################################################
1052 # ROUTERS CONFIGURATION #
1053 # Specifies how addresses are handled #
1054 ######################################################################
1055 # ORDER DOES MATTER #
1056 # An address is passed to each in turn until it is accepted. #
1057 ######################################################################
1059 <%- if @is_mailrelay -%>
1061 driver = manualroute
1062 domains = +mailhubdomains
1063 transport = ${if forany{${lookup dnsdb{>: mxh=$domain}}}\
1064 {match_domain{$item}{+single_domain_mx}}\
1065 {remote_smtp_single_domain}{remote_smtp}\
1067 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1068 require_files = /etc/exim4/manualroute
1072 debug_print = "R: bsmtp for $local_part@$domain"
1073 driver = manualroute
1074 domains = +bsmtp_domains
1075 require_files = /etc/exim4/bsmtp
1076 route_list = * ${extract{file}{\
1077 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1081 # This router routes to remote hosts over SMTP by explicit IP address,
1082 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1083 # require this facility, which is why it is enabled by default in Exim.
1085 debug_print = "R: ipliteral for $local_part@$domain"
1087 domains = !+handled_domains
1088 transport = remote_smtp
1089 ignore_target_hosts = +reservedaddrs
1091 <%- if @use_smarthost -%>
1093 debug_print = "R: smarthost for $local_part@$domain"
1094 driver = manualroute
1095 domains = !+handled_domains
1096 transport = remote_smtp_smarthost
1097 route_list = * <%= @smarthost %>
1098 host_find_failed = defer
1099 same_domain_copy_routing = yes
1103 # This router routes to remote hosts over SMTP using a DNS lookup.
1104 # Ignore reserved network responses, including localhost.
1106 debug_print = "R: dnslookup for $local_part@$domain"
1108 domains = !+handled_domains
1109 transport = ${if forany{${lookup dnsdb{>: mxh=$domain}}}\
1110 {match_domain{$item}{+single_domain_mx}}\
1111 {remote_smtp_single_domain}{remote_smtp}\
1113 ignore_target_hosts = +reservedaddrs
1117 debug_print = "R: postmasterish for $local_part@$domain"
1122 local_parts = +postmasterish
1123 domains = +virtual_domains : +bsmtp_domains
1124 data = debian-admin@debian.org
1125 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1127 # This router handles aliasing using a traditional /etc/aliases file.
1128 # If any of your aliases expand to pipes or files, you will need to set
1129 # up a user and a group for these deliveries to run under. You can do
1130 # this by uncommenting the "user" option below (changing the user name
1131 # as appropriate) and adding a "group" option if necessary.
1134 debug_print = "R: system_aliases for $local_part@$domain"
1138 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1139 domains = +local_domains
1140 file_transport = address_file
1141 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1142 pipe_transport = address_pipe
1143 retry_use_local_part
1145 # This router handles forwarding using traditional .forward files.
1146 # It also allows mail filtering when a forward file starts with the
1147 # string "# Exim filter": to disable filtering, uncomment the "filter"
1148 # option. The check_ancestor option means that if the forward file
1149 # generates an address that is an ancestor of the current one, the
1150 # current one gets passed on instead. This covers the case where A is
1151 # aliased to B and B has a .forward file pointing to A.
1153 # For standard Debian setup of one group per user, it is acceptable---normal
1154 # even---for .forward to be group writable. If you have everyone in one
1155 # group, you should comment out the "modemask" line. Without it, the Exim
1156 # default of 022 will apply, which is probably what you want.
1159 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1164 directory_transport = address_directory
1165 domains = +local_domains
1166 # filter - I have disabled filtering to force users to use .forward-foo files
1167 # or procmail. This will make it easier to move mailers in the future
1169 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1170 # also checks if the .forward-bar exists, if not then it uses
1171 # .forward-default instead.
1172 file = $home/.forward\
1173 ${if eq{}{$local_part_suffix}{}{\
1174 ${if exists {${home}/.forward${local_part_suffix}} \
1175 {${local_part_suffix}}{-default}}\
1178 file_transport = address_file
1179 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1180 local_part_suffix = -*
1181 local_part_suffix_optional
1183 pipe_transport = address_pipe
1184 reply_transport = address_reply
1185 require_files = $home
1186 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1189 # This is a sendmailesque alias file lookup
1191 debug_print = "R: virt_aliases for $local_part@$domain"
1195 data = ${if exists{\
1196 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1197 {${lookup{$local_part}lsearch*{\
1198 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1200 directory_transport = address_directory
1201 domains = +virtual_domains
1202 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1203 cannot_route_message = Unknown user
1204 group = ${extract{group}{VDOMAINDATA}}
1205 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1206 pipe_transport = address_pipe
1207 qualify_preserve_domain
1208 retry_use_local_part
1209 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1210 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1211 user = ${extract{user}{VDOMAINDATA}}
1213 # No direct match, so try doing a regex match if there's an
1216 debug_print = "R: virt_aliases_regex for $local_part$local_part_suffix@$domain"
1220 data = ${if exists{\
1221 ${extract{directory}{VDOMAINDATA}{${value}/aliases.regex}}}\
1222 {${lookup{$local_part}nwildlsearch*{\
1223 ${extract{directory}{VDOMAINDATA}{$value/aliases.regex}}\
1225 directory_transport = address_directory
1226 domains = +virtual_domains
1227 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1228 cannot_route_message = Unknown user
1229 group = ${extract{group}{VDOMAINDATA}}
1230 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1231 pipe_transport = address_pipe
1232 qualify_preserve_domain
1233 retry_use_local_part
1234 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1235 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1236 user = ${extract{user}{VDOMAINDATA}}
1239 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1243 directory_transport = address_directory
1244 domains = +local_domains
1245 # filter - I have disabled filtering to force users to use .forward-foo files
1246 # or procmail. This will make it easier to move mailers in the future
1248 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1249 # also checks if the .forward-bar exists, if not then it uses
1250 # .forward-default instead.
1251 file = $home/.forward\
1252 ${if eq{}{$local_part_suffix}{}{\
1253 ${if exists {${home}/.forward${local_part_suffix}} \
1254 {${local_part_suffix}}{-default}}\
1257 file_transport = address_file
1258 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1259 local_part_suffix = -*
1260 local_part_suffix_optional
1262 pipe_transport = address_pipe
1263 reply_transport = address_reply
1264 require_files = $home
1267 # This delivers to procmail
1269 debug_print = "R: procmail for $local_part@$domain"
1272 domains = +local_domains
1273 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1274 local_part_suffix = -*
1275 local_part_suffix_optional
1278 require_files = $local_part:$home/.procmailrc
1279 transport = procmail_pipe
1280 transport_current_directory = $home
1282 # This driver delivers to the LDAP generated alias file.
1284 debug_print = "R: ldap_aliases for $local_part@$domain"
1288 data = ${if exists{/var/lib/misc/$primary_hostname/user-forward.cdb}\
1289 {${lookup{$local_part}cdb\
1290 {/var/lib/misc/$primary_hostname/user-forward.cdb}}}}
1291 domains = +local_domains
1292 file_transport = address_file
1293 local_part_suffix = -*
1294 local_part_suffix_optional
1295 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1296 pipe_transport = address_pipe
1297 retry_use_local_part
1299 # This director matches local user mailboxes.
1301 debug_print = "R: localuser for $local_part@$domain"
1304 domains = +local_domains
1305 local_part_suffix = -*
1306 local_part_suffix_optional
1307 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1308 # Disable if the user has never logged in
1309 require_files = $home
1310 transport = local_delivery
1313 # Now we begin the Virtual Domain configuration
1314 # Everything before here should apply only to the local domains with a
1317 <%- if @is_packagesmaster -%>
1318 # This router delivers for packages.d.o
1320 debug_print = "R: packages for $local_part@$domain"
1322 file_transport = address_file
1323 pipe_transport = address_pipe
1324 domains = packages.debian.org
1325 require_files = /srv/packages.debian.org/conf/maintainer
1326 data = ${lookup{$local_part}cdb{/srv/packages.debian.org/conf/maintainer.cdb}}
1327 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1328 transport_home_directory = /srv/packages.debian.org/mail
1329 transport_current_directory = /srv/packages.debian.org/mail
1331 retry_use_local_part
1335 <%- if @is_rtmaster -%>
1336 # This router delivers for rt.d.o
1337 rt_force_new_verbose:
1338 debug_print = "R: rt for $local_part+new@$domain"
1340 domains = rt.debian.org
1341 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1342 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1343 local_part_suffix = +new
1344 pipe_transport = rt_pipe
1345 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}}"
1346 headers_remove = Subject
1347 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:}}"
1349 # FIXME: figure out how to generalize this approach so that all of the following would work
1350 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1351 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1352 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1353 # requires modification to custom condition in 'scrips'
1354 rt_force_new_quiesce:
1355 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1357 domains = rt.debian.org
1358 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1359 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1360 local_part_suffix = +new-quiesce
1361 pipe_transport = rt_pipe
1362 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}}"
1363 headers_remove = Subject
1364 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:}}"
1367 debug_print = "R: rt for $local_part@$domain"
1369 domains = rt.debian.org
1370 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1371 local_parts = ${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1372 local_part_suffix = +*
1373 local_part_suffix_optional
1374 pipe_transport = rt_pipe
1375 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}}}}"
1376 headers_remove = Subject
1377 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:}}"
1380 # Exim fails the router if it can't change to the user/group for delivery
1381 # during verification. So we have to separate the cases of verifying
1382 # the virts, and delivering to them. blah.
1385 debug_print = "R: virt_direct for $local_part@$domain"
1391 directory_transport = address_directory
1392 domains = +virtual_domains
1393 local_part_suffix = -*
1394 local_part_suffix_optional
1395 file = $home/.forward-\
1396 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1398 file_transport = address_file
1399 pipe_transport = address_pipe
1400 reply_transport = address_reply
1401 retry_use_local_part
1402 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1403 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1406 # This is a qmailesque deliver into a directory of .forward files
1408 debug_print = "R: virt_direct for $local_part@$domain"
1414 directory_transport = address_directory
1415 domains = +virtual_domains
1416 file = $home/.forward-\
1417 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1419 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1420 group = ${extract{group}{VDOMAINDATA}}
1421 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1423 local_part_suffix = -*
1424 local_part_suffix_optional
1425 pipe_transport = address_pipe
1426 reply_transport = address_reply
1427 retry_use_local_part
1428 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1429 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1431 user = ${extract{user}{VDOMAINDATA}}
1432 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1434 # This router delivers to the LDAP generated mail-forward file.
1435 # It's only really useful for debian.org
1437 debug_print = "R: virt_users for $local_part@$domain"
1441 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1442 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1443 user = ${extract{user}{VDOMAINDATA}}
1444 group = ${extract{group}{VDOMAINDATA}}
1445 # Manually construct the forwarding address, preserving the
1446 # local_part_suffix if the remote host is master.
1447 data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}\
1448 {! eq {${lookup{$local_part}cdb\
1449 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1451 {${local_part:${lookup{$local_part}cdb\
1452 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1453 ${if eq {${domain:${lookup{$local_part}cdb\
1454 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}{master.debian.org}{$local_part_suffix} {}}\
1456 ${domain:${lookup{$local_part}cdb\
1457 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}}
1458 domains = +virtual_domains
1459 file_transport = address_file
1460 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1461 pipe_transport = address_pipe
1462 local_part_suffix = -*
1463 local_part_suffix_optional
1464 retry_use_local_part
1466 <%- if @is_bugsmx -%>
1467 # This router delivers for bugs.d.o
1469 debug_print = "R: bugs for $local_part@$domain"
1471 transport = bugs_pipe
1472 domains = bugs.debian.org
1473 cannot_route_message = Unknown or archived bug
1474 require_files = /srv/bugs.debian.org/mail/run-procmail
1476 local_parts = ${if match\
1478 {\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}\
1479 {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1480 {$local_part}fail}}fail}
1482 ######################################################################
1483 # TRANSPORTS CONFIGURATION #
1484 ######################################################################
1485 # ORDER DOES NOT MATTER #
1486 # Only one appropriate transport is called for each delivery. #
1487 ######################################################################
1492 # This transport is used for local delivery to user mailboxes. On Debian
1493 # systems group mail is used so we can write to the /var/mail
1494 # directory. (The alternative, which most other unixes use, is to deliver
1495 # as the user's own group, into a sticky-bitted directory)
1498 file = /var/mail/${local_part}
1501 no_mode_fail_narrower
1504 # This transport is used for handling pipe addresses generated by alias
1505 # or .forward files. It has a conventional name, since it is not actually
1506 # mentioned elsewhere in this configuration file. (A different name *can*
1507 # be specified via the "address_pipe_transport" option if you really want
1508 # to.) If the pipe generates any standard output, it is returned to the sender
1509 # of the message as a delivery error. Set return_fail_output instead if you
1510 # want this to happen only when the pipe fails to complete normally.
1514 current_directory = ${home}
1515 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1516 EXT=${substr_1:${local_part_suffix}}:\
1517 LOCAL=${local_part}${local_part_suffix}:\
1518 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1522 # This transport is used for handling file addresses generated by alias
1523 # or .forward files. It has a conventional name, since it is not actually
1524 # mentioned elsewhere in this configuration file.
1534 directory_mode = 0770
1535 mode_fail_narrower = false
1537 # This transport is used for handling file addresses generated by alias
1538 # or .forward files if the path ends in "/", which causes it to be treated
1539 # as a directory name rather than a file name. Each message is then delivered
1540 # to a unique file in the directory. If instead you want all such deliveries to
1541 # be in the "maildir" format that is used by some other mail software,
1542 # uncomment the final option below. If this is done, the directory specified
1543 # in the .forward or alias file is the base maildir directory.
1545 # Should you want to be able to specify either maildir or non-maildir
1546 # directory-style deliveries, then you must set up yet another transport,
1547 # called address_directory2. This is used if the path ends in "//" so should
1548 # be the one used for maildir, as the double slash suggests another level
1549 # of directory. In the absence of address_directory2, paths ending in //
1550 # are passed to address_directory.
1560 # This transport is used for handling autoreplies generated by the filtering
1561 # option of the forwardfile director. It has a conventional name, since it
1562 # is not actually mentioned elsewhere in this configuration file.
1566 # This transport is used for delivering messages over SMTP connections.
1570 connect_timeout = 15s
1571 delay_after_cutoff = false
1572 tls_certificate = /etc/exim4/ssl/thishost.crt
1573 tls_privatekey = /etc/exim4/ssl/thishost.key
1575 remote_smtp_single_domain:
1577 connect_timeout = 15s
1578 delay_after_cutoff = false
1580 tls_certificate = /etc/exim4/ssl/thishost.crt
1581 tls_privatekey = /etc/exim4/ssl/thishost.key
1583 <%- if @use_smarthost -%>
1584 remote_smtp_smarthost:
1585 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1587 delay_after_cutoff = false
1588 port = <%= @smarthost_port %>
1589 tls_tempfail_tryclear = false
1590 hosts_require_tls = <%= @smarthost %>
1591 tls_certificate = /etc/exim4/ssl/thishost.crt
1592 tls_privatekey = /etc/exim4/ssl/thishost.key
1594 # Send the message to procmail
1597 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}
1599 user = ${local_part}
1608 user = ${extract{user}{\
1609 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1613 <%- if @is_bugsmx -%>
1616 command = /srv/bugs.debian.org/mail/run-procmail
1617 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1618 EXT=${substr_1:${local_part_suffix}}:\
1619 LOCAL=${local_part}${local_part_suffix}:\
1620 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1626 <%- if @is_rtmaster -%>
1628 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1631 environment = EXTENSION=${substr_1:${local_part_suffix}}
1632 allow_commands = /usr/bin/rt-mailgate
1636 ######################################################################
1637 # RETRY CONFIGURATION #
1638 ######################################################################
1640 # This single retry rule applies to all domains and all errors. It specifies
1641 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1642 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1643 # hours, then retries every 8 hours until 4 days have passed since the first
1646 # Domain Error Retries
1647 # ------ ----- -------
1652 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1653 * * senders=: F,2h,10m
1654 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1655 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1657 # End of Exim 4 configuration