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 *.aspmx.l.google.com : *.gmail-smtp-in.l.google.com
138 domainlist single_domain_mx = +google_mxen
140 <%- if @is_mailrelay -%>
141 # Domains we relay for; that is domains that aren't considered local but we
142 # accept mail for them.
143 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
146 tls_certificate = /etc/exim4/ssl/thishost.crt
147 tls_privatekey = /etc/exim4/ssl/thishost.key
148 tls_try_verify_hosts = *
149 tls_verify_certificates = /etc/exim4/ssl/ca.crt
150 tls_crl = /etc/exim4/ssl/ca.crl
152 # The setting below causes Exim to do a reverse DNS lookup on all incoming
153 # IP calls, in order to get the true host name. If you feel this is too
154 # expensive, you can specify the networks for which a lookup is done, or
155 # remove the setting entirely.
157 dns_ipv4_lookup = +google_mxen
159 # If this option is set, then any process that is running as one of the
160 # listed users may pass a message to Exim and specify the sender's
161 # address using the "-f" command line option, without Exim's adding a
164 untrusted_set_sender = *
166 # Some spam scanners (*cough* irritated *cough*) want the Sender field
167 # to exist. Appease them by not actually adding a Sender field.
169 local_from_check = false
171 # Some operating systems use the "gecos" field in the system password file
172 # to hold other information in addition to users' real names. Exim looks up
173 # this field when it is creating "sender" and "from" headers. If these options
174 # are set, Exim uses "gecos_pattern" to parse the gecos field, and then
175 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
178 gecos_pattern = ^([^,:]*)
181 # Do *not* include the body of the original message in a bounce
182 # The combinaton of bounce_return_message and bounce_return_body
183 # allows us to return only the headers within a bounce
185 bounce_return_message = true
186 bounce_return_body = false
188 # This tells Exim to immediately discard error messages (ie double bounces).
189 ignore_bounce_errors_after = 0s
191 timeout_frozen_after=14d
193 message_size_limit = 100M
195 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
197 smtp_accept_max = 300
198 smtp_accept_queue = 200
199 smtp_accept_queue_per_connection = 50
200 smtp_accept_reserve = 25
203 smtp_accept_queue = 20
204 smtp_accept_queue_per_connection = 10
205 smtp_accept_reserve = 5
207 smtp_reserve_hosts = +debianhosts
209 split_spool_directory = true
210 check_spool_inodes = 200
211 check_spool_space = 20M
216 message_body_visible = 5000
218 deliver_queue_load_max = 50
220 smtp_load_reserve = 20
223 <%- if scope.lookupvar('::processorcount').to_s != 'undefined' -%>
224 deliver_queue_load_max = <%= [scope.lookupvar('::processorcount').to_i,2].max * 5 %>
225 queue_only_load = <%= [scope.lookupvar('::processorcount').to_i,2].max * 4 %>
227 deliver_queue_load_max = 10
231 queue_list_requires_admin = false
233 <%- if has_variable?("clamd") && @clamd -%>
234 av_scanner = clamd:/var/run/clamav/clamd.ctl
239 out = "daemon_smtp_ports = "
241 if @mail_port # if we have an overridden mail_port
250 ports << @smarthost_port
253 out += ports.uniq.sort.join(" : ")
258 remote_sort_domains = *.debian.org:*.debian.net
260 pipelining_advertise_hosts = !*
261 tls_advertise_hosts = *
262 smtp_enforce_sync = true
270 +smtp_incomplete_transaction \
274 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
275 {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
276 ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
277 by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
278 (Exim $version_number)\n\t\
279 ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
280 id $message_exim_id${if def:received_for {\n\tfor $received_for}}
284 MAX_SCAN_SIZE = 256000
285 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
286 VSENDERDOMAINDATA = ${lookup{$sender_address_domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
287 WHITELIST = ${if match_domain{$domain}{+virtual_domains}\
288 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}\
289 {${lookup{$local_part}lsearch{${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}{$value}{}}}{}}}\
290 {/etc/exim4/whitelist} } : \
291 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}
292 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
293 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
294 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
295 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \
296 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}
297 <%- if @is_rtmaster -%>
298 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
304 ######################################################################
305 # ACL CONFIGURATION #
306 ######################################################################
310 # There are a few profiles that don't want much smtp time checking of
311 # mail. It's easier to track them in one place
313 accept condition = ${if eq {$acl_m_prf}{PopconMail}}
314 accept condition = ${if eq {$acl_m_prf}{BugsMail}}
319 # Determine the mail profile for this recipient.
320 # An empty string implies no match has been found.
322 warn set acl_m_rprf =
324 warn recipients = survey@popcon.debian.org
325 set acl_m_rprf = PopconMail
327 accept condition = ${if !eq {$acl_m_rprf}{}}
329 warn local_parts = +local_only_users
330 domains = +local_domains
331 hosts = !+debianhosts
332 set acl_m_rprf = localonly
334 <%- if @is_mailrelay -%>
335 warn local_parts = +local_only_users
336 domains = +mailhubdomains
337 hosts = !+debianhosts
338 set acl_m_rprf = localonly
341 accept condition = ${if !eq {$acl_m_rprf}{}}
343 <%- if @is_rtmaster -%>
344 warn domains = rt.debian.org
345 set acl_m_rprf = RTMail
347 accept condition = ${if !eq {$acl_m_rprf}{}}
350 <%- if @is_bugsmx -%>
351 warn domains = bugs.debian.org
352 set acl_m_rprf = BugsMail
354 accept condition = ${if !eq {$acl_m_rprf}{}}
357 <%- if @is_packagesmaster -%>
358 warn domains = packages.debian.org
359 set acl_m_rprf = PackagesMail
361 accept condition = ${if !eq {$acl_m_rprf}{}}
364 <%- if @is_packagesqamaster -%>
365 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
366 set acl_m_rprf = PTSOwner
368 accept condition = ${if !eq {$acl_m_rprf}{}}
371 domains = packages.qa.debian.org
372 condition = ${if match{$local_part}{\N^bounces+\N}}
373 set acl_m_rprf = PTSListBounce
375 accept condition = ${if !eq {$acl_m_rprf}{}}
377 warn domains = packages.qa.debian.org
378 set acl_m_rprf = PTSMail
380 accept condition = ${if !eq {$acl_m_rprf}{}}
383 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
384 set acl_m_rprf = DBSignedMail
386 accept condition = ${if !eq {$acl_m_rprf}{}}
388 warn domains = +virtual_domains
389 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
390 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
391 set acl_m_rprf = markup
393 accept condition = ${if !eq {$acl_m_rprf}{}}
395 warn domains = +virtual_domains
396 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
397 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
398 set acl_m_rprf = blackhole
400 accept condition = ${if !eq {$acl_m_rprf}{}}
402 warn domains = +virtual_domains
403 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
404 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{markup}}
405 set acl_m_rprf = markup
407 accept condition = ${if !eq {$acl_m_rprf}{}}
409 warn domains = +virtual_domains
410 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
411 condition = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{blackhole}}
412 set acl_m_rprf = blackhole
414 accept condition = ${if !eq {$acl_m_rprf}{}}
416 warn domains = +local_domains
417 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
418 set acl_m_rprf = markup
420 accept condition = ${if !eq {$acl_m_rprf}{}}
422 warn domains = +local_domains
423 condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
424 set acl_m_rprf = blackhole
426 accept condition = ${if !eq {$acl_m_rprf}{}}
428 warn set acl_m_rprf = normal
434 warn set acl_c_scr = 0
436 <%- if @is_mailrelay -%>
437 accept verify = certificate
440 <%- unless @use_smarthost -%>
441 # These are in HELO acl so that they are only run once. They increment a counter,
442 # so we don't want it to increment per rcpt to.
444 warn dnslists = list.dnswl.org&0.0.0.3
445 log_message = Hit on list.dnswl.org for $sender_host_address
446 set acl_c_scr = ${eval:$acl_c_scr-30}
448 warn dnslists = list.dnswl.org&0.0.0.2
449 log_message = Hit on list.dnswl.org for $sender_host_address
450 set acl_c_scr = ${eval:$acl_c_scr-20}
452 warn dnslists = list.dnswl.org
453 log_message = Hit on list.dnswl.org for $sender_host_address
454 set acl_c_scr = ${eval:$acl_c_scr-10}
456 warn condition = ${if isip {$sender_helo_name}}
457 log_message = remote host used IP address in HELO/EHLO greeting
458 set acl_c_scr = ${eval:$acl_c_scr+20}
460 warn !hosts = +debianhosts
461 condition = ${if eq{$host_lookup_failed}{1}}
462 set acl_c_scr = ${eval:$acl_c_scr+20}
464 warn !hosts = +debianhosts
465 condition = ${if eq{$host_lookup_failed}{0}}
466 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}}
467 set acl_c_scr = ${eval:$acl_c_scr+20}
469 warn !hosts = +debianhosts
470 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}}
471 set acl_c_scr = ${eval:$acl_c_scr+20}
473 warn !hosts = +debianhosts
474 dnslists = dul.dnsbl.sorbs.net
475 set acl_c_scr = ${eval:$acl_c_scr+15}
477 # If the sender's helo name is empty, the message will be rejected later
478 # because the helo is empty. If the rDNS lookup failed, we are already
479 # going to greylist them, so no sense worrying about it here. Finally,
480 # if rDNS does not match helo name (both lower cased first), greylist.
482 warn !hosts = +debianhosts
483 condition = ${if !eq {$host_lookup_failed}{1}}
484 condition = ${if def:sender_helo_name}
485 condition = ${if !eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}}
486 log_message = HELO doesn't match rDNS
487 set acl_c_scr = ${eval:$acl_c_scr+8}
490 # matches 098325879 - looks fishy
492 warn condition = ${if and { \
493 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
494 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
497 log_message = non-FQDN HELO
498 set acl_c_scr = ${eval:$acl_c_scr+12}
500 # Matches DOMAIN99.com - looks bad
502 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
503 log_message = SHOUTING HELO
504 set acl_c_scr = ${eval:$acl_c_scr+7}
506 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
507 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
508 # naive test, so it's not worth much
510 warn condition = ${if !match {${lc:$sender_helo_name}}{smtp}}
511 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
512 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
513 log_message = random HELO
514 set acl_c_scr = ${eval:$acl_c_scr+5}
517 drop !hosts = +debianhosts
518 log_message = mail from non-d.o host
519 message = Interesting. I doubt that should have happened.
522 # Implicit, but simpler to just say it
525 #!!# ACL that is used after the RCPT command on the submission port
528 accept hosts = +debianhosts
530 <%- if @is_mailrelay -%>
531 accept verify = certificate
534 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
535 # This is a rough pass at preventing address harvesting or other mail blasts.
537 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
538 message = Too many bad recipients, try again later
539 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
542 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
543 !hosts = +debianhosts
544 message = sorry, only 5 reports per hour for submission
546 accept domains = +local_domains
551 <%- if @is_mailrelay -%>
552 accept domains = +mailhubdomains
554 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
557 accept domains = +submission_domains
561 deny message = relay not permitted
563 #!!# ACL that is used after the RCPT command
566 <%- if @is_mailrelay -%>
567 accept verify = certificate
570 accept hosts = <; ::1 ; 127.0.0.1 ; @
571 warn acl = acl_getprofile
572 condition = ${if eq{$acl_m_prf}{}}
573 set acl_m_prf = $acl_m_rprf
575 defer condition = ${if !eq{$acl_m_prf}{$acl_m_rprf}}
576 message = Different profile, please retry
577 log_message = Only one profile at a time, please
579 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
580 # This is a rough pass at preventing address harvesting or other mail blasts.
582 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
583 !acl = acl_spamlovers
584 message = Too many bad recipients, try again later
585 !hosts = +debianhosts
586 condition = ${if > {${eval:$rcpt_fail_count}}{3}}
588 # Dump spambots that are so stupid they say helo as our IP address
590 drop !hosts = +debianhosts
591 !acl = acl_spamlovers
592 condition = ${if eq {$sender_helo_name}{$interface_address}}
593 message = HELO mismatch Forged HELO for ($sender_helo_name)
595 # Also for spambots that say helo as us or one of our domains
597 drop !hosts = +debianhosts
598 !acl = acl_spamlovers
599 condition = ${if match_domain{$sender_helo_name}{+ourself_and_handled}}
600 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
601 message = HELO mismatch Forged HELO for ($sender_helo_name)
603 # This logic gives you a list of commonly forged domains in helo to reject against
605 warn set acl_m_frg = ${lookup{$sender_helo_name} \
606 nwildlsearch{/etc/exim4/helo-check} \
607 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
609 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
610 # say helo as a name in the list but we can't look them up
612 defer !hosts = +debianhosts
613 !acl = acl_spamlovers
614 condition = ${if !eq{$acl_m_frg}{}}
615 condition = ${if eq{$sender_host_name}{}}
616 condition = ${if !eq{$host_lookup_failed}{1}}
617 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
619 # If DNS works, go ahead and reject them
621 drop !hosts = +debianhosts
622 !acl = acl_spamlovers
623 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}}
624 message = HELO mismatch Forged HELO for ($sender_helo_name)
626 # disabled accounts don't even get local mail.
627 deny domains = +virtual_domains
628 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}\
629 {${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{true}{false}}}\
631 message = ${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{$value}}
633 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
634 domains = +local_domains
635 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
637 deny domains = +virtual_domains
638 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
639 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
641 hosts = !+debianhosts
642 message = mail for <$local_part@$domain> only accepted from debian.org machines
644 # Accept if the source is local SMTP (i.e. not over TCP/IP).
645 # We do this by testing for an empty sending host field.
648 deny domains = +handled_domains
649 local_parts = ^[.] : ^.*[@%!/|]
651 deny domains = !+handled_domains
652 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
654 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
655 sender_domains= +local_domains
656 hosts = !+debianhosts
657 message = mail from <$sender_address> not allowed externally
659 deny sender_domains= +virtual_domains
660 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}}
661 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}{true}}
662 hosts = !+debianhosts
663 message = mail from <$sender_address> not allowed externally
665 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}}
666 condition = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}}
667 condition = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}{true}}
668 message = no mail should ever come from <$sender_address>
670 warn condition = ${if eq{$acl_m_prf}{localonly}}
671 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
673 <%- if @is_packagesmaster -%>
674 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
675 condition = ${if eq {$sender_address}{$local_part@$domain}}
676 message = X-Packages-FromTo-Same: yes
679 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
682 defer !hosts = +debianhosts
683 condition = ${if !eq {$acl_m_prf}{PopconMail}}
684 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
685 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
686 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
688 <%- if has_variable?("policydweight") && @policydweight -%>
689 # Check with policyd-weight
690 warn !hosts = +debianhosts
691 condition = ${if !eq {$acl_m_prf}{PopconMail}}
692 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
693 {request=smtpd_access_policy\n\
694 protocol_state=RCPT\n\
695 protocol_name=${uc:$received_protocol}\n\
696 helo_name=$sender_helo_name\n\
697 queue_id=$message_exim_id\n\
698 sender=$sender_address\n\
699 recipient=$local_part@$domain\n\
700 recipient_count=$rcpt_count\n\
701 client_address=$sender_host_address\n\
702 client_name=$sender_host_name\n\
703 reverse_client_name=$sender_host_name\n\
704 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
705 {20s}{\n}{socket failure}}
707 # Defer on socket error
708 defer !hosts = +debianhosts
709 condition = ${if !eq {$acl_m_prf}{PopconMail}}
710 condition = ${if eq{$acl_m_pw}{socket failure}}
711 message = Cannot connect to policyd-weight. Please try again later.
713 # Set proposed action to $acl_m_act and message to $acl_m_mes
714 warn !hosts = +debianhosts
715 condition = ${if !eq {$acl_m_prf}{PopconMail}}
716 set acl_m_mes = ${extract{action}{$acl_m_pw}}
717 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
719 # Add X-policyd-weight header line to message
720 warn !hosts = +debianhosts
721 condition = ${if !eq {$acl_m_prf}{PopconMail}}
723 condition = ${if eq{$acl_m_act}{PREPEND}}
725 # Write log message, if policyd-weight can't run checks
726 warn !hosts = +debianhosts
727 condition = ${if !eq {$acl_m_prf}{PopconMail}}
728 log_message = policyd-weight message: $acl_m_mes
729 condition = ${if eq{$acl_m_act}{DUNNO}}
731 # Deny mails which policyd-weight thinks are spam
732 deny !hosts = +debianhosts
733 condition = ${if !eq {$acl_m_prf}{PopconMail}}
734 message = policyd-weight said: $acl_m_mes
735 condition = ${if eq{$acl_m_act}{550}}
737 # Defer messages when policyd-weight suggests so.
738 defer !hosts = +debianhosts
739 condition = ${if !eq {$acl_m_prf}{PopconMail}}
740 message = policyd-weight said: $acl_m_mes
741 condition = ${if eq{$acl_m_act}{450}}
744 <%- if @is_rtmaster -%>
745 warn condition = ${if eq{$acl_m_prf}{RTMail}}
746 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}}}}
747 # temporary hack because weasel screwed up and gave people an rt-3520@ address, which doesn't really work normally. and rt-3645
748 #set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
752 <%- if has_variable?("greylistd") && @greylistd -%>
754 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
755 log_message = greylisted.
756 local_parts = ${if match_domain{$domain}{+virtual_domains}\
757 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
758 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
759 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
760 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
762 !hosts = : +debianhosts : WHITELIST : \
763 ${if exists {/etc/greylistd/whitelist-hosts}\
764 {/etc/greylistd/whitelist-hosts}{}} : \
765 ${if exists {/var/lib/greylistd/whitelist-hosts}\
766 {/var/lib/greylistd/whitelist-hosts}{}}
767 condition = ${if !eq {$acl_m_prf}{PopconMail}}
769 domains = +handled_domains
770 condition = ${readsocket{/var/run/greylistd/socket}\
772 $sender_host_address \
774 $local_part@$domain}\
777 <%- elsif has_variable?("postgrey") && @postgrey -%>
778 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
779 # this adds acl_m_grey if there isn't one (so unique per message)
782 !hosts = : +debianhosts : WHITELIST
783 condition = ${if !eq {$acl_m_prf}{PopconMail}}
784 condition = ${if ! def:acl_m_grey}
785 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
787 # and defers the message if postgrey thinks it should be defered ...
790 !hosts = : +debianhosts : WHITELIST
791 condition = ${if !eq {$acl_m_prf}{PopconMail}}
793 domains = +handled_domains
794 local_parts = GREYLIST_LOCAL_PARTS
795 set acl_m_pgr = request=smtpd_access_policy\n\
796 protocol_state=RCPT\n\
797 protocol_name=${uc:$received_protocol}\n\
798 instance=${acl_m_grey}\n\
799 helo_name=${sender_helo_name}\n\
800 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
801 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
803 client_address=${sender_host_address}\n\
805 client_name=${sender_host_name}\n\
806 sender=${sender_address}\n\
807 recipient=$local_part@$domain\n\n
808 set acl_m_pgr = ${sg{\
809 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
810 {5s}{}{action=DUNNO}}\
812 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
813 log_message = greylisted.
814 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
816 # ... or adds a header with information about how long the delay was
819 !hosts = : +debianhosts : WHITELIST
820 condition = ${if !eq {$acl_m_prf}{PopconMail}}
822 domains = +handled_domains
823 local_parts = GREYLIST_LOCAL_PARTS
824 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
825 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
828 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
829 message = I'm terribly sorry, but it seems you have been blacklisted
830 log_message = blacklisted IP
832 deny log_message = <$sender_address> is blacklisted
833 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
834 message = We have blacklisted <$sender_address>. Please stop mailing us
836 accept local_parts = +postmasterish
837 domains = +virtual_domains : +bsmtp_domains
839 <%- unless @use_smarthost -%>
840 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
841 dnslists = ${if match_domain{$domain}{+virtual_domains}\
842 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
843 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
844 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
845 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
846 domains = +handled_domains
847 !hosts = +debianhosts : WHITELIST
850 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
851 dnslists = ${if match_domain{$domain}{+virtual_domains}\
852 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
853 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
854 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
855 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
856 domains = +handled_domains
857 !hosts = +debianhosts : WHITELIST
859 <%- unless @use_smarthost -%>
860 deny domains = +handled_domains
861 local_parts = ${if match_domain{$domain}{+virtual_domains}\
862 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
863 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
864 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}}}} : \
865 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}
866 !hosts = +debianhosts : WHITELIST
867 !verify = sender/callout=90s,maxwait=300s
868 message = "Sender verification failed: $acl_verify_message"
871 <%- if @is_mailrelay -%>
872 accept domains = +mailhubdomains
874 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
877 accept domains = +handled_domains
879 verify = recipient/defer_ok
881 accept hosts = +debianhosts
883 accept authenticated = *
885 deny message = relay not permitted
890 accept verify = certificate
891 accept hosts = +debianhosts
893 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
894 condition = ${if eq {$acl_m_prf}{blackhole}}
895 set acl_m_srb = ${perl{surblspamcheck}}
896 condition = ${if !eq{$acl_m_srb}{false}}
897 log_message = discarded surbl message for $recipients
899 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
900 condition = ${if !eq {$acl_m_prf}{markup}}
901 condition = ${if !eq {$acl_m_prf}{PopconMail}}
902 set acl_m_srb = ${perl{surblspamcheck}}
903 condition = ${if !eq{$acl_m_srb}{false}}
904 log_message = $acl_m_srb
907 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
908 condition = ${if eq {$acl_m_prf}{markup}}
909 set acl_m_srb = ${perl{surblspamcheck}}
910 condition = ${if !eq{$acl_m_srb}{false}}
911 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
917 deny condition = ${if eq{$acl_m_prf}{localonly}}
918 message = mail for $acl_m_lrc is only accepted internally
923 #!!# ACL that is used after the DATA command
926 # Some people put from postmaster@something.debian.org in the From
927 # header. Take their crack pipe away.
928 drop condition = ${if match{${lc:$h_From:}}{\Npostmaster@([^.]+\.)?debian\.org\N}}
930 <%- if @is_rtmaster -%>
931 deny condition = ${if eq {$acl_m_prf}{RTMail}}
932 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
933 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
934 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
935 message = messages to the Request Tracker system require a subject tag or a subaddress
938 <%- if @is_packagesqamaster -%>
939 deny !hosts = +debianhosts
940 condition = ${if eq {$acl_m_prf}{PTSMail}}
941 condition = ${if !def:h_X-PTS-Approved:}
942 message = messages to the PTS require an X-PTS-Approved header
945 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
946 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
947 {!match {$message_body}{PGP SIGNED MESSAGE}} \
948 {!match {$message_body}{PGP SIGNATURE}} \
949 {!match {$header_content-type:}{multipart/signed}} \
950 {!match {$header_content-type:}{pgp}} \
953 message = Mail to this address needs to be PGP-signed
955 accept verify = certificate
956 accept hosts = +debianhosts
958 deny condition = ${if !eq {$acl_m_prf}{PopconMail}}
959 !verify = header_syntax
960 message = Invalid header syntax: $acl_verify_message
962 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
963 # postfix's strict_7bit_headers option, but only checks a few common problem
964 # headers, as there doesn't appear to be an easy way to check them all.
966 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
967 {match {$rh_To:}{[\200-\377]}}\
968 {match {$rh_From:}{[\200-\377]}}\
969 {match {$rh_Cc:}{[\200-\377]}}}}
970 condition = ${if !eq {$acl_m_prf}{PopconMail}}
971 message = improper use of 8-bit data in message header: message rejected
974 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}}
975 condition = ${if !eq {$acl_m_prf}{PopconMail}}
976 message = Your mailer is not RFC 2047 compliant: message rejected
978 <%- if has_variable?("clamd") && @clamd -%>
979 discard condition = ${if eq {$acl_m_prf}{blackhole}}
980 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
984 log_message = discarded malware message for $recipients
986 deny condition = ${if !eq {$acl_m_prf}{markup}}
987 condition = ${if !eq {$acl_m_prf}{PopconMail}}
988 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
992 message = malware detected: $malware_name: message rejected
994 warn condition = ${if eq {$acl_m_prf}{markup}}
995 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
999 message = X-malware detected: $malware_name
1003 discard condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1004 condition = ${if eq {$acl_m_prf}{blackhole}}
1005 set acl_m_srb = ${perl{surblspamcheck}}
1006 condition = ${if !eq{$acl_m_srb}{false}}
1007 log_message = discarded surbl message for $recipients
1009 deny condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1010 condition = ${if !eq {$acl_m_prf}{markup}}
1011 condition = ${if !eq {$acl_m_prf}{PopconMail}}
1012 set acl_m_srb = ${perl{surblspamcheck}}
1013 condition = ${if !eq{$acl_m_srb}{false}}
1014 log_message = $acl_m_srb
1015 message = $acl_m_srb
1017 warn condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1018 condition = ${if eq {$acl_m_prf}{markup}}
1019 set acl_m_srb = ${perl{surblspamcheck}}
1020 condition = ${if !eq{$acl_m_srb}{false}}
1021 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1024 # Check header_sender except for survey@popcon.d.o
1025 deny condition = ${if !eq{$acl_m_prf}{PopconMail}}
1026 !verify = header_sender
1027 message = No valid sender found in the From:, Sender: and Reply-to: headers
1029 <%- if @is_packagesmaster -%>
1030 deny message = Congratulations, you scored $spam_score points.
1031 log_message = spam: $spam_score points.
1032 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1034 !verify = certificate
1035 !hosts = +debianhosts
1036 condition = ${if <{$message_size}{MAX_SCAN_SIZE}}
1037 spam = pkg_user : true
1038 condition = ${if >{$spam_score_int}{59}}
1045 ######################################################################
1046 # REWRITE CONFIGURATION #
1047 ######################################################################
1053 \N^buildd_(.*)@fasolo\.debian\.org$\N buildd_$1@buildd.debian.org T
1054 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1055 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1056 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1059 #!!#######################################################!!#
1060 #!!# Here follow routers created from the old routers, #!!#
1061 #!!# for handling non-local domains. #!!#
1062 #!!#######################################################!!#
1068 ######################################################################
1069 # ROUTERS CONFIGURATION #
1070 # Specifies how addresses are handled #
1071 ######################################################################
1072 # ORDER DOES MATTER #
1073 # An address is passed to each in turn until it is accepted. #
1074 ######################################################################
1076 <%- if @is_mailrelay -%>
1078 driver = manualroute
1079 domains = +mailhubdomains
1080 transport = ${if forany{${lookup dnsdb{>: mxh=$domain}}}\
1081 {match_domain{$item}{+single_domain_mx}}\
1082 {remote_smtp_single_domain}{remote_smtp}\
1084 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1085 require_files = /etc/exim4/manualroute
1089 debug_print = "R: bsmtp for $local_part@$domain"
1090 driver = manualroute
1091 domains = +bsmtp_domains
1092 require_files = /etc/exim4/bsmtp
1093 route_list = * ${extract{file}{\
1094 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1098 # This router routes to remote hosts over SMTP by explicit IP address,
1099 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1100 # require this facility, which is why it is enabled by default in Exim.
1102 debug_print = "R: ipliteral for $local_part@$domain"
1104 domains = !+handled_domains
1105 transport = remote_smtp
1106 ignore_target_hosts = +reservedaddrs
1108 <%- if @use_smarthost -%>
1110 debug_print = "R: smarthost for $local_part@$domain"
1111 driver = manualroute
1112 domains = !+handled_domains
1113 transport = remote_smtp_smarthost
1114 route_list = * <%= @smarthost %>
1115 host_find_failed = defer
1116 same_domain_copy_routing = yes
1120 # This router routes to remote hosts over SMTP using a DNS lookup.
1121 # Ignore reserved network responses, including localhost.
1123 debug_print = "R: dnslookup for $local_part@$domain"
1125 domains = !+handled_domains
1126 transport = ${if forany{${lookup dnsdb{>: mxh=$domain}}}\
1127 {match_domain{$item}{+single_domain_mx}}\
1128 {remote_smtp_single_domain}{remote_smtp}\
1130 ignore_target_hosts = +reservedaddrs
1134 debug_print = "R: postmasterish for $local_part@$domain"
1139 local_parts = +postmasterish
1140 domains = +virtual_domains : +bsmtp_domains
1141 data = debian-admin@debian.org
1142 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1144 # This router handles aliasing using a traditional /etc/aliases file.
1145 # If any of your aliases expand to pipes or files, you will need to set
1146 # up a user and a group for these deliveries to run under. You can do
1147 # this by uncommenting the "user" option below (changing the user name
1148 # as appropriate) and adding a "group" option if necessary.
1151 debug_print = "R: system_aliases for $local_part@$domain"
1155 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1156 domains = +local_domains
1157 file_transport = address_file
1158 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1159 pipe_transport = address_pipe
1160 retry_use_local_part
1162 # This router handles forwarding using traditional .forward files.
1163 # It also allows mail filtering when a forward file starts with the
1164 # string "# Exim filter": to disable filtering, uncomment the "filter"
1165 # option. The check_ancestor option means that if the forward file
1166 # generates an address that is an ancestor of the current one, the
1167 # current one gets passed on instead. This covers the case where A is
1168 # aliased to B and B has a .forward file pointing to A.
1170 # For standard Debian setup of one group per user, it is acceptable---normal
1171 # even---for .forward to be group writable. If you have everyone in one
1172 # group, you should comment out the "modemask" line. Without it, the Exim
1173 # default of 022 will apply, which is probably what you want.
1176 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1181 directory_transport = address_directory
1182 domains = +local_domains
1183 # filter - I have disabled filtering to force users to use .forward-foo files
1184 # or procmail. This will make it easier to move mailers in the future
1186 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1187 # also checks if the .forward-bar exists, if not then it uses
1188 # .forward-default instead.
1189 file = $home/.forward\
1190 ${if eq{}{$local_part_suffix}{}{\
1191 ${if exists {${home}/.forward${local_part_suffix}} \
1192 {${local_part_suffix}}{-default}}\
1195 file_transport = address_file
1196 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1197 local_part_suffix = -*
1198 local_part_suffix_optional
1200 pipe_transport = address_pipe
1201 reply_transport = address_reply
1202 require_files = $home
1203 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1206 # This is a sendmailesque alias file lookup
1208 debug_print = "R: virt_aliases for $local_part@$domain"
1212 data = ${if exists{\
1213 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1214 {${lookup{$local_part}lsearch*{\
1215 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1217 directory_transport = address_directory
1218 domains = +virtual_domains
1219 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1220 cannot_route_message = Unknown user
1221 group = ${extract{group}{VDOMAINDATA}}
1222 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1223 pipe_transport = address_pipe
1224 qualify_preserve_domain
1225 retry_use_local_part
1226 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1227 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1228 user = ${extract{user}{VDOMAINDATA}}
1230 # No direct match, so try doing a regex match if there's an
1233 debug_print = "R: virt_aliases_regex for $local_part$local_part_suffix@$domain"
1237 data = ${if exists{\
1238 ${extract{directory}{VDOMAINDATA}{${value}/aliases.regex}}}\
1239 {${lookup{$local_part}nwildlsearch*{\
1240 ${extract{directory}{VDOMAINDATA}{$value/aliases.regex}}\
1242 directory_transport = address_directory
1243 domains = +virtual_domains
1244 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1245 cannot_route_message = Unknown user
1246 group = ${extract{group}{VDOMAINDATA}}
1247 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1248 pipe_transport = address_pipe
1249 qualify_preserve_domain
1250 retry_use_local_part
1251 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1252 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1253 user = ${extract{user}{VDOMAINDATA}}
1256 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1260 directory_transport = address_directory
1261 domains = +local_domains
1262 # filter - I have disabled filtering to force users to use .forward-foo files
1263 # or procmail. This will make it easier to move mailers in the future
1265 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1266 # also checks if the .forward-bar exists, if not then it uses
1267 # .forward-default instead.
1268 file = $home/.forward\
1269 ${if eq{}{$local_part_suffix}{}{\
1270 ${if exists {${home}/.forward${local_part_suffix}} \
1271 {${local_part_suffix}}{-default}}\
1274 file_transport = address_file
1275 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1276 local_part_suffix = -*
1277 local_part_suffix_optional
1279 pipe_transport = address_pipe
1280 reply_transport = address_reply
1281 require_files = $home
1284 # This delivers to procmail
1286 debug_print = "R: procmail for $local_part@$domain"
1289 domains = +local_domains
1290 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1291 local_part_suffix = -*
1292 local_part_suffix_optional
1295 require_files = $local_part:$home/.procmailrc
1296 transport = procmail_pipe
1297 transport_current_directory = $home
1299 # This driver delivers to the LDAP generated alias file.
1301 debug_print = "R: ldap_aliases for $local_part@$domain"
1305 data = ${if exists{/var/lib/misc/$primary_hostname/user-forward.cdb}\
1306 {${lookup{$local_part}cdb\
1307 {/var/lib/misc/$primary_hostname/user-forward.cdb}}}}
1308 domains = +local_domains
1309 file_transport = address_file
1310 local_part_suffix = -*
1311 local_part_suffix_optional
1312 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1313 pipe_transport = address_pipe
1314 retry_use_local_part
1316 # This director matches local user mailboxes.
1318 debug_print = "R: localuser for $local_part@$domain"
1321 domains = +local_domains
1322 local_part_suffix = -*
1323 local_part_suffix_optional
1324 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1325 # Disable if the user has never logged in
1326 require_files = $home
1327 transport = local_delivery
1330 # Now we begin the Virtual Domain configuration
1331 # Everything before here should apply only to the local domains with a
1334 <%- if @is_packagesmaster -%>
1335 # This router delivers for packages.d.o
1337 debug_print = "R: packages for $local_part@$domain"
1339 file_transport = address_file
1340 pipe_transport = address_pipe
1341 domains = packages.debian.org
1342 require_files = /srv/packages.debian.org/conf/maintainer
1343 data = ${lookup{$local_part}cdb{/srv/packages.debian.org/conf/maintainer.cdb}}
1344 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1345 transport_home_directory = /srv/packages.debian.org/mail
1346 transport_current_directory = /srv/packages.debian.org/mail
1348 retry_use_local_part
1352 <%- if @is_rtmaster -%>
1353 # This router delivers for rt.d.o
1354 rt_force_new_verbose:
1355 debug_print = "R: rt for $local_part+new@$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
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}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?is)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1366 # FIXME: figure out how to generalize this approach so that all of the following would work
1367 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1368 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1369 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1370 # requires modification to custom condition in 'scrips'
1371 rt_force_new_quiesce:
1372 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1374 domains = rt.debian.org
1375 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1376 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1377 local_part_suffix = +new-quiesce
1378 pipe_transport = rt_pipe
1379 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}}"
1380 headers_remove = Subject
1381 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:}}"
1384 debug_print = "R: rt for $local_part@$domain"
1386 domains = rt.debian.org
1387 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1388 local_parts = ${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1389 local_part_suffix = +*
1390 local_part_suffix_optional
1391 pipe_transport = rt_pipe
1392 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}}}}"
1393 headers_remove = Subject
1394 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:}}"
1397 # Exim fails the router if it can't change to the user/group for delivery
1398 # during verification. So we have to separate the cases of verifying
1399 # the virts, and delivering to them. blah.
1402 debug_print = "R: virt_direct for $local_part@$domain"
1408 directory_transport = address_directory
1409 domains = +virtual_domains
1410 local_part_suffix = -*
1411 local_part_suffix_optional
1412 file = $home/.forward-\
1413 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1415 file_transport = address_file
1416 pipe_transport = address_pipe
1417 reply_transport = address_reply
1418 retry_use_local_part
1419 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1420 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1423 # This is a qmailesque deliver into a directory of .forward files
1425 debug_print = "R: virt_direct for $local_part@$domain"
1431 directory_transport = address_directory
1432 domains = +virtual_domains
1433 file = $home/.forward-\
1434 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1436 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1437 group = ${extract{group}{VDOMAINDATA}}
1438 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1440 local_part_suffix = -*
1441 local_part_suffix_optional
1442 pipe_transport = address_pipe
1443 reply_transport = address_reply
1444 retry_use_local_part
1445 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1446 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1448 user = ${extract{user}{VDOMAINDATA}}
1449 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1451 # This router delivers to the LDAP generated mail-forward file.
1452 # It's only really useful for debian.org
1454 debug_print = "R: virt_users for $local_part@$domain"
1458 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1459 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1460 user = ${extract{user}{VDOMAINDATA}}
1461 group = ${extract{group}{VDOMAINDATA}}
1462 # Manually construct the forwarding address, preserving the
1463 # local_part_suffix if the remote host is master.
1464 data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}\
1465 {! eq {${lookup{$local_part}cdb\
1466 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1468 {${local_part:${lookup{$local_part}cdb\
1469 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1470 ${if eq {${domain:${lookup{$local_part}cdb\
1471 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}{master.debian.org}{$local_part_suffix} {}}\
1473 ${domain:${lookup{$local_part}cdb\
1474 {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}}
1475 domains = +virtual_domains
1476 file_transport = address_file
1477 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1478 pipe_transport = address_pipe
1479 local_part_suffix = -*
1480 local_part_suffix_optional
1481 retry_use_local_part
1483 <%- if @is_bugsmx -%>
1484 # This router delivers for bugs.d.o
1486 debug_print = "R: bugs for $local_part@$domain"
1488 transport = bugs_pipe
1489 domains = bugs.debian.org
1490 cannot_route_message = Unknown or archived bug
1491 require_files = /srv/bugs.debian.org/mail/run-procmail
1493 local_parts = ${if match\
1495 {\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}\
1496 {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1497 {$local_part}fail}}fail}
1499 ######################################################################
1500 # TRANSPORTS CONFIGURATION #
1501 ######################################################################
1502 # ORDER DOES NOT MATTER #
1503 # Only one appropriate transport is called for each delivery. #
1504 ######################################################################
1509 # This transport is used for local delivery to user mailboxes. On Debian
1510 # systems group mail is used so we can write to the /var/mail
1511 # directory. (The alternative, which most other unixes use, is to deliver
1512 # as the user's own group, into a sticky-bitted directory)
1515 file = /var/mail/${local_part}
1518 no_mode_fail_narrower
1521 # This transport is used for handling pipe addresses generated by alias
1522 # or .forward files. It has a conventional name, since it is not actually
1523 # mentioned elsewhere in this configuration file. (A different name *can*
1524 # be specified via the "address_pipe_transport" option if you really want
1525 # to.) If the pipe generates any standard output, it is returned to the sender
1526 # of the message as a delivery error. Set return_fail_output instead if you
1527 # want this to happen only when the pipe fails to complete normally.
1531 current_directory = ${home}
1532 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1533 EXT=${substr_1:${local_part_suffix}}:\
1534 LOCAL=${local_part}${local_part_suffix}:\
1535 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1539 # This transport is used for handling file addresses generated by alias
1540 # or .forward files. It has a conventional name, since it is not actually
1541 # mentioned elsewhere in this configuration file.
1551 directory_mode = 0770
1552 mode_fail_narrower = false
1554 # This transport is used for handling file addresses generated by alias
1555 # or .forward files if the path ends in "/", which causes it to be treated
1556 # as a directory name rather than a file name. Each message is then delivered
1557 # to a unique file in the directory. If instead you want all such deliveries to
1558 # be in the "maildir" format that is used by some other mail software,
1559 # uncomment the final option below. If this is done, the directory specified
1560 # in the .forward or alias file is the base maildir directory.
1562 # Should you want to be able to specify either maildir or non-maildir
1563 # directory-style deliveries, then you must set up yet another transport,
1564 # called address_directory2. This is used if the path ends in "//" so should
1565 # be the one used for maildir, as the double slash suggests another level
1566 # of directory. In the absence of address_directory2, paths ending in //
1567 # are passed to address_directory.
1577 # This transport is used for handling autoreplies generated by the filtering
1578 # option of the forwardfile director. It has a conventional name, since it
1579 # is not actually mentioned elsewhere in this configuration file.
1583 # This transport is used for delivering messages over SMTP connections.
1587 connect_timeout = 15s
1588 delay_after_cutoff = false
1589 tls_certificate = /etc/exim4/ssl/thishost.crt
1590 tls_privatekey = /etc/exim4/ssl/thishost.key
1592 remote_smtp_single_domain:
1594 connect_timeout = 15s
1595 delay_after_cutoff = false
1597 tls_certificate = /etc/exim4/ssl/thishost.crt
1598 tls_privatekey = /etc/exim4/ssl/thishost.key
1600 <%- if @use_smarthost -%>
1601 remote_smtp_smarthost:
1602 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1604 delay_after_cutoff = false
1605 port = <%= @smarthost_port %>
1606 tls_tempfail_tryclear = false
1607 hosts_require_tls = <%= @smarthost %>
1608 tls_certificate = /etc/exim4/ssl/thishost.crt
1609 tls_privatekey = /etc/exim4/ssl/thishost.key
1611 # Send the message to procmail
1614 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}
1616 user = ${local_part}
1625 user = ${extract{user}{\
1626 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1630 <%- if @is_bugsmx -%>
1633 command = /srv/bugs.debian.org/mail/run-procmail
1634 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1635 EXT=${substr_1:${local_part_suffix}}:\
1636 LOCAL=${local_part}${local_part_suffix}:\
1637 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1643 <%- if @is_rtmaster -%>
1645 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1648 environment = EXTENSION=${substr_1:${local_part_suffix}}
1649 allow_commands = /usr/bin/rt-mailgate
1653 ######################################################################
1654 # RETRY CONFIGURATION #
1655 ######################################################################
1657 # This single retry rule applies to all domains and all errors. It specifies
1658 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1659 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1660 # hours, then retries every 8 hours until 4 days have passed since the first
1663 # Domain Error Retries
1664 # ------ ----- -------
1669 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1670 * * senders=: F,2h,10m
1671 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1672 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1674 # End of Exim 4 configuration