eximconf: remove explicit inclusion of 82.195.75.76
[mirror/dsa-puppet.git] / modules / exim / templates / eximconf.erb
1 ##
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
4 ##
5
6 # This is the main exim4 configuration file based on the 28.08.05 version by
7 # ametzler
8
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.
12
13 # This configuration file brings in the necessary information from
14 # other databases stored in /etc/exim4/ and the files distributed by ud-ldap
15
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 
18 # settings.
19
20 # The configuration files in /etc/exim4 are as follows:
21 #  locals - This is a list of domains that are considered local. A local
22 #           domain is essentially one for which deliveries to /var/mail
23 #           will be attempted. The users available for local delivery
24 #           come from /etc/passwd and /etc/aliases. Wildcards are not
25 #           permitted.
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 useful for emergency '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 @is_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
41 #           that list.
42 <%- end -%>
43
44 # From /var/lib/misc / UD:
45 #
46 # mail-forward.cdb - aliases for @d.o
47 # user-forward.cdb - aliases for @thishost.d.o
48
49 # Exim's wildcard mechanism is a bit odd in that to say "any address in
50 # debian.org including debian.org" you must use two patterns,
51 #   *.debian.org
52 #   debian.org
53 # Also you can only place a * before a . and as the first char in a string.
54 # Wildcards always match last so they may be used as a catchall.
55
56 # Further details can be found in each of the files.
57
58 # Useful Exim commands:
59 #  exim4 -qf  - Try sending all messages right now, including frozen ones
60 #  exim4 -bt foo@blah - Write what Exim would do if it saw the address
61 #                      Great for testing virtual domains and forward files
62
63 # Special Features for users:
64 # .forward-foo - is understood as an extension address for bar-foo@cow.com
65 # .forward-default - is understood to be a catch all for bar-*@cow.com
66 # .procmailrc - with no .forward file invokes procmail for delivery
67 #               automatically.
68
69 # For virtual domains the first lookup is done against a linear text
70 # database called 'aliases', then .forward files are consulted. Exim
71 # filtering is available for these .forward files only. .forward-default
72 # is the universal catch all for everything not handled.
73
74 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
75 # will trigger things like rcpt to rate limiting or possibly a reject if
76 # enough hits are triggered).
77 #
78 # value is stored in acl_c_scr
79
80 ######################################################################
81 #                    MAIN CONFIGURATION SETTINGS                     #
82 ######################################################################
83
84 <%- if @heavy -%>
85  perl_startup = do '/etc/exim4/exim_surbl.pl'
86 <%- end -%>
87
88 # These options specify the Access Control Lists (ACLs) that
89 # are used for incoming SMTP messages - after the RCPT and DATA
90 # commands, respectively.
91
92 acl_smtp_helo = check_helo
93 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
94 acl_smtp_data = check_message
95 <%- if @heavy -%>
96 acl_smtp_mime = acl_check_mime
97 <%- end -%>
98 acl_smtp_predata = acl_check_predata
99
100 # accept domain literal syntax in e-mail addresses. To actually make use of
101 # this a router is also required
102 allow_domain_literals = true
103
104 # This setting defines a named domain list called
105 # local_domains. It will be referenced
106 # later on by the syntax "+local_domains".
107 # Other domain and host lists may follow.
108 # @ is the local FQDN, @[] matches the IP adress of any local interface.
109
110 domainlist local_domains = @ : \
111     @[] : \
112     localhost : \
113     ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
114
115 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
116
117 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
118
119 domainlist bsmtp_domains = ${if exists {/etc/exim4/bsmtp}{partial-lsearch;/etc/exim4/bsmtp}{}}
120
121 domainlist handled_domains = +local_domains : +virtual_domains : +bsmtp_domains
122
123 domainlist ourself_and_handled = $primary_hostname : +handled_domains
124
125 localpartlist local_only_users = lsearch;/etc/exim4/localusers
126
127 localpartlist postmasterish = postmaster : abuse : hostmaster
128
129 hostlist debianhosts = <; ; 127.0.0.1 ; ::1 ; /var/lib/misc/thishost/debianhosts ; 89.16.166.49 ; 2001:41b8:202:deb:bab5:0:52c3:4b4c
130
131 hostlist reservedaddrs = 0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/24 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5
132
133 <%- if @is_mailrelay -%>
134 # Domains we relay for; that is domains that aren't considered local but we 
135 # accept mail for them.
136 domainlist mailhubdomains = lsearch;/etc/exim4/manualroute
137
138 <%- end -%>
139 tls_certificate = /etc/exim4/ssl/thishost.crt
140 tls_privatekey = /etc/exim4/ssl/thishost.key
141 tls_try_verify_hosts = *
142 tls_verify_certificates = /etc/exim4/ssl/ca.crt
143 tls_crl = /etc/exim4/ssl/ca.crl
144
145 # The setting below causes Exim to do a reverse DNS lookup on all incoming
146 # IP calls, in order to get the true host name. If you feel this is too
147 # expensive, you can specify the networks for which a lookup is done, or
148 # remove the setting entirely.
149 host_lookup = *
150 # dns_ipv4_lookup = !localhost (disabled upon sgrans request, zobel, 2010-03-16)
151
152 # If this option is set, then any process that is running as one of the
153 # listed users may pass a message to Exim and specify the sender's
154 # address using the "-f" command line option, without Exim's adding a
155 # "Sender" header.
156
157 untrusted_set_sender = *
158
159 # Some spam scanners (*cough* irritated *cough*) want the Sender field
160 # to exist.  Appease them by not actually adding a Sender field.
161
162 local_from_check = false
163
164 # Some operating systems use the "gecos" field in the system password file
165 # to hold other information in addition to users' real names. Exim looks up
166 # this field when it is creating "sender" and "from" headers. If these options
167 # are set, Exim uses "gecos_pattern" to parse the gecos field, and then
168 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
169 # by the pattern.
170
171 gecos_pattern = ^([^,:]*)
172 gecos_name = $1
173
174 # This tells Exim to immediately discard error messages (ie double bounces).
175 ignore_bounce_errors_after = 0s
176 auto_thaw = 1d
177 timeout_frozen_after=14d
178
179 message_size_limit = 100M
180 message_logs = false
181 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
182 <%- if @heavy -%>
183 smtp_accept_max = 300
184 smtp_accept_queue = 200
185 smtp_accept_queue_per_connection = 50
186 smtp_accept_reserve = 25
187 <%- else -%>
188 smtp_accept_max = 30
189 smtp_accept_queue = 20
190 smtp_accept_queue_per_connection = 10
191 smtp_accept_reserve = 5
192 <%- end -%>
193 smtp_reserve_hosts = +debianhosts
194
195 split_spool_directory = true
196 check_spool_inodes = 200
197 check_spool_space  = 20M
198
199 delay_warning =
200
201 <%- if @heavy -%>
202 message_body_visible = 5000
203 queue_run_max = 50
204 deliver_queue_load_max = 50
205 queue_only_load = 35
206 smtp_load_reserve = 20
207 <%- else -%>
208 queue_run_max = 5
209 <%- if scope.lookupvar('::processorcount').to_s != 'undefined' -%>
210 deliver_queue_load_max = <%= [scope.lookupvar('::processorcount').to_i,2].max * 5 %>
211 queue_only_load = <%= [scope.lookupvar('::processorcount').to_i,2].max * 4 %>
212 <%- else -%>
213 deliver_queue_load_max = 10
214 queue_only_load = 8
215 <%- end -%>
216 <%- end -%>
217 queue_list_requires_admin = false
218
219 <%- if has_variable?("clamd") && @clamd -%>
220 av_scanner = clamd:/var/run/clamav/clamd.ctl
221 <%- end -%>
222
223 <%= 
224 ports = []
225 out = "daemon_smtp_ports = "
226 ports << 25
227 if @mail_port  # if we have an overridden mail_port
228   ports << @mail_port
229 end
230
231 if @is_bugsmx
232   ports << 587
233 end
234
235 if @is_mailrelay
236   ports << @smarthost_port
237 end
238
239 out += ports.uniq.sort.join(" : ")
240 out
241 %>
242
243 admin_groups = adm
244 remote_sort_domains = *.debian.org:*.debian.net
245
246 pipelining_advertise_hosts = !*
247 tls_advertise_hosts = *
248 smtp_enforce_sync = true
249
250 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation +smtp_protocol_error
251
252 received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
253                                  {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
254                                  ${if and {{eq {$tls_certificate_verified}{1}}{def:tls_peerdn}}{from $tls_peerdn (verified)\n\t}}\
255                                  by $primary_hostname ${if def:received_protocol {with $received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}\
256                                  (Exim $version_number)\n\t\
257                                  ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
258                                  id $message_exim_id${if def:received_for {\n\tfor $received_for}}
259
260 # macro definitions.
261 # Do not wrap!
262 MAX_SCAN_SIZE = 256000
263 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
264 VSENDERDOMAINDATA = ${lookup{$sender_address_domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
265 WHITELIST = ${if match_domain{$domain}{+virtual_domains}\
266             {${if exists {${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}\
267             {${lookup{$local_part}lsearch{${extract{directory}{VDOMAINDATA}{${value}/whitelist}}}{$value}{}}}{}}}\
268             {/etc/exim4/whitelist} } : \
269             ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}
270 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
271                        {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
272                        {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
273                        {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \
274                        ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}
275 <%- if @is_rtmaster -%>
276 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
277 <%- end -%>
278
279 keep_environment =
280 add_environment =
281
282 ######################################################################
283 #                        ACL CONFIGURATION                           #
284 ######################################################################
285 begin acl
286
287 acl_spamlovers:
288   # There are a few profiles that don't want much smtp time checking of
289   # mail.  It's easier to track them in one place
290
291   accept  condition      = ${if eq {$acl_m_prf}{PopconMail}}
292   accept  condition      = ${if eq {$acl_m_prf}{BugsMail}}
293   deny
294
295 acl_getprofile:
296
297   # Determine the mail profile for this recipient.
298   # An empty string implies no match has been found.
299
300   warn    set acl_m_rprf = 
301
302   warn    recipients     = survey@popcon.debian.org
303           set acl_m_rprf = PopconMail
304
305   accept  condition      = ${if !eq {$acl_m_rprf}{}}
306
307   warn    local_parts    = +local_only_users
308           domains        = +local_domains
309           hosts          = !+debianhosts
310           set acl_m_rprf = localonly
311
312 <%- if @is_mailrelay -%>
313   warn    local_parts    = +local_only_users
314           domains        = +mailhubdomains
315           hosts          = !+debianhosts
316           set acl_m_rprf = localonly
317
318 <%- end -%>
319   accept  condition      = ${if !eq {$acl_m_rprf}{}}
320
321 <%- if @is_rtmaster -%>
322   warn    domains        = rt.debian.org
323           set acl_m_rprf = RTMail
324
325   accept  condition      = ${if !eq {$acl_m_rprf}{}}
326
327 <%- end -%>
328 <%- if @is_bugsmx -%>
329   warn    domains        = bugs.debian.org
330           set acl_m_rprf = BugsMail
331
332   accept  condition      = ${if !eq {$acl_m_rprf}{}}
333
334 <%- end -%>
335 <%- if @is_packagesmaster -%>
336   warn    domains        = packages.debian.org
337           set acl_m_rprf = PackagesMail
338
339   accept  condition      = ${if !eq {$acl_m_rprf}{}}
340
341 <%- end -%>
342 <%- if @is_packagesqamaster -%>
343   warn    recipients     = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
344           set acl_m_rprf = PTSOwner
345
346   accept  condition      = ${if !eq {$acl_m_rprf}{}}
347
348   warn    senders        = :
349           domains        = packages.qa.debian.org
350           condition      = ${if match{$local_part}{\N^bounces+\N}}
351           set acl_m_rprf = PTSListBounce
352
353   accept  condition      = ${if !eq {$acl_m_rprf}{}}
354
355   warn    domains        = packages.qa.debian.org
356           set acl_m_rprf = PTSMail
357
358   accept  condition      = ${if !eq {$acl_m_rprf}{}}
359
360 <%- end -%>
361   warn    recipients     = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
362           set acl_m_rprf = DBSignedMail
363
364   accept  condition      = ${if !eq {$acl_m_rprf}{}}
365
366   warn    domains        = +virtual_domains
367           condition      = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
368           condition      = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{markup}}
369           set acl_m_rprf = markup
370
371   accept  condition      = ${if !eq {$acl_m_rprf}{}}
372
373   warn    domains        = +virtual_domains
374           condition      = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}}
375           condition      = ${if eq{${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction}}}{$value}{}}}{blackhole}}
376           set acl_m_rprf = blackhole
377
378   accept  condition      = ${if !eq {$acl_m_rprf}{}}
379
380   warn    domains        = +virtual_domains
381           condition      = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
382           condition      = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{markup}}
383           set acl_m_rprf = markup
384
385   accept  condition      = ${if !eq {$acl_m_rprf}{}}
386
387   warn    domains        = +virtual_domains
388           condition      = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}}
389           condition      = ${if eq{${lookup{$local_part}cdb{${extract{directory}{VDOMAINDATA}{${value}/contentinspectionaction.cdb}}}{$value}{}}}{blackhole}}
390           set acl_m_rprf = blackhole
391
392   accept  condition      = ${if !eq {$acl_m_rprf}{}}
393
394   warn    domains        = +local_domains
395           condition      = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{markup}}
396           set acl_m_rprf = markup
397
398   accept  condition      = ${if !eq {$acl_m_rprf}{}}
399
400   warn    domains        = +local_domains
401           condition      = ${if eq{${lookup{$local_part}cdb{/var/lib/misc/${primary_hostname}/mail-contentinspectionaction.cdb}{$value}{}}}{blackhole}}
402           set acl_m_rprf = blackhole
403
404   accept  condition      = ${if !eq {$acl_m_rprf}{}}
405
406   warn    set acl_m_rprf = normal
407
408   accept
409
410 check_helo:
411
412   warn    set acl_c_scr    = 0
413
414 <%- if @is_mailrelay -%>
415   accept  verify   = certificate
416
417 <%- end -%>
418 <%- unless @use_smarthost -%>
419   # These are in HELO acl so that they are only run once.  They increment a counter,
420   # so we don't want it to increment per rcpt to.
421
422   warn    dnslists       = list.dnswl.org&0.0.0.3
423           log_message    = Hit on list.dnswl.org for $sender_host_address
424           set acl_c_scr  = ${eval:$acl_c_scr-30}
425
426   warn    dnslists       = list.dnswl.org&0.0.0.2
427           log_message    = Hit on list.dnswl.org for $sender_host_address
428           set acl_c_scr  = ${eval:$acl_c_scr-20}
429
430   warn    dnslists       = list.dnswl.org
431           log_message    = Hit on list.dnswl.org for $sender_host_address
432           set acl_c_scr  = ${eval:$acl_c_scr-10}
433
434   warn    condition      = ${if isip {$sender_helo_name}}
435           log_message    = remote host used IP address in HELO/EHLO greeting
436           set acl_c_scr  = ${eval:$acl_c_scr+20}
437
438   warn    !hosts         = +debianhosts
439           condition      = ${if eq{$host_lookup_failed}{1}}
440           set acl_c_scr  = ${eval:$acl_c_scr+20}
441
442   warn    !hosts         = +debianhosts
443           condition      = ${if eq{$host_lookup_failed}{0}}
444           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}}
445           set acl_c_scr  = ${eval:$acl_c_scr+20}
446
447   warn    !hosts         = +debianhosts
448           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}}
449           set acl_c_scr  = ${eval:$acl_c_scr+20}
450
451   warn    !hosts         = +debianhosts
452           dnslists       = dul.dnsbl.sorbs.net
453           set acl_c_scr  = ${eval:$acl_c_scr+15}
454
455   # If the sender's helo name is empty, the message will be rejected later
456   # because the helo is empty.  If the rDNS lookup failed, we are already
457   # going to greylist them, so no sense worrying about it here.  Finally,
458   # if rDNS does not match helo name (both lower cased first), greylist.
459
460   warn    !hosts         = +debianhosts
461           condition      = ${if !eq {$host_lookup_failed}{1}}
462           condition      = ${if def:sender_helo_name}
463           condition      = ${if !eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}}
464           log_message    = HELO doesn't match rDNS
465           set acl_c_scr  = ${eval:$acl_c_scr+8}
466
467   # Regexes of doom
468   # matches 098325879 - looks fishy
469
470   warn condition        = ${if and { \
471                                      { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
472                                      { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
473                                     } \
474                             }
475        log_message      = non-FQDN HELO
476        set acl_c_scr    = ${eval:$acl_c_scr+12}
477
478   # Matches DOMAIN99.com - looks bad
479
480   warn condition       = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
481        log_message     = SHOUTING HELO
482        set acl_c_scr   = ${eval:$acl_c_scr+7}
483
484   # Random HELO (run of 7 consonants) (constructed by viruses).  We purposefully
485   # skip matching on machines named .*smtp.*, since that's 4 already.  This is a fairly
486   # naive test, so it's not worth much
487
488   warn condition       = ${if !match {${lc:$sender_helo_name}}{smtp}}
489        condition       = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
490        condition       = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
491        log_message     = random HELO
492        set acl_c_scr   = ${eval:$acl_c_scr+5}
493
494 <%- else -%>
495   drop !hosts          = +debianhosts
496        log_message     = mail from non-d.o host
497        message         = Interesting.  I doubt that should have happened.
498
499 <%- end -%>
500   # Implicit, but simpler to just say it
501   accept
502
503 #!!# ACL that is used after the RCPT command on the submission port
504 check_submission:
505
506   accept  hosts = +debianhosts
507
508 <%- if @is_mailrelay -%>
509   accept  verify   = certificate
510
511 <%- end -%>
512   # Defer after too many bad RCPT TO's.  Legit MTAs will retry later.
513   # This is a rough pass at preventing address harvesting or other mail blasts.
514
515   defer  log_message   = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
516          message       = Too many bad recipients, try again later
517          condition     = ${if > {${eval:$rcpt_fail_count}}{3}}
518
519   defer
520           ratelimit      = 5 / 60m / per_rcpt / $sender_host_address
521           !hosts         = +debianhosts
522           message        = sorry, only 5 reports per hour for submission
523
524   accept  domains  = +local_domains
525           hosts    = +debianhosts
526           endpass
527           verify   = recipient
528
529 <%- if @is_mailrelay -%>
530   accept  domains  = +mailhubdomains
531           endpass
532           verify   = recipient/callout=30s,defer_ok,use_sender,no_cache
533
534 <%- end -%>
535   accept  domains  = +submission_domains
536           endpass
537           verify   = recipient
538
539   deny    message = relay not permitted
540
541 #!!# ACL that is used after the RCPT command
542 check_recipient:
543
544 <%- if @is_mailrelay -%>
545   accept  verify   = certificate
546
547 <%- end -%>
548   accept  hosts = <; ::1 ; 127.0.0.1 ; @
549   warn    acl           = acl_getprofile
550           condition     = ${if eq{$acl_m_prf}{}}
551           set acl_m_prf = $acl_m_rprf
552
553   defer   condition     = ${if !eq{$acl_m_prf}{$acl_m_rprf}}
554           message       = Different profile, please retry
555           log_message   = Only one profile at a time, please
556
557   # Defer after too many bad RCPT TO's.  Legit MTAs will retry later.
558   # This is a rough pass at preventing address harvesting or other mail blasts.
559
560   defer  log_message   = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
561          !acl          = acl_spamlovers
562          message       = Too many bad recipients, try again later
563          !hosts        = +debianhosts
564          condition     = ${if > {${eval:$rcpt_fail_count}}{3}}
565
566   # Dump spambots that are so stupid they say helo as our IP address
567
568   drop   !hosts        = +debianhosts
569          !acl          = acl_spamlovers
570          condition     = ${if eq {$sender_helo_name}{$interface_address}}
571          message       = HELO mismatch Forged HELO for ($sender_helo_name)
572
573   # Also for spambots that say helo as us or one of our domains
574
575   drop   !hosts        = +debianhosts
576          !acl          = acl_spamlovers
577          condition     = ${if match_domain{$sender_helo_name}{+ourself_and_handled}}
578          condition     = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
579          message       = HELO mismatch Forged HELO for ($sender_helo_name)
580
581   # This logic gives you a list of commonly forged domains in helo to reject against
582
583   warn set acl_m_frg   = ${lookup{$sender_helo_name} \
584                            nwildlsearch{/etc/exim4/helo-check} \
585                           {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
586
587   # This is a failsafe in case DNS fails - we defer instead of hard reject if they 
588   # say helo as a name in the list but we can't look them up
589
590   defer  !hosts        = +debianhosts
591          !acl          = acl_spamlovers
592          condition     = ${if !eq{$acl_m_frg}{}}
593          condition     = ${if eq{$sender_host_name}{}}
594          condition     = ${if !eq{$host_lookup_failed}{1}}
595          message       = Access temporarily denied. Resolve failed PTR for $sender_host_address
596
597   # If DNS works, go ahead and reject them
598
599   drop   !hosts        = +debianhosts
600          !acl          = acl_spamlovers
601          condition     = ${if and { {!eq{$acl_m_frg}{}}{!match{$sender_host_name}{${rxquote:$acl_m_frg}\N$\N}}}}
602          message       = HELO mismatch Forged HELO for ($sender_helo_name)
603
604   # disabled accounts don't even get local mail.
605   deny   domains       = +virtual_domains
606          condition    = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}\
607                                      {${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{true}{false}}}\
608                                      {}}
609          message       = ${lookup{${extract{1}{-}{$local_part}}}lsearch{${extract{directory}{VDOMAINDATA}{${value}/mail-disable}}}{$value}}
610
611   deny   local_parts   = lsearch;/var/lib/misc/$primary_hostname/mail-disable
612          domains       = +local_domains
613          message       = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
614
615   deny   domains       = +virtual_domains
616          local_parts   = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
617                                      {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
618                                      {}}
619          hosts         = !+debianhosts
620          message       = mail for <$local_part@$domain> only accepted from debian.org machines
621
622   # Accept if the source is local SMTP (i.e. not over TCP/IP).
623   # We do this by testing for an empty sending host field.
624   accept  hosts = :
625   
626   deny    domains       = +handled_domains
627           local_parts   = ^[.] : ^.*[@%!/|]
628   
629   deny    domains       = !+handled_domains
630           local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
631
632   deny    condition     = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
633           sender_domains= +local_domains
634           hosts         = !+debianhosts
635           message       = mail from <$sender_address> not allowed externally
636
637   deny    sender_domains= +virtual_domains
638           condition     = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}}
639           condition     = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/localusers}}}{true}}
640           hosts         = !+debianhosts
641           message       = mail from <$sender_address> not allowed externally
642
643   deny    condition     = ${if match_domain{$sender_address_domain}{+virtual_domains}}
644           condition     = ${if exists {${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}}
645           condition     = ${lookup{$sender_address_local_part}lsearch{${extract{directory}{VSENDERDOMAINDATA}{${value}/neversenders}}}{true}}
646           message       = no mail should ever come from <$sender_address>
647
648   warn    condition     = ${if eq{$acl_m_prf}{localonly}}
649           set acl_m_lrc = ${if eq{$acl_m_lrc}{}{$local_part@$domain}{$acl_m_lrc, $local_part@$domain}}
650
651 <%- if @is_packagesmaster -%>
652   warn    condition      = ${if eq {$acl_m_prf}{PackagesMail}}
653           condition      = ${if eq {$sender_address}{$local_part@$domain}}
654           message        = X-Packages-FromTo-Same: yes
655
656 <%- end -%>
657   deny    condition      = ${if !eq {$acl_m_prf}{PopconMail}}
658           !verify        = sender
659
660   defer   !hosts         = +debianhosts
661           condition      = ${if !eq {$acl_m_prf}{PopconMail}}
662           condition      = ${if >{${eval:$acl_c_scr+0}}{0}}
663           ratelimit      = 10 / 60m / per_rcpt / $sender_host_address
664           message        = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
665
666 <%- if has_variable?("policydweight") && @policydweight -%>
667   # Check with policyd-weight
668   warn  !hosts         = +debianhosts
669         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
670         set acl_m_pw   = ${readsocket{inet:127.0.0.1:12525}\
671                           {request=smtpd_access_policy\n\
672                            protocol_state=RCPT\n\
673                            protocol_name=${uc:$received_protocol}\n\
674                            helo_name=$sender_helo_name\n\
675                            queue_id=$message_exim_id\n\
676                            sender=$sender_address\n\
677                            recipient=$local_part@$domain\n\
678                            recipient_count=$rcpt_count\n\
679                            client_address=$sender_host_address\n\
680                            client_name=$sender_host_name\n\
681                            reverse_client_name=$sender_host_name\n\
682                            instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
683                           {20s}{\n}{socket failure}}
684
685   # Defer on socket error
686   defer !hosts         = +debianhosts
687         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
688         condition      = ${if eq{$acl_m_pw}{socket failure}}
689         message        = Cannot connect to policyd-weight. Please try again later.
690
691   # Set proposed action to $acl_m_act and message to $acl_m_mes
692   warn  !hosts         = +debianhosts
693         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
694         set acl_m_mes  = ${extract{action}{$acl_m_pw}}
695         set acl_m_act  = ${sg{$acl_m_pw}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
696
697   # Add X-policyd-weight header line to message
698   warn  !hosts         = +debianhosts
699         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
700         message        = $acl_m_mes
701         condition      = ${if eq{$acl_m_act}{PREPEND}}
702
703   # Write log message, if policyd-weight can't run checks
704   warn  !hosts         = +debianhosts
705         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
706         log_message    = policyd-weight message: $acl_m_mes
707         condition      = ${if eq{$acl_m_act}{DUNNO}}
708
709   # Deny mails which policyd-weight thinks are spam
710   deny  !hosts         = +debianhosts
711         condition      = ${if !eq {$acl_m_prf}{PopconMail}}
712         message        = policyd-weight said: $acl_m_mes
713         condition      = ${if eq{$acl_m_act}{550}}
714
715   # Defer messages when policyd-weight suggests so.
716   defer  !hosts         = +debianhosts
717          condition      = ${if !eq {$acl_m_prf}{PopconMail}}
718          message        = policyd-weight said: $acl_m_mes
719          condition      = ${if eq{$acl_m_act}{450}}
720
721 <%- end -%>
722 <%- if @is_rtmaster -%>
723   warn    condition     = ${if eq{$acl_m_prf}{RTMail}}
724           set acl_m12   = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}{match{$local_part}{3520}}{match{$local_part}{3645}}} {RTMailRecipientHasSubaddress}}}}
725   # temporary hack because weasel screwed up and gave people an rt-3520@ address, which doesn't really work normally.  and rt-3645
726   #set acl_m12  = ${if def:acl_m12 {$acl_m12} {${if or{{match{$local_part}{\N[^+]+\+\d+\N}}{match{$local_part}{\N[^+]+\+new\N}}} {RTMailRecipientHasSubaddress}}}}
727
728
729 <%- end -%>
730 <%- if has_variable?("greylistd") && @greylistd -%>
731   defer
732     message  = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
733     log_message = greylisted.
734     local_parts    = ${if match_domain{$domain}{+virtual_domains}\
735                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
736                      {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
737                      {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
738                      ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
739     !senders       = :
740     !hosts         = : +debianhosts : WHITELIST : \
741                      ${if exists {/etc/greylistd/whitelist-hosts}\
742                                  {/etc/greylistd/whitelist-hosts}{}} : \
743                      ${if exists {/var/lib/greylistd/whitelist-hosts}\
744                                  {/var/lib/greylistd/whitelist-hosts}{}} 
745     condition      = ${if !eq {$acl_m_prf}{PopconMail}}
746     !authenticated = *
747     domains        = +handled_domains
748     condition      = ${readsocket{/var/run/greylistd/socket}\
749                                  {--grey \
750                                   $sender_host_address \
751                                   $sender_address \
752                                   $local_part@$domain}\
753                                  {5s}{}{false}}
754
755 <%- elsif has_variable?("postgrey") && @postgrey -%>
756   # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
757   # this adds acl_m_grey if there isn't one (so unique per message)
758   warn
759     !senders       = :
760     !hosts         = : +debianhosts : WHITELIST
761     condition      = ${if !eq {$acl_m_prf}{PopconMail}}
762     condition      = ${if ! def:acl_m_grey}
763     set acl_m_grey = $pid.$tod_epoch.$sender_host_port
764
765   # and defers the message if postgrey thinks it should be defered ...
766   defer
767     !senders       = :
768     !hosts         = : +debianhosts : WHITELIST
769     condition      = ${if !eq {$acl_m_prf}{PopconMail}}
770     !authenticated = *
771     domains        = +handled_domains
772     local_parts    = GREYLIST_LOCAL_PARTS
773     set acl_m_pgr  = request=smtpd_access_policy\n\
774                      protocol_state=RCPT\n\
775                      protocol_name=${uc:$received_protocol}\n\
776                      instance=${acl_m_grey}\n\
777                      helo_name=${sender_helo_name}\n\
778 <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
779                      client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
780 <%- else -%>
781                      client_address=${sender_host_address}\n\
782 <%- end -%>
783                      client_name=${sender_host_name}\n\
784                      sender=${sender_address}\n\
785                      recipient=$local_part@$domain\n\n
786     set acl_m_pgr  = ${sg{\
787                          ${readsocket{/var/run/postgrey/socket}{$acl_m_pgr}\
788                                {5s}{}{action=DUNNO}}\
789                      }{action=}{}}
790     message        = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
791     log_message    = greylisted.
792     condition      = ${if eq{${uc:${substr{0}{5}{$acl_m_pgr}}}}{DEFER}}
793
794  # ... or adds a header with information about how long the delay was
795  warn
796     !senders       = :
797     !hosts         = : +debianhosts : WHITELIST
798     condition      = ${if !eq {$acl_m_prf}{PopconMail}}
799     !authenticated = *
800     domains        = +handled_domains
801     local_parts    = GREYLIST_LOCAL_PARTS
802     condition      = ${if eq{${uc:${substr_0_7:$acl_m_pgr}}}{PREPEND}}
803     message        = ${sg{$acl_m_pgr}{^\\w+\\s*}{}}
804
805 <%- end -%>
806   deny    hosts        = ${if exists{/etc/exim4/host_blacklist}{/etc/exim4/host_blacklist}{}}
807           message      = I'm terribly sorry, but it seems you have been blacklisted
808           log_message  = blacklisted IP
809
810   deny   log_message   = <$sender_address> is blacklisted
811          senders       = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
812          message       = We have blacklisted <$sender_address>.  Please stop mailing us
813
814   accept  local_parts   = +postmasterish
815           domains       = +virtual_domains : +bsmtp_domains
816
817 <%- unless @use_smarthost -%>
818   deny    message  = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
819           dnslists = ${if match_domain{$domain}{+virtual_domains}\
820                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
821                      {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
822                      {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
823                      ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
824           domains       = +handled_domains
825           !hosts        = +debianhosts : WHITELIST
826
827 <%- end -%>
828   deny    message  = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
829           dnslists = ${if match_domain{$domain}{+virtual_domains}\
830                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
831                      {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
832                      {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
833                      ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
834           domains       = +handled_domains
835           !hosts        = +debianhosts : WHITELIST
836
837 <%- unless @use_smarthost -%>
838   deny    domains  = +handled_domains
839           local_parts = ${if match_domain{$domain}{+virtual_domains}\
840                         {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
841                         {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
842                         {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}}}} : \
843                         ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}
844           !hosts   = +debianhosts : WHITELIST
845           !verify  = sender/callout=90s,maxwait=300s
846           message  = "Sender verification failed: $acl_verify_message"
847
848 <%- end -%>
849 <%- if @is_mailrelay -%>
850   accept  domains  = +mailhubdomains
851           endpass
852           verify   = recipient/callout=30s,defer_ok,use_sender,no_cache
853
854 <%- end -%>
855   accept  domains  = +handled_domains
856           endpass
857           verify   = recipient/defer_ok
858
859   accept  hosts         = +debianhosts
860
861   accept  authenticated = *
862
863   deny    message = relay not permitted
864
865 <%- if @heavy -%>
866 acl_check_mime:
867
868  accept  verify        = certificate
869  accept  hosts         = +debianhosts
870
871  discard condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
872          condition     = ${if eq {$acl_m_prf}{blackhole}}
873          set acl_m_srb = ${perl{surblspamcheck}}
874          condition     = ${if !eq{$acl_m_srb}{false}}
875          log_message   = discarded surbl message for $recipients
876
877   deny   condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
878          condition     = ${if !eq {$acl_m_prf}{markup}}
879          condition     = ${if !eq {$acl_m_prf}{PopconMail}}
880          set acl_m_srb = ${perl{surblspamcheck}}
881          condition     = ${if !eq{$acl_m_srb}{false}}
882          log_message   = $acl_m_srb
883          message       = $acl_m_srb
884
885   warn   condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
886          condition     = ${if eq {$acl_m_prf}{markup}}
887          set acl_m_srb = ${perl{surblspamcheck}}
888          condition     = ${if !eq{$acl_m_srb}{false}}
889          message       = X-Surbl-Hit: $primary_hostname: $acl_m_srb
890
891   accept
892
893 <%- end -%>
894 acl_check_predata:
895   deny   condition     = ${if eq{$acl_m_prf}{localonly}}
896          message       = mail for $acl_m_lrc is only accepted internally
897
898   accept
899
900
901 #!!# ACL that is used after the DATA command
902 check_message:
903
904   # Some people put from postmaster@something.debian.org in the From
905   # header.  Take their crack pipe away.
906   drop   condition = ${if match{${lc:$h_From:}}{\Npostmaster@([^.]+\.)?debian\.org\N}}
907
908 <%- if @is_rtmaster -%>
909   deny    condition = ${if eq {$acl_m_prf}{RTMail}}
910           condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
911                                {!match {${lc:$rh_Subject:]}} {\N\[rt.debian.org \N}} \
912                                {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
913           message  = messages to the Request Tracker system require a subject tag or a subaddress
914
915 <%- end -%>
916 <%- if @is_packagesqamaster -%>
917   deny    !hosts  = +debianhosts
918           condition = ${if eq {$acl_m_prf}{PTSMail}}
919           condition = ${if !def:h_X-PTS-Approved:}
920           message   = messages to the PTS require an X-PTS-Approved header
921
922 <%- end -%>
923   deny    condition      = ${if eq {$acl_m_prf}{DBSignedMail}}
924           condition      = ${if and {{!match {$message_body}{PGP MESSAGE}}              \
925                                      {!match {$message_body}{PGP SIGNED MESSAGE}}       \
926                                      {!match {$message_body}{PGP SIGNATURE}}            \
927                                      {!match {$header_content-type:}{multipart/signed}} \
928                                      {!match {$header_content-type:}{pgp}}              \
929                                     }                                                   \
930                             }
931           message        = Mail to this address needs to be PGP-signed
932
933   accept  verify    = certificate
934   accept  hosts     = +debianhosts
935
936   deny    condition = ${if !eq {$acl_m_prf}{PopconMail}}
937           !verify   = header_syntax
938           message   = Invalid header syntax: $acl_verify_message
939
940 # RFC 822 and 2822 say that headers must be ASCII.  This kinda emulates
941 # postfix's strict_7bit_headers option, but only checks a few common problem
942 # headers, as there doesn't appear to be an easy way to check them all.
943   deny
944           condition       = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
945                                  {match {$rh_To:}{[\200-\377]}}\
946                                  {match {$rh_From:}{[\200-\377]}}\
947                                  {match {$rh_Cc:}{[\200-\377]}}}}
948           condition       = ${if !eq {$acl_m_prf}{PopconMail}}
949           message         = improper use of 8-bit data in message header: message rejected
950
951   deny
952           condition       = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}}
953           condition       = ${if !eq {$acl_m_prf}{PopconMail}}
954           message         = Your mailer is not RFC 2047 compliant: message rejected
955
956 <%- if has_variable?("clamd") && @clamd -%>
957   discard condition       = ${if eq {$acl_m_prf}{blackhole}}
958   <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
959           demime          = *
960   <%- end -%>
961           malware         = */defer_ok
962           log_message     = discarded malware message for $recipients
963
964   deny    condition       = ${if !eq {$acl_m_prf}{markup}}
965           condition       = ${if !eq {$acl_m_prf}{PopconMail}}
966   <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
967           demime          = *
968   <%- end -%>
969           malware         = */defer_ok
970           message         = malware detected: $malware_name: message rejected
971
972   warn    condition       = ${if eq {$acl_m_prf}{markup}}
973   <%- if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0 -%>
974           demime          = *
975   <%- end -%>
976           malware         = */defer_ok
977           message         = X-malware detected: $malware_name
978
979 <%- end -%>
980 <%- if @heavy -%>
981  discard condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
982          condition     = ${if eq {$acl_m_prf}{blackhole}}
983          set acl_m_srb = ${perl{surblspamcheck}}
984          condition     = ${if !eq{$acl_m_srb}{false}}
985          log_message   = discarded surbl message for $recipients
986
987   deny   condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
988          condition     = ${if !eq {$acl_m_prf}{markup}}
989          condition     = ${if !eq {$acl_m_prf}{PopconMail}}
990          set acl_m_srb = ${perl{surblspamcheck}}
991          condition     = ${if !eq{$acl_m_srb}{false}}
992          log_message   = $acl_m_srb
993          message       = $acl_m_srb
994
995   warn   condition     = ${if <{$message_size}{MAX_SCAN_SIZE}}
996          condition     = ${if eq {$acl_m_prf}{markup}}
997          set acl_m_srb = ${perl{surblspamcheck}}
998          condition     = ${if !eq{$acl_m_srb}{false}}
999          message       = X-Surbl-Hit: $primary_hostname: $acl_m_srb
1000
1001 <%- end -%>
1002   # Check header_sender except for survey@popcon.d.o
1003   deny    condition    = ${if !eq{$acl_m_prf}{PopconMail}}
1004           !verify      = header_sender
1005           message      = No valid sender found in the From:, Sender: and Reply-to: headers
1006
1007 <%- if @is_packagesmaster -%>
1008   deny  message        = Congratulations, you scored $spam_score points.
1009         log_message    = spam: $spam_score points.
1010         condition      = ${if eq {$acl_m_prf}{PackagesMail}}
1011         !authenticated = *
1012         !verify        = certificate
1013         !hosts         = +debianhosts
1014         condition      = ${if <{$message_size}{MAX_SCAN_SIZE}}
1015         spam           = pkg_user : true
1016         condition      = ${if >{$spam_score_int}{59}}
1017
1018 <%- end -%>
1019   accept
1020
1021
1022
1023 ######################################################################
1024 #                      REWRITE CONFIGURATION                         #
1025 ######################################################################
1026
1027
1028
1029 begin rewrite
1030
1031 \N^buildd_(.*)@fasolo\.debian\.org$\N buildd_$1@buildd.debian.org T
1032 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1033 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
1034 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
1035
1036
1037 #!!#######################################################!!#
1038 #!!# Here follow routers created from the old routers,   #!!#
1039 #!!# for handling non-local domains.                     #!!#
1040 #!!#######################################################!!#
1041
1042 begin routers
1043
1044
1045
1046 ######################################################################
1047 #                      ROUTERS CONFIGURATION                         #
1048 #                Specifies how addresses are handled                 #
1049 ######################################################################
1050 #                          ORDER DOES MATTER                         #
1051 #     An address is passed to each in turn until it is accepted.     #
1052 ######################################################################
1053
1054 <%- if @is_mailrelay -%>
1055 relay_manualroute:
1056   driver = manualroute
1057   domains = +mailhubdomains
1058   transport = remote_smtp
1059   route_data = ${lookup{$domain}lsearch{/etc/exim4/manualroute}}
1060   require_files = /etc/exim4/manualroute
1061
1062 <%- end -%>
1063 bsmtp:
1064   debug_print = "R: bsmtp for $local_part@$domain"
1065   driver = manualroute
1066   domains = +bsmtp_domains
1067   require_files = /etc/exim4/bsmtp
1068   route_list = * ${extract{file}{\
1069                    ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1070                      {$value}fail}}}
1071   transport = bsmtp
1072
1073 # This router routes to remote hosts over SMTP by explicit IP address,
1074 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
1075 # require this facility, which is why it is enabled by default in Exim.
1076 ipliteral:
1077   debug_print = "R: ipliteral for $local_part@$domain"
1078   driver = ipliteral
1079   domains = !+handled_domains
1080   transport = remote_smtp
1081   ignore_target_hosts = +reservedaddrs
1082
1083 <%- if @use_smarthost -%>
1084 smarthost:
1085   debug_print = "R: smarthost for $local_part@$domain"
1086   driver = manualroute
1087   domains = !+handled_domains
1088   transport = remote_smtp_smarthost
1089   route_list = * <%= @smarthost %>
1090   host_find_failed = defer
1091   same_domain_copy_routing = yes
1092   no_more
1093 <%- end -%>
1094
1095 # This router routes to remote hosts over SMTP using a DNS lookup.
1096 # Ignore reserved network responses, including localhost.
1097 dnslookup:
1098   debug_print = "R: dnslookup for $local_part@$domain"
1099   driver = dnslookup
1100   domains = !+handled_domains
1101   transport = remote_smtp
1102   ignore_target_hosts = +reservedaddrs
1103   no_more
1104
1105 postmasterish:
1106   debug_print = "R: postmasterish for $local_part@$domain"
1107   driver = redirect
1108   verify = false
1109   unseen = true
1110   expn = true
1111   local_parts = +postmasterish
1112   domains = +virtual_domains : +bsmtp_domains
1113   data = debian-admin@debian.org
1114   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1115
1116 # This router handles aliasing using a traditional /etc/aliases file.
1117 # If any of your aliases expand to pipes or files, you will need to set
1118 # up a user and a group for these deliveries to run under. You can do
1119 # this by uncommenting the "user" option below (changing the user name
1120 # as appropriate) and adding a "group" option if necessary.
1121
1122 system_aliases:
1123   debug_print = "R: system_aliases for $local_part@$domain"
1124   driver = redirect
1125   allow_defer
1126   allow_fail
1127   data = ${lookup{$local_part}lsearch*{/etc/aliases}}
1128   domains = +local_domains
1129   file_transport = address_file
1130   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1131   pipe_transport = address_pipe
1132   retry_use_local_part
1133
1134 # This router handles forwarding using traditional .forward files.
1135 # It also allows mail filtering when a forward file starts with the 
1136 # string "# Exim filter": to disable filtering, uncomment the "filter" 
1137 # option. The check_ancestor option means that if the forward file 
1138 # generates an address that is an ancestor of the current one, the 
1139 # current one gets passed on instead. This covers the case where A is 
1140 # aliased to B and B has a .forward file pointing to A.
1141
1142 # For standard Debian setup of one group per user, it is acceptable---normal
1143 # even---for .forward to be group writable. If you have everyone in one
1144 # group, you should comment out the "modemask" line. Without it, the Exim
1145 # default of 022 will apply, which is probably what you want.
1146
1147 userforward_verify:
1148   debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1149   driver = redirect
1150   check_ancestor
1151   user = Debian-exim
1152   no_check_local_user
1153   directory_transport = address_directory
1154   domains = +local_domains
1155   # filter - I have disabled filtering to force users to use .forward-foo files
1156   # or procmail. This will make it easier to move mailers in the future
1157   #
1158   # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1159   # also checks if the .forward-bar exists, if not then it uses
1160   # .forward-default instead.
1161   file = $home/.forward\
1162          ${if eq{}{$local_part_suffix}{}{\
1163            ${if exists {${home}/.forward${local_part_suffix}} \
1164              {${local_part_suffix}}{-default}}\
1165            }\
1166           }
1167   file_transport = address_file
1168   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1169   local_part_suffix = -*
1170   local_part_suffix_optional
1171   modemask = 002
1172   pipe_transport = address_pipe
1173   reply_transport = address_reply
1174   require_files = $home
1175   router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
1176   verify_only
1177
1178 # This is a sendmailesque alias file lookup
1179 virt_aliases:
1180   debug_print = "R: virt_aliases for $local_part@$domain"
1181   driver = redirect
1182   allow_defer
1183   allow_fail
1184   data = ${if exists{\
1185            ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
1186            {${lookup{$local_part}lsearch*{\
1187               ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
1188            }}}}
1189   directory_transport = address_directory
1190   domains = +virtual_domains
1191   file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1192   cannot_route_message = Unknown user
1193   group = ${extract{group}{VDOMAINDATA}}
1194   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1195   pipe_transport = address_pipe
1196   qualify_preserve_domain
1197   retry_use_local_part
1198   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1199   transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1200   user = ${extract{user}{VDOMAINDATA}}
1201   
1202 # No direct match, so try doing a regex match if there's an
1203 # aliases.regex
1204 virt_aliases_regex:
1205   debug_print = "R: virt_aliases_regex for $local_part$local_part_suffix@$domain"
1206   driver = redirect
1207   allow_defer
1208   allow_fail
1209   data = ${if exists{\
1210            ${extract{directory}{VDOMAINDATA}{${value}/aliases.regex}}}\
1211            {${lookup{$local_part}nwildlsearch*{\
1212               ${extract{directory}{VDOMAINDATA}{$value/aliases.regex}}\
1213            }}}}
1214   directory_transport = address_directory
1215   domains = +virtual_domains
1216   file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1217   cannot_route_message = Unknown user
1218   group = ${extract{group}{VDOMAINDATA}}
1219   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1220   pipe_transport = address_pipe
1221   qualify_preserve_domain
1222   retry_use_local_part
1223   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1224   transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1225   user = ${extract{user}{VDOMAINDATA}}
1226
1227 userforward:
1228   debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
1229   driver = redirect
1230   check_ancestor
1231   check_local_user
1232   directory_transport = address_directory
1233   domains = +local_domains
1234   # filter - I have disabled filtering to force users to use .forward-foo files
1235   # or procmail. This will make it easier to move mailers in the future
1236   #
1237   # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
1238   # also checks if the .forward-bar exists, if not then it uses
1239   # .forward-default instead.
1240   file = $home/.forward\
1241          ${if eq{}{$local_part_suffix}{}{\
1242            ${if exists {${home}/.forward${local_part_suffix}} \
1243              {${local_part_suffix}}{-default}}\
1244            }\
1245           }
1246   file_transport = address_file
1247   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1248   local_part_suffix = -*
1249   local_part_suffix_optional
1250   modemask = 002
1251   pipe_transport = address_pipe
1252   reply_transport = address_reply
1253   require_files = $home
1254   no_verify
1255
1256 # This delivers to procmail
1257 procmail:
1258   debug_print = "R: procmail for $local_part@$domain"
1259   driver = accept
1260   check_local_user
1261   domains = +local_domains
1262   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1263   local_part_suffix = -*
1264   local_part_suffix_optional
1265   no_verify
1266   no_expn
1267   require_files = $local_part:$home/.procmailrc
1268   transport = procmail_pipe
1269   transport_current_directory = $home
1270   
1271 # This driver delivers to the LDAP generated alias file.
1272 ldap_aliases:
1273   debug_print = "R: ldap_aliases for $local_part@$domain"
1274   driver = redirect
1275   allow_defer
1276   allow_fail
1277   data = ${if exists{/var/lib/misc/$primary_hostname/user-forward.cdb}\
1278              {${lookup{$local_part}cdb\
1279                {/var/lib/misc/$primary_hostname/user-forward.cdb}}}}
1280   domains = +local_domains
1281   file_transport = address_file
1282   local_part_suffix = -*
1283   local_part_suffix_optional
1284   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1285   pipe_transport = address_pipe
1286   retry_use_local_part
1287   
1288 # This director matches local user mailboxes.
1289 localuser:
1290   debug_print = "R: localuser for $local_part@$domain"
1291   driver = accept
1292   check_local_user
1293   domains = +local_domains
1294   local_part_suffix = -*
1295   local_part_suffix_optional
1296   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1297   # Disable if the user has never logged in
1298   require_files = $home
1299   transport = local_delivery
1300   no_more
1301
1302 # Now we begin the Virtual Domain configuration
1303 # Everything before here should apply only to the local domains with a 
1304 # domains= rule
1305
1306 <%- if @is_packagesmaster -%>
1307 # This router delivers for packages.d.o
1308 packages:
1309   debug_print = "R: packages for $local_part@$domain"
1310   driver = redirect
1311   file_transport = address_file
1312   pipe_transport = address_pipe
1313   domains = packages.debian.org
1314   require_files = /srv/packages.debian.org/conf/maintainer
1315   data = ${lookup{$local_part}cdb{/srv/packages.debian.org/conf/maintainer.cdb}}
1316   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1317   transport_home_directory = /srv/packages.debian.org/mail
1318   transport_current_directory = /srv/packages.debian.org/mail
1319   check_ancestor
1320   retry_use_local_part
1321   no_more
1322
1323 <%- end -%>
1324 <%- if @is_rtmaster -%>
1325 # This router delivers for rt.d.o
1326 rt_force_new_verbose:
1327   debug_print = "R: rt for $local_part+new@$domain"
1328   driver = redirect
1329   domains = rt.debian.org
1330   require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1331   local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1332   local_part_suffix = +new
1333   pipe_transport = rt_pipe
1334   data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1335   headers_remove = Subject
1336   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?is)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1337
1338 # FIXME: figure out how to generalize this approach so that all of the following would work
1339 # - rt+NNNN@rt.debian.org          : attach correspondence to ticket (verbose)
1340 # - rt+NNNN-quiesce@rt.debian.org  : attach correspondence to ticket (quiesce)
1341 # - rt+NNNN-<action>@rt.debian.org : attach correspondence to ticket (some action)
1342 # requires modification to custom condition in 'scrips'
1343 rt_force_new_quiesce:
1344   debug_print = "R: rt for $local_part+new-quiesce@$domain"
1345   driver = redirect
1346   domains = rt.debian.org
1347   require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1348   local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1349   local_part_suffix = +new-quiesce
1350   pipe_transport = rt_pipe
1351   data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
1352   headers_remove = Subject
1353   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?is)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1354
1355 rt_otherwise:
1356   debug_print = "R: rt for $local_part@$domain"
1357   driver = redirect
1358   domains = rt.debian.org
1359   require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
1360   local_parts = ${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
1361   local_part_suffix = +*
1362   local_part_suffix_optional
1363   pipe_transport = rt_pipe
1364   data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{${if match{$local_part}{.*-done.*}{correspond-resolve}{correspond}}}}"
1365   headers_remove = Subject
1366   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{(?i)(.*?)\\\\[?debian rt\\\\]?[:\\s]*(.*)}}} {$1$2}{$h_subject:}}"
1367 <%- end -%>
1368
1369 # Exim fails the router if it can't change to the user/group for delivery
1370 # during verification.  So we have to separate the cases of verifying
1371 # the virts, and delivering to them.  blah.
1372
1373 virt_direct_verify:
1374   debug_print = "R: virt_direct for $local_part@$domain"
1375   driver = redirect
1376   no_check_local_user
1377   user = Debian-exim
1378   allow_filter
1379   modemask = 002
1380   directory_transport = address_directory
1381   domains = +virtual_domains
1382   local_part_suffix = -*
1383   local_part_suffix_optional
1384   file = $home/.forward-\
1385               ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1386                    {default}}
1387   file_transport = address_file
1388   pipe_transport = address_pipe
1389   reply_transport = address_reply
1390   retry_use_local_part
1391   router_home_directory = ${extract{directory}{VDOMAINDATA}}
1392   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1393   verify_only
1394
1395 # This is a qmailesque deliver into a directory of .forward files
1396 virt_direct:
1397   debug_print = "R: virt_direct for $local_part@$domain"
1398   driver = redirect
1399   allow_filter
1400   allow_fail
1401   allow_defer
1402   no_check_local_user
1403   directory_transport = address_directory
1404   domains = +virtual_domains
1405   file = $home/.forward-\
1406               ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1407                    {default}}
1408   file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1409   group = ${extract{group}{VDOMAINDATA}}
1410   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1411   modemask = 002
1412   local_part_suffix = -*
1413   local_part_suffix_optional
1414   pipe_transport = address_pipe
1415   reply_transport = address_reply
1416   retry_use_local_part
1417   router_home_directory = ${extract{directory}{VDOMAINDATA}}
1418   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1419   no_verify
1420   user = ${extract{user}{VDOMAINDATA}}
1421   #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1422
1423 # This router delivers to the LDAP generated mail-forward file.
1424 # It's only really useful for debian.org
1425 virt_users:
1426   debug_print = "R: virt_users for $local_part@$domain"
1427   driver = redirect
1428   allow_defer
1429   allow_fail
1430   router_home_directory = ${extract{directory}{VDOMAINDATA}}
1431   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1432   user = ${extract{user}{VDOMAINDATA}}
1433   group = ${extract{group}{VDOMAINDATA}}
1434   # Manually construct the forwarding address, preserving the
1435   # local_part_suffix if the remote host is master.
1436   data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}\
1437                      {! eq {${lookup{$local_part}cdb\
1438                             {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1439                            {}}}\
1440              {${local_part:${lookup{$local_part}cdb\
1441              {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}\
1442              ${if eq {${domain:${lookup{$local_part}cdb\
1443              {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}{master.debian.org}{$local_part_suffix} {}}\
1444              @\
1445              ${domain:${lookup{$local_part}cdb\
1446             {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.cdb}}}}}}}
1447   domains = +virtual_domains
1448   file_transport = address_file
1449   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1450   pipe_transport = address_pipe
1451   local_part_suffix = -*
1452   local_part_suffix_optional
1453   retry_use_local_part
1454
1455 <%- if @is_bugsmx -%>
1456 # This router delivers for bugs.d.o
1457 bugs:
1458   debug_print = "R: bugs for $local_part@$domain"
1459   driver = accept
1460   transport = bugs_pipe
1461   domains = bugs.debian.org
1462   cannot_route_message = Unknown or archived bug
1463   require_files = /srv/bugs.debian.org/mail/run-procmail
1464   no_more
1465   local_parts = ${if match\
1466                   {$local_part}\
1467                   {\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}\
1468                {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
1469                {$local_part}fail}}fail}
1470 <%- end -%>
1471 ######################################################################
1472 #                      TRANSPORTS CONFIGURATION                      #
1473 ######################################################################
1474 #                       ORDER DOES NOT MATTER                        #
1475 #     Only one appropriate transport is called for each delivery.    #
1476 ######################################################################
1477
1478
1479 begin transports
1480
1481 # This transport is used for local delivery to user mailboxes. On Debian
1482 # systems group mail is used so we can write to the /var/mail
1483 # directory. (The alternative, which most other unixes use, is to deliver
1484 # as the user's own group, into a sticky-bitted directory)
1485 local_delivery:
1486   driver = appendfile
1487   file = /var/mail/${local_part}
1488   group = mail
1489   mode = 0660
1490   no_mode_fail_narrower
1491   return_path_add
1492   
1493 # This transport is used for handling pipe addresses generated by alias
1494 # or .forward files. It has a conventional name, since it is not actually
1495 # mentioned elsewhere in this configuration file. (A different name *can*
1496 # be specified via the "address_pipe_transport" option if you really want
1497 # to.) If the pipe generates any standard output, it is returned to the sender
1498 # of the message as a delivery error. Set return_fail_output instead if you
1499 # want this to happen only when the pipe fails to complete normally.
1500
1501 address_pipe:
1502   driver = pipe
1503   current_directory = ${home}
1504   environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1505                  EXT=${substr_1:${local_part_suffix}}:\
1506                  LOCAL=${local_part}${local_part_suffix}:\
1507                  RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1508   return_output
1509   return_path_add
1510
1511 # This transport is used for handling file addresses generated by alias
1512 # or .forward files. It has a conventional name, since it is not actually
1513 # mentioned elsewhere in this configuration file.
1514
1515 address_file:
1516   driver = appendfile
1517   return_path_add
1518
1519 address_file_group:
1520   driver = appendfile
1521   return_path_add
1522   mode = 0660
1523   directory_mode = 0770
1524   mode_fail_narrower = false
1525
1526 # This transport is used for handling file addresses generated by alias
1527 # or .forward files if the path ends in "/", which causes it to be treated
1528 # as a directory name rather than a file name. Each message is then delivered
1529 # to a unique file in the directory. If instead you want all such deliveries to
1530 # be in the "maildir" format that is used by some other mail software,
1531 # uncomment the final option below. If this is done, the directory specified
1532 # in the .forward or alias file is the base maildir directory.
1533 #
1534 # Should you want to be able to specify either maildir or non-maildir
1535 # directory-style deliveries, then you must set up yet another transport,
1536 # called address_directory2. This is used if the path ends in "//" so should
1537 # be the one used for maildir, as the double slash suggests another level
1538 # of directory. In the absence of address_directory2, paths ending in //
1539 # are passed to address_directory.
1540
1541 address_directory:
1542   driver = appendfile
1543   check_string = 
1544   maildir_format
1545   message_prefix = ""
1546   message_suffix = ""
1547   return_path_add
1548
1549 # This transport is used for handling autoreplies generated by the filtering
1550 # option of the forwardfile director. It has a conventional name, since it
1551 # is not actually mentioned elsewhere in this configuration file.
1552 address_reply:
1553   driver = autoreply
1554
1555 # This transport is used for delivering messages over SMTP connections.
1556
1557 remote_smtp:
1558   driver = smtp
1559   connect_timeout = 15s
1560   delay_after_cutoff = false
1561   tls_certificate = /etc/exim4/ssl/thishost.crt
1562   tls_privatekey = /etc/exim4/ssl/thishost.key
1563
1564 <%- if @use_smarthost -%>
1565 remote_smtp_smarthost:
1566   debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
1567   driver = smtp
1568   delay_after_cutoff = false
1569   port = <%= @smarthost_port %>
1570   tls_tempfail_tryclear = false
1571   hosts_require_tls = <%= @smarthost %>
1572   tls_certificate = /etc/exim4/ssl/thishost.crt
1573   tls_privatekey = /etc/exim4/ssl/thishost.key
1574 <%- end -%>
1575 # Send the message to procmail
1576 procmail_pipe:
1577   driver = pipe
1578   command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}
1579   return_path_add
1580   user = ${local_part}
1581
1582 bsmtp:
1583   driver = appendfile
1584   batch_max = 100
1585   file = ${host}
1586   message_prefix = 
1587   message_suffix = 
1588   use_bsmtp
1589   user = ${extract{user}{\
1590                    ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1591                      {$value}fail}\
1592                    }}
1593
1594 <%- if @is_bugsmx -%>
1595 bugs_pipe:
1596   driver = pipe
1597   command = /srv/bugs.debian.org/mail/run-procmail
1598   environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1599                  EXT=${substr_1:${local_part_suffix}}:\
1600                  LOCAL=${local_part}${local_part_suffix}:\
1601                  RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1602   return_path_add
1603   return_output
1604   user = debbugs
1605
1606 <%- end -%>
1607 <%- if @is_rtmaster -%>
1608 rt_pipe:
1609   debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1610   driver = pipe
1611   return_fail_output
1612   environment = EXTENSION=${substr_1:${local_part_suffix}}
1613   allow_commands = /usr/bin/rt-mailgate
1614
1615 <%- end -%>
1616
1617 ######################################################################
1618 #                      RETRY CONFIGURATION                           #
1619 ######################################################################
1620
1621 # This single retry rule applies to all domains and all errors. It specifies
1622 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1623 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1624 # hours, then retries every 8 hours until 4 days have passed since the first
1625 # failed delivery.
1626
1627 # Domain               Error       Retries
1628 # ------               -----       -------
1629
1630
1631 begin retry
1632
1633 debian.org             *           F,2h,10m; G,16h,2h,1.5; F,14d,8h
1634 *                      * senders=: F,2h,10m
1635 *                      rcpt_4xx    F,2h,5m;  F,4h,10m; F,4d,15m
1636 *                      *           F,2h,15m; G,16h,2h,1.5; F,4d,8h
1637
1638 # End of Exim 4 configuration