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