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