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