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