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