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 # relayhosts - Hostnames that can send any arbitarily addressed mail to
31 # us. This is primarily only usefull for emergancy 'queue
32 # flushing' operations, but should be populated with a list
33 # of trusted machines. Wildcards are not permitted
34 # bsmtp_domains - Domains that we deliver locally via bsmtp
35 <% if nodeinfo['mailrelay'] %>
36 # mailhubdomains - Domains for which we are the MX, but the mail is relayed
37 # elsewhere. This is designed for use with small volume or
38 # restricted machines that need to use a smarthost for mail
39 # traffic. We will relay for them based on ssl cert validation
40 # but we need to teach exim how to route the mail to them. This is
43 # Exim's wildcard mechanism is a bit odd in that to say "any address in
44 # debian.org including debian.org" you must use two patterns,
47 # Also you can only place a * before a . and as the first char in a string.
48 # Wildcards always match last so they may be used as a catchall.
50 # Further details can be found in each of the files.
52 # Usefull exim commands:
53 # exim4 -qf - Try sending all messages right now, including frozen ones
54 # exim4 -bt foo@blah - Write what exim would do if it saw the address
55 # Great for testing virtual domains and forward files
57 # Special Features for users:
58 # .forward-foo - is understood as an extension address for bar-foo@cow.com
59 # .forward-default - is understood to be a catch all for bar-*@cow.com
60 # .procmailrc - with no .forward file invokes procmail for delivery
63 # For virtual domains the first lookup is done against a linear text
64 # database called 'aliases', then .forward files are consulted. Exim
65 # filtering is available for these .forward files only. .forward-default
66 # is the universal catch all for everything not handled.
68 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
69 # will trigger things like rcpt to rate limiting or possibly a reject if
70 # enough hits are triggered.
72 # value is stored in acl_c_scr
74 ######################################################################
75 # MAIN CONFIGURATION SETTINGS #
76 ######################################################################
78 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
79 perl_startup = do '/etc/exim4/exim_surbl.pl'
82 # These options specify the Access Control Lists (ACLs) that
83 # are used for incoming SMTP messages - after the RCPT and DATA
84 # commands, respectively.
86 acl_smtp_helo = check_helo
87 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
88 acl_smtp_data = check_message
89 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
90 acl_smtp_mime = acl_check_mime
92 acl_smtp_predata = acl_check_predata
94 # accept domain literal syntax in e-mail addresses. To actually make use of
95 # this a router is also required
96 allow_domain_literals = true
98 # This setting defines a named domain list called
99 # local_domains. It will be referenced
100 # later on by the syntax "+local_domains".
101 # Other domain and host lists may follow.
102 # @ is the local FQDN, @[] matches the IP adress of any local interface.
104 domainlist local_domains = @ : \
107 ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
109 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
111 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
113 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
115 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
117 localpartlist local_only_users = lsearch;/etc/exim4/localusers
119 localpartlist postmasterish = postmaster : abuse : hostmaster : root
121 hostlist debianhosts = 127.0.0.1 : /var/lib/misc/thishost/debianhosts
123 hostlist reservedaddrs = <%= nodeinfo['reservedaddrs'] %>
125 <% if nodeinfo['mailrelay'] %>
126 # Domains we relay for; that is domains that aren't considered local but we
127 # accept mail for them.
128 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
131 <% if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true" %>
132 tls_certificate = /etc/exim4/ssl/thishost.crt
133 tls_privatekey = /etc/exim4/ssl/thishost.key
134 tls_try_verify_hosts = *
135 tls_verify_certificates = /etc/exim4/ssl/ca.crt
136 tls_crl = /etc/exim4/ssl/ca.crl
139 # The setting below causes Exim to do a reverse DNS lookup on all incoming
140 # IP calls, in order to get the true host name. If you feel this is too
141 # expensive, you can specify the networks for which a lookup is done, or
142 # remove the setting entirely.
144 # dns_ipv4_lookup = !localhost (disabled upon sgrans request, zobel, 2010-03-16)
146 # If this option is set, then any process that is running as one of the
147 # listed users may pass a message to Exim and specify the sender's
148 # address using the "-f" command line option, without Exim's adding a
151 untrusted_set_sender = *
153 # Some operating systems use the "gecos" field in the system password file
154 # to hold other information in addition to users' real names. Exim looks up
155 # this field when it is creating "sender" and "from" headers. If these options
156 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
157 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
160 gecos_pattern = ^([^,:]*)
163 # This tells exim to immediately discard error messages (ie double bounces).
164 ignore_bounce_errors_after = 0s
166 timeout_frozen_after=14d
168 message_size_limit = 100M
170 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
171 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
172 smtp_accept_max = 300
173 smtp_accept_queue = 200
174 smtp_accept_queue_per_connection = 50
175 smtp_accept_reserve = 25
178 smtp_accept_queue = 20
179 smtp_accept_queue_per_connection = 10
180 smtp_accept_reserve = 5
182 smtp_reserve_hosts = +debianhosts
184 split_spool_directory = true
185 check_spool_inodes = 200
186 check_spool_space = 20M
190 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
192 deliver_queue_load_max = 50
194 smtp_load_reserve = 20
197 deliver_queue_load_max = 10
200 queue_list_requires_admin = false
202 <% if has_variable?("clamd") && clamd == "true" %>
203 av_scanner = clamd:/var/run/clamav/clamd.ctl
208 out = "daemon_smtp_ports = "
211 if nodeinfo['bugsmaster'] or nodeinfo['bugsmx']
215 if not nodeinfo['mail_port'].to_s.empty?
216 ports << nodeinfo['mail_port']
219 if nodeinfo['mailrelay']
220 ports << nodeinfo['smarthost_port']
223 out += ports.uniq.sort.join(" : ")
228 remote_sort_domains = *.debian.org:*.debian.net
230 pipelining_advertise_hosts = !*
231 <% if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true" %>
232 tls_advertise_hosts = *
234 smtp_enforce_sync = true
236 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
238 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
239 {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
240 ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
241 by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
242 (Exim $version_number)\n\t\
243 ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
244 id $message_exim_id${if def:received_for {\n\tfor $received_for}}
248 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
249 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
250 ${if exists {/srv/$domain/mail/whitelist}{\
251 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
253 }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
254 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
255 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
256 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
257 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
258 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
259 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
261 ######################################################################
262 # ACL CONFIGURATION #
263 ######################################################################
267 # There are a few profiles that don't want much smtp time checking of
268 # mail. It's easier to track them in one place
270 accept condition = ${if eq {$acl_m_prf}{PopconMail}}
271 accept condition = ${if eq {$acl_m_prf}{BugsMail}}
275 # This is a bad hack to reset the variable, by defining it be something
278 warn set acl_m_rprf = $acl_m_undefined
280 warn recipients = survey@popcon.debian.org
281 set acl_m_rprf = PopconMail
283 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
285 warn local_parts = +local_only_users
286 domains = +local_domains
287 hosts = !+debianhosts
288 set acl_m_rprf = localonly
290 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
292 <% if nodeinfo['rtmaster'] %>
293 warn domains = rt.debian.org
294 set acl_m_rprf = RTMail
296 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
299 <% if nodeinfo['bugsmx'] %>
300 warn domains = bugs.debian.org
301 set acl_m_rprf = BugsMail
303 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
306 <% if nodeinfo['packagesmaster'] %>
307 warn domains = packages.debian.org
308 set acl_m_rprf = PackagesMail
310 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
313 <% if nodeinfo['packagesqamaster'] %>
314 warn recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
315 set acl_m_rprf = PTSOwner
317 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
320 domains = packages.qa.debian.org
321 condition = ${if match{$local_part}{\N^bounces+\N}}
322 set acl_m_rprf = PTSListBounce
324 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
326 warn domains = packages.qa.debian.org
327 set acl_m_rprf = PTSMail
329 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
332 warn recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
333 set acl_m_rprf = DBSignedMail
335 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
337 warn domains = +virtual_domains
338 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
339 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
340 log_message = $local_part@$domain: markup
341 set acl_m_rprf = markup
343 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
345 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
346 log_message = $local_part@$domain: markup
347 set acl_m_rprf = markup
349 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
351 warn condition = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
352 log_message = $local_part@$domain: blackhole
353 set acl_m_rprf = blackhole
355 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
357 warn domains = +virtual_domains
358 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
359 condition = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
360 log_message = $local_part@$domain: blackhole
361 set acl_m_rprf = blackhole
363 accept condition = ${if eq {$acl_m_rprf}{}{no}{yes}}
365 warn set acl_m_rprf = normal
371 warn set acl_c_scr = 0
373 <% if nodeinfo['mailrelay'] %>
374 accept verify = certificate
377 <% if nodeinfo['smarthost'].empty? %>
378 # These are in HELO acl so that they are only run once. They increment a counter,
379 # so we don't want it to increment per rcpt to.
381 warn dnslists = list.dnswl.org&0.0.0.3
382 log_message = Hit on list.dnswl.org for $sender_host_address
383 set acl_c_scr = ${eval:$acl_c_scr-30}
385 warn dnslists = list.dnswl.org&0.0.0.2
386 log_message = Hit on list.dnswl.org for $sender_host_address
387 set acl_c_scr = ${eval:$acl_c_scr-20}
389 warn dnslists = list.dnswl.org
390 log_message = Hit on list.dnswl.org for $sender_host_address
391 set acl_c_scr = ${eval:$acl_c_scr-10}
393 warn condition = ${if isip {$sender_helo_name}{true}{false}}
394 log_message = remote host used IP address in HELO/EHLO greeting
395 set acl_c_scr = ${eval:$acl_c_scr+20}
397 warn !hosts = +debianhosts
398 condition = ${if eq{$host_lookup_failed}{1}}
399 set acl_c_scr = ${eval:$acl_c_scr+20}
401 warn !hosts = +debianhosts
402 condition = ${if eq{$host_lookup_failed}{0}}
403 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}}
404 set acl_c_scr = ${eval:$acl_c_scr+20}
406 warn !hosts = +debianhosts
407 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}}
408 set acl_c_scr = ${eval:$acl_c_scr+20}
410 warn !hosts = +debianhosts
411 dnslists = dul.dnsbl.sorbs.net
412 set acl_c_scr = ${eval:$acl_c_scr+15}
414 # If the sender's helo name is empty, the message will be rejected later
415 # because the helo is empty. If the rDNS lookup failed, we are already
416 # going to greylist them, so no sense worrying about it here. Finally,
417 # if rDNS does not match helo name (both lower cased first), greylist.
419 warn !hosts = +debianhosts
420 condition = ${if eq {$host_lookup_failed}{1}{no}{yes}}
421 condition = ${if def:sender_helo_name {yes}{no}}
422 condition = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
423 log_message = HELO doesn't match rDNS
424 set acl_c_scr = ${eval:$acl_c_scr+8}
427 # matches 098325879 - looks fishy
429 warn condition = ${if and { \
430 { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
431 { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
434 log_message = non-FQDN HELO
435 set acl_c_scr = ${eval:$acl_c_scr+12}
437 # Matches DOMAIN99.com - looks bad
439 warn condition = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
440 log_message = SHOUTING HELO
441 set acl_c_scr = ${eval:$acl_c_scr+7}
443 # Random HELO (run of 7 consonants) (constructed by viruses). We purposefully
444 # skip matching on machines named .*smtp.*, since that's 4 already. This is a fairly
445 # naive test, so it's not worth much
447 warn condition = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
448 condition = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
449 condition = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
450 log_message = random HELO
451 set acl_c_scr = ${eval:$acl_c_scr+5}
454 drop !hosts = +debianhosts
455 log_message = mail from non-d.o host
456 message = Interesting. I doubt that should have happened.
459 # Implicit, but simpler to just say it
462 #!!# ACL that is used after the RCPT command on the submission port
465 # Accept if the source is local SMTP (i.e. not over TCP/IP).
466 # We do this by testing for an empty sending host field.
467 accept hosts = : 127.0.0.1
469 <% if nodeinfo['mailrelay'] %>
470 accept verify = certificate
473 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
474 # This is a rough pass at preventing addres harvesting or other mail blasts.
476 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
477 message = Too many bad recipients, try again later
478 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
481 ratelimit = 5 / 60m / per_rcpt / $sender_host_address
482 !hosts = +debianhosts
483 message = sorry, only 5 reports per hour for submission
485 accept domains = +local_domains
490 <% if nodeinfo['mailrelay'] %>
491 accept domains = +mailhubdomains
493 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
496 accept domains = +submission_domains
500 deny message = relay not permitted
502 #!!# ACL that is used after the RCPT command
505 <% if nodeinfo['mailrelay'] %>
506 accept verify = certificate
509 warn acl = acl_getprofile
510 condition = ${if eq{$acl_m_prf}{}}
511 set acl_m_prf = $acl_m_rprf
513 defer condition = ${if eq{$acl_m_prf}{$acl_m_rprf}{no}{yes}}
514 log_message = Only one profile at a time, please
516 # Defer after too many bad RCPT TO's. Legit MTAs will retry later.
517 # This is a rough pass at preventing addres harvesting or other mail blasts.
519 defer log_message = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
520 !acl = acl_spamlovers
521 message = Too many bad recipients, try again later
522 !hosts = +debianhosts
523 condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
525 # Dump spambots that are so stupid they say helo as our IP address
527 drop !hosts = +debianhosts
528 !acl = acl_spamlovers
529 condition = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
530 message = HELO mismatch Forged HELO for ($sender_helo_name)
532 # Also for spambots that say helo as us or one of our domains
534 drop !hosts = +debianhosts
535 !acl = acl_spamlovers
536 condition = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
537 condition = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
538 message = HELO mismatch Forged HELO for ($sender_helo_name)
540 # This logic gives you a list of commonly forged domains in helo to reject against
542 warn set acl_m_frg = ${lookup{$sender_helo_name} \
543 nwildlsearch{/etc/exim4/helo-check} \
544 {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
546 # This is a failsafe in case DNS fails - we defer instead of hard reject if they
547 # say helo as a name in the list but we can't look them up
549 defer !hosts = +debianhosts
550 !acl = acl_spamlovers
551 condition = ${if eq{$acl_m_frg}{}{no}{yes}}
552 condition = ${if eq{$sender_host_name}{}{yes}{no}}
553 condition = ${if eq{$host_lookup_failed}{1}{no}{yes}}
554 message = Access temporarily denied. Resolve failed PTR for $sender_host_address
556 # If DNS works, go ahead and reject them
558 drop !hosts = +debianhosts
559 !acl = acl_spamlovers
560 condition = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}{yes}{no}}
561 message = HELO mismatch Forged HELO for ($sender_helo_name)
563 # disabled accounts don't even get local mail.
564 deny local_parts = lsearch;/var/lib/misc/$primary_hostname/mail-disable
565 domains = +local_domains
566 message = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
568 deny domains = +virtual_domains
569 local_parts = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
570 {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
572 hosts = !+debianhosts
573 message = mail for <$local_part@$domain> only accepted from debian.org machines
574 # Accept if the source is local SMTP (i.e. not over TCP/IP).
575 # We do this by testing for an empty sending host field.
578 deny domains = +handled_domains
579 local_parts = ^[.] : ^.*[@%!/|]
581 deny domains = !+handled_domains
582 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
584 # forwards mail to @d.o address, even if it's a bounce from master, no reply
585 # from source address; rejecting all mail now.
586 deny recipients = mendoza@debian.org
587 hosts = 65.110.39.147 : 64.39.31.15
588 message = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
590 deny condition = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
591 sender_domains= +local_domains : debian.org : debian.net : debian.com
592 hosts = !+debianhosts
593 message = mail from <$sender_address> not allowed externally
595 deny condition = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
596 condition = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
597 condition = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
598 message = no mail should ever come from <$sender_address>
600 warn condition = ${if eq{$acl_m_prf}{localonly}}
601 set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
604 deny message = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
605 hosts = !+debianhosts
606 dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
609 <% if nodeinfo['packagesmaster'] %>
610 warn condition = ${if eq {$acl_m_prf}{PackagesMail}}
611 condition = ${if eq {$sender_address}{$local_part@$domain}}
612 message = X-Packages-FromTo-Same: yes
615 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
618 defer !hosts = +debianhosts
619 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
620 condition = ${if >{${eval:$acl_c_scr+0}}{0}}
621 ratelimit = 10 / 60m / per_rcpt / $sender_host_address
622 message = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
624 <% if has_variable?("policydweight") && policydweight == "true" %>
625 # Check with policyd-weight - this only works with a version after etch's,
626 # sadly. etch's version attempts to hold the socket open, since that's what
627 # postfix expects. Exim, on the other hand, expects the remote side to close
628 # the socket when it's finished sending data, so it see each transaction as
629 # an incomplete read. I'm sure there's a way we could force exim to do
630 # something sick and clever to force either the interpretation or the socket
631 # closure, but I'm fairly sure it's now worth it, since the backport of
632 # policyd-weight is trivial.
633 warn !hosts = +debianhosts
634 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
635 set acl_m_pw = ${readsocket{inet:127.0.0.1:12525}\
636 {request=smtpd_access_policy\n\
637 protocol_state=RCPT\n\
638 protocol_name=${uc:$received_protocol}\n\
639 helo_name=$sender_helo_name\n\
640 queue_id=$message_exim_id\n\
641 sender=$sender_address\n\
642 recipient=$local_part@$domain\n\
643 recipient_count=$rcpt_count\n\
644 client_address=$sender_host_address\n\
645 client_name=$sender_host_name\n\
646 reverse_client_name=$sender_host_name\n\
647 instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
648 {20s}{\n}{socket failure}}
650 # Defer on socket error
651 defer !hosts = +debianhosts
652 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
653 condition = ${if eq{$acl_m_pw}{socket failure}{yes}{no}}
654 message = Cannot connect to policyd-weight. Please try again later.
656 # Set proposed action to $acl_m_act and message to $acl_m_mes
657 warn !hosts = +debianhosts
658 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
659 set acl_m_mes = ${extract{action}{$acl_m_pw}}
660 set acl_m_act = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
662 # Add X-policyd-weight header line to message
663 warn !hosts = +debianhosts
664 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
666 condition = ${if eq{$acl_m_act}{PREPEND}{yes}{no}}
668 # Write log message, if policyd-weight can't run checks
669 warn !hosts = +debianhosts
670 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
671 log_message = policyd-weight message: $acl_m_mes
672 condition = ${if eq{$acl_m_act}{DUNNO}{yes}{no}}
674 # Deny mails which policyd-weight thinks are spam
675 deny !hosts = +debianhosts
676 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
677 message = policyd-weight said: $acl_m_mes
678 condition = ${if eq{$acl_m_act}{550}{yes}{no}}
680 # Defer messages when policyd-weight suggests so.
681 defer !hosts = +debianhosts
682 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
683 message = policyd-weight said: $acl_m_mes
684 condition = ${if eq{$acl_m_act}{450}{yes}{no}}
687 <% if nodeinfo['rtmaster'] %>
688 warn condition = ${if eq{$acl_m_prf}{RTMail}}
689 set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
692 <% if has_variable?("greylistd") && greylistd == "true" %>
694 message = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
695 log_message = greylisted.
696 local_parts = ${if match_domain{$domain}{+virtual_domains}\
697 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
698 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
699 {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
700 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
702 !hosts = : +debianhosts : WHITELIST : \
703 ${if exists {/etc/greylistd/whitelist-hosts}\
704 {/etc/greylistd/whitelist-hosts}{}} : \
705 ${if exists {/var/lib/greylistd/whitelist-hosts}\
706 {/var/lib/greylistd/whitelist-hosts}{}}
707 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
709 domains = +handled_domains
710 condition = ${readsocket{/var/run/greylistd/socket}\
712 $sender_host_address \
714 $local_part@$domain}\
717 <% elsif has_variable?("postgrey") && postgrey == "true" %>
718 # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
719 # this adds acl_m_grey if there isn't one (so unique per message)
722 !hosts = : +debianhosts : WHITELIST
723 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
724 condition = ${if def:acl_m_grey {no}{yes}}
725 set acl_m_grey = $pid.$tod_epoch.$sender_host_port
727 # and defers the message if postgrey thinks it should be defered ...
730 !hosts = : +debianhosts : WHITELIST
731 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
733 domains = +handled_domains
734 local_parts = GREYLIST_LOCAL_PARTS
735 set acl_m_pgr = request=smtpd_access_policy\n\
736 protocol_state=RCPT\n\
737 protocol_name=${uc:$received_protocol}\n\
738 instance=${acl_m_grey}\n\
739 helo_name=${sender_helo_name}\n\
740 client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
741 client_name=${sender_host_name}\n\
742 sender=${sender_address}\n\
743 recipient=$local_part@$domain\n\n
744 set acl_m_pgr = ${sg{\
745 ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
746 {5s}{}{action=DUNNO}}\
748 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
749 log_message = greylisted.
750 condition = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
752 # ... or adds a header with information about how long the delay was
755 !hosts = : +debianhosts : WHITELIST
756 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
758 domains = +handled_domains
759 local_parts = GREYLIST_LOCAL_PARTS
760 condition = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
761 message = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
765 accept local_parts = +postmasterish
766 domains = +handled_domains
768 deny hosts = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
769 message = I'm terribly sorry, but it seems you have been blacklisted
770 log_message = blacklisted IP
772 deny log_message = <$sender_address> is blacklisted
773 senders = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
774 message = We have blacklisted <$sender_address>. Please stop mailing us
776 <% if nodeinfo['smarthost'].empty? %>
777 deny message = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
778 dnslists = ${if match_domain{$domain}{+virtual_domains}\
779 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
780 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
781 {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
782 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
783 domains = +handled_domains
784 !hosts = +debianhosts : WHITELIST
787 deny message = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
788 dnslists = ${if match_domain{$domain}{+virtual_domains}\
789 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
790 {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
791 {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
792 ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
793 domains = +handled_domains
794 !hosts = +debianhosts : WHITELIST
796 <% if nodeinfo['smarthost'].empty? %>
797 deny domains = +handled_domains
798 local_parts = ${if match_domain{$domain}{+virtual_domains}\
799 {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
800 {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
801 {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
802 ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
803 !hosts = +debianhosts : WHITELIST
804 !verify = sender/callout=90s,maxwait=300s
807 <% if nodeinfo['mailrelay'] %>
808 accept domains = +mailhubdomains
810 verify = recipient/callout=30s,defer_ok,use_sender,no_cache
813 accept domains = +handled_domains
815 verify = recipient/defer_ok
817 accept hosts = +debianhosts
819 accept authenticated = *
821 deny message = relay not permitted
823 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
826 discard condition = ${if <{$message_size}{256000}}
827 condition = ${if eq {$acl_m_prf}{blackhole}}
828 set acl_m_srb = ${perl{surblspamcheck}}
829 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
830 log_message = discarded surbl message for $recipients
832 deny condition = ${if <{$message_size}{256000}}
833 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
834 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
835 set acl_m_srb = ${perl{surblspamcheck}}
836 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
837 log_message = $acl_m_srb
840 warn condition = ${if <{$message_size}{256000}}
841 condition = ${if eq {$acl_m_prf}{markup}}
842 set acl_m_srb = ${perl{surblspamcheck}}
843 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
844 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
851 deny condition = ${if eq{$acl_m_prf}{localonly}}
852 message = mail for $acl_m_lrc is only accepted internally
857 #!!# ACL that is used after the DATA command
859 <% if nodeinfo['rtmaster'] %>
860 deny condition = ${if eq {$acl_m_prf}{RTMail}}
861 condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
862 {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
863 {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
864 message = messages to the Request Tracker system require a subject tag or a subaddress
867 <% if nodeinfo['packagesqamaster'] %>
868 deny !hosts = +debianhosts : 217.196.43.134
869 condition = ${if eq {$acl_m_prf}{PTSMail}}
870 condition = ${if def:h_X-PTS-Approved:{false}{true}}
871 message = messages to the PTS require an X-PTS-Approved header
874 deny condition = ${if eq {$acl_m_prf}{DBSignedMail}}
875 condition = ${if and {{!match {$message_body}{PGP MESSAGE}} \
876 {!match {$message_body}{PGP SIGNED MESSAGE}} \
877 {!match {$message_body}{PGP SIGNATURE}} \
878 {!match {$header_content-type:}{multipart/signed}} \
879 {!match {$header_content-type:}{pgp}} \
882 message = Mail to this address needs to be PGP-signed
884 accept verify = certificate
886 deny condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
887 !verify = header_syntax
888 message = Invalid syntax in the header
890 # RFC 822 and 2822 say that headers must be ASCII. This kinda emulates
891 # postfix's strict_7bit_headers option, but only checks a few common problem
892 # headers, as there doesn't appear to be an easy way to check them all.
894 condition = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
895 {match {$rh_To:}{[\200-\377]}}\
896 {match {$rh_From:}{[\200-\377]}}\
897 {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
898 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
899 message = improper use of 8-bit data in message header: message rejected
902 condition = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
903 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
904 message = Your mailer is not RFC 2047 compliant: message rejected
906 <% if has_variable?("clamd") && clamd == "true" %>
907 discard condition = ${if eq {$acl_m_prf}{blackhole}}
910 log_message = discarded malware message for $recipients
912 deny condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
913 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
916 message = malware detected: $malware_name: message rejected
918 warn condition = ${if eq {$acl_m_prf}{markup}}
921 message = X-malware detected: $malware_name
924 <% if nodeinfo.has_key?('heavy_exim') and not nodeinfo['heavy_exim'].empty? %>
925 discard condition = ${if <{$message_size}{256000}}
926 condition = ${if eq {$acl_m_prf}{blackhole}}
927 set acl_m_srb = ${perl{surblspamcheck}}
928 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
929 log_message = discarded surbl message for $recipients
931 deny condition = ${if <{$message_size}{256000}}
932 condition = ${if eq {$acl_m_prf}{markup}{no}{yes}}
933 condition = ${if eq {$acl_m_prf}{PopconMail}{no}{yes}}
934 set acl_m_srb = ${perl{surblspamcheck}}
935 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
936 log_message = $acl_m_srb
939 warn condition = ${if <{$message_size}{256000}}
940 condition = ${if eq {$acl_m_prf}{markup}}
941 set acl_m_srb = ${perl{surblspamcheck}}
942 condition = ${if eq{$acl_m_srb}{false}{no}{yes}}
943 message = X-Surbl-Hit: $primary_hostname: $acl_m_srb
946 # Check header_sender except for survey@popcon.d.o
947 deny condition = ${if eq{$acl_m_prf}{PopconMail}{false}{true}}
948 !verify = header_sender
949 message = No valid sender found in the From:, Sender: and Reply-to: headers
951 <% if nodeinfo['packagesmaster'] %>
952 deny message = Congratulations, you scored $spam_score points.
953 log_message = spam: $spam_score points.
954 condition = ${if eq {$acl_m_prf}{PackagesMail}}
956 !verify = certificate
957 !hosts = +debianhosts
958 condition = ${if <{$message_size}{256000}}
959 spam = pkg_user : true
960 condition = ${if >{$spam_score_int}{59}}
967 ######################################################################
968 # REWRITE CONFIGURATION #
969 ######################################################################
975 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
976 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
977 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
978 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
979 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
980 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
983 #!!#######################################################!!#
984 #!!# Here follow routers created from the old routers, #!!#
985 #!!# for handling non-local domains. #!!#
986 #!!#######################################################!!#
992 ######################################################################
993 # ROUTERS CONFIGURATION #
994 # Specifies how addresses are handled #
995 ######################################################################
996 # ORDER DOES MATTER #
997 # An address is passed to each in turn until it is accepted. #
998 ######################################################################
1000 <% if nodeinfo['mailrelay'] %>
1002 driver = manualroute
1003 domains = +mailhubdomains
1004 transport = remote_smtp
1005 route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1006 require_files = /etc/exim4/manualroute
1010 debug_print = "R: bsmtp for $local_part@$domain"
1011 driver = manualroute
1012 domains = +bsmtp_domains
1013 require_files = /etc/exim4/bsmtp
1014 route_list = * ${extract{file}{\
1015 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1019 # This router routes to remote hosts over SMTP by explicit IP address,
1020 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1021 # require this facility, which is why it is enabled by default in Exim.
1023 debug_print = "R: ipliteral for $local_part@$domain"
1025 domains = !+handled_domains
1026 transport = remote_smtp
1027 ignore_target_hosts = +reservedaddrs
1031 if not nodeinfo['smarthost'].empty?
1034 debug_print = "R: smarthost for $local_part@$domain"
1035 driver = manualroute
1036 domains = !+handled_domains
1037 transport = remote_smtp_smarthost
1038 route_list = * ' + nodeinfo['smarthost']
1039 if nodeinfo['smarthost'] == 'mailout.debian.org'
1043 host_find_failed = defer
1044 same_domain_copy_routing = yes
1051 # This router routes to remote hosts over SMTP using a DNS lookup.
1052 # Ignore reserved network responses, including localhost.
1054 debug_print = "R: dnslookup for $local_part@$domain"
1056 domains = !+handled_domains
1057 transport = remote_smtp
1058 ignore_target_hosts = +reservedaddrs
1062 debug_print = "R: postmasterish for $local_part@$domain"
1067 local_parts = +postmasterish
1068 domains = +handled_domains
1069 data = debian-admin@debian.org
1070 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1072 # This router handles aliasing using a traditional /etc/aliases file.
1073 # If any of your aliases expand to pipes or files, you will need to set
1074 # up a user and a group for these deliveries to run under. You can do
1075 # this by uncommenting the "user" option below (changing the user name
1076 # as appropriate) and adding a "group" option if necessary.
1079 debug_print = "R: system_aliases for $local_part@$domain"
1083 data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1084 domains = +local_domains
1085 file_transport = address_file
1086 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1087 pipe_transport = address_pipe
1088 retry_use_local_part
1090 # This router handles forwarding using traditional .forward files.
1091 # It also allows mail filtering when a forward file starts with the
1092 # string "# Exim filter": to disable filtering, uncomment the "filter"
1093 # option. The check_ancestor option means that if the forward file
1094 # generates an address that is an ancestor of the current one, the
1095 # current one gets passed on instead. This covers the case where A is
1096 # aliased to B and B has a .forward file pointing to A.
1098 # For standard debian setup of one group per user, it is acceptable---normal
1099 # even---for .forward to be group writable. If you have everyone in one
1100 # group, you should comment out the "modemask" line. Without it, the exim
1101 # default of 022 will apply, which is probably what you want.
1104 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1109 directory_transport = address_directory
1110 domains = +local_domains
1111 # filter - I have disabled filtering to force users to use .forward-foo files
1112 # or procmail. This will make it easier to move mailers in the future
1114 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1115 # also checks if the .forward-bar exists, if not then it uses
1116 # .forward-default instead.
1117 file = $home/.forward\
1118 ${if eq{}{$local_part_suffix}{}{\
1119 ${if exists {${home}/.forward${local_part_suffix}} \
1120 {${local_part_suffix}}{-default}}\
1123 file_transport = address_file
1124 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1125 local_part_suffix = -*
1126 local_part_suffix_optional
1128 pipe_transport = address_pipe
1129 reply_transport = address_reply
1130 require_files = $home
1131 router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1135 debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1139 directory_transport = address_directory
1140 domains = +local_domains
1141 # filter - I have disabled filtering to force users to use .forward-foo files
1142 # or procmail. This will make it easier to move mailers in the future
1144 # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1145 # also checks if the .forward-bar exists, if not then it uses
1146 # .forward-default instead.
1147 file = $home/.forward\
1148 ${if eq{}{$local_part_suffix}{}{\
1149 ${if exists {${home}/.forward${local_part_suffix}} \
1150 {${local_part_suffix}}{-default}}\
1153 file_transport = address_file
1154 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1155 local_part_suffix = -*
1156 local_part_suffix_optional
1158 pipe_transport = address_pipe
1159 reply_transport = address_reply
1160 require_files = $home
1163 # This delivers to procmail
1165 debug_print = "R: procmail for $local_part@$domain"
1168 domains = +local_domains
1169 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1170 local_part_suffix = -*
1171 local_part_suffix_optional
1174 require_files = $local_part:$home/.procmailrc
1175 transport = procmail_pipe
1176 transport_current_directory = $home
1178 # This driver delivers to the LDAP generated alias file.
1180 debug_print = "R: ldap_aliases for $local_part@$domain"
1184 data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
1185 {${lookup{$local_part}cdb\
1186 {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
1187 domains = +local_domains
1188 file_transport = address_file
1189 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1190 pipe_transport = address_pipe
1191 retry_use_local_part
1193 # This director matches local user mailboxes.
1195 debug_print = "R: localuser for $local_part@$domain"
1198 domains = +local_domains
1199 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1200 # Disable if the user has never logged in
1201 require_files = $home
1202 transport = local_delivery
1205 # Now we begin the Virtual Domain configuration
1206 # Everything before here should apply only to the local domains with a
1209 <% if nodeinfo['packagesmaster'] %>
1210 # This router delivers for packages.d.o
1212 debug_print = "R: packages for $local_part@$domain"
1214 file_transport = address_file
1215 pipe_transport = address_pipe
1216 domains = packages.debian.org
1217 require_files = /org/packages.debian.org/conf/maintainer
1218 data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
1219 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1220 transport_home_directory = /org/packages.debian.org/mail
1221 transport_current_directory = /org/packages.debian.org/mail
1223 retry_use_local_part
1229 if nodeinfo['bugsmaster'] or nodeinfo['bugsmx']
1230 domain = 'bugs.debian.org'
1231 if nodeinfo['bugsmaster']
1232 domain = 'bugs-master.debian.org'
1235 # This router delivers for bugs.d.o
1237 debug_print = "R: bugs for $local_part@$domain"
1239 transport = bugs_pipe
1240 domains = ' + domain + '
1241 cannot_route_message = Unknown or archived bug
1242 require_files = /org/bugs.debian.org/mail/run-procmail
1244 local_parts = ${if match\
1246 {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|help|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
1247 {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1248 {$local_part}fail}}fail}
1253 <% if nodeinfo['rtmaster'] %>
1254 # This router delivers for rt.d.o
1255 rt_force_new_verbose:
1256 debug_print = "R: rt for $local_part+new@$domain"
1258 domains = rt.debian.org
1259 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1260 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1261 local_part_suffix = +new
1262 pipe_transport = rt_pipe
1263 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}}"
1264 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1266 # FIXME: figure out how to generalize this approach so that all of the following would work
1267 # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose)
1268 # - rt+NNNN-quiesce@rt.debian.org : attach correspondence to ticket (quiesce)
1269 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1270 # requires modification to custom condition in 'scrips'
1271 rt_force_new_quiesce:
1272 debug_print = "R: rt for $local_part+new-quiesce@$domain"
1274 domains = rt.debian.org
1275 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1276 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1277 local_part_suffix = +new-quiesce
1278 pipe_transport = rt_pipe
1279 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}}"
1280 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce"
1283 debug_print = "R: rt for $local_part@$domain"
1285 domains = rt.debian.org
1286 require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1287 local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1288 local_part_suffix = +*
1289 local_part_suffix_optional
1290 pipe_transport = rt_pipe
1291 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}}"
1292 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1296 # exim4 fails the router if it can't change to the user/group for delivery
1297 # during verification. So we have to seperate the cases of verifying
1298 # the virts, and delivering to them. blah.
1301 debug_print = "R: virt_direct for $local_part@$domain"
1307 directory_transport = address_directory
1308 domains = +virtual_domains
1309 file = $home/.forward-\
1310 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1312 file_transport = address_file
1313 pipe_transport = address_pipe
1314 reply_transport = address_reply
1315 retry_use_local_part
1316 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1317 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1320 # This is a senmailesque alias file lookup
1322 debug_print = "R: virt_aliases for $local_part@$domain"
1326 data = ${if exists{\
1327 ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1328 {${lookup{$local_part}lsearch*{\
1329 ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1331 directory_transport = address_directory
1332 domains = +virtual_domains
1333 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1334 cannot_route_message = Unknown user
1335 group = ${extract{group}{VDOMAINDATA}}
1336 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1337 pipe_transport = address_pipe
1338 qualify_preserve_domain
1339 retry_use_local_part
1340 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1341 transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1342 user = ${extract{user}{VDOMAINDATA}}
1344 # This is a qmailesque deliver into a directory of .forward files
1346 debug_print = "R: virt_direct for $local_part@$domain"
1352 directory_transport = address_directory
1353 domains = +virtual_domains
1354 file = $home/.forward-\
1355 ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1357 file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1358 group = ${extract{group}{VDOMAINDATA}}
1359 headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1361 pipe_transport = address_pipe
1362 reply_transport = address_reply
1363 retry_use_local_part
1364 router_home_directory = ${extract{directory}{VDOMAINDATA}}
1365 transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1367 user = ${extract{user}{VDOMAINDATA}}
1368 #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1370 ######################################################################
1371 # TRANSPORTS CONFIGURATION #
1372 ######################################################################
1373 # ORDER DOES NOT MATTER #
1374 # Only one appropriate transport is called for each delivery. #
1375 ######################################################################
1380 # This transport is used for local delivery to user mailboxes. On debian
1381 # systems group mail is used so we can write to the /var/mail
1382 # directory. (The alternative, which most other unixes use, is to deliver
1383 # as the user's own group, into a sticky-bitted directory)
1386 file = /var/mail/${local_part}
1389 no_mode_fail_narrower
1392 # This transport is used for handling pipe addresses generated by alias
1393 # or .forward files. It has a conventional name, since it is not actually
1394 # mentioned elsewhere in this configuration file. (A different name *can*
1395 # be specified via the "address_pipe_transport" option if you really want
1396 # to.) If the pipe generates any standard output, it is returned to the sender
1397 # of the message as a delivery error. Set return_fail_output instead if you
1398 # want this to happen only when the pipe fails to complete normally.
1402 current_directory = ${home}
1403 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1404 EXT=${substr_1:${local_part_suffix}}:\
1405 LOCAL=${local_part}${local_part_suffix}:\
1406 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1410 # This transport is used for handling file addresses generated by alias
1411 # or .forward files. It has a conventional name, since it is not actually
1412 # mentioned elsewhere in this configuration file.
1422 directory_mode = 0770
1423 mode_fail_narrower = false
1425 # This transport is used for handling file addresses generated by alias
1426 # or .forward files if the path ends in "/", which causes it to be treated
1427 # as a directory name rather than a file name. Each message is then delivered
1428 # to a unique file in the directory. If instead you want all such deliveries to
1429 # be in the "maildir" format that is used by some other mail software,
1430 # uncomment the final option below. If this is done, the directory specified
1431 # in the .forward or alias file is the base maildir directory.
1433 # Should you want to be able to specify either maildir or non-maildir
1434 # directory-style deliveries, then you must set up yet another transport,
1435 # called address_directory2. This is used if the path ends in "//" so should
1436 # be the one used for maildir, as the double slash suggests another level
1437 # of directory. In the absence of address_directory2, paths ending in //
1438 # are passed to address_directory.
1448 # This transport is used for handling autoreplies generated by the filtering
1449 # option of the forwardfile director. It has a conventional name, since it
1450 # is not actually mentioned elsewhere in this configuration file.
1454 # This transport is used for delivering messages over SMTP connections.
1458 connect_timeout = 1m
1459 delay_after_cutoff = false
1460 <%= if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true" %>
1461 tls_certificate = /etc/exim4/ssl/thishost.crt
1462 tls_privatekey = /etc/exim4/ssl/thishost.key
1467 if not nodeinfo['smarthost'].empty?
1469 remote_smtp_smarthost:
1470 debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1472 delay_after_cutoff = false
1474 out += nodeinfo['smarthost_port'].to_s + "\n"
1475 if has_variable?("exim_ssl_certs") && exim_ssl_certs == "true"
1476 out += ' tls_tempfail_tryclear = false
1477 hosts_require_tls = ' + nodeinfo['smarthost'] + '
1478 tls_certificate = /etc/exim4/ssl/thishost.crt
1479 tls_privatekey = /etc/exim4/ssl/thishost.key
1485 # Send the message to procmail
1488 command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1490 user = ${local_part}
1499 user = ${extract{user}{\
1500 ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1504 <% if nodeinfo['bugsmaster'] or nodeinfo['bugsmx'] %>
1507 command = /org/bugs.debian.org/mail/run-procmail
1508 environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1509 EXT=${substr_1:${local_part_suffix}}:\
1510 LOCAL=${local_part}${local_part_suffix}:\
1511 RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1517 <% if nodeinfo['rtmaster'] %>
1519 debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1522 environment = EXTENSION=${substr_1:${local_part_suffix}}
1523 allow_commands = /usr/bin/rt-mailgate
1527 ######################################################################
1528 # RETRY CONFIGURATION #
1529 ######################################################################
1531 # This single retry rule applies to all domains and all errors. It specifies
1532 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1533 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1534 # hours, then retries every 8 hours until 4 days have passed since the first
1537 # Domain Error Retries
1538 # ------ ----- -------
1543 debian.org * F,2h,10m; G,16h,2h,1.5; F,14d,8h
1544 * * senders=: F,2h,10m
1545 * rcpt_4xx F,2h,5m; F,4h,10m; F,4d,15m
1546 * * F,2h,15m; G,16h,2h,1.5; F,4d,8h
1548 # End of Exim 4 configuration