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