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"
419 if nodeinfo['smarthost'].empty?
421 # These are in HELO acl so that they are only run once. They increment a counter,
422 # so we don't want it to increment per rcpt to.
424 warn dnslists = list.dnswl.org&0.0.0.3
425 log_message = Hit on list.dnswl.org for $sender_host_address
426 set acl_c_scr = ${eval:$acl_c_scr-30}
428 warn dnslists = list.dnswl.org&0.0.0.2
429 log_message = Hit on list.dnswl.org for $sender_host_address
430 set acl_c_scr = ${eval:$acl_c_scr-20}
432 warn dnslists = list.dnswl.org
433 log_message = Hit on list.dnswl.org for $sender_host_address
434 set acl_c_scr = ${eval:$acl_c_scr-10}
436 warn condition = ${if isip {$sender_helo_name}{true}{false}}
437 log_message = remote host used IP address in HELO/EHLO greeting
438 set acl_c_scr = ${eval:$acl_c_scr+20}
440 warn !hosts = +debianhosts
441 condition = ${if eq{$host_lookup_failed}{1}}
442 set acl_c_scr = ${eval:$acl_c_scr+20}
444 warn !hosts = +debianhosts
445 condition = ${if eq{$host_lookup_failed}{0}}
446 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}}
447 set acl_c_scr = ${eval:$acl_c_scr+20}
449 warn !hosts = +debianhosts
450 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}}
451 set acl_c_scr = ${eval:$acl_c_scr+20}
453 warn !hosts = +debianhosts
454 dnslists = dul.dnsbl.sorbs.net
455 set acl_c_scr = ${eval:$acl_c_scr+15}
457 # If the sender's helo name is empty, the message will be rejected later
458 # because the helo is empty. If the rDNS lookup failed, we are already
459 # going to greylist them, so no sense worrying about it here. Finally,
460 # if rDNS does not match helo name (both lower cased first), greylist.
462 warn !hosts = +debianhosts
463 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
464 condition = ${if def:sender_helo_name {yes}{no}}
465 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
466 log_message = HELO doesn't match rDNS
467 set acl_c_scr = ${eval:$acl_c_scr+8}
470 # matches 098325879 - looks fishy
472 warn condition = ${if and { \
473 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
474 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
477 log_message = non-FQDN HELO
478 set acl_c_scr = ${eval:$acl_c_scr+12}
480 # Matches DOMAIN99.com - looks bad
482 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
483 log_message = SHOUTING HELO
484 set acl_c_scr = ${eval:$acl_c_scr+7}
486 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
487 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
488 # naive test, so it's not worth much
490 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
491 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
492 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
493 log_message = random HELO
494 set acl_c_scr = ${eval:$acl_c_scr+5}
499 # Implicit, but simpler to just say it
502 #!!# ACL that is used after the RCPT command on the submission port
505 # Accept if the source is local SMTP (i.e. not over TCP/IP).
506 # We do this by testing for an empty sending host field.
507 accept hosts = : 127.0.0.1
511 if nodeinfo['mailrelay']
512 out = " accept verify = certificate"
517 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
518 # This is a rough pass at preventing addres harvesting or other mail blasts.
520 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
521 message = Too many bad recipients, try again later
522 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
525 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
526 !hosts = +debianhosts
527 message = sorry, only 5 reports per hour for submission
529 accept domains = +local_domains
532 message = unknown user
537 if nodeinfo['mailrelay']
539 accept domains = +mailhubdomains
541 message = unknown user
542 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
548 accept domains = +submission_domains
550 message = unknown user
553 deny message = relay not permitted
555 #!!# ACL that is used after the RCPT command
560 if nodeinfo['mailrelay']
561 out = " accept verify = certificate"
566 warn acl = acl_getprofile
567 condition = ${if eq{$acl_m_prf}{}}
568 set acl_m_prf = $acl_m_rprf
570 defer condition = ${if eq{$acl_m_prf}{$acl_m_rprf}{no}{yes}}
571 log_message = Only one profile at a time, please
573 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
574 # This is a rough pass at preventing addres harvesting or other mail blasts.
576 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
577 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
578 message = Too many bad recipients, try again later
579 !hosts = +debianhosts
580 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
582 # Dump spambots that are so stupid they say helo as our IP address
584 drop !hosts = +debianhosts
585 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
586 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
587 message = HELO mismatch Forged HELO for ($sender_helo_name)
589 # Also for spambots that say helo as us or one of our domains
591 drop !hosts = +debianhosts
592 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
593 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
594 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
595 message = HELO mismatch Forged HELO for ($sender_helo_name)
597 # This logic gives you a list of commonly forged domains in helo to reject against
599 warn set acl_m_frg = ${lookup{$sender_helo_name} \
600 nwildlsearch{/etc/exim4/helo-check} \
601 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
603 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
604 # say helo as a name in the list but we can't look them up
606 defer !hosts = +debianhosts
607 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
608 condition = ${if eq{$acl_m_frg}{}{no}{yes}}
609 condition = ${if eq{$sender_host_name}{}{yes}{no}}
610 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
611 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
613 # If DNS works, go ahead and reject them
615 drop !hosts = +debianhosts
616 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
617 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}{yes}{no}}
618 message = HELO mismatch Forged HELO for ($sender_helo_name)
620 # disabled accounts don't even get local mail.
621 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
622 domains = +local_domains
623 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
625 deny domains = +virtual_domains
626 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
627 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
629 hosts = !+debianhosts
630 message = mail for <$local_part@$domain> only accepted from debian.org machines
631 # Accept if the source is local SMTP (i.e. not over TCP/IP).
632 # We do this by testing for an empty sending host field.
635 deny domains = +handled_domains
636 local_parts = ^[.] : ^.*[@%!/|]
638 deny domains = !+handled_domains
639 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
641 # forwards mail to @d.o address, even if it's a bounce from master, no reply
642 # from source address; rejecting all mail now.
643 deny recipients = mendoza@debian.org
644 hosts = 65.110.39.147 : 64.39.31.15
645 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
647 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
648 sender_domains= +local_domains : debian.org : debian.net : debian.com
649 hosts = !+debianhosts
650 message = mail from <$sender_address> not allowed externally
652 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
653 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
654 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
655 message = no mail should ever come from <$sender_address>
657 warn condition = ${if eq{$acl_m_prf}{localonly}}
658 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
664 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
665 hosts = !+debianhosts
666 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
673 if nodeinfo['packagesmaster']
675 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
676 condition = ${if eq {$sender_address}{$local_part@$domain}}
677 message = X-Packages-FromTo-Same: yes
682 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
685 defer !hosts = +debianhosts
686 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
687 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
688 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
689 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
692 if has_variable?("policydweight") && policydweight == "true"
694 # Check with policyd-weight - this only works with a version after etch\'s,
695 # sadly. etch\'s version attempts to hold the socket open, since that\'s what
696 # postfix expects. Exim, on the other hand, expects the remote side to close
697 # the socket when it\'s finished sending data, so it see each transaction as
698 # an incomplete read. I\'m sure there\'s a way we could force exim to do
699 # something sick and clever to force either the interpretation or the socket
700 # closure, but I\'m fairly sure it\'s now worth it, since the backport of
701 # policyd-weight is trivial.
702 warn !hosts = +debianhosts
703 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
704 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
705 {request=smtpd_access_policy\n\
706 protocol_state=RCPT\n\
707 protocol_name=${uc:$received_protocol}\n\
708 helo_name=$sender_helo_name\n\
709 queue_id=$message_exim_id\n\
710 sender=$sender_address\n\
711 recipient=$local_part@$domain\n\
712 recipient_count=$rcpt_count\n\
713 client_address=$sender_host_address\n\
714 client_name=$sender_host_name\n\
715 reverse_client_name=$sender_host_name\n\
716 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
717 {20s}{\n}{socket failure}}
719 # Defer on socket error
720 defer !hosts = +debianhosts
721 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
722 condition = ${if eq{$acl_m_pw}{socket failure}{yes}{no}}
723 message = Cannot connect to policyd-weight. Please try again later.
725 # Set proposed action to $acl_m_act and message to $acl_m_mes
726 warn !hosts = +debianhosts
727 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
728 set acl_m_mes = ${extract{action}{$acl_m_pw}}
729 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
731 # Add X-policyd-weight header line to message
732 warn !hosts = +debianhosts
733 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
735 condition = ${if eq{$acl_m_act}{PREPEND}{yes}{no}}
737 # Write log message, if policyd-weight can\'t run checks
738 warn !hosts = +debianhosts
739 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
740 log_message = policyd-weight message: $acl_m_mes
741 condition = ${if eq{$acl_m_act}{DUNNO}{yes}{no}}
743 # Deny mails which policyd-weight thinks are spam
744 deny !hosts = +debianhosts
745 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
746 message = policyd-weight said: $acl_m_mes
747 condition = ${if eq{$acl_m_act}{550}{yes}{no}}
749 # Defer messages when policyd-weight suggests so.
750 defer !hosts = +debianhosts
751 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
752 message = policyd-weight said: $acl_m_mes
753 condition = ${if eq{$acl_m_act}{450}{yes}{no}}
760 if nodeinfo['rtmaster']
762 warn condition = ${if eq{$acl_m_prf}{RTMail}}
763 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
770 if has_variable?("greylistd") && greylistd == "true"
773 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
774 log_message = greylisted.
775 local_parts = ${if match_domain{$domain}{+virtual_domains}\
776 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
777 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
778 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
779 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
781 !hosts = : +debianhosts : WHITELIST : \
782 ${if exists {/etc/greylistd/whitelist-hosts}\
783 {/etc/greylistd/whitelist-hosts}{}} : \
784 ${if exists {/var/lib/greylistd/whitelist-hosts}\
785 {/var/lib/greylistd/whitelist-hosts}{}}
786 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
788 domains = +handled_domains : +rcpthosts
789 condition = ${readsocket{/var/run/greylistd/socket}\
791 $sender_host_address \
793 $local_part@$domain}\
796 elsif has_variable?("postgrey") && postgrey == "true"
798 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
799 # this adds acl_m_grey if there isn\'t one (so unique per message)
802 !hosts = : +debianhosts : WHITELIST
803 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
804 condition = ${if def:acl_m_grey {no}{yes}}
805 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
807 # and defers the message if postgrey thinks it should be defered ...
810 !hosts = : +debianhosts : WHITELIST
811 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
813 domains = +handled_domains : +rcpthosts
814 local_parts = GREYLIST_LOCAL_PARTS
815 set acl_m_pgr = request=smtpd_access_policy\n\
816 protocol_state=RCPT\n\
817 protocol_name=${uc:$received_protocol}\n\
818 instance=${acl_m_grey}\n\
819 helo_name=${sender_helo_name}\n\
820 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
821 client_name=${sender_host_name}\n\
822 sender=${sender_address}\n\
823 recipient=$local_part@$domain\n\n
824 set acl_m_pgr = ${sg{\
825 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
826 {5s}{}{action=DUNNO}}\
828 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
829 log_message = greylisted.
830 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
832 # ... or adds a header with information about how long the delay was
835 !hosts = : +debianhosts : WHITELIST
836 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
838 domains = +handled_domains : +rcpthosts
839 local_parts = GREYLIST_LOCAL_PARTS
840 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
841 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
847 accept local_parts = +postmasterish
848 domains = +handled_domains : +rcpthosts
850 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
851 message = I'm terribly sorry, but it seems you have been blacklisted
852 log_message = blacklisted IP
854 deny log_message = <$sender_address> is blacklisted
855 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
856 message = We have blacklisted <$sender_address>. Please stop mailing us
858 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
859 dnslists = ${if match_domain{$domain}{+virtual_domains}\
860 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
861 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
862 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
863 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
864 domains = +handled_domains : +rcpthosts
865 !hosts = +debianhosts : WHITELIST
867 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
868 dnslists = ${if match_domain{$domain}{+virtual_domains}\
869 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
870 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
871 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
872 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
873 domains = +handled_domains : +rcpthosts
874 !hosts = +debianhosts : WHITELIST
876 deny domains = +handled_domains : +rcpthosts
877 local_parts = ${if match_domain{$domain}{+virtual_domains}\
878 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
879 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
880 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
881 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
882 !hosts = +debianhosts : WHITELIST
883 !verify = sender/callout
887 if nodeinfo['mailrelay']
889 accept domains = +mailhubdomains
891 message = unknown user
892 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
897 accept domains = +handled_domains
899 message = unknown user
900 verify = recipient/defer_ok
902 accept domains = +rcpthosts
904 message = unrouteable address
907 accept hosts = +debianhosts
909 accept authenticated = *
911 deny message = relay not permitted
915 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
919 discard condition = ${if <{$message_size}{256000}}
920 condition = ${if eq {$acl_m_prf}{blackhole}}
921 set acl_m_srb = ${perl{surblspamcheck}}
922 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
923 log_message = discarded surbl message for $recipients
925 deny condition = ${if <{$message_size}{256000}}
926 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
927 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
928 set acl_m_srb = ${perl{surblspamcheck}}
929 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
930 log_message = $acl_m_srb
933 warn condition = ${if <{$message_size}{256000}}
934 condition = ${if eq {$acl_m_prf}{markup}}
935 set acl_m_srb = ${perl{surblspamcheck}}
936 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
937 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
946 deny condition = ${if eq{$acl_m_prf}{localonly}}
947 message = mail for $acl_m_lrc is only accepted internally
952 #!!# ACL that is used after the DATA command
956 if nodeinfo['rtmaster']
958 deny condition = ${if eq {$acl_m_prf}{RTMail}}
959 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
960 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
961 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
962 message = messages to the Request Tracker system require a subject tag or a subaddress
969 if nodeinfo['packagesqamaster']
971 deny !hosts = +debianhosts : 217.196.43.134
972 condition = ${if eq {$acl_m_prf}{PTSMail}}
973 condition = ${if def:h_X-PTS-Approved:{false}{true}}
974 message = messages to the PTS require an X-PTS-Approved header
979 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
980 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
981 {!match {$message_body}{PGP SIGNED MESSAGE}} \
982 {!match {$message_body}{PGP SIGNATURE}} \
983 {!match {$header_content-type:}{multipart/signed}} \
984 {!match {$header_content-type:}{pgp}} \
987 message = Mail to this address needs to be PGP-signed
989 accept verify = certificate
991 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
992 !verify = header_syntax
993 message = Invalid syntax in the header
995 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
996 # postfix's strict_7bit_headers option, but only checks a few common problem
997 # headers, as there doesn't appear to be an easy way to check them all.
999 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
1000 {match {$rh_To:}{[\200-\377]}}\
1001 {match {$rh_From:}{[\200-\377]}}\
1002 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
1003 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1004 message = improper use of 8-bit data in message header: message rejected
1007 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
1008 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1009 message = Your mailer is not RFC 2047 compliant: message rejected
1013 if has_variable?("clamd") && clamd == "true"
1015 discard condition = ${if eq {$acl_m_prf}{blackhole}}
1017 malware = */defer_ok
1018 log_message = discarded malware message for $recipients
1020 deny condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1021 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1023 malware = */defer_ok
1024 message = malware detected: $malware_name: message rejected
1026 warn condition = ${if eq {$acl_m_prf}{markup}}
1028 malware = */defer_ok
1029 message = X-malware detected: $malware_name
1036 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
1038 discard condition = ${if <{$message_size}{256000}}
1039 condition = ${if eq {$acl_m_prf}{blackhole}}
1040 set acl_m_srb = ${perl{surblspamcheck}}
1041 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1042 log_message = discarded surbl message for $recipients
1044 deny condition = ${if <{$message_size}{256000}}
1045 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1046 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1047 set acl_m_srb = ${perl{surblspamcheck}}
1048 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1049 log_message = $acl_m_srb
1050 message = $acl_m_srb
1052 warn condition = ${if <{$message_size}{256000}}
1053 condition = ${if eq {$acl_m_prf}{markup}}
1054 set acl_m_srb = ${perl{surblspamcheck}}
1055 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1056 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1062 # Check header_sender except for survey@popcon.d.o
1063 deny condition = ${if eq{$acl_m_prf}{PopconMail}{false}{true}}
1064 !verify = header_sender
1065 message = No valid sender found in the From:, Sender: and Reply-to: headers
1069 if nodeinfo['packagesmaster']
1071 deny message = Congratulations, you scored $spam_score points.
1072 log_message = spam: $spam_score points.
1073 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1075 !verify = certificate
1076 !hosts = +debianhosts
1077 condition = ${if <{$message_size}{256000}}
1078 spam = pkg_user : true
1079 condition = ${if >{$spam_score_int}{59}}
1088 ######################################################################
1089 # REWRITE CONFIGURATION #
1090 ######################################################################
1096 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
1097 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
1098 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1099 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1100 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1101 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
1104 #!!#######################################################!!#
1105 #!!# Here follow routers created from the old routers, #!!#
1106 #!!# for handling non-local domains. #!!#
1107 #!!#######################################################!!#
1113 ######################################################################
1114 # ROUTERS CONFIGURATION #
1115 # Specifies how addresses are handled #
1116 ######################################################################
1117 # ORDER DOES MATTER #
1118 # An address is passed to each in turn until it is accepted. #
1119 ######################################################################
1123 if nodeinfo['mailrelay']
1126 driver = manualroute
1127 domains = +mailhubdomains
1128 transport = remote_smtp
1129 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1130 require_files = /etc/exim4/manualroute
1137 debug_print = "R: bsmtp for $local_part@$domain"
1138 driver = manualroute
1139 domains = +bsmtp_domains
1140 require_files = /etc/exim4/bsmtp
1141 route_list = * ${extract{file}{\
1142 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1146 # This router routes to remote hosts over SMTP by explicit IP address,
1147 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1148 # require this facility, which is why it is enabled by default in Exim.
1150 debug_print = "R: ipliteral for $local_part@$domain"
1152 domains = !+handled_domains
1153 transport = remote_smtp
1154 ignore_target_hosts = +reservedaddrs
1158 if not nodeinfo['smarthost'].empty?
1161 debug_print = "R: smarthost for $local_part@$domain"
1162 driver = manualroute
1163 domains = !+handled_domains
1164 transport = remote_smtp_smarthost
1165 route_list = * ' + nodeinfo['smarthost']
1166 if nodeinfo['smarthost'] == 'mailout.debian.org'
1170 host_find_failed = defer
1171 same_domain_copy_routing = yes
1178 # This router routes to remote hosts over SMTP using a DNS lookup.
1179 # Ignore reserved network responses, including localhost.
1181 debug_print = "R: dnslookup for $local_part@$domain"
1183 domains = !+handled_domains
1184 transport = remote_smtp
1185 ignore_target_hosts = +reservedaddrs
1189 debug_print = "R: postmasterish for $local_part@$domain"
1194 local_parts = +postmasterish
1195 domains = +handled_domains
1196 data = debian-admin@debian.org
1197 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1199 # This router handles aliasing using a traditional /etc/aliases file.
1200 # If any of your aliases expand to pipes or files, you will need to set
1201 # up a user and a group for these deliveries to run under. You can do
1202 # this by uncommenting the "user" option below (changing the user name
1203 # as appropriate) and adding a "group" option if necessary.
1206 debug_print = "R: system_aliases for $local_part@$domain"
1210 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1211 domains = +local_domains
1212 file_transport = address_file
1213 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1214 pipe_transport = address_pipe
1215 retry_use_local_part
1217 # This router handles forwarding using traditional .forward files.
1218 # It also allows mail filtering when a forward file starts with the
1219 # string "# Exim filter": to disable filtering, uncomment the "filter"
1220 # option. The check_ancestor option means that if the forward file
1221 # generates an address that is an ancestor of the current one, the
1222 # current one gets passed on instead. This covers the case where A is
1223 # aliased to B and B has a .forward file pointing to A.
1225 # For standard debian setup of one group per user, it is acceptable---normal
1226 # even---for .forward to be group writable. If you have everyone in one
1227 # group, you should comment out the "modemask" line. Without it, the exim
1228 # default of 022 will apply, which is probably what you want.
1231 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1236 directory_transport = address_directory
1237 domains = +local_domains
1238 # filter - I have disabled filtering to force users to use .forward-foo files
1239 # or procmail. This will make it easier to move mailers in the future
1241 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1242 # also checks if the .forward-bar exists, if not then it uses
1243 # .forward-default instead.
1244 file = $home/.forward\
1245 ${if eq{}{$local_part_suffix}{}{\
1246 ${if exists {${home}/.forward${local_part_suffix}} \
1247 {${local_part_suffix}}{-default}}\
1250 file_transport = address_file
1251 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1252 local_part_suffix = -*
1253 local_part_suffix_optional
1255 pipe_transport = address_pipe
1256 reply_transport = address_reply
1257 require_files = $home
1258 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1262 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1266 directory_transport = address_directory
1267 domains = +local_domains
1268 # filter - I have disabled filtering to force users to use .forward-foo files
1269 # or procmail. This will make it easier to move mailers in the future
1271 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1272 # also checks if the .forward-bar exists, if not then it uses
1273 # .forward-default instead.
1274 file = $home/.forward\
1275 ${if eq{}{$local_part_suffix}{}{\
1276 ${if exists {${home}/.forward${local_part_suffix}} \
1277 {${local_part_suffix}}{-default}}\
1280 file_transport = address_file
1281 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1282 local_part_suffix = -*
1283 local_part_suffix_optional
1285 pipe_transport = address_pipe
1286 reply_transport = address_reply
1287 require_files = $home
1290 # This delivers to procmail
1292 debug_print = "R: procmail for $local_part@$domain"
1295 domains = +local_domains
1296 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1299 require_files = $local_part:$home/.procmailrc
1300 transport = procmail_pipe
1301 transport_current_directory = $home
1303 # This driver delivers to the LDAP generated alias file.
1305 debug_print = "R: ldap_aliases for $local_part@$domain"
1309 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
1310 {${lookup{$local_part}cdb\
1311 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
1312 domains = +local_domains
1313 file_transport = address_file
1314 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1315 pipe_transport = address_pipe
1316 retry_use_local_part
1318 # This director matches local user mailboxes.
1320 debug_print = "R: localuser for $local_part@$domain"
1323 domains = +local_domains
1324 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1325 # Disable if the user has never logged in
1326 require_files = $home
1327 transport = local_delivery
1330 # Now we begin the Virtual Domain configuration
1331 # Everything before here should apply only to the local domains with a
1334 # exim4 fails the router if it can't change to the user/group for delivery
1335 # during verification. So we have to seperate the cases of verifying
1336 # the virts, and delivering to them. blah.
1339 if nodeinfo['packagesmaster']
1341 # This router delivers for packages.d.o
1343 debug_print = "R: packages for $local_part@$domain"
1345 file_transport = address_file
1346 pipe_transport = address_pipe
1347 domains = packages.debian.org
1348 require_files = /org/packages.debian.org/conf/maintainer
1349 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
1350 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1351 transport_home_directory = /org/packages.debian.org/mail
1352 transport_current_directory = /org/packages.debian.org/mail
1354 retry_use_local_part
1363 if nodeinfo['bugsmaster']
1365 # This router delivers for bugs.d.o
1367 debug_print = "R: bugs for $local_part@$domain"
1369 transport = bugs_pipe
1370 domains = bugs.debian.org
1371 cannot_route_message = Unknown or archived bug
1372 require_files = /org/bugs.debian.org/mail/run-procmail
1374 local_parts = ${if match\
1376 {\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}\
1377 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1378 {$local_part}fail}}fail}
1386 if nodeinfo['rtmaster']
1388 # This router delivers for rt.d.o
1389 rt_force_new_verbose:
1390 debug_print = "R: rt for $local_part+new@$domain"
1392 domains = rt.debian.org
1393 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1394 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1395 local_part_suffix = +new
1396 pipe_transport = rt_pipe
1397 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}}"
1398 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1400 # FIXME: figure out how to generalize this approach so that all of the following would work
1401 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1402 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1403 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1404 # requires modification to custom condition in \'scrips\'
1405 rt_force_new_quiesce:
1406 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1408 domains = rt.debian.org
1409 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1410 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1411 local_part_suffix = +new-quiesce
1412 pipe_transport = rt_pipe
1413 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}}"
1414 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce"
1417 debug_print = "R: rt for $local_part@$domain"
1419 domains = rt.debian.org
1420 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1421 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1422 local_part_suffix = +*
1423 local_part_suffix_optional
1424 pipe_transport = rt_pipe
1425 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}}"
1426 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1433 debug_print = "R: virt_aliases for $local_part@$domain"
1435 data = ${if exists{\
1436 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1437 {${lookup{$local_part}lsearch*{\
1438 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1440 directory_transport = address_directory
1441 cannot_route_message = Unknown user
1442 domains = +virtual_domains
1443 file_transport = address_file
1444 pipe_transport = address_pipe
1445 qualify_preserve_domain
1446 retry_use_local_part
1447 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1448 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1452 debug_print = "R: virt_direct for $local_part@$domain"
1458 directory_transport = address_directory
1459 domains = +virtual_domains
1460 file = $home/.forward-\
1461 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1463 file_transport = address_file
1464 pipe_transport = address_pipe
1465 reply_transport = address_reply
1466 retry_use_local_part
1467 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1468 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1471 # This is a senmailesque alias file lookup
1473 debug_print = "R: virt_aliases for $local_part@$domain"
1477 data = ${if exists{\
1478 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1479 {${lookup{$local_part}lsearch*{\
1480 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1482 directory_transport = address_directory
1483 domains = +virtual_domains
1484 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1485 cannot_route_message = Unknown user
1486 group = ${extract{group}{VDOMAINDATA}}
1487 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1488 pipe_transport = address_pipe
1489 qualify_preserve_domain
1490 retry_use_local_part
1491 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1492 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1494 user = ${extract{user}{VDOMAINDATA}}
1496 # This is a qmailesque deliver into a directory of .forward files
1498 debug_print = "R: virt_direct for $local_part@$domain"
1504 directory_transport = address_directory
1505 domains = +virtual_domains
1506 file = $home/.forward-\
1507 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1509 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1510 group = ${extract{group}{VDOMAINDATA}}
1511 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1513 pipe_transport = address_pipe
1514 reply_transport = address_reply
1515 retry_use_local_part
1516 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1517 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1519 user = ${extract{user}{VDOMAINDATA}}
1520 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1522 ######################################################################
1523 # TRANSPORTS CONFIGURATION #
1524 ######################################################################
1525 # ORDER DOES NOT MATTER #
1526 # Only one appropriate transport is called for each delivery. #
1527 ######################################################################
1532 # This transport is used for local delivery to user mailboxes. On debian
1533 # systems group mail is used so we can write to the /var/mail
1534 # directory. (The alternative, which most other unixes use, is to deliver
1535 # as the user's own group, into a sticky-bitted directory)
1538 file = /var/mail/${local_part}
1541 no_mode_fail_narrower
1544 # This transport is used for handling pipe addresses generated by alias
1545 # or .forward files. It has a conventional name, since it is not actually
1546 # mentioned elsewhere in this configuration file. (A different name *can*
1547 # be specified via the "address_pipe_transport" option if you really want
1548 # to.) If the pipe generates any standard output, it is returned to the sender
1549 # of the message as a delivery error. Set return_fail_output instead if you
1550 # want this to happen only when the pipe fails to complete normally.
1554 current_directory = ${home}
1555 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1556 EXT=${substr_1:${local_part_suffix}}:\
1557 LOCAL=${local_part}${local_part_suffix}:\
1558 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1562 # This transport is used for handling file addresses generated by alias
1563 # or .forward files. It has a conventional name, since it is not actually
1564 # mentioned elsewhere in this configuration file.
1574 directory_mode = 0770
1575 mode_fail_narrower = false
1577 # This transport is used for handling file addresses generated by alias
1578 # or .forward files if the path ends in "/", which causes it to be treated
1579 # as a directory name rather than a file name. Each message is then delivered
1580 # to a unique file in the directory. If instead you want all such deliveries to
1581 # be in the "maildir" format that is used by some other mail software,
1582 # uncomment the final option below. If this is done, the directory specified
1583 # in the .forward or alias file is the base maildir directory.
1585 # Should you want to be able to specify either maildir or non-maildir
1586 # directory-style deliveries, then you must set up yet another transport,
1587 # called address_directory2. This is used if the path ends in "//" so should
1588 # be the one used for maildir, as the double slash suggests another level
1589 # of directory. In the absence of address_directory2, paths ending in //
1590 # are passed to address_directory.
1600 # This transport is used for handling autoreplies generated by the filtering
1601 # option of the forwardfile director. It has a conventional name, since it
1602 # is not actually mentioned elsewhere in this configuration file.
1606 # This transport is used for delivering messages over SMTP connections.
1610 connect_timeout = 1m
1611 delay_after_cutoff = false
1614 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1615 out = " tls_certificate = /etc/exim4/ssl/thishost.crt
1616 tls_privatekey = /etc/exim4/ssl/thishost.key"
1623 if not nodeinfo['smarthost'].empty?
1625 remote_smtp_smarthost:
1626 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1628 delay_after_cutoff = false
1630 out += nodeinfo['smarthost_port'].to_s + "\n"
1631 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1632 out += ' tls_tempfail_tryclear = false
1633 hosts_require_tls = ' + nodeinfo['smarthost'] + '
1634 tls_certificate = /etc/exim4/ssl/thishost.crt
1635 tls_privatekey = /etc/exim4/ssl/thishost.key
1642 # Send the message to procmail
1645 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1647 user = ${local_part}
1656 user = ${extract{user}{\
1657 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1663 if nodeinfo['bugsmaster']
1667 command = /org/bugs.debian.org/mail/run-procmail
1668 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1669 EXT=${substr_1:${local_part_suffix}}:\
1670 LOCAL=${local_part}${local_part_suffix}:\
1671 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1682 if nodeinfo['rtmaster']
1685 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1688 environment = EXTENSION=${substr_1:${local_part_suffix}}
1689 allow_commands = /usr/bin/rt-mailgate
1695 ######################################################################
1696 # RETRY CONFIGURATION #
1697 ######################################################################
1699 # This single retry rule applies to all domains and all errors. It specifies
1700 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1701 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1702 # hours, then retries every 8 hours until 4 days have passed since the first
1705 # Domain Error Retries
1706 # ------ ----- -------
1711 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1712 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1713 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1715 # End of Exim 4 configuration