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