6c4fecb9fe9db2369683ab3740ad994547967551
[mirror/dsa-puppet.git] / modules / exim / files / common / exim4.conf
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 # It is hand crafted, do not replace with anything generated by a config
9 # tool!
10 # It is installed as part of the debian.org package -- don't edit this file
11
12 # The configuration file uses a set of macros and rules to generate an
13 # acceptable mail environment for debian.org machines. It deviates
14 # considerably from what could be considered a standard exim configuration.
15
16 # This configuration file brings in the necessary information from
17 # other databases stored in /etc/exim/ right now these are linear text
18 # databases.
19
20 # This file is independent of the local host, it should not be changed
21 # per machine. primary_hostname is used in all places that require per-host 
22 # settings.
23
24 # The configuration files in /etc/exim are as follows:
25 #  locals - This is a list of domains that are considered local. A local
26 #           domain is essential one that deliveries to /var/mail
27 #           will be attempted. The users available for local delivery
28 #           comes from /etc/passwd and /etc/aliases. Wildcards are not
29 #           permitted.
30 #  virtualdomains - This is a list of all virtual domains. A virtual domain
31 #           is much like a local domain, execpt that the delivery location
32 #           and allowed set of users is controlled by a virtual domain
33 #           alias file and not /etc/passwd. Wildcards are permitted
34 #  rcpthosts - recipient hosts or relay domains. This is a list of
35 #           all hosts that we mail exchange for. All domains that list
36 #           this host in their MX records should be listed here. Wildcards
37 #           are permitted.
38 #  relayhosts - Hostnames that can send any arbitarily addressed mail to
39 #           us. This is primarily only usefull for emergancy 'queue
40 #           flushing' operations, but should be populated with a list
41 #           of trusted machines. Wildcards are not permitted
42 # The division of files is designed so that all hosts may share rcpthosts
43 # and relayhosts, these could be replicated automatically if necessary.
44
45 # Exim's wildcard mechanism is a bit odd in that to say "any address in
46 # debian.org including debian.org" you must use two patterns,
47 #   *.debian.org
48 #   debian.org
49 # Also you can only place a * before a . and as the first char in a string.
50 # Wildcards always match last so they may be used as a catchall.
51
52 # Further details can be found in each of the files.
53
54 # Usefull exim commands:
55 #  exim4 -qf  - Try sending all messages right now, including frozen ones
56 #  exim4 -bt foo@blah - Write what exim would do if it saw the address
57 #                      Great for testing virtual domains and forward files
58
59 # Special Features for users:
60 # .forward-foo - is understood as an extension address for bar-foo@cow.com
61 # .forward-default - is understood to be a catch all for bar-*@cow.com
62 # .procmailrc - with no .forward file invokes procmail for delivery
63 #               automatically.
64
65 # For virtual domains the first lookup is done against a linear text
66 # database called 'aliases', then .forward files are consulted. Exim
67 # filtering is available for these .forward files only. .forward-default
68 # is the universal catch all for everything not handled.
69
70 # Heuristic check (none bad enough to cause a hard reject, but in aggregate
71 # will trigger things like rcpt to rate limiting or possibly a reject if
72 # enough hits are triggered.
73 #
74 # value is stored in acl_c1
75
76 ######################################################################
77 #                    MAIN CONFIGURATION SETTINGS                     #
78 ######################################################################
79
80 # These options specify the Access Control Lists (ACLs) that
81 # are used for incoming SMTP messages - after the RCPT and DATA
82 # commands, respectively.
83
84 acl_smtp_helo = check_helo
85 acl_smtp_rcpt = ${if ={$interface_port}{587} {check_submission}{check_recipient}}
86 acl_smtp_data = check_message
87
88 # accept domain literal syntax in e-mail addresses. To actually make use of
89 # this a router is also required
90 allow_domain_literals = true
91
92 # This setting defines a named domain list called
93 # local_domains. It will be referenced
94 # later on by the syntax "+local_domains".
95 # Other domain and host lists may follow.
96 # @ is the local FQDN, @[] matches the IP adress of any local interface.
97
98 .include_if_exists /etc/exim4/local-auto.conf
99 .include_if_exists /etc/exim4/local-settings.conf
100
101 domainlist local_domains = @ : \
102     @[] : \
103     localhost : \
104     ${if exists {/etc/exim4/locals}{lsearch;/etc/exim4/locals}}
105
106 domainlist virtual_domains = partial-lsearch;/etc/exim4/virtualdomains
107
108 domainlist submission_domains = ${if exists {/etc/exim4/submission-domains}{/etc/exim4/submission-domains}{}}
109
110 domainlist handled_domains = +local_domains : +virtual_domains
111
112 localpartlist local_only_users = lsearch;/etc/exim4/localusers
113
114 # Domains we relay for; that is domains that aren't considered local but we 
115 # accept mail for them.
116 domainlist rcpthosts = partial-lsearch;/etc/exim4/rcpthosts
117 hostlist debianhosts = 127.0.0.1 : net-lsearch;/var/lib/misc/thishost/debianhosts
118
119 .ifndef RESERVEDADDRS
120 RESERVEDADDRS = 0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : \
121                 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : \
122                 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5
123 .endif
124
125 hostlist reservedaddrs = RESERVEDADDRS
126
127 tls_certificate = /etc/exim4/ssl/thishost.crt
128 tls_privatekey = /etc/exim4/ssl/thishost.key
129 .ifdef RELAY_HOST
130 tls_try_verify_hosts = *
131 tls_verify_certificates = /etc/exim4/ssl/ca.crt
132 tls_crl = /etc/exim4/ssl/ca.crl
133 .endif
134
135 #system_filter = /etc/exim4/filter
136 #system_filter_file_transport = address_file
137
138 # The setting below causes Exim to do a reverse DNS lookup on all incoming
139 # IP calls, in order to get the true host name. If you feel this is too
140 # expensive, you can specify the networks for which a lookup is done, or
141 # remove the setting entirely.
142 host_lookup = *
143 dns_ipv4_lookup = !localhost
144
145 # If this option is set, then any process that is running as one of the
146 # listed users may pass a message to Exim and specify the sender's
147 # address using the "-f" command line option, without Exim's adding a
148 # "Sender" header.
149
150 #trusted_users = mail
151 #trusted_users = mail : www-data : ${if exists{/home/qa}{qa}{}}
152 untrusted_set_sender = *
153
154 # Some operating systems use the "gecos" field in the system password file
155 # to hold other information in addition to users' real names. Exim looks up
156 # this field when it is creating "sender" and "from" headers. If these options
157 # are set, exim uses "gecos_pattern" to parse the gecos field, and then
158 # expands "gecos_name" as the user's name. $1 etc refer to sub-fields matched
159 # by the pattern.
160
161 gecos_pattern = ^([^,:]*)
162 gecos_name = $1
163
164 # This tells exim to immediately discard error messages (ie double bounces).
165 ignore_bounce_errors_after = 0s
166 auto_thaw = 1d
167 timeout_frozen_after=14d
168
169 message_size_limit = 100M
170 message_logs = false
171 smtp_accept_max = 300
172 smtp_accept_max_per_host = ${if match_ip {$sender_host_address}{+debianhosts}{0}{7}}
173 smtp_accept_queue = 200
174 smtp_accept_queue_per_connection = 50
175 smtp_accept_reserve = 25
176 smtp_reserve_hosts = +debianhosts
177
178 split_spool_directory = true
179 check_spool_inodes = 200
180 check_spool_space  = 20M
181
182 delay_warning =
183
184 queue_run_max = 50
185 deliver_queue_load_max = 50
186 queue_only_load = 15
187 queue_list_requires_admin = false
188
189 .ifdef CLAMAV
190 av_scanner = CLAMAV
191 .endif
192
193 .ifdef HAVE_USER_DEBBUGS
194 daemon_smtp_ports = 25 : 587
195 .endif
196
197 admin_groups = adm
198 remote_sort_domains = *.debian.org:*.debian.net
199
200 pipelining_advertise_hosts = !*
201 tls_advertise_hosts = *
202 smtp_enforce_sync = true
203
204 log_selector = +tls_cipher +tls_peerdn +queue_time +deliver_time +smtp_connection +smtp_incomplete_transaction +smtp_confirmation
205
206 # macro definitions.
207 # Do not wrap!
208 VDOMAINDATA = ${lookup{$domain}partial-lsearch{/etc/exim4/virtualdomains}{$value}}
209 WHITELIST = ${if match_domain{$domain}{+virtual_domains}{\
210                ${if exists {/srv/$domain/mail/whitelist}{\
211                 ${lookup{$local_part}lsearch{/srv/$domain/mail/whitelist}{$value}{}}\
212                 }{}}\
213                }{${lookup{$local_part}lsearch{/etc/exim4/whitelist}{$value}{}} : ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-whitelist}{$value}{}}}}
214 GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
215                        {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
216                        {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
217                        {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
218                        ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
219 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
220
221 ######################################################################
222 #                        ACL CONFIGURATION                           #
223 ######################################################################
224 begin acl
225
226 check_helo:
227
228   warn    set acl_c1    = 0
229   # These are in HELO acl so that they are only run once.  They increment a counter,
230   # so we don't want it to increment per rcpt to.
231
232   warn    dnslists       = list.dnswl.org&0.0.0.3
233           log_message    = Hit on list.dnswl.org for $sender_host_address
234           set acl_c1     = ${eval:$acl_c1-30}
235
236   warn    dnslists       = list.dnswl.org&0.0.0.2
237           log_message    = Hit on list.dnswl.org for $sender_host_address
238           set acl_c1     = ${eval:$acl_c1-20}
239
240   warn    dnslists       = list.dnswl.org
241           log_message    = Hit on list.dnswl.org for $sender_host_address
242           set acl_c1     = ${eval:$acl_c1-10}
243
244   warn    condition      = ${if isip {$sender_helo_name}{true}{false}}
245           log_message    = remote host used IP address in HELO/EHLO greeting
246           set acl_c1     = ${eval:$acl_c1+20}
247
248   warn    !hosts         = +debianhosts
249           condition      = ${if eq{$host_lookup_failed}{1}}
250           set acl_c1     = ${eval:$acl_c1+20}
251
252   warn    !hosts         = +debianhosts
253           condition      = ${if eq{$host_lookup_failed}{0}}
254           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}}
255           set acl_c1     = ${eval:$acl_c1+20}
256
257   warn    !hosts         = +debianhosts
258           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}}
259           set acl_c1     = ${eval:$acl_c1+20}
260
261   warn    !hosts         = +debianhosts
262           dnslists       = dul.dnsbl.sorbs.net
263           set acl_c1     = ${eval:$acl_c1+15}
264
265   # If the sender's helo name is empty, the message will be rejected later
266   # because the helo is empty.  If the rDNS lookup failed, we are already
267   # going to greylist them, so no sense worrying about it here.  Finally,
268   # if rDNS does not match helo name (both lower cased first), greylist.
269
270   warn    !hosts         = +debianhosts
271           condition      = ${if eq {$host_lookup_failed}{1}{no}{yes}}
272           condition      = ${if def:sender_helo_name {yes}{no}}
273           condition      = ${if eq {${lc:$sender_helo_name}}{${lc:$sender_host_name}}{no}{yes}}
274           log_message    = HELO doesn't match rDNS
275           set acl_c1     = ${eval:$acl_c1+8}
276
277   # Regexes of doom
278   # matches 098325879 - looks fishy
279
280   warn condition        = ${if and { \
281                                      { !match{$sender_helo_name}{\N^\[.+\]$\N} } \
282                                      { !match{$sender_helo_name}{\N^(?i)((?=[^-])[a-z0-9-]*[a-z0-9]\.)+[a-z]{2,6}$\N} } \
283                                     } \
284                             }
285        log_message      = non-FQDN HELO
286        set acl_c1       = ${eval:$acl_c1+12}
287
288   # Matches DOMAIN99.com - looks bad
289
290   warn condition       = ${if match {$sender_helo_name}{\N^[A-Z]+[A-Z0-9\-]+\.[A-Za-z0-9]+$\N}}
291        log_message     = SHOUTING HELO
292        set acl_c1      = ${eval:$acl_c1+7}
293
294   # Random HELO (run of 7 consonants) (constructed by viruses).  We purposefully
295   # skip matching on machines named .*smtp.*, since that's 4 already.  This is a fairly
296   # naive test, so it's not worth much
297
298   warn condition       = ${if match {${lc:$sender_helo_name}}{smtp}{no}{yes}}
299        condition       = ${if match {${lc:$sender_helo_name}}{\N^[a-z0-9]+\.[a-z]+$\N}}
300        condition       = ${if match {${lc:$sender_helo_name}}{\N.*[bcdfghjklmnpqrstvwxz]{7,}.*\.[a-z]+$\N}}
301        log_message     = random HELO
302        set acl_c1      = ${eval:$acl_c1+5}
303
304   # Implicit, but simpler to just say it
305   accept
306
307 #!!# ACL that is used after the RCPT command on the submission port
308 check_submission:
309
310   # Defer after too many bad RCPT TO's.  Legit MTAs will retry later.
311   # This is a rough pass at preventing addres harvesting or other mail blasts.
312
313   defer  log_message   = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
314          message       = Too many bad recipients, try again later
315          condition     = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
316
317   defer
318           ratelimit      = 5 / 60m / per_rcpt / $sender_host_address
319           message        = sorry, only 5 reports per hour for submission
320
321   accept  domains  = +submission_domains
322           endpass
323           message  = unknown user
324           verify   = recipient
325
326   deny    message = relay not permitted
327
328 #!!# ACL that is used after the RCPT command
329 check_recipient:
330
331   # Defer after too many bad RCPT TO's.  Legit MTAs will retry later.
332   # This is a rough pass at preventing addres harvesting or other mail blasts.
333
334   defer  log_message   = Too many bad recipients ${eval:$rcpt_fail_count} out of $rcpt_count
335          message       = Too many bad recipients, try again later
336          !hosts        = +debianhosts
337          condition     = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
338
339   # Dump spambots that are so stupid they say helo as our IP address
340
341   drop !hosts          = +debianhosts
342        condition       = ${if eq {$sender_helo_name}{$interface_address}{yes}{no}}
343        message         = HELO mismatch Forged HELO for ($sender_helo_name)
344
345   # Also for spambots that say helo as us or one of our domains
346
347   drop !hosts          = +debianhosts
348        condition       = ${if match_domain{$sender_helo_name}{$primary_hostname:+handled_domains}}
349        condition       = ${if !match{$sender_host_name}{${rxquote:$sender_helo_name}\N$\N}}
350        message         = HELO mismatch Forged HELO for ($sender_helo_name)
351
352   # This logic gives you a list of commonly forged domains in helo to reject against
353
354   warn set acl_m2      = ${lookup{$sender_helo_name} \
355                            nwildlsearch{/etc/exim4/helo-check} \
356                           {${if eq{$value}{}{$sender_helo_name}{$value}}}{}}
357
358   # This is a failsafe in case DNS fails - we defer instead of hard reject if they 
359   # say helo as a name in the list but we can't look them up
360
361   defer !hosts         = +debianhosts
362         condition      = ${if eq{$acl_m2}{}{no}{yes}}
363         condition      = ${if eq{$sender_host_name}{}{yes}{no}}
364         condition      = ${if eq{$host_lookup_failed}{1}{no}{yes}}
365         message        = Access temporarily denied. Resolve failed PTR for $sender_host_address
366
367   # If DNS works, go ahead and reject them
368
369   drop !hosts          = +debianhosts
370        condition       = ${if and { {!eq{$acl_m2}{}}{!match{$sender_host_name}{${rxquote:$acl_m2}\N$\N}}}{yes}{no}}
371         message        = HELO mismatch Forged HELO for ($sender_helo_name)
372
373   # disabled accounts don't even get local mail.
374   deny    local_parts   = lsearch;/var/lib/misc/$primary_hostname/mail-disable
375           domains       = +local_domains
376           message       = ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-disable}{$value}}
377
378   deny    domains       = +virtual_domains
379           local_parts   = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
380                                       {${extract{directory}{VDOMAINDATA}{${value}/localonly}}}\
381                                       {}}
382           hosts         = !+debianhosts
383           message       = mail for <$local_part@$domain> only accepted from debian.org machines
384   # Accept if the source is local SMTP (i.e. not over TCP/IP).
385   # We do this by testing for an empty sending host field.
386   accept  hosts = :
387   
388   deny    domains       = +handled_domains
389           local_parts   = ^[.] : ^.*[@%!/|]
390   
391   deny    domains       = !+handled_domains
392           local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
393
394 # forwards mail to @d.o address, even if it's a bounce from master, no reply
395 # from source address; rejecting all mail now.
396   deny    recipients    = mendoza@debian.org
397           hosts         = 65.110.39.147 : 64.39.31.15
398           message       = <mendoza@kenny.linuxsis.net> cannot forward here while mailer-daemon mail is not caught
399
400   deny    condition     = ${lookup{$sender_address_local_part}lsearch{/etc/exim4/localusers}{true}}
401           sender_domains= +local_domains : debian.org : debian.net : debian.com
402           hosts         = !+debianhosts
403           message       = mail from <$sender_address> not allowed externally
404
405   deny    condition     = ${if match_domain{$sender_address_domain}{+virtual_domains}{1}{0}}
406           condition     = ${if exists {${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
407           condition     = ${if match_local_part {$sender_address_local_part}{${extract{directory}{VDOMAINDATA}{${value}/neversenders}}}{1}{0}}
408           message       = no mail should ever come from <$sender_address>
409
410   deny    local_parts   = +local_only_users
411           domains       = +local_domains
412           hosts         = !+debianhosts
413           message       = mail for $local_part is only accepted internally
414
415   deny    message  = address $sender_host_address is listed in $dnslist_domain; $dnslist_text
416           hosts    = !+debianhosts
417           dnslists = rbl.debian.net : rbl.debian.net/$sender_address_domain
418
419   deny    !recipients = survey@popcon.debian.org
420           !verify = sender
421
422   defer   !hosts         = +debianhosts
423           condition      = ${if >{${eval:$acl_c1}}{0}}
424           ratelimit      = 10 / 60m / per_rcpt / $sender_host_address
425           message        = slow down (no reverse dns, mismatched ehlo, dialup, or in blacklists)
426
427 .ifdef HAVE_POLICYD
428   # Check with policyd-weight - this only works with a version after etch's,
429   # sadly.  etch's version attempts to hold the socket open, since that's what
430   # postfix expects.  Exim, on the other hand, expects the remote side to close
431   # the socket when it's finished sending data, so it see each transaction as
432   # an incomplete read.  I'm sure there's a way we could force exim to do
433   # something sick and clever to force either the interpretation or the socket
434   # closure, but I'm fairly sure it's now worth it, since the backport of
435   # policyd-weight is trivial.
436   warn  !hosts         = +debianhosts
437         set acl_m9     = ${readsocket{inet:127.0.0.1:12525}\
438                           {request=smtpd_access_policy\n\
439                            protocol_state=RCPT\n\
440                            protocol_name=${uc:$received_protocol}\n\
441                            helo_name=$sender_helo_name\n\
442                            queue_id=$message_exim_id\n\
443                            sender=$sender_address\n\
444                            recipient=$local_part@$domain\n\
445                            recipient_count=$rcpt_count\n\
446                            client_address=$sender_host_address\n\
447                            client_name=$sender_host_name\n\
448                            reverse_client_name=$sender_host_name\n\
449                            instance=$sender_host_address.$sender_address.$sender_helo_name\n\n}\
450                           {20s}{\n}{socket failure}}
451
452   # Defer on socket error
453   defer !hosts         = +debianhosts
454         condition      = ${if eq{$acl_m9}{socket failure}{yes}{no}}
455         message        = Cannot connect to policyd-weight. Please try again later.
456
457   # Set proposed action to $acl_m8 and message to $acl_m7
458   warn  !hosts         = +debianhosts
459         set acl_m8     = ${extract{action}{$acl_m9}}
460         set acl_m7     = ${sg{$acl_m9}{\Naction=[^ ]+ (.*)\n\n\N}{\$1}}
461
462   # Add X-policyd-weight header line to message
463   warn  !hosts         = +debianhosts
464         message        = $acl_m7
465         condition      = ${if eq{$acl_m8}{PREPEND}{yes}{no}}
466
467   # Write log message, if policyd-weight can't run checks
468   warn  !hosts         = +debianhosts
469         log_message    = policyd-weight message: $acl_m7
470         condition      = ${if eq{$acl_m8}{DUNNO}{yes}{no}}
471
472   # Deny mails which policyd-weight thinks are spam
473   deny  !hosts         = +debianhosts
474         message        = policyd-weight said: $acl_m7
475         condition      = ${if eq{$acl_m8}{550}{yes}{no}}
476
477   # Defer messages when policyd-weight suggests so.
478   defer  !hosts         = +debianhosts
479          message        = policyd-weight said: $acl_m7
480          condition      = ${if eq{$acl_m8}{450}{yes}{no}}
481 .endif
482
483   warn    recipients = survey@popcon.debian.org
484           set acl_m1 = PopconMail
485
486   warn    domains  = rt.debian.org
487           set acl_m1 = RTMail
488           set acl_m12 = ${if def:acl_m12 {$acl_m12} {${if match{$local_part}{[^+]+\\+\\d+} {RTMailRecipientHasSubaddress}}}}
489
490   warn    domains  = packages.qa.debian.org
491           set acl_m1 = PTSMail
492
493   warn    recipients = owner@packages.qa.debian.org : postmaster@packages.qa.debian.org
494           set acl_m1 = PTSOwner
495
496   warn    recipients = change@db.debian.org : changes@db.debian.org : chpasswd@db.debian.org : ping@db.debian.org : recommend@nm.debian.org
497           set acl_m1 = DBSignedMail
498
499   warn    senders  = :
500           domains  = packages.qa.debian.org
501           condition = ${if match{$local_part}{\N^bounces+\N}}
502           set acl_m1 = PTSListBounce
503
504 .ifdef USE_GREYLISTING
505 .ifdef HAVE_GREYLIST
506   defer
507     message  = $sender_host_address is not yet authorized to deliver mail from <$sender_address> to <$local_part@$domain>.
508     log_message = greylisted.
509     local_parts    = ${if match_domain{$domain}{+virtual_domains}\
510                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}\
511                      {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
512                      {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}} : \
513                      ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}}}
514     !senders       = :
515     !hosts         = : +debianhosts : WHITELIST : \
516                      ${if exists {/etc/greylistd/whitelist-hosts}\
517                                  {/etc/greylistd/whitelist-hosts}{}} : \
518                      ${if exists {/var/lib/greylistd/whitelist-hosts}\
519                                  {/var/lib/greylistd/whitelist-hosts}{}} 
520     !authenticated = *
521     domains        = +handled_domains : +rcpthosts
522     condition      = ${readsocket{/var/run/greylistd/socket}\
523                                  {--grey \
524                                   $sender_host_address \
525                                   $sender_address \
526                                   $local_part@$domain}\
527                                  {5s}{}{false}}
528 .endif
529 .ifdef HAVE_POSTGREY
530   # next three are greylisting, inspired by http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html
531   # this adds acl_m4 if there isn't one (so unique per message)
532   warn
533     !senders       = :
534     !hosts         = : +debianhosts : WHITELIST
535     condition      = ${if def:acl_m4 {no}{yes}}
536     set acl_m4     = $pid.$tod_epoch.$sender_host_port
537
538   # and defers the message if postgrey thinks it should be defered ...
539   defer
540     !senders       = :
541     !hosts         = : +debianhosts : WHITELIST
542     !authenticated = *
543     domains        = +handled_domains : +rcpthosts
544     local_parts    = GREYLIST_LOCAL_PARTS
545     set acl_m3     = request=smtpd_access_policy\n\
546                      protocol_state=RCPT\n\
547                      protocol_name=${uc:$received_protocol}\n\
548                      instance=${acl_m4}\n\
549                      helo_name=${sender_helo_name}\n\
550                      client_address=${substr_-3:${mask:$sender_host_address/24}}\n\
551                      client_name=${sender_host_name}\n\
552                      sender=${sender_address}\n\
553                      recipient=$local_part@$domain\n\n
554     set acl_m3     = ${sg{\
555                          ${readsocket{/var/run/postgrey/socket}{$acl_m3}\
556                                {5s}{}{action=DUNNO}}\
557                      }{action=}{}}
558     message        = ${sg{$acl_m3}{^\\w+\\s*}{}}
559     log_message    = greylisted.
560     condition      = ${if eq{${uc:${substr{0}{5}{$acl_m3}}}}{DEFER}}
561
562  # ... or adds a header with information about how long the delay was
563  warn
564     !senders       = :
565     !hosts         = : +debianhosts : WHITELIST
566     !authenticated = *
567     domains        = +handled_domains : +rcpthosts
568     local_parts    = GREYLIST_LOCAL_PARTS
569     condition      = ${if eq{${uc:${substr_0_7:$acl_m3}}}{PREPEND}}
570     message        = ${sg{$acl_m3}{^\\w+\\s*}{}}
571 .endif
572 .endif
573
574   accept  local_parts   = postmaster
575           domains       = +handled_domains : +rcpthosts
576
577   deny   log_message   = <$sender_address> is blacklisted
578          senders       = ${if exists{/etc/exim4/blacklist}{/etc/exim4/blacklist}{}}
579          message       = We have blacklisted <$sender_address>.  Please stop mailing us
580
581   deny    message  = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
582           dnslists = ${if match_domain{$domain}{+virtual_domains}\
583                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
584                      {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
585                      {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}} : \
586                      ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}}}
587           domains       = +handled_domains : +rcpthosts
588           !hosts        = +debianhosts : WHITELIST
589
590   deny    message  = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
591           dnslists = ${if match_domain{$domain}{+virtual_domains}\
592                      {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
593                      {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
594                      {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}} : \
595                      ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}}}
596           domains       = +handled_domains : +rcpthosts
597           !hosts        = +debianhosts : WHITELIST
598
599   deny    domains  = +handled_domains : +rcpthosts
600           local_parts   = ${if match_domain{$domain}{+virtual_domains}\
601                            {${if exists {${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}\
602                            {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/callout_users}}}{$local_part}{}}}{}}}\
603                            {${lookup{$local_part}lsearch{/etc/exim4/callout_users}{$local_part}{}} : \
604                            ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-callout}{$local_part}{}}}}
605           !hosts   = +debianhosts : WHITELIST
606           !verify  = sender/callout
607
608   accept  domains  = +handled_domains
609           endpass
610           message  = unknown user
611           verify   = recipient/defer_ok
612
613   accept  domains  = +rcpthosts
614           endpass
615           message  = unrouteable address
616           verify   = recipient
617
618   accept  hosts         = +debianhosts
619
620   accept  authenticated = *
621
622   deny    message = relay not permitted
623
624 #!!# ACL that is used after the DATA command
625 check_message:
626   require verify = header_syntax
627           message = Invalid syntax in the header
628
629   deny    condition = ${if eq {$acl_m1}{RTMail}}
630           condition = ${if and{{!match {${lc:$rh_Subject:}} {debian rt}} \
631                                {!match {${lc:$rh_Subject:]}} {\\[rt.debian.org }} \
632                                {!match {$acl_m12}{RTMailRecipientHasSubaddress}}}}
633           message  = messages to the Request Tracker system require a subject tag or a subaddress
634
635   deny    !hosts  = +debianhosts : 217.196.43.134
636           condition = ${if eq {$acl_m1}{PTSMail}}
637           condition = ${if def:h_X-PTS-Approved:{false}{true}}
638           message   = messages to the PTS require an X-PTS-Approved header
639
640   deny    condition      = ${if match {$message_body}{\Nhttp:\/\/[a-z\.-]+\/video1?.exe\N}}
641           message        = Blackisted URI found in body
642
643   deny    condition      = ${if eq {$acl_m1}{DBSignedMail}}
644           condition      = ${if and {{!match {$message_body}{PGP MESSAGE}}              \
645                                      {!match {$message_body}{PGP SIGNED MESSAGE}}       \
646                                      {!match {$message_body}{PGP SIGNATURE}}            \
647                                      {!match {$header_content-type:}{multipart/signed}} \
648                                      {!match {$header_content-type:}{pgp}}              \
649                                     }                                                   \
650                             }
651           message        = Mail to this address needs to be PGP-signed
652
653 # RFC 822 and 2822 say that headers must be ASCII.  This kinda emulates
654 # postfix's strict_7bit_headers option, but only checks a few common problem
655 # headers, as there doesn't appear to be an easy way to check them all.
656   deny
657           condition       = ${if or {{match {$rh_Subject:}{[\200-\377]}}\
658                                  {match {$rh_To:}{[\200-\377]}}\
659                                  {match {$rh_From:}{[\200-\377]}}\
660                                  {match {$rh_Cc:}{[\200-\377]}}}{true}{false}}
661           message         = improper use of 8-bit data in message header: message rejected
662
663   deny
664           condition       = ${if match {$rh_Subject:}{[^[:print:]]\{8\}}{true}{false}}
665           message         = Your mailer is not RFC 2047 compliant: message rejected
666
667 .ifdef CLAMAV
668   deny    
669           demime          = *
670           malware         = */defer_ok
671           message         = malware detected: $malware_name: message rejected
672 .endif
673
674   deny    spam            = $value/defer_ok
675           domains         = +handled_domains : +rcpthosts
676           message         = message got a spam score of $spam_score
677           local_parts     = ${if exists {/etc/exim4/sa_users}\
678                              {${if match_domain{$domain}{+virtual_domains}\
679                              {${lookup{$local_part@$domain}nwildlsearch{/etc/exim4/sa_users}{$local_part}{}}}\
680                              {${lookup{$local_part}lsearch{/etc/exim4/sa_users}{$local_part}{}}}}}}
681
682   # Check header_sender except for survey@popcon.d.o
683   deny    condition = ${if eq{$acl_m1}{PopconMail}{false}{true}}
684           !verify = header_sender
685           message = No valid sender found in the From:, Sender: and Reply-to: headers
686
687   accept
688
689
690
691 ######################################################################
692 #                      REWRITE CONFIGURATION                         #
693 ######################################################################
694
695
696
697 begin rewrite
698
699 \N^buildd_(.*)@ries\.debian\.org$\N buildd_$1@buildd.debian.org T
700 \N^buildd_(.*)@klecker\.debian\.org$\N buildd_$1@buildd.debian.org T
701 *@debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
702 *@people.debian.org ${lookup{$1}cdb{/var/lib/misc/${primary_hostname}/mail-forward.cdb}{$value}fail} T
703 #*@${primary_hostname} "${if exists{/etc/exim4/email-addresses}{${lookup{$1}lsearch{/etc/exim4/email-addresses}{$value}fail}}fail}" fFs
704 m68k@buildd.debian.org m68k-build@nocrew.org Ttrbc
705
706
707 #!!#######################################################!!#
708 #!!# Here follow routers created from the old routers,   #!!#
709 #!!# for handling non-local domains.                     #!!#
710 #!!#######################################################!!#
711
712 begin routers
713
714
715
716 ######################################################################
717 #                      ROUTERS CONFIGURATION                         #
718 #                Specifies how addresses are handled                 #
719 ######################################################################
720 #                          ORDER DOES MATTER                         #
721 #     An address is passed to each in turn until it is accepted.     #
722 ######################################################################
723
724 bsmtp:
725   debug_print = "R: bsmtp for $local_part@$domain"
726   driver = manualroute
727   domains = !+local_domains
728   require_files = /etc/exim4/bsmtp
729   route_list = * ${extract{file}{\
730                    ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
731                      {$value}fail}}}
732   transport = bsmtp
733
734 # This router routes to remote hosts over SMTP by explicit IP address,
735 # given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
736 # require this facility, which is why it is enabled by default in Exim.
737 ipliteral:
738   debug_print = "R: ipliteral for $local_part@$domain"
739   driver = ipliteral
740   domains = !+handled_domains
741   transport = remote_smtp
742   ignore_target_hosts = +reservedaddrs
743
744 # This router routes to remote hosts over SMTP using a DNS lookup.
745 # Ignore reserved network responses, including localhost.
746 dnslookup:
747   debug_print = "R: dnslookup for $local_part@$domain"
748   driver = dnslookup
749   domains = !+handled_domains
750   transport = remote_smtp
751   ignore_target_hosts = +reservedaddrs
752   no_more
753
754 # This allows local delivery to be forced, avoiding alias files and
755 # forwarding.
756
757 #real_local:
758 #  debug_print = "R: real_local for $local_part@$domain"
759 #  driver = accept
760 #  check_local_user
761 #  domains = lsearch;/etc/exim4/locals
762 #  local_part_prefix = real-
763 #  transport = local_delivery
764
765 # This router handles aliasing using a traditional /etc/aliases file.
766 # If any of your aliases expand to pipes or files, you will need to set
767 # up a user and a group for these deliveries to run under. You can do
768 # this by uncommenting the "user" option below (changing the user name
769 # as appropriate) and adding a "group" option if necessary.
770
771 system_aliases:
772   debug_print = "R: system_aliases for $local_part@$domain"
773   driver = redirect
774   allow_defer
775   allow_fail
776   data = ${lookup{$local_part}lsearch*{/etc/aliases}}
777   domains = +local_domains
778   file_transport = address_file
779   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
780   pipe_transport = address_pipe
781   retry_use_local_part
782
783 # This router handles forwarding using traditional .forward files.
784 # It also allows mail filtering when a forward file starts with the 
785 # string "# Exim filter": to disable filtering, uncomment the "filter" 
786 # option. The check_ancestor option means that if the forward file 
787 # generates an address that is an ancestor of the current one, the 
788 # current one gets passed on instead. This covers the case where A is 
789 # aliased to B and B has a .forward file pointing to A.
790
791 # For standard debian setup of one group per user, it is acceptable---normal
792 # even---for .forward to be group writable. If you have everyone in one
793 # group, you should comment out the "modemask" line. Without it, the exim
794 # default of 022 will apply, which is probably what you want.
795
796 userforward_verify:
797   debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
798   driver = redirect
799   check_ancestor
800   user = Debian-exim
801   no_check_local_user
802   directory_transport = address_directory
803   domains = +local_domains
804   # filter - I have disabled filtering to force users to use .forward-foo files
805   # or procmail. This will make it easier to move mailers in the future
806   #
807   # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
808   # also checks if the .forward-bar exists, if not then it uses
809   # .forward-default instead.
810   file = $home/.forward\
811          ${if eq{}{$local_part_suffix}{}{\
812            ${if exists {${home}/.forward${local_part_suffix}} \
813              {${local_part_suffix}}{-default}}\
814            }\
815           }
816   file_transport = address_file
817   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
818   local_part_suffix = -*
819   local_part_suffix_optional
820   modemask = 002
821   pipe_transport = address_pipe
822   reply_transport = address_reply
823   require_files = $home
824   router_home_directory = ${lookup passwd{$local_part}{${extract{5}{:}{$value}}}fail}
825   verify_only
826
827 userforward:
828   debug_print = "R: userforward for $local_part${local_part_suffix}@$domain"
829   driver = redirect
830   check_ancestor
831   check_local_user
832   directory_transport = address_directory
833   domains = +local_domains
834   # filter - I have disabled filtering to force users to use .forward-foo files
835   # or procmail. This will make it easier to move mailers in the future
836   #
837   # This bit does the qmailesque extension names, foo-bar@ is .forward-foo it
838   # also checks if the .forward-bar exists, if not then it uses
839   # .forward-default instead.
840   file = $home/.forward\
841          ${if eq{}{$local_part_suffix}{}{\
842            ${if exists {${home}/.forward${local_part_suffix}} \
843              {${local_part_suffix}}{-default}}\
844            }\
845           }
846   file_transport = address_file
847   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
848   local_part_suffix = -*
849   local_part_suffix_optional
850   modemask = 002
851   pipe_transport = address_pipe
852   reply_transport = address_reply
853   require_files = $home
854   no_verify
855
856 # This delivers to procmail
857 procmail:
858   debug_print = "R: procmail for $local_part@$domain"
859   driver = accept
860   check_local_user
861   domains = +local_domains
862   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
863   no_verify
864   no_expn
865   require_files = $local_part:$home/.procmailrc
866   transport = procmail_pipe
867   transport_current_directory = $home
868   
869 # This driver delivers to the LDAP generated alias file.
870 ldap_aliases:
871   debug_print = "R: ldap_aliases for $local_part@$domain"
872   driver = redirect
873   allow_defer
874   allow_fail
875   data = ${if exists{/var/lib/misc/$primary_hostname/mail-forward.cdb}\
876              {${lookup{$local_part}cdb\
877                {/var/lib/misc/$primary_hostname/mail-forward.cdb}}}}
878   domains = +local_domains
879   file_transport = address_file
880   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
881   pipe_transport = address_pipe
882   retry_use_local_part
883   
884 # This director matches local user mailboxes.
885 localuser:
886   debug_print = "R: localuser for $local_part@$domain"
887   driver = accept
888   check_local_user
889   domains = +local_domains
890   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
891   # Disable if the user has never logged in
892   require_files = $home
893   transport = local_delivery
894   no_more
895
896 # Now we begin the Virtual Domain configuration
897 # Everything before here should apply only to the local domains with a 
898 # domains= rule
899
900 # exim4 fails the router if it can't change to the user/group for delivery
901 # during verification.  So we have to seperate the cases of verifying
902 # the virts, and delivering to them.  blah.
903
904 # This router delivers for packages.d.o
905 packages:
906   debug_print = "R: packages for $local_part@$domain"
907   driver = redirect
908   file_transport = address_file
909   pipe_transport = address_pipe
910   domains = packages.debian.org
911   require_files = /org/packages.debian.org/conf/maintainer
912   data = ${lookup{$local_part}cdb{/org/packages.debian.org/conf/maintainer.cdb}}
913   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
914   transport_home_directory = /org/packages.debian.org/mail
915   transport_current_directory = /org/packages.debian.org/mail
916   check_ancestor
917   retry_use_local_part
918   no_more
919
920 .ifdef HAVE_USER_DEBBUGS
921 # This router delivers for bugs.d.o
922 bugs:
923   debug_print = "R: bugs for $local_part@$domain"
924   driver = accept
925   transport = bugs_pipe
926   domains = bugs.debian.org
927   cannot_route_message = Unknown or archived bug
928   require_files = /org/bugs.debian.org/mail/run-procmail
929   no_more
930   local_parts = ${if match\
931                   {$local_part}\
932                   {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
933                {${if exists{/org/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
934                {$local_part}fail}}fail}
935 .endif
936
937 # This router delivers for rt.d.o
938 rt:
939   debug_print = "R: rt for $local_part@$domain"
940   driver = redirect
941   domains = rt.debian.org
942   require_files = /usr/bin/rt-mailgate : RT_QUEUE_MAP
943   local_parts = ${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}{$local_part}{}}
944   local_part_suffix = +*
945   local_part_suffix_optional
946   pipe_transport = rt_pipe
947   data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}"
948   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
949
950 virt_alias_verify:
951   debug_print = "R: virt_aliases for $local_part@$domain"
952   driver = redirect
953   data = ${if exists{\
954            ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
955            {${lookup{$local_part}lsearch*{\
956               ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
957            }}}}
958   directory_transport = address_directory
959   cannot_route_message = Unknown user
960   domains = +virtual_domains
961   file_transport = address_file
962   pipe_transport = address_pipe
963   qualify_preserve_domain
964   retry_use_local_part
965   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
966   transport_home_directory = ${extract{directory}{VDOMAINDATA}}
967   verify_only
968
969 virt_direct_verify:
970   debug_print = "R: virt_direct for $local_part@$domain"
971   driver = redirect
972   no_check_local_user
973   user = Debian-exim
974   allow_filter
975   modemask = 002
976   directory_transport = address_directory
977   domains = +virtual_domains
978   file = $home/.forward-\
979               ${if exists {${home}/.forward-${local_part}}{${local_part}}\
980                    {default}}
981   file_transport = address_file
982   pipe_transport = address_pipe
983   reply_transport = address_reply
984   retry_use_local_part
985   router_home_directory = ${extract{directory}{VDOMAINDATA}}
986   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
987   verify_only
988
989 # This is a senmailesque alias file lookup
990 virt_aliases:
991   debug_print = "R: virt_aliases for $local_part@$domain"
992   driver = redirect
993   allow_defer
994   allow_fail
995   data = ${if exists{\
996            ${extract{directory}{VDOMAINDATA}{${value}/aliases}}}\
997            {${lookup{$local_part}lsearch*{\
998               ${extract{directory}{VDOMAINDATA}{$value/aliases}}\
999            }}}}
1000   directory_transport = address_directory
1001   domains = +virtual_domains
1002   file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1003   cannot_route_message = Unknown user
1004   group = ${extract{group}{VDOMAINDATA}}
1005   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1006   pipe_transport = address_pipe
1007   qualify_preserve_domain
1008   retry_use_local_part
1009   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1010   transport_home_directory = ${extract{directory}{VDOMAINDATA}}
1011   no_verify
1012   user = ${extract{user}{VDOMAINDATA}}
1013   
1014 # This is a qmailesque deliver into a directory of .forward files
1015 virt_direct:
1016   debug_print = "R: virt_direct for $local_part@$domain"
1017   driver = redirect
1018   allow_filter
1019   allow_fail
1020   allow_defer
1021   no_check_local_user
1022   directory_transport = address_directory
1023   domains = +virtual_domains
1024   file = $home/.forward-\
1025               ${if exists {${home}/.forward-${local_part}}{${local_part}}\
1026                    {default}}
1027   file_transport = ${if eq {${extract{group_writable}{VDOMAINDATA}}}{true}{address_file_group}{address_file}}
1028   group = ${extract{group}{VDOMAINDATA}}
1029   headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
1030   modemask = 002
1031   pipe_transport = address_pipe
1032   reply_transport = address_reply
1033   retry_use_local_part
1034   router_home_directory = ${extract{directory}{VDOMAINDATA}}
1035   transport_current_directory = ${extract{directory}{VDOMAINDATA}}
1036   no_verify
1037   user = ${extract{user}{VDOMAINDATA}}
1038   #debug_print = .forward-${if exists {${home}/.forward-${local_part}} {${local_part}} {default}}
1039
1040 ######################################################################
1041 #                      TRANSPORTS CONFIGURATION                      #
1042 ######################################################################
1043 #                       ORDER DOES NOT MATTER                        #
1044 #     Only one appropriate transport is called for each delivery.    #
1045 ######################################################################
1046
1047
1048 begin transports
1049
1050 # This transport is used for local delivery to user mailboxes. On debian
1051 # systems group mail is used so we can write to the /var/mail
1052 # directory. (The alternative, which most other unixes use, is to deliver
1053 # as the user's own group, into a sticky-bitted directory)
1054 local_delivery:
1055   driver = appendfile
1056   file = /var/mail/${local_part}
1057   group = mail
1058   mode = 0660
1059   no_mode_fail_narrower
1060   return_path_add
1061   
1062 # This transport is used for handling pipe addresses generated by alias
1063 # or .forward files. It has a conventional name, since it is not actually
1064 # mentioned elsewhere in this configuration file. (A different name *can*
1065 # be specified via the "address_pipe_transport" option if you really want
1066 # to.) If the pipe generates any standard output, it is returned to the sender
1067 # of the message as a delivery error. Set return_fail_output instead if you
1068 # want this to happen only when the pipe fails to complete normally.
1069
1070 address_pipe:
1071   driver = pipe
1072   current_directory = ${home}
1073   environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1074                  EXT=${substr_1:${local_part_suffix}}:\
1075                  LOCAL=${local_part}${local_part_suffix}:\
1076                  RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1077   return_output
1078   return_path_add
1079
1080 # This transport is used for handling file addresses generated by alias
1081 # or .forward files. It has a conventional name, since it is not actually
1082 # mentioned elsewhere in this configuration file.
1083
1084 address_file:
1085   driver = appendfile
1086   return_path_add
1087
1088 address_file_group:
1089   driver = appendfile
1090   return_path_add
1091   mode = 0660
1092   directory_mode = 0770
1093   mode_fail_narrower = false
1094
1095 # This transport is used for handling file addresses generated by alias
1096 # or .forward files if the path ends in "/", which causes it to be treated
1097 # as a directory name rather than a file name. Each message is then delivered
1098 # to a unique file in the directory. If instead you want all such deliveries to
1099 # be in the "maildir" format that is used by some other mail software,
1100 # uncomment the final option below. If this is done, the directory specified
1101 # in the .forward or alias file is the base maildir directory.
1102 #
1103 # Should you want to be able to specify either maildir or non-maildir
1104 # directory-style deliveries, then you must set up yet another transport,
1105 # called address_directory2. This is used if the path ends in "//" so should
1106 # be the one used for maildir, as the double slash suggests another level
1107 # of directory. In the absence of address_directory2, paths ending in //
1108 # are passed to address_directory.
1109
1110 address_directory:
1111   driver = appendfile
1112   check_string = 
1113   maildir_format
1114   message_prefix = ""
1115   message_suffix = ""
1116   return_path_add
1117
1118 # This transport is used for handling autoreplies generated by the filtering
1119 # option of the forwardfile director. It has a conventional name, since it
1120 # is not actually mentioned elsewhere in this configuration file.
1121 address_reply:
1122   driver = autoreply
1123
1124 # This transport is used for delivering messages over SMTP connections.
1125
1126 remote_smtp:
1127   driver = smtp
1128   connect_timeout = 1m
1129   tls_tempfail_tryclear = true
1130   tls_certificate = /etc/exim4/ssl/thishost.crt
1131   tls_privatekey = /etc/exim4/ssl/thishost.key
1132
1133 # Send the message to procmail
1134 procmail_pipe:
1135   driver = pipe
1136   command = /usr/bin/procmail -a ${substr_1:${local_part_suffix}}}
1137   return_path_add
1138   user = ${local_part}
1139
1140 bsmtp:
1141   driver = appendfile
1142   batch_max = 100
1143   file = ${host}
1144   message_prefix = 
1145   message_suffix = 
1146   use_bsmtp
1147   user = ${extract{user}{\
1148                    ${lookup{$domain}partial-lsearch{/etc/exim4/bsmtp}\
1149                      {$value}fail}\
1150                    }}
1151
1152 .ifdef HAVE_USER_DEBBUGS
1153 bugs_pipe:
1154   driver = pipe
1155   command = /org/bugs.debian.org/mail/run-procmail
1156   environment = "EXTENSION=${substr_1:${local_part_suffix}}:\
1157                  EXT=${substr_1:${local_part_suffix}}:\
1158                  LOCAL=${local_part}${local_part_suffix}:\
1159                  RECIPIENT=${local_part}${local_part_suffix}@${domain}"
1160   return_path_add
1161   return_output
1162   user = debbugs
1163 .endif
1164
1165 rt_pipe:
1166   debug_print = "T: rt_pipe for $local_part${local_part_suffix}@$domain"
1167   driver = pipe
1168   return_fail_output
1169   environment = EXTENSION=${substr_1:${local_part_suffix}}
1170   allow_commands = /usr/bin/rt-mailgate
1171
1172
1173 ######################################################################
1174 #                      RETRY CONFIGURATION                           #
1175 ######################################################################
1176
1177 # This single retry rule applies to all domains and all errors. It specifies
1178 # retries every 15 minutes for 2 hours, then increasing retry intervals,
1179 # starting at 2 hours and increasing each time by a factor of 1.5, up to 16
1180 # hours, then retries every 8 hours until 4 days have passed since the first
1181 # failed delivery.
1182
1183 # Domain               Error       Retries
1184 # ------               -----       -------
1185
1186
1187 begin retry
1188
1189 debian.org             *           F,2h,10m; G,16h,2h,1.5; F,14d,8h
1190 *                      * senders=: F,2h,10m
1191 *                      rcpt_4xx    F,2h,5m;  F,4h,10m; F,4d,15m
1192 *                      *           F,2h,15m; G,16h,2h,1.5; F,4d,8h
1193
1194 # End of Exim 4 configuration