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 ; 82.195.75.76 ; 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}}
296 # This is a bad hack to reset the variable, by defining it be something
299 warn set acl_m_rprf = $acl_m_undefined
301 warn recipients = survey@popcon.debian.org
302 set acl_m_rprf = PopconMail
304 accept condition = ${if !eq {$acl_m_rprf}{}}
306 warn local_parts = +local_only_users
307 domains = +local_domains
308 hosts = !+debianhosts
309 set acl_m_rprf = localonly
311 <%- if @is_mailrelay -%>
312 warn local_parts = +local_only_users
313 domains = +mailhubdomains
314 hosts = !+debianhosts
315 set acl_m_rprf = localonly
318 accept condition = ${if !eq {$acl_m_rprf}{}}
320 <%- if @is_rtmaster -%>
321 warn domains = rt.debian.org
322 set acl_m_rprf = RTMail
324 accept condition = ${if !eq {$acl_m_rprf}{}}
327 <%- if @is_bugsmx -%>
328 warn domains = bugs.debian.org
329 set acl_m_rprf = BugsMail
331 accept condition = ${if !eq {$acl_m_rprf}{}}
334 <%- if @is_packagesmaster -%>
335 warn domains = packages.debian.org
336 set acl_m_rprf = PackagesMail
338 accept condition = ${if !eq {$acl_m_rprf}{}}
341 <%- if @is_packagesqamaster -%>
342 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
343 set acl_m_rprf = PTSOwner
345 accept condition = ${if !eq {$acl_m_rprf}{}}
348 domains = packages.qa.debian.org
349 condition = ${if match{$local_part}{\N^bounces+\N}}
350 set acl_m_rprf = PTSListBounce
352 accept condition = ${if !eq {$acl_m_rprf}{}}
354 warn domains = packages.qa.debian.org
355 set acl_m_rprf = PTSMail
357 accept condition = ${if !eq {$acl_m_rprf}{}}
360 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
361 set acl_m_rprf = DBSignedMail
363 accept condition = ${if !eq {$acl_m_rprf}{}}
365 warn domains = +virtual_domains
366 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
367 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
368 set acl_m_rprf = markup
370 accept condition = ${if !eq {$acl_m_rprf}{}}
372 warn domains = +virtual_domains
373 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
374 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
375 set acl_m_rprf = blackhole
377 accept condition = ${if !eq {$acl_m_rprf}{}}
379 warn domains = +virtual_domains
380 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
381 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{markup}}
382 set acl_m_rprf = markup
384 accept condition = ${if !eq {$acl_m_rprf}{}}
386 warn domains = +virtual_domains
387 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
388 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{blackhole}}
389 set acl_m_rprf = blackhole
391 accept condition = ${if !eq {$acl_m_rprf}{}}
393 warn domains = +local_domains
394 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
395 set acl_m_rprf = markup
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}{}}}{blackhole}}
401 set acl_m_rprf = blackhole
403 accept condition = ${if !eq {$acl_m_rprf}{}}
405 warn set acl_m_rprf = normal
411 warn set acl_c_scr = 0
413 <%- if @is_mailrelay -%>
414 accept verify = certificate
417 <%- unless @use_smarthost -%>
418 # These are in HELO acl so that they are only run once. They increment a counter,
419 # so we don't want it to increment per rcpt to.
421 warn dnslists = list.dnswl.org&0.0.0.3
422 log_message = Hit on list.dnswl.org for $sender_host_address
423 set acl_c_scr = ${eval:$acl_c_scr-30}
425 warn dnslists = list.dnswl.org&0.0.0.2
426 log_message = Hit on list.dnswl.org for $sender_host_address
427 set acl_c_scr = ${eval:$acl_c_scr-20}
429 warn dnslists = list.dnswl.org
430 log_message = Hit on list.dnswl.org for $sender_host_address
431 set acl_c_scr = ${eval:$acl_c_scr-10}
433 warn condition = ${if isip {$sender_helo_name}}
434 log_message = remote host used IP address in HELO/EHLO greeting
435 set acl_c_scr = ${eval:$acl_c_scr+20}
437 warn !hosts = +debianhosts
438 condition = ${if eq{$host_lookup_failed}{1}}
439 set acl_c_scr = ${eval:$acl_c_scr+20}
441 warn !hosts = +debianhosts
442 condition = ${if eq{$host_lookup_failed}{0}}
443 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}}
444 set acl_c_scr = ${eval:$acl_c_scr+20}
446 warn !hosts = +debianhosts
447 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}}
448 set acl_c_scr = ${eval:$acl_c_scr+20}
450 warn !hosts = +debianhosts
451 dnslists = dul.dnsbl.sorbs.net
452 set acl_c_scr = ${eval:$acl_c_scr+15}
454 # If the sender's helo name is empty, the message will be rejected later
455 # because the helo is empty. If the rDNS lookup failed, we are already
456 # going to greylist them, so no sense worrying about it here. Finally,
457 # if rDNS does not match helo name (both lower cased first), greylist.
459 warn !hosts = +debianhosts
460 condition = ${if !eq {$host_lookup_failed}{1}}
461 condition = ${if def:sender_helo_name}
462 condition = ${if !eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}}
463 log_message = HELO doesn't match rDNS
464 set acl_c_scr = ${eval:$acl_c_scr+8}
467 # matches 098325879 - looks fishy
469 warn condition = ${if and { \
470 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
471 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
474 log_message = non-FQDN HELO
475 set acl_c_scr = ${eval:$acl_c_scr+12}
477 # Matches DOMAIN99.com - looks bad
479 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
480 log_message = SHOUTING HELO
481 set acl_c_scr = ${eval:$acl_c_scr+7}
483 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
484 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
485 # naive test, so it's not worth much
487 warn condition = ${if !match {${lc:$sender_helo_name}}{smtp}}
488 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
489 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
490 log_message = random HELO
491 set acl_c_scr = ${eval:$acl_c_scr+5}
494 drop !hosts = +debianhosts
495 log_message = mail from non-d.o host
496 message = Interesting. I doubt that should have happened.
499 # Implicit, but simpler to just say it
502 #!!# ACL that is used after the RCPT command on the submission port
505 # Accept if the source is local SMTP (i.e. not over TCP/IP).
506 # We do this by testing for an empty sending host field.
507 accept hosts = +debianhosts
509 <%- if @is_mailrelay -%>
510 accept verify = certificate
513 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
514 # This is a rough pass at preventing address harvesting or other mail blasts.
516 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
517 message = Too many bad recipients, try again later
518 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
521 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
522 !hosts = +debianhosts
523 message = sorry, only 5 reports per hour for submission
525 accept domains = +local_domains
530 <%- if @is_mailrelay -%>
531 accept domains = +mailhubdomains
533 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
536 accept domains = +submission_domains
540 deny message = relay not permitted
542 #!!# ACL that is used after the RCPT command
545 <%- if @is_mailrelay -%>
546 accept verify = certificate
549 accept hosts = <; ::1 ; 127.0.0.1 ; @
550 warn acl = acl_getprofile
551 condition = ${if eq{$acl_m_prf}{}}
552 set acl_m_prf = $acl_m_rprf
554 defer condition = ${if !eq{$acl_m_prf}{$acl_m_rprf}}
555 message = Different profile, please retry
556 log_message = Only one profile at a time, please
558 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
559 # This is a rough pass at preventing address harvesting or other mail blasts.
561 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
562 !acl = acl_spamlovers
563 message = Too many bad recipients, try again later
564 !hosts = +debianhosts
565 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
567 # Dump spambots that are so stupid they say helo as our IP address
569 drop !hosts = +debianhosts
570 !acl = acl_spamlovers
571 condition = ${if eq {$sender_helo_name}{$interface_address}}
572 message = HELO mismatch Forged HELO for ($sender_helo_name)
574 # Also for spambots that say helo as us or one of our domains
576 drop !hosts = +debianhosts
577 !acl = acl_spamlovers
578 condition = ${if match_domain{$sender_helo_name}{+ourself_and_handled}}
579 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
580 message = HELO mismatch Forged HELO for ($sender_helo_name)
582 # This logic gives you a list of commonly forged domains in helo to reject against
584 warn set acl_m_frg = ${lookup{$sender_helo_name} \
585 nwildlsearch{/etc/exim4/helo-check} \
586 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
588 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
589 # say helo as a name in the list but we can't look them up
591 defer !hosts = +debianhosts
592 !acl = acl_spamlovers
593 condition = ${if !eq{$acl_m_frg}{}}
594 condition = ${if eq{$sender_host_name}{}}
595 condition = ${if !eq{$host_lookup_failed}{1}}
596 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
598 # If DNS works, go ahead and reject them
600 drop !hosts = +debianhosts
601 !acl = acl_spamlovers
602 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}}
603 message = HELO mismatch Forged HELO for ($sender_helo_name)
605 # disabled accounts don't even get local mail.
606 deny domains = +virtual_domains
607 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}\
608 {${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{true}{false}}}\
610 message = ${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{$value}}
612 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
613 domains = +local_domains
614 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
616 deny domains = +virtual_domains
617 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
618 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
620 hosts = !+debianhosts
621 message = mail for <$local_part@$domain> only accepted from debian.org machines
623 # Accept if the source is local SMTP (i.e. not over TCP/IP).
624 # We do this by testing for an empty sending host field.
627 deny domains = +handled_domains
628 local_parts = ^[.] : ^.*[@%!/|]
630 deny domains = !+handled_domains
631 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
633 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
634 sender_domains= +local_domains
635 hosts = !+debianhosts
636 message = mail from <$sender_address> not allowed externally
638 deny sender_domains= +virtual_domains
639 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}}
640 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}{true}}
641 hosts = !+debianhosts
642 message = mail from <$sender_address> not allowed externally
644 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}}
645 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}}
646 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}{true}}
647 message = no mail should ever come from <$sender_address>
649 warn condition = ${if eq{$acl_m_prf}{localonly}}
650 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
652 <%- if @is_packagesmaster -%>
653 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
654 condition = ${if eq {$sender_address}{$local_part@$domain}}
655 message = X-Packages-FromTo-Same: yes
658 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
661 defer !hosts = +debianhosts
662 condition = ${if !eq {$acl_m_prf}{PopconMail}}
663 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
664 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
665 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
667 <%- if has_variable?("policydweight") && @policydweight -%>
668 # Check with policyd-weight
669 warn !hosts = +debianhosts
670 condition = ${if !eq {$acl_m_prf}{PopconMail}}
671 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
672 {request=smtpd_access_policy\n\
673 protocol_state=RCPT\n\
674 protocol_name=${uc:$received_protocol}\n\
675 helo_name=$sender_helo_name\n\
676 queue_id=$message_exim_id\n\
677 sender=$sender_address\n\
678 recipient=$local_part@$domain\n\
679 recipient_count=$rcpt_count\n\
680 client_address=$sender_host_address\n\
681 client_name=$sender_host_name\n\
682 reverse_client_name=$sender_host_name\n\
683 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
684 {20s}{\n}{socket failure}}
686 # Defer on socket error
687 defer !hosts = +debianhosts
688 condition = ${if !eq {$acl_m_prf}{PopconMail}}
689 condition = ${if eq{$acl_m_pw}{socket failure}}
690 message = Cannot connect to policyd-weight. Please try again later.
692 # Set proposed action to $acl_m_act and message to $acl_m_mes
693 warn !hosts = +debianhosts
694 condition = ${if !eq {$acl_m_prf}{PopconMail}}
695 set acl_m_mes = ${extract{action}{$acl_m_pw}}
696 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
698 # Add X-policyd-weight header line to message
699 warn !hosts = +debianhosts
700 condition = ${if !eq {$acl_m_prf}{PopconMail}}
702 condition = ${if eq{$acl_m_act}{PREPEND}}
704 # Write log message, if policyd-weight can't run checks
705 warn !hosts = +debianhosts
706 condition = ${if !eq {$acl_m_prf}{PopconMail}}
707 log_message = policyd-weight message: $acl_m_mes
708 condition = ${if eq{$acl_m_act}{DUNNO}}
710 # Deny mails which policyd-weight thinks are spam
711 deny !hosts = +debianhosts
712 condition = ${if !eq {$acl_m_prf}{PopconMail}}
713 message = policyd-weight said: $acl_m_mes
714 condition = ${if eq{$acl_m_act}{550}}
716 # Defer messages when policyd-weight suggests so.
717 defer !hosts = +debianhosts
718 condition = ${if !eq {$acl_m_prf}{PopconMail}}
719 message = policyd-weight said: $acl_m_mes
720 condition = ${if eq{$acl_m_act}{450}}
723 <%- if @is_rtmaster -%>
724 warn condition = ${if eq{$acl_m_prf}{RTMail}}
725 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}}}}
726 # temporary hack because weasel screwed up and gave people an rt-3520@ address, which doesn't really work normally. and rt-3645
727 #set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
731 <%- if has_variable?("greylistd") && @greylistd -%>
733 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
734 log_message = greylisted.
735 local_parts = ${if match_domain{$domain}{+virtual_domains}\
736 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
737 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
738 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
739 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
741 !hosts = : +debianhosts : WHITELIST : \
742 ${if exists {/etc/greylistd/whitelist-hosts}\
743 {/etc/greylistd/whitelist-hosts}{}} : \
744 ${if exists {/var/lib/greylistd/whitelist-hosts}\
745 {/var/lib/greylistd/whitelist-hosts}{}}
746 condition = ${if !eq {$acl_m_prf}{PopconMail}}
748 domains = +handled_domains
749 condition = ${readsocket{/var/run/greylistd/socket}\
751 $sender_host_address \
753 $local_part@$domain}\
756 <%- elsif has_variable?("postgrey") && @postgrey -%>
757 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
758 # this adds acl_m_grey if there isn't one (so unique per message)
761 !hosts = : +debianhosts : WHITELIST
762 condition = ${if !eq {$acl_m_prf}{PopconMail}}
763 condition = ${if ! def:acl_m_grey}
764 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
766 # and defers the message if postgrey thinks it should be defered ...
769 !hosts = : +debianhosts : WHITELIST
770 condition = ${if !eq {$acl_m_prf}{PopconMail}}
772 domains = +handled_domains
773 local_parts = GREYLIST_LOCAL_PARTS
774 set acl_m_pgr = request=smtpd_access_policy\n\
775 protocol_state=RCPT\n\
776 protocol_name=${uc:$received_protocol}\n\
777 instance=${acl_m_grey}\n\
778 helo_name=${sender_helo_name}\n\
779 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
780 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
782 client_address=${sender_host_address}\n\
784 client_name=${sender_host_name}\n\
785 sender=${sender_address}\n\
786 recipient=$local_part@$domain\n\n
787 set acl_m_pgr = ${sg{\
788 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
789 {5s}{}{action=DUNNO}}\
791 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
792 log_message = greylisted.
793 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
795 # ... or adds a header with information about how long the delay was
798 !hosts = : +debianhosts : WHITELIST
799 condition = ${if !eq {$acl_m_prf}{PopconMail}}
801 domains = +handled_domains
802 local_parts = GREYLIST_LOCAL_PARTS
803 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
804 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
807 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
808 message = I'm terribly sorry, but it seems you have been blacklisted
809 log_message = blacklisted IP
811 deny log_message = <$sender_address> is blacklisted
812 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
813 message = We have blacklisted <$sender_address>. Please stop mailing us
815 accept local_parts = +postmasterish
816 domains = +virtual_domains : +bsmtp_domains
818 <%- unless @use_smarthost -%>
819 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
820 dnslists = ${if match_domain{$domain}{+virtual_domains}\
821 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
822 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
823 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
824 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
825 domains = +handled_domains
826 !hosts = +debianhosts : WHITELIST
829 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
830 dnslists = ${if match_domain{$domain}{+virtual_domains}\
831 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
832 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
833 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
834 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
835 domains = +handled_domains
836 !hosts = +debianhosts : WHITELIST
838 <%- unless @use_smarthost -%>
839 deny domains = +handled_domains
840 local_parts = ${if match_domain{$domain}{+virtual_domains}\
841 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
842 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
843 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}}}} : \
844 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}
845 !hosts = +debianhosts : WHITELIST
846 !verify = sender/callout=90s,maxwait=300s
847 message = "Sender verification failed: $acl_verify_message"
850 <%- if @is_mailrelay -%>
851 accept domains = +mailhubdomains
853 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
856 accept domains = +handled_domains
858 verify = recipient/defer_ok
860 accept hosts = +debianhosts
862 accept authenticated = *
864 deny message = relay not permitted
869 accept verify = certificate
870 accept hosts = +debianhosts
872 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
873 condition = ${if eq {$acl_m_prf}{blackhole}}
874 set acl_m_srb = ${perl{surblspamcheck}}
875 condition = ${if !eq{$acl_m_srb}{false}}
876 log_message = discarded surbl message for $recipients
878 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
879 condition = ${if !eq {$acl_m_prf}{markup}}
880 condition = ${if !eq {$acl_m_prf}{PopconMail}}
881 set acl_m_srb = ${perl{surblspamcheck}}
882 condition = ${if !eq{$acl_m_srb}{false}}
883 log_message = $acl_m_srb
886 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
887 condition = ${if eq {$acl_m_prf}{markup}}
888 set acl_m_srb = ${perl{surblspamcheck}}
889 condition = ${if !eq{$acl_m_srb}{false}}
890 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
896 deny condition = ${if eq{$acl_m_prf}{localonly}}
897 message = mail for $acl_m_lrc is only accepted internally
902 #!!# ACL that is used after the DATA command
905 # Some people put from postmaster@something.debian.org in the From
906 # header. Take their crack pipe away.
907 drop condition = ${if match{${lc:$h_From:}}{\Npostmaster@([^.]+\.)?debian\.org\N}}
909 <%- if @is_rtmaster -%>
910 deny condition = ${if eq {$acl_m_prf}{RTMail}}
911 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
912 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
913 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
914 message = messages to the Request Tracker system require a subject tag or a subaddress
917 <%- if @is_packagesqamaster -%>
918 deny !hosts = +debianhosts
919 condition = ${if eq {$acl_m_prf}{PTSMail}}
920 condition = ${if !def:h_X-PTS-Approved:}
921 message = messages to the PTS require an X-PTS-Approved header
924 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
925 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
926 {!match {$message_body}{PGP SIGNED MESSAGE}} \
927 {!match {$message_body}{PGP SIGNATURE}} \
928 {!match {$header_content-type:}{multipart/signed}} \
929 {!match {$header_content-type:}{pgp}} \
932 message = Mail to this address needs to be PGP-signed
934 accept verify = certificate
935 accept hosts = +debianhosts
937 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
938 !verify = header_syntax
939 message = Invalid header syntax: $acl_verify_message
941 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
942 # postfix's strict_7bit_headers option, but only checks a few common problem
943 # headers, as there doesn't appear to be an easy way to check them all.
945 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
946 {match {$rh_To:}{[\200-\377]}}\
947 {match {$rh_From:}{[\200-\377]}}\
948 {match {$rh_Cc:}{[\200-\377]}}}}
949 condition = ${if !eq {$acl_m_prf}{PopconMail}}
950 message = improper use of 8-bit data in message header: message rejected
953 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}}
954 condition = ${if !eq {$acl_m_prf}{PopconMail}}
955 message = Your mailer is not RFC 2047 compliant: message rejected
957 <%- if has_variable?("clamd") && @clamd -%>
958 discard condition = ${if eq {$acl_m_prf}{blackhole}}
959 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
963 log_message = discarded malware message for $recipients
965 deny condition = ${if !eq {$acl_m_prf}{markup}}
966 condition = ${if !eq {$acl_m_prf}{PopconMail}}
967 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
971 message = malware detected: $malware_name: message rejected
973 warn condition = ${if eq {$acl_m_prf}{markup}}
974 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
978 message = X-malware detected: $malware_name
982 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
983 condition = ${if eq {$acl_m_prf}{blackhole}}
984 set acl_m_srb = ${perl{surblspamcheck}}
985 condition = ${if !eq{$acl_m_srb}{false}}
986 log_message = discarded surbl message for $recipients
988 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
989 condition = ${if !eq {$acl_m_prf}{markup}}
990 condition = ${if !eq {$acl_m_prf}{PopconMail}}
991 set acl_m_srb = ${perl{surblspamcheck}}
992 condition = ${if !eq{$acl_m_srb}{false}}
993 log_message = $acl_m_srb
996 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
997 condition = ${if eq {$acl_m_prf}{markup}}
998 set acl_m_srb = ${perl{surblspamcheck}}
999 condition = ${if !eq{$acl_m_srb}{false}}
1000 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1003 # Check header_sender except for survey@popcon.d.o
1004 deny condition = ${if !eq{$acl_m_prf}{PopconMail}}
1005 !verify = header_sender
1006 message = No valid sender found in the From:, Sender: and Reply-to: headers
1008 <%- if @is_packagesmaster -%>
1009 deny message = Congratulations, you scored $spam_score points.
1010 log_message = spam: $spam_score points.
1011 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1013 !verify = certificate
1014 !hosts = +debianhosts
1015 condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1016 spam = pkg_user : true
1017 condition = ${if >{$spam_score_int}{59}}
1024 ######################################################################
1025 # REWRITE CONFIGURATION #
1026 ######################################################################
1032 \N^buildd_(.*)@fasolo\.debian\.org$\N buildd_$1@buildd.debian.org T
1033 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1034 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1035 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1038 #!!#######################################################!!#
1039 #!!# Here follow routers created from the old routers, #!!#
1040 #!!# for handling non-local domains. #!!#
1041 #!!#######################################################!!#
1047 ######################################################################
1048 # ROUTERS CONFIGURATION #
1049 # Specifies how addresses are handled #
1050 ######################################################################
1051 # ORDER DOES MATTER #
1052 # An address is passed to each in turn until it is accepted. #
1053 ######################################################################
1055 <%- if @is_mailrelay -%>
1057 driver = manualroute
1058 domains = +mailhubdomains
1059 transport = remote_smtp
1060 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1061 require_files = /etc/exim4/manualroute
1065 debug_print = "R: bsmtp for $local_part@$domain"
1066 driver = manualroute
1067 domains = +bsmtp_domains
1068 require_files = /etc/exim4/bsmtp
1069 route_list = * ${extract{file}{\
1070 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1074 # This router routes to remote hosts over SMTP by explicit IP address,
1075 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1076 # require this facility, which is why it is enabled by default in Exim.
1078 debug_print = "R: ipliteral for $local_part@$domain"
1080 domains = !+handled_domains
1081 transport = remote_smtp
1082 ignore_target_hosts = +reservedaddrs
1084 <%- if @use_smarthost -%>
1086 debug_print = "R: smarthost for $local_part@$domain"
1087 driver = manualroute
1088 domains = !+handled_domains
1089 transport = remote_smtp_smarthost
1090 route_list = * <%= @smarthost %>
1091 host_find_failed = defer
1092 same_domain_copy_routing = yes
1096 # This router routes to remote hosts over SMTP using a DNS lookup.
1097 # Ignore reserved network responses, including localhost.
1099 debug_print = "R: dnslookup for $local_part@$domain"
1101 domains = !+handled_domains
1102 transport = remote_smtp
1103 ignore_target_hosts = +reservedaddrs
1107 debug_print = "R: postmasterish for $local_part@$domain"
1112 local_parts = +postmasterish
1113 domains = +virtual_domains : +bsmtp_domains
1114 data = debian-admin@debian.org
1115 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1117 # This router handles aliasing using a traditional /etc/aliases file.
1118 # If any of your aliases expand to pipes or files, you will need to set
1119 # up a user and a group for these deliveries to run under. You can do
1120 # this by uncommenting the "user" option below (changing the user name
1121 # as appropriate) and adding a "group" option if necessary.
1124 debug_print = "R: system_aliases for $local_part@$domain"
1128 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1129 domains = +local_domains
1130 file_transport = address_file
1131 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1132 pipe_transport = address_pipe
1133 retry_use_local_part
1135 # This router handles forwarding using traditional .forward files.
1136 # It also allows mail filtering when a forward file starts with the
1137 # string "# Exim filter": to disable filtering, uncomment the "filter"
1138 # option. The check_ancestor option means that if the forward file
1139 # generates an address that is an ancestor of the current one, the
1140 # current one gets passed on instead. This covers the case where A is
1141 # aliased to B and B has a .forward file pointing to A.
1143 # For standard Debian setup of one group per user, it is acceptable---normal
1144 # even---for .forward to be group writable. If you have everyone in one
1145 # group, you should comment out the "modemask" line. Without it, the Exim
1146 # default of 022 will apply, which is probably what you want.
1149 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1154 directory_transport = address_directory
1155 domains = +local_domains
1156 # filter - I have disabled filtering to force users to use .forward-foo files
1157 # or procmail. This will make it easier to move mailers in the future
1159 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1160 # also checks if the .forward-bar exists, if not then it uses
1161 # .forward-default instead.
1162 file = $home/.forward\
1163 ${if eq{}{$local_part_suffix}{}{\
1164 ${if exists {${home}/.forward${local_part_suffix}} \
1165 {${local_part_suffix}}{-default}}\
1168 file_transport = address_file
1169 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1170 local_part_suffix = -*
1171 local_part_suffix_optional
1173 pipe_transport = address_pipe
1174 reply_transport = address_reply
1175 require_files = $home
1176 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1179 # This is a sendmailesque alias file lookup
1181 debug_print = "R: virt_aliases for $local_part@$domain"
1185 data = ${if exists{\
1186 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1187 {${lookup{$local_part}lsearch*{\
1188 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1190 directory_transport = address_directory
1191 domains = +virtual_domains
1192 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1193 cannot_route_message = Unknown user
1194 group = ${extract{group}{VDOMAINDATA}}
1195 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1196 pipe_transport = address_pipe
1197 qualify_preserve_domain
1198 retry_use_local_part
1199 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1200 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1201 user = ${extract{user}{VDOMAINDATA}}
1203 # No direct match, so try doing a regex match if there's an
1206 debug_print = "R: virt_aliases_regex for $local_part$local_part_suffix@$domain"
1210 data = ${if exists{\
1211 ${extract{directory}{VDOMAINDATA}{${value}/aliases.regex}}}\
1212 {${lookup{$local_part}nwildlsearch*{\
1213 ${extract{directory}{VDOMAINDATA}{$value/aliases.regex}}\
1215 directory_transport = address_directory
1216 domains = +virtual_domains
1217 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1218 cannot_route_message = Unknown user
1219 group = ${extract{group}{VDOMAINDATA}}
1220 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1221 pipe_transport = address_pipe
1222 qualify_preserve_domain
1223 retry_use_local_part
1224 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1225 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1226 user = ${extract{user}{VDOMAINDATA}}
1229 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1233 directory_transport = address_directory
1234 domains = +local_domains
1235 # filter - I have disabled filtering to force users to use .forward-foo files
1236 # or procmail. This will make it easier to move mailers in the future
1238 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1239 # also checks if the .forward-bar exists, if not then it uses
1240 # .forward-default instead.
1241 file = $home/.forward\
1242 ${if eq{}{$local_part_suffix}{}{\
1243 ${if exists {${home}/.forward${local_part_suffix}} \
1244 {${local_part_suffix}}{-default}}\
1247 file_transport = address_file
1248 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1249 local_part_suffix = -*
1250 local_part_suffix_optional
1252 pipe_transport = address_pipe
1253 reply_transport = address_reply
1254 require_files = $home
1257 # This delivers to procmail
1259 debug_print = "R: procmail for $local_part@$domain"
1262 domains = +local_domains
1263 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1264 local_part_suffix = -*
1265 local_part_suffix_optional
1268 require_files = $local_part:$home/.procmailrc
1269 transport = procmail_pipe
1270 transport_current_directory = $home
1272 # This driver delivers to the LDAP generated alias file.
1274 debug_print = "R: ldap_aliases for $local_part@$domain"
1278 data = ${if exists{/var/lib/misc/$primary_hostname/user-forward.cdb}\
1279 {${lookup{$local_part}cdb\
1280 {/var/lib/misc/$primary_hostname/user-forward.cdb}}}}
1281 domains = +local_domains
1282 file_transport = address_file
1283 local_part_suffix = -*
1284 local_part_suffix_optional
1285 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1286 pipe_transport = address_pipe
1287 retry_use_local_part
1289 # This director matches local user mailboxes.
1291 debug_print = "R: localuser for $local_part@$domain"
1294 domains = +local_domains
1295 local_part_suffix = -*
1296 local_part_suffix_optional
1297 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1298 # Disable if the user has never logged in
1299 require_files = $home
1300 transport = local_delivery
1303 # Now we begin the Virtual Domain configuration
1304 # Everything before here should apply only to the local domains with a
1307 <%- if @is_packagesmaster -%>
1308 # This router delivers for packages.d.o
1310 debug_print = "R: packages for $local_part@$domain"
1312 file_transport = address_file
1313 pipe_transport = address_pipe
1314 domains = packages.debian.org
1315 require_files = /srv/packages.debian.org/conf/maintainer
1316 data = ${lookup{$local_part}cdb{/srv/packages.debian.org/conf/maintainer.cdb}}
1317 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1318 transport_home_directory = /srv/packages.debian.org/mail
1319 transport_current_directory = /srv/packages.debian.org/mail
1321 retry_use_local_part
1325 <%- if @is_rtmaster -%>
1326 # This router delivers for rt.d.o
1327 rt_force_new_verbose:
1328 debug_print = "R: rt for $local_part+new@$domain"
1330 domains = rt.debian.org
1331 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1332 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1333 local_part_suffix = +new
1334 pipe_transport = rt_pipe
1335 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}}"
1336 headers_remove = Subject
1337 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:}}"
1339 # FIXME: figure out how to generalize this approach so that all of the following would work
1340 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1341 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1342 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1343 # requires modification to custom condition in 'scrips'
1344 rt_force_new_quiesce:
1345 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1347 domains = rt.debian.org
1348 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1349 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1350 local_part_suffix = +new-quiesce
1351 pipe_transport = rt_pipe
1352 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}}"
1353 headers_remove = Subject
1354 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:}}"
1357 debug_print = "R: rt for $local_part@$domain"
1359 domains = rt.debian.org
1360 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1361 local_parts = ${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1362 local_part_suffix = +*
1363 local_part_suffix_optional
1364 pipe_transport = rt_pipe
1365 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}}}}"
1366 headers_remove = Subject
1367 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:}}"
1370 # Exim fails the router if it can't change to the user/group for delivery
1371 # during verification. So we have to separate the cases of verifying
1372 # the virts, and delivering to them. blah.
1375 debug_print = "R: virt_direct for $local_part@$domain"
1381 directory_transport = address_directory
1382 domains = +virtual_domains
1383 local_part_suffix = -*
1384 local_part_suffix_optional
1385 file = $home/.forward-\
1386 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1388 file_transport = address_file
1389 pipe_transport = address_pipe
1390 reply_transport = address_reply
1391 retry_use_local_part
1392 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1393 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1396 # This is a qmailesque deliver into a directory of .forward files
1398 debug_print = "R: virt_direct for $local_part@$domain"
1404 directory_transport = address_directory
1405 domains = +virtual_domains
1406 file = $home/.forward-\
1407 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1409 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1410 group = ${extract{group}{VDOMAINDATA}}
1411 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1413 local_part_suffix = -*
1414 local_part_suffix_optional
1415 pipe_transport = address_pipe
1416 reply_transport = address_reply
1417 retry_use_local_part
1418 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1419 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1421 user = ${extract{user}{VDOMAINDATA}}
1422 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1424 # This router delivers to the LDAP generated mail-forward file.
1425 # It's only really useful for debian.org
1427 debug_print = "R: virt_users for $local_part@$domain"
1431 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1432 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1433 user = ${extract{user}{VDOMAINDATA}}
1434 group = ${extract{group}{VDOMAINDATA}}
1435 # Manually construct the forwarding address, preserving the
1436 # local_part_suffix if the remote host is master.
1437 data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}\
1438 {! eq {${lookup{$local_part}cdb\
1439 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1441 {${local_part:${lookup{$local_part}cdb\
1442 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1443 ${if eq {${domain:${lookup{$local_part}cdb\
1444 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}{master.debian.org}{$local_part_suffix} {}}\
1446 ${domain:${lookup{$local_part}cdb\
1447 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}}
1448 domains = +virtual_domains
1449 file_transport = address_file
1450 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1451 pipe_transport = address_pipe
1452 local_part_suffix = -*
1453 local_part_suffix_optional
1454 retry_use_local_part
1456 <%- if @is_bugsmx -%>
1457 # This router delivers for bugs.d.o
1459 debug_print = "R: bugs for $local_part@$domain"
1461 transport = bugs_pipe
1462 domains = bugs.debian.org
1463 cannot_route_message = Unknown or archived bug
1464 require_files = /srv/bugs.debian.org/mail/run-procmail
1466 local_parts = ${if match\
1468 {\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}\
1469 {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1470 {$local_part}fail}}fail}
1472 ######################################################################
1473 # TRANSPORTS CONFIGURATION #
1474 ######################################################################
1475 # ORDER DOES NOT MATTER #
1476 # Only one appropriate transport is called for each delivery. #
1477 ######################################################################
1482 # This transport is used for local delivery to user mailboxes. On Debian
1483 # systems group mail is used so we can write to the /var/mail
1484 # directory. (The alternative, which most other unixes use, is to deliver
1485 # as the user's own group, into a sticky-bitted directory)
1488 file = /var/mail/${local_part}
1491 no_mode_fail_narrower
1494 # This transport is used for handling pipe addresses generated by alias
1495 # or .forward files. It has a conventional name, since it is not actually
1496 # mentioned elsewhere in this configuration file. (A different name *can*
1497 # be specified via the "address_pipe_transport" option if you really want
1498 # to.) If the pipe generates any standard output, it is returned to the sender
1499 # of the message as a delivery error. Set return_fail_output instead if you
1500 # want this to happen only when the pipe fails to complete normally.
1504 current_directory = ${home}
1505 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1506 EXT=${substr_1:${local_part_suffix}}:\
1507 LOCAL=${local_part}${local_part_suffix}:\
1508 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1512 # This transport is used for handling file addresses generated by alias
1513 # or .forward files. It has a conventional name, since it is not actually
1514 # mentioned elsewhere in this configuration file.
1524 directory_mode = 0770
1525 mode_fail_narrower = false
1527 # This transport is used for handling file addresses generated by alias
1528 # or .forward files if the path ends in "/", which causes it to be treated
1529 # as a directory name rather than a file name. Each message is then delivered
1530 # to a unique file in the directory. If instead you want all such deliveries to
1531 # be in the "maildir" format that is used by some other mail software,
1532 # uncomment the final option below. If this is done, the directory specified
1533 # in the .forward or alias file is the base maildir directory.
1535 # Should you want to be able to specify either maildir or non-maildir
1536 # directory-style deliveries, then you must set up yet another transport,
1537 # called address_directory2. This is used if the path ends in "//" so should
1538 # be the one used for maildir, as the double slash suggests another level
1539 # of directory. In the absence of address_directory2, paths ending in //
1540 # are passed to address_directory.
1550 # This transport is used for handling autoreplies generated by the filtering
1551 # option of the forwardfile director. It has a conventional name, since it
1552 # is not actually mentioned elsewhere in this configuration file.
1556 # This transport is used for delivering messages over SMTP connections.
1560 connect_timeout = 15s
1561 delay_after_cutoff = false
1562 tls_certificate = /etc/exim4/ssl/thishost.crt
1563 tls_privatekey = /etc/exim4/ssl/thishost.key
1565 <%- if @use_smarthost -%>
1566 remote_smtp_smarthost:
1567 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1569 delay_after_cutoff = false
1570 port = <%= @smarthost_port %>
1571 tls_tempfail_tryclear = false
1572 hosts_require_tls = <%= @smarthost %>
1573 tls_certificate = /etc/exim4/ssl/thishost.crt
1574 tls_privatekey = /etc/exim4/ssl/thishost.key
1576 # Send the message to procmail
1579 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}
1581 user = ${local_part}
1590 user = ${extract{user}{\
1591 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1595 <%- if @is_bugsmx -%>
1598 command = /srv/bugs.debian.org/mail/run-procmail
1599 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1600 EXT=${substr_1:${local_part_suffix}}:\
1601 LOCAL=${local_part}${local_part_suffix}:\
1602 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1608 <%- if @is_rtmaster -%>
1610 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1613 environment = EXTENSION=${substr_1:${local_part_suffix}}
1614 allow_commands = /usr/bin/rt-mailgate
1618 ######################################################################
1619 # RETRY CONFIGURATION #
1620 ######################################################################
1622 # This single retry rule applies to all domains and all errors. It specifies
1623 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1624 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1625 # hours, then retries every 8 hours until 4 days have passed since the first
1628 # Domain Error Retries
1629 # ------ ----- -------
1634 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1635 * * senders=: F,2h,10m
1636 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1637 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1639 # End of Exim 4 configuration