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/exim/ 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/exim are as follows:
21 # locals - This is a list of domains that are considered local. A local
22 # domain is essential one that deliveries to /var/mail
23 # will be attempted. The users available for local delivery
24 # comes 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 # rcpthosts - recipient hosts or relay domains. This is a list of
31 # all hosts that we mail exchange for. All domains that list
32 # this host in their MX records should be listed here. Wildcards
34 # relayhosts - Hostnames that can send any arbitarily addressed mail to
35 # us. This is primarily only usefull for emergancy 'queue
36 # flushing' operations, but should be populated with a list
37 # of trusted machines. Wildcards are not permitted
38 # bsmtp_domains - Domains that we deliver locally via bsmtp
41 if nodeinfo['mailrelay']
43 # mailhubdomains - Domains for which we are the MX, but the mail is relayed
44 # elsewhere. This is designed for use with small volume or
45 # restricted machines that need to use a smarthost for mail
46 # traffic. We will relay for them based on ssl cert validation
47 # but we need to teach exim how to route the mail to them. This is
53 # Exim's wildcard mechanism is a bit odd in that to say "any address in
54 # debian.org including debian.org" you must use two patterns,
57 # Also you can only place a * before a . and as the first char in a string.
58 # Wildcards always match last so they may be used as a catchall.
60 # Further details can be found in each of the files.
62 # Usefull exim commands:
63 # exim4 -qf - Try sending all messages right now, including frozen ones
64 # exim4 -bt foo@blah - Write what exim would do if it saw the address
65 # Great for testing virtual domains and forward files
67 # Special Features for users:
68 # .forward-foo - is understood as an extension address for bar-foo@cow.com
69 # .forward-default - is understood to be a catch all for bar-*@cow.com
70 # .procmailrc - with no .forward file invokes procmail for delivery
73 # For virtual domains the first lookup is done against a linear text
74 # database called 'aliases', then .forward files are consulted. Exim
75 # filtering is available for these .forward files only. .forward-default
76 # is the universal catch all for everything not handled.
78 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
79 # will trigger things like rcpt to rate limiting or possibly a reject if
80 # enough hits are triggered.
82 # value is stored in acl_c_scr
84 ######################################################################
85 # MAIN CONFIGURATION SETTINGS #
86 ######################################################################
90 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
92 perl_startup = do '/etc/exim4/exim_surbl.pl'
98 # These options specify the Access Control Lists (ACLs) that
99 # are used for incoming SMTP messages - after the RCPT and DATA
100 # commands, respectively.
102 acl_smtp_helo = check_helo
103 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
104 acl_smtp_data = check_message
107 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
108 out = "acl_smtp_mime = acl_check_mime"
112 acl_smtp_predata = acl_check_predata
114 # accept domain literal syntax in e-mail addresses. To actually make use of
115 # this a router is also required
116 allow_domain_literals = true
118 # This setting defines a named domain list called
119 # local_domains. It will be referenced
120 # later on by the syntax "+local_domains".
121 # Other domain and host lists may follow.
122 # @ is the local FQDN, @[] matches the IP adress of any local interface.
124 .include_if_exists /etc/exim4/local-settings.conf
126 domainlist local_domains = @ : \
129 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
131 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
133 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
135 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
137 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
139 localpartlist local_only_users = lsearch;/etc/exim4/localusers
141 localpartlist postmasterish = postmaster : abuse : hostmaster : root
143 # Domains we relay for; that is domains that aren't considered local but we
144 # accept mail for them.
145 domainlist rcpthosts = partial-lsearch;/etc/exim4/rcpthosts
146 hostlist debianhosts = 127.0.0.1 : net-lsearch;/var/lib/misc/thishost/debianhosts
149 if nodeinfo['mailrelay']
151 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
157 hostlist reservedaddrs = <%= nodeinfo['reservedaddrs'] %>
160 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
161 out = "tls_certificate = /etc/exim4/ssl/thishost.crt
162 tls_privatekey = /etc/exim4/ssl/thishost.key
163 tls_try_verify_hosts = *
164 tls_verify_certificates = /etc/exim4/ssl/ca.crt
165 tls_crl = /etc/exim4/ssl/ca.crl"
170 # The setting below causes Exim to do a reverse DNS lookup on all incoming
171 # IP calls, in order to get the true host name. If you feel this is too
172 # expensive, you can specify the networks for which a lookup is done, or
173 # remove the setting entirely.
175 dns_ipv4_lookup = !localhost
177 # If this option is set, then any process that is running as one of the
178 # listed users may pass a message to Exim and specify the sender's
179 # address using the "-f" command line option, without Exim's adding a
182 untrusted_set_sender = *
184 # Some operating systems use the "gecos" field in the system password file
185 # to hold other information in addition to users' real names. Exim looks up
186 # this field when it is creating "sender" and "from" headers. If these options
187 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
188 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
191 gecos_pattern = ^([^,:]*)
194 # This tells exim to immediately discard error messages (ie double bounces).
195 ignore_bounce_errors_after = 0s
197 timeout_frozen_after=14d
199 message_size_limit = 100M
201 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
202 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
203 smtp_accept_max = 300
204 smtp_accept_queue = 200
205 smtp_accept_queue_per_connection = 50
206 smtp_accept_reserve = 25
209 smtp_accept_queue = 20
210 smtp_accept_queue_per_connection = 10
211 smtp_accept_reserve = 5
213 smtp_reserve_hosts = +debianhosts
215 split_spool_directory = true
216 check_spool_inodes = 200
217 check_spool_space = 20M
221 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
223 deliver_queue_load_max = 50
227 deliver_queue_load_max = 10
230 queue_list_requires_admin = false
233 if has_variable?("clamd") && clamd == "true"
234 out = "av_scanner = clamd:/var/run/clamav/clamd.ctl"
241 out = "daemon_smtp_ports = "
244 if nodeinfo['bugsmaster']
248 if not nodeinfo['mail_port'].to_s.empty?
249 ports << nodeinfo['mail_port']
252 if nodeinfo['mailrelay']
253 ports << nodeinfo['smarthost_port']
256 out += ports.uniq.sort.join(" : ")
261 remote_sort_domains = *.debian.org:*.debian.net
263 pipelining_advertise_hosts = !*
265 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
266 out = 'tls_advertise_hosts = *'
270 smtp_enforce_sync = true
272 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
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 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
285 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
286 ${if exists {/srv/$domain/mail/whitelist}{\
287 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
289 }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
290 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
291 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
292 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
293 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
294 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
295 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
297 ######################################################################
298 # ACL CONFIGURATION #
299 ######################################################################
303 # This is a bad hack to reset the variable, by defining it be something
306 warn set acl_m_rprf = $acl_m_undefined
308 warn recipients = survey@popcon.debian.org
309 set acl_m_rprf = PopconMail
311 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
313 warn local_parts = +local_only_users
314 domains = +local_domains
315 hosts = !+debianhosts
316 set acl_m_rprf = localonly
318 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
322 if nodeinfo['rtmaster']
324 warn domains = rt.debian.org
325 set acl_m_rprf = RTMail
327 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
334 if nodeinfo['packagesmaster']
336 warn domains = packages.debian.org
337 set acl_m_rprf = PackagesMail
339 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
346 if nodeinfo['packagesqamaster']
348 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
349 set acl_m_rprf = PTSOwner
351 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
354 domains = packages.qa.debian.org
355 condition = ${if match{$local_part}{\N^bounces+\N}}
356 set acl_m_rprf = PTSListBounce
358 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
360 warn domains = packages.qa.debian.org
361 set acl_m_rprf = PTSMail
363 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
368 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
369 set acl_m_rprf = DBSignedMail
371 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
373 warn domains = +virtual_domains
374 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
375 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
376 log_message = $local_part@$domain: markup
377 set acl_m_rprf = markup
379 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
381 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
382 log_message = $local_part@$domain: markup
383 set acl_m_rprf = markup
385 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
387 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
388 log_message = $local_part@$domain: blackhole
389 set acl_m_rprf = blackhole
391 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
393 warn domains = +virtual_domains
394 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
395 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
396 log_message = $local_part@$domain: blackhole
397 set acl_m_rprf = blackhole
399 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
401 warn set acl_m_rprf = normal
407 warn set acl_c_scr = 0
411 if nodeinfo['mailrelay']
412 out = " accept verify = certificate"
417 # These are in HELO acl so that they are only run once. They increment a counter,
418 # so we don't want it to increment per rcpt to.
420 warn dnslists = list.dnswl.org&0.0.0.3
421 log_message = Hit on list.dnswl.org for $sender_host_address
422 set acl_c_scr = ${eval:$acl_c_scr-30}
424 warn dnslists = list.dnswl.org&0.0.0.2
425 log_message = Hit on list.dnswl.org for $sender_host_address
426 set acl_c_scr = ${eval:$acl_c_scr-20}
428 warn dnslists = list.dnswl.org
429 log_message = Hit on list.dnswl.org for $sender_host_address
430 set acl_c_scr = ${eval:$acl_c_scr-10}
432 warn condition = ${if isip {$sender_helo_name}{true}{false}}
433 log_message = remote host used IP address in HELO/EHLO greeting
434 set acl_c_scr = ${eval:$acl_c_scr+20}
436 warn !hosts = +debianhosts
437 condition = ${if eq{$host_lookup_failed}{1}}
438 set acl_c_scr = ${eval:$acl_c_scr+20}
440 warn !hosts = +debianhosts
441 condition = ${if eq{$host_lookup_failed}{0}}
442 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}}
443 set acl_c_scr = ${eval:$acl_c_scr+20}
445 warn !hosts = +debianhosts
446 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}}
447 set acl_c_scr = ${eval:$acl_c_scr+20}
449 warn !hosts = +debianhosts
450 dnslists = dul.dnsbl.sorbs.net
451 set acl_c_scr = ${eval:$acl_c_scr+15}
453 # If the sender's helo name is empty, the message will be rejected later
454 # because the helo is empty. If the rDNS lookup failed, we are already
455 # going to greylist them, so no sense worrying about it here. Finally,
456 # if rDNS does not match helo name (both lower cased first), greylist.
458 warn !hosts = +debianhosts
459 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
460 condition = ${if def:sender_helo_name {yes}{no}}
461 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
462 log_message = HELO doesn't match rDNS
463 set acl_c_scr = ${eval:$acl_c_scr+8}
466 # matches 098325879 - looks fishy
468 warn condition = ${if and { \
469 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
470 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
473 log_message = non-FQDN HELO
474 set acl_c_scr = ${eval:$acl_c_scr+12}
476 # Matches DOMAIN99.com - looks bad
478 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
479 log_message = SHOUTING HELO
480 set acl_c_scr = ${eval:$acl_c_scr+7}
482 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
483 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
484 # naive test, so it's not worth much
486 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
487 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
488 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
489 log_message = random HELO
490 set acl_c_scr = ${eval:$acl_c_scr+5}
492 # Implicit, but simpler to just say it
495 #!!# ACL that is used after the RCPT command on the submission port
498 # Accept if the source is local SMTP (i.e. not over TCP/IP).
499 # We do this by testing for an empty sending host field.
500 accept hosts = : 127.0.0.1
504 if nodeinfo['mailrelay']
505 out = " accept verify = certificate"
510 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
511 # This is a rough pass at preventing addres harvesting or other mail blasts.
513 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
514 message = Too many bad recipients, try again later
515 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
518 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
519 !hosts = +debianhosts
520 message = sorry, only 5 reports per hour for submission
522 accept domains = +local_domains
525 message = unknown user
530 if nodeinfo['mailrelay']
532 accept domains = +mailhubdomains
534 message = unknown user
535 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
541 accept domains = +submission_domains
543 message = unknown user
546 deny message = relay not permitted
548 #!!# ACL that is used after the RCPT command
553 if nodeinfo['mailrelay']
554 out = " accept verify = certificate"
559 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
560 # This is a rough pass at preventing addres harvesting or other mail blasts.
562 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
563 message = Too many bad recipients, try again later
564 !hosts = +debianhosts
565 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
567 # Dump spambots that are so stupid they say helo as our IP address
569 drop !hosts = +debianhosts
570 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
571 message = HELO mismatch Forged HELO for ($sender_helo_name)
573 # Also for spambots that say helo as us or one of our domains
575 drop !hosts = +debianhosts
576 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
577 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
578 message = HELO mismatch Forged HELO for ($sender_helo_name)
580 # This logic gives you a list of commonly forged domains in helo to reject against
582 warn set acl_m_frg = ${lookup{$sender_helo_name} \
583 nwildlsearch{/etc/exim4/helo-check} \
584 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
586 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
587 # say helo as a name in the list but we can't look them up
589 defer !hosts = +debianhosts
590 condition = ${if eq{$acl_m_frg}{}{no}{yes}}
591 condition = ${if eq{$sender_host_name}{}{yes}{no}}
592 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
593 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
595 # If DNS works, go ahead and reject them
597 drop !hosts = +debianhosts
598 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}{yes}{no}}
599 message = HELO mismatch Forged HELO for ($sender_helo_name)
601 # disabled accounts don't even get local mail.
602 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
603 domains = +local_domains
604 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
606 deny domains = +virtual_domains
607 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
608 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
610 hosts = !+debianhosts
611 message = mail for <$local_part@$domain> only accepted from debian.org machines
612 # Accept if the source is local SMTP (i.e. not over TCP/IP).
613 # We do this by testing for an empty sending host field.
616 deny domains = +handled_domains
617 local_parts = ^[.] : ^.*[@%!/|]
619 deny domains = !+handled_domains
620 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
622 # forwards mail to @d.o address, even if it's a bounce from master, no reply
623 # from source address; rejecting all mail now.
624 deny recipients = mendoza@debian.org
625 hosts = 65.110.39.147 : 64.39.31.15
626 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
628 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
629 sender_domains= +local_domains : debian.org : debian.net : debian.com
630 hosts = !+debianhosts
631 message = mail from <$sender_address> not allowed externally
633 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
634 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
635 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
636 message = no mail should ever come from <$sender_address>
638 warn acl = acl_getprofile
639 condition = ${if eq{$acl_m_prf}{}}
640 set acl_m_prf = $acl_m_rprf
642 defer condition = ${if eq{$acl_m_prf}{$acl_m_rprf}{no}{yes}}
643 log_message = Only one profile at a time, please
645 warn condition = ${if eq{$acl_m_prf}{localonly}}
646 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
652 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
653 hosts = !+debianhosts
654 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
661 if nodeinfo['packagesmaster']
663 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
664 condition = ${if eq {$sender_address}{$local_part@$domain}}
665 message = X-Packages-FromTo-Same: yes
670 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
673 defer !hosts = +debianhosts
674 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
675 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
676 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
679 if has_variable?("policydweight") && policydweight == "true"
681 # Check with policyd-weight - this only works with a version after etch\'s,
682 # sadly. etch\'s version attempts to hold the socket open, since that\'s what
683 # postfix expects. Exim, on the other hand, expects the remote side to close
684 # the socket when it\'s finished sending data, so it see each transaction as
685 # an incomplete read. I\'m sure there\'s a way we could force exim to do
686 # something sick and clever to force either the interpretation or the socket
687 # closure, but I\'m fairly sure it\'s now worth it, since the backport of
688 # policyd-weight is trivial.
689 warn !hosts = +debianhosts
690 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
691 {request=smtpd_access_policy\n\
692 protocol_state=RCPT\n\
693 protocol_name=${uc:$received_protocol}\n\
694 helo_name=$sender_helo_name\n\
695 queue_id=$message_exim_id\n\
696 sender=$sender_address\n\
697 recipient=$local_part@$domain\n\
698 recipient_count=$rcpt_count\n\
699 client_address=$sender_host_address\n\
700 client_name=$sender_host_name\n\
701 reverse_client_name=$sender_host_name\n\
702 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
703 {20s}{\n}{socket failure}}
705 # Defer on socket error
706 defer !hosts = +debianhosts
707 condition = ${if eq{$acl_m_pw}{socket failure}{yes}{no}}
708 message = Cannot connect to policyd-weight. Please try again later.
710 # Set proposed action to $acl_m_act and message to $acl_m_mes
711 warn !hosts = +debianhosts
712 set acl_m_mes = ${extract{action}{$acl_m_pw}}
713 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
715 # Add X-policyd-weight header line to message
716 warn !hosts = +debianhosts
718 condition = ${if eq{$acl_m_act}{PREPEND}{yes}{no}}
720 # Write log message, if policyd-weight can\'t run checks
721 warn !hosts = +debianhosts
722 log_message = policyd-weight message: $acl_m_mes
723 condition = ${if eq{$acl_m_act}{DUNNO}{yes}{no}}
725 # Deny mails which policyd-weight thinks are spam
726 deny !hosts = +debianhosts
727 message = policyd-weight said: $acl_m_mes
728 condition = ${if eq{$acl_m_act}{550}{yes}{no}}
730 # Defer messages when policyd-weight suggests so.
731 defer !hosts = +debianhosts
732 message = policyd-weight said: $acl_m_mes
733 condition = ${if eq{$acl_m_act}{450}{yes}{no}}
740 if nodeinfo['rtmaster']
742 warn condition = ${if eq{$acl_m_prf}{RTMail}}
743 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
750 if has_variable?("greylistd") && greylistd == "true"
753 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
754 log_message = greylisted.
755 local_parts = ${if match_domain{$domain}{+virtual_domains}\
756 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
757 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
758 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
759 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
761 !hosts = : +debianhosts : WHITELIST : \
762 ${if exists {/etc/greylistd/whitelist-hosts}\
763 {/etc/greylistd/whitelist-hosts}{}} : \
764 ${if exists {/var/lib/greylistd/whitelist-hosts}\
765 {/var/lib/greylistd/whitelist-hosts}{}}
767 domains = +handled_domains : +rcpthosts
768 condition = ${readsocket{/var/run/greylistd/socket}\
770 $sender_host_address \
772 $local_part@$domain}\
775 elsif has_variable?("postgrey") && postgrey == "true"
777 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
778 # this adds acl_m_grey if there isn\'t one (so unique per message)
781 !hosts = : +debianhosts : WHITELIST
782 condition = ${if def:acl_m_grey {no}{yes}}
783 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
785 # and defers the message if postgrey thinks it should be defered ...
788 !hosts = : +debianhosts : WHITELIST
790 domains = +handled_domains : +rcpthosts
791 local_parts = GREYLIST_LOCAL_PARTS
792 set acl_m_pgr = request=smtpd_access_policy\n\
793 protocol_state=RCPT\n\
794 protocol_name=${uc:$received_protocol}\n\
795 instance=${acl_m_grey}\n\
796 helo_name=${sender_helo_name}\n\
797 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
798 client_name=${sender_host_name}\n\
799 sender=${sender_address}\n\
800 recipient=$local_part@$domain\n\n
801 set acl_m_pgr = ${sg{\
802 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
803 {5s}{}{action=DUNNO}}\
805 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
806 log_message = greylisted.
807 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
809 # ... or adds a header with information about how long the delay was
812 !hosts = : +debianhosts : WHITELIST
814 domains = +handled_domains : +rcpthosts
815 local_parts = GREYLIST_LOCAL_PARTS
816 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
817 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
823 accept local_parts = +postmasterish
824 domains = +handled_domains : +rcpthosts
826 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
827 message = I'm terribly sorry, but it seems you have been blacklisted
828 log_message = blacklisted IP
830 deny log_message = <$sender_address> is blacklisted
831 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
832 message = We have blacklisted <$sender_address>. Please stop mailing us
834 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
835 dnslists = ${if match_domain{$domain}{+virtual_domains}\
836 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
837 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
838 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
839 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
840 domains = +handled_domains : +rcpthosts
841 !hosts = +debianhosts : WHITELIST
843 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
844 dnslists = ${if match_domain{$domain}{+virtual_domains}\
845 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
846 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
847 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
848 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
849 domains = +handled_domains : +rcpthosts
850 !hosts = +debianhosts : WHITELIST
852 deny domains = +handled_domains : +rcpthosts
853 local_parts = ${if match_domain{$domain}{+virtual_domains}\
854 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
855 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
856 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
857 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
858 !hosts = +debianhosts : WHITELIST
859 !verify = sender/callout
863 if nodeinfo['mailrelay']
865 accept domains = +mailhubdomains
867 message = unknown user
868 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
873 accept domains = +handled_domains
875 message = unknown user
876 verify = recipient/defer_ok
878 accept domains = +rcpthosts
880 message = unrouteable address
883 accept hosts = +debianhosts
885 accept authenticated = *
887 deny message = relay not permitted
891 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
895 discard condition = ${if <{$message_size}{256000}}
896 condition = ${if eq {$acl_m_prf}{blackhole}}
897 set acl_m_srb = ${perl{surblspamcheck}}
898 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
899 log_message = discarded surbl message for $recipients
901 warn condition = ${if <{$message_size}{256000}}
902 condition = ${if eq {$acl_m_prf}{markup}}
903 set acl_m_srb = ${perl{surblspamcheck}}
904 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
905 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
907 accept condition = ${if eq {$acl_m_prf}{markup}}
909 deny condition = ${if <{$message_size}{256000}}
910 set acl_m_srb = ${perl{surblspamcheck}}
911 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
912 log_message = $acl_m_srb
922 deny condition = ${if eq{$acl_m_prf}{localonly}}
923 message = mail for $acl_m_lrc is only accepted internally
928 #!!# ACL that is used after the DATA command
932 if nodeinfo['rtmaster']
934 deny condition = ${if eq {$acl_m_prf}{RTMail}}
935 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
936 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
937 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
938 message = messages to the Request Tracker system require a subject tag or a subaddress
945 if nodeinfo['packagesqamaster']
947 deny !hosts = +debianhosts : 217.196.43.134
948 condition = ${if eq {$acl_m_prf}{PTSMail}}
949 condition = ${if def:h_X-PTS-Approved:{false}{true}}
950 message = messages to the PTS require an X-PTS-Approved header
955 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
956 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
957 {!match {$message_body}{PGP SIGNED MESSAGE}} \
958 {!match {$message_body}{PGP SIGNATURE}} \
959 {!match {$header_content-type:}{multipart/signed}} \
960 {!match {$header_content-type:}{pgp}} \
963 message = Mail to this address needs to be PGP-signed
965 accept verify = certificate
967 require verify = header_syntax
968 message = Invalid syntax in the header
970 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
971 # postfix's strict_7bit_headers option, but only checks a few common problem
972 # headers, as there doesn't appear to be an easy way to check them all.
974 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
975 {match {$rh_To:}{[\200-\377]}}\
976 {match {$rh_From:}{[\200-\377]}}\
977 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
978 message = improper use of 8-bit data in message header: message rejected
981 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
982 message = Your mailer is not RFC 2047 compliant: message rejected
986 if has_variable?("clamd") && clamd == "true"
988 discard condition = ${if eq {$acl_m_prf}{blackhole}}
991 log_message = discarded malware message for $recipients
993 deny condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
996 message = malware detected: $malware_name: message rejected
998 warn condition = ${if eq {$acl_m_prf}{markup}}
1000 malware = */defer_ok
1001 message = X-malware detected: $malware_name
1008 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
1010 discard condition = ${if <{$message_size}{256000}}
1011 condition = ${if eq {$acl_m_prf}{blackhole}}
1012 set acl_m_srb = ${perl{surblspamcheck}}
1013 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1014 log_message = discarded surbl message for $recipients
1016 warn condition = ${if <{$message_size}{256000}}
1017 condition = ${if eq {$acl_m_prf}{markup}}
1018 set acl_m_srb = ${perl{surblspamcheck}}
1019 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1020 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1022 accept condition = ${if eq {$acl_m_prf}{markup}}
1024 deny condition = ${if <{$message_size}{256000}}
1025 set acl_m_srb = ${perl{surblspamcheck}}
1026 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1027 log_message = $acl_m_srb
1028 message = $acl_m_srb
1033 # Check header_sender except for survey@popcon.d.o
1034 deny condition = ${if eq{$acl_m_prf}{PopconMail}{false}{true}}
1035 !verify = header_sender
1036 message = No valid sender found in the From:, Sender: and Reply-to: headers
1040 if nodeinfo['packagesmaster']
1042 deny message = Congratulations, you scored $spam_score points.
1043 log_message = spam: $spam_score points.
1044 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1046 !verify = certificate
1047 !hosts = +debianhosts
1048 condition = ${if <{$message_size}{256000}}
1049 spam = pkg_user : true
1050 condition = ${if >{$spam_score_int}{59}}
1059 ######################################################################
1060 # REWRITE CONFIGURATION #
1061 ######################################################################
1067 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
1068 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
1069 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1070 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1071 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1072 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
1075 #!!#######################################################!!#
1076 #!!# Here follow routers created from the old routers, #!!#
1077 #!!# for handling non-local domains. #!!#
1078 #!!#######################################################!!#
1084 ######################################################################
1085 # ROUTERS CONFIGURATION #
1086 # Specifies how addresses are handled #
1087 ######################################################################
1088 # ORDER DOES MATTER #
1089 # An address is passed to each in turn until it is accepted. #
1090 ######################################################################
1094 if nodeinfo['mailrelay']
1097 driver = manualroute
1098 domains = +mailhubdomains
1099 transport = remote_smtp
1100 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1101 require_files = /etc/exim4/manualroute
1108 debug_print = "R: bsmtp for $local_part@$domain"
1109 driver = manualroute
1110 domains = +bsmtp_domains
1111 require_files = /etc/exim4/bsmtp
1112 route_list = * ${extract{file}{\
1113 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1117 # This router routes to remote hosts over SMTP by explicit IP address,
1118 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1119 # require this facility, which is why it is enabled by default in Exim.
1121 debug_print = "R: ipliteral for $local_part@$domain"
1123 domains = !+handled_domains
1124 transport = remote_smtp
1125 ignore_target_hosts = +reservedaddrs
1129 if not nodeinfo['smarthost'].empty?
1132 debug_print = "R: smarthost for $local_part@$domain"
1133 driver = manualroute
1134 domains = !+handled_domains
1135 transport = remote_smtp_smarthost
1136 route_list = * ' + nodeinfo['smarthost'] + '
1137 host_find_failed = defer
1138 same_domain_copy_routing = yes
1145 # This router routes to remote hosts over SMTP using a DNS lookup.
1146 # Ignore reserved network responses, including localhost.
1148 debug_print = "R: dnslookup for $local_part@$domain"
1150 domains = !+handled_domains
1151 transport = remote_smtp
1152 ignore_target_hosts = +reservedaddrs
1156 debug_print = "R: postmasterish for $local_part@$domain"
1161 local_parts = +postmasterish
1162 domains = +handled_domains
1163 data = debian-admin@debian.org
1164 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1166 # This router handles aliasing using a traditional /etc/aliases file.
1167 # If any of your aliases expand to pipes or files, you will need to set
1168 # up a user and a group for these deliveries to run under. You can do
1169 # this by uncommenting the "user" option below (changing the user name
1170 # as appropriate) and adding a "group" option if necessary.
1173 debug_print = "R: system_aliases for $local_part@$domain"
1177 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1178 domains = +local_domains
1179 file_transport = address_file
1180 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1181 pipe_transport = address_pipe
1182 retry_use_local_part
1184 # This router handles forwarding using traditional .forward files.
1185 # It also allows mail filtering when a forward file starts with the
1186 # string "# Exim filter": to disable filtering, uncomment the "filter"
1187 # option. The check_ancestor option means that if the forward file
1188 # generates an address that is an ancestor of the current one, the
1189 # current one gets passed on instead. This covers the case where A is
1190 # aliased to B and B has a .forward file pointing to A.
1192 # For standard debian setup of one group per user, it is acceptable---normal
1193 # even---for .forward to be group writable. If you have everyone in one
1194 # group, you should comment out the "modemask" line. Without it, the exim
1195 # default of 022 will apply, which is probably what you want.
1198 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1203 directory_transport = address_directory
1204 domains = +local_domains
1205 # filter - I have disabled filtering to force users to use .forward-foo files
1206 # or procmail. This will make it easier to move mailers in the future
1208 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1209 # also checks if the .forward-bar exists, if not then it uses
1210 # .forward-default instead.
1211 file = $home/.forward\
1212 ${if eq{}{$local_part_suffix}{}{\
1213 ${if exists {${home}/.forward${local_part_suffix}} \
1214 {${local_part_suffix}}{-default}}\
1217 file_transport = address_file
1218 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1219 local_part_suffix = -*
1220 local_part_suffix_optional
1222 pipe_transport = address_pipe
1223 reply_transport = address_reply
1224 require_files = $home
1225 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
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}"
1266 require_files = $local_part:$home/.procmailrc
1267 transport = procmail_pipe
1268 transport_current_directory = $home
1270 # This driver delivers to the LDAP generated alias file.
1272 debug_print = "R: ldap_aliases for $local_part@$domain"
1276 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
1277 {${lookup{$local_part}cdb\
1278 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
1279 domains = +local_domains
1280 file_transport = address_file
1281 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1282 pipe_transport = address_pipe
1283 retry_use_local_part
1285 # This director matches local user mailboxes.
1287 debug_print = "R: localuser for $local_part@$domain"
1290 domains = +local_domains
1291 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1292 # Disable if the user has never logged in
1293 require_files = $home
1294 transport = local_delivery
1297 # Now we begin the Virtual Domain configuration
1298 # Everything before here should apply only to the local domains with a
1301 # exim4 fails the router if it can't change to the user/group for delivery
1302 # during verification. So we have to seperate the cases of verifying
1303 # the virts, and delivering to them. blah.
1306 if nodeinfo['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 = /org/packages.debian.org/conf/maintainer
1316 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
1317 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1318 transport_home_directory = /org/packages.debian.org/mail
1319 transport_current_directory = /org/packages.debian.org/mail
1321 retry_use_local_part
1330 if nodeinfo['bugsmaster']
1332 # This router delivers for bugs.d.o
1334 debug_print = "R: bugs for $local_part@$domain"
1336 transport = bugs_pipe
1337 domains = bugs.debian.org
1338 cannot_route_message = Unknown or archived bug
1339 require_files = /org/bugs.debian.org/mail/run-procmail
1341 local_parts = ${if match\
1343 {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
1344 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1345 {$local_part}fail}}fail}
1353 if nodeinfo['rtmaster']
1355 # This router delivers for rt.d.o
1356 rt_force_new_verbose:
1357 debug_print = "R: rt for $local_part+new@$domain"
1359 domains = rt.debian.org
1360 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1361 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1362 local_part_suffix = +new
1363 pipe_transport = rt_pipe
1364 data = "|/usr/bin/rt-mailgate --queue \'${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}\' --url https://rt.debian.org/ --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1365 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1367 # FIXME: figure out how to generalize this approach so that all of the following would work
1368 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1369 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1370 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1371 # requires modification to custom condition in \'scrips\'
1372 rt_force_new_quiesce:
1373 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1375 domains = rt.debian.org
1376 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1377 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1378 local_part_suffix = +new-quiesce
1379 pipe_transport = rt_pipe
1380 data = "|/usr/bin/rt-mailgate --queue \'${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}\' --url https://rt.debian.org/ --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1381 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce"
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}{}}}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}{}}}lsearch{RT_QUEUE_MAP}}\' --url https://rt.debian.org/ --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1393 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1400 debug_print = "R: virt_aliases for $local_part@$domain"
1402 data = ${if exists{\
1403 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1404 {${lookup{$local_part}lsearch*{\
1405 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1407 directory_transport = address_directory
1408 cannot_route_message = Unknown user
1409 domains = +virtual_domains
1410 file_transport = address_file
1411 pipe_transport = address_pipe
1412 qualify_preserve_domain
1413 retry_use_local_part
1414 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1415 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1419 debug_print = "R: virt_direct for $local_part@$domain"
1425 directory_transport = address_directory
1426 domains = +virtual_domains
1427 file = $home/.forward-\
1428 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1430 file_transport = address_file
1431 pipe_transport = address_pipe
1432 reply_transport = address_reply
1433 retry_use_local_part
1434 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1435 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1438 # This is a senmailesque alias file lookup
1440 debug_print = "R: virt_aliases for $local_part@$domain"
1444 data = ${if exists{\
1445 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1446 {${lookup{$local_part}lsearch*{\
1447 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1449 directory_transport = address_directory
1450 domains = +virtual_domains
1451 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1452 cannot_route_message = Unknown user
1453 group = ${extract{group}{VDOMAINDATA}}
1454 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1455 pipe_transport = address_pipe
1456 qualify_preserve_domain
1457 retry_use_local_part
1458 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1459 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1461 user = ${extract{user}{VDOMAINDATA}}
1463 # This is a qmailesque deliver into a directory of .forward files
1465 debug_print = "R: virt_direct for $local_part@$domain"
1471 directory_transport = address_directory
1472 domains = +virtual_domains
1473 file = $home/.forward-\
1474 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1476 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1477 group = ${extract{group}{VDOMAINDATA}}
1478 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1480 pipe_transport = address_pipe
1481 reply_transport = address_reply
1482 retry_use_local_part
1483 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1484 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1486 user = ${extract{user}{VDOMAINDATA}}
1487 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1489 ######################################################################
1490 # TRANSPORTS CONFIGURATION #
1491 ######################################################################
1492 # ORDER DOES NOT MATTER #
1493 # Only one appropriate transport is called for each delivery. #
1494 ######################################################################
1499 # This transport is used for local delivery to user mailboxes. On debian
1500 # systems group mail is used so we can write to the /var/mail
1501 # directory. (The alternative, which most other unixes use, is to deliver
1502 # as the user's own group, into a sticky-bitted directory)
1505 file = /var/mail/${local_part}
1508 no_mode_fail_narrower
1511 # This transport is used for handling pipe addresses generated by alias
1512 # or .forward files. It has a conventional name, since it is not actually
1513 # mentioned elsewhere in this configuration file. (A different name *can*
1514 # be specified via the "address_pipe_transport" option if you really want
1515 # to.) If the pipe generates any standard output, it is returned to the sender
1516 # of the message as a delivery error. Set return_fail_output instead if you
1517 # want this to happen only when the pipe fails to complete normally.
1521 current_directory = ${home}
1522 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1523 EXT=${substr_1:${local_part_suffix}}:\
1524 LOCAL=${local_part}${local_part_suffix}:\
1525 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1529 # This transport is used for handling file addresses generated by alias
1530 # or .forward files. It has a conventional name, since it is not actually
1531 # mentioned elsewhere in this configuration file.
1541 directory_mode = 0770
1542 mode_fail_narrower = false
1544 # This transport is used for handling file addresses generated by alias
1545 # or .forward files if the path ends in "/", which causes it to be treated
1546 # as a directory name rather than a file name. Each message is then delivered
1547 # to a unique file in the directory. If instead you want all such deliveries to
1548 # be in the "maildir" format that is used by some other mail software,
1549 # uncomment the final option below. If this is done, the directory specified
1550 # in the .forward or alias file is the base maildir directory.
1552 # Should you want to be able to specify either maildir or non-maildir
1553 # directory-style deliveries, then you must set up yet another transport,
1554 # called address_directory2. This is used if the path ends in "//" so should
1555 # be the one used for maildir, as the double slash suggests another level
1556 # of directory. In the absence of address_directory2, paths ending in //
1557 # are passed to address_directory.
1567 # This transport is used for handling autoreplies generated by the filtering
1568 # option of the forwardfile director. It has a conventional name, since it
1569 # is not actually mentioned elsewhere in this configuration file.
1573 # This transport is used for delivering messages over SMTP connections.
1577 connect_timeout = 1m
1578 delay_after_cutoff = false
1581 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1582 out = " tls_certificate = /etc/exim4/ssl/thishost.crt
1583 tls_privatekey = /etc/exim4/ssl/thishost.key"
1590 if not nodeinfo['smarthost'].empty?
1592 remote_smtp_smarthost:
1593 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1595 delay_after_cutoff = false
1597 out += nodeinfo['smarthost_port'].to_s + "\n"
1598 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1599 out += ' tls_tempfail_tryclear = false
1600 hosts_require_tls = ' + nodeinfo['smarthost'] + '
1601 tls_certificate = /etc/exim4/ssl/thishost.crt
1602 tls_privatekey = /etc/exim4/ssl/thishost.key
1609 # Send the message to procmail
1612 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1614 user = ${local_part}
1623 user = ${extract{user}{\
1624 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1630 if nodeinfo['bugsmaster']
1634 command = /org/bugs.debian.org/mail/run-procmail
1635 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1636 EXT=${substr_1:${local_part_suffix}}:\
1637 LOCAL=${local_part}${local_part_suffix}:\
1638 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1649 if nodeinfo['rtmaster']
1652 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1655 environment = EXTENSION=${substr_1:${local_part_suffix}}
1656 allow_commands = /usr/bin/rt-mailgate
1662 ######################################################################
1663 # RETRY CONFIGURATION #
1664 ######################################################################
1666 # This single retry rule applies to all domains and all errors. It specifies
1667 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1668 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1669 # hours, then retries every 8 hours until 4 days have passed since the first
1672 # Domain Error Retries
1673 # ------ ----- -------
1678 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1679 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1680 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1682 # End of Exim 4 configuration