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 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
691 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
692 {request=smtpd_access_policy\n\
693 protocol_state=RCPT\n\
694 protocol_name=${uc:$received_protocol}\n\
695 helo_name=$sender_helo_name\n\
696 queue_id=$message_exim_id\n\
697 sender=$sender_address\n\
698 recipient=$local_part@$domain\n\
699 recipient_count=$rcpt_count\n\
700 client_address=$sender_host_address\n\
701 client_name=$sender_host_name\n\
702 reverse_client_name=$sender_host_name\n\
703 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
704 {20s}{\n}{socket failure}}
706 # Defer on socket error
707 defer !hosts = +debianhosts
708 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
709 condition = ${if eq{$acl_m_pw}{socket failure}{yes}{no}}
710 message = Cannot connect to policyd-weight. Please try again later.
712 # Set proposed action to $acl_m_act and message to $acl_m_mes
713 warn !hosts = +debianhosts
714 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
715 set acl_m_mes = ${extract{action}{$acl_m_pw}}
716 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
718 # Add X-policyd-weight header line to message
719 warn !hosts = +debianhosts
720 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
722 condition = ${if eq{$acl_m_act}{PREPEND}{yes}{no}}
724 # Write log message, if policyd-weight can\'t run checks
725 warn !hosts = +debianhosts
726 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
727 log_message = policyd-weight message: $acl_m_mes
728 condition = ${if eq{$acl_m_act}{DUNNO}{yes}{no}}
730 # Deny mails which policyd-weight thinks are spam
731 deny !hosts = +debianhosts
732 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
733 message = policyd-weight said: $acl_m_mes
734 condition = ${if eq{$acl_m_act}{550}{yes}{no}}
736 # Defer messages when policyd-weight suggests so.
737 defer !hosts = +debianhosts
738 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
739 message = policyd-weight said: $acl_m_mes
740 condition = ${if eq{$acl_m_act}{450}{yes}{no}}
747 if nodeinfo['rtmaster']
749 warn condition = ${if eq{$acl_m_prf}{RTMail}}
750 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
757 if has_variable?("greylistd") && greylistd == "true"
760 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
761 log_message = greylisted.
762 local_parts = ${if match_domain{$domain}{+virtual_domains}\
763 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
764 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
765 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
766 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
768 !hosts = : +debianhosts : WHITELIST : \
769 ${if exists {/etc/greylistd/whitelist-hosts}\
770 {/etc/greylistd/whitelist-hosts}{}} : \
771 ${if exists {/var/lib/greylistd/whitelist-hosts}\
772 {/var/lib/greylistd/whitelist-hosts}{}}
773 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
775 domains = +handled_domains : +rcpthosts
776 condition = ${readsocket{/var/run/greylistd/socket}\
778 $sender_host_address \
780 $local_part@$domain}\
783 elsif has_variable?("postgrey") && postgrey == "true"
785 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
786 # this adds acl_m_grey if there isn\'t one (so unique per message)
789 !hosts = : +debianhosts : WHITELIST
790 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
791 condition = ${if def:acl_m_grey {no}{yes}}
792 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
794 # and defers the message if postgrey thinks it should be defered ...
797 !hosts = : +debianhosts : WHITELIST
798 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
800 domains = +handled_domains : +rcpthosts
801 local_parts = GREYLIST_LOCAL_PARTS
802 set acl_m_pgr = request=smtpd_access_policy\n\
803 protocol_state=RCPT\n\
804 protocol_name=${uc:$received_protocol}\n\
805 instance=${acl_m_grey}\n\
806 helo_name=${sender_helo_name}\n\
807 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
808 client_name=${sender_host_name}\n\
809 sender=${sender_address}\n\
810 recipient=$local_part@$domain\n\n
811 set acl_m_pgr = ${sg{\
812 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
813 {5s}{}{action=DUNNO}}\
815 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
816 log_message = greylisted.
817 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
819 # ... or adds a header with information about how long the delay was
822 !hosts = : +debianhosts : WHITELIST
823 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
825 domains = +handled_domains : +rcpthosts
826 local_parts = GREYLIST_LOCAL_PARTS
827 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
828 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
834 accept local_parts = +postmasterish
835 domains = +handled_domains : +rcpthosts
837 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
838 message = I'm terribly sorry, but it seems you have been blacklisted
839 log_message = blacklisted IP
841 deny log_message = <$sender_address> is blacklisted
842 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
843 message = We have blacklisted <$sender_address>. Please stop mailing us
845 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
846 dnslists = ${if match_domain{$domain}{+virtual_domains}\
847 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
848 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
849 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
850 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
851 domains = +handled_domains : +rcpthosts
852 !hosts = +debianhosts : WHITELIST
854 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
855 dnslists = ${if match_domain{$domain}{+virtual_domains}\
856 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
857 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
858 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
859 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
860 domains = +handled_domains : +rcpthosts
861 !hosts = +debianhosts : WHITELIST
863 deny domains = +handled_domains : +rcpthosts
864 local_parts = ${if match_domain{$domain}{+virtual_domains}\
865 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
866 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
867 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
868 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
869 !hosts = +debianhosts : WHITELIST
870 !verify = sender/callout
874 if nodeinfo['mailrelay']
876 accept domains = +mailhubdomains
878 message = unknown user
879 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
884 accept domains = +handled_domains
886 message = unknown user
887 verify = recipient/defer_ok
889 accept domains = +rcpthosts
891 message = unrouteable address
894 accept hosts = +debianhosts
896 accept authenticated = *
898 deny message = relay not permitted
902 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
906 discard condition = ${if <{$message_size}{256000}}
907 condition = ${if eq {$acl_m_prf}{blackhole}}
908 set acl_m_srb = ${perl{surblspamcheck}}
909 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
910 log_message = discarded surbl message for $recipients
912 deny condition = ${if <{$message_size}{256000}}
913 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
914 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
915 set acl_m_srb = ${perl{surblspamcheck}}
916 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
917 log_message = $acl_m_srb
920 warn condition = ${if <{$message_size}{256000}}
921 condition = ${if eq {$acl_m_prf}{markup}}
922 set acl_m_srb = ${perl{surblspamcheck}}
923 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
924 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
933 deny condition = ${if eq{$acl_m_prf}{localonly}}
934 message = mail for $acl_m_lrc is only accepted internally
939 #!!# ACL that is used after the DATA command
943 if nodeinfo['rtmaster']
945 deny condition = ${if eq {$acl_m_prf}{RTMail}}
946 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
947 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
948 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
949 message = messages to the Request Tracker system require a subject tag or a subaddress
956 if nodeinfo['packagesqamaster']
958 deny !hosts = +debianhosts : 217.196.43.134
959 condition = ${if eq {$acl_m_prf}{PTSMail}}
960 condition = ${if def:h_X-PTS-Approved:{false}{true}}
961 message = messages to the PTS require an X-PTS-Approved header
966 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
967 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
968 {!match {$message_body}{PGP SIGNED MESSAGE}} \
969 {!match {$message_body}{PGP SIGNATURE}} \
970 {!match {$header_content-type:}{multipart/signed}} \
971 {!match {$header_content-type:}{pgp}} \
974 message = Mail to this address needs to be PGP-signed
976 accept verify = certificate
978 require verify = header_syntax
979 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
980 message = Invalid syntax in the header
982 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
983 # postfix's strict_7bit_headers option, but only checks a few common problem
984 # headers, as there doesn't appear to be an easy way to check them all.
986 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
987 {match {$rh_To:}{[\200-\377]}}\
988 {match {$rh_From:}{[\200-\377]}}\
989 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
990 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
991 message = improper use of 8-bit data in message header: message rejected
994 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
995 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
996 message = Your mailer is not RFC 2047 compliant: message rejected
1000 if has_variable?("clamd") && clamd == "true"
1002 discard condition = ${if eq {$acl_m_prf}{blackhole}}
1004 malware = */defer_ok
1005 log_message = discarded malware message for $recipients
1007 deny condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1008 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1010 malware = */defer_ok
1011 message = malware detected: $malware_name: message rejected
1013 warn condition = ${if eq {$acl_m_prf}{markup}}
1015 malware = */defer_ok
1016 message = X-malware detected: $malware_name
1023 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
1025 discard condition = ${if <{$message_size}{256000}}
1026 condition = ${if eq {$acl_m_prf}{blackhole}}
1027 set acl_m_srb = ${perl{surblspamcheck}}
1028 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1029 log_message = discarded surbl message for $recipients
1031 deny condition = ${if <{$message_size}{256000}}
1032 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1033 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1034 set acl_m_srb = ${perl{surblspamcheck}}
1035 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1036 log_message = $acl_m_srb
1037 message = $acl_m_srb
1039 warn condition = ${if <{$message_size}{256000}}
1040 condition = ${if eq {$acl_m_prf}{markup}}
1041 set acl_m_srb = ${perl{surblspamcheck}}
1042 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1043 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1049 # Check header_sender except for survey@popcon.d.o
1050 deny condition = ${if eq{$acl_m_prf}{PopconMail}{false}{true}}
1051 !verify = header_sender
1052 message = No valid sender found in the From:, Sender: and Reply-to: headers
1056 if nodeinfo['packagesmaster']
1058 deny message = Congratulations, you scored $spam_score points.
1059 log_message = spam: $spam_score points.
1060 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1062 !verify = certificate
1063 !hosts = +debianhosts
1064 condition = ${if <{$message_size}{256000}}
1065 spam = pkg_user : true
1066 condition = ${if >{$spam_score_int}{59}}
1075 ######################################################################
1076 # REWRITE CONFIGURATION #
1077 ######################################################################
1083 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
1084 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
1085 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1086 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1087 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1088 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
1091 #!!#######################################################!!#
1092 #!!# Here follow routers created from the old routers, #!!#
1093 #!!# for handling non-local domains. #!!#
1094 #!!#######################################################!!#
1100 ######################################################################
1101 # ROUTERS CONFIGURATION #
1102 # Specifies how addresses are handled #
1103 ######################################################################
1104 # ORDER DOES MATTER #
1105 # An address is passed to each in turn until it is accepted. #
1106 ######################################################################
1110 if nodeinfo['mailrelay']
1113 driver = manualroute
1114 domains = +mailhubdomains
1115 transport = remote_smtp
1116 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1117 require_files = /etc/exim4/manualroute
1124 debug_print = "R: bsmtp for $local_part@$domain"
1125 driver = manualroute
1126 domains = +bsmtp_domains
1127 require_files = /etc/exim4/bsmtp
1128 route_list = * ${extract{file}{\
1129 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1133 # This router routes to remote hosts over SMTP by explicit IP address,
1134 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1135 # require this facility, which is why it is enabled by default in Exim.
1137 debug_print = "R: ipliteral for $local_part@$domain"
1139 domains = !+handled_domains
1140 transport = remote_smtp
1141 ignore_target_hosts = +reservedaddrs
1145 if not nodeinfo['smarthost'].empty?
1148 debug_print = "R: smarthost for $local_part@$domain"
1149 driver = manualroute
1150 domains = !+handled_domains
1151 transport = remote_smtp_smarthost
1152 route_list = * ' + nodeinfo['smarthost'] + '
1153 host_find_failed = defer
1154 same_domain_copy_routing = yes
1161 # This router routes to remote hosts over SMTP using a DNS lookup.
1162 # Ignore reserved network responses, including localhost.
1164 debug_print = "R: dnslookup for $local_part@$domain"
1166 domains = !+handled_domains
1167 transport = remote_smtp
1168 ignore_target_hosts = +reservedaddrs
1172 debug_print = "R: postmasterish for $local_part@$domain"
1177 local_parts = +postmasterish
1178 domains = +handled_domains
1179 data = debian-admin@debian.org
1180 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1182 # This router handles aliasing using a traditional /etc/aliases file.
1183 # If any of your aliases expand to pipes or files, you will need to set
1184 # up a user and a group for these deliveries to run under. You can do
1185 # this by uncommenting the "user" option below (changing the user name
1186 # as appropriate) and adding a "group" option if necessary.
1189 debug_print = "R: system_aliases for $local_part@$domain"
1193 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1194 domains = +local_domains
1195 file_transport = address_file
1196 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1197 pipe_transport = address_pipe
1198 retry_use_local_part
1200 # This router handles forwarding using traditional .forward files.
1201 # It also allows mail filtering when a forward file starts with the
1202 # string "# Exim filter": to disable filtering, uncomment the "filter"
1203 # option. The check_ancestor option means that if the forward file
1204 # generates an address that is an ancestor of the current one, the
1205 # current one gets passed on instead. This covers the case where A is
1206 # aliased to B and B has a .forward file pointing to A.
1208 # For standard debian setup of one group per user, it is acceptable---normal
1209 # even---for .forward to be group writable. If you have everyone in one
1210 # group, you should comment out the "modemask" line. Without it, the exim
1211 # default of 022 will apply, which is probably what you want.
1214 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1219 directory_transport = address_directory
1220 domains = +local_domains
1221 # filter - I have disabled filtering to force users to use .forward-foo files
1222 # or procmail. This will make it easier to move mailers in the future
1224 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1225 # also checks if the .forward-bar exists, if not then it uses
1226 # .forward-default instead.
1227 file = $home/.forward\
1228 ${if eq{}{$local_part_suffix}{}{\
1229 ${if exists {${home}/.forward${local_part_suffix}} \
1230 {${local_part_suffix}}{-default}}\
1233 file_transport = address_file
1234 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1235 local_part_suffix = -*
1236 local_part_suffix_optional
1238 pipe_transport = address_pipe
1239 reply_transport = address_reply
1240 require_files = $home
1241 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1245 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1249 directory_transport = address_directory
1250 domains = +local_domains
1251 # filter - I have disabled filtering to force users to use .forward-foo files
1252 # or procmail. This will make it easier to move mailers in the future
1254 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1255 # also checks if the .forward-bar exists, if not then it uses
1256 # .forward-default instead.
1257 file = $home/.forward\
1258 ${if eq{}{$local_part_suffix}{}{\
1259 ${if exists {${home}/.forward${local_part_suffix}} \
1260 {${local_part_suffix}}{-default}}\
1263 file_transport = address_file
1264 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1265 local_part_suffix = -*
1266 local_part_suffix_optional
1268 pipe_transport = address_pipe
1269 reply_transport = address_reply
1270 require_files = $home
1273 # This delivers to procmail
1275 debug_print = "R: procmail for $local_part@$domain"
1278 domains = +local_domains
1279 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1282 require_files = $local_part:$home/.procmailrc
1283 transport = procmail_pipe
1284 transport_current_directory = $home
1286 # This driver delivers to the LDAP generated alias file.
1288 debug_print = "R: ldap_aliases for $local_part@$domain"
1292 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
1293 {${lookup{$local_part}cdb\
1294 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
1295 domains = +local_domains
1296 file_transport = address_file
1297 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1298 pipe_transport = address_pipe
1299 retry_use_local_part
1301 # This director matches local user mailboxes.
1303 debug_print = "R: localuser for $local_part@$domain"
1306 domains = +local_domains
1307 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1308 # Disable if the user has never logged in
1309 require_files = $home
1310 transport = local_delivery
1313 # Now we begin the Virtual Domain configuration
1314 # Everything before here should apply only to the local domains with a
1317 # exim4 fails the router if it can't change to the user/group for delivery
1318 # during verification. So we have to seperate the cases of verifying
1319 # the virts, and delivering to them. blah.
1322 if nodeinfo['packagesmaster']
1324 # This router delivers for packages.d.o
1326 debug_print = "R: packages for $local_part@$domain"
1328 file_transport = address_file
1329 pipe_transport = address_pipe
1330 domains = packages.debian.org
1331 require_files = /org/packages.debian.org/conf/maintainer
1332 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
1333 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1334 transport_home_directory = /org/packages.debian.org/mail
1335 transport_current_directory = /org/packages.debian.org/mail
1337 retry_use_local_part
1346 if nodeinfo['bugsmaster']
1348 # This router delivers for bugs.d.o
1350 debug_print = "R: bugs for $local_part@$domain"
1352 transport = bugs_pipe
1353 domains = bugs.debian.org
1354 cannot_route_message = Unknown or archived bug
1355 require_files = /org/bugs.debian.org/mail/run-procmail
1357 local_parts = ${if match\
1359 {\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}\
1360 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1361 {$local_part}fail}}fail}
1369 if nodeinfo['rtmaster']
1371 # This router delivers for rt.d.o
1372 rt_force_new_verbose:
1373 debug_print = "R: rt for $local_part+new@$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
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}"
1383 # FIXME: figure out how to generalize this approach so that all of the following would work
1384 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1385 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1386 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1387 # requires modification to custom condition in \'scrips\'
1388 rt_force_new_quiesce:
1389 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1391 domains = rt.debian.org
1392 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1393 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1394 local_part_suffix = +new-quiesce
1395 pipe_transport = rt_pipe
1396 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}}"
1397 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce"
1400 debug_print = "R: rt for $local_part@$domain"
1402 domains = rt.debian.org
1403 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1404 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1405 local_part_suffix = +*
1406 local_part_suffix_optional
1407 pipe_transport = rt_pipe
1408 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}}"
1409 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1416 debug_print = "R: virt_aliases for $local_part@$domain"
1418 data = ${if exists{\
1419 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1420 {${lookup{$local_part}lsearch*{\
1421 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1423 directory_transport = address_directory
1424 cannot_route_message = Unknown user
1425 domains = +virtual_domains
1426 file_transport = address_file
1427 pipe_transport = address_pipe
1428 qualify_preserve_domain
1429 retry_use_local_part
1430 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1431 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1435 debug_print = "R: virt_direct for $local_part@$domain"
1441 directory_transport = address_directory
1442 domains = +virtual_domains
1443 file = $home/.forward-\
1444 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1446 file_transport = address_file
1447 pipe_transport = address_pipe
1448 reply_transport = address_reply
1449 retry_use_local_part
1450 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1451 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1454 # This is a senmailesque alias file lookup
1456 debug_print = "R: virt_aliases for $local_part@$domain"
1460 data = ${if exists{\
1461 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1462 {${lookup{$local_part}lsearch*{\
1463 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1465 directory_transport = address_directory
1466 domains = +virtual_domains
1467 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1468 cannot_route_message = Unknown user
1469 group = ${extract{group}{VDOMAINDATA}}
1470 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1471 pipe_transport = address_pipe
1472 qualify_preserve_domain
1473 retry_use_local_part
1474 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1475 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1477 user = ${extract{user}{VDOMAINDATA}}
1479 # This is a qmailesque deliver into a directory of .forward files
1481 debug_print = "R: virt_direct for $local_part@$domain"
1487 directory_transport = address_directory
1488 domains = +virtual_domains
1489 file = $home/.forward-\
1490 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1492 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1493 group = ${extract{group}{VDOMAINDATA}}
1494 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1496 pipe_transport = address_pipe
1497 reply_transport = address_reply
1498 retry_use_local_part
1499 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1500 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1502 user = ${extract{user}{VDOMAINDATA}}
1503 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1505 ######################################################################
1506 # TRANSPORTS CONFIGURATION #
1507 ######################################################################
1508 # ORDER DOES NOT MATTER #
1509 # Only one appropriate transport is called for each delivery. #
1510 ######################################################################
1515 # This transport is used for local delivery to user mailboxes. On debian
1516 # systems group mail is used so we can write to the /var/mail
1517 # directory. (The alternative, which most other unixes use, is to deliver
1518 # as the user's own group, into a sticky-bitted directory)
1521 file = /var/mail/${local_part}
1524 no_mode_fail_narrower
1527 # This transport is used for handling pipe addresses generated by alias
1528 # or .forward files. It has a conventional name, since it is not actually
1529 # mentioned elsewhere in this configuration file. (A different name *can*
1530 # be specified via the "address_pipe_transport" option if you really want
1531 # to.) If the pipe generates any standard output, it is returned to the sender
1532 # of the message as a delivery error. Set return_fail_output instead if you
1533 # want this to happen only when the pipe fails to complete normally.
1537 current_directory = ${home}
1538 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1539 EXT=${substr_1:${local_part_suffix}}:\
1540 LOCAL=${local_part}${local_part_suffix}:\
1541 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1545 # This transport is used for handling file addresses generated by alias
1546 # or .forward files. It has a conventional name, since it is not actually
1547 # mentioned elsewhere in this configuration file.
1557 directory_mode = 0770
1558 mode_fail_narrower = false
1560 # This transport is used for handling file addresses generated by alias
1561 # or .forward files if the path ends in "/", which causes it to be treated
1562 # as a directory name rather than a file name. Each message is then delivered
1563 # to a unique file in the directory. If instead you want all such deliveries to
1564 # be in the "maildir" format that is used by some other mail software,
1565 # uncomment the final option below. If this is done, the directory specified
1566 # in the .forward or alias file is the base maildir directory.
1568 # Should you want to be able to specify either maildir or non-maildir
1569 # directory-style deliveries, then you must set up yet another transport,
1570 # called address_directory2. This is used if the path ends in "//" so should
1571 # be the one used for maildir, as the double slash suggests another level
1572 # of directory. In the absence of address_directory2, paths ending in //
1573 # are passed to address_directory.
1583 # This transport is used for handling autoreplies generated by the filtering
1584 # option of the forwardfile director. It has a conventional name, since it
1585 # is not actually mentioned elsewhere in this configuration file.
1589 # This transport is used for delivering messages over SMTP connections.
1593 connect_timeout = 1m
1594 delay_after_cutoff = false
1597 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1598 out = " tls_certificate = /etc/exim4/ssl/thishost.crt
1599 tls_privatekey = /etc/exim4/ssl/thishost.key"
1606 if not nodeinfo['smarthost'].empty?
1608 remote_smtp_smarthost:
1609 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1611 delay_after_cutoff = false
1613 out += nodeinfo['smarthost_port'].to_s + "\n"
1614 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1615 out += ' tls_tempfail_tryclear = false
1616 hosts_require_tls = ' + nodeinfo['smarthost'] + '
1617 tls_certificate = /etc/exim4/ssl/thishost.crt
1618 tls_privatekey = /etc/exim4/ssl/thishost.key
1625 # Send the message to procmail
1628 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1630 user = ${local_part}
1639 user = ${extract{user}{\
1640 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1646 if nodeinfo['bugsmaster']
1650 command = /org/bugs.debian.org/mail/run-procmail
1651 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1652 EXT=${substr_1:${local_part_suffix}}:\
1653 LOCAL=${local_part}${local_part_suffix}:\
1654 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1665 if nodeinfo['rtmaster']
1668 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1671 environment = EXTENSION=${substr_1:${local_part_suffix}}
1672 allow_commands = /usr/bin/rt-mailgate
1678 ######################################################################
1679 # RETRY CONFIGURATION #
1680 ######################################################################
1682 # This single retry rule applies to all domains and all errors. It specifies
1683 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1684 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1685 # hours, then retries every 8 hours until 4 days have passed since the first
1688 # Domain Error Retries
1689 # ------ ----- -------
1694 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1695 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1696 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1698 # End of Exim 4 configuration