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 domainlist local_domains = @ : \
127 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
129 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
131 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
133 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
135 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
137 localpartlist local_only_users = lsearch;/etc/exim4/localusers
139 localpartlist postmasterish = postmaster : abuse : hostmaster : root
141 # Domains we relay for; that is domains that aren't considered local but we
142 # accept mail for them.
143 domainlist rcpthosts = partial-lsearch;/etc/exim4/rcpthosts
144 hostlist debianhosts = 127.0.0.1 : net-lsearch;/var/lib/misc/thishost/debianhosts
147 if nodeinfo['mailrelay']
149 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
155 hostlist reservedaddrs = <%= nodeinfo['reservedaddrs'] %>
158 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
159 out = "tls_certificate = /etc/exim4/ssl/thishost.crt
160 tls_privatekey = /etc/exim4/ssl/thishost.key
161 tls_try_verify_hosts = *
162 tls_verify_certificates = /etc/exim4/ssl/ca.crt
163 tls_crl = /etc/exim4/ssl/ca.crl"
168 # The setting below causes Exim to do a reverse DNS lookup on all incoming
169 # IP calls, in order to get the true host name. If you feel this is too
170 # expensive, you can specify the networks for which a lookup is done, or
171 # remove the setting entirely.
173 dns_ipv4_lookup = !localhost
175 # If this option is set, then any process that is running as one of the
176 # listed users may pass a message to Exim and specify the sender's
177 # address using the "-f" command line option, without Exim's adding a
180 untrusted_set_sender = *
182 # Some operating systems use the "gecos" field in the system password file
183 # to hold other information in addition to users' real names. Exim looks up
184 # this field when it is creating "sender" and "from" headers. If these options
185 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
186 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
189 gecos_pattern = ^([^,:]*)
192 # This tells exim to immediately discard error messages (ie double bounces).
193 ignore_bounce_errors_after = 0s
195 timeout_frozen_after=14d
197 message_size_limit = 100M
199 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
200 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
201 smtp_accept_max = 300
202 smtp_accept_queue = 200
203 smtp_accept_queue_per_connection = 50
204 smtp_accept_reserve = 25
207 smtp_accept_queue = 20
208 smtp_accept_queue_per_connection = 10
209 smtp_accept_reserve = 5
211 smtp_reserve_hosts = +debianhosts
213 split_spool_directory = true
214 check_spool_inodes = 200
215 check_spool_space = 20M
219 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
221 deliver_queue_load_max = 50
225 deliver_queue_load_max = 10
228 queue_list_requires_admin = false
231 if has_variable?("clamd") && clamd == "true"
232 out = "av_scanner = clamd:/var/run/clamav/clamd.ctl"
239 out = "daemon_smtp_ports = "
242 if nodeinfo['bugsmaster']
246 if not nodeinfo['mail_port'].to_s.empty?
247 ports << nodeinfo['mail_port']
250 if nodeinfo['mailrelay']
251 ports << nodeinfo['smarthost_port']
254 out += ports.uniq.sort.join(" : ")
259 remote_sort_domains = *.debian.org:*.debian.net
261 pipelining_advertise_hosts = !*
263 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
264 out = 'tls_advertise_hosts = *'
268 smtp_enforce_sync = true
270 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
272 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
273 {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
274 ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
275 by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
276 (Exim $version_number)\n\t\
277 ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
278 id $message_exim_id${if def:received_for {\n\tfor $received_for}}
282 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
283 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
284 ${if exists {/srv/$domain/mail/whitelist}{\
285 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
287 }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
288 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
289 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
290 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
291 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
292 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
293 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
295 ######################################################################
296 # ACL CONFIGURATION #
297 ######################################################################
301 # This is a bad hack to reset the variable, by defining it be something
304 warn set acl_m_rprf = $acl_m_undefined
306 warn recipients = survey@popcon.debian.org
307 set acl_m_rprf = PopconMail
309 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
311 warn local_parts = +local_only_users
312 domains = +local_domains
313 hosts = !+debianhosts
314 set acl_m_rprf = localonly
316 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
320 if nodeinfo['rtmaster']
322 warn domains = rt.debian.org
323 set acl_m_rprf = RTMail
325 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
332 if nodeinfo['packagesmaster']
334 warn domains = packages.debian.org
335 set acl_m_rprf = PackagesMail
337 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
344 if nodeinfo['packagesqamaster']
346 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
347 set acl_m_rprf = PTSOwner
349 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
352 domains = packages.qa.debian.org
353 condition = ${if match{$local_part}{\N^bounces+\N}}
354 set acl_m_rprf = PTSListBounce
356 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
358 warn domains = packages.qa.debian.org
359 set acl_m_rprf = PTSMail
361 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
366 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
367 set acl_m_rprf = DBSignedMail
369 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
371 warn domains = +virtual_domains
372 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
373 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
374 log_message = $local_part@$domain: markup
375 set acl_m_rprf = markup
377 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
379 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
380 log_message = $local_part@$domain: markup
381 set acl_m_rprf = markup
383 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
385 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
386 log_message = $local_part@$domain: blackhole
387 set acl_m_rprf = blackhole
389 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
391 warn domains = +virtual_domains
392 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
393 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
394 log_message = $local_part@$domain: blackhole
395 set acl_m_rprf = blackhole
397 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
399 warn set acl_m_rprf = normal
405 warn set acl_c_scr = 0
409 if nodeinfo['mailrelay']
410 out = " accept verify = certificate"
416 if nodeinfo['smarthost'].empty?
418 # These are in HELO acl so that they are only run once. They increment a counter,
419 # so we don\'t want it to increment per rcpt to.
421 warn dnslists = list.dnswl.org&0.0.0.3
422 log_message = Hit on list.dnswl.org for $sender_host_address
423 set acl_c_scr = ${eval:$acl_c_scr-30}
425 warn dnslists = list.dnswl.org&0.0.0.2
426 log_message = Hit on list.dnswl.org for $sender_host_address
427 set acl_c_scr = ${eval:$acl_c_scr-20}
429 warn dnslists = list.dnswl.org
430 log_message = Hit on list.dnswl.org for $sender_host_address
431 set acl_c_scr = ${eval:$acl_c_scr-10}
433 warn condition = ${if isip {$sender_helo_name}{true}{false}}
434 log_message = remote host used IP address in HELO/EHLO greeting
435 set acl_c_scr = ${eval:$acl_c_scr+20}
437 warn !hosts = +debianhosts
438 condition = ${if eq{$host_lookup_failed}{1}}
439 set acl_c_scr = ${eval:$acl_c_scr+20}
441 warn !hosts = +debianhosts
442 condition = ${if eq{$host_lookup_failed}{0}}
443 condition = ${if match{$sender_host_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
444 set acl_c_scr = ${eval:$acl_c_scr+20}
446 warn !hosts = +debianhosts
447 condition = ${if match{$sender_helo_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
448 set acl_c_scr = ${eval:$acl_c_scr+20}
450 warn !hosts = +debianhosts
451 dnslists = dul.dnsbl.sorbs.net
452 set acl_c_scr = ${eval:$acl_c_scr+15}
454 # If the sender\'s helo name is empty, the message will be rejected later
455 # because the helo is empty. If the rDNS lookup failed, we are already
456 # going to greylist them, so no sense worrying about it here. Finally,
457 # if rDNS does not match helo name (both lower cased first), greylist.
459 warn !hosts = +debianhosts
460 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
461 condition = ${if def:sender_helo_name {yes}{no}}
462 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
463 log_message = HELO doesn\'t match rDNS
464 set acl_c_scr = ${eval:$acl_c_scr+8}
467 # matches 098325879 - looks fishy
469 warn condition = ${if and { \
470 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
471 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
474 log_message = non-FQDN HELO
475 set acl_c_scr = ${eval:$acl_c_scr+12}
477 # Matches DOMAIN99.com - looks bad
479 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
480 log_message = SHOUTING HELO
481 set acl_c_scr = ${eval:$acl_c_scr+7}
483 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
484 # skip matching on machines named .*smtp.*, since that\'s 4 already. This is a fairly
485 # naive test, so it\'s not worth much
487 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
488 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
489 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
490 log_message = random HELO
491 set acl_c_scr = ${eval:$acl_c_scr+5}
495 drop !hosts = +debianhosts
496 log_message = mail from non-d.o host
497 message = Interesting. I doubt that should have happened.
503 # Implicit, but simpler to just say it
506 #!!# ACL that is used after the RCPT command on the submission port
509 # Accept if the source is local SMTP (i.e. not over TCP/IP).
510 # We do this by testing for an empty sending host field.
511 accept hosts = : 127.0.0.1
515 if nodeinfo['mailrelay']
516 out = " accept verify = certificate"
521 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
522 # This is a rough pass at preventing addres harvesting or other mail blasts.
524 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
525 message = Too many bad recipients, try again later
526 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
529 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
530 !hosts = +debianhosts
531 message = sorry, only 5 reports per hour for submission
533 accept domains = +local_domains
536 message = unknown user
541 if nodeinfo['mailrelay']
543 accept domains = +mailhubdomains
545 message = unknown user
546 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
552 accept domains = +submission_domains
554 message = unknown user
557 deny message = relay not permitted
559 #!!# ACL that is used after the RCPT command
564 if nodeinfo['mailrelay']
565 out = " accept verify = certificate"
570 warn acl = acl_getprofile
571 condition = ${if eq{$acl_m_prf}{}}
572 set acl_m_prf = $acl_m_rprf
574 defer condition = ${if eq{$acl_m_prf}{$acl_m_rprf}{no}{yes}}
575 log_message = Only one profile at a time, please
577 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
578 # This is a rough pass at preventing addres harvesting or other mail blasts.
580 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
581 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
582 message = Too many bad recipients, try again later
583 !hosts = +debianhosts
584 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
586 # Dump spambots that are so stupid they say helo as our IP address
588 drop !hosts = +debianhosts
589 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
590 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
591 message = HELO mismatch Forged HELO for ($sender_helo_name)
593 # Also for spambots that say helo as us or one of our domains
595 drop !hosts = +debianhosts
596 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
597 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
598 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
599 message = HELO mismatch Forged HELO for ($sender_helo_name)
601 # This logic gives you a list of commonly forged domains in helo to reject against
603 warn set acl_m_frg = ${lookup{$sender_helo_name} \
604 nwildlsearch{/etc/exim4/helo-check} \
605 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
607 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
608 # say helo as a name in the list but we can't look them up
610 defer !hosts = +debianhosts
611 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
612 condition = ${if eq{$acl_m_frg}{}{no}{yes}}
613 condition = ${if eq{$sender_host_name}{}{yes}{no}}
614 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
615 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
617 # If DNS works, go ahead and reject them
619 drop !hosts = +debianhosts
620 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
621 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}{yes}{no}}
622 message = HELO mismatch Forged HELO for ($sender_helo_name)
624 # disabled accounts don't even get local mail.
625 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
626 domains = +local_domains
627 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
629 deny domains = +virtual_domains
630 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
631 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
633 hosts = !+debianhosts
634 message = mail for <$local_part@$domain> only accepted from debian.org machines
635 # Accept if the source is local SMTP (i.e. not over TCP/IP).
636 # We do this by testing for an empty sending host field.
639 deny domains = +handled_domains
640 local_parts = ^[.] : ^.*[@%!/|]
642 deny domains = !+handled_domains
643 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
645 # forwards mail to @d.o address, even if it's a bounce from master, no reply
646 # from source address; rejecting all mail now.
647 deny recipients = mendoza@debian.org
648 hosts = 65.110.39.147 : 64.39.31.15
649 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
651 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
652 sender_domains= +local_domains : debian.org : debian.net : debian.com
653 hosts = !+debianhosts
654 message = mail from <$sender_address> not allowed externally
656 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
657 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
658 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
659 message = no mail should ever come from <$sender_address>
661 warn condition = ${if eq{$acl_m_prf}{localonly}}
662 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
668 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
669 hosts = !+debianhosts
670 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
677 if nodeinfo['packagesmaster']
679 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
680 condition = ${if eq {$sender_address}{$local_part@$domain}}
681 message = X-Packages-FromTo-Same: yes
686 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
689 defer !hosts = +debianhosts
690 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
691 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
692 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
693 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
696 if has_variable?("policydweight") && policydweight == "true"
698 # Check with policyd-weight - this only works with a version after etch\'s,
699 # sadly. etch\'s version attempts to hold the socket open, since that\'s what
700 # postfix expects. Exim, on the other hand, expects the remote side to close
701 # the socket when it\'s finished sending data, so it see each transaction as
702 # an incomplete read. I\'m sure there\'s a way we could force exim to do
703 # something sick and clever to force either the interpretation or the socket
704 # closure, but I\'m fairly sure it\'s now worth it, since the backport of
705 # policyd-weight is trivial.
706 warn !hosts = +debianhosts
707 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
708 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
709 {request=smtpd_access_policy\n\
710 protocol_state=RCPT\n\
711 protocol_name=${uc:$received_protocol}\n\
712 helo_name=$sender_helo_name\n\
713 queue_id=$message_exim_id\n\
714 sender=$sender_address\n\
715 recipient=$local_part@$domain\n\
716 recipient_count=$rcpt_count\n\
717 client_address=$sender_host_address\n\
718 client_name=$sender_host_name\n\
719 reverse_client_name=$sender_host_name\n\
720 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
721 {20s}{\n}{socket failure}}
723 # Defer on socket error
724 defer !hosts = +debianhosts
725 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
726 condition = ${if eq{$acl_m_pw}{socket failure}{yes}{no}}
727 message = Cannot connect to policyd-weight. Please try again later.
729 # Set proposed action to $acl_m_act and message to $acl_m_mes
730 warn !hosts = +debianhosts
731 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
732 set acl_m_mes = ${extract{action}{$acl_m_pw}}
733 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
735 # Add X-policyd-weight header line to message
736 warn !hosts = +debianhosts
737 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
739 condition = ${if eq{$acl_m_act}{PREPEND}{yes}{no}}
741 # Write log message, if policyd-weight can\'t run checks
742 warn !hosts = +debianhosts
743 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
744 log_message = policyd-weight message: $acl_m_mes
745 condition = ${if eq{$acl_m_act}{DUNNO}{yes}{no}}
747 # Deny mails which policyd-weight thinks are spam
748 deny !hosts = +debianhosts
749 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
750 message = policyd-weight said: $acl_m_mes
751 condition = ${if eq{$acl_m_act}{550}{yes}{no}}
753 # Defer messages when policyd-weight suggests so.
754 defer !hosts = +debianhosts
755 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
756 message = policyd-weight said: $acl_m_mes
757 condition = ${if eq{$acl_m_act}{450}{yes}{no}}
764 if nodeinfo['rtmaster']
766 warn condition = ${if eq{$acl_m_prf}{RTMail}}
767 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
774 if has_variable?("greylistd") && greylistd == "true"
777 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
778 log_message = greylisted.
779 local_parts = ${if match_domain{$domain}{+virtual_domains}\
780 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
781 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
782 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
783 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
785 !hosts = : +debianhosts : WHITELIST : \
786 ${if exists {/etc/greylistd/whitelist-hosts}\
787 {/etc/greylistd/whitelist-hosts}{}} : \
788 ${if exists {/var/lib/greylistd/whitelist-hosts}\
789 {/var/lib/greylistd/whitelist-hosts}{}}
790 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
792 domains = +handled_domains : +rcpthosts
793 condition = ${readsocket{/var/run/greylistd/socket}\
795 $sender_host_address \
797 $local_part@$domain}\
800 elsif has_variable?("postgrey") && postgrey == "true"
802 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
803 # this adds acl_m_grey if there isn\'t one (so unique per message)
806 !hosts = : +debianhosts : WHITELIST
807 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
808 condition = ${if def:acl_m_grey {no}{yes}}
809 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
811 # and defers the message if postgrey thinks it should be defered ...
814 !hosts = : +debianhosts : WHITELIST
815 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
817 domains = +handled_domains : +rcpthosts
818 local_parts = GREYLIST_LOCAL_PARTS
819 set acl_m_pgr = request=smtpd_access_policy\n\
820 protocol_state=RCPT\n\
821 protocol_name=${uc:$received_protocol}\n\
822 instance=${acl_m_grey}\n\
823 helo_name=${sender_helo_name}\n\
824 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
825 client_name=${sender_host_name}\n\
826 sender=${sender_address}\n\
827 recipient=$local_part@$domain\n\n
828 set acl_m_pgr = ${sg{\
829 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
830 {5s}{}{action=DUNNO}}\
832 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
833 log_message = greylisted.
834 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
836 # ... or adds a header with information about how long the delay was
839 !hosts = : +debianhosts : WHITELIST
840 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
842 domains = +handled_domains : +rcpthosts
843 local_parts = GREYLIST_LOCAL_PARTS
844 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
845 message = ${sg{$acl_m_pgr}{^\\\\w+\\\\s*}{}}
851 accept local_parts = +postmasterish
852 domains = +handled_domains : +rcpthosts
854 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
855 message = I'm terribly sorry, but it seems you have been blacklisted
856 log_message = blacklisted IP
858 deny log_message = <$sender_address> is blacklisted
859 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
860 message = We have blacklisted <$sender_address>. Please stop mailing us
864 if nodeinfo['smarthost'].empty?
866 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
867 dnslists = ${if match_domain{$domain}{+virtual_domains}\
868 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
869 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
870 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
871 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
872 domains = +handled_domains : +rcpthosts
873 !hosts = +debianhosts : WHITELIST
879 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
880 dnslists = ${if match_domain{$domain}{+virtual_domains}\
881 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
882 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
883 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
884 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
885 domains = +handled_domains : +rcpthosts
886 !hosts = +debianhosts : WHITELIST
890 if nodeinfo['smarthost'].empty?
892 deny domains = +handled_domains : +rcpthosts
893 local_parts = ${if match_domain{$domain}{+virtual_domains}\
894 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
895 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
896 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
897 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
898 !hosts = +debianhosts : WHITELIST
899 !verify = sender/callout=90s,maxwait=300s
907 if nodeinfo['mailrelay']
909 accept domains = +mailhubdomains
911 message = unknown user
912 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
917 accept domains = +handled_domains
919 message = unknown user
920 verify = recipient/defer_ok
922 accept domains = +rcpthosts
924 message = unrouteable address
927 accept hosts = +debianhosts
929 accept authenticated = *
931 deny message = relay not permitted
935 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
939 discard condition = ${if <{$message_size}{256000}}
940 condition = ${if eq {$acl_m_prf}{blackhole}}
941 set acl_m_srb = ${perl{surblspamcheck}}
942 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
943 log_message = discarded surbl message for $recipients
945 deny condition = ${if <{$message_size}{256000}}
946 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
947 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
948 set acl_m_srb = ${perl{surblspamcheck}}
949 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
950 log_message = $acl_m_srb
953 warn condition = ${if <{$message_size}{256000}}
954 condition = ${if eq {$acl_m_prf}{markup}}
955 set acl_m_srb = ${perl{surblspamcheck}}
956 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
957 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
966 deny condition = ${if eq{$acl_m_prf}{localonly}}
967 message = mail for $acl_m_lrc is only accepted internally
972 #!!# ACL that is used after the DATA command
976 if nodeinfo['rtmaster']
978 deny condition = ${if eq {$acl_m_prf}{RTMail}}
979 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
980 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
981 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
982 message = messages to the Request Tracker system require a subject tag or a subaddress
989 if nodeinfo['packagesqamaster']
991 deny !hosts = +debianhosts : 217.196.43.134
992 condition = ${if eq {$acl_m_prf}{PTSMail}}
993 condition = ${if def:h_X-PTS-Approved:{false}{true}}
994 message = messages to the PTS require an X-PTS-Approved header
999 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
1000 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
1001 {!match {$message_body}{PGP SIGNED MESSAGE}} \
1002 {!match {$message_body}{PGP SIGNATURE}} \
1003 {!match {$header_content-type:}{multipart/signed}} \
1004 {!match {$header_content-type:}{pgp}} \
1007 message = Mail to this address needs to be PGP-signed
1009 accept verify = certificate
1011 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1012 !verify = header_syntax
1013 message = Invalid syntax in the header
1015 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
1016 # postfix's strict_7bit_headers option, but only checks a few common problem
1017 # headers, as there doesn't appear to be an easy way to check them all.
1019 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
1020 {match {$rh_To:}{[\200-\377]}}\
1021 {match {$rh_From:}{[\200-\377]}}\
1022 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
1023 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1024 message = improper use of 8-bit data in message header: message rejected
1027 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
1028 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1029 message = Your mailer is not RFC 2047 compliant: message rejected
1033 if has_variable?("clamd") && clamd == "true"
1035 discard condition = ${if eq {$acl_m_prf}{blackhole}}
1037 malware = */defer_ok
1038 log_message = discarded malware message for $recipients
1040 deny condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1041 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1043 malware = */defer_ok
1044 message = malware detected: $malware_name: message rejected
1046 warn condition = ${if eq {$acl_m_prf}{markup}}
1048 malware = */defer_ok
1049 message = X-malware detected: $malware_name
1056 if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty?
1058 discard condition = ${if <{$message_size}{256000}}
1059 condition = ${if eq {$acl_m_prf}{blackhole}}
1060 set acl_m_srb = ${perl{surblspamcheck}}
1061 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1062 log_message = discarded surbl message for $recipients
1064 deny condition = ${if <{$message_size}{256000}}
1065 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
1066 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
1067 set acl_m_srb = ${perl{surblspamcheck}}
1068 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1069 log_message = $acl_m_srb
1070 message = $acl_m_srb
1072 warn condition = ${if <{$message_size}{256000}}
1073 condition = ${if eq {$acl_m_prf}{markup}}
1074 set acl_m_srb = ${perl{surblspamcheck}}
1075 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
1076 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1082 # Check header_sender except for survey@popcon.d.o
1083 deny condition = ${if eq{$acl_m_prf}{PopconMail}{false}{true}}
1084 !verify = header_sender
1085 message = No valid sender found in the From:, Sender: and Reply-to: headers
1089 if nodeinfo['packagesmaster']
1091 deny message = Congratulations, you scored $spam_score points.
1092 log_message = spam: $spam_score points.
1093 condition = ${if eq {$acl_m_prf}{PackagesMail}}
1095 !verify = certificate
1096 !hosts = +debianhosts
1097 condition = ${if <{$message_size}{256000}}
1098 spam = pkg_user : true
1099 condition = ${if >{$spam_score_int}{59}}
1108 ######################################################################
1109 # REWRITE CONFIGURATION #
1110 ######################################################################
1116 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
1117 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
1118 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1119 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1120 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1121 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
1124 #!!#######################################################!!#
1125 #!!# Here follow routers created from the old routers, #!!#
1126 #!!# for handling non-local domains. #!!#
1127 #!!#######################################################!!#
1133 ######################################################################
1134 # ROUTERS CONFIGURATION #
1135 # Specifies how addresses are handled #
1136 ######################################################################
1137 # ORDER DOES MATTER #
1138 # An address is passed to each in turn until it is accepted. #
1139 ######################################################################
1143 if nodeinfo['mailrelay']
1146 driver = manualroute
1147 domains = +mailhubdomains
1148 transport = remote_smtp
1149 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1150 require_files = /etc/exim4/manualroute
1157 debug_print = "R: bsmtp for $local_part@$domain"
1158 driver = manualroute
1159 domains = +bsmtp_domains
1160 require_files = /etc/exim4/bsmtp
1161 route_list = * ${extract{file}{\
1162 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1166 # This router routes to remote hosts over SMTP by explicit IP address,
1167 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1168 # require this facility, which is why it is enabled by default in Exim.
1170 debug_print = "R: ipliteral for $local_part@$domain"
1172 domains = !+handled_domains
1173 transport = remote_smtp
1174 ignore_target_hosts = +reservedaddrs
1178 if not nodeinfo['smarthost'].empty?
1181 debug_print = "R: smarthost for $local_part@$domain"
1182 driver = manualroute
1183 domains = !+handled_domains
1184 transport = remote_smtp_smarthost
1185 route_list = * ' + nodeinfo['smarthost']
1186 if nodeinfo['smarthost'] == 'mailout.debian.org'
1190 host_find_failed = defer
1191 same_domain_copy_routing = yes
1198 # This router routes to remote hosts over SMTP using a DNS lookup.
1199 # Ignore reserved network responses, including localhost.
1201 debug_print = "R: dnslookup for $local_part@$domain"
1203 domains = !+handled_domains
1204 transport = remote_smtp
1205 ignore_target_hosts = +reservedaddrs
1209 debug_print = "R: postmasterish for $local_part@$domain"
1214 local_parts = +postmasterish
1215 domains = +handled_domains
1216 data = debian-admin@debian.org
1217 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1219 # This router handles aliasing using a traditional /etc/aliases file.
1220 # If any of your aliases expand to pipes or files, you will need to set
1221 # up a user and a group for these deliveries to run under. You can do
1222 # this by uncommenting the "user" option below (changing the user name
1223 # as appropriate) and adding a "group" option if necessary.
1226 debug_print = "R: system_aliases for $local_part@$domain"
1230 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1231 domains = +local_domains
1232 file_transport = address_file
1233 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1234 pipe_transport = address_pipe
1235 retry_use_local_part
1237 # This router handles forwarding using traditional .forward files.
1238 # It also allows mail filtering when a forward file starts with the
1239 # string "# Exim filter": to disable filtering, uncomment the "filter"
1240 # option. The check_ancestor option means that if the forward file
1241 # generates an address that is an ancestor of the current one, the
1242 # current one gets passed on instead. This covers the case where A is
1243 # aliased to B and B has a .forward file pointing to A.
1245 # For standard debian setup of one group per user, it is acceptable---normal
1246 # even---for .forward to be group writable. If you have everyone in one
1247 # group, you should comment out the "modemask" line. Without it, the exim
1248 # default of 022 will apply, which is probably what you want.
1251 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1256 directory_transport = address_directory
1257 domains = +local_domains
1258 # filter - I have disabled filtering to force users to use .forward-foo files
1259 # or procmail. This will make it easier to move mailers in the future
1261 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1262 # also checks if the .forward-bar exists, if not then it uses
1263 # .forward-default instead.
1264 file = $home/.forward\
1265 ${if eq{}{$local_part_suffix}{}{\
1266 ${if exists {${home}/.forward${local_part_suffix}} \
1267 {${local_part_suffix}}{-default}}\
1270 file_transport = address_file
1271 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1272 local_part_suffix = -*
1273 local_part_suffix_optional
1275 pipe_transport = address_pipe
1276 reply_transport = address_reply
1277 require_files = $home
1278 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1282 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1286 directory_transport = address_directory
1287 domains = +local_domains
1288 # filter - I have disabled filtering to force users to use .forward-foo files
1289 # or procmail. This will make it easier to move mailers in the future
1291 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1292 # also checks if the .forward-bar exists, if not then it uses
1293 # .forward-default instead.
1294 file = $home/.forward\
1295 ${if eq{}{$local_part_suffix}{}{\
1296 ${if exists {${home}/.forward${local_part_suffix}} \
1297 {${local_part_suffix}}{-default}}\
1300 file_transport = address_file
1301 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1302 local_part_suffix = -*
1303 local_part_suffix_optional
1305 pipe_transport = address_pipe
1306 reply_transport = address_reply
1307 require_files = $home
1310 # This delivers to procmail
1312 debug_print = "R: procmail for $local_part@$domain"
1315 domains = +local_domains
1316 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1319 require_files = $local_part:$home/.procmailrc
1320 transport = procmail_pipe
1321 transport_current_directory = $home
1323 # This driver delivers to the LDAP generated alias file.
1325 debug_print = "R: ldap_aliases for $local_part@$domain"
1329 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
1330 {${lookup{$local_part}cdb\
1331 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
1332 domains = +local_domains
1333 file_transport = address_file
1334 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1335 pipe_transport = address_pipe
1336 retry_use_local_part
1338 # This director matches local user mailboxes.
1340 debug_print = "R: localuser for $local_part@$domain"
1343 domains = +local_domains
1344 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1345 # Disable if the user has never logged in
1346 require_files = $home
1347 transport = local_delivery
1350 # Now we begin the Virtual Domain configuration
1351 # Everything before here should apply only to the local domains with a
1354 # exim4 fails the router if it can't change to the user/group for delivery
1355 # during verification. So we have to seperate the cases of verifying
1356 # the virts, and delivering to them. blah.
1359 if nodeinfo['packagesmaster']
1361 # This router delivers for packages.d.o
1363 debug_print = "R: packages for $local_part@$domain"
1365 file_transport = address_file
1366 pipe_transport = address_pipe
1367 domains = packages.debian.org
1368 require_files = /org/packages.debian.org/conf/maintainer
1369 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
1370 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1371 transport_home_directory = /org/packages.debian.org/mail
1372 transport_current_directory = /org/packages.debian.org/mail
1374 retry_use_local_part
1383 if nodeinfo['bugsmaster']
1385 # This router delivers for bugs.d.o
1387 debug_print = "R: bugs for $local_part@$domain"
1389 transport = bugs_pipe
1390 domains = bugs.debian.org
1391 cannot_route_message = Unknown or archived bug
1392 require_files = /org/bugs.debian.org/mail/run-procmail
1394 local_parts = ${if match\
1396 {\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}\
1397 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1398 {$local_part}fail}}fail}
1406 if nodeinfo['rtmaster']
1408 # This router delivers for rt.d.o
1409 rt_force_new_verbose:
1410 debug_print = "R: rt for $local_part+new@$domain"
1412 domains = rt.debian.org
1413 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1414 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1415 local_part_suffix = +new
1416 pipe_transport = rt_pipe
1417 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}}"
1418 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1420 # FIXME: figure out how to generalize this approach so that all of the following would work
1421 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1422 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1423 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1424 # requires modification to custom condition in \'scrips\'
1425 rt_force_new_quiesce:
1426 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1428 domains = rt.debian.org
1429 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1430 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1431 local_part_suffix = +new-quiesce
1432 pipe_transport = rt_pipe
1433 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}}"
1434 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce"
1437 debug_print = "R: rt for $local_part@$domain"
1439 domains = rt.debian.org
1440 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1441 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1442 local_part_suffix = +*
1443 local_part_suffix_optional
1444 pipe_transport = rt_pipe
1445 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}}"
1446 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1453 debug_print = "R: virt_aliases for $local_part@$domain"
1455 data = ${if exists{\
1456 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1457 {${lookup{$local_part}lsearch*{\
1458 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1460 directory_transport = address_directory
1461 cannot_route_message = Unknown user
1462 domains = +virtual_domains
1463 file_transport = address_file
1464 pipe_transport = address_pipe
1465 qualify_preserve_domain
1466 retry_use_local_part
1467 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1468 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1472 debug_print = "R: virt_direct for $local_part@$domain"
1478 directory_transport = address_directory
1479 domains = +virtual_domains
1480 file = $home/.forward-\
1481 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1483 file_transport = address_file
1484 pipe_transport = address_pipe
1485 reply_transport = address_reply
1486 retry_use_local_part
1487 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1488 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1491 # This is a senmailesque alias file lookup
1493 debug_print = "R: virt_aliases for $local_part@$domain"
1497 data = ${if exists{\
1498 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1499 {${lookup{$local_part}lsearch*{\
1500 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1502 directory_transport = address_directory
1503 domains = +virtual_domains
1504 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1505 cannot_route_message = Unknown user
1506 group = ${extract{group}{VDOMAINDATA}}
1507 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1508 pipe_transport = address_pipe
1509 qualify_preserve_domain
1510 retry_use_local_part
1511 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1512 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1514 user = ${extract{user}{VDOMAINDATA}}
1516 # This is a qmailesque deliver into a directory of .forward files
1518 debug_print = "R: virt_direct for $local_part@$domain"
1524 directory_transport = address_directory
1525 domains = +virtual_domains
1526 file = $home/.forward-\
1527 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1529 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1530 group = ${extract{group}{VDOMAINDATA}}
1531 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1533 pipe_transport = address_pipe
1534 reply_transport = address_reply
1535 retry_use_local_part
1536 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1537 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1539 user = ${extract{user}{VDOMAINDATA}}
1540 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1542 ######################################################################
1543 # TRANSPORTS CONFIGURATION #
1544 ######################################################################
1545 # ORDER DOES NOT MATTER #
1546 # Only one appropriate transport is called for each delivery. #
1547 ######################################################################
1552 # This transport is used for local delivery to user mailboxes. On debian
1553 # systems group mail is used so we can write to the /var/mail
1554 # directory. (The alternative, which most other unixes use, is to deliver
1555 # as the user's own group, into a sticky-bitted directory)
1558 file = /var/mail/${local_part}
1561 no_mode_fail_narrower
1564 # This transport is used for handling pipe addresses generated by alias
1565 # or .forward files. It has a conventional name, since it is not actually
1566 # mentioned elsewhere in this configuration file. (A different name *can*
1567 # be specified via the "address_pipe_transport" option if you really want
1568 # to.) If the pipe generates any standard output, it is returned to the sender
1569 # of the message as a delivery error. Set return_fail_output instead if you
1570 # want this to happen only when the pipe fails to complete normally.
1574 current_directory = ${home}
1575 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1576 EXT=${substr_1:${local_part_suffix}}:\
1577 LOCAL=${local_part}${local_part_suffix}:\
1578 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1582 # This transport is used for handling file addresses generated by alias
1583 # or .forward files. It has a conventional name, since it is not actually
1584 # mentioned elsewhere in this configuration file.
1594 directory_mode = 0770
1595 mode_fail_narrower = false
1597 # This transport is used for handling file addresses generated by alias
1598 # or .forward files if the path ends in "/", which causes it to be treated
1599 # as a directory name rather than a file name. Each message is then delivered
1600 # to a unique file in the directory. If instead you want all such deliveries to
1601 # be in the "maildir" format that is used by some other mail software,
1602 # uncomment the final option below. If this is done, the directory specified
1603 # in the .forward or alias file is the base maildir directory.
1605 # Should you want to be able to specify either maildir or non-maildir
1606 # directory-style deliveries, then you must set up yet another transport,
1607 # called address_directory2. This is used if the path ends in "//" so should
1608 # be the one used for maildir, as the double slash suggests another level
1609 # of directory. In the absence of address_directory2, paths ending in //
1610 # are passed to address_directory.
1620 # This transport is used for handling autoreplies generated by the filtering
1621 # option of the forwardfile director. It has a conventional name, since it
1622 # is not actually mentioned elsewhere in this configuration file.
1626 # This transport is used for delivering messages over SMTP connections.
1630 connect_timeout = 1m
1631 delay_after_cutoff = false
1634 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1635 out = " tls_certificate = /etc/exim4/ssl/thishost.crt
1636 tls_privatekey = /etc/exim4/ssl/thishost.key"
1643 if not nodeinfo['smarthost'].empty?
1645 remote_smtp_smarthost:
1646 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1648 delay_after_cutoff = false
1650 out += nodeinfo['smarthost_port'].to_s + "\n"
1651 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1652 out += ' tls_tempfail_tryclear = false
1653 hosts_require_tls = ' + nodeinfo['smarthost'] + '
1654 tls_certificate = /etc/exim4/ssl/thishost.crt
1655 tls_privatekey = /etc/exim4/ssl/thishost.key
1662 # Send the message to procmail
1665 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1667 user = ${local_part}
1676 user = ${extract{user}{\
1677 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1683 if nodeinfo['bugsmaster']
1687 command = /org/bugs.debian.org/mail/run-procmail
1688 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1689 EXT=${substr_1:${local_part_suffix}}:\
1690 LOCAL=${local_part}${local_part_suffix}:\
1691 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1702 if nodeinfo['rtmaster']
1705 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1708 environment = EXTENSION=${substr_1:${local_part_suffix}}
1709 allow_commands = /usr/bin/rt-mailgate
1715 ######################################################################
1716 # RETRY CONFIGURATION #
1717 ######################################################################
1719 # This single retry rule applies to all domains and all errors. It specifies
1720 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1721 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1722 # hours, then retries every 8 hours until 4 days have passed since the first
1725 # Domain Error Retries
1726 # ------ ----- -------
1731 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1732 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1733 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1735 # End of Exim 4 configuration