1 # HG changeset patch |
1 # HG changeset patch |
2 # Parent edb5de053fb4b1e81d7ae2eeb4b5afd977fb1978 |
2 # Parent 0000000000000000000000000000000000000000 |
3 diff -r edb5de053fb4 -r ceca9fed510e doc/spec.txt |
3 |
4 --- a/doc/spec.txt Fri Feb 11 21:12:38 2011 +0100 |
4 diff --git a/doc/spec.txt b/doc/spec.txt |
5 +++ b/doc/spec.txt Fri Feb 11 21:35:49 2011 +0100 |
5 new file mode 100644 |
6 @@ -18794,6 +18794,14 @@ |
6 --- /dev/null |
7 empty, it is ignored. If it starts with an alphanumeric character, a leading |
7 +++ b/doc/spec.txt |
8 colon is inserted. |
8 @@ -0,0 +1,31861 @@ |
9 |
9 +Specification of the Exim Mail Transfer Agent |
|
10 + |
|
11 +Exim Maintainers |
|
12 + |
|
13 +Copyright (c) 2011 University of Cambridge |
|
14 + |
|
15 ++-----------------------------------------------------------------------------+ |
|
16 +|-----------------------------------------------------------------------------| |
|
17 +|Revision 4.74 |21 Jan 2011 |EM | |
|
18 ++-----------------------------------------------------------------------------+ |
|
19 +------------------------------------------------------------------------------- |
|
20 + |
|
21 +TABLE OF CONTENTS |
|
22 + |
|
23 +1. Introduction |
|
24 + |
|
25 + 1.1. Exim documentation |
|
26 + 1.2. FTP and web sites |
|
27 + 1.3. Mailing lists |
|
28 + 1.4. Exim training |
|
29 + 1.5. Bug reports |
|
30 + 1.6. Where to find the Exim distribution |
|
31 + 1.7. Limitations |
|
32 + 1.8. Run time configuration |
|
33 + 1.9. Calling interface |
|
34 + 1.10. Terminology |
|
35 + |
|
36 +2. Incorporated code |
|
37 +3. How Exim receives and delivers mail |
|
38 + |
|
39 + 3.1. Overall philosophy |
|
40 + 3.2. Policy control |
|
41 + 3.3. User filters |
|
42 + 3.4. Message identification |
|
43 + 3.5. Receiving mail |
|
44 + 3.6. Handling an incoming message |
|
45 + 3.7. Life of a message |
|
46 + 3.8. Processing an address for delivery |
|
47 + 3.9. Processing an address for verification |
|
48 + 3.10. Running an individual router |
|
49 + 3.11. Duplicate addresses |
|
50 + 3.12. Router preconditions |
|
51 + 3.13. Delivery in detail |
|
52 + 3.14. Retry mechanism |
|
53 + 3.15. Temporary delivery failure |
|
54 + 3.16. Permanent delivery failure |
|
55 + 3.17. Failures to deliver bounce messages |
|
56 + |
|
57 +4. Building and installing Exim |
|
58 + |
|
59 + 4.1. Unpacking |
|
60 + 4.2. Multiple machine architectures and operating systems |
|
61 + 4.3. PCRE library |
|
62 + 4.4. DBM libraries |
|
63 + 4.5. Pre-building configuration |
|
64 + 4.6. Support for iconv() |
|
65 + 4.7. Including TLS/SSL encryption support |
|
66 + 4.8. Use of tcpwrappers |
|
67 + 4.9. Including support for IPv6 |
|
68 + 4.10. Dynamically loaded lookup module support |
|
69 + 4.11. The building process |
|
70 + 4.12. Output from "make" |
|
71 + 4.13. Overriding build-time options for Exim |
|
72 + 4.14. OS-specific header files |
|
73 + 4.15. Overriding build-time options for the monitor |
|
74 + 4.16. Installing Exim binaries and scripts |
|
75 + 4.17. Installing info documentation |
|
76 + 4.18. Setting up the spool directory |
|
77 + 4.19. Testing |
|
78 + 4.20. Replacing another MTA with Exim |
|
79 + 4.21. Upgrading Exim |
|
80 + 4.22. Stopping the Exim daemon on Solaris |
|
81 + |
|
82 +5. The Exim command line |
|
83 + |
|
84 + 5.1. Setting options by program name |
|
85 + 5.2. Trusted and admin users |
|
86 + 5.3. Command line options |
|
87 + |
|
88 +6. The Exim run time configuration file |
|
89 + |
|
90 + 6.1. Using a different configuration file |
|
91 + 6.2. Configuration file format |
|
92 + 6.3. File inclusions in the configuration file |
|
93 + 6.4. Macros in the configuration file |
|
94 + 6.5. Macro substitution |
|
95 + 6.6. Redefining macros |
|
96 + 6.7. Overriding macro values |
|
97 + 6.8. Example of macro usage |
|
98 + 6.9. Conditional skips in the configuration file |
|
99 + 6.10. Common option syntax |
|
100 + 6.11. Boolean options |
|
101 + 6.12. Integer values |
|
102 + 6.13. Octal integer values |
|
103 + 6.14. Fixed point numbers |
|
104 + 6.15. Time intervals |
|
105 + 6.16. String values |
|
106 + 6.17. Expanded strings |
|
107 + 6.18. User and group names |
|
108 + 6.19. List construction |
|
109 + 6.20. Changing list separators |
|
110 + 6.21. Empty items in lists |
|
111 + 6.22. Format of driver configurations |
|
112 + |
|
113 +7. The default configuration file |
|
114 + |
|
115 + 7.1. Main configuration settings |
|
116 + 7.2. ACL configuration |
|
117 + 7.3. Router configuration |
|
118 + 7.4. Transport configuration |
|
119 + 7.5. Default retry rule |
|
120 + 7.6. Rewriting configuration |
|
121 + 7.7. Authenticators configuration |
|
122 + |
|
123 +8. Regular expressions |
|
124 +9. File and database lookups |
|
125 + |
|
126 + 9.1. Examples of different lookup syntax |
|
127 + 9.2. Lookup types |
|
128 + 9.3. Single-key lookup types |
|
129 + 9.4. Query-style lookup types |
|
130 + 9.5. Temporary errors in lookups |
|
131 + 9.6. Default values in single-key lookups |
|
132 + 9.7. Partial matching in single-key lookups |
|
133 + 9.8. Lookup caching |
|
134 + 9.9. Quoting lookup data |
|
135 + 9.10. More about dnsdb |
|
136 + 9.11. Pseudo dnsdb record types |
|
137 + 9.12. Multiple dnsdb lookups |
|
138 + 9.13. More about LDAP |
|
139 + 9.14. Format of LDAP queries |
|
140 + 9.15. LDAP quoting |
|
141 + 9.16. LDAP connections |
|
142 + 9.17. LDAP authentication and control information |
|
143 + 9.18. Format of data returned by LDAP |
|
144 + 9.19. More about NIS+ |
|
145 + 9.20. SQL lookups |
|
146 + 9.21. More about MySQL, PostgreSQL, Oracle, and InterBase |
|
147 + 9.22. Specifying the server in the query |
|
148 + 9.23. Special MySQL features |
|
149 + 9.24. Special PostgreSQL features |
|
150 + 9.25. More about SQLite |
|
151 + |
|
152 +10. Domain, host, address, and local part lists |
|
153 + |
|
154 + 10.1. Expansion of lists |
|
155 + 10.2. Negated items in lists |
|
156 + 10.3. File names in lists |
|
157 + 10.4. An lsearch file is not an out-of-line list |
|
158 + 10.5. Named lists |
|
159 + 10.6. Named lists compared with macros |
|
160 + 10.7. Named list caching |
|
161 + 10.8. Domain lists |
|
162 + 10.9. Host lists |
|
163 + 10.10. Special host list patterns |
|
164 + 10.11. Host list patterns that match by IP address |
|
165 + 10.12. Host list patterns for single-key lookups by host address |
|
166 + 10.13. Host list patterns that match by host name |
|
167 + 10.14. Behaviour when an IP address or name cannot be found |
|
168 + 10.15. Temporary DNS errors when looking up host information |
|
169 + 10.16. Host list patterns for single-key lookups by host name |
|
170 + 10.17. Host list patterns for query-style lookups |
|
171 + 10.18. Mixing wildcarded host names and addresses in host lists |
|
172 + 10.19. Address lists |
|
173 + 10.20. Case of letters in address lists |
|
174 + 10.21. Local part lists |
|
175 + |
|
176 +11. String expansions |
|
177 + |
|
178 + 11.1. Literal text in expanded strings |
|
179 + 11.2. Character escape sequences in expanded strings |
|
180 + 11.3. Testing string expansions |
|
181 + 11.4. Forced expansion failure |
|
182 + 11.5. Expansion items |
|
183 + 11.6. Expansion operators |
|
184 + 11.7. Expansion conditions |
|
185 + 11.8. Combining expansion conditions |
|
186 + 11.9. Expansion variables |
|
187 + |
|
188 +12. Embedded Perl |
|
189 + |
|
190 + 12.1. Setting up so Perl can be used |
|
191 + 12.2. Calling Perl subroutines |
|
192 + 12.3. Calling Exim functions from Perl |
|
193 + 12.4. Use of standard output and error by Perl |
|
194 + |
|
195 +13. Starting the daemon and the use of network interfaces |
|
196 + |
|
197 + 13.1. Starting a listening daemon |
|
198 + 13.2. Special IP listening addresses |
|
199 + 13.3. Overriding local_interfaces and daemon_smtp_ports |
|
200 + 13.4. Support for the obsolete SSMTP (or SMTPS) protocol |
|
201 + 13.5. IPv6 address scopes |
|
202 + 13.6. Disabling IPv6 |
|
203 + 13.7. Examples of starting a listening daemon |
|
204 + 13.8. Recognizing the local host |
|
205 + 13.9. Delivering to a remote host |
|
206 + |
|
207 +14. Main configuration |
|
208 + |
|
209 + 14.1. Miscellaneous |
|
210 + 14.2. Exim parameters |
|
211 + 14.3. Privilege controls |
|
212 + 14.4. Logging |
|
213 + 14.5. Frozen messages |
|
214 + 14.6. Data lookups |
|
215 + 14.7. Message ids |
|
216 + 14.8. Embedded Perl Startup |
|
217 + 14.9. Daemon |
|
218 + 14.10. Resource control |
|
219 + 14.11. Policy controls |
|
220 + 14.12. Callout cache |
|
221 + 14.13. TLS |
|
222 + 14.14. Local user handling |
|
223 + 14.15. All incoming messages (SMTP and non-SMTP) |
|
224 + 14.16. Non-SMTP incoming messages |
|
225 + 14.17. Incoming SMTP messages |
|
226 + 14.18. SMTP extensions |
|
227 + 14.19. Processing messages |
|
228 + 14.20. System filter |
|
229 + 14.21. Routing and delivery |
|
230 + 14.22. Bounce and warning messages |
|
231 + 14.23. Alphabetical list of main options |
|
232 + |
|
233 +15. Generic options for routers |
|
234 +16. The accept router |
|
235 +17. The dnslookup router |
|
236 + |
|
237 + 17.1. Problems with DNS lookups |
|
238 + 17.2. Private options for dnslookup |
|
239 + 17.3. Effect of qualify_single and search_parents |
|
240 + |
|
241 +18. The ipliteral router |
|
242 +19. The iplookup router |
|
243 +20. The manualroute router |
|
244 + |
|
245 + 20.1. Private options for manualroute |
|
246 + 20.2. Routing rules in route_list |
|
247 + 20.3. Routing rules in route_data |
|
248 + 20.4. Format of the list of hosts |
|
249 + 20.5. Format of one host item |
|
250 + 20.6. How the list of hosts is used |
|
251 + 20.7. How the options are used |
|
252 + 20.8. Manualroute examples |
|
253 + |
|
254 +21. The queryprogram router |
|
255 +22. The redirect router |
|
256 + |
|
257 + 22.1. Redirection data |
|
258 + 22.2. Forward files and address verification |
|
259 + 22.3. Interpreting redirection data |
|
260 + 22.4. Items in a non-filter redirection list |
|
261 + 22.5. Redirecting to a local mailbox |
|
262 + 22.6. Special items in redirection lists |
|
263 + 22.7. Duplicate addresses |
|
264 + 22.8. Repeated redirection expansion |
|
265 + 22.9. Errors in redirection lists |
|
266 + 22.10. Private options for the redirect router |
|
267 + |
|
268 +23. Environment for running local transports |
|
269 + |
|
270 + 23.1. Concurrent deliveries |
|
271 + 23.2. Uids and gids |
|
272 + 23.3. Current and home directories |
|
273 + 23.4. Expansion variables derived from the address |
|
274 + |
|
275 +24. Generic options for transports |
|
276 +25. Address batching in local transports |
|
277 +26. The appendfile transport |
|
278 + |
|
279 + 26.1. The file and directory options |
|
280 + 26.2. Private options for appendfile |
|
281 + 26.3. Operational details for appending |
|
282 + 26.4. Operational details for delivery to a new file |
|
283 + 26.5. Maildir delivery |
|
284 + 26.6. Using tags to record message sizes |
|
285 + 26.7. Using a maildirsize file |
|
286 + 26.8. Mailstore delivery |
|
287 + 26.9. Non-special new file delivery |
|
288 + |
|
289 +27. The autoreply transport |
|
290 + |
|
291 + 27.1. Private options for autoreply |
|
292 + |
|
293 +28. The lmtp transport |
|
294 +29. The pipe transport |
|
295 + |
|
296 + 29.1. Concurrent delivery |
|
297 + 29.2. Returned status and data |
|
298 + 29.3. How the command is run |
|
299 + 29.4. Environment variables |
|
300 + 29.5. Private options for pipe |
|
301 + 29.6. Using an external local delivery agent |
|
302 + |
|
303 +30. The smtp transport |
|
304 + |
|
305 + 30.1. Multiple messages on a single connection |
|
306 + 30.2. Use of the $host and $host_address variables |
|
307 + 30.3. Use of $tls_cipher and $tls_peerdn |
|
308 + 30.4. Private options for smtp |
|
309 + 30.5. How the limits for the number of hosts to try are used |
|
310 + |
|
311 +31. Address rewriting |
|
312 + |
|
313 + 31.1. Explicitly configured address rewriting |
|
314 + 31.2. When does rewriting happen? |
|
315 + 31.3. Testing the rewriting rules that apply on input |
|
316 + 31.4. Rewriting rules |
|
317 + 31.5. Rewriting patterns |
|
318 + 31.6. Rewriting replacements |
|
319 + 31.7. Rewriting flags |
|
320 + 31.8. Flags specifying which headers and envelope addresses to rewrite |
|
321 + 31.9. The SMTP-time rewriting flag |
|
322 + 31.10. Flags controlling the rewriting process |
|
323 + 31.11. Rewriting examples |
|
324 + |
|
325 +32. Retry configuration |
|
326 + |
|
327 + 32.1. Changing retry rules |
|
328 + 32.2. Format of retry rules |
|
329 + 32.3. Choosing which retry rule to use for address errors |
|
330 + 32.4. Choosing which retry rule to use for host and message errors |
|
331 + 32.5. Retry rules for specific errors |
|
332 + 32.6. Retry rules for specified senders |
|
333 + 32.7. Retry parameters |
|
334 + 32.8. Retry rule examples |
|
335 + 32.9. Timeout of retry data |
|
336 + 32.10. Long-term failures |
|
337 + 32.11. Deliveries that work intermittently |
|
338 + |
|
339 +33. SMTP authentication |
|
340 + |
|
341 + 33.1. Generic options for authenticators |
|
342 + 33.2. The AUTH parameter on MAIL commands |
|
343 + 33.3. Authentication on an Exim server |
|
344 + 33.4. Testing server authentication |
|
345 + 33.5. Authentication by an Exim client |
|
346 + |
|
347 +34. The plaintext authenticator |
|
348 + |
|
349 + 34.1. Plaintext options |
|
350 + 34.2. Using plaintext in a server |
|
351 + 34.3. The PLAIN authentication mechanism |
|
352 + 34.4. The LOGIN authentication mechanism |
|
353 + 34.5. Support for different kinds of authentication |
|
354 + 34.6. Using plaintext in a client |
|
355 + |
|
356 +35. The cram_md5 authenticator |
|
357 + |
|
358 + 35.1. Using cram_md5 as a server |
|
359 + 35.2. Using cram_md5 as a client |
|
360 + |
|
361 +36. The cyrus_sasl authenticator |
|
362 + |
|
363 + 36.1. Using cyrus_sasl as a server |
|
364 + |
|
365 +37. The dovecot authenticator |
|
366 +38. The spa authenticator |
|
367 + |
|
368 + 38.1. Using spa as a server |
|
369 + 38.2. Using spa as a client |
|
370 + |
|
371 +39. Encrypted SMTP connections using TLS/SSL |
|
372 + |
|
373 + 39.1. Support for the legacy "ssmtp" (aka "smtps") protocol |
|
374 + 39.2. OpenSSL vs GnuTLS |
|
375 + 39.3. GnuTLS parameter computation |
|
376 + 39.4. Requiring specific ciphers in OpenSSL |
|
377 + 39.5. Requiring specific ciphers or other parameters in GnuTLS |
|
378 + 39.6. Configuring an Exim server to use TLS |
|
379 + 39.7. Requesting and verifying client certificates |
|
380 + 39.8. Revoked certificates |
|
381 + 39.9. Configuring an Exim client to use TLS |
|
382 + 39.10. Multiple messages on the same encrypted TCP/IP connection |
|
383 + 39.11. Certificates and all that |
|
384 + 39.12. Certificate chains |
|
385 + 39.13. Self-signed certificates |
|
386 + |
|
387 +40. Access control lists |
|
388 + |
|
389 + 40.1. Testing ACLs |
|
390 + 40.2. Specifying when ACLs are used |
|
391 + 40.3. The non-SMTP ACLs |
|
392 + 40.4. The SMTP connect ACL |
|
393 + 40.5. The EHLO/HELO ACL |
|
394 + 40.6. The DATA ACLs |
|
395 + 40.7. The SMTP DKIM ACL |
|
396 + 40.8. The SMTP MIME ACL |
|
397 + 40.9. The QUIT ACL |
|
398 + 40.10. The not-QUIT ACL |
|
399 + 40.11. Finding an ACL to use |
|
400 + 40.12. ACL return codes |
|
401 + 40.13. Unset ACL options |
|
402 + 40.14. Data for message ACLs |
|
403 + 40.15. Data for non-message ACLs |
|
404 + 40.16. Format of an ACL |
|
405 + 40.17. ACL verbs |
|
406 + 40.18. ACL variables |
|
407 + 40.19. Condition and modifier processing |
|
408 + 40.20. ACL modifiers |
|
409 + 40.21. Use of the control modifier |
|
410 + 40.22. Summary of message fixup control |
|
411 + 40.23. Adding header lines in ACLs |
|
412 + 40.24. ACL conditions |
|
413 + 40.25. Using DNS lists |
|
414 + 40.26. Specifying the IP address for a DNS list lookup |
|
415 + 40.27. DNS lists keyed on domain names |
|
416 + 40.28. Multiple explicit keys for a DNS list |
|
417 + 40.29. Data returned by DNS lists |
|
418 + 40.30. Variables set from DNS lists |
|
419 + 40.31. Additional matching conditions for DNS lists |
|
420 + 40.32. Negated DNS matching conditions |
|
421 + 40.33. Handling multiple DNS records from a DNS list |
|
422 + 40.34. Detailed information from merged DNS lists |
|
423 + 40.35. DNS lists and IPv6 |
|
424 + 40.36. Rate limiting incoming messages |
|
425 + 40.37. Ratelimit options for what is being measured |
|
426 + 40.38. Ratelimit options for handling fast clients |
|
427 + 40.39. Using rate limiting |
|
428 + 40.40. Reading ratelimit data without updating |
|
429 + 40.41. Address verification |
|
430 + 40.42. Callout verification |
|
431 + 40.43. Additional parameters for callouts |
|
432 + 40.44. Callout caching |
|
433 + 40.45. Sender address verification reporting |
|
434 + 40.46. Redirection while verifying |
|
435 + 40.47. Client SMTP authorization (CSA) |
|
436 + 40.48. Bounce address tag validation |
|
437 + 40.49. Using an ACL to control relaying |
|
438 + 40.50. Checking a relay configuration |
|
439 + |
|
440 +41. Content scanning at ACL time |
|
441 + |
|
442 + 41.1. Scanning for viruses |
|
443 + 41.2. Scanning with SpamAssassin |
|
444 + 41.3. Calling SpamAssassin from an Exim ACL |
|
445 + 41.4. Scanning MIME parts |
|
446 + 41.5. Scanning with regular expressions |
|
447 + 41.6. The demime condition |
|
448 + |
|
449 +42. Adding a local scan function to Exim |
|
450 + |
|
451 + 42.1. Building Exim to use a local scan function |
|
452 + 42.2. API for local_scan() |
|
453 + 42.3. Configuration options for local_scan() |
|
454 + 42.4. Available Exim variables |
|
455 + 42.5. Structure of header lines |
|
456 + 42.6. Structure of recipient items |
|
457 + 42.7. Available Exim functions |
|
458 + 42.8. More about Exim's memory handling |
|
459 + |
|
460 +43. System-wide message filtering |
|
461 + |
|
462 + 43.1. Specifying a system filter |
|
463 + 43.2. Testing a system filter |
|
464 + 43.3. Contents of a system filter |
|
465 + 43.4. Additional variable for system filters |
|
466 + 43.5. Defer, freeze, and fail commands for system filters |
|
467 + 43.6. Adding and removing headers in a system filter |
|
468 + 43.7. Setting an errors address in a system filter |
|
469 + 43.8. Per-address filtering |
|
470 + |
|
471 +44. Message processing |
|
472 + |
|
473 + 44.1. Submission mode for non-local messages |
|
474 + 44.2. Line endings |
|
475 + 44.3. Unqualified addresses |
|
476 + 44.4. The UUCP From line |
|
477 + 44.5. Resent- header lines |
|
478 + 44.6. The Auto-Submitted: header line |
|
479 + 44.7. The Bcc: header line |
|
480 + 44.8. The Date: header line |
|
481 + 44.9. The Delivery-date: header line |
|
482 + 44.10. The Envelope-to: header line |
|
483 + 44.11. The From: header line |
|
484 + 44.12. The Message-ID: header line |
|
485 + 44.13. The Received: header line |
|
486 + 44.14. The References: header line |
|
487 + 44.15. The Return-path: header line |
|
488 + 44.16. The Sender: header line |
|
489 + 44.17. Adding and removing header lines in routers and transports |
|
490 + 44.18. Constructed addresses |
|
491 + 44.19. Case of local parts |
|
492 + 44.20. Dots in local parts |
|
493 + 44.21. Rewriting addresses |
|
494 + |
|
495 +45. SMTP processing |
|
496 + |
|
497 + 45.1. Outgoing SMTP and LMTP over TCP/IP |
|
498 + 45.2. Errors in outgoing SMTP |
|
499 + 45.3. Incoming SMTP messages over TCP/IP |
|
500 + 45.4. Unrecognized SMTP commands |
|
501 + 45.5. Syntax and protocol errors in SMTP commands |
|
502 + 45.6. Use of non-mail SMTP commands |
|
503 + 45.7. The VRFY and EXPN commands |
|
504 + 45.8. The ETRN command |
|
505 + 45.9. Incoming local SMTP |
|
506 + 45.10. Outgoing batched SMTP |
|
507 + 45.11. Incoming batched SMTP |
|
508 + |
|
509 +46. Customizing bounce and warning messages |
|
510 + |
|
511 + 46.1. Customizing bounce messages |
|
512 + 46.2. Customizing warning messages |
|
513 + |
|
514 +47. Some common configuration settings |
|
515 + |
|
516 + 47.1. Sending mail to a smart host |
|
517 + 47.2. Using Exim to handle mailing lists |
|
518 + 47.3. Syntax errors in mailing lists |
|
519 + 47.4. Re-expansion of mailing lists |
|
520 + 47.5. Closed mailing lists |
|
521 + 47.6. Variable Envelope Return Paths (VERP) |
|
522 + 47.7. Virtual domains |
|
523 + 47.8. Multiple user mailboxes |
|
524 + 47.9. Simplified vacation processing |
|
525 + 47.10. Taking copies of mail |
|
526 + 47.11. Intermittently connected hosts |
|
527 + 47.12. Exim on the upstream server host |
|
528 + 47.13. Exim on the intermittently connected client host |
|
529 + |
|
530 +48. Using Exim as a non-queueing client |
|
531 +49. Log files |
|
532 + |
|
533 + 49.1. Where the logs are written |
|
534 + 49.2. Logging to local files that are periodically "cycled" |
|
535 + 49.3. Datestamped log files |
|
536 + 49.4. Logging to syslog |
|
537 + 49.5. Log line flags |
|
538 + 49.6. Logging message reception |
|
539 + 49.7. Logging deliveries |
|
540 + 49.8. Discarded deliveries |
|
541 + 49.9. Deferred deliveries |
|
542 + 49.10. Delivery failures |
|
543 + 49.11. Fake deliveries |
|
544 + 49.12. Completion |
|
545 + 49.13. Summary of Fields in Log Lines |
|
546 + 49.14. Other log entries |
|
547 + 49.15. Reducing or increasing what is logged |
|
548 + 49.16. Message log |
|
549 + |
|
550 +50. Exim utilities |
|
551 + |
|
552 + 50.1. Finding out what Exim processes are doing (exiwhat) |
|
553 + 50.2. Selective queue listing (exiqgrep) |
|
554 + 50.3. Summarizing the queue (exiqsumm) |
|
555 + 50.4. Extracting specific information from the log (exigrep) |
|
556 + 50.5. Selecting messages by various criteria (exipick) |
|
557 + 50.6. Cycling log files (exicyclog) |
|
558 + 50.7. Mail statistics (eximstats) |
|
559 + 50.8. Checking access policy (exim_checkaccess) |
|
560 + 50.9. Making DBM files (exim_dbmbuild) |
|
561 + 50.10. Finding individual retry times (exinext) |
|
562 + 50.11. Hints database maintenance |
|
563 + 50.12. exim_dumpdb |
|
564 + 50.13. exim_tidydb |
|
565 + 50.14. exim_fixdb |
|
566 + 50.15. Mailbox maintenance (exim_lock) |
|
567 + |
|
568 +51. The Exim monitor |
|
569 + |
|
570 + 51.1. Running the monitor |
|
571 + 51.2. The stripcharts |
|
572 + 51.3. Main action buttons |
|
573 + 51.4. The log display |
|
574 + 51.5. The queue display |
|
575 + 51.6. The queue menu |
|
576 + |
|
577 +52. Security considerations |
|
578 + |
|
579 + 52.1. Building a more "hardened" Exim |
|
580 + 52.2. Root privilege |
|
581 + 52.3. Running Exim without privilege |
|
582 + 52.4. Delivering to local files |
|
583 + 52.5. IPv4 source routing |
|
584 + 52.6. The VRFY, EXPN, and ETRN commands in SMTP |
|
585 + 52.7. Privileged users |
|
586 + 52.8. Spool files |
|
587 + 52.9. Use of argv[0] |
|
588 + 52.10. Use of %f formatting |
|
589 + 52.11. Embedded Exim path |
|
590 + 52.12. Dynamic module directory |
|
591 + 52.13. Use of sprintf() |
|
592 + 52.14. Use of debug_printf() and log_write() |
|
593 + 52.15. Use of strcat() and strcpy() |
|
594 + |
|
595 +53. Format of spool files |
|
596 + |
|
597 + 53.1. Format of the -H file |
|
598 + |
|
599 +54. Support for DKIM (DomainKeys Identified Mail) - RFC4871 |
|
600 + |
|
601 + 54.1. Signing outgoing messages |
|
602 + 54.2. Verifying DKIM signatures in incoming mail |
|
603 + |
|
604 +55. Adding new drivers or lookup types |
|
605 + |
|
606 +1. Introduction |
|
607 + |
|
608 +Exim is a mail transfer agent (MTA) for hosts that are running Unix or |
|
609 +Unix-like operating systems. It was designed on the assumption that it would be |
|
610 +run on hosts that are permanently connected to the Internet. However, it can be |
|
611 +used on intermittently connected hosts with suitable configuration adjustments. |
|
612 + |
|
613 +Configuration files currently exist for the following operating systems: AIX, |
|
614 +BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd, GNU/ |
|
615 +Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD, |
|
616 +OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4, |
|
617 +Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware. |
|
618 +Some of these operating systems are no longer current and cannot easily be |
|
619 +tested, so the configuration files may no longer work in practice. |
|
620 + |
|
621 +There are also configuration files for compiling Exim in the Cygwin environment |
|
622 +that can be installed on systems running Windows. However, this document does |
|
623 +not contain any information about running Exim in the Cygwin environment. |
|
624 + |
|
625 +The terms and conditions for the use and distribution of Exim are contained in |
|
626 +the file NOTICE. Exim is distributed under the terms of the GNU General Public |
|
627 +Licence, a copy of which may be found in the file LICENCE. |
|
628 + |
|
629 +The use, supply or promotion of Exim for the purpose of sending bulk, |
|
630 +unsolicited electronic mail is incompatible with the basic aims of the program, |
|
631 +which revolve around the free provision of a service that enhances the quality |
|
632 +of personal communications. The author of Exim regards indiscriminate |
|
633 +mass-mailing as an antisocial, irresponsible abuse of the Internet. |
|
634 + |
|
635 +Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the |
|
636 +experience of running and working on the Smail 3 code, I could never have |
|
637 +contemplated starting to write a new MTA. Many of the ideas and user interfaces |
|
638 +were originally taken from Smail 3, though the actual code of Exim is entirely |
|
639 +new, and has developed far beyond the initial concept. |
|
640 + |
|
641 +Many people, both in Cambridge and around the world, have contributed to the |
|
642 +development and the testing of Exim, and to porting it to various operating |
|
643 +systems. I am grateful to them all. The distribution now contains a file called |
|
644 +ACKNOWLEDGMENTS, in which I have started recording the names of contributors. |
|
645 + |
|
646 +1.1Â Exim documentation |
|
647 + |
|
648 +This edition of the Exim specification applies to version 4.74 of Exim. |
|
649 +Substantive changes from the 4.72 edition are marked in some renditions of the |
|
650 +document; this paragraph is so marked if the rendition is capable of showing a |
|
651 +change indicator. |
|
652 + |
|
653 +This document is very much a reference manual; it is not a tutorial. The reader |
|
654 +is expected to have some familiarity with the SMTP mail transfer protocol and |
|
655 +with general Unix system administration. Although there are some discussions |
|
656 +and examples in places, the information is mostly organized in a way that makes |
|
657 +it easy to look up, rather than in a natural order for sequential reading. |
|
658 +Furthermore, the manual aims to cover every aspect of Exim in detail, including |
|
659 +a number of rarely-used, special-purpose features that are unlikely to be of |
|
660 +very wide interest. |
|
661 + |
|
662 +An "easier" discussion of Exim which provides more in-depth explanatory, |
|
663 +introductory, and tutorial material can be found in a book entitled The Exim |
|
664 +SMTP Mail Server (second edition, 2007), published by UIT Cambridge (http:// |
|
665 +www.uit.co.uk/exim-book/). |
|
666 + |
|
667 +This book also contains a chapter that gives a general introduction to SMTP and |
|
668 +Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date |
|
669 +with the latest release of Exim. (Note that the earlier book about Exim, |
|
670 +published by O'Reilly, covers Exim 3, and many things have changed in Exim 4.) |
|
671 + |
|
672 +If you are using a Debian distribution of Exim, you will find information about |
|
673 +Debian-specific features in the file /usr/share/doc/exim4-base/README.Debian. |
|
674 +The command man update-exim.conf is another source of Debian-specific |
|
675 +information. |
|
676 + |
|
677 +As the program develops, there may be features in newer versions that have not |
|
678 +yet made it into this document, which is updated only when the most significant |
|
679 +digit of the fractional part of the version number changes. Specifications of |
|
680 +new features that are not yet in this manual are placed in the file doc/ |
|
681 +NewStuff in the Exim distribution. |
|
682 + |
|
683 +Some features may be classified as "experimental". These may change |
|
684 +incompatibly while they are developing, or even be withdrawn. For this reason, |
|
685 +they are not documented in this manual. Information about experimental features |
|
686 +can be found in the file doc/experimental.txt. |
|
687 + |
|
688 +All changes to the program (whether new features, bug fixes, or other kinds of |
|
689 +change) are noted briefly in the file called doc/ChangeLog. |
|
690 + |
|
691 +This specification itself is available as an ASCII file in doc/spec.txt so that |
|
692 +it can easily be searched with a text editor. Other files in the doc directory |
|
693 +are: |
|
694 + |
|
695 +OptionLists.txt list of all options in alphabetical order |
|
696 +dbm.discuss.txt discussion about DBM libraries |
|
697 +exim.8 a man page of Exim's command line options |
|
698 +experimental.txt documentation of experimental features |
|
699 +filter.txt specification of the filter language |
|
700 +Exim3.upgrade upgrade notes from release 2 to release 3 |
|
701 +Exim4.upgrade upgrade notes from release 3 to release 4 |
|
702 + |
|
703 +The main specification and the specification of the filtering language are also |
|
704 +available in other formats (HTML, PostScript, PDF, and Texinfo). Section 1.6 |
|
705 +below tells you how to get hold of these. |
|
706 + |
|
707 +1.2Â FTP and web sites |
|
708 + |
|
709 +The primary site for Exim source distributions is currently the University of |
|
710 +Cambridge's FTP site, whose contents are described in Where to find the Exim |
|
711 +distribution below. In addition, there is a web site and an FTP site at |
|
712 +exim.org. These are now also hosted at the University of Cambridge. The |
|
713 +exim.org site was previously hosted for a number of years by Energis Squared, |
|
714 +formerly Planet Online Ltd, whose support I gratefully acknowledge. |
|
715 + |
|
716 +As well as Exim distribution tar files, the Exim web site contains a number of |
|
717 +differently formatted versions of the documentation. A recent addition to the |
|
718 +online information is the Exim wiki (http://wiki.exim.org), which contains what |
|
719 +used to be a separate FAQ, as well as various other examples, tips, and |
|
720 +know-how that have been contributed by Exim users. |
|
721 + |
|
722 +An Exim Bugzilla exists at http://bugs.exim.org. You can use this to report |
|
723 +bugs, and also to add items to the wish list. Please search first to check that |
|
724 +you are not duplicating a previous entry. |
|
725 + |
|
726 +1.3Â Mailing lists |
|
727 + |
|
728 +The following Exim mailing lists exist: |
|
729 + |
|
730 +exim-users@exim.org General discussion list |
|
731 +exim-dev@exim.org Discussion of bugs, enhancements, etc. |
|
732 +exim-announce@exim.org Moderated, low volume announcements list |
|
733 +exim-future@exim.org Discussion of long-term development |
|
734 + |
|
735 +You can subscribe to these lists, change your existing subscriptions, and view |
|
736 +or search the archives via the mailing lists link on the Exim home page. If you |
|
737 +are using a Debian distribution of Exim, you may wish to subscribe to the |
|
738 +Debian-specific mailing list pkg-exim4-users@lists.alioth.debian.org via this |
|
739 +web page: |
|
740 + |
|
741 +http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users |
|
742 + |
|
743 +Please ask Debian-specific questions on this list and not on the general Exim |
|
744 +lists. |
|
745 + |
|
746 +1.4Â Exim training |
|
747 + |
|
748 +Training courses in Cambridge (UK) used to be run annually by the author of |
|
749 +Exim, before he retired. At the time of writing, there are no plans to run |
|
750 +further Exim courses in Cambridge. However, if that changes, relevant |
|
751 +information will be posted at http://www-tus.csx.cam.ac.uk/courses/exim/. |
|
752 + |
|
753 +1.5Â Bug reports |
|
754 + |
|
755 +Reports of obvious bugs can be emailed to bugs@exim.org or reported via the |
|
756 +Bugzilla (http://bugs.exim.org). However, if you are unsure whether some |
|
757 +behaviour is a bug or not, the best thing to do is to post a message to the |
|
758 +exim-dev mailing list and have it discussed. |
|
759 + |
|
760 +1.6Â Where to find the Exim distribution |
|
761 + |
|
762 +The master ftp site for the Exim distribution is |
|
763 + |
|
764 +ftp://ftp.csx.cam.ac.uk/pub/software/email/exim |
|
765 + |
|
766 +This is mirrored by |
|
767 + |
|
768 +ftp://ftp.exim.org/pub/exim |
|
769 + |
|
770 +The file references that follow are relative to the exim directories at these |
|
771 +sites. There are now quite a number of independent mirror sites around the |
|
772 +world. Those that I know about are listed in the file called Mirrors. |
|
773 + |
|
774 +Within the exim directory there are subdirectories called exim3 (for previous |
|
775 +Exim 3 distributions), exim4 (for the latest Exim 4 distributions), and Testing |
|
776 +for testing versions. In the exim4 subdirectory, the current release can always |
|
777 +be found in files called |
|
778 + |
|
779 +exim-n.nn.tar.gz |
|
780 +exim-n.nn.tar.bz2 |
|
781 + |
|
782 +where n.nn is the highest such version number in the directory. The two files |
|
783 +contain identical data; the only difference is the type of compression. The |
|
784 +.bz2 file is usually a lot smaller than the .gz file. |
|
785 + |
|
786 +The distributions are currently signed with Nigel Metheringham's GPG key. The |
|
787 +corresponding public key is available from a number of keyservers, and there is |
|
788 +also a copy in the file nigel-pubkey.asc. The signatures for the tar bundles |
|
789 +are in: |
|
790 + |
|
791 +exim-n.nn.tar.gz.asc |
|
792 +exim-n.nn.tar.bz2.asc |
|
793 + |
|
794 +For each released version, the log of changes is made separately available in a |
|
795 +separate file in the directory ChangeLogs so that it is possible to find out |
|
796 +what has changed without having to download the entire distribution. |
|
797 + |
|
798 +The main distribution contains ASCII versions of this specification and other |
|
799 +documentation; other formats of the documents are available in separate files |
|
800 +inside the exim4 directory of the FTP site: |
|
801 + |
|
802 +exim-html-n.nn.tar.gz |
|
803 +exim-pdf-n.nn.tar.gz |
|
804 +exim-postscript-n.nn.tar.gz |
|
805 +exim-texinfo-n.nn.tar.gz |
|
806 + |
|
807 +These tar files contain only the doc directory, not the complete distribution, |
|
808 +and are also available in .bz2 as well as .gz forms. |
|
809 + |
|
810 +1.7Â Limitations |
|
811 + |
|
812 + * Exim is designed for use as an Internet MTA, and therefore handles |
|
813 + addresses in RFC 2822 domain format only. It cannot handle UUCP "bang |
|
814 + paths", though simple two-component bang paths can be converted by a |
|
815 + straightforward rewriting configuration. This restriction does not prevent |
|
816 + Exim from being interfaced to UUCP as a transport mechanism, provided that |
|
817 + domain addresses are used. |
|
818 + |
|
819 + * Exim insists that every address it handles has a domain attached. For |
|
820 + incoming local messages, domainless addresses are automatically qualified |
|
821 + with a configured domain value. Configuration options specify from which |
|
822 + remote systems unqualified addresses are acceptable. These are then |
|
823 + qualified on arrival. |
|
824 + |
|
825 + * The only external transport mechanisms that are currently implemented are |
|
826 + SMTP and LMTP over a TCP/IP network (including support for IPv6). However, |
|
827 + a pipe transport is available, and there are facilities for writing |
|
828 + messages to files and pipes, optionally in batched SMTP format; these |
|
829 + facilities can be used to send messages to other transport mechanisms such |
|
830 + as UUCP, provided they can handle domain-style addresses. Batched SMTP |
|
831 + input is also catered for. |
|
832 + |
|
833 + * Exim is not designed for storing mail for dial-in hosts. When the volumes |
|
834 + of such mail are large, it is better to get the messages "delivered" into |
|
835 + files (that is, off Exim's queue) and subsequently passed on to the dial-in |
|
836 + hosts by other means. |
|
837 + |
|
838 + * Although Exim does have basic facilities for scanning incoming messages, |
|
839 + these are not comprehensive enough to do full virus or spam scanning. Such |
|
840 + operations are best carried out using additional specialized software |
|
841 + packages. If you compile Exim with the content-scanning extension, |
|
842 + straightforward interfaces to a number of common scanners are provided. |
|
843 + |
|
844 +1.8Â Run time configuration |
|
845 + |
|
846 +Exim's run time configuration is held in a single text file that is divided |
|
847 +into a number of sections. The entries in this file consist of keywords and |
|
848 +values, in the style of Smail 3 configuration files. A default configuration |
|
849 +file which is suitable for simple online installations is provided in the |
|
850 +distribution, and is described in chapter 7 below. |
|
851 + |
|
852 +1.9Â Calling interface |
|
853 + |
|
854 +Like many MTAs, Exim has adopted the Sendmail command line interface so that it |
|
855 +can be a straight replacement for /usr/lib/sendmail or /usr/sbin/sendmail when |
|
856 +sending mail, but you do not need to know anything about Sendmail in order to |
|
857 +run Exim. For actions other than sending messages, Sendmail-compatible options |
|
858 +also exist, but those that produce output (for example, -bp, which lists the |
|
859 +messages on the queue) do so in Exim's own format. There are also some |
|
860 +additional options that are compatible with Smail 3, and some further options |
|
861 +that are new to Exim. Chapter 5 documents all Exim's command line options. This |
|
862 +information is automatically made into the man page that forms part of the Exim |
|
863 +distribution. |
|
864 + |
|
865 +Control of messages on the queue can be done via certain privileged command |
|
866 +line options. There is also an optional monitor program called eximon, which |
|
867 +displays current information in an X window, and which contains a menu |
|
868 +interface to Exim's command line administration options. |
|
869 + |
|
870 +1.10Â Terminology |
|
871 + |
|
872 +The body of a message is the actual data that the sender wants to transmit. It |
|
873 +is the last part of a message, and is separated from the header (see below) by |
|
874 +a blank line. |
|
875 + |
|
876 +When a message cannot be delivered, it is normally returned to the sender in a |
|
877 +delivery failure message or a "non-delivery report" (NDR). The term bounce is |
|
878 +commonly used for this action, and the error reports are often called bounce |
|
879 +messages. This is a convenient shorthand for "delivery failure error report". |
|
880 +Such messages have an empty sender address in the message's envelope (see |
|
881 +below) to ensure that they cannot themselves give rise to further bounce |
|
882 +messages. |
|
883 + |
|
884 +The term default appears frequently in this manual. It is used to qualify a |
|
885 +value which is used in the absence of any setting in the configuration. It may |
|
886 +also qualify an action which is taken unless a configuration setting specifies |
|
887 +otherwise. |
|
888 + |
|
889 +The term defer is used when the delivery of a message to a specific destination |
|
890 +cannot immediately take place for some reason (a remote host may be down, or a |
|
891 +user's local mailbox may be full). Such deliveries are deferred until a later |
|
892 +time. |
|
893 + |
|
894 +The word domain is sometimes used to mean all but the first component of a |
|
895 +host's name. It is not used in that sense here, where it normally refers to the |
|
896 +part of an email address following the @ sign. |
|
897 + |
|
898 +A message in transit has an associated envelope, as well as a header and a |
|
899 +body. The envelope contains a sender address (to which bounce messages should |
|
900 +be delivered), and any number of recipient addresses. References to the sender |
|
901 +or the recipients of a message usually mean the addresses in the envelope. An |
|
902 +MTA uses these addresses for delivery, and for returning bounce messages, not |
|
903 +the addresses that appear in the header lines. |
|
904 + |
|
905 +The header of a message is the first part of a message's text, consisting of a |
|
906 +number of lines, each of which has a name such as From:, To:, Subject:, etc. |
|
907 +Long header lines can be split over several text lines by indenting the |
|
908 +continuations. The header is separated from the body by a blank line. |
|
909 + |
|
910 +The term local part, which is taken from RFC 2822, is used to refer to that |
|
911 +part of an email address that precedes the @ sign. The part that follows the @ |
|
912 +sign is called the domain or mail domain. |
|
913 + |
|
914 +The terms local delivery and remote delivery are used to distinguish delivery |
|
915 +to a file or a pipe on the local host from delivery by SMTP over TCP/IP to |
|
916 +another host. As far as Exim is concerned, all hosts other than the host it is |
|
917 +running on are remote. |
|
918 + |
|
919 +Return path is another name that is used for the sender address in a message's |
|
920 +envelope. |
|
921 + |
|
922 +The term queue is used to refer to the set of messages awaiting delivery, |
|
923 +because this term is in widespread use in the context of MTAs. However, in |
|
924 +Exim's case the reality is more like a pool than a queue, because there is |
|
925 +normally no ordering of waiting messages. |
|
926 + |
|
927 +The term queue runner is used to describe a process that scans the queue and |
|
928 +attempts to deliver those messages whose retry times have come. This term is |
|
929 +used by other MTAs, and also relates to the command runq, but in Exim the |
|
930 +waiting messages are normally processed in an unpredictable order. |
|
931 + |
|
932 +The term spool directory is used for a directory in which Exim keeps the |
|
933 +messages on its queue - that is, those that it is in the process of delivering. |
|
934 +This should not be confused with the directory in which local mailboxes are |
|
935 +stored, which is called a "spool directory" by some people. In the Exim |
|
936 +documentation, "spool" is always used in the first sense. |
|
937 + |
|
938 +2. Incorporated code |
|
939 + |
|
940 +A number of pieces of external code are included in the Exim distribution. |
|
941 + |
|
942 + * Regular expressions are supported in the main Exim program and in the Exim |
|
943 + monitor using the freely-distributable PCRE library, copyright (c) |
|
944 + University of Cambridge. The source to PCRE is no longer shipped with Exim, |
|
945 + so you will need to use the version of PCRE shipped with your system, or |
|
946 + obtain and install the full version of the library from ftp:// |
|
947 + ftp.csx.cam.ac.uk/pub/software/programming/pcre. |
|
948 + |
|
949 + * Support for the cdb (Constant DataBase) lookup method is provided by code |
|
950 + contributed by Nigel Metheringham of (at the time he contributed it) Planet |
|
951 + Online Ltd. The implementation is completely contained within the code of |
|
952 + Exim. It does not link against an external cdb library. The code contains |
|
953 + the following statements: |
|
954 + |
|
955 + Copyright (c) 1998 Nigel Metheringham, Planet Online Ltd |
|
956 + |
|
957 + This program is free software; you can redistribute it and/or modify it |
|
958 + under the terms of the GNU General Public License as published by the |
|
959 + Free Software Foundation; either version 2 of the License, or (at your |
|
960 + option) any later version. This code implements Dan Bernstein's |
|
961 + Constant DataBase (cdb) spec. Information, the spec and sample code for |
|
962 + cdb can be obtained from http://www.pobox.com/~djb/cdb.html. This |
|
963 + implementation borrows some code from Dan Bernstein's implementation |
|
964 + (which has no license restrictions applied to it). |
|
965 + |
|
966 + * Client support for Microsoft's Secure Password Authentication is provided |
|
967 + by code contributed by Marc Prud'hommeaux. Server support was contributed |
|
968 + by Tom Kistner. This includes code taken from the Samba project, which is |
|
969 + released under the Gnu GPL. |
|
970 + |
|
971 + * Support for calling the Cyrus pwcheck and saslauthd daemons is provided by |
|
972 + code taken from the Cyrus-SASL library and adapted by Alexander S. |
|
973 + Sabourenkov. The permission notice appears below, in accordance with the |
|
974 + conditions expressed therein. |
|
975 + |
|
976 + Copyright (c) 2001 Carnegie Mellon University. All rights reserved. |
|
977 + |
|
978 + Redistribution and use in source and binary forms, with or without |
|
979 + modification, are permitted provided that the following conditions are |
|
980 + met: |
|
981 + |
|
982 + 1. Redistributions of source code must retain the above copyright |
|
983 + notice, this list of conditions and the following disclaimer. |
|
984 + |
|
985 + 2. Redistributions in binary form must reproduce the above copyright |
|
986 + notice, this list of conditions and the following disclaimer in the |
|
987 + documentation and/or other materials provided with the |
|
988 + distribution. |
|
989 + |
|
990 + 3. The name "Carnegie Mellon University" must not be used to endorse |
|
991 + or promote products derived from this software without prior |
|
992 + written permission. For permission or any other legal details, |
|
993 + please contact |
|
994 + |
|
995 +               Office of Technology Transfer |
|
996 +               Carnegie Mellon University |
|
997 +               5000 Forbes Avenue |
|
998 +               Pittsburgh, PA  15213-3890 |
|
999 +               (412) 268-4387, fax: (412) 268-7395 |
|
1000 + Â Â Â Â Â Â Â Â Â Â Â Â Â Â tech-transfer@andrew.cmu.edu |
|
1001 + |
|
1002 + 4. Redistributions of any form whatsoever must retain the following |
|
1003 + acknowledgment: |
|
1004 + |
|
1005 + "This product includes software developed by Computing Services at |
|
1006 + Carnegie Mellon University (http://www.cmu.edu/computing/." |
|
1007 + |
|
1008 + CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO |
|
1009 + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|
1010 + AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE |
|
1011 + FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
1012 + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN |
|
1013 + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING |
|
1014 + OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
|
1015 + SOFTWARE. |
|
1016 + |
|
1017 + * The Exim Monitor program, which is an X-Window application, includes |
|
1018 + modified versions of the Athena StripChart and TextPop widgets. This code |
|
1019 + is copyright by DEC and MIT, and their permission notice appears below, in |
|
1020 + accordance with the conditions expressed therein. |
|
1021 + |
|
1022 + Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, |
|
1023 + Massachusetts, and the Massachusetts Institute of Technology, |
|
1024 + Cambridge, Massachusetts. |
|
1025 + |
|
1026 + All Rights Reserved |
|
1027 + |
|
1028 + Permission to use, copy, modify, and distribute this software and its |
|
1029 + documentation for any purpose and without fee is hereby granted, |
|
1030 + provided that the above copyright notice appear in all copies and that |
|
1031 + both that copyright notice and this permission notice appear in |
|
1032 + supporting documentation, and that the names of Digital or MIT not be |
|
1033 + used in advertising or publicity pertaining to distribution of the |
|
1034 + software without specific, written prior permission. |
|
1035 + |
|
1036 + DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
|
1037 + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
|
1038 + EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
|
1039 + CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF |
|
1040 + USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|
1041 + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
1042 + PERFORMANCE OF THIS SOFTWARE. |
|
1043 + |
|
1044 + * Many people have contributed code fragments, some large, some small, that |
|
1045 + were not covered by any specific licence requirements. It is assumed that |
|
1046 + the contributors are happy to see their code incorporated into Exim under |
|
1047 + the GPL. |
|
1048 + |
|
1049 +3. How Exim receives and delivers mail |
|
1050 + |
|
1051 +3.1Â Overall philosophy |
|
1052 + |
|
1053 +Exim is designed to work efficiently on systems that are permanently connected |
|
1054 +to the Internet and are handling a general mix of mail. In such circumstances, |
|
1055 +most messages can be delivered immediately. Consequently, Exim does not |
|
1056 +maintain independent queues of messages for specific domains or hosts, though |
|
1057 +it does try to send several messages in a single SMTP connection after a host |
|
1058 +has been down, and it also maintains per-host retry information. |
|
1059 + |
|
1060 +3.2Â Policy control |
|
1061 + |
|
1062 +Policy controls are now an important feature of MTAs that are connected to the |
|
1063 +Internet. Perhaps their most important job is to stop MTAs being abused as |
|
1064 +"open relays" by misguided individuals who send out vast amounts of unsolicited |
|
1065 +junk, and want to disguise its source. Exim provides flexible facilities for |
|
1066 +specifying policy controls on incoming mail: |
|
1067 + |
|
1068 + * Exim 4 (unlike previous versions of Exim) implements policy controls on |
|
1069 + incoming mail by means of Access Control Lists (ACLs). Each list is a |
|
1070 + series of statements that may either grant or deny access. ACLs can be used |
|
1071 + at several places in the SMTP dialogue while receiving a message from a |
|
1072 + remote host. However, the most common places are after each RCPT command, |
|
1073 + and at the very end of the message. The sysadmin can specify conditions for |
|
1074 + accepting or rejecting individual recipients or the entire message, |
|
1075 + respectively, at these two points (see chapter 40). Denial of access |
|
1076 + results in an SMTP error code. |
|
1077 + |
|
1078 + * An ACL is also available for locally generated, non-SMTP messages. In this |
|
1079 + case, the only available actions are to accept or deny the entire message. |
|
1080 + |
|
1081 + * When Exim is compiled with the content-scanning extension, facilities are |
|
1082 + provided in the ACL mechanism for passing the message to external virus and |
|
1083 + /or spam scanning software. The result of such a scan is passed back to the |
|
1084 + ACL, which can then use it to decide what to do with the message. |
|
1085 + |
|
1086 + * When a message has been received, either from a remote host or from the |
|
1087 + local host, but before the final acknowledgment has been sent, a locally |
|
1088 + supplied C function called local_scan() can be run to inspect the message |
|
1089 + and decide whether to accept it or not (see chapter 42). If the message is |
|
1090 + accepted, the list of recipients can be modified by the function. |
|
1091 + |
|
1092 + * Using the local_scan() mechanism is another way of calling external scanner |
|
1093 + software. The SA-Exim add-on package works this way. It does not require |
|
1094 + Exim to be compiled with the content-scanning extension. |
|
1095 + |
|
1096 + * After a message has been accepted, a further checking mechanism is |
|
1097 + available in the form of the system filter (see chapter 43). This runs at |
|
1098 + the start of every delivery process. |
|
1099 + |
|
1100 +3.3Â User filters |
|
1101 + |
|
1102 +In a conventional Exim configuration, users are able to run private filters by |
|
1103 +setting up appropriate .forward files in their home directories. See chapter 22 |
|
1104 +(about the redirect router) for the configuration needed to support this, and |
|
1105 +the separate document entitled Exim's interfaces to mail filtering for user |
|
1106 +details. Two different kinds of filtering are available: |
|
1107 + |
|
1108 + * Sieve filters are written in the standard filtering language that is |
|
1109 + defined by RFC 3028. |
|
1110 + |
|
1111 + * Exim filters are written in a syntax that is unique to Exim, but which is |
|
1112 + more powerful than Sieve, which it pre-dates. |
|
1113 + |
|
1114 +User filters are run as part of the routing process, described below. |
|
1115 + |
|
1116 +3.4Â Message identification |
|
1117 + |
|
1118 +Every message handled by Exim is given a message id which is sixteen characters |
|
1119 +long. It is divided into three parts, separated by hyphens, for example |
|
1120 +"16VDhn-0001bo-D3". Each part is a sequence of letters and digits, normally |
|
1121 +encoding numbers in base 62. However, in the Darwin operating system (Mac OS X) |
|
1122 +and when Exim is compiled to run under Cygwin, base 36 (avoiding the use of |
|
1123 +lower case letters) is used instead, because the message id is used to |
|
1124 +construct file names, and the names of files in those systems are not always |
|
1125 +case-sensitive. |
|
1126 + |
|
1127 +The detail of the contents of the message id have changed as Exim has evolved. |
|
1128 +Earlier versions relied on the operating system not re-using a process id (pid) |
|
1129 +within one second. On modern operating systems, this assumption can no longer |
|
1130 +be made, so the algorithm had to be changed. To retain backward compatibility, |
|
1131 +the format of the message id was retained, which is why the following rules are |
|
1132 +somewhat eccentric: |
|
1133 + |
|
1134 + * The first six characters of the message id are the time at which the |
|
1135 + message started to be received, to a granularity of one second. That is, |
|
1136 + this field contains the number of seconds since the start of the epoch (the |
|
1137 + normal Unix way of representing the date and time of day). |
|
1138 + |
|
1139 + * After the first hyphen, the next six characters are the id of the process |
|
1140 + that received the message. |
|
1141 + |
|
1142 + * There are two different possibilities for the final two characters: |
|
1143 + |
|
1144 + 1. If localhost_number is not set, this value is the fractional part of |
|
1145 + the time of reception, normally in units of 1/2000 of a second, but for |
|
1146 + systems that must use base 36 instead of base 62 (because of |
|
1147 + case-insensitive file systems), the units are 1/1000 of a second. |
|
1148 + |
|
1149 + 2. If localhost_number is set, it is multiplied by 200 (100) and added to |
|
1150 + the fractional part of the time, which in this case is in units of 1/ |
|
1151 + 200 (1/100) of a second. |
|
1152 + |
|
1153 +After a message has been received, Exim waits for the clock to tick at the |
|
1154 +appropriate resolution before proceeding, so that if another message is |
|
1155 +received by the same process, or by another process with the same (re-used) |
|
1156 +pid, it is guaranteed that the time will be different. In most cases, the clock |
|
1157 +will already have ticked while the message was being received. |
|
1158 + |
|
1159 +3.5Â Receiving mail |
|
1160 + |
|
1161 +The only way Exim can receive mail from another host is using SMTP over TCP/IP, |
|
1162 +in which case the sender and recipient addresses are transferred using SMTP |
|
1163 +commands. However, from a locally running process (such as a user's MUA), there |
|
1164 +are several possibilities: |
|
1165 + |
|
1166 + * If the process runs Exim with the -bm option, the message is read |
|
1167 + non-interactively (usually via a pipe), with the recipients taken from the |
|
1168 + command line, or from the body of the message if -t is also used. |
|
1169 + |
|
1170 + * If the process runs Exim with the -bS option, the message is also read |
|
1171 + non-interactively, but in this case the recipients are listed at the start |
|
1172 + of the message in a series of SMTP RCPT commands, terminated by a DATA |
|
1173 + command. This is so-called "batch SMTP" format, but it isn't really SMTP. |
|
1174 + The SMTP commands are just another way of passing envelope addresses in a |
|
1175 + non-interactive submission. |
|
1176 + |
|
1177 + * If the process runs Exim with the -bs option, the message is read |
|
1178 + interactively, using the SMTP protocol. A two-way pipe is normally used for |
|
1179 + passing data between the local process and the Exim process. This is "real" |
|
1180 + SMTP and is handled in the same way as SMTP over TCP/IP. For example, the |
|
1181 + ACLs for SMTP commands are used for this form of submission. |
|
1182 + |
|
1183 + * A local process may also make a TCP/IP call to the host's loopback address |
|
1184 + (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim |
|
1185 + does not treat the loopback address specially. It treats all such |
|
1186 + connections in the same way as connections from other hosts. |
|
1187 + |
|
1188 +In the three cases that do not involve TCP/IP, the sender address is |
|
1189 +constructed from the login name of the user that called Exim and a default |
|
1190 +qualification domain (which can be set by the qualify_domain configuration |
|
1191 +option). For local or batch SMTP, a sender address that is passed using the |
|
1192 +SMTP MAIL command is ignored. However, the system administrator may allow |
|
1193 +certain users ("trusted users") to specify a different sender address |
|
1194 +unconditionally, or all users to specify certain forms of different sender |
|
1195 +address. The -f option or the SMTP MAIL command is used to specify these |
|
1196 +different addresses. See section 5.2 for details of trusted users, and the |
|
1197 +untrusted_set_sender option for a way of allowing untrusted users to change |
|
1198 +sender addresses. |
|
1199 + |
|
1200 +Messages received by either of the non-interactive mechanisms are subject to |
|
1201 +checking by the non-SMTP ACL, if one is defined. Messages received using SMTP |
|
1202 +(either over TCP/IP, or interacting with a local process) can be checked by a |
|
1203 +number of ACLs that operate at different times during the SMTP session. Either |
|
1204 +individual recipients, or the entire message, can be rejected if local policy |
|
1205 +requirements are not met. The local_scan() function (see chapter 42) is run for |
|
1206 +all incoming messages. |
|
1207 + |
|
1208 +Exim can be configured not to start a delivery process when a message is |
|
1209 +received; this can be unconditional, or depend on the number of incoming SMTP |
|
1210 +connections or the system load. In these situations, new messages wait on the |
|
1211 +queue until a queue runner process picks them up. However, in standard |
|
1212 +configurations under normal conditions, delivery is started as soon as a |
|
1213 +message is received. |
|
1214 + |
|
1215 +3.6Â Handling an incoming message |
|
1216 + |
|
1217 +When Exim accepts a message, it writes two files in its spool directory. The |
|
1218 +first contains the envelope information, the current status of the message, and |
|
1219 +the header lines, and the second contains the body of the message. The names of |
|
1220 +the two spool files consist of the message id, followed by "-H" for the file |
|
1221 +containing the envelope and header, and "-D" for the data file. |
|
1222 + |
|
1223 +By default all these message files are held in a single directory called input |
|
1224 +inside the general Exim spool directory. Some operating systems do not perform |
|
1225 +very well if the number of files in a directory gets large; to improve |
|
1226 +performance in such cases, the split_spool_directory option can be used. This |
|
1227 +causes Exim to split up the input files into 62 sub-directories whose names are |
|
1228 +single letters or digits. When this is done, the queue is processed one |
|
1229 +sub-directory at a time instead of all at once, which can improve overall |
|
1230 +performance even when there are not enough files in each directory to affect |
|
1231 +file system performance. |
|
1232 + |
|
1233 +The envelope information consists of the address of the message's sender and |
|
1234 +the addresses of the recipients. This information is entirely separate from any |
|
1235 +addresses contained in the header lines. The status of the message includes a |
|
1236 +list of recipients who have already received the message. The format of the |
|
1237 +first spool file is described in chapter 53. |
|
1238 + |
|
1239 +Address rewriting that is specified in the rewrite section of the configuration |
|
1240 +(see chapter 31) is done once and for all on incoming addresses, both in the |
|
1241 +header lines and the envelope, at the time the message is accepted. If during |
|
1242 +the course of delivery additional addresses are generated (for example, via |
|
1243 +aliasing), these new addresses are rewritten as soon as they are generated. At |
|
1244 +the time a message is actually delivered (transported) further rewriting can |
|
1245 +take place; because this is a transport option, it can be different for |
|
1246 +different forms of delivery. It is also possible to specify the addition or |
|
1247 +removal of certain header lines at the time the message is delivered (see |
|
1248 +chapters 15 and 24). |
|
1249 + |
|
1250 +3.7Â Life of a message |
|
1251 + |
|
1252 +A message remains in the spool directory until it is completely delivered to |
|
1253 +its recipients or to an error address, or until it is deleted by an |
|
1254 +administrator or by the user who originally created it. In cases when delivery |
|
1255 +cannot proceed - for example, when a message can neither be delivered to its |
|
1256 +recipients nor returned to its sender, the message is marked "frozen" on the |
|
1257 +spool, and no more deliveries are attempted. |
|
1258 + |
|
1259 +An administrator can "thaw" such messages when the problem has been corrected, |
|
1260 +and can also freeze individual messages by hand if necessary. In addition, an |
|
1261 +administrator can force a delivery error, causing a bounce message to be sent. |
|
1262 + |
|
1263 +There are options called ignore_bounce_errors_after and timeout_frozen_after, |
|
1264 +which discard frozen messages after a certain time. The first applies only to |
|
1265 +frozen bounces, the second to any frozen messages. |
|
1266 + |
|
1267 +While Exim is working on a message, it writes information about each delivery |
|
1268 +attempt to its main log file. This includes successful, unsuccessful, and |
|
1269 +delayed deliveries for each recipient (see chapter 49). The log lines are also |
|
1270 +written to a separate message log file for each message. These logs are solely |
|
1271 +for the benefit of the administrator, and are normally deleted along with the |
|
1272 +spool files when processing of a message is complete. The use of individual |
|
1273 +message logs can be disabled by setting no_message_logs; this might give an |
|
1274 +improvement in performance on very busy systems. |
|
1275 + |
|
1276 +All the information Exim itself needs to set up a delivery is kept in the first |
|
1277 +spool file, along with the header lines. When a successful delivery occurs, the |
|
1278 +address is immediately written at the end of a journal file, whose name is the |
|
1279 +message id followed by "-J". At the end of a delivery run, if there are some |
|
1280 +addresses left to be tried again later, the first spool file (the "-H" file) is |
|
1281 +updated to indicate which these are, and the journal file is then deleted. |
|
1282 +Updating the spool file is done by writing a new file and renaming it, to |
|
1283 +minimize the possibility of data loss. |
|
1284 + |
|
1285 +Should the system or the program crash after a successful delivery but before |
|
1286 +the spool file has been updated, the journal is left lying around. The next |
|
1287 +time Exim attempts to deliver the message, it reads the journal file and |
|
1288 +updates the spool file before proceeding. This minimizes the chances of double |
|
1289 +deliveries caused by crashes. |
|
1290 + |
|
1291 +3.8Â Processing an address for delivery |
|
1292 + |
|
1293 +The main delivery processing elements of Exim are called routers and transports |
|
1294 +, and collectively these are known as drivers. Code for a number of them is |
|
1295 +provided in the source distribution, and compile-time options specify which |
|
1296 +ones are included in the binary. Run time options specify which ones are |
|
1297 +actually used for delivering messages. |
|
1298 + |
|
1299 +Each driver that is specified in the run time configuration is an instance of |
|
1300 +that particular driver type. Multiple instances are allowed; for example, you |
|
1301 +can set up several different smtp transports, each with different option values |
|
1302 +that might specify different ports or different timeouts. Each instance has its |
|
1303 +own identifying name. In what follows we will normally use the instance name |
|
1304 +when discussing one particular instance (that is, one specific configuration of |
|
1305 +the driver), and the generic driver name when discussing the driver's features |
|
1306 +in general. |
|
1307 + |
|
1308 +A router is a driver that operates on an address, either determining how its |
|
1309 +delivery should happen, by assigning it to a specific transport, or converting |
|
1310 +the address into one or more new addresses (for example, via an alias file). A |
|
1311 +router may also explicitly choose to fail an address, causing it to be bounced. |
|
1312 + |
|
1313 +A transport is a driver that transmits a copy of the message from Exim's spool |
|
1314 +to some destination. There are two kinds of transport: for a local transport, |
|
1315 +the destination is a file or a pipe on the local host, whereas for a remote |
|
1316 +transport the destination is some other host. A message is passed to a specific |
|
1317 +transport as a result of successful routing. If a message has several |
|
1318 +recipients, it may be passed to a number of different transports. |
|
1319 + |
|
1320 +An address is processed by passing it to each configured router instance in |
|
1321 +turn, subject to certain preconditions, until a router accepts the address or |
|
1322 +specifies that it should be bounced. We will describe this process in more |
|
1323 +detail shortly. First, as a simple example, we consider how each recipient |
|
1324 +address in a message is processed in a small configuration of three routers. |
|
1325 + |
|
1326 +To make this a more concrete example, it is described in terms of some actual |
|
1327 +routers, but remember, this is only an example. You can configure Exim's |
|
1328 +routers in many different ways, and there may be any number of routers in a |
|
1329 +configuration. |
|
1330 + |
|
1331 +The first router that is specified in a configuration is often one that handles |
|
1332 +addresses in domains that are not recognized specially by the local host. These |
|
1333 +are typically addresses for arbitrary domains on the Internet. A precondition |
|
1334 +is set up which looks for the special domains known to the host (for example, |
|
1335 +its own domain name), and the router is run for addresses that do not match. |
|
1336 +Typically, this is a router that looks up domains in the DNS in order to find |
|
1337 +the hosts to which this address routes. If it succeeds, the address is assigned |
|
1338 +to a suitable SMTP transport; if it does not succeed, the router is configured |
|
1339 +to fail the address. |
|
1340 + |
|
1341 +The second router is reached only when the domain is recognized as one that |
|
1342 +"belongs" to the local host. This router does redirection - also known as |
|
1343 +aliasing and forwarding. When it generates one or more new addresses from the |
|
1344 +original, each of them is routed independently from the start. Otherwise, the |
|
1345 +router may cause an address to fail, or it may simply decline to handle the |
|
1346 +address, in which case the address is passed to the next router. |
|
1347 + |
|
1348 +The final router in many configurations is one that checks to see if the |
|
1349 +address belongs to a local mailbox. The precondition may involve a check to see |
|
1350 +if the local part is the name of a login account, or it may look up the local |
|
1351 +part in a file or a database. If its preconditions are not met, or if the |
|
1352 +router declines, we have reached the end of the routers. When this happens, the |
|
1353 +address is bounced. |
|
1354 + |
|
1355 +3.9Â Processing an address for verification |
|
1356 + |
|
1357 +As well as being used to decide how to deliver to an address, Exim's routers |
|
1358 +are also used for address verification. Verification can be requested as one of |
|
1359 +the checks to be performed in an ACL for incoming messages, on both sender and |
|
1360 +recipient addresses, and it can be tested using the -bv and -bvs command line |
|
1361 +options. |
|
1362 + |
|
1363 +When an address is being verified, the routers are run in "verify mode". This |
|
1364 +does not affect the way the routers work, but it is a state that can be |
|
1365 +detected. By this means, a router can be skipped or made to behave differently |
|
1366 +when verifying. A common example is a configuration in which the first router |
|
1367 +sends all messages to a message-scanning program, unless they have been |
|
1368 +previously scanned. Thus, the first router accepts all addresses without any |
|
1369 +checking, making it useless for verifying. Normally, the no_verify option would |
|
1370 +be set for such a router, causing it to be skipped in verify mode. |
|
1371 + |
|
1372 +3.10Â Running an individual router |
|
1373 + |
|
1374 +As explained in the example above, a number of preconditions are checked before |
|
1375 +running a router. If any are not met, the router is skipped, and the address is |
|
1376 +passed to the next router. When all the preconditions on a router are met, the |
|
1377 +router is run. What happens next depends on the outcome, which is one of the |
|
1378 +following: |
|
1379 + |
|
1380 + * accept: The router accepts the address, and either assigns it to a |
|
1381 + transport, or generates one or more "child" addresses. Processing the |
|
1382 + original address ceases, unless the unseen option is set on the router. |
|
1383 + This option can be used to set up multiple deliveries with different |
|
1384 + routing (for example, for keeping archive copies of messages). When unseen |
|
1385 + is set, the address is passed to the next router. Normally, however, an |
|
1386 + accept return marks the end of routing. |
|
1387 + |
|
1388 + Any child addresses generated by the router are processed independently, |
|
1389 + starting with the first router by default. It is possible to change this by |
|
1390 + setting the redirect_router option to specify which router to start at for |
|
1391 + child addresses. Unlike pass_router (see below) the router specified by |
|
1392 + redirect_router may be anywhere in the router configuration. |
|
1393 + |
|
1394 + * pass: The router recognizes the address, but cannot handle it itself. It |
|
1395 + requests that the address be passed to another router. By default the |
|
1396 + address is passed to the next router, but this can be changed by setting |
|
1397 + the pass_router option. However, (unlike redirect_router) the named router |
|
1398 + must be below the current router (to avoid loops). |
|
1399 + |
|
1400 + * decline: The router declines to accept the address because it does not |
|
1401 + recognize it at all. By default, the address is passed to the next router, |
|
1402 + but this can be prevented by setting the no_more option. When no_more is |
|
1403 + set, all the remaining routers are skipped. In effect, no_more converts |
|
1404 + decline into fail. |
|
1405 + |
|
1406 + * fail: The router determines that the address should fail, and queues it for |
|
1407 + the generation of a bounce message. There is no further processing of the |
|
1408 + original address unless unseen is set on the router. |
|
1409 + |
|
1410 + * defer: The router cannot handle the address at the present time. (A |
|
1411 + database may be offline, or a DNS lookup may have timed out.) No further |
|
1412 + processing of the address happens in this delivery attempt. It is tried |
|
1413 + again next time the message is considered for delivery. |
|
1414 + |
|
1415 + * error: There is some error in the router (for example, a syntax error in |
|
1416 + its configuration). The action is as for defer. |
|
1417 + |
|
1418 +If an address reaches the end of the routers without having been accepted by |
|
1419 +any of them, it is bounced as unrouteable. The default error message in this |
|
1420 +situation is "unrouteable address", but you can set your own message by making |
|
1421 +use of the cannot_route_message option. This can be set for any router; the |
|
1422 +value from the last router that "saw" the address is used. |
|
1423 + |
|
1424 +Sometimes while routing you want to fail a delivery when some conditions are |
|
1425 +met but others are not, instead of passing the address on for further routing. |
|
1426 +You can do this by having a second router that explicitly fails the delivery |
|
1427 +when the relevant conditions are met. The redirect router has a "fail" facility |
|
1428 +for this purpose. |
|
1429 + |
|
1430 +3.11Â Duplicate addresses |
|
1431 + |
|
1432 +Once routing is complete, Exim scans the addresses that are assigned to local |
|
1433 +and remote transports, and discards any duplicates that it finds. During this |
|
1434 +check, local parts are treated as case-sensitive. This happens only when |
|
1435 +actually delivering a message; when testing routers with -bt, all the routed |
|
1436 +addresses are shown. |
|
1437 + |
|
1438 +3.12Â Router preconditions |
|
1439 + |
|
1440 +The preconditions that are tested for each router are listed below, in the |
|
1441 +order in which they are tested. The individual configuration options are |
|
1442 +described in more detail in chapter 15. |
|
1443 + |
|
1444 + * The local_part_prefix and local_part_suffix options can specify that the |
|
1445 + local parts handled by the router may or must have certain prefixes and/or |
|
1446 + suffixes. If a mandatory affix (prefix or suffix) is not present, the |
|
1447 + router is skipped. These conditions are tested first. When an affix is |
|
1448 + present, it is removed from the local part before further processing, |
|
1449 + including the evaluation of any other conditions. |
|
1450 + |
|
1451 + * Routers can be designated for use only when not verifying an address, that |
|
1452 + is, only when routing it for delivery (or testing its delivery routing). If |
|
1453 + the verify option is set false, the router is skipped when Exim is |
|
1454 + verifying an address. Setting the verify option actually sets two options, |
|
1455 + verify_sender and verify_recipient, which independently control the use of |
|
1456 + the router for sender and recipient verification. You can set these options |
|
1457 + directly if you want a router to be used for only one type of verification. |
|
1458 + |
|
1459 + * If the address_test option is set false, the router is skipped when Exim is |
|
1460 + run with the -bt option to test an address routing. This can be helpful |
|
1461 + when the first router sends all new messages to a scanner of some sort; it |
|
1462 + makes it possible to use -bt to test subsequent delivery routing without |
|
1463 + having to simulate the effect of the scanner. |
|
1464 + |
|
1465 + * Routers can be designated for use only when verifying an address, as |
|
1466 + opposed to routing it for delivery. The verify_only option controls this. |
|
1467 + |
|
1468 + * Individual routers can be explicitly skipped when running the routers to |
|
1469 + check an address given in the SMTP EXPN command (see the expn option). |
|
1470 + |
|
1471 + * If the domains option is set, the domain of the address must be in the set |
|
1472 + of domains that it defines. |
|
1473 + |
|
1474 + * If the local_parts option is set, the local part of the address must be in |
|
1475 + the set of local parts that it defines. If local_part_prefix or |
|
1476 + local_part_suffix is in use, the prefix or suffix is removed from the local |
|
1477 + part before this check. If you want to do precondition tests on local parts |
|
1478 + that include affixes, you can do so by using a condition option (see below) |
|
1479 + that uses the variables $local_part, $local_part_prefix, and |
|
1480 + $local_part_suffix as necessary. |
|
1481 + |
|
1482 + * If the check_local_user option is set, the local part must be the name of |
|
1483 + an account on the local host. If this check succeeds, the uid and gid of |
|
1484 + the local user are placed in $local_user_uid and $local_user_gid and the |
|
1485 + user's home directory is placed in $home; these values can be used in the |
|
1486 + remaining preconditions. |
|
1487 + |
|
1488 + * If the router_home_directory option is set, it is expanded at this point, |
|
1489 + because it overrides the value of $home. If this expansion were left till |
|
1490 + later, the value of $home as set by check_local_user would be used in |
|
1491 + subsequent tests. Having two different values of $home in the same router |
|
1492 + could lead to confusion. |
|
1493 + |
|
1494 + * If the senders option is set, the envelope sender address must be in the |
|
1495 + set of addresses that it defines. |
|
1496 + |
|
1497 + * If the require_files option is set, the existence or non-existence of |
|
1498 + specified files is tested. |
|
1499 + |
|
1500 + * If the condition option is set, it is evaluated and tested. This option |
|
1501 + uses an expanded string to allow you to set up your own custom |
|
1502 + preconditions. Expanded strings are described in chapter 11. |
|
1503 + |
|
1504 +Note that require_files comes near the end of the list, so you cannot use it to |
|
1505 +check for the existence of a file in which to lookup up a domain, local part, |
|
1506 +or sender. However, as these options are all expanded, you can use the exists |
|
1507 +expansion condition to make such tests within each condition. The require_files |
|
1508 +option is intended for checking files that the router may be going to use |
|
1509 +internally, or which are needed by a specific transport (for example, |
|
1510 +.procmailrc). |
|
1511 + |
|
1512 +3.13Â Delivery in detail |
|
1513 + |
|
1514 +When a message is to be delivered, the sequence of events is as follows: |
|
1515 + |
|
1516 + * If a system-wide filter file is specified, the message is passed to it. The |
|
1517 + filter may add recipients to the message, replace the recipients, discard |
|
1518 + the message, cause a new message to be generated, or cause the message |
|
1519 + delivery to fail. The format of the system filter file is the same as for |
|
1520 + Exim user filter files, described in the separate document entitled Exim's |
|
1521 + interfaces to mail filtering. (Note: Sieve cannot be used for system filter |
|
1522 + files.) |
|
1523 + |
|
1524 + Some additional features are available in system filters - see chapter 43 |
|
1525 + for details. Note that a message is passed to the system filter only once |
|
1526 + per delivery attempt, however many recipients it has. However, if there are |
|
1527 + several delivery attempts because one or more addresses could not be |
|
1528 + immediately delivered, the system filter is run each time. The filter |
|
1529 + condition first_delivery can be used to detect the first run of the system |
|
1530 + filter. |
|
1531 + |
|
1532 + * Each recipient address is offered to each configured router in turn, |
|
1533 + subject to its preconditions, until one is able to handle it. If no router |
|
1534 + can handle the address, that is, if they all decline, the address is |
|
1535 + failed. Because routers can be targeted at particular domains, several |
|
1536 + locally handled domains can be processed entirely independently of each |
|
1537 + other. |
|
1538 + |
|
1539 + * A router that accepts an address may assign it to a local or a remote |
|
1540 + transport. However, the transport is not run at this time. Instead, the |
|
1541 + address is placed on a list for the particular transport, which will be run |
|
1542 + later. Alternatively, the router may generate one or more new addresses |
|
1543 + (typically from alias, forward, or filter files). New addresses are fed |
|
1544 + back into this process from the top, but in order to avoid loops, a router |
|
1545 + ignores any address which has an identically-named ancestor that was |
|
1546 + processed by itself. |
|
1547 + |
|
1548 + * When all the routing has been done, addresses that have been successfully |
|
1549 + handled are passed to their assigned transports. When local transports are |
|
1550 + doing real local deliveries, they handle only one address at a time, but if |
|
1551 + a local transport is being used as a pseudo-remote transport (for example, |
|
1552 + to collect batched SMTP messages for transmission by some other means) |
|
1553 + multiple addresses can be handled. Remote transports can always handle more |
|
1554 + than one address at a time, but can be configured not to do so, or to |
|
1555 + restrict multiple addresses to the same domain. |
|
1556 + |
|
1557 + * Each local delivery to a file or a pipe runs in a separate process under a |
|
1558 + non-privileged uid, and these deliveries are run one at a time. Remote |
|
1559 + deliveries also run in separate processes, normally under a uid that is |
|
1560 + private to Exim ("the Exim user"), but in this case, several remote |
|
1561 + deliveries can be run in parallel. The maximum number of simultaneous |
|
1562 + remote deliveries for any one message is set by the remote_max_parallel |
|
1563 + option. The order in which deliveries are done is not defined, except that |
|
1564 + all local deliveries happen before any remote deliveries. |
|
1565 + |
|
1566 + * When it encounters a local delivery during a queue run, Exim checks its |
|
1567 + retry database to see if there has been a previous temporary delivery |
|
1568 + failure for the address before running the local transport. If there was a |
|
1569 + previous failure, Exim does not attempt a new delivery until the retry time |
|
1570 + for the address is reached. However, this happens only for delivery |
|
1571 + attempts that are part of a queue run. Local deliveries are always |
|
1572 + attempted when delivery immediately follows message reception, even if |
|
1573 + retry times are set for them. This makes for better behaviour if one |
|
1574 + particular message is causing problems (for example, causing quota |
|
1575 + overflow, or provoking an error in a filter file). |
|
1576 + |
|
1577 + * Remote transports do their own retry handling, since an address may be |
|
1578 + deliverable to one of a number of hosts, each of which may have a different |
|
1579 + retry time. If there have been previous temporary failures and no host has |
|
1580 + reached its retry time, no delivery is attempted, whether in a queue run or |
|
1581 + not. See chapter 32 for details of retry strategies. |
|
1582 + |
|
1583 + * If there were any permanent errors, a bounce message is returned to an |
|
1584 + appropriate address (the sender in the common case), with details of the |
|
1585 + error for each failing address. Exim can be configured to send copies of |
|
1586 + bounce messages to other addresses. |
|
1587 + |
|
1588 + * If one or more addresses suffered a temporary failure, the message is left |
|
1589 + on the queue, to be tried again later. Delivery of these addresses is said |
|
1590 + to be deferred. |
|
1591 + |
|
1592 + * When all the recipient addresses have either been delivered or bounced, |
|
1593 + handling of the message is complete. The spool files and message log are |
|
1594 + deleted, though the message log can optionally be preserved if required. |
|
1595 + |
|
1596 +3.14Â Retry mechanism |
|
1597 + |
|
1598 +Exim's mechanism for retrying messages that fail to get delivered at the first |
|
1599 +attempt is the queue runner process. You must either run an Exim daemon that |
|
1600 +uses the -q option with a time interval to start queue runners at regular |
|
1601 +intervals, or use some other means (such as cron) to start them. If you do not |
|
1602 +arrange for queue runners to be run, messages that fail temporarily at the |
|
1603 +first attempt will remain on your queue for ever. A queue runner process works |
|
1604 +its way through the queue, one message at a time, trying each delivery that has |
|
1605 +passed its retry time. You can run several queue runners at once. |
|
1606 + |
|
1607 +Exim uses a set of configured rules to determine when next to retry the failing |
|
1608 +address (see chapter 32). These rules also specify when Exim should give up |
|
1609 +trying to deliver to the address, at which point it generates a bounce message. |
|
1610 +If no retry rules are set for a particular host, address, and error |
|
1611 +combination, no retries are attempted, and temporary errors are treated as |
|
1612 +permanent. |
|
1613 + |
|
1614 +3.15Â Temporary delivery failure |
|
1615 + |
|
1616 +There are many reasons why a message may not be immediately deliverable to a |
|
1617 +particular address. Failure to connect to a remote machine (because it, or the |
|
1618 +connection to it, is down) is one of the most common. Temporary failures may be |
|
1619 +detected during routing as well as during the transport stage of delivery. |
|
1620 +Local deliveries may be delayed if NFS files are unavailable, or if a mailbox |
|
1621 +is on a file system where the user is over quota. Exim can be configured to |
|
1622 +impose its own quotas on local mailboxes; where system quotas are set they will |
|
1623 +also apply. |
|
1624 + |
|
1625 +If a host is unreachable for a period of time, a number of messages may be |
|
1626 +waiting for it by the time it recovers, and sending them in a single SMTP |
|
1627 +connection is clearly beneficial. Whenever a delivery to a remote host is |
|
1628 +deferred, Exim makes a note in its hints database, and whenever a successful |
|
1629 +SMTP delivery has happened, it looks to see if any other messages are waiting |
|
1630 +for the same host. If any are found, they are sent over the same SMTP |
|
1631 +connection, subject to a configuration limit as to the maximum number in any |
|
1632 +one connection. |
|
1633 + |
|
1634 +3.16Â Permanent delivery failure |
|
1635 + |
|
1636 +When a message cannot be delivered to some or all of its intended recipients, a |
|
1637 +bounce message is generated. Temporary delivery failures turn into permanent |
|
1638 +errors when their timeout expires. All the addresses that fail in a given |
|
1639 +delivery attempt are listed in a single message. If the original message has |
|
1640 +many recipients, it is possible for some addresses to fail in one delivery |
|
1641 +attempt and others to fail subsequently, giving rise to more than one bounce |
|
1642 +message. The wording of bounce messages can be customized by the administrator. |
|
1643 +See chapter 46 for details. |
|
1644 + |
|
1645 +Bounce messages contain an X-Failed-Recipients: header line that lists the |
|
1646 +failed addresses, for the benefit of programs that try to analyse such messages |
|
1647 +automatically. |
|
1648 + |
|
1649 +A bounce message is normally sent to the sender of the original message, as |
|
1650 +obtained from the message's envelope. For incoming SMTP messages, this is the |
|
1651 +address given in the MAIL command. However, when an address is expanded via a |
|
1652 +forward or alias file, an alternative address can be specified for delivery |
|
1653 +failures of the generated addresses. For a mailing list expansion (see section |
|
1654 +47.2) it is common to direct bounce messages to the manager of the list. |
|
1655 + |
|
1656 +3.17Â Failures to deliver bounce messages |
|
1657 + |
|
1658 +If a bounce message (either locally generated or received from a remote host) |
|
1659 +itself suffers a permanent delivery failure, the message is left on the queue, |
|
1660 +but it is frozen, awaiting the attention of an administrator. There are options |
|
1661 +that can be used to make Exim discard such failed messages, or to keep them for |
|
1662 +only a short time (see timeout_frozen_after and ignore_bounce_errors_after). |
|
1663 + |
|
1664 +4. Building and installing Exim |
|
1665 + |
|
1666 +4.1Â Unpacking |
|
1667 + |
|
1668 +Exim is distributed as a gzipped or bzipped tar file which, when unpacked, |
|
1669 +creates a directory with the name of the current release (for example, |
|
1670 +exim-4.74) into which the following files are placed: |
|
1671 + |
|
1672 +Â Â Â Â ACKNOWLEDGMENTS contains some acknowledgments |
|
1673 +Â Â Â Â CHANGES contains a reference to where changes are documented |
|
1674 +Â Â Â Â LICENCE the GNU General Public Licence |
|
1675 +Â Â Â Â Makefile top-level make file |
|
1676 +Â Â Â Â NOTICE conditions for the use of Exim |
|
1677 +Â Â Â Â README list of files, directories and simple build |
|
1678 + instructions |
|
1679 + |
|
1680 +Other files whose names begin with README may also be present. The following |
|
1681 +subdirectories are created: |
|
1682 + |
|
1683 +Â Â Â Â Local an empty directory for local configuration files |
|
1684 +Â Â Â Â OS OS-specific files |
|
1685 +Â Â Â Â doc documentation files |
|
1686 +Â Â Â Â exim_monitor source files for the Exim monitor |
|
1687 +Â Â Â Â scripts scripts used in the build process |
|
1688 +Â Â Â Â src remaining source files |
|
1689 +Â Â Â Â util independent utilities |
|
1690 + |
|
1691 +The main utility programs are contained in the src directory, and are built |
|
1692 +with the Exim binary. The util directory contains a few optional scripts that |
|
1693 +may be useful to some sites. |
|
1694 + |
|
1695 +4.2Â Multiple machine architectures and operating systems |
|
1696 + |
|
1697 +The building process for Exim is arranged to make it easy to build binaries for |
|
1698 +a number of different architectures and operating systems from the same set of |
|
1699 +source files. Compilation does not take place in the src directory. Instead, a |
|
1700 +build directory is created for each architecture and operating system. Symbolic |
|
1701 +links to the sources are installed in this directory, which is where the actual |
|
1702 +building takes place. In most cases, Exim can discover the machine architecture |
|
1703 +and operating system for itself, but the defaults can be overridden if |
|
1704 +necessary. |
|
1705 + |
|
1706 +4.3Â PCRE library |
|
1707 + |
|
1708 +Exim no longer has an embedded PCRE library as the vast majority of modern |
|
1709 +systems include PCRE as a system library, although you may need to install the |
|
1710 +PCRE or PCRE development package for your operating system. If your system has |
|
1711 +a normal PCRE installation the Exim build process will need no further |
|
1712 +configuration. If the library or the headers are in an unusual location you |
|
1713 +will need to set the PCRE_LIBS and INCLUDE directives appropriately. If your |
|
1714 +operating system has no PCRE support then you will need to obtain and build the |
|
1715 +current PCRE from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/. |
|
1716 + |
|
1717 +4.4Â DBM libraries |
|
1718 + |
|
1719 +Even if you do not use any DBM files in your configuration, Exim still needs a |
|
1720 +DBM library in order to operate, because it uses indexed files for its hints |
|
1721 +databases. Unfortunately, there are a number of DBM libraries in existence, and |
|
1722 +different operating systems often have different ones installed. |
|
1723 + |
|
1724 +If you are using Solaris, IRIX, one of the modern BSD systems, or a modern |
|
1725 +Linux distribution, the DBM configuration should happen automatically, and you |
|
1726 +may be able to ignore this section. Otherwise, you may have to learn more than |
|
1727 +you would like about DBM libraries from what follows. |
|
1728 + |
|
1729 +Licensed versions of Unix normally contain a library of DBM functions operating |
|
1730 +via the ndbm interface, and this is what Exim expects by default. Free versions |
|
1731 +of Unix seem to vary in what they contain as standard. In particular, some |
|
1732 +early versions of Linux have no default DBM library, and different distributors |
|
1733 +have chosen to bundle different libraries with their packaged versions. |
|
1734 +However, the more recent releases seem to have standardized on the Berkeley DB |
|
1735 +library. |
|
1736 + |
|
1737 +Different DBM libraries have different conventions for naming the files they |
|
1738 +use. When a program opens a file called dbmfile, there are several |
|
1739 +possibilities: |
|
1740 + |
|
1741 + 1. A traditional ndbm implementation, such as that supplied as part of |
|
1742 + Solaris, operates on two files called dbmfile.dir and dbmfile.pag. |
|
1743 + |
|
1744 + 2. The GNU library, gdbm, operates on a single file. If used via its ndbm |
|
1745 + compatibility interface it makes two different hard links to it with names |
|
1746 + dbmfile.dir and dbmfile.pag, but if used via its native interface, the file |
|
1747 + name is used unmodified. |
|
1748 + |
|
1749 + 3. The Berkeley DB package, if called via its ndbm compatibility interface, |
|
1750 + operates on a single file called dbmfile.db, but otherwise looks to the |
|
1751 + programmer exactly the same as the traditional ndbm implementation. |
|
1752 + |
|
1753 + 4. If the Berkeley package is used in its native mode, it operates on a single |
|
1754 + file called dbmfile; the programmer's interface is somewhat different to |
|
1755 + the traditional ndbm interface. |
|
1756 + |
|
1757 + 5. To complicate things further, there are several very different versions of |
|
1758 + the Berkeley DB package. Version 1.85 was stable for a very long time, |
|
1759 + releases 2.x and 3.x were current for a while, but the latest versions are |
|
1760 + now numbered 4.x. Maintenance of some of the earlier releases has ceased. |
|
1761 + All versions of Berkeley DB can be obtained from http://www.sleepycat.com/. |
|
1762 + |
|
1763 + 6. Yet another DBM library, called tdb, is available from http:// |
|
1764 + download.sourceforge.net/tdb. It has its own interface, and also operates |
|
1765 + on a single file. |
|
1766 + |
|
1767 +Exim and its utilities can be compiled to use any of these interfaces. In order |
|
1768 +to use any version of the Berkeley DB package in native mode, you must set |
|
1769 +USE_DB in an appropriate configuration file (typically Local/Makefile). For |
|
1770 +example: |
|
1771 + |
|
1772 +USE_DB=yes |
|
1773 + |
|
1774 +Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An error is |
|
1775 +diagnosed if you set more than one of these. |
|
1776 + |
|
1777 +At the lowest level, the build-time configuration sets none of these options, |
|
1778 +thereby assuming an interface of type (1). However, some operating system |
|
1779 +configuration files (for example, those for the BSD operating systems and |
|
1780 +Linux) assume type (4) by setting USE_DB as their default, and the |
|
1781 +configuration files for Cygwin set USE_GDBM. Anything you set in Local/Makefile |
|
1782 +, however, overrides these system defaults. |
|
1783 + |
|
1784 +As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be necessary to |
|
1785 +set DBMLIB, to cause inclusion of the appropriate library, as in one of these |
|
1786 +lines: |
|
1787 + |
|
1788 +DBMLIB = -ldb |
|
1789 +DBMLIB = -ltdb |
|
1790 + |
|
1791 +Settings like that will work if the DBM library is installed in the standard |
|
1792 +place. Sometimes it is not, and the library's header file may also not be in |
|
1793 +the default path. You may need to set INCLUDE to specify where the header file |
|
1794 +is, and to specify the path to the library more fully in DBMLIB, as in this |
|
1795 +example: |
|
1796 + |
|
1797 +INCLUDE=-I/usr/local/include/db-4.1 |
|
1798 +DBMLIB=/usr/local/lib/db-4.1/libdb.a |
|
1799 + |
|
1800 +There is further detailed discussion about the various DBM libraries in the |
|
1801 +file doc/dbm.discuss.txt in the Exim distribution. |
|
1802 + |
|
1803 +4.5Â Pre-building configuration |
|
1804 + |
|
1805 +Before building Exim, a local configuration file that specifies options |
|
1806 +independent of any operating system has to be created with the name Local/ |
|
1807 +Makefile. A template for this file is supplied as the file src/EDITME, and it |
|
1808 +contains full descriptions of all the option settings therein. These |
|
1809 +descriptions are therefore not repeated here. If you are building Exim for the |
|
1810 +first time, the simplest thing to do is to copy src/EDITME to Local/Makefile, |
|
1811 +then read it and edit it appropriately. |
|
1812 + |
|
1813 +There are three settings that you must supply, because Exim will not build |
|
1814 +without them. They are the location of the run time configuration file |
|
1815 +(CONFIGURE_FILE), the directory in which Exim binaries will be installed |
|
1816 +(BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and maybe |
|
1817 +EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be a |
|
1818 +colon-separated list of file names; Exim uses the first of them that exists. |
|
1819 + |
|
1820 +There are a few other parameters that can be specified either at build time or |
|
1821 +at run time, to enable the same binary to be used on a number of different |
|
1822 +machines. However, if the locations of Exim's spool directory and log file |
|
1823 +directory (if not within the spool directory) are fixed, it is recommended that |
|
1824 +you specify them in Local/Makefile instead of at run time, so that errors |
|
1825 +detected early in Exim's execution (such as a malformed configuration file) can |
|
1826 +be logged. |
|
1827 + |
|
1828 +Exim's interfaces for calling virus and spam scanning software directly from |
|
1829 +access control lists are not compiled by default. If you want to include these |
|
1830 +facilities, you need to set |
|
1831 + |
|
1832 +WITH_CONTENT_SCAN=yes |
|
1833 + |
|
1834 +in your Local/Makefile. For details of the facilities themselves, see chapter |
|
1835 +41. |
|
1836 + |
|
1837 +If you are going to build the Exim monitor, a similar configuration process is |
|
1838 +required. The file exim_monitor/EDITME must be edited appropriately for your |
|
1839 +installation and saved under the name Local/eximon.conf. If you are happy with |
|
1840 +the default settings described in exim_monitor/EDITME, Local/eximon.conf can be |
|
1841 +empty, but it must exist. |
|
1842 + |
|
1843 +This is all the configuration that is needed in straightforward cases for known |
|
1844 +operating systems. However, the building process is set up so that it is easy |
|
1845 +to override options that are set by default or by operating-system-specific |
|
1846 +configuration files, for example to change the name of the C compiler, which |
|
1847 +defaults to gcc. See section 4.13 below for details of how to do this. |
|
1848 + |
|
1849 +4.6Â Support for iconv() |
|
1850 + |
|
1851 +The contents of header lines in messages may be encoded according to the rules |
|
1852 +described RFC 2047. This makes it possible to transmit characters that are not |
|
1853 +in the ASCII character set, and to label them as being in a particular |
|
1854 +character set. When Exim is inspecting header lines by means of the $h_ |
|
1855 +mechanism, it decodes them, and translates them into a specified character set |
|
1856 +(default ISO-8859-1). The translation is possible only if the operating system |
|
1857 +supports the iconv() function. |
|
1858 + |
|
1859 +However, some of the operating systems that supply iconv() do not support very |
|
1860 +many conversions. The GNU libiconv library (available from http://www.gnu.org/ |
|
1861 +software/libiconv/) can be installed on such systems to remedy this deficiency, |
|
1862 +as well as on systems that do not supply iconv() at all. After installing |
|
1863 +libiconv, you should add |
|
1864 + |
|
1865 +HAVE_ICONV=yes |
|
1866 + |
|
1867 +to your Local/Makefile and rebuild Exim. |
|
1868 + |
|
1869 +4.7Â Including TLS/SSL encryption support |
|
1870 + |
|
1871 +Exim can be built to support encrypted SMTP connections, using the STARTTLS |
|
1872 +command as per RFC 2487. It can also support legacy clients that expect to |
|
1873 +start a TLS session immediately on connection to a non-standard port (see the |
|
1874 +tls_on_connect_ports runtime option and the -tls-on-connect command line |
|
1875 +option). |
|
1876 + |
|
1877 +If you want to build Exim with TLS support, you must first install either the |
|
1878 +OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for |
|
1879 +implementing SSL. |
|
1880 + |
|
1881 +If OpenSSL is installed, you should set |
|
1882 + |
|
1883 +SUPPORT_TLS=yes |
|
1884 +TLS_LIBS=-lssl -lcrypto |
|
1885 + |
|
1886 +in Local/Makefile. You may also need to specify the locations of the OpenSSL |
|
1887 +library and include files. For example: |
|
1888 + |
|
1889 +SUPPORT_TLS=yes |
|
1890 +TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto |
|
1891 +TLS_INCLUDE=-I/usr/local/openssl/include/ |
|
1892 + |
|
1893 +If GnuTLS is installed, you should set |
|
1894 + |
|
1895 +SUPPORT_TLS=yes |
|
1896 +USE_GNUTLS=yes |
|
1897 +TLS_LIBS=-lgnutls -ltasn1 -lgcrypt |
|
1898 + |
|
1899 +in Local/Makefile, and again you may need to specify the locations of the |
|
1900 +library and include files. For example: |
|
1901 + |
|
1902 +SUPPORT_TLS=yes |
|
1903 +USE_GNUTLS=yes |
|
1904 +TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt |
|
1905 +TLS_INCLUDE=-I/usr/gnu/include |
|
1906 + |
|
1907 +You do not need to set TLS_INCLUDE if the relevant directory is already |
|
1908 +specified in INCLUDE. Details of how to configure Exim to make use of TLS are |
|
1909 +given in chapter 39. |
|
1910 + |
|
1911 +4.8Â Use of tcpwrappers |
|
1912 + |
|
1913 +Exim can be linked with the tcpwrappers library in order to check incoming SMTP |
|
1914 +calls using the tcpwrappers control files. This may be a convenient alternative |
|
1915 +to Exim's own checking facilities for installations that are already making use |
|
1916 +of tcpwrappers for other purposes. To do this, you should set USE_TCP_WRAPPERS |
|
1917 +in Local/Makefile, arrange for the file tcpd.h to be available at compile time, |
|
1918 +and also ensure that the library libwrap.a is available at link time, typically |
|
1919 +by including -lwrap in EXTRALIBS_EXIM. For example, if tcpwrappers is installed |
|
1920 +in /usr/local, you might have |
|
1921 + |
|
1922 +USE_TCP_WRAPPERS=yes |
|
1923 +CFLAGS=-O -I/usr/local/include |
|
1924 +EXTRALIBS_EXIM=-L/usr/local/lib -lwrap |
|
1925 + |
|
1926 +in Local/Makefile. The daemon name to use in the tcpwrappers control files is |
|
1927 +"exim". For example, the line |
|
1928 + |
|
1929 +exim : LOCAL 192.168.1. .friendly.domain.example |
|
1930 + |
|
1931 +in your /etc/hosts.allow file allows connections from the local host, from the |
|
1932 +subnet 192.168.1.0/24, and from all hosts in friendly.domain.example. All other |
|
1933 +connections are denied. The daemon name used by tcpwrappers can be changed at |
|
1934 +build time by setting TCP_WRAPPERS_DAEMON_NAME in in Local/Makefile, or by |
|
1935 +setting tcp_wrappers_daemon_name in the configure file. Consult the tcpwrappers |
|
1936 +documentation for further details. |
|
1937 + |
|
1938 +4.9Â Including support for IPv6 |
|
1939 + |
|
1940 +Exim contains code for use on systems that have IPv6 support. Setting |
|
1941 +"HAVE_IPV6=YES" in Local/Makefile causes the IPv6 code to be included; it may |
|
1942 +also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems where the IPv6 |
|
1943 +support is not fully integrated into the normal include and library files. |
|
1944 + |
|
1945 +Two different types of DNS record for handling IPv6 addresses have been |
|
1946 +defined. AAAA records (analogous to A records for IPv4) are in use, and are |
|
1947 +currently seen as the mainstream. Another record type called A6 was proposed as |
|
1948 +better than AAAA because it had more flexibility. However, it was felt to be |
|
1949 +over-complex, and its status was reduced to "experimental". It is not known if |
|
1950 +anyone is actually using A6 records. Exim has support for A6 records, but this |
|
1951 +is included only if you set "SUPPORT_A6=YES" in Local/Makefile. The support has |
|
1952 +not been tested for some time. |
|
1953 + |
|
1954 +4.10Â Dynamically loaded lookup module support |
|
1955 + |
|
1956 +On some platforms, Exim supports not compiling all lookup types directly into |
|
1957 +the main binary, instead putting some into external modules which can be loaded |
|
1958 +on demand. This permits packagers to build Exim with support for lookups with |
|
1959 +extensive library dependencies without requiring all users to install all of |
|
1960 +those dependencies. Most, but not all, lookup types can be built this way. |
|
1961 + |
|
1962 +Set "LOOKUP_MODULE_DIR" to the directory into which the modules will be |
|
1963 +installed; Exim will only load modules from that directory, as a security |
|
1964 +measure. You will need to set "CFLAGS_DYNAMIC" if not already defined for your |
|
1965 +OS; see OS/Makefile-Linux for an example. Some other requirements for adjusting |
|
1966 +"EXTRALIBS" may also be necessary, see src/EDITME for details. |
|
1967 + |
|
1968 +Then, for each module to be loaded dynamically, define the relevant "LOOKUP_"< |
|
1969 +lookup_type> flags to have the value "2" instead of "yes". For example, this |
|
1970 +will build in lsearch but load sqlite and mysql support on demand: |
|
1971 + |
|
1972 +LOOKUP_LSEARCH=yes |
|
1973 +LOOKUP_SQLITE=2 |
|
1974 +LOOKUP_MYSQL=2 |
|
1975 + |
|
1976 +4.11Â The building process |
|
1977 + |
|
1978 +Once Local/Makefile (and Local/eximon.conf, if required) have been created, run |
|
1979 +make at the top level. It determines the architecture and operating system |
|
1980 +types, and creates a build directory if one does not exist. For example, on a |
|
1981 +Sun system running Solaris 8, the directory build-SunOS5-5.8-sparc is created. |
|
1982 +Symbolic links to relevant source files are installed in the build directory. |
|
1983 + |
|
1984 +Warning: The -j (parallel) flag must not be used with make; the building |
|
1985 +process fails if it is set. |
|
1986 + |
|
1987 +If this is the first time make has been run, it calls a script that builds a |
|
1988 +make file inside the build directory, using the configuration files from the |
|
1989 +Local directory. The new make file is then passed to another instance of make. |
|
1990 +This does the real work, building a number of utility scripts, and then |
|
1991 +compiling and linking the binaries for the Exim monitor (if configured), a |
|
1992 +number of utility programs, and finally Exim itself. The command "make |
|
1993 +makefile" can be used to force a rebuild of the make file in the build |
|
1994 +directory, should this ever be necessary. |
|
1995 + |
|
1996 +If you have problems building Exim, check for any comments there may be in the |
|
1997 +README file concerning your operating system, and also take a look at the FAQ, |
|
1998 +where some common problems are covered. |
|
1999 + |
|
2000 +4.12Â Output from "make" |
|
2001 + |
|
2002 +The output produced by the make process for compile lines is often very |
|
2003 +unreadable, because these lines can be very long. For this reason, the normal |
|
2004 +output is suppressed by default, and instead output similar to that which |
|
2005 +appears when compiling the 2.6 Linux kernel is generated: just a short line for |
|
2006 +each module that is being compiled or linked. However, it is still possible to |
|
2007 +get the full output, by calling make like this: |
|
2008 + |
|
2009 +FULLECHO='' make -e |
|
2010 + |
|
2011 +The value of FULLECHO defaults to "@", the flag character that suppresses |
|
2012 +command reflection in make. When you ask for the full output, it is given in |
|
2013 +addition to the short output. |
|
2014 + |
|
2015 +4.13Â Overriding build-time options for Exim |
|
2016 + |
|
2017 +The main make file that is created at the beginning of the building process |
|
2018 +consists of the concatenation of a number of files which set configuration |
|
2019 +values, followed by a fixed set of make instructions. If a value is set more |
|
2020 +than once, the last setting overrides any previous ones. This provides a |
|
2021 +convenient way of overriding defaults. The files that are concatenated are, in |
|
2022 +order: |
|
2023 + |
|
2024 +OS/Makefile-Default |
|
2025 +OS/Makefile-<ostype> |
|
2026 +Local/Makefile |
|
2027 +Local/Makefile-<ostype> |
|
2028 +Local/Makefile-<archtype> |
|
2029 +Local/Makefile-<ostype>-<archtype> |
|
2030 +OS/Makefile-Base |
|
2031 + |
|
2032 +where <ostype> is the operating system type and <archtype> is the architecture |
|
2033 +type. Local/Makefile is required to exist, and the building process fails if it |
|
2034 +is absent. The other three Local files are optional, and are often not needed. |
|
2035 + |
|
2036 +The values used for <ostype> and <archtype> are obtained from scripts called |
|
2037 +scripts/os-type and scripts/arch-type respectively. If either of the |
|
2038 +environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their values are |
|
2039 +used, thereby providing a means of forcing particular settings. Otherwise, the |
|
2040 +scripts try to get values from the uname command. If this fails, the shell |
|
2041 +variables OSTYPE and ARCHTYPE are inspected. A number of ad hoc transformations |
|
2042 +are then applied, to produce the standard names that Exim expects. You can run |
|
2043 +these scripts directly from the shell in order to find out what values are |
|
2044 +being used on your system. |
|
2045 + |
|
2046 +OS/Makefile-Default contains comments about the variables that are set therein. |
|
2047 +Some (but not all) are mentioned below. If there is something that needs |
|
2048 +changing, review the contents of this file and the contents of the make file |
|
2049 +for your operating system (OS/Makefile-<ostype>) to see what the default values |
|
2050 +are. |
|
2051 + |
|
2052 +If you need to change any of the values that are set in OS/Makefile-Default or |
|
2053 +in OS/Makefile-<ostype>, or to add any new definitions, you do not need to |
|
2054 +change the original files. Instead, you should make the changes by putting the |
|
2055 +new values in an appropriate Local file. For example, when building Exim in |
|
2056 +many releases of the Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1) |
|
2057 +operating system, it is necessary to specify that the C compiler is called cc |
|
2058 +rather than gcc. Also, the compiler must be called with the option -std1, to |
|
2059 +make it recognize some of the features of Standard C that Exim uses. (Most |
|
2060 +other compilers recognize Standard C by default.) To do this, you should create |
|
2061 +a file called Local/Makefile-OSF1 containing the lines |
|
2062 + |
|
2063 +CC=cc |
|
2064 +CFLAGS=-std1 |
|
2065 + |
|
2066 +If you are compiling for just one operating system, it may be easier to put |
|
2067 +these lines directly into Local/Makefile. |
|
2068 + |
|
2069 +Keeping all your local configuration settings separate from the distributed |
|
2070 +files makes it easy to transfer them to new versions of Exim simply by copying |
|
2071 +the contents of the Local directory. |
|
2072 + |
|
2073 +Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file |
|
2074 +lookup, but not all systems have these components installed, so the default is |
|
2075 +not to include the relevant code in the binary. All the different kinds of file |
|
2076 +and database lookup that Exim supports are implemented as separate code modules |
|
2077 +which are included only if the relevant compile-time options are set. In the |
|
2078 +case of LDAP, NIS, and NIS+, the settings for Local/Makefile are: |
|
2079 + |
|
2080 +LOOKUP_LDAP=yes |
|
2081 +LOOKUP_NIS=yes |
|
2082 +LOOKUP_NISPLUS=yes |
|
2083 + |
|
2084 +and similar settings apply to the other lookup types. They are all listed in |
|
2085 +src/EDITME. In many cases the relevant include files and interface libraries |
|
2086 +need to be installed before compiling Exim. However, there are some optional |
|
2087 +lookup types (such as cdb) for which the code is entirely contained within |
|
2088 +Exim, and no external include files or libraries are required. When a lookup |
|
2089 +type is not included in the binary, attempts to configure Exim to use it cause |
|
2090 +run time configuration errors. |
|
2091 + |
|
2092 +Exim can be linked with an embedded Perl interpreter, allowing Perl subroutines |
|
2093 +to be called during string expansion. To enable this facility, |
|
2094 + |
|
2095 +EXIM_PERL=perl.o |
|
2096 + |
|
2097 +must be defined in Local/Makefile. Details of this facility are given in |
|
2098 +chapter 12. |
|
2099 + |
|
2100 +The location of the X11 libraries is something that varies a lot between |
|
2101 +operating systems, and there may be different versions of X11 to cope with. |
|
2102 +Exim itself makes no use of X11, but if you are compiling the Exim monitor, the |
|
2103 +X11 libraries must be available. The following three variables are set in OS/ |
|
2104 +Makefile-Default: |
|
2105 + |
|
2106 +X11=/usr/X11R6 |
|
2107 +XINCLUDE=-I$(X11)/include |
|
2108 +XLFLAGS=-L$(X11)/lib |
|
2109 + |
|
2110 +These are overridden in some of the operating-system configuration files. For |
|
2111 +example, in OS/Makefile-SunOS5 there is |
|
2112 + |
|
2113 +X11=/usr/openwin |
|
2114 +XINCLUDE=-I$(X11)/include |
|
2115 +XLFLAGS=-L$(X11)/lib -R$(X11)/lib |
|
2116 + |
|
2117 +If you need to override the default setting for your operating system, place a |
|
2118 +definition of all three of these variables into your Local/Makefile-<ostype> |
|
2119 +file. |
|
2120 + |
|
2121 +If you need to add any extra libraries to the link steps, these can be put in a |
|
2122 +variable called EXTRALIBS, which appears in all the link commands, but by |
|
2123 +default is not defined. In contrast, EXTRALIBS_EXIM is used only on the command |
|
2124 +for linking the main Exim binary, and not for any associated utilities. |
|
2125 + |
|
2126 +There is also DBMLIB, which appears in the link commands for binaries that use |
|
2127 +DBM functions (see also section 4.4). Finally, there is EXTRALIBS_EXIMON, which |
|
2128 +appears only in the link step for the Exim monitor binary, and which can be |
|
2129 +used, for example, to include additional X11 libraries. |
|
2130 + |
|
2131 +The make file copes with rebuilding Exim correctly if any of the configuration |
|
2132 +files are edited. However, if an optional configuration file is deleted, it is |
|
2133 +necessary to touch the associated non-optional file (that is, Local/Makefile or |
|
2134 +Local/eximon.conf) before rebuilding. |
|
2135 + |
|
2136 +4.14Â OS-specific header files |
|
2137 + |
|
2138 +The OS directory contains a number of files with names of the form os.h- |
|
2139 +<ostype>. These are system-specific C header files that should not normally |
|
2140 +need to be changed. There is a list of macro settings that are recognized in |
|
2141 +the file OS/os.configuring, which should be consulted if you are porting Exim |
|
2142 +to a new operating system. |
|
2143 + |
|
2144 +4.15Â Overriding build-time options for the monitor |
|
2145 + |
|
2146 +A similar process is used for overriding things when building the Exim monitor, |
|
2147 +where the files that are involved are |
|
2148 + |
|
2149 +OS/eximon.conf-Default |
|
2150 +OS/eximon.conf-<ostype> |
|
2151 +Local/eximon.conf |
|
2152 +Local/eximon.conf-<ostype> |
|
2153 +Local/eximon.conf-<archtype> |
|
2154 +Local/eximon.conf-<ostype>-<archtype> |
|
2155 + |
|
2156 +As with Exim itself, the final three files need not exist, and in this case the |
|
2157 +OS/eximon.conf-<ostype> file is also optional. The default values in OS/ |
|
2158 +eximon.conf-Default can be overridden dynamically by setting environment |
|
2159 +variables of the same name, preceded by EXIMON_. For example, setting |
|
2160 +EXIMON_LOG_DEPTH in the environment overrides the value of LOG_DEPTH at run |
|
2161 +time. |
|
2162 + |
|
2163 +4.16Â Installing Exim binaries and scripts |
|
2164 + |
|
2165 +The command "make install" runs the exim_install script with no arguments. The |
|
2166 +script copies binaries and utility scripts into the directory whose name is |
|
2167 +specified by the BIN_DIRECTORY setting in Local/Makefile. The install script |
|
2168 +copies files only if they are newer than the files they are going to replace. |
|
2169 +The Exim binary is required to be owned by root and have the setuid bit set, |
|
2170 +for normal configurations. Therefore, you must run "make install" as root so |
|
2171 +that it can set up the Exim binary in this way. However, in some special |
|
2172 +situations (for example, if a host is doing no local deliveries) it may be |
|
2173 +possible to run Exim without making the binary setuid root (see chapter 52 for |
|
2174 +details). |
|
2175 + |
|
2176 +Exim's run time configuration file is named by the CONFIGURE_FILE setting in |
|
2177 +Local/Makefile. If this names a single file, and the file does not exist, the |
|
2178 +default configuration file src/configure.default is copied there by the |
|
2179 +installation script. If a run time configuration file already exists, it is |
|
2180 +left alone. If CONFIGURE_FILE is a colon-separated list, naming several |
|
2181 +alternative files, no default is installed. |
|
2182 + |
|
2183 +One change is made to the default configuration file when it is installed: the |
|
2184 +default configuration contains a router that references a system aliases file. |
|
2185 +The path to this file is set to the value specified by SYSTEM_ALIASES_FILE in |
|
2186 +Local/Makefile (/etc/aliases by default). If the system aliases file does not |
|
2187 +exist, the installation script creates it, and outputs a comment to the user. |
|
2188 + |
|
2189 +The created file contains no aliases, but it does contain comments about the |
|
2190 +aliases a site should normally have. Mail aliases have traditionally been kept |
|
2191 +in /etc/aliases. However, some operating systems are now using /etc/mail/ |
|
2192 +aliases. You should check if yours is one of these, and change Exim's |
|
2193 +configuration if necessary. |
|
2194 + |
|
2195 +The default configuration uses the local host's name as the only local domain, |
|
2196 +and is set up to do local deliveries into the shared directory /var/mail, |
|
2197 +running as the local user. System aliases and .forward files in users' home |
|
2198 +directories are supported, but no NIS or NIS+ support is configured. Domains |
|
2199 +other than the name of the local host are routed using the DNS, with delivery |
|
2200 +over SMTP. |
|
2201 + |
|
2202 +It is possible to install Exim for special purposes (such as building a binary |
|
2203 +distribution) in a private part of the file system. You can do this by a |
|
2204 +command such as |
|
2205 + |
|
2206 +make DESTDIR=/some/directory/ install |
|
2207 + |
|
2208 +This has the effect of pre-pending the specified directory to all the file |
|
2209 +paths, except the name of the system aliases file that appears in the default |
|
2210 +configuration. (If a default alias file is created, its name is modified.) For |
|
2211 +backwards compatibility, ROOT is used if DESTDIR is not set, but this usage is |
|
2212 +deprecated. |
|
2213 + |
|
2214 +Running make install does not copy the Exim 4 conversion script convert4r4. You |
|
2215 +will probably run this only once if you are upgrading from Exim 3. None of the |
|
2216 +documentation files in the doc directory are copied, except for the info files |
|
2217 +when you have set INFO_DIRECTORY, as described in section 4.17 below. |
|
2218 + |
|
2219 +For the utility programs, old versions are renamed by adding the suffix .O to |
|
2220 +their names. The Exim binary itself, however, is handled differently. It is |
|
2221 +installed under a name that includes the version number and the compile number, |
|
2222 +for example exim-4.74-1. The script then arranges for a symbolic link called |
|
2223 +exim to point to the binary. If you are updating a previous version of Exim, |
|
2224 +the script takes care to ensure that the name exim is never absent from the |
|
2225 +directory (as seen by other processes). |
|
2226 + |
|
2227 +If you want to see what the make install will do before running it for real, |
|
2228 +you can pass the -n option to the installation script by this command: |
|
2229 + |
|
2230 +make INSTALL_ARG=-n install |
|
2231 + |
|
2232 +The contents of the variable INSTALL_ARG are passed to the installation script. |
|
2233 +You do not need to be root to run this test. Alternatively, you can run the |
|
2234 +installation script directly, but this must be from within the build directory. |
|
2235 +For example, from the top-level Exim directory you could use this command: |
|
2236 + |
|
2237 +(cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n) |
|
2238 + |
|
2239 +There are two other options that can be supplied to the installation script. |
|
2240 + |
|
2241 + * -no_chown bypasses the call to change the owner of the installed binary to |
|
2242 + root, and the call to make it a setuid binary. |
|
2243 + |
|
2244 + * -no_symlink bypasses the setting up of the symbolic link exim to the |
|
2245 + installed binary. |
|
2246 + |
|
2247 +INSTALL_ARG can be used to pass these options to the script. For example: |
|
2248 + |
|
2249 +make INSTALL_ARG=-no_symlink install |
|
2250 + |
|
2251 +The installation script can also be given arguments specifying which files are |
|
2252 +to be copied. For example, to install just the Exim binary, and nothing else, |
|
2253 +without creating the symbolic link, you could use: |
|
2254 + |
|
2255 +make INSTALL_ARG='-no_symlink exim' install |
|
2256 + |
|
2257 +4.17Â Installing info documentation |
|
2258 + |
|
2259 +Not all systems use the GNU info system for documentation, and for this reason, |
|
2260 +the Texinfo source of Exim's documentation is not included in the main |
|
2261 +distribution. Instead it is available separately from the ftp site (see section |
|
2262 +1.6). |
|
2263 + |
|
2264 +If you have defined INFO_DIRECTORY in Local/Makefile and the Texinfo source of |
|
2265 +the documentation is found in the source tree, running "make install" |
|
2266 +automatically builds the info files and installs them. |
|
2267 + |
|
2268 +4.18Â Setting up the spool directory |
|
2269 + |
|
2270 +When it starts up, Exim tries to create its spool directory if it does not |
|
2271 +exist. The Exim uid and gid are used for the owner and group of the spool |
|
2272 +directory. Sub-directories are automatically created in the spool directory as |
|
2273 +necessary. |
|
2274 + |
|
2275 +4.19Â Testing |
|
2276 + |
|
2277 +Having installed Exim, you can check that the run time configuration file is |
|
2278 +syntactically valid by running the following command, which assumes that the |
|
2279 +Exim binary directory is within your PATH environment variable: |
|
2280 + |
|
2281 +exim -bV |
|
2282 + |
|
2283 +If there are any errors in the configuration file, Exim outputs error messages. |
|
2284 +Otherwise it outputs the version number and build date, the DBM library that is |
|
2285 +being used, and information about which drivers and other optional code modules |
|
2286 +are included in the binary. Some simple routing tests can be done by using the |
|
2287 +address testing option. For example, |
|
2288 + |
|
2289 +exim -bt <local username> |
|
2290 + |
|
2291 +should verify that it recognizes a local mailbox, and |
|
2292 + |
|
2293 +exim -bt <remote address> |
|
2294 + |
|
2295 +a remote one. Then try getting it to deliver mail, both locally and remotely. |
|
2296 +This can be done by passing messages directly to Exim, without going through a |
|
2297 +user agent. For example: |
|
2298 + |
|
2299 +exim -v postmaster@your.domain.example |
|
2300 +From: user@your.domain.example |
|
2301 +To: postmaster@your.domain.example |
|
2302 +Subject: Testing Exim |
|
2303 + |
|
2304 +This is a test message. |
|
2305 +^D |
|
2306 + |
|
2307 +The -v option causes Exim to output some verification of what it is doing. In |
|
2308 +this case you should see copies of three log lines, one for the message's |
|
2309 +arrival, one for its delivery, and one containing "Completed". |
|
2310 + |
|
2311 +If you encounter problems, look at Exim's log files (mainlog and paniclog) to |
|
2312 +see if there is any relevant information there. Another source of information |
|
2313 +is running Exim with debugging turned on, by specifying the -d option. If a |
|
2314 +message is stuck on Exim's spool, you can force a delivery with debugging |
|
2315 +turned on by a command of the form |
|
2316 + |
|
2317 +exim -d -M <exim-message-id> |
|
2318 + |
|
2319 +You must be root or an "admin user" in order to do this. The -d option produces |
|
2320 +rather a lot of output, but you can cut this down to specific areas. For |
|
2321 +example, if you use -d-all+route only the debugging information relevant to |
|
2322 +routing is included. (See the -d option in chapter 5 for more details.) |
|
2323 + |
|
2324 +One specific problem that has shown up on some sites is the inability to do |
|
2325 +local deliveries into a shared mailbox directory, because it does not have the |
|
2326 +"sticky bit" set on it. By default, Exim tries to create a lock file before |
|
2327 +writing to a mailbox file, and if it cannot create the lock file, the delivery |
|
2328 +is deferred. You can get round this either by setting the "sticky bit" on the |
|
2329 +directory, or by setting a specific group for local deliveries and allowing |
|
2330 +that group to create files in the directory (see the comments above the |
|
2331 +local_delivery transport in the default configuration file). Another approach |
|
2332 +is to configure Exim not to use lock files, but just to rely on fcntl() locking |
|
2333 +instead. However, you should do this only if all user agents also use fcntl() |
|
2334 +locking. For further discussion of locking issues, see chapter 26. |
|
2335 + |
|
2336 +One thing that cannot be tested on a system that is already running an MTA is |
|
2337 +the receipt of incoming SMTP mail on the standard SMTP port. However, the -oX |
|
2338 +option can be used to run an Exim daemon that listens on some other port, or |
|
2339 +inetd can be used to do this. The -bh option and the exim_checkaccess utility |
|
2340 +can be used to check out policy controls on incoming SMTP mail. |
|
2341 + |
|
2342 +Testing a new version on a system that is already running Exim can most easily |
|
2343 +be done by building a binary with a different CONFIGURE_FILE setting. From |
|
2344 +within the run time configuration, all other file and directory names that Exim |
|
2345 +uses can be altered, in order to keep it entirely clear of the production |
|
2346 +version. |
|
2347 + |
|
2348 +4.20Â Replacing another MTA with Exim |
|
2349 + |
|
2350 +Building and installing Exim for the first time does not of itself put it in |
|
2351 +general use. The name by which the system's MTA is called by mail user agents |
|
2352 +is either /usr/sbin/sendmail, or /usr/lib/sendmail (depending on the operating |
|
2353 +system), and it is necessary to make this name point to the exim binary in |
|
2354 +order to get the user agents to pass messages to Exim. This is normally done by |
|
2355 +renaming any existing file and making /usr/sbin/sendmail or /usr/lib/sendmail a |
|
2356 +symbolic link to the exim binary. It is a good idea to remove any setuid |
|
2357 +privilege and executable status from the old MTA. It is then necessary to stop |
|
2358 +and restart the mailer daemon, if one is running. |
|
2359 + |
|
2360 +Some operating systems have introduced alternative ways of switching MTAs. For |
|
2361 +example, if you are running FreeBSD, you need to edit the file /etc/mail/ |
|
2362 +mailer.conf instead of setting up a symbolic link as just described. A typical |
|
2363 +example of the contents of this file for running Exim is as follows: |
|
2364 + |
|
2365 +sendmail /usr/exim/bin/exim |
|
2366 +send-mail /usr/exim/bin/exim |
|
2367 +mailq /usr/exim/bin/exim -bp |
|
2368 +newaliases /usr/bin/true |
|
2369 + |
|
2370 +Once you have set up the symbolic link, or edited /etc/mail/mailer.conf, your |
|
2371 +Exim installation is "live". Check it by sending a message from your favourite |
|
2372 +user agent. |
|
2373 + |
|
2374 +You should consider what to tell your users about the change of MTA. Exim may |
|
2375 +have different capabilities to what was previously running, and there are |
|
2376 +various operational differences such as the text of messages produced by |
|
2377 +command line options and in bounce messages. If you allow your users to make |
|
2378 +use of Exim's filtering capabilities, you should make the document entitled |
|
2379 +Exim's interface to mail filtering available to them. |
|
2380 + |
|
2381 +4.21Â Upgrading Exim |
|
2382 + |
|
2383 +If you are already running Exim on your host, building and installing a new |
|
2384 +version automatically makes it available to MUAs, or any other programs that |
|
2385 +call the MTA directly. However, if you are running an Exim daemon, you do need |
|
2386 +to send it a HUP signal, to make it re-execute itself, and thereby pick up the |
|
2387 +new binary. You do not need to stop processing mail in order to install a new |
|
2388 +version of Exim. The install script does not modify an existing runtime |
|
2389 +configuration file. |
|
2390 + |
|
2391 +4.22Â Stopping the Exim daemon on Solaris |
|
2392 + |
|
2393 +The standard command for stopping the mailer daemon on Solaris is |
|
2394 + |
|
2395 +/etc/init.d/sendmail stop |
|
2396 + |
|
2397 +If /usr/lib/sendmail has been turned into a symbolic link, this script fails to |
|
2398 +stop Exim because it uses the command ps -e and greps the output for the text |
|
2399 +"sendmail"; this is not present because the actual program name (that is, |
|
2400 +"exim") is given by the ps command with these options. A solution is to replace |
|
2401 +the line that finds the process id with something like |
|
2402 + |
|
2403 +pid=`cat /var/spool/exim/exim-daemon.pid` |
|
2404 + |
|
2405 +to obtain the daemon's pid directly from the file that Exim saves it in. |
|
2406 + |
|
2407 +Note, however, that stopping the daemon does not "stop Exim". Messages can |
|
2408 +still be received from local processes, and if automatic delivery is configured |
|
2409 +(the normal case), deliveries will still occur. |
|
2410 + |
|
2411 +5. The Exim command line |
|
2412 + |
|
2413 +Exim's command line takes the standard Unix form of a sequence of options, each |
|
2414 +starting with a hyphen character, followed by a number of arguments. The |
|
2415 +options are compatible with the main options of Sendmail, and there are also |
|
2416 +some additional options, some of which are compatible with Smail 3. Certain |
|
2417 +combinations of options do not make sense, and provoke an error if used. The |
|
2418 +form of the arguments depends on which options are set. |
|
2419 + |
|
2420 +5.1Â Setting options by program name |
|
2421 + |
|
2422 +If Exim is called under the name mailq, it behaves as if the option -bp were |
|
2423 +present before any other options. The -bp option requests a listing of the |
|
2424 +contents of the mail queue on the standard output. This feature is for |
|
2425 +compatibility with some systems that contain a command of that name in one of |
|
2426 +the standard libraries, symbolically linked to /usr/sbin/sendmail or /usr/lib/ |
|
2427 +sendmail. |
|
2428 + |
|
2429 +If Exim is called under the name rsmtp it behaves as if the option -bS were |
|
2430 +present before any other options, for compatibility with Smail. The -bS option |
|
2431 +is used for reading in a number of messages in batched SMTP format. |
|
2432 + |
|
2433 +If Exim is called under the name rmail it behaves as if the -i and -oee options |
|
2434 +were present before any other options, for compatibility with Smail. The name |
|
2435 +rmail is used as an interface by some UUCP systems. |
|
2436 + |
|
2437 +If Exim is called under the name runq it behaves as if the option -q were |
|
2438 +present before any other options, for compatibility with Smail. The -q option |
|
2439 +causes a single queue runner process to be started. |
|
2440 + |
|
2441 +If Exim is called under the name newaliases it behaves as if the option -bi |
|
2442 +were present before any other options, for compatibility with Sendmail. This |
|
2443 +option is used for rebuilding Sendmail's alias file. Exim does not have the |
|
2444 +concept of a single alias file, but can be configured to run a given command if |
|
2445 +called with the -bi option. |
|
2446 + |
|
2447 +5.2Â Trusted and admin users |
|
2448 + |
|
2449 +Some Exim options are available only to trusted users and others are available |
|
2450 +only to admin users. In the description below, the phrases "Exim user" and |
|
2451 +"Exim group" mean the user and group defined by EXIM_USER and EXIM_GROUP in |
|
2452 +Local/Makefile or set by the exim_user and exim_group options. These do not |
|
2453 +necessarily have to use the name "exim". |
|
2454 + |
|
2455 + * The trusted users are root, the Exim user, any user listed in the |
|
2456 + trusted_users configuration option, and any user whose current group or any |
|
2457 + supplementary group is one of those listed in the trusted_groups |
|
2458 + configuration option. Note that the Exim group is not automatically |
|
2459 + trusted. |
|
2460 + |
|
2461 + Trusted users are always permitted to use the -f option or a leading |
|
2462 + "From " line to specify the envelope sender of a message that is passed to |
|
2463 + Exim through the local interface (see the -bm and -f options below). See |
|
2464 + the untrusted_set_sender option for a way of permitting non-trusted users |
|
2465 + to set envelope senders. |
|
2466 + |
|
2467 + For a trusted user, there is never any check on the contents of the From: |
|
2468 + header line, and a Sender: line is never added. Furthermore, any existing |
|
2469 + Sender: line in incoming local (non-TCP/IP) messages is not removed. |
|
2470 + |
|
2471 + Trusted users may also specify a host name, host address, interface |
|
2472 + address, protocol name, ident value, and authentication data when |
|
2473 + submitting a message locally. Thus, they are able to insert messages into |
|
2474 + Exim's queue locally that have the characteristics of messages received |
|
2475 + from a remote host. Untrusted users may in some circumstances use -f, but |
|
2476 + can never set the other values that are available to trusted users. |
|
2477 + |
|
2478 + * The admin users are root, the Exim user, and any user that is a member of |
|
2479 + the Exim group or of any group listed in the admin_groups configuration |
|
2480 + option. The current group does not have to be one of these groups. |
|
2481 + |
|
2482 + Admin users are permitted to list the queue, and to carry out certain |
|
2483 + operations on messages, for example, to force delivery failures. It is also |
|
2484 + necessary to be an admin user in order to see the full information provided |
|
2485 + by the Exim monitor, and full debugging output. |
|
2486 + |
|
2487 + By default, the use of the -M, -q, -R, and -S options to cause Exim to |
|
2488 + attempt delivery of messages on its queue is restricted to admin users. |
|
2489 + However, this restriction can be relaxed by setting the prod_requires_admin |
|
2490 + option false (that is, specifying no_prod_requires_admin). |
|
2491 + |
|
2492 + Similarly, the use of the -bp option to list all the messages in the queue |
|
2493 + is restricted to admin users unless queue_list_requires_admin is set false. |
|
2494 + |
|
2495 +Warning: If you configure your system so that admin users are able to edit |
|
2496 +Exim's configuration file, you are giving those users an easy way of getting |
|
2497 +root. There is further discussion of this issue at the start of chapter 6. |
|
2498 + |
|
2499 +5.3Â Command line options |
|
2500 + |
|
2501 +Exim's command line options are described in alphabetical order below. If none |
|
2502 +of the options that specifies a specific action (such as starting the daemon or |
|
2503 +a queue runner, or testing an address, or receiving a message in a specific |
|
2504 +format, or listing the queue) are present, and there is at least one argument |
|
2505 +on the command line, -bm (accept a local message on the standard input, with |
|
2506 +the arguments specifying the recipients) is assumed. Otherwise, Exim outputs a |
|
2507 +brief message about itself and exits. |
|
2508 + |
|
2509 +-- |
|
2510 + |
|
2511 + This is a pseudo-option whose only purpose is to terminate the options and |
|
2512 + therefore to cause subsequent command line items to be treated as arguments |
|
2513 + rather than options, even if they begin with hyphens. |
|
2514 + |
|
2515 +--help |
|
2516 + |
|
2517 + This option causes Exim to output a few sentences stating what it is. The |
|
2518 + same output is generated if the Exim binary is called with no options and |
|
2519 + no arguments. |
|
2520 + |
|
2521 +--version |
|
2522 + |
|
2523 + This option is an alias for -bV and causes version information to be |
|
2524 + displayed. |
|
2525 + |
|
2526 +-B<type> |
|
2527 + |
|
2528 + This is a Sendmail option for selecting 7 or 8 bit processing. Exim is |
|
2529 + 8-bit clean; it ignores this option. |
|
2530 + |
|
2531 +-bd |
|
2532 + |
|
2533 + This option runs Exim as a daemon, awaiting incoming SMTP connections. |
|
2534 + Usually the -bd option is combined with the -q<time> option, to specify |
|
2535 + that the daemon should also initiate periodic queue runs. |
|
2536 + |
|
2537 + The -bd option can be used only by an admin user. If either of the -d |
|
2538 + (debugging) or -v (verifying) options are set, the daemon does not |
|
2539 + disconnect from the controlling terminal. When running this way, it can be |
|
2540 + stopped by pressing ctrl-C. |
|
2541 + |
|
2542 + By default, Exim listens for incoming connections to the standard SMTP port |
|
2543 + on all the host's running interfaces. However, it is possible to listen on |
|
2544 + other ports, on multiple ports, and only on specific interfaces. Chapter 13 |
|
2545 + contains a description of the options that control this. |
|
2546 + |
|
2547 + When a listening daemon is started without the use of -oX (that is, without |
|
2548 + overriding the normal configuration), it writes its process id to a file |
|
2549 + called exim-daemon.pid in Exim's spool directory. This location can be |
|
2550 + overridden by setting PID_FILE_PATH in Local/Makefile. The file is written |
|
2551 + while Exim is still running as root. |
|
2552 + |
|
2553 + When -oX is used on the command line to start a listening daemon, the |
|
2554 + process id is not written to the normal pid file path. However, -oP can be |
|
2555 + used to specify a path on the command line if a pid file is required. |
|
2556 + |
|
2557 + The SIGHUP signal can be used to cause the daemon to re-execute itself. |
|
2558 + This should be done whenever Exim's configuration file, or any file that is |
|
2559 + incorporated into it by means of the .include facility, is changed, and |
|
2560 + also whenever a new version of Exim is installed. It is not necessary to do |
|
2561 + this when other files that are referenced from the configuration (for |
|
2562 + example, alias files) are changed, because these are reread each time they |
|
2563 + are used. |
|
2564 + |
|
2565 +-bdf |
|
2566 + |
|
2567 + This option has the same effect as -bd except that it never disconnects |
|
2568 + from the controlling terminal, even when no debugging is specified. |
|
2569 + |
|
2570 +-be |
|
2571 + |
|
2572 + Run Exim in expansion testing mode. Exim discards its root privilege, to |
|
2573 + prevent ordinary users from using this mode to read otherwise inaccessible |
|
2574 + files. If no arguments are given, Exim runs interactively, prompting for |
|
2575 + lines of data. Otherwise, it processes each argument in turn. |
|
2576 + |
|
2577 + If Exim was built with USE_READLINE=yes in Local/Makefile, it tries to load |
|
2578 + the libreadline library dynamically whenever the -be option is used without |
|
2579 + command line arguments. If successful, it uses the readline() function, |
|
2580 + which provides extensive line-editing facilities, for reading the test |
|
2581 + data. A line history is supported. |
|
2582 + |
|
2583 + Long expansion expressions can be split over several lines by using |
|
2584 + backslash continuations. As in Exim's run time configuration, white space |
|
2585 + at the start of continuation lines is ignored. Each argument or data line |
|
2586 + is passed through the string expansion mechanism, and the result is output. |
|
2587 + Variable values from the configuration file (for example, $qualify_domain) |
|
2588 + are available, but no message-specific values (such as $sender_domain) are |
|
2589 + set, because no message is being processed (but see -bem and -Mset). |
|
2590 + |
|
2591 + Note: If you use this mechanism to test lookups, and you change the data |
|
2592 + files or databases you are using, you must exit and restart Exim before |
|
2593 + trying the same lookup again. Otherwise, because each Exim process caches |
|
2594 + the results of lookups, you will just get the same result as before. |
|
2595 + |
|
2596 +-bem <filename> |
|
2597 + |
|
2598 + This option operates like -be except that it must be followed by the name |
|
2599 + of a file. For example: |
|
2600 + |
|
2601 + exim -bem /tmp/testmessage |
|
2602 + |
|
2603 + The file is read as a message (as if receiving a locally-submitted non-SMTP |
|
2604 + message) before any of the test expansions are done. Thus, message-specific |
|
2605 + variables such as $message_size and $header_from: are available. However, |
|
2606 + no Received: header is added to the message. If the -t option is set, |
|
2607 + recipients are read from the headers in the normal way, and are shown in |
|
2608 + the $recipients variable. Note that recipients cannot be given on the |
|
2609 + command line, because further arguments are taken as strings to expand |
|
2610 + (just like -be). |
|
2611 + |
|
2612 +-bFÂ <filename> |
|
2613 + |
|
2614 + This option is the same as -bf except that it assumes that the filter being |
|
2615 + tested is a system filter. The additional commands that are available only |
|
2616 + in system filters are recognized. |
|
2617 + |
|
2618 +-bf <filename> |
|
2619 + |
|
2620 + This option runs Exim in user filter testing mode; the file is the filter |
|
2621 + file to be tested, and a test message must be supplied on the standard |
|
2622 + input. If there are no message-dependent tests in the filter, an empty file |
|
2623 + can be supplied. |
|
2624 + |
|
2625 + If you want to test a system filter file, use -bF instead of -bf. You can |
|
2626 + use both -bF and -bf on the same command, in order to test a system filter |
|
2627 + and a user filter in the same run. For example: |
|
2628 + |
|
2629 + exim -bF /system/filter -bf /user/filter </test/message |
|
2630 + |
|
2631 + This is helpful when the system filter adds header lines or sets filter |
|
2632 + variables that are used by the user filter. |
|
2633 + |
|
2634 + If the test filter file does not begin with one of the special lines |
|
2635 + |
|
2636 + # Exim filter |
|
2637 + # Sieve filter |
|
2638 + |
|
2639 + it is taken to be a normal .forward file, and is tested for validity under |
|
2640 + that interpretation. See sections 22.4 to 22.6 for a description of the |
|
2641 + possible contents of non-filter redirection lists. |
|
2642 + |
|
2643 + The result of an Exim command that uses -bf, provided no errors are |
|
2644 + detected, is a list of the actions that Exim would try to take if presented |
|
2645 + with the message for real. More details of filter testing are given in the |
|
2646 + separate document entitled Exim's interfaces to mail filtering. |
|
2647 + |
|
2648 + When testing a filter file, the envelope sender can be set by the -f |
|
2649 + option, or by a "From " line at the start of the test message. Various |
|
2650 + parameters that would normally be taken from the envelope recipient address |
|
2651 + of the message can be set by means of additional command line options (see |
|
2652 + the next four options). |
|
2653 + |
|
2654 +-bfd <domain> |
|
2655 + |
|
2656 + This sets the domain of the recipient address when a filter file is being |
|
2657 + tested by means of the -bf option. The default is the value of |
|
2658 + $qualify_domain. |
|
2659 + |
|
2660 +-bfl <local part> |
|
2661 + |
|
2662 + This sets the local part of the recipient address when a filter file is |
|
2663 + being tested by means of the -bf option. The default is the username of the |
|
2664 + process that calls Exim. A local part should be specified with any prefix |
|
2665 + or suffix stripped, because that is how it appears to the filter when a |
|
2666 + message is actually being delivered. |
|
2667 + |
|
2668 +-bfp <prefix> |
|
2669 + |
|
2670 + This sets the prefix of the local part of the recipient address when a |
|
2671 + filter file is being tested by means of the -bf option. The default is an |
|
2672 + empty prefix. |
|
2673 + |
|
2674 +-bfs <suffix> |
|
2675 + |
|
2676 + This sets the suffix of the local part of the recipient address when a |
|
2677 + filter file is being tested by means of the -bf option. The default is an |
|
2678 + empty suffix. |
|
2679 + |
|
2680 +-bh <IP address> |
|
2681 + |
|
2682 + This option runs a fake SMTP session as if from the given IP address, using |
|
2683 + the standard input and output. The IP address may include a port number at |
|
2684 + the end, after a full stop. For example: |
|
2685 + |
|
2686 + exim -bh 10.9.8.7.1234 |
|
2687 + exim -bh fe80::a00:20ff:fe86:a061.5678 |
|
2688 + |
|
2689 + When an IPv6 address is given, it is converted into canonical form. In the |
|
2690 + case of the second example above, the value of $sender_host_address after |
|
2691 + conversion to the canonical form is |
|
2692 + "fe80:0000:0000:0a00:20ff:fe86:a061.5678". |
|
2693 + |
|
2694 + Comments as to what is going on are written to the standard error file. |
|
2695 + These include lines beginning with "LOG" for anything that would have been |
|
2696 + logged. This facility is provided for testing configuration options for |
|
2697 + incoming messages, to make sure they implement the required policy. For |
|
2698 + example, you can test your relay controls using -bh. |
|
2699 + |
|
2700 + Warning 1: You can test features of the configuration that rely on ident |
|
2701 + (RFC 1413) information by using the -oMt option. However, Exim cannot |
|
2702 + actually perform an ident callout when testing using -bh because there is |
|
2703 + no incoming SMTP connection. |
|
2704 + |
|
2705 + Warning 2: Address verification callouts (see section 40.42) are also |
|
2706 + skipped when testing using -bh. If you want these callouts to occur, use |
|
2707 + -bhc instead. |
|
2708 + |
|
2709 + Messages supplied during the testing session are discarded, and nothing is |
|
2710 + written to any of the real log files. There may be pauses when DNS (and |
|
2711 + other) lookups are taking place, and of course these may time out. The -oMi |
|
2712 + option can be used to specify a specific IP interface and port if this is |
|
2713 + important, and -oMaa and -oMai can be used to set parameters as if the SMTP |
|
2714 + session were authenticated. |
|
2715 + |
|
2716 + The exim_checkaccess utility is a "packaged" version of -bh whose output |
|
2717 + just states whether a given recipient address from a given host is |
|
2718 + acceptable or not. See section 50.8. |
|
2719 + |
|
2720 + Features such as authentication and encryption, where the client input is |
|
2721 + not plain text, cannot easily be tested with -bh. Instead, you should use a |
|
2722 + specialized SMTP test program such as swaks. |
|
2723 + |
|
2724 +-bhc <IP address> |
|
2725 + |
|
2726 + This option operates in the same way as -bh, except that address |
|
2727 + verification callouts are performed if required. This includes consulting |
|
2728 + and updating the callout cache database. |
|
2729 + |
|
2730 +-bi |
|
2731 + |
|
2732 + Sendmail interprets the -bi option as a request to rebuild its alias file. |
|
2733 + Exim does not have the concept of a single alias file, and so it cannot |
|
2734 + mimic this behaviour. However, calls to /usr/lib/sendmail with the -bi |
|
2735 + option tend to appear in various scripts such as NIS make files, so the |
|
2736 + option must be recognized. |
|
2737 + |
|
2738 + If -bi is encountered, the command specified by the bi_command |
|
2739 + configuration option is run, under the uid and gid of the caller of Exim. |
|
2740 + If the -oA option is used, its value is passed to the command as an |
|
2741 + argument. The command set by bi_command may not contain arguments. The |
|
2742 + command can use the exim_dbmbuild utility, or some other means, to rebuild |
|
2743 + alias files if this is required. If the bi_command option is not set, |
|
2744 + calling Exim with -bi is a no-op. |
|
2745 + |
|
2746 +-bm |
|
2747 + |
|
2748 + This option runs an Exim receiving process that accepts an incoming, |
|
2749 + locally-generated message on the current input. The recipients are given as |
|
2750 + the command arguments (except when -t is also present - see below). Each |
|
2751 + argument can be a comma-separated list of RFC 2822 addresses. This is the |
|
2752 + default option for selecting the overall action of an Exim call; it is |
|
2753 + assumed if no other conflicting option is present. |
|
2754 + |
|
2755 + If any addresses in the message are unqualified (have no domain), they are |
|
2756 + qualified by the values of the qualify_domain or qualify_recipient options, |
|
2757 + as appropriate. The -bnq option (see below) provides a way of suppressing |
|
2758 + this for special cases. |
|
2759 + |
|
2760 + Policy checks on the contents of local messages can be enforced by means of |
|
2761 + the non-SMTP ACL. See chapter 40 for details. |
|
2762 + |
|
2763 + The return code is zero if the message is successfully accepted. Otherwise, |
|
2764 + the action is controlled by the -oex option setting - see below. |
|
2765 + |
|
2766 + The format of the message must be as defined in RFC 2822, except that, for |
|
2767 + compatibility with Sendmail and Smail, a line in one of the forms |
|
2768 + |
|
2769 + From sender Fri Jan 5 12:55 GMT 1997 |
|
2770 + From sender Fri, 5 Jan 97 12:55:01 |
|
2771 + |
|
2772 + (with the weekday optional, and possibly with additional text after the |
|
2773 + date) is permitted to appear at the start of the message. There appears to |
|
2774 + be no authoritative specification of the format of this line. Exim |
|
2775 + recognizes it by matching against the regular expression defined by the |
|
2776 + uucp_from_pattern option, which can be changed if necessary. |
|
2777 + |
|
2778 + The specified sender is treated as if it were given as the argument to the |
|
2779 + -f option, but if a -f option is also present, its argument is used in |
|
2780 + preference to the address taken from the message. The caller of Exim must |
|
2781 + be a trusted user for the sender of a message to be set in this way. |
|
2782 + |
|
2783 +-bnq |
|
2784 + |
|
2785 + By default, Exim automatically qualifies unqualified addresses (those |
|
2786 + without domains) that appear in messages that are submitted locally (that |
|
2787 + is, not over TCP/IP). This qualification applies both to addresses in |
|
2788 + envelopes, and addresses in header lines. Sender addresses are qualified |
|
2789 + using qualify_domain, and recipient addresses using qualify_recipient |
|
2790 + (which defaults to the value of qualify_domain). |
|
2791 + |
|
2792 + Sometimes, qualification is not wanted. For example, if -bS (batch SMTP) is |
|
2793 + being used to re-submit messages that originally came from remote hosts |
|
2794 + after content scanning, you probably do not want to qualify unqualified |
|
2795 + addresses in header lines. (Such lines will be present only if you have not |
|
2796 + enabled a header syntax check in the appropriate ACL.) |
|
2797 + |
|
2798 + The -bnq option suppresses all qualification of unqualified addresses in |
|
2799 + messages that originate on the local host. When this is used, unqualified |
|
2800 + addresses in the envelope provoke errors (causing message rejection) and |
|
2801 + unqualified addresses in header lines are left alone. |
|
2802 + |
|
2803 +-bP |
|
2804 + |
|
2805 + If this option is given with no arguments, it causes the values of all |
|
2806 + Exim's main configuration options to be written to the standard output. The |
|
2807 + values of one or more specific options can be requested by giving their |
|
2808 + names as arguments, for example: |
|
2809 + |
|
2810 + exim -bP qualify_domain hold_domains |
|
2811 + |
|
2812 + However, any option setting that is preceded by the word "hide" in the |
|
2813 + configuration file is not shown in full, except to an admin user. For other |
|
2814 + users, the output is as in this example: |
|
2815 + |
|
2816 + mysql_servers = <value not displayable> |
|
2817 + |
|
2818 + If configure_file is given as an argument, the name of the run time |
|
2819 + configuration file is output. If a list of configuration files was |
|
2820 + supplied, the value that is output here is the name of the file that was |
|
2821 + actually used. |
|
2822 + |
|
2823 + If log_file_path or pid_file_path are given, the names of the directories |
|
2824 + where log files and daemon pid files are written are output, respectively. |
|
2825 + If these values are unset, log files are written in a sub-directory of the |
|
2826 + spool directory called log, and the pid file is written directly into the |
|
2827 + spool directory. |
|
2828 + |
|
2829 + If -bP is followed by a name preceded by "+", for example, |
|
2830 + |
|
2831 + exim -bP +local_domains |
|
2832 + |
|
2833 + it searches for a matching named list of any type (domain, host, address, |
|
2834 + or local part) and outputs what it finds. |
|
2835 + |
|
2836 + If one of the words router, transport, or authenticator is given, followed |
|
2837 + by the name of an appropriate driver instance, the option settings for that |
|
2838 + driver are output. For example: |
|
2839 + |
|
2840 + exim -bP transport local_delivery |
|
2841 + |
|
2842 + The generic driver options are output first, followed by the driver's |
|
2843 + private options. A list of the names of drivers of a particular type can be |
|
2844 + obtained by using one of the words router_list, transport_list, or |
|
2845 + authenticator_list, and a complete list of all drivers with their option |
|
2846 + settings can be obtained by using routers, transports, or authenticators. |
|
2847 + |
|
2848 + If invoked by an admin user, then macro, macro_list and macros are |
|
2849 + available, similarly to the drivers. Because macros are sometimes used for |
|
2850 + storing passwords, this option is restricted. The output format is one item |
|
2851 + per line. |
|
2852 + |
|
2853 +-bp |
|
2854 + |
|
2855 + This option requests a listing of the contents of the mail queue on the |
|
2856 + standard output. If the -bp option is followed by a list of message ids, |
|
2857 + just those messages are listed. By default, this option can be used only by |
|
2858 + an admin user. However, the queue_list_requires_admin option can be set |
|
2859 + false to allow any user to see the queue. |
|
2860 + |
|
2861 + Each message on the queue is displayed as in the following example: |
|
2862 + |
|
2863 + 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example> |
|
2864 + red.king@looking-glass.fict.example |
|
2865 + <other addresses> |
|
2866 + |
|
2867 + The first line contains the length of time the message has been on the |
|
2868 + queue (in this case 25 minutes), the size of the message (2.9K), the unique |
|
2869 + local identifier for the message, and the message sender, as contained in |
|
2870 + the envelope. For bounce messages, the sender address is empty, and appears |
|
2871 + as "<>". If the message was submitted locally by an untrusted user who |
|
2872 + overrode the default sender address, the user's login name is shown in |
|
2873 + parentheses before the sender address. |
|
2874 + |
|
2875 + If the message is frozen (attempts to deliver it are suspended) then the |
|
2876 + text "*** frozen ***" is displayed at the end of this line. |
|
2877 + |
|
2878 + The recipients of the message (taken from the envelope, not the headers) |
|
2879 + are displayed on subsequent lines. Those addresses to which the message has |
|
2880 + already been delivered are marked with the letter D. If an original address |
|
2881 + gets expanded into several addresses via an alias or forward file, the |
|
2882 + original is displayed with a D only when deliveries for all of its child |
|
2883 + addresses are complete. |
|
2884 + |
|
2885 +-bpa |
|
2886 + |
|
2887 + This option operates like -bp, but in addition it shows delivered addresses |
|
2888 + that were generated from the original top level address(es) in each message |
|
2889 + by alias or forwarding operations. These addresses are flagged with "+D" |
|
2890 + instead of just "D". |
|
2891 + |
|
2892 +-bpc |
|
2893 + |
|
2894 + This option counts the number of messages on the queue, and writes the |
|
2895 + total to the standard output. It is restricted to admin users, unless |
|
2896 + queue_list_requires_admin is set false. |
|
2897 + |
|
2898 +-bpr |
|
2899 + |
|
2900 + This option operates like -bp, but the output is not sorted into |
|
2901 + chronological order of message arrival. This can speed it up when there are |
|
2902 + lots of messages on the queue, and is particularly useful if the output is |
|
2903 + going to be post-processed in a way that doesn't need the sorting. |
|
2904 + |
|
2905 +-bpra |
|
2906 + |
|
2907 + This option is a combination of -bpr and -bpa. |
|
2908 + |
|
2909 +-bpru |
|
2910 + |
|
2911 + This option is a combination of -bpr and -bpu. |
|
2912 + |
|
2913 +-bpu |
|
2914 + |
|
2915 + This option operates like -bp but shows only undelivered top-level |
|
2916 + addresses for each message displayed. Addresses generated by aliasing or |
|
2917 + forwarding are not shown, unless the message was deferred after processing |
|
2918 + by a router with the one_time option set. |
|
2919 + |
|
2920 +-brt |
|
2921 + |
|
2922 + This option is for testing retry rules, and it must be followed by up to |
|
2923 + three arguments. It causes Exim to look for a retry rule that matches the |
|
2924 + values and to write it to the standard output. For example: |
|
2925 + |
|
2926 + exim -brt bach.comp.mus.example |
|
2927 + Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m; |
|
2928 + |
|
2929 + See chapter 32 for a description of Exim's retry rules. The first argument, |
|
2930 + which is required, can be a complete address in the form local_part@domain, |
|
2931 + or it can be just a domain name. If the second argument contains a dot, it |
|
2932 + is interpreted as an optional second domain name; if no retry rule is found |
|
2933 + for the first argument, the second is tried. This ties in with Exim's |
|
2934 + behaviour when looking for retry rules for remote hosts - if no rule is |
|
2935 + found that matches the host, one that matches the mail domain is sought. |
|
2936 + Finally, an argument that is the name of a specific delivery error, as used |
|
2937 + in setting up retry rules, can be given. For example: |
|
2938 + |
|
2939 + exim -brt haydn.comp.mus.example quota_3d |
|
2940 + Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m |
|
2941 + |
|
2942 +-brw |
|
2943 + |
|
2944 + This option is for testing address rewriting rules, and it must be followed |
|
2945 + by a single argument, consisting of either a local part without a domain, |
|
2946 + or a complete address with a fully qualified domain. Exim outputs how this |
|
2947 + address would be rewritten for each possible place it might appear. See |
|
2948 + chapter 31 for further details. |
|
2949 + |
|
2950 +-bS |
|
2951 + |
|
2952 + This option is used for batched SMTP input, which is an alternative |
|
2953 + interface for non-interactive local message submission. A number of |
|
2954 + messages can be submitted in a single run. However, despite its name, this |
|
2955 + is not really SMTP input. Exim reads each message's envelope from SMTP |
|
2956 + commands on the standard input, but generates no responses. If the caller |
|
2957 + is trusted, or untrusted_set_sender is set, the senders in the SMTP MAIL |
|
2958 + commands are believed; otherwise the sender is always the caller of Exim. |
|
2959 + |
|
2960 + The message itself is read from the standard input, in SMTP format (leading |
|
2961 + dots doubled), terminated by a line containing just a single dot. An error |
|
2962 + is provoked if the terminating dot is missing. A further message may then |
|
2963 + follow. |
|
2964 + |
|
2965 + As for other local message submissions, the contents of incoming batch SMTP |
|
2966 + messages can be checked using the non-SMTP ACL (see chapter 40). |
|
2967 + Unqualified addresses are automatically qualified using qualify_domain and |
|
2968 + qualify_recipient, as appropriate, unless the -bnq option is used. |
|
2969 + |
|
2970 + Some other SMTP commands are recognized in the input. HELO and EHLO act as |
|
2971 + RSET; VRFY, EXPN, ETRN, and HELP act as NOOP; QUIT quits, ignoring the rest |
|
2972 + of the standard input. |
|
2973 + |
|
2974 + If any error is encountered, reports are written to the standard output and |
|
2975 + error streams, and Exim gives up immediately. The return code is 0 if no |
|
2976 + error was detected; it is 1 if one or more messages were accepted before |
|
2977 + the error was detected; otherwise it is 2. |
|
2978 + |
|
2979 + More details of input using batched SMTP are given in section 45.11. |
|
2980 + |
|
2981 +-bs |
|
2982 + |
|
2983 + This option causes Exim to accept one or more messages by reading SMTP |
|
2984 + commands on the standard input, and producing SMTP replies on the standard |
|
2985 + output. SMTP policy controls, as defined in ACLs (see chapter 40) are |
|
2986 + applied. Some user agents use this interface as a way of passing |
|
2987 + locally-generated messages to the MTA. |
|
2988 + |
|
2989 + In this usage, if the caller of Exim is trusted, or untrusted_set_sender is |
|
2990 + set, the senders of messages are taken from the SMTP MAIL commands. |
|
2991 + Otherwise the content of these commands is ignored and the sender is set up |
|
2992 + as the calling user. Unqualified addresses are automatically qualified |
|
2993 + using qualify_domain and qualify_recipient, as appropriate, unless the -bnq |
|
2994 + option is used. |
|
2995 + |
|
2996 + The -bs option is also used to run Exim from inetd, as an alternative to |
|
2997 + using a listening daemon. Exim can distinguish the two cases by checking |
|
2998 + whether the standard input is a TCP/IP socket. When Exim is called from |
|
2999 + inetd, the source of the mail is assumed to be remote, and the comments |
|
3000 + above concerning senders and qualification do not apply. In this situation, |
|
3001 + Exim behaves in exactly the same way as it does when receiving a message |
|
3002 + via the listening daemon. |
|
3003 + |
|
3004 +-bmalware <filename> |
|
3005 + |
|
3006 + This debugging option causes Exim to scan the given file, using the malware |
|
3007 + scanning framework. The option of av_scanner influences this option, so if |
|
3008 + av_scanner's value is dependent upon an expansion then the expansion should |
|
3009 + have defaults which apply to this invocation. ACLs are not invoked, so if |
|
3010 + av_scanner references an ACL variable then that variable will never be |
|
3011 + populated and -bmalware will fail. |
|
3012 + |
|
3013 + Exim will have changed working directory before resolving the filename, so |
|
3014 + using fully qualified pathnames is advisable. Exim will be running as the |
|
3015 + Exim user when it tries to open the file, rather than as the invoking user. |
|
3016 + This option requires admin privileges. |
|
3017 + |
|
3018 + The -bmalware option will not be extended to be more generally useful, |
|
3019 + there are better tools for file-scanning. This option exists to help |
|
3020 + administrators verify their Exim and AV scanner configuration. |
|
3021 + |
|
3022 +-bt |
|
3023 + |
|
3024 + This option runs Exim in address testing mode, in which each argument is |
|
3025 + taken as a recipient address to be tested for deliverability. The results |
|
3026 + are written to the standard output. If a test fails, and the caller is not |
|
3027 + an admin user, no details of the failure are output, because these might |
|
3028 + contain sensitive information such as usernames and passwords for database |
|
3029 + lookups. |
|
3030 + |
|
3031 + If no arguments are given, Exim runs in an interactive manner, prompting |
|
3032 + with a right angle bracket for addresses to be tested. |
|
3033 + |
|
3034 + Unlike the -be test option, you cannot arrange for Exim to use the readline |
|
3035 + () function, because it is running as root and there are security issues. |
|
3036 + |
|
3037 + Each address is handled as if it were the recipient address of a message |
|
3038 + (compare the -bv option). It is passed to the routers and the result is |
|
3039 + written to the standard output. However, any router that has |
|
3040 + no_address_test set is bypassed. This can make -bt easier to use for |
|
3041 + genuine routing tests if your first router passes everything to a scanner |
|
3042 + program. |
|
3043 + |
|
3044 + The return code is 2 if any address failed outright; it is 1 if no address |
|
3045 + failed outright but at least one could not be resolved for some reason. |
|
3046 + Return code 0 is given only when all addresses succeed. |
|
3047 + |
|
3048 + Note: When actually delivering a message, Exim removes duplicate recipient |
|
3049 + addresses after routing is complete, so that only one delivery takes place. |
|
3050 + This does not happen when testing with -bt; the full results of routing are |
|
3051 + always shown. |
|
3052 + |
|
3053 + Warning: -bt can only do relatively simple testing. If any of the routers |
|
3054 + in the configuration makes any tests on the sender address of a message, |
|
3055 + you can use the -f option to set an appropriate sender when running -bt |
|
3056 + tests. Without it, the sender is assumed to be the calling user at the |
|
3057 + default qualifying domain. However, if you have set up (for example) |
|
3058 + routers whose behaviour depends on the contents of an incoming message, you |
|
3059 + cannot test those conditions using -bt. The -N option provides a possible |
|
3060 + way of doing such tests. |
|
3061 + |
|
3062 +-bV |
|
3063 + |
|
3064 + This option causes Exim to write the current version number, compilation |
|
3065 + number, and compilation date of the exim binary to the standard output. It |
|
3066 + also lists the DBM library that is being used, the optional modules (such |
|
3067 + as specific lookup types), the drivers that are included in the binary, and |
|
3068 + the name of the run time configuration file that is in use. |
|
3069 + |
|
3070 + As part of its operation, -bV causes Exim to read and syntax check its |
|
3071 + configuration file. However, this is a static check only. It cannot check |
|
3072 + values that are to be expanded. For example, although a misspelt ACL verb |
|
3073 + is detected, an error in the verb's arguments is not. You cannot rely on |
|
3074 + -bV alone to discover (for example) all the typos in the configuration; |
|
3075 + some realistic testing is needed. The -bh and -N options provide more |
|
3076 + dynamic testing facilities. |
|
3077 + |
|
3078 +-bv |
|
3079 + |
|
3080 + This option runs Exim in address verification mode, in which each argument |
|
3081 + is taken as a recipient address to be verified by the routers. (This does |
|
3082 + not involve any verification callouts). During normal operation, |
|
3083 + verification happens mostly as a consequence processing a verify condition |
|
3084 + in an ACL (see chapter 40). If you want to test an entire ACL, possibly |
|
3085 + including callouts, see the -bh and -bhc options. |
|
3086 + |
|
3087 + If verification fails, and the caller is not an admin user, no details of |
|
3088 + the failure are output, because these might contain sensitive information |
|
3089 + such as usernames and passwords for database lookups. |
|
3090 + |
|
3091 + If no arguments are given, Exim runs in an interactive manner, prompting |
|
3092 + with a right angle bracket for addresses to be verified. |
|
3093 + |
|
3094 + Unlike the -be test option, you cannot arrange for Exim to use the readline |
|
3095 + () function, because it is running as exim and there are security issues. |
|
3096 + |
|
3097 + Verification differs from address testing (the -bt option) in that routers |
|
3098 + that have no_verify set are skipped, and if the address is accepted by a |
|
3099 + router that has fail_verify set, verification fails. The address is |
|
3100 + verified as a recipient if -bv is used; to test verification for a sender |
|
3101 + address, -bvs should be used. |
|
3102 + |
|
3103 + If the -v option is not set, the output consists of a single line for each |
|
3104 + address, stating whether it was verified or not, and giving a reason in the |
|
3105 + latter case. Without -v, generating more than one address by redirection |
|
3106 + causes verification to end successfully, without considering the generated |
|
3107 + addresses. However, if just one address is generated, processing continues, |
|
3108 + and the generated address must verify successfully for the overall |
|
3109 + verification to succeed. |
|
3110 + |
|
3111 + When -v is set, more details are given of how the address has been handled, |
|
3112 + and in the case of address redirection, all the generated addresses are |
|
3113 + also considered. Verification may succeed for some and fail for others. |
|
3114 + |
|
3115 + The return code is 2 if any address failed outright; it is 1 if no address |
|
3116 + failed outright but at least one could not be resolved for some reason. |
|
3117 + Return code 0 is given only when all addresses succeed. |
|
3118 + |
|
3119 + If any of the routers in the configuration makes any tests on the sender |
|
3120 + address of a message, you should use the -f option to set an appropriate |
|
3121 + sender when running -bv tests. Without it, the sender is assumed to be the |
|
3122 + calling user at the default qualifying domain. |
|
3123 + |
|
3124 +-bvs |
|
3125 + |
|
3126 + This option acts like -bv, but verifies the address as a sender rather than |
|
3127 + a recipient address. This affects any rewriting and qualification that |
|
3128 + might happen. |
|
3129 + |
|
3130 +-CÂ <filelist> |
|
3131 + |
|
3132 + This option causes Exim to find the run time configuration file from the |
|
3133 + given list instead of from the list specified by the CONFIGURE_FILE |
|
3134 + compile-time setting. Usually, the list will consist of just a single file |
|
3135 + name, but it can be a colon-separated list of names. In this case, the |
|
3136 + first file that exists is used. Failure to open an existing file stops Exim |
|
3137 + from proceeding any further along the list, and an error is generated. |
|
3138 + |
|
3139 + When this option is used by a caller other than root, and the list is |
|
3140 + different from the compiled-in list, Exim gives up its root privilege |
|
3141 + immediately, and runs with the real and effective uid and gid set to those |
|
3142 + of the caller. However, if a TRUSTED_CONFIG_LIST file is defined in Local/ |
|
3143 + Makefile, that file contains a list of full pathnames, one per line, for |
|
3144 + configuration files which are trusted. Root privilege is retained for any |
|
3145 + configuration file so listed, as long as the caller is the Exim user (or |
|
3146 + the user specified in the CONFIGURE_OWNER option, if any), and as long as |
|
3147 + the configuration file is not writeable by inappropriate users or groups. |
|
3148 + |
|
3149 + Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a |
|
3150 + configuration using -C right through message reception and delivery, even |
|
3151 + if the caller is root. The reception works, but by that time, Exim is |
|
3152 + running as the Exim user, so when it re-executes to regain privilege for |
|
3153 + the delivery, the use of -C causes privilege to be lost. However, root can |
|
3154 + test reception and delivery using two separate commands (one to put a |
|
3155 + message on the queue, using -odq, and another to do the delivery, using -M |
|
3156 + ). |
|
3157 + |
|
3158 + If ALT_CONFIG_PREFIX is defined in Local/Makefile, it specifies a prefix |
|
3159 + string with which any file named in a -C command line option must start. In |
|
3160 + addition, the file name must not contain the sequence "/../". However, if |
|
3161 + the value of the -C option is identical to the value of CONFIGURE_FILE in |
|
3162 + Local/Makefile, Exim ignores -C and proceeds as usual. There is no default |
|
3163 + setting for ALT_CONFIG_PREFIX; when it is unset, any file name can be used |
|
3164 + with -C. |
|
3165 + |
|
3166 + ALT_CONFIG_PREFIX can be used to confine alternative configuration files to |
|
3167 + a directory to which only root has access. This prevents someone who has |
|
3168 + broken into the Exim account from running a privileged Exim with an |
|
3169 + arbitrary configuration file. |
|
3170 + |
|
3171 + The -C facility is useful for ensuring that configuration files are |
|
3172 + syntactically correct, but cannot be used for test deliveries, unless the |
|
3173 + caller is privileged, or unless it is an exotic configuration that does not |
|
3174 + require privilege. No check is made on the owner or group of the files |
|
3175 + specified by this option. |
|
3176 + |
|
3177 +-D<macro>=<value> |
|
3178 + |
|
3179 + This option can be used to override macro definitions in the configuration |
|
3180 + file (see section 6.4). However, like -C, if it is used by an unprivileged |
|
3181 + caller, it causes Exim to give up its root privilege. If DISABLE_D_OPTION |
|
3182 + is defined in Local/Makefile, the use of -D is completely disabled, and its |
|
3183 + use causes an immediate error exit. |
|
3184 + |
|
3185 + If WHITELIST_D_MACROS is defined in Local/Makefile then it should be a |
|
3186 + colon-separated list of macros which are considered safe and, if -D only |
|
3187 + supplies macros from this list, and the values are acceptable, then Exim |
|
3188 + will not give up root privilege if the caller is root, the Exim run-time |
|
3189 + user, or the CONFIGURE_OWNER, if set. This is a transition mechanism and is |
|
3190 + expected to be removed in the future. Acceptable values for the macros |
|
3191 + satisfy the regexp: "^[A-Za-z0-9_/.-]*$" |
|
3192 + |
|
3193 + The entire option (including equals sign if present) must all be within one |
|
3194 + command line item. -D can be used to set the value of a macro to the empty |
|
3195 + string, in which case the equals sign is optional. These two commands are |
|
3196 + synonymous: |
|
3197 + |
|
3198 + exim -DABC ... |
|
3199 + exim -DABC= ... |
|
3200 + |
|
3201 + To include spaces in a macro definition item, quotes must be used. If you |
|
3202 + use quotes, spaces are permitted around the macro name and the equals sign. |
|
3203 + For example: |
|
3204 + |
|
3205 + exim '-D ABC = something' ... |
|
3206 + |
|
3207 + -D may be repeated up to 10 times on a command line. |
|
3208 + |
|
3209 +-d<debug options> |
|
3210 + |
|
3211 + This option causes debugging information to be written to the standard |
|
3212 + error stream. It is restricted to admin users because debugging output may |
|
3213 + show database queries that contain password information. Also, the details |
|
3214 + of users' filter files should be protected. If a non-admin user uses -d, |
|
3215 + Exim writes an error message to the standard error stream and exits with a |
|
3216 + non-zero return code. |
|
3217 + |
|
3218 + When -d is used, -v is assumed. If -d is given on its own, a lot of |
|
3219 + standard debugging data is output. This can be reduced, or increased to |
|
3220 + include some more rarely needed information, by directly following -d with |
|
3221 + a string made up of names preceded by plus or minus characters. These add |
|
3222 + or remove sets of debugging data, respectively. For example, -d+filter adds |
|
3223 + filter debugging, whereas -d-all+filter selects only filter debugging. Note |
|
3224 + that no spaces are allowed in the debug setting. The available debugging |
|
3225 + categories are: |
|
3226 + |
|
3227 + acl             ACL interpretation |
|
3228 + auth            authenticators |
|
3229 + deliver         general delivery logic |
|
3230 + dns             DNS lookups (see also resolver) |
|
3231 + dnsbl           DNS black list (aka RBL) code |
|
3232 + exec            arguments for execv() calls |
|
3233 + expand          detailed debugging for string expansions |
|
3234 + filter          filter handling |
|
3235 + hints_lookup    hints data lookups |
|
3236 + host_lookup     all types of name-to-IP address handling |
|
3237 + ident           ident lookup |
|
3238 + interface       lists of local interfaces |
|
3239 + lists           matching things in lists |
|
3240 + load            system load checks |
|
3241 + local_scan      can be used by local_scan() (see chapter 42) |
|
3242 + lookup          general lookup code and all lookups |
|
3243 + memory          memory handling |
|
3244 + pid             add pid to debug output lines |
|
3245 + process_info    setting info for the process log |
|
3246 + queue_run       queue runs |
|
3247 + receive         general message reception logic |
|
3248 + resolver        turn on the DNS resolver's debugging output |
|
3249 + retry           retry handling |
|
3250 + rewrite         address rewriting |
|
3251 + route           address routing |
|
3252 + timestamp       add timestamp to debug output lines |
|
3253 + tls             TLS logic |
|
3254 + transport       transports |
|
3255 + uid             changes of uid/gid and looking up uid/ |
|
3256 + gid |
|
3257 + verify          address verification logic |
|
3258 + all             almost all of the above |
|
3259 + (see below), and also -v |
|
3260 + |
|
3261 + The "all" option excludes "memory" when used as "+all", but includes it for |
|
3262 + "-all". The reason for this is that "+all" is something that people tend to |
|
3263 + use when generating debug output for Exim maintainers. If "+memory" is |
|
3264 + included, an awful lot of output that is very rarely of interest is |
|
3265 + generated, so it now has to be explicitly requested. However, "-all" does |
|
3266 + turn everything off. |
|
3267 + |
|
3268 + The "resolver" option produces output only if the DNS resolver was compiled |
|
3269 + with DEBUG enabled. This is not the case in some operating systems. Also, |
|
3270 + unfortunately, debugging output from the DNS resolver is written to stdout |
|
3271 + rather than stderr. |
|
3272 + |
|
3273 + The default (-d with no argument) omits "expand", "filter", "interface", |
|
3274 + "load", "memory", "pid", "resolver", and "timestamp". However, the "pid" |
|
3275 + selector is forced when debugging is turned on for a daemon, which then |
|
3276 + passes it on to any re-executed Exims. Exim also automatically adds the pid |
|
3277 + to debug lines when several remote deliveries are run in parallel. |
|
3278 + |
|
3279 + The "timestamp" selector causes the current time to be inserted at the |
|
3280 + start of all debug output lines. This can be useful when trying to track |
|
3281 + down delays in processing. |
|
3282 + |
|
3283 + If the debug_print option is set in any driver, it produces output whenever |
|
3284 + any debugging is selected, or if -v is used. |
|
3285 + |
|
3286 +-dd<debug options> |
|
3287 + |
|
3288 + This option behaves exactly like -d except when used on a command that |
|
3289 + starts a daemon process. In that case, debugging is turned off for the |
|
3290 + subprocesses that the daemon creates. Thus, it is useful for monitoring the |
|
3291 + behaviour of the daemon without creating as much output as full debugging |
|
3292 + does. |
|
3293 + |
|
3294 +-dropcr |
|
3295 + |
|
3296 + This is an obsolete option that is now a no-op. It used to affect the way |
|
3297 + Exim handled CR and LF characters in incoming messages. What happens now is |
|
3298 + described in section 44.2. |
|
3299 + |
|
3300 +-E |
|
3301 + |
|
3302 + This option specifies that an incoming message is a locally-generated |
|
3303 + delivery failure report. It is used internally by Exim when handling |
|
3304 + delivery failures and is not intended for external use. Its only effect is |
|
3305 + to stop Exim generating certain messages to the postmaster, as otherwise |
|
3306 + message cascades could occur in some situations. As part of the same |
|
3307 + option, a message id may follow the characters -E. If it does, the log |
|
3308 + entry for the receipt of the new message contains the id, following "R=", |
|
3309 + as a cross-reference. |
|
3310 + |
|
3311 +-ex |
|
3312 + |
|
3313 + There are a number of Sendmail options starting with -oe which seem to be |
|
3314 + called by various programs without the leading o in the option. For |
|
3315 + example, the vacation program uses -eq. Exim treats all options of the form |
|
3316 + -ex as synonymous with the corresponding -oex options. |
|
3317 + |
|
3318 +-FÂ <string> |
|
3319 + |
|
3320 + This option sets the sender's full name for use when a locally-generated |
|
3321 + message is being accepted. In the absence of this option, the user's gecos |
|
3322 + entry from the password data is used. As users are generally permitted to |
|
3323 + alter their gecos entries, no security considerations are involved. White |
|
3324 + space between -F and the <string> is optional. |
|
3325 + |
|
3326 +-f <address> |
|
3327 + |
|
3328 + This option sets the address of the envelope sender of a locally-generated |
|
3329 + message (also known as the return path). The option can normally be used |
|
3330 + only by a trusted user, but untrusted_set_sender can be set to allow |
|
3331 + untrusted users to use it. |
|
3332 + |
|
3333 + Processes running as root or the Exim user are always trusted. Other |
|
3334 + trusted users are defined by the trusted_users or trusted_groups options. |
|
3335 + In the absence of -f, or if the caller is not trusted, the sender of a |
|
3336 + local message is set to the caller's login name at the default qualify |
|
3337 + domain. |
|
3338 + |
|
3339 + There is one exception to the restriction on the use of -f: an empty sender |
|
3340 + can be specified by any user, trusted or not, to create a message that can |
|
3341 + never provoke a bounce. An empty sender can be specified either as an empty |
|
3342 + string, or as a pair of angle brackets with nothing between them, as in |
|
3343 + these examples of shell commands: |
|
3344 + |
|
3345 + exim -f '<>' user@domain |
|
3346 + exim -f "" user@domain |
|
3347 + |
|
3348 + In addition, the use of -f is not restricted when testing a filter file |
|
3349 + with -bf or when testing or verifying addresses using the -bt or -bv |
|
3350 + options. |
|
3351 + |
|
3352 + Allowing untrusted users to change the sender address does not of itself |
|
3353 + make it possible to send anonymous mail. Exim still checks that the From: |
|
3354 + header refers to the local user, and if it does not, it adds a Sender: |
|
3355 + header, though this can be overridden by setting no_local_from_check. |
|
3356 + |
|
3357 + White space between -f and the <address> is optional (that is, they can be |
|
3358 + given as two arguments or one combined argument). The sender of a |
|
3359 + locally-generated message can also be set (when permitted) by an initial |
|
3360 + "From " line in the message - see the description of -bm above - but if -f |
|
3361 + is also present, it overrides "From ". |
|
3362 + |
|
3363 +-G |
|
3364 + |
|
3365 + This is a Sendmail option which is ignored by Exim. |
|
3366 + |
|
3367 +-h <number> |
|
3368 + |
|
3369 + This option is accepted for compatibility with Sendmail, but has no effect. |
|
3370 + (In Sendmail it overrides the "hop count" obtained by counting Received: |
|
3371 + headers.) |
|
3372 + |
|
3373 +-i |
|
3374 + |
|
3375 + This option, which has the same effect as -oi, specifies that a dot on a |
|
3376 + line by itself should not terminate an incoming, non-SMTP message. I can |
|
3377 + find no documentation for this option in Solaris 2.4 Sendmail, but the |
|
3378 + mailx command in Solaris 2.4 uses it. See also -ti. |
|
3379 + |
|
3380 +-M <message id> <message id> ... |
|
3381 + |
|
3382 + This option requests Exim to run a delivery attempt on each message in |
|
3383 + turn. If any of the messages are frozen, they are automatically thawed |
|
3384 + before the delivery attempt. The settings of queue_domains, |
|
3385 + queue_smtp_domains, and hold_domains are ignored. |
|
3386 + |
|
3387 + Retry hints for any of the addresses are overridden - Exim tries to deliver |
|
3388 + even if the normal retry time has not yet been reached. This option |
|
3389 + requires the caller to be an admin user. However, there is an option called |
|
3390 + prod_requires_admin which can be set false to relax this restriction (and |
|
3391 + also the same requirement for the -q, -R, and -S options). |
|
3392 + |
|
3393 + The deliveries happen synchronously, that is, the original Exim process |
|
3394 + does not terminate until all the delivery attempts have finished. No output |
|
3395 + is produced unless there is a serious error. If you want to see what is |
|
3396 + happening, use the -v option as well, or inspect Exim's main log. |
|
3397 + |
|
3398 +-Mar <message id> <address> <address> ... |
|
3399 + |
|
3400 + This option requests Exim to add the addresses to the list of recipients of |
|
3401 + the message ("ar" for "add recipients"). The first argument must be a |
|
3402 + message id, and the remaining ones must be email addresses. However, if the |
|
3403 + message is active (in the middle of a delivery attempt), it is not altered. |
|
3404 + This option can be used only by an admin user. |
|
3405 + |
|
3406 +-MC <transport> <hostname> <sequence number> <message id> |
|
3407 + |
|
3408 + This option is not intended for use by external callers. It is used |
|
3409 + internally by Exim to invoke another instance of itself to deliver a |
|
3410 + waiting message using an existing SMTP connection, which is passed as the |
|
3411 + standard input. Details are given in chapter 45. This must be the final |
|
3412 + option, and the caller must be root or the Exim user in order to use it. |
|
3413 + |
|
3414 +-MCA |
|
3415 + |
|
3416 + This option is not intended for use by external callers. It is used |
|
3417 + internally by Exim in conjunction with the -MC option. It signifies that |
|
3418 + the connection to the remote host has been authenticated. |
|
3419 + |
|
3420 +-MCP |
|
3421 + |
|
3422 + This option is not intended for use by external callers. It is used |
|
3423 + internally by Exim in conjunction with the -MC option. It signifies that |
|
3424 + the server to which Exim is connected supports pipelining. |
|
3425 + |
|
3426 +-MCQ <process id> <pipe fd> |
|
3427 + |
|
3428 + This option is not intended for use by external callers. It is used |
|
3429 + internally by Exim in conjunction with the -MC option when the original |
|
3430 + delivery was started by a queue runner. It passes on the process id of the |
|
3431 + queue runner, together with the file descriptor number of an open pipe. |
|
3432 + Closure of the pipe signals the final completion of the sequence of |
|
3433 + processes that are passing messages through the same SMTP connection. |
|
3434 + |
|
3435 +-MCS |
|
3436 + |
|
3437 + This option is not intended for use by external callers. It is used |
|
3438 + internally by Exim in conjunction with the -MC option, and passes on the |
|
3439 + fact that the SMTP SIZE option should be used on messages delivered down |
|
3440 + the existing connection. |
|
3441 + |
|
3442 +-MCT |
|
3443 + |
|
3444 + This option is not intended for use by external callers. It is used |
|
3445 + internally by Exim in conjunction with the -MC option, and passes on the |
|
3446 + fact that the host to which Exim is connected supports TLS encryption. |
|
3447 + |
|
3448 +-Mc <message id> <message id> ... |
|
3449 + |
|
3450 + This option requests Exim to run a delivery attempt on each message in |
|
3451 + turn, but unlike the -M option, it does check for retry hints, and respects |
|
3452 + any that are found. This option is not very useful to external callers. It |
|
3453 + is provided mainly for internal use by Exim when it needs to re-invoke |
|
3454 + itself in order to regain root privilege for a delivery (see chapter 52). |
|
3455 + However, -Mc can be useful when testing, in order to run a delivery that |
|
3456 + respects retry times and other options such as hold_domains that are |
|
3457 + overridden when -M is used. Such a delivery does not count as a queue run. |
|
3458 + If you want to run a specific delivery as if in a queue run, you should use |
|
3459 + -q with a message id argument. A distinction between queue run deliveries |
|
3460 + and other deliveries is made in one or two places. |
|
3461 + |
|
3462 +-Mes <message id> <address> |
|
3463 + |
|
3464 + This option requests Exim to change the sender address in the message to |
|
3465 + the given address, which must be a fully qualified address or "<>" ("es" |
|
3466 + for "edit sender"). There must be exactly two arguments. The first argument |
|
3467 + must be a message id, and the second one an email address. However, if the |
|
3468 + message is active (in the middle of a delivery attempt), its status is not |
|
3469 + altered. This option can be used only by an admin user. |
|
3470 + |
|
3471 +-Mf <message id> <message id> ... |
|
3472 + |
|
3473 + This option requests Exim to mark each listed message as "frozen". This |
|
3474 + prevents any delivery attempts taking place until the message is "thawed", |
|
3475 + either manually or as a result of the auto_thaw configuration option. |
|
3476 + However, if any of the messages are active (in the middle of a delivery |
|
3477 + attempt), their status is not altered. This option can be used only by an |
|
3478 + admin user. |
|
3479 + |
|
3480 +-Mg <message id> <message id> ... |
|
3481 + |
|
3482 + This option requests Exim to give up trying to deliver the listed messages, |
|
3483 + including any that are frozen. However, if any of the messages are active, |
|
3484 + their status is not altered. For non-bounce messages, a delivery error |
|
3485 + message is sent to the sender, containing the text "cancelled by |
|
3486 + administrator". Bounce messages are just discarded. This option can be used |
|
3487 + only by an admin user. |
|
3488 + |
|
3489 +-Mmad <message id> <message id> ... |
|
3490 + |
|
3491 + This option requests Exim to mark all the recipient addresses in the |
|
3492 + messages as already delivered ("mad" for "mark all delivered"). However, if |
|
3493 + any message is active (in the middle of a delivery attempt), its status is |
|
3494 + not altered. This option can be used only by an admin user. |
|
3495 + |
|
3496 +-Mmd <message id> <address> <address> ... |
|
3497 + |
|
3498 + This option requests Exim to mark the given addresses as already delivered |
|
3499 + ("md" for "mark delivered"). The first argument must be a message id, and |
|
3500 + the remaining ones must be email addresses. These are matched to recipient |
|
3501 + addresses in the message in a case-sensitive manner. If the message is |
|
3502 + active (in the middle of a delivery attempt), its status is not altered. |
|
3503 + This option can be used only by an admin user. |
|
3504 + |
|
3505 +-Mrm <message id> <message id> ... |
|
3506 + |
|
3507 + This option requests Exim to remove the given messages from the queue. No |
|
3508 + bounce messages are sent; each message is simply forgotten. However, if any |
|
3509 + of the messages are active, their status is not altered. This option can be |
|
3510 + used only by an admin user or by the user who originally caused the message |
|
3511 + to be placed on the queue. |
|
3512 + |
|
3513 +-Mset <message id> |
|
3514 + |
|
3515 + This option is useful only in conjunction with -be (that is, when testing |
|
3516 + string expansions). Exim loads the given message from its spool before |
|
3517 + doing the test expansions, thus setting message-specific variables such as |
|
3518 + $message_size and the header variables. The $recipients variable is made |
|
3519 + available. This feature is provided to make it easier to test expansions |
|
3520 + that make use of these variables. However, this option can be used only by |
|
3521 + an admin user. See also -bem. |
|
3522 + |
|
3523 +-Mt <message id> <message id> ... |
|
3524 + |
|
3525 + This option requests Exim to "thaw" any of the listed messages that are |
|
3526 + "frozen", so that delivery attempts can resume. However, if any of the |
|
3527 + messages are active, their status is not altered. This option can be used |
|
3528 + only by an admin user. |
|
3529 + |
|
3530 +-Mvb <message id> |
|
3531 + |
|
3532 + This option causes the contents of the message body (-D) spool file to be |
|
3533 + written to the standard output. This option can be used only by an admin |
|
3534 + user. |
|
3535 + |
|
3536 +-Mvc <message id> |
|
3537 + |
|
3538 + This option causes a copy of the complete message (header lines plus body) |
|
3539 + to be written to the standard output in RFC 2822 format. This option can be |
|
3540 + used only by an admin user. |
|
3541 + |
|
3542 +-Mvh <message id> |
|
3543 + |
|
3544 + This option causes the contents of the message headers (-H) spool file to |
|
3545 + be written to the standard output. This option can be used only by an admin |
|
3546 + user. |
|
3547 + |
|
3548 +-Mvl <message id> |
|
3549 + |
|
3550 + This option causes the contents of the message log spool file to be written |
|
3551 + to the standard output. This option can be used only by an admin user. |
|
3552 + |
|
3553 +-m |
|
3554 + |
|
3555 + This is apparently a synonym for -om that is accepted by Sendmail, so Exim |
|
3556 + treats it that way too. |
|
3557 + |
|
3558 +-N |
|
3559 + |
|
3560 + This is a debugging option that inhibits delivery of a message at the |
|
3561 + transport level. It implies -v. Exim goes through many of the motions of |
|
3562 + delivery - it just doesn't actually transport the message, but instead |
|
3563 + behaves as if it had successfully done so. However, it does not make any |
|
3564 + updates to the retry database, and the log entries for deliveries are |
|
3565 + flagged with "*>" rather than "=>". |
|
3566 + |
|
3567 + Because -N discards any message to which it applies, only root or the Exim |
|
3568 + user are allowed to use it with -bd, -q, -R or -M. In other words, an |
|
3569 + ordinary user can use it only when supplying an incoming message to which |
|
3570 + it will apply. Although transportation never fails when -N is set, an |
|
3571 + address may be deferred because of a configuration problem on a transport, |
|
3572 + or a routing problem. Once -N has been used for a delivery attempt, it |
|
3573 + sticks to the message, and applies to any subsequent delivery attempts that |
|
3574 + may happen for that message. |
|
3575 + |
|
3576 +-n |
|
3577 + |
|
3578 + This option is interpreted by Sendmail to mean "no aliasing". It is ignored |
|
3579 + by Exim. |
|
3580 + |
|
3581 +-OÂ <data> |
|
3582 + |
|
3583 + This option is interpreted by Sendmail to mean "set option". It is ignored |
|
3584 + by Exim. |
|
3585 + |
|
3586 +-oA <file name> |
|
3587 + |
|
3588 + This option is used by Sendmail in conjunction with -bi to specify an |
|
3589 + alternative alias file name. Exim handles -bi differently; see the |
|
3590 + description above. |
|
3591 + |
|
3592 +-oBÂ <n> |
|
3593 + |
|
3594 + This is a debugging option which limits the maximum number of messages that |
|
3595 + can be delivered down one SMTP connection, overriding the value set in any |
|
3596 + smtp transport. If <n> is omitted, the limit is set to 1. |
|
3597 + |
|
3598 +-odb |
|
3599 + |
|
3600 + This option applies to all modes in which Exim accepts incoming messages, |
|
3601 + including the listening daemon. It requests "background" delivery of such |
|
3602 + messages, which means that the accepting process automatically starts a |
|
3603 + delivery process for each message received, but does not wait for the |
|
3604 + delivery processes to finish. |
|
3605 + |
|
3606 + When all the messages have been received, the reception process exits, |
|
3607 + leaving the delivery processes to finish in their own time. The standard |
|
3608 + output and error streams are closed at the start of each delivery process. |
|
3609 + This is the default action if none of the -od options are present. |
|
3610 + |
|
3611 + If one of the queueing options in the configuration file (queue_only or |
|
3612 + queue_only_file, for example) is in effect, -odb overrides it if |
|
3613 + queue_only_override is set true, which is the default setting. If |
|
3614 + queue_only_override is set false, -odb has no effect. |
|
3615 + |
|
3616 +-odf |
|
3617 + |
|
3618 + This option requests "foreground" (synchronous) delivery when Exim has |
|
3619 + accepted a locally-generated message. (For the daemon it is exactly the |
|
3620 + same as -odb.) A delivery process is automatically started to deliver the |
|
3621 + message, and Exim waits for it to complete before proceeding. |
|
3622 + |
|
3623 + The original Exim reception process does not finish until the delivery |
|
3624 + process for the final message has ended. The standard error stream is left |
|
3625 + open during deliveries. |
|
3626 + |
|
3627 + However, like -odb, this option has no effect if queue_only_override is |
|
3628 + false and one of the queueing options in the configuration file is in |
|
3629 + effect. |
|
3630 + |
|
3631 + If there is a temporary delivery error during foreground delivery, the |
|
3632 + message is left on the queue for later delivery, and the original reception |
|
3633 + process exits. See chapter 48 for a way of setting up a restricted |
|
3634 + configuration that never queues messages. |
|
3635 + |
|
3636 +-odi |
|
3637 + |
|
3638 + This option is synonymous with -odf. It is provided for compatibility with |
|
3639 + Sendmail. |
|
3640 + |
|
3641 +-odq |
|
3642 + |
|
3643 + This option applies to all modes in which Exim accepts incoming messages, |
|
3644 + including the listening daemon. It specifies that the accepting process |
|
3645 + should not automatically start a delivery process for each message |
|
3646 + received. Messages are placed on the queue, and remain there until a |
|
3647 + subsequent queue runner process encounters them. There are several |
|
3648 + configuration options (such as queue_only) that can be used to queue |
|
3649 + incoming messages under certain conditions. This option overrides all of |
|
3650 + them and also -odqs. It always forces queueing. |
|
3651 + |
|
3652 +-odqs |
|
3653 + |
|
3654 + This option is a hybrid between -odb/-odi and -odq. However, like -odb and |
|
3655 + -odi, this option has no effect if queue_only_override is false and one of |
|
3656 + the queueing options in the configuration file is in effect. |
|
3657 + |
|
3658 + When -odqs does operate, a delivery process is started for each incoming |
|
3659 + message, in the background by default, but in the foreground if -odi is |
|
3660 + also present. The recipient addresses are routed, and local deliveries are |
|
3661 + done in the normal way. However, if any SMTP deliveries are required, they |
|
3662 + are not done at this time, so the message remains on the queue until a |
|
3663 + subsequent queue runner process encounters it. Because routing was done, |
|
3664 + Exim knows which messages are waiting for which hosts, and so a number of |
|
3665 + messages for the same host can be sent in a single SMTP connection. The |
|
3666 + queue_smtp_domains configuration option has the same effect for specific |
|
3667 + domains. See also the -qq option. |
|
3668 + |
|
3669 +-oee |
|
3670 + |
|
3671 + If an error is detected while a non-SMTP message is being received (for |
|
3672 + example, a malformed address), the error is reported to the sender in a |
|
3673 + mail message. |
|
3674 + |
|
3675 + Provided this error message is successfully sent, the Exim receiving |
|
3676 + process exits with a return code of zero. If not, the return code is 2 if |
|
3677 + the problem is that the original message has no recipients, or 1 any other |
|
3678 + error. This is the default -oex option if Exim is called as rmail. |
|
3679 + |
|
3680 +-oem |
|
3681 + |
|
3682 + This is the same as -oee, except that Exim always exits with a non-zero |
|
3683 + return code, whether or not the error message was successfully sent. This |
|
3684 + is the default -oex option, unless Exim is called as rmail. |
|
3685 + |
|
3686 +-oep |
|
3687 + |
|
3688 + If an error is detected while a non-SMTP message is being received, the |
|
3689 + error is reported by writing a message to the standard error file (stderr). |
|
3690 + The return code is 1 for all errors. |
|
3691 + |
|
3692 +-oeq |
|
3693 + |
|
3694 + This option is supported for compatibility with Sendmail, but has the same |
|
3695 + effect as -oep. |
|
3696 + |
|
3697 +-oew |
|
3698 + |
|
3699 + This option is supported for compatibility with Sendmail, but has the same |
|
3700 + effect as -oem. |
|
3701 + |
|
3702 +-oi |
|
3703 + |
|
3704 + This option, which has the same effect as -i, specifies that a dot on a |
|
3705 + line by itself should not terminate an incoming, non-SMTP message. |
|
3706 + Otherwise, a single dot does terminate, though Exim does no special |
|
3707 + processing for other lines that start with a dot. This option is set by |
|
3708 + default if Exim is called as rmail. See also -ti. |
|
3709 + |
|
3710 +-oitrue |
|
3711 + |
|
3712 + This option is treated as synonymous with -oi. |
|
3713 + |
|
3714 +-oMa <host address> |
|
3715 + |
|
3716 + A number of options starting with -oM can be used to set values associated |
|
3717 + with remote hosts on locally-submitted messages (that is, messages not |
|
3718 + received over TCP/IP). These options can be used by any caller in |
|
3719 + conjunction with the -bh, -be, -bf, -bF, -bt, or -bv testing options. In |
|
3720 + other circumstances, they are ignored unless the caller is trusted. |
|
3721 + |
|
3722 + The -oMa option sets the sender host address. This may include a port |
|
3723 + number at the end, after a full stop (period). For example: |
|
3724 + |
|
3725 + exim -bs -oMa 10.9.8.7.1234 |
|
3726 + |
|
3727 + An alternative syntax is to enclose the IP address in square brackets, |
|
3728 + followed by a colon and the port number: |
|
3729 + |
|
3730 + exim -bs -oMa [10.9.8.7]:1234 |
|
3731 + |
|
3732 + The IP address is placed in the $sender_host_address variable, and the |
|
3733 + port, if present, in $sender_host_port. If both -oMa and -bh are present on |
|
3734 + the command line, the sender host IP address is taken from whichever one is |
|
3735 + last. |
|
3736 + |
|
3737 +-oMaa <name> |
|
3738 + |
|
3739 + See -oMa above for general remarks about the -oM options. The -oMaa option |
|
3740 + sets the value of $sender_host_authenticated (the authenticator name). See |
|
3741 + chapter 33 for a discussion of SMTP authentication. This option can be used |
|
3742 + with -bh and -bs to set up an authenticated SMTP session without actually |
|
3743 + using the SMTP AUTH command. |
|
3744 + |
|
3745 +-oMai <string> |
|
3746 + |
|
3747 + See -oMa above for general remarks about the -oM options. The -oMai option |
|
3748 + sets the value of $authenticated_id (the id that was authenticated). This |
|
3749 + overrides the default value (the caller's login id, except with -bh, where |
|
3750 + there is no default) for messages from local sources. See chapter 33 for a |
|
3751 + discussion of authenticated ids. |
|
3752 + |
|
3753 +-oMas <address> |
|
3754 + |
|
3755 + See -oMa above for general remarks about the -oM options. The -oMas option |
|
3756 + sets the authenticated sender value in $authenticated_sender. It overrides |
|
3757 + the sender address that is created from the caller's login id for messages |
|
3758 + from local sources, except when -bh is used, when there is no default. For |
|
3759 + both -bh and -bs, an authenticated sender that is specified on a MAIL |
|
3760 + command overrides this value. See chapter 33 for a discussion of |
|
3761 + authenticated senders. |
|
3762 + |
|
3763 +-oMi <interface address> |
|
3764 + |
|
3765 + See -oMa above for general remarks about the -oM options. The -oMi option |
|
3766 + sets the IP interface address value. A port number may be included, using |
|
3767 + the same syntax as for -oMa. The interface address is placed in |
|
3768 + $received_ip_address and the port number, if present, in $received_port. |
|
3769 + |
|
3770 +-oMr <protocol name> |
|
3771 + |
|
3772 + See -oMa above for general remarks about the -oM options. The -oMr option |
|
3773 + sets the received protocol value that is stored in $received_protocol. |
|
3774 + However, it does not apply (and is ignored) when -bh or -bs is used. For |
|
3775 + -bh, the protocol is forced to one of the standard SMTP protocol names (see |
|
3776 + the description of $received_protocol in section 11.9). For -bs, the |
|
3777 + protocol is always "local-" followed by one of those same names. For -bS |
|
3778 + (batched SMTP) however, the protocol can be set by -oMr. |
|
3779 + |
|
3780 +-oMs <host name> |
|
3781 + |
|
3782 + See -oMa above for general remarks about the -oM options. The -oMs option |
|
3783 + sets the sender host name in $sender_host_name. When this option is |
|
3784 + present, Exim does not attempt to look up a host name from an IP address; |
|
3785 + it uses the name it is given. |
|
3786 + |
|
3787 +-oMt <ident string> |
|
3788 + |
|
3789 + See -oMa above for general remarks about the -oM options. The -oMt option |
|
3790 + sets the sender ident value in $sender_ident. The default setting for local |
|
3791 + callers is the login id of the calling process, except when -bh is used, |
|
3792 + when there is no default. |
|
3793 + |
|
3794 +-om |
|
3795 + |
|
3796 + In Sendmail, this option means "me too", indicating that the sender of a |
|
3797 + message should receive a copy of the message if the sender appears in an |
|
3798 + alias expansion. Exim always does this, so the option does nothing. |
|
3799 + |
|
3800 +-oo |
|
3801 + |
|
3802 + This option is ignored. In Sendmail it specifies "old style headers", |
|
3803 + whatever that means. |
|
3804 + |
|
3805 +-oPÂ <path> |
|
3806 + |
|
3807 + This option is useful only in conjunction with -bd or -q with a time value. |
|
3808 + The option specifies the file to which the process id of the daemon is |
|
3809 + written. When -oX is used with -bd, or when -q with a time is used without |
|
3810 + -bd, this is the only way of causing Exim to write a pid file, because in |
|
3811 + those cases, the normal pid file is not used. |
|
3812 + |
|
3813 +-or <time> |
|
3814 + |
|
3815 + This option sets a timeout value for incoming non-SMTP messages. If it is |
|
3816 + not set, Exim will wait forever for the standard input. The value can also |
|
3817 + be set by the receive_timeout option. The format used for specifying times |
|
3818 + is described in section 6.15. |
|
3819 + |
|
3820 +-os <time> |
|
3821 + |
|
3822 + This option sets a timeout value for incoming SMTP messages. The timeout |
|
3823 + applies to each SMTP command and block of data. The value can also be set |
|
3824 + by the smtp_receive_timeout option; it defaults to 5 minutes. The format |
|
3825 + used for specifying times is described in section 6.15. |
|
3826 + |
|
3827 +-ov |
|
3828 + |
|
3829 + This option has exactly the same effect as -v. |
|
3830 + |
|
3831 +-oX <number or string> |
|
3832 + |
|
3833 + This option is relevant only when the -bd (start listening daemon) option |
|
3834 + is also given. It controls which ports and interfaces the daemon uses. |
|
3835 + Details of the syntax, and how it interacts with configuration file |
|
3836 + options, are given in chapter 13. When -oX is used to start a daemon, no |
|
3837 + pid file is written unless -oP is also present to specify a pid file name. |
|
3838 + |
|
3839 +-pd |
|
3840 + |
|
3841 + This option applies when an embedded Perl interpreter is linked with Exim |
|
3842 + (see chapter 12). It overrides the setting of the perl_at_start option, |
|
3843 + forcing the starting of the interpreter to be delayed until it is needed. |
|
3844 + |
|
3845 +-ps |
|
3846 + |
|
3847 + This option applies when an embedded Perl interpreter is linked with Exim |
|
3848 + (see chapter 12). It overrides the setting of the perl_at_start option, |
|
3849 + forcing the starting of the interpreter to occur as soon as Exim is |
|
3850 + started. |
|
3851 + |
|
3852 +-p<rval>:<sval> |
|
3853 + |
|
3854 + For compatibility with Sendmail, this option is equivalent to |
|
3855 + |
|
3856 + -oMr <rval> -oMs <sval> |
|
3857 + |
|
3858 + It sets the incoming protocol and host name (for trusted callers). The host |
|
3859 + name and its colon can be omitted when only the protocol is to be set. Note |
|
3860 + the Exim already has two private options, -pd and -ps, that refer to |
|
3861 + embedded Perl. It is therefore impossible to set a protocol value of "p" or |
|
3862 + "s" using this option (but that does not seem a real limitation). |
|
3863 + |
|
3864 +-q |
|
3865 + |
|
3866 + This option is normally restricted to admin users. However, there is a |
|
3867 + configuration option called prod_requires_admin which can be set false to |
|
3868 + relax this restriction (and also the same requirement for the -M, -R, and |
|
3869 + -S options). |
|
3870 + |
|
3871 + The -q option starts one queue runner process. This scans the queue of |
|
3872 + waiting messages, and runs a delivery process for each one in turn. It |
|
3873 + waits for each delivery process to finish before starting the next one. A |
|
3874 + delivery process may not actually do any deliveries if the retry times for |
|
3875 + the addresses have not been reached. Use -qf (see below) if you want to |
|
3876 + override this. |
|
3877 + |
|
3878 + If the delivery process spawns other processes to deliver other messages |
|
3879 + down passed SMTP connections, the queue runner waits for these to finish |
|
3880 + before proceeding. |
|
3881 + |
|
3882 + When all the queued messages have been considered, the original queue |
|
3883 + runner process terminates. In other words, a single pass is made over the |
|
3884 + waiting mail, one message at a time. Use -q with a time (see below) if you |
|
3885 + want this to be repeated periodically. |
|
3886 + |
|
3887 + Exim processes the waiting messages in an unpredictable order. It isn't |
|
3888 + very random, but it is likely to be different each time, which is all that |
|
3889 + matters. If one particular message screws up a remote MTA, other messages |
|
3890 + to the same MTA have a chance of getting through if they get tried first. |
|
3891 + |
|
3892 + It is possible to cause the messages to be processed in lexical message id |
|
3893 + order, which is essentially the order in which they arrived, by setting the |
|
3894 + queue_run_in_order option, but this is not recommended for normal use. |
|
3895 + |
|
3896 +-q<qflags> |
|
3897 + |
|
3898 + The -q option may be followed by one or more flag letters that change its |
|
3899 + behaviour. They are all optional, but if more than one is present, they |
|
3900 + must appear in the correct order. Each flag is described in a separate item |
|
3901 + below. |
|
3902 + |
|
3903 +-qq... |
|
3904 + |
|
3905 + An option starting with -qq requests a two-stage queue run. In the first |
|
3906 + stage, the queue is scanned as if the queue_smtp_domains option matched |
|
3907 + every domain. Addresses are routed, local deliveries happen, but no remote |
|
3908 + transports are run. |
|
3909 + |
|
3910 + The hints database that remembers which messages are waiting for specific |
|
3911 + hosts is updated, as if delivery to those hosts had been deferred. After |
|
3912 + this is complete, a second, normal queue scan happens, with routing and |
|
3913 + delivery taking place as normal. Messages that are routed to the same host |
|
3914 + should mostly be delivered down a single SMTP connection because of the |
|
3915 + hints that were set up during the first queue scan. This option may be |
|
3916 + useful for hosts that are connected to the Internet intermittently. |
|
3917 + |
|
3918 +-q[q]i... |
|
3919 + |
|
3920 + If the i flag is present, the queue runner runs delivery processes only for |
|
3921 + those messages that haven't previously been tried. (i stands for "initial |
|
3922 + delivery".) This can be helpful if you are putting messages on the queue |
|
3923 + using -odq and want a queue runner just to process the new messages. |
|
3924 + |
|
3925 +-q[q][i]f... |
|
3926 + |
|
3927 + If one f flag is present, a delivery attempt is forced for each non-frozen |
|
3928 + message, whereas without f only those non-frozen addresses that have passed |
|
3929 + their retry times are tried. |
|
3930 + |
|
3931 +-q[q][i]ff... |
|
3932 + |
|
3933 + If ff is present, a delivery attempt is forced for every message, whether |
|
3934 + frozen or not. |
|
3935 + |
|
3936 +-q[q][i][f[f]]l |
|
3937 + |
|
3938 + The l (the letter "ell") flag specifies that only local deliveries are to |
|
3939 + be done. If a message requires any remote deliveries, it remains on the |
|
3940 + queue for later delivery. |
|
3941 + |
|
3942 +-q<qflags> <start id> <end id> |
|
3943 + |
|
3944 + When scanning the queue, Exim can be made to skip over messages whose ids |
|
3945 + are lexically less than a given value by following the -q option with a |
|
3946 + starting message id. For example: |
|
3947 + |
|
3948 + exim -q 0t5C6f-0000c8-00 |
|
3949 + |
|
3950 + Messages that arrived earlier than "0t5C6f-0000c8-00" are not inspected. If |
|
3951 + a second message id is given, messages whose ids are lexically greater than |
|
3952 + it are also skipped. If the same id is given twice, for example, |
|
3953 + |
|
3954 + exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00 |
|
3955 + |
|
3956 + just one delivery process is started, for that message. This differs from |
|
3957 + -M in that retry data is respected, and it also differs from -Mc in that it |
|
3958 + counts as a delivery from a queue run. Note that the selection mechanism |
|
3959 + does not affect the order in which the messages are scanned. There are also |
|
3960 + other ways of selecting specific sets of messages for delivery in a queue |
|
3961 + run - see -R and -S. |
|
3962 + |
|
3963 +-q<qflags><time> |
|
3964 + |
|
3965 + When a time value is present, the -q option causes Exim to run as a daemon, |
|
3966 + starting a queue runner process at intervals specified by the given time |
|
3967 + value (whose format is described in section 6.15). This form of the -q |
|
3968 + option is commonly combined with the -bd option, in which case a single |
|
3969 + daemon process handles both functions. A common way of starting up a |
|
3970 + combined daemon at system boot time is to use a command such as |
|
3971 + |
|
3972 + /usr/exim/bin/exim -bd -q30m |
|
3973 + |
|
3974 + Such a daemon listens for incoming SMTP calls, and also starts a queue |
|
3975 + runner process every 30 minutes. |
|
3976 + |
|
3977 + When a daemon is started by -q with a time value, but without -bd, no pid |
|
3978 + file is written unless one is explicitly requested by the -oP option. |
|
3979 + |
|
3980 +-qR<rsflags>Â <string> |
|
3981 + |
|
3982 + This option is synonymous with -R. It is provided for Sendmail |
|
3983 + compatibility. |
|
3984 + |
|
3985 +-qS<rsflags>Â <string> |
|
3986 + |
|
3987 + This option is synonymous with -S. |
|
3988 + |
|
3989 +-R<rsflags>Â <string> |
|
3990 + |
|
3991 + The <rsflags> may be empty, in which case the white space before the string |
|
3992 + is optional, unless the string is f, ff, r, rf, or rff, which are the |
|
3993 + possible values for <rsflags>. White space is required if <rsflags> is not |
|
3994 + empty. |
|
3995 + |
|
3996 + This option is similar to -q with no time value, that is, it causes Exim to |
|
3997 + perform a single queue run, except that, when scanning the messages on the |
|
3998 + queue, Exim processes only those that have at least one undelivered |
|
3999 + recipient address containing the given string, which is checked in a |
|
4000 + case-independent way. If the <rsflags> start with r, <string> is |
|
4001 + interpreted as a regular expression; otherwise it is a literal string. |
|
4002 + |
|
4003 + If you want to do periodic queue runs for messages with specific |
|
4004 + recipients, you can combine -R with -q and a time value. For example: |
|
4005 + |
|
4006 + exim -q25m -R @special.domain.example |
|
4007 + |
|
4008 + This example does a queue run for messages with recipients in the given |
|
4009 + domain every 25 minutes. Any additional flags that are specified with -q |
|
4010 + are applied to each queue run. |
|
4011 + |
|
4012 + Once a message is selected for delivery by this mechanism, all its |
|
4013 + addresses are processed. For the first selected message, Exim overrides any |
|
4014 + retry information and forces a delivery attempt for each undelivered |
|
4015 + address. This means that if delivery of any address in the first message is |
|
4016 + successful, any existing retry information is deleted, and so delivery |
|
4017 + attempts for that address in subsequently selected messages (which are |
|
4018 + processed without forcing) will run. However, if delivery of any address |
|
4019 + does not succeed, the retry information is updated, and in subsequently |
|
4020 + selected messages, the failing address will be skipped. |
|
4021 + |
|
4022 + If the <rsflags> contain f or ff, the delivery forcing applies to all |
|
4023 + selected messages, not just the first; frozen messages are included when ff |
|
4024 + is present. |
|
4025 + |
|
4026 + The -R option makes it straightforward to initiate delivery of all messages |
|
4027 + to a given domain after a host has been down for some time. When the SMTP |
|
4028 + command ETRN is accepted by its ACL (see chapter 40), its default effect is |
|
4029 + to run Exim with the -R option, but it can be configured to run an |
|
4030 + arbitrary command instead. |
|
4031 + |
|
4032 +-r |
|
4033 + |
|
4034 + This is a documented (for Sendmail) obsolete alternative name for -f. |
|
4035 + |
|
4036 +-S<rsflags>Â <string> |
|
4037 + |
|
4038 + This option acts like -R except that it checks the string against each |
|
4039 + message's sender instead of against the recipients. If -R is also set, both |
|
4040 + conditions must be met for a message to be selected. If either of the |
|
4041 + options has f or ff in its flags, the associated action is taken. |
|
4042 + |
|
4043 +-Tqt <times> |
|
4044 + |
|
4045 + This an option that is exclusively for use by the Exim testing suite. It is |
|
4046 + not recognized when Exim is run normally. It allows for the setting up of |
|
4047 + explicit "queue times" so that various warning/retry features can be |
|
4048 + tested. |
|
4049 + |
|
4050 +-t |
|
4051 + |
|
4052 + When Exim is receiving a locally-generated, non-SMTP message on its |
|
4053 + standard input, the -t option causes the recipients of the message to be |
|
4054 + obtained from the To:, Cc:, and Bcc: header lines in the message instead of |
|
4055 + from the command arguments. The addresses are extracted before any |
|
4056 + rewriting takes place and the Bcc: header line, if present, is then |
|
4057 + removed. |
|
4058 + |
|
4059 + If the command has any arguments, they specify addresses to which the |
|
4060 + message is not to be delivered. That is, the argument addresses are removed |
|
4061 + from the recipients list obtained from the headers. This is compatible with |
|
4062 + Smail 3 and in accordance with the documented behaviour of several versions |
|
4063 + of Sendmail, as described in man pages on a number of operating systems |
|
4064 + (e.g. Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail |
|
4065 + add argument addresses to those obtained from the headers, and the O'Reilly |
|
4066 + Sendmail book documents it that way. Exim can be made to add argument |
|
4067 + addresses instead of subtracting them by setting the option |
|
4068 + extract_addresses_remove_arguments false. |
|
4069 + |
|
4070 + If there are any Resent- header lines in the message, Exim extracts |
|
4071 + recipients from all Resent-To:, Resent-Cc:, and Resent-Bcc: header lines |
|
4072 + instead of from To:, Cc:, and Bcc:. This is for compatibility with Sendmail |
|
4073 + and other MTAs. (Prior to release 4.20, Exim gave an error if -t was used |
|
4074 + in conjunction with Resent- header lines.) |
|
4075 + |
|
4076 + RFC 2822 talks about different sets of Resent- header lines (for when a |
|
4077 + message is resent several times). The RFC also specifies that they should |
|
4078 + be added at the front of the message, and separated by Received: lines. It |
|
4079 + is not at all clear how -t should operate in the present of multiple sets, |
|
4080 + nor indeed exactly what constitutes a "set". In practice, it seems that |
|
4081 + MUAs do not follow the RFC. The Resent- lines are often added at the end of |
|
4082 + the header, and if a message is resent more than once, it is common for the |
|
4083 + original set of Resent- headers to be renamed as X-Resent- when a new set |
|
4084 + is added. This removes any possible ambiguity. |
|
4085 + |
|
4086 +-ti |
|
4087 + |
|
4088 + This option is exactly equivalent to -t -i. It is provided for |
|
4089 + compatibility with Sendmail. |
|
4090 + |
|
4091 +-tls-on-connect |
|
4092 + |
|
4093 + This option is available when Exim is compiled with TLS support. It forces |
|
4094 + all incoming SMTP connections to behave as if the incoming port is listed |
|
4095 + in the tls_on_connect_ports option. See section 13.4 and chapter 39 for |
|
4096 + further details. |
|
4097 + |
|
4098 +-U |
|
4099 + |
|
4100 + Sendmail uses this option for "initial message submission", and its |
|
4101 + documentation states that in future releases, it may complain about |
|
4102 + syntactically invalid messages rather than fixing them when this flag is |
|
4103 + not set. Exim ignores this option. |
|
4104 + |
|
4105 +-v |
|
4106 + |
|
4107 + This option causes Exim to write information to the standard error stream, |
|
4108 + describing what it is doing. In particular, it shows the log lines for |
|
4109 + receiving and delivering a message, and if an SMTP connection is made, the |
|
4110 + SMTP dialogue is shown. Some of the log lines shown may not actually be |
|
4111 + written to the log if the setting of log_selector discards them. Any |
|
4112 + relevant selectors are shown with each log line. If none are shown, the |
|
4113 + logging is unconditional. |
|
4114 + |
|
4115 +-x |
|
4116 + |
|
4117 + AIX uses -x for a private purpose ("mail from a local mail program has |
|
4118 + National Language Support extended characters in the body of the mail |
|
4119 + item"). It sets -x when calling the MTA from its mail command. Exim ignores |
|
4120 + this option. |
|
4121 + |
|
4122 +6. The Exim run time configuration file |
|
4123 + |
|
4124 +Exim uses a single run time configuration file that is read whenever an Exim |
|
4125 +binary is executed. Note that in normal operation, this happens frequently, |
|
4126 +because Exim is designed to operate in a distributed manner, without central |
|
4127 +control. |
|
4128 + |
|
4129 +If a syntax error is detected while reading the configuration file, Exim writes |
|
4130 +a message on the standard error, and exits with a non-zero return code. The |
|
4131 +message is also written to the panic log. Note: Only simple syntax errors can |
|
4132 +be detected at this time. The values of any expanded options are not checked |
|
4133 +until the expansion happens, even when the expansion does not actually alter |
|
4134 +the string. |
|
4135 + |
|
4136 +The name of the configuration file is compiled into the binary for security |
|
4137 +reasons, and is specified by the CONFIGURE_FILE compilation option. In most |
|
4138 +configurations, this specifies a single file. However, it is permitted to give |
|
4139 +a colon-separated list of file names, in which case Exim uses the first |
|
4140 +existing file in the list. |
|
4141 + |
|
4142 +The run time configuration file must be owned by root or by the user that is |
|
4143 +specified at compile time by the CONFIGURE_OWNER option (if set). The |
|
4144 +configuration file must not be world-writeable, or group-writeable unless its |
|
4145 +group is the root group or the one specified at compile time by the |
|
4146 +CONFIGURE_GROUP option. |
|
4147 + |
|
4148 +Warning: In a conventional configuration, where the Exim binary is setuid to |
|
4149 +root, anybody who is able to edit the run time configuration file has an easy |
|
4150 +way to run commands as root. If you specify a user or group in the |
|
4151 +CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users who |
|
4152 +are members of that group will trivially be able to obtain root privileges. |
|
4153 + |
|
4154 +Up to Exim version 4.72, the run time configuration file was also permitted to |
|
4155 +be writeable by the Exim user and/or group. That has been changed in Exim 4.73 |
|
4156 +since it offered a simple privilege escalation for any attacker who managed to |
|
4157 +compromise the Exim user account. |
|
4158 + |
|
4159 +A default configuration file, which will work correctly in simple situations, |
|
4160 +is provided in the file src/configure.default. If CONFIGURE_FILE defines just |
|
4161 +one file name, the installation process copies the default configuration to a |
|
4162 +new file of that name if it did not previously exist. If CONFIGURE_FILE is a |
|
4163 +list, no default is automatically installed. Chapter 7 is a "walk-through" |
|
4164 +discussion of the default configuration. |
|
4165 + |
|
4166 +6.1Â Using a different configuration file |
|
4167 + |
|
4168 +A one-off alternate configuration can be specified by the -C command line |
|
4169 +option, which may specify a single file or a list of files. However, when -C is |
|
4170 +used, Exim gives up its root privilege, unless called by root (or unless the |
|
4171 +argument for -C is identical to the built-in value from CONFIGURE_FILE), or is |
|
4172 +listed in the TRUSTED_CONFIG_LIST file and the caller is the Exim user or the |
|
4173 +user specified in the CONFIGURE_OWNER setting. -C is useful mainly for checking |
|
4174 +the syntax of configuration files before installing them. No owner or group |
|
4175 +checks are done on a configuration file specified by -C, if root privilege has |
|
4176 +been dropped. |
|
4177 + |
|
4178 +Even the Exim user is not trusted to specify an arbitrary configuration file |
|
4179 +with the -C option to be used with root privileges, unless that file is listed |
|
4180 +in the TRUSTED_CONFIG_LIST file. This locks out the possibility of testing a |
|
4181 +configuration using -C right through message reception and delivery, even if |
|
4182 +the caller is root. The reception works, but by that time, Exim is running as |
|
4183 +the Exim user, so when it re-execs to regain privilege for the delivery, the |
|
4184 +use of -C causes privilege to be lost. However, root can test reception and |
|
4185 +delivery using two separate commands (one to put a message on the queue, using |
|
4186 +-odq, and another to do the delivery, using -M). |
|
4187 + |
|
4188 +If ALT_CONFIG_PREFIX is defined in Local/Makefile, it specifies a prefix string |
|
4189 +with which any file named in a -C command line option must start. In addition, |
|
4190 +the file name must not contain the sequence "/../". There is no default setting |
|
4191 +for ALT_CONFIG_PREFIX; when it is unset, any file name can be used with -C. |
|
4192 + |
|
4193 +One-off changes to a configuration can be specified by the -D command line |
|
4194 +option, which defines and overrides values for macros used inside the |
|
4195 +configuration file. However, like -C, the use of this option by a |
|
4196 +non-privileged user causes Exim to discard its root privilege. If |
|
4197 +DISABLE_D_OPTION is defined in Local/Makefile, the use of -D is completely |
|
4198 +disabled, and its use causes an immediate error exit. |
|
4199 + |
|
4200 +The WHITELIST_D_MACROS option in Local/Makefile permits the binary builder to |
|
4201 +declare certain macro names trusted, such that root privilege will not |
|
4202 +necessarily be discarded. WHITELIST_D_MACROS defines a colon-separated list of |
|
4203 +macros which are considered safe and, if -D only supplies macros from this |
|
4204 +list, and the values are acceptable, then Exim will not give up root privilege |
|
4205 +if the caller is root, the Exim run-time user, or the CONFIGURE_OWNER, if set. |
|
4206 +This is a transition mechanism and is expected to be removed in the future. |
|
4207 +Acceptable values for the macros satisfy the regexp: "^[A-Za-z0-9_/.-]*$" |
|
4208 + |
|
4209 +Some sites may wish to use the same Exim binary on different machines that |
|
4210 +share a file system, but to use different configuration files on each machine. |
|
4211 +If CONFIGURE_FILE_USE_NODE is defined in Local/Makefile, Exim first looks for a |
|
4212 +file whose name is the configuration file name followed by a dot and the |
|
4213 +machine's node name, as obtained from the uname() function. If this file does |
|
4214 +not exist, the standard name is tried. This processing occurs for each file |
|
4215 +name in the list given by CONFIGURE_FILE or -C. |
|
4216 + |
|
4217 +In some esoteric situations different versions of Exim may be run under |
|
4218 +different effective uids and the CONFIGURE_FILE_USE_EUID is defined to help |
|
4219 +with this. See the comments in src/EDITME for details. |
|
4220 + |
|
4221 +6.2Â Configuration file format |
|
4222 + |
|
4223 +Exim's configuration file is divided into a number of different parts. General |
|
4224 +option settings must always appear at the start of the file. The other parts |
|
4225 +are all optional, and may appear in any order. Each part other than the first |
|
4226 +is introduced by the word "begin" followed by the name of the part. The |
|
4227 +optional parts are: |
|
4228 + |
|
4229 + * ACL: Access control lists for controlling incoming SMTP mail (see chapter |
|
4230 + 40). |
|
4231 + |
|
4232 + * authenticators: Configuration settings for the authenticator drivers. These |
|
4233 + are concerned with the SMTP AUTH command (see chapter 33). |
|
4234 + |
|
4235 + * routers: Configuration settings for the router drivers. Routers process |
|
4236 + addresses and determine how the message is to be delivered (see chapters 15 |
|
4237 + -22). |
|
4238 + |
|
4239 + * transports: Configuration settings for the transport drivers. Transports |
|
4240 + define mechanisms for copying messages to destinations (see chapters 24-30 |
|
4241 + ). |
|
4242 + |
|
4243 + * retry: Retry rules, for use when a message cannot be delivered immediately. |
|
4244 + If there is no retry section, or if it is empty (that is, no retry rules |
|
4245 + are defined), Exim will not retry deliveries. In this situation, temporary |
|
4246 + errors are treated the same as permanent errors. Retry rules are discussed |
|
4247 + in chapter 32. |
|
4248 + |
|
4249 + * rewrite: Global address rewriting rules, for use when a message arrives and |
|
4250 + when new addresses are generated during delivery. Rewriting is discussed in |
|
4251 + chapter 31. |
|
4252 + |
|
4253 + * local_scan: Private options for the local_scan() function. If you want to |
|
4254 + use this feature, you must set |
|
4255 + |
|
4256 + LOCAL_SCAN_HAS_OPTIONS=yes |
|
4257 + |
|
4258 + in Local/Makefile before building Exim. Details of the local_scan() |
|
4259 + facility are given in chapter 42. |
|
4260 + |
|
4261 +Leading and trailing white space in configuration lines is always ignored. |
|
4262 + |
|
4263 +Blank lines in the file, and lines starting with a # character (ignoring |
|
4264 +leading white space) are treated as comments and are ignored. Note: A # |
|
4265 +character other than at the beginning of a line is not treated specially, and |
|
4266 +does not introduce a comment. |
|
4267 + |
|
4268 +Any non-comment line can be continued by ending it with a backslash. Note that |
|
4269 +the general rule for white space means that trailing white space after the |
|
4270 +backslash and leading white space at the start of continuation lines is |
|
4271 +ignored. Comment lines beginning with # (but not empty lines) may appear in the |
|
4272 +middle of a sequence of continuation lines. |
|
4273 + |
|
4274 +A convenient way to create a configuration file is to start from the default, |
|
4275 +which is supplied in src/configure.default, and add, delete, or change settings |
|
4276 +as required. |
|
4277 + |
|
4278 +The ACLs, retry rules, and rewriting rules have their own syntax which is |
|
4279 +described in chapters 40, 32, and 31, respectively. The other parts of the |
|
4280 +configuration file have some syntactic items in common, and these are described |
|
4281 +below, from section 6.10 onwards. Before that, the inclusion, macro, and |
|
4282 +conditional facilities are described. |
|
4283 + |
|
4284 +6.3Â File inclusions in the configuration file |
|
4285 + |
|
4286 +You can include other files inside Exim's run time configuration file by using |
|
4287 +this syntax: |
|
4288 + |
|
4289 +.include <file name> |
|
4290 +.include_if_exists <file name> |
|
4291 + |
|
4292 +on a line by itself. Double quotes round the file name are optional. If you use |
|
4293 +the first form, a configuration error occurs if the file does not exist; the |
|
4294 +second form does nothing for non-existent files. In all cases, an absolute file |
|
4295 +name is required. |
|
4296 + |
|
4297 +Includes may be nested to any depth, but remember that Exim reads its |
|
4298 +configuration file often, so it is a good idea to keep them to a minimum. If |
|
4299 +you change the contents of an included file, you must HUP the daemon, because |
|
4300 +an included file is read only when the configuration itself is read. |
|
4301 + |
|
4302 +The processing of inclusions happens early, at a physical line level, so, like |
|
4303 +comment lines, an inclusion can be used in the middle of an option setting, for |
|
4304 +example: |
|
4305 + |
|
4306 +hosts_lookup = a.b.c \ |
|
4307 + .include /some/file |
|
4308 + |
|
4309 +Include processing happens after macro processing (see below). Its effect is to |
|
4310 +process the lines of the included file as if they occurred inline where the |
|
4311 +inclusion appears. |
|
4312 + |
|
4313 +6.4Â Macros in the configuration file |
|
4314 + |
|
4315 +If a line in the main part of the configuration (that is, before the first |
|
4316 +"begin" line) begins with an upper case letter, it is taken as a macro |
|
4317 +definition, and must be of the form |
|
4318 + |
|
4319 +<name> = <rest of line> |
|
4320 + |
|
4321 +The name must consist of letters, digits, and underscores, and need not all be |
|
4322 +in upper case, though that is recommended. The rest of the line, including any |
|
4323 +continuations, is the replacement text, and has leading and trailing white |
|
4324 +space removed. Quotes are not removed. The replacement text can never end with |
|
4325 +a backslash character, but this doesn't seem to be a serious limitation. |
|
4326 + |
|
4327 +Macros may also be defined between router, transport, authenticator, or ACL |
|
4328 +definitions. They may not, however, be defined within an individual driver or |
|
4329 +ACL, or in the local_scan, retry, or rewrite sections of the configuration. |
|
4330 + |
|
4331 +6.5Â Macro substitution |
|
4332 + |
|
4333 +Once a macro is defined, all subsequent lines in the file (and any included |
|
4334 +files) are scanned for the macro name; if there are several macros, the line is |
|
4335 +scanned for each in turn, in the order in which the macros are defined. The |
|
4336 +replacement text is not re-scanned for the current macro, though it is scanned |
|
4337 +for subsequently defined macros. For this reason, a macro name may not contain |
|
4338 +the name of a previously defined macro as a substring. You could, for example, |
|
4339 +define |
|
4340 + |
|
4341 +ABCD_XYZÂ =Â <something> |
|
4342 +ABCD = <something else> |
|
4343 + |
|
4344 +but putting the definitions in the opposite order would provoke a configuration |
|
4345 +error. Macro expansion is applied to individual physical lines from the file, |
|
4346 +before checking for line continuation or file inclusion (see above). If a line |
|
4347 +consists solely of a macro name, and the expansion of the macro is empty, the |
|
4348 +line is ignored. A macro at the start of a line may turn the line into a |
|
4349 +comment line or a ".include" line. |
|
4350 + |
|
4351 +6.6Â Redefining macros |
|
4352 + |
|
4353 +Once defined, the value of a macro can be redefined later in the configuration |
|
4354 +(or in an included file). Redefinition is specified by using == instead of =. |
|
4355 +For example: |
|
4356 + |
|
4357 +MAC = initial value |
|
4358 +... |
|
4359 +MAC == updated value |
|
4360 + |
|
4361 +Redefinition does not alter the order in which the macros are applied to the |
|
4362 +subsequent lines of the configuration file. It is still the same order in which |
|
4363 +the macros were originally defined. All that changes is the macro's value. |
|
4364 +Redefinition makes it possible to accumulate values. For example: |
|
4365 + |
|
4366 +MAC = initial value |
|
4367 +... |
|
4368 +MAC == MAC and something added |
|
4369 + |
|
4370 +This can be helpful in situations where the configuration file is built from a |
|
4371 +number of other files. |
|
4372 + |
|
4373 +6.7Â Overriding macro values |
|
4374 + |
|
4375 +The values set for macros in the configuration file can be overridden by the -D |
|
4376 +command line option, but Exim gives up its root privilege when -D is used, |
|
4377 +unless called by root or the Exim user. A definition on the command line using |
|
4378 +the -D option causes all definitions and redefinitions within the file to be |
|
4379 +ignored. |
|
4380 + |
|
4381 +6.8Â Example of macro usage |
|
4382 + |
|
4383 +As an example of macro usage, consider a configuration where aliases are looked |
|
4384 +up in a MySQL database. It helps to keep the file less cluttered if long |
|
4385 +strings such as SQL statements are defined separately as macros, for example: |
|
4386 + |
|
4387 +ALIAS_QUERY = select mailbox from user where \ |
|
4388 + login='${quote_mysql:$local_part}'; |
|
4389 + |
|
4390 +This can then be used in a redirect router setting like this: |
|
4391 + |
|
4392 +data = ${lookup mysql{ALIAS_QUERY}} |
|
4393 + |
|
4394 +In earlier versions of Exim macros were sometimes used for domain, host, or |
|
4395 +address lists. In Exim 4 these are handled better by named lists - see section |
|
4396 +10.5. |
|
4397 + |
|
4398 +6.9Â Conditional skips in the configuration file |
|
4399 + |
|
4400 +You can use the directives ".ifdef", ".ifndef", ".elifdef", ".elifndef", |
|
4401 +".else", and ".endif" to dynamically include or exclude portions of the |
|
4402 +configuration file. The processing happens whenever the file is read (that is, |
|
4403 +when an Exim binary starts to run). |
|
4404 + |
|
4405 +The implementation is very simple. Instances of the first four directives must |
|
4406 +be followed by text that includes the names of one or macros. The condition |
|
4407 +that is tested is whether or not any macro substitution has taken place in the |
|
4408 +line. Thus: |
|
4409 + |
|
4410 +.ifdef AAA |
|
4411 +message_size_limit = 50M |
|
4412 +.else |
|
4413 +message_size_limit = 100M |
|
4414 +.endif |
|
4415 + |
|
4416 +sets a message size limit of 50M if the macro "AAA" is defined, and 100M |
|
4417 +otherwise. If there is more than one macro named on the line, the condition is |
|
4418 +true if any of them are defined. That is, it is an "or" condition. To obtain an |
|
4419 +"and" condition, you need to use nested ".ifdef"s. |
|
4420 + |
|
4421 +Although you can use a macro expansion to generate one of these directives, it |
|
4422 +is not very useful, because the condition "there was a macro substitution in |
|
4423 +this line" will always be true. |
|
4424 + |
|
4425 +Text following ".else" and ".endif" is ignored, and can be used as comment to |
|
4426 +clarify complicated nestings. |
|
4427 + |
|
4428 +6.10Â Common option syntax |
|
4429 + |
|
4430 +For the main set of options, driver options, and local_scan() options, each |
|
4431 +setting is on a line by itself, and starts with a name consisting of lower-case |
|
4432 +letters and underscores. Many options require a data value, and in these cases |
|
4433 +the name must be followed by an equals sign (with optional white space) and |
|
4434 +then the value. For example: |
|
4435 + |
|
4436 +qualify_domain = mydomain.example.com |
|
4437 + |
|
4438 +Some option settings may contain sensitive data, for example, passwords for |
|
4439 +accessing databases. To stop non-admin users from using the -bP command line |
|
4440 +option to read these values, you can precede the option settings with the word |
|
4441 +"hide". For example: |
|
4442 + |
|
4443 +hide mysql_servers = localhost/users/admin/secret-password |
|
4444 + |
|
4445 +For non-admin users, such options are displayed like this: |
|
4446 + |
|
4447 +mysql_servers = <value not displayable> |
|
4448 + |
|
4449 +If "hide" is used on a driver option, it hides the value of that option on all |
|
4450 +instances of the same driver. |
|
4451 + |
|
4452 +The following sections describe the syntax used for the different data types |
|
4453 +that are found in option settings. |
|
4454 + |
|
4455 +6.11Â Boolean options |
|
4456 + |
|
4457 +Options whose type is given as boolean are on/off switches. There are two |
|
4458 +different ways of specifying such options: with and without a data value. If |
|
4459 +the option name is specified on its own without data, the switch is turned on; |
|
4460 +if it is preceded by "no_" or "not_" the switch is turned off. However, boolean |
|
4461 +options may be followed by an equals sign and one of the words "true", "false", |
|
4462 +"yes", or "no", as an alternative syntax. For example, the following two |
|
4463 +settings have exactly the same effect: |
|
4464 + |
|
4465 +queue_only |
|
4466 +queue_only = true |
|
4467 + |
|
4468 +The following two lines also have the same (opposite) effect: |
|
4469 + |
|
4470 +no_queue_only |
|
4471 +queue_only = false |
|
4472 + |
|
4473 +You can use whichever syntax you prefer. |
|
4474 + |
|
4475 +6.12Â Integer values |
|
4476 + |
|
4477 +If an option's type is given as "integer", the value can be given in decimal, |
|
4478 +hexadecimal, or octal. If it starts with a digit greater than zero, a decimal |
|
4479 +number is assumed. Otherwise, it is treated as an octal number unless it starts |
|
4480 +with the characters "0x", in which case the remainder is interpreted as a |
|
4481 +hexadecimal number. |
|
4482 + |
|
4483 +If an integer value is followed by the letter K, it is multiplied by 1024; if |
|
4484 +it is followed by the letter M, it is multiplied by 1024x1024. When the values |
|
4485 +of integer option settings are output, values which are an exact multiple of |
|
4486 +1024 or 1024x1024 are sometimes, but not always, printed using the letters K |
|
4487 +and M. The printing style is independent of the actual input format that was |
|
4488 +used. |
|
4489 + |
|
4490 +6.13Â Octal integer values |
|
4491 + |
|
4492 +If an option's type is given as "octal integer", its value is always |
|
4493 +interpreted as an octal number, whether or not it starts with the digit zero. |
|
4494 +Such options are always output in octal. |
|
4495 + |
|
4496 +6.14Â Fixed point numbers |
|
4497 + |
|
4498 +If an option's type is given as "fixed-point", its value must be a decimal |
|
4499 +integer, optionally followed by a decimal point and up to three further digits. |
|
4500 + |
|
4501 +6.15Â Time intervals |
|
4502 + |
|
4503 +A time interval is specified as a sequence of numbers, each followed by one of |
|
4504 +the following letters, with no intervening white space: |
|
4505 + |
|
4506 +Â Â Â Â s seconds |
|
4507 +Â Â Â Â m minutes |
|
4508 +Â Â Â Â h hours |
|
4509 +Â Â Â Â d days |
|
4510 +Â Â Â Â w weeks |
|
4511 + |
|
4512 +For example, "3h50m" specifies 3 hours and 50 minutes. The values of time |
|
4513 +intervals are output in the same format. Exim does not restrict the values; it |
|
4514 +is perfectly acceptable, for example, to specify "90m" instead of "1h30m". |
|
4515 + |
|
4516 +6.16Â String values |
|
4517 + |
|
4518 +If an option's type is specified as "string", the value can be specified with |
|
4519 +or without double-quotes. If it does not start with a double-quote, the value |
|
4520 +consists of the remainder of the line plus any continuation lines, starting at |
|
4521 +the first character after any leading white space, with trailing white space |
|
4522 +removed, and with no interpretation of the characters in the string. Because |
|
4523 +Exim removes comment lines (those beginning with #) at an early stage, they can |
|
4524 +appear in the middle of a multi-line string. The following two settings are |
|
4525 +therefore equivalent: |
|
4526 + |
|
4527 +trusted_users = uucp:mail |
|
4528 +trusted_users = uucp:\ |
|
4529 + # This comment line is ignored |
|
4530 + mail |
|
4531 + |
|
4532 +If a string does start with a double-quote, it must end with a closing |
|
4533 +double-quote, and any backslash characters other than those used for line |
|
4534 +continuation are interpreted as escape characters, as follows: |
|
4535 + |
|
4536 +Â Â Â Â "\\" single backslash |
|
4537 +Â Â Â Â "\n" newline |
|
4538 +Â Â Â Â "\r" carriage return |
|
4539 +Â Â Â Â "\t" tab |
|
4540 +Â Â Â Â "\"<octal digits> up to 3 octal digits specify one character |
|
4541 +Â Â Â Â "\x"<hex digits> up to 2 hexadecimal digits specify one character |
|
4542 + |
|
4543 +If a backslash is followed by some other character, including a double-quote |
|
4544 +character, that character replaces the pair. |
|
4545 + |
|
4546 +Quoting is necessary only if you want to make use of the backslash escapes to |
|
4547 +insert special characters, or if you need to specify a value with leading or |
|
4548 +trailing spaces. These cases are rare, so quoting is almost never needed in |
|
4549 +current versions of Exim. In versions of Exim before 3.14, quoting was required |
|
4550 +in order to continue lines, so you may come across older configuration files |
|
4551 +and examples that apparently quote unnecessarily. |
|
4552 + |
|
4553 +6.17Â Expanded strings |
|
4554 + |
|
4555 +Some strings in the configuration file are subjected to string expansion, by |
|
4556 +which means various parts of the string may be changed according to the |
|
4557 +circumstances (see chapter 11). The input syntax for such strings is as just |
|
4558 +described; in particular, the handling of backslashes in quoted strings is done |
|
4559 +as part of the input process, before expansion takes place. However, backslash |
|
4560 +is also an escape character for the expander, so any backslashes that are |
|
4561 +required for that reason must be doubled if they are within a quoted |
|
4562 +configuration string. |
|
4563 + |
|
4564 +6.18Â User and group names |
|
4565 + |
|
4566 +User and group names are specified as strings, using the syntax described |
|
4567 +above, but the strings are interpreted specially. A user or group name must |
|
4568 +either consist entirely of digits, or be a name that can be looked up using the |
|
4569 +getpwnam() or getgrnam() function, as appropriate. |
|
4570 + |
|
4571 +6.19Â List construction |
|
4572 + |
|
4573 +The data for some configuration options is a list of items, with colon as the |
|
4574 +default separator. Many of these options are shown with type "string list" in |
|
4575 +the descriptions later in this document. Others are listed as "domain list", |
|
4576 +"host list", "address list", or "local part list". Syntactically, they are all |
|
4577 +the same; however, those other than "string list" are subject to particular |
|
4578 +kinds of interpretation, as described in chapter 10. |
|
4579 + |
|
4580 +In all these cases, the entire list is treated as a single string as far as the |
|
4581 +input syntax is concerned. The trusted_users setting in section 6.16 above is |
|
4582 +an example. If a colon is actually needed in an item in a list, it must be |
|
4583 +entered as two colons. Leading and trailing white space on each item in a list |
|
4584 +is ignored. This makes it possible to include items that start with a colon, |
|
4585 +and in particular, certain forms of IPv6 address. For example, the list |
|
4586 + |
|
4587 +local_interfaces = 127.0.0.1 : ::::1 |
|
4588 + |
|
4589 +contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1. |
|
4590 + |
|
4591 +Note: Although leading and trailing white space is ignored in individual list |
|
4592 +items, it is not ignored when parsing the list. The space after the first colon |
|
4593 +in the example above is necessary. If it were not there, the list would be |
|
4594 +interpreted as the two items 127.0.0.1:: and 1. |
|
4595 + |
|
4596 +6.20Â Changing list separators |
|
4597 + |
|
4598 +Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was |
|
4599 +introduced to allow the separator character to be changed. If a list begins |
|
4600 +with a left angle bracket, followed by any punctuation character, that |
|
4601 +character is used instead of colon as the list separator. For example, the list |
|
4602 +above can be rewritten to use a semicolon separator like this: |
|
4603 + |
|
4604 +local_interfaces = <; 127.0.0.1 ; ::1 |
|
4605 + |
|
4606 +This facility applies to all lists, with the exception of the list in |
|
4607 +log_file_path. It is recommended that the use of non-colon separators be |
|
4608 +confined to circumstances where they really are needed. |
|
4609 + |
|
4610 +It is also possible to use newline and other control characters (those with |
|
4611 +code values less than 32, plus DEL) as separators in lists. Such separators |
|
4612 +must be provided literally at the time the list is processed. For options that |
|
4613 +are string-expanded, you can write the separator using a normal escape |
|
4614 +sequence. This will be processed by the expander before the string is |
|
4615 +interpreted as a list. For example, if a newline-separated list of domains is |
|
4616 +generated by a lookup, you can process it directly by a line such as this: |
|
4617 + |
|
4618 +domains = <\n ${lookup mysql{.....}} |
|
4619 + |
|
4620 +This avoids having to change the list separator in such data. You are unlikely |
|
4621 +to want to use a control character as a separator in an option that is not |
|
4622 +expanded, because the value is literal text. However, it can be done by giving |
|
4623 +the value in quotes. For example: |
|
4624 + |
|
4625 +local_interfaces = "<\n 127.0.0.1 \n ::1" |
|
4626 + |
|
4627 +Unlike printing character separators, which can be included in list items by |
|
4628 +doubling, it is not possible to include a control character as data when it is |
|
4629 +set as the separator. Two such characters in succession are interpreted as |
|
4630 +enclosing an empty list item. |
|
4631 + |
|
4632 +6.21Â Empty items in lists |
|
4633 + |
|
4634 +An empty item at the end of a list is always ignored. In other words, trailing |
|
4635 +separator characters are ignored. Thus, the list in |
|
4636 + |
|
4637 +senders = user@domain : |
|
4638 + |
|
4639 +contains only a single item. If you want to include an empty string as one item |
|
4640 +in a list, it must not be the last item. For example, this list contains three |
|
4641 +items, the second of which is empty: |
|
4642 + |
|
4643 +senders = user1@domain : : user2@domain |
|
4644 + |
|
4645 +Note: There must be white space between the two colons, as otherwise they are |
|
4646 +interpreted as representing a single colon data character (and the list would |
|
4647 +then contain just one item). If you want to specify a list that contains just |
|
4648 +one, empty item, you can do it as in this example: |
|
4649 + |
|
4650 +senders = : |
|
4651 + |
|
4652 +In this case, the first item is empty, and the second is discarded because it |
|
4653 +is at the end of the list. |
|
4654 + |
|
4655 +6.22Â Format of driver configurations |
|
4656 + |
|
4657 +There are separate parts in the configuration for defining routers, transports, |
|
4658 +and authenticators. In each part, you are defining a number of driver |
|
4659 +instances, each with its own set of options. Each driver instance is defined by |
|
4660 +a sequence of lines like this: |
|
4661 + |
|
4662 +<instance name>: |
|
4663 +Â Â <option> |
|
4664 +Â Â ... |
|
4665 +Â Â <option> |
|
4666 + |
|
4667 +In the following example, the instance name is localuser, and it is followed by |
|
4668 +three options settings: |
|
4669 + |
|
4670 +localuser: |
|
4671 + driver = accept |
|
4672 + check_local_user |
|
4673 + transport = local_delivery |
|
4674 + |
|
4675 +For each driver instance, you specify which Exim code module it uses - by the |
|
4676 +setting of the driver option - and (optionally) some configuration settings. |
|
4677 +For example, in the case of transports, if you want a transport to deliver with |
|
4678 +SMTP you would use the smtp driver; if you want to deliver to a local file you |
|
4679 +would use the appendfile driver. Each of the drivers is described in detail in |
|
4680 +its own separate chapter later in this manual. |
|
4681 + |
|
4682 +You can have several routers, transports, or authenticators that are based on |
|
4683 +the same underlying driver (each must have a different instance name). |
|
4684 + |
|
4685 +The order in which routers are defined is important, because addresses are |
|
4686 +passed to individual routers one by one, in order. The order in which |
|
4687 +transports are defined does not matter at all. The order in which |
|
4688 +authenticators are defined is used only when Exim, as a client, is searching |
|
4689 +them to find one that matches an authentication mechanism offered by the |
|
4690 +server. |
|
4691 + |
|
4692 +Within a driver instance definition, there are two kinds of option: generic and |
|
4693 +private. The generic options are those that apply to all drivers of the same |
|
4694 +type (that is, all routers, all transports or all authenticators). The driver |
|
4695 +option is a generic option that must appear in every definition. The private |
|
4696 +options are special for each driver, and none need appear, because they all |
|
4697 +have default values. |
|
4698 + |
|
4699 +The options may appear in any order, except that the driver option must precede |
|
4700 +any private options, since these depend on the particular driver. For this |
|
4701 +reason, it is recommended that driver always be the first option. |
|
4702 + |
|
4703 +Driver instance names, which are used for reference in log entries and |
|
4704 +elsewhere, can be any sequence of letters, digits, and underscores (starting |
|
4705 +with a letter) and must be unique among drivers of the same type. A router and |
|
4706 +a transport (for example) can each have the same name, but no two router |
|
4707 +instances can have the same name. The name of a driver instance should not be |
|
4708 +confused with the name of the underlying driver module. For example, the |
|
4709 +configuration lines: |
|
4710 + |
|
4711 +remote_smtp: |
|
4712 + driver = smtp |
|
4713 + |
|
4714 +create an instance of the smtp transport driver whose name is remote_smtp. The |
|
4715 +same driver code can be used more than once, with different instance names and |
|
4716 +different option settings each time. A second instance of the smtp transport, |
|
4717 +with different options, might be defined thus: |
|
4718 + |
|
4719 +special_smtp: |
|
4720 + driver = smtp |
|
4721 + port = 1234 |
|
4722 + command_timeout = 10s |
|
4723 + |
|
4724 +The names remote_smtp and special_smtp would be used to reference these |
|
4725 +transport instances from routers, and these names would appear in log lines. |
|
4726 + |
|
4727 +Comment lines may be present in the middle of driver specifications. The full |
|
4728 +list of option settings for any particular driver instance, including all the |
|
4729 +defaulted values, can be extracted by making use of the -bP command line |
|
4730 +option. |
|
4731 + |
|
4732 +7. The default configuration file |
|
4733 + |
|
4734 +The default configuration file supplied with Exim as src/configure.default is |
|
4735 +sufficient for a host with simple mail requirements. As an introduction to the |
|
4736 +way Exim is configured, this chapter "walks through" the default configuration, |
|
4737 +giving brief explanations of the settings. Detailed descriptions of the options |
|
4738 +are given in subsequent chapters. The default configuration file itself |
|
4739 +contains extensive comments about ways you might want to modify the initial |
|
4740 +settings. However, note that there are many options that are not mentioned at |
|
4741 +all in the default configuration. |
|
4742 + |
|
4743 +7.1Â Main configuration settings |
|
4744 + |
|
4745 +The main (global) configuration option settings must always come first in the |
|
4746 +file. The first thing you'll see in the file, after some initial comments, is |
|
4747 +the line |
|
4748 + |
|
4749 +# primary_hostname = |
|
4750 + |
|
4751 +This is a commented-out setting of the primary_hostname option. Exim needs to |
|
4752 +know the official, fully qualified name of your host, and this is where you can |
|
4753 +specify it. However, in most cases you do not need to set this option. When it |
|
4754 +is unset, Exim uses the uname() system function to obtain the host name. |
|
4755 + |
|
4756 +The first three non-comment configuration lines are as follows: |
|
4757 + |
|
4758 +domainlist local_domains = @ |
|
4759 +domainlist relay_to_domains = |
|
4760 +hostlist relay_from_hosts = 127.0.0.1 |
|
4761 + |
|
4762 +These are not, in fact, option settings. They are definitions of two named |
|
4763 +domain lists and one named host list. Exim allows you to give names to lists of |
|
4764 +domains, hosts, and email addresses, in order to make it easier to manage the |
|
4765 +configuration file (see section 10.5). |
|
4766 + |
|
4767 +The first line defines a domain list called local_domains; this is used later |
|
4768 +in the configuration to identify domains that are to be delivered on the local |
|
4769 +host. |
|
4770 + |
|
4771 +There is just one item in this list, the string "@". This is a special form of |
|
4772 +entry which means "the name of the local host". Thus, if the local host is |
|
4773 +called a.host.example, mail to any.user@a.host.example is expected to be |
|
4774 +delivered locally. Because the local host's name is referenced indirectly, the |
|
4775 +same configuration file can be used on different hosts. |
|
4776 + |
|
4777 +The second line defines a domain list called relay_to_domains, but the list |
|
4778 +itself is empty. Later in the configuration we will come to the part that |
|
4779 +controls mail relaying through the local host; it allows relaying to any |
|
4780 +domains in this list. By default, therefore, no relaying on the basis of a mail |
|
4781 +domain is permitted. |
|
4782 + |
|
4783 +The third line defines a host list called relay_from_hosts. This list is used |
|
4784 +later in the configuration to permit relaying from any host or IP address that |
|
4785 +matches the list. The default contains just the IP address of the IPv4 loopback |
|
4786 +interface, which means that processes on the local host are able to submit mail |
|
4787 +for relaying by sending it over TCP/IP to that interface. No other hosts are |
|
4788 +permitted to submit messages for relaying. |
|
4789 + |
|
4790 +Just to be sure there's no misunderstanding: at this point in the configuration |
|
4791 +we aren't actually setting up any controls. We are just defining some domains |
|
4792 +and hosts that will be used in the controls that are specified later. |
|
4793 + |
|
4794 +The next two configuration lines are genuine option settings: |
|
4795 + |
|
4796 +acl_smtp_rcpt = acl_check_rcpt |
|
4797 +acl_smtp_data = acl_check_data |
|
4798 + |
|
4799 +These options specify Access Control Lists (ACLs) that are to be used during an |
|
4800 +incoming SMTP session for every recipient of a message (every RCPT command), |
|
4801 +and after the contents of the message have been received, respectively. The |
|
4802 +names of the lists are acl_check_rcpt and acl_check_data, and we will come to |
|
4803 +their definitions below, in the ACL section of the configuration. The RCPT ACL |
|
4804 +controls which recipients are accepted for an incoming message - if a |
|
4805 +configuration does not provide an ACL to check recipients, no SMTP mail can be |
|
4806 +accepted. The DATA ACL allows the contents of a message to be checked. |
|
4807 + |
|
4808 +Two commented-out option settings are next: |
|
4809 + |
|
4810 +# av_scanner = clamd:/tmp/clamd |
|
4811 +# spamd_address = 127.0.0.1 783 |
|
4812 + |
|
4813 +These are example settings that can be used when Exim is compiled with the |
|
4814 +content-scanning extension. The first specifies the interface to the virus |
|
4815 +scanner, and the second specifies the interface to SpamAssassin. Further |
|
4816 +details are given in chapter 41. |
|
4817 + |
|
4818 +Three more commented-out option settings follow: |
|
4819 + |
|
4820 +# tls_advertise_hosts = * |
|
4821 +# tls_certificate = /etc/ssl/exim.crt |
|
4822 +# tls_privatekey = /etc/ssl/exim.pem |
|
4823 + |
|
4824 +These are example settings that can be used when Exim is compiled with support |
|
4825 +for TLS (aka SSL) as described in section 4.7. The first one specifies the list |
|
4826 +of clients that are allowed to use TLS when connecting to this server; in this |
|
4827 +case the wildcard means all clients. The other options specify where Exim |
|
4828 +should find its TLS certificate and private key, which together prove the |
|
4829 +server's identity to any clients that connect. More details are given in |
|
4830 +chapter 39. |
|
4831 + |
|
4832 +Another two commented-out option settings follow: |
|
4833 + |
|
4834 +# daemon_smtp_ports = 25 : 465 : 587 |
|
4835 +# tls_on_connect_ports = 465 |
|
4836 + |
|
4837 +These options provide better support for roaming users who wish to use this |
|
4838 +server for message submission. They are not much use unless you have turned on |
|
4839 +TLS (as described in the previous paragraph) and authentication (about which |
|
4840 +more in section 7.7). The usual SMTP port 25 is often blocked on end-user |
|
4841 +networks, so RFC 4409 specifies that message submission should use port 587 |
|
4842 +instead. However some software (notably Microsoft Outlook) cannot be configured |
|
4843 +to use port 587 correctly, so these settings also enable the non-standard |
|
4844 +"smtps" (aka "ssmtp") port 465 (see section 13.4). |
|
4845 + |
|
4846 +Two more commented-out options settings follow: |
|
4847 + |
|
4848 +# qualify_domain = |
|
4849 +# qualify_recipient = |
|
4850 + |
|
4851 +The first of these specifies a domain that Exim uses when it constructs a |
|
4852 +complete email address from a local login name. This is often needed when Exim |
|
4853 +receives a message from a local process. If you do not set qualify_domain, the |
|
4854 +value of primary_hostname is used. If you set both of these options, you can |
|
4855 +have different qualification domains for sender and recipient addresses. If you |
|
4856 +set only the first one, its value is used in both cases. |
|
4857 + |
|
4858 +The following line must be uncommented if you want Exim to recognize addresses |
|
4859 +of the form user@[10.11.12.13] that is, with a "domain literal" (an IP address |
|
4860 +within square brackets) instead of a named domain. |
|
4861 + |
|
4862 +# allow_domain_literals |
|
4863 + |
|
4864 +The RFCs still require this form, but many people think that in the modern |
|
4865 +Internet it makes little sense to permit mail to be sent to specific hosts by |
|
4866 +quoting their IP addresses. This ancient format has been used by people who try |
|
4867 +to abuse hosts by using them for unwanted relaying. However, some people |
|
4868 +believe there are circumstances (for example, messages addressed to postmaster) |
|
4869 +where domain literals are still useful. |
|
4870 + |
|
4871 +The next configuration line is a kind of trigger guard: |
|
4872 + |
|
4873 +never_users = root |
|
4874 + |
|
4875 +It specifies that no delivery must ever be run as the root user. The normal |
|
4876 +convention is to set up root as an alias for the system administrator. This |
|
4877 +setting is a guard against slips in the configuration. The list of users |
|
4878 +specified by never_users is not, however, the complete list; the build-time |
|
4879 +configuration in Local/Makefile has an option called FIXED_NEVER_USERS |
|
4880 +specifying a list that cannot be overridden. The contents of never_users are |
|
4881 +added to this list. By default FIXED_NEVER_USERS also specifies root. |
|
4882 + |
|
4883 +When a remote host connects to Exim in order to send mail, the only information |
|
4884 +Exim has about the host's identity is its IP address. The next configuration |
|
4885 +line, |
|
4886 + |
|
4887 +host_lookup = * |
|
4888 + |
|
4889 +specifies that Exim should do a reverse DNS lookup on all incoming connections, |
|
4890 +in order to get a host name. This improves the quality of the logging |
|
4891 +information, but if you feel it is too expensive, you can remove it entirely, |
|
4892 +or restrict the lookup to hosts on "nearby" networks. Note that it is not |
|
4893 +always possible to find a host name from an IP address, because not all DNS |
|
4894 +reverse zones are maintained, and sometimes DNS servers are unreachable. |
|
4895 + |
|
4896 +The next two lines are concerned with ident callbacks, as defined by RFC 1413 |
|
4897 +(hence their names): |
|
4898 + |
|
4899 +rfc1413_hosts = * |
|
4900 +rfc1413_query_timeout = 5s |
|
4901 + |
|
4902 +These settings cause Exim to make ident callbacks for all incoming SMTP calls. |
|
4903 +You can limit the hosts to which these calls are made, or change the timeout |
|
4904 +that is used. If you set the timeout to zero, all ident calls are disabled. |
|
4905 +Although they are cheap and can provide useful information for tracing problem |
|
4906 +messages, some hosts and firewalls have problems with ident calls. This can |
|
4907 +result in a timeout instead of an immediate refused connection, leading to |
|
4908 +delays on starting up an incoming SMTP session. |
|
4909 + |
|
4910 +When Exim receives messages over SMTP connections, it expects all addresses to |
|
4911 +be fully qualified with a domain, as required by the SMTP definition. However, |
|
4912 +if you are running a server to which simple clients submit messages, you may |
|
4913 +find that they send unqualified addresses. The two commented-out options: |
|
4914 + |
|
4915 +# sender_unqualified_hosts = |
|
4916 +# recipient_unqualified_hosts = |
|
4917 + |
|
4918 +show how you can specify hosts that are permitted to send unqualified sender |
|
4919 +and recipient addresses, respectively. |
|
4920 + |
|
4921 +The percent_hack_domains option is also commented out: |
|
4922 + |
|
4923 +# percent_hack_domains = |
|
4924 + |
|
4925 +It provides a list of domains for which the "percent hack" is to operate. This |
|
4926 +is an almost obsolete form of explicit email routing. If you do not know |
|
4927 +anything about it, you can safely ignore this topic. |
|
4928 + |
|
4929 +The last two settings in the main part of the default configuration are |
|
4930 +concerned with messages that have been "frozen" on Exim's queue. When a message |
|
4931 +is frozen, Exim no longer continues to try to deliver it. Freezing occurs when |
|
4932 +a bounce message encounters a permanent failure because the sender address of |
|
4933 +the original message that caused the bounce is invalid, so the bounce cannot be |
|
4934 +delivered. This is probably the most common case, but there are also other |
|
4935 +conditions that cause freezing, and frozen messages are not always bounce |
|
4936 +messages. |
|
4937 + |
|
4938 +ignore_bounce_errors_after = 2d |
|
4939 +timeout_frozen_after = 7d |
|
4940 + |
|
4941 +The first of these options specifies that failing bounce messages are to be |
|
4942 +discarded after 2 days on the queue. The second specifies that any frozen |
|
4943 +message (whether a bounce message or not) is to be timed out (and discarded) |
|
4944 +after a week. In this configuration, the first setting ensures that no failing |
|
4945 +bounce message ever lasts a week. |
|
4946 + |
|
4947 +7.2Â ACL configuration |
|
4948 + |
|
4949 +In the default configuration, the ACL section follows the main configuration. |
|
4950 +It starts with the line |
|
4951 + |
|
4952 +begin acl |
|
4953 + |
|
4954 +and it contains the definitions of two ACLs, called acl_check_rcpt and |
|
4955 +acl_check_data, that were referenced in the settings of acl_smtp_rcpt and |
|
4956 +acl_smtp_data above. |
|
4957 + |
|
4958 +The first ACL is used for every RCPT command in an incoming SMTP message. Each |
|
4959 +RCPT command specifies one of the message's recipients. The ACL statements are |
|
4960 +considered in order, until the recipient address is either accepted or |
|
4961 +rejected. The RCPT command is then accepted or rejected, according to the |
|
4962 +result of the ACL processing. |
|
4963 + |
|
4964 +acl_check_rcpt: |
|
4965 + |
|
4966 +This line, consisting of a name terminated by a colon, marks the start of the |
|
4967 +ACL, and names it. |
|
4968 + |
|
4969 +accept hosts = : |
|
4970 + |
|
4971 +This ACL statement accepts the recipient if the sending host matches the list. |
|
4972 +But what does that strange list mean? It doesn't actually contain any host |
|
4973 +names or IP addresses. The presence of the colon puts an empty item in the |
|
4974 +list; Exim matches this only if the incoming message did not come from a remote |
|
4975 +host, because in that case, the remote hostname is empty. The colon is |
|
4976 +important. Without it, the list itself is empty, and can never match anything. |
|
4977 + |
|
4978 +What this statement is doing is to accept unconditionally all recipients in |
|
4979 +messages that are submitted by SMTP from local processes using the standard |
|
4980 +input and output (that is, not using TCP/IP). A number of MUAs operate in this |
|
4981 +manner. |
|
4982 + |
|
4983 +deny message = Restricted characters in address |
|
4984 + domains = +local_domains |
|
4985 + local_parts = ^[.] : ^.*[@%!/|] |
|
4986 + |
|
4987 +deny message = Restricted characters in address |
|
4988 + domains = !+local_domains |
|
4989 + local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./ |
|
4990 + |
|
4991 +These statements are concerned with local parts that contain any of the |
|
4992 +characters "@", "%", "!", "/", "|", or dots in unusual places. Although these |
|
4993 +characters are entirely legal in local parts (in the case of "@" and leading |
|
4994 +dots, only if correctly quoted), they do not commonly occur in Internet mail |
|
4995 +addresses. |
|
4996 + |
|
4997 +The first three have in the past been associated with explicitly routed |
|
4998 +addresses (percent is still sometimes used - see the percent_hack_domains |
|
4999 +option). Addresses containing these characters are regularly tried by spammers |
|
5000 +in an attempt to bypass relaying restrictions, and also by open relay testing |
|
5001 +programs. Unless you really need them it is safest to reject these characters |
|
5002 +at this early stage. This configuration is heavy-handed in rejecting these |
|
5003 +characters for all messages it accepts from remote hosts. This is a deliberate |
|
5004 +policy of being as safe as possible. |
|
5005 + |
|
5006 +The first rule above is stricter, and is applied to messages that are addressed |
|
5007 +to one of the local domains handled by this host. This is implemented by the |
|
5008 +first condition, which restricts it to domains that are listed in the |
|
5009 +local_domains domain list. The "+" character is used to indicate a reference to |
|
5010 +a named list. In this configuration, there is just one domain in local_domains, |
|
5011 +but in general there may be many. |
|
5012 + |
|
5013 +The second condition on the first statement uses two regular expressions to |
|
5014 +block local parts that begin with a dot or contain "@", "%", "!", "/", or "|". |
|
5015 +If you have local accounts that include these characters, you will have to |
|
5016 +modify this rule. |
|
5017 + |
|
5018 +Empty components (two dots in a row) are not valid in RFC 2822, but Exim allows |
|
5019 +them because they have been encountered in practice. (Consider the common |
|
5020 +convention of local parts constructed as " |
|
5021 +first-initial.second-initial.family-name" when applied to someone like the |
|
5022 +author of Exim, who has no second initial.) However, a local part starting with |
|
5023 +a dot or containing "/../" can cause trouble if it is used as part of a file |
|
5024 +name (for example, for a mailing list). This is also true for local parts that |
|
5025 +contain slashes. A pipe symbol can also be troublesome if the local part is |
|
5026 +incorporated unthinkingly into a shell command line. |
|
5027 + |
|
5028 +The second rule above applies to all other domains, and is less strict. This |
|
5029 +allows your own users to send outgoing messages to sites that use slashes and |
|
5030 +vertical bars in their local parts. It blocks local parts that begin with a |
|
5031 +dot, slash, or vertical bar, but allows these characters within the local part. |
|
5032 +However, the sequence "/../" is barred. The use of "@", "%", and "!" is |
|
5033 +blocked, as before. The motivation here is to prevent your users (or your |
|
5034 +users' viruses) from mounting certain kinds of attack on remote sites. |
|
5035 + |
|
5036 +accept local_parts = postmaster |
|
5037 + domains = +local_domains |
|
5038 + |
|
5039 +This statement, which has two conditions, accepts an incoming address if the |
|
5040 +local part is postmaster and the domain is one of those listed in the |
|
5041 +local_domains domain list. The "+" character is used to indicate a reference to |
|
5042 +a named list. In this configuration, there is just one domain in local_domains, |
|
5043 +but in general there may be many. |
|
5044 + |
|
5045 +The presence of this statement means that mail to postmaster is never blocked |
|
5046 +by any of the subsequent tests. This can be helpful while sorting out problems |
|
5047 +in cases where the subsequent tests are incorrectly denying access. |
|
5048 + |
|
5049 +require verify = sender |
|
5050 + |
|
5051 +This statement requires the sender address to be verified before any subsequent |
|
5052 +ACL statement can be used. If verification fails, the incoming recipient |
|
5053 +address is refused. Verification consists of trying to route the address, to |
|
5054 +see if a bounce message could be delivered to it. In the case of remote |
|
5055 +addresses, basic verification checks only the domain, but callouts can be used |
|
5056 +for more verification if required. Section 40.41 discusses the details of |
|
5057 +address verification. |
|
5058 + |
|
5059 +accept hosts = +relay_from_hosts |
|
5060 + control = submission |
|
5061 + |
|
5062 +This statement accepts the address if the message is coming from one of the |
|
5063 +hosts that are defined as being allowed to relay through this host. Recipient |
|
5064 +verification is omitted here, because in many cases the clients are dumb MUAs |
|
5065 +that do not cope well with SMTP error responses. For the same reason, the |
|
5066 +second line specifies "submission mode" for messages that are accepted. This is |
|
5067 +described in detail in section 44.1; it causes Exim to fix messages that are |
|
5068 +deficient in some way, for example, because they lack a Date: header line. If |
|
5069 +you are actually relaying out from MTAs, you should probably add recipient |
|
5070 +verification here, and disable submission mode. |
|
5071 + |
|
5072 +accept authenticated = * |
|
5073 + control = submission |
|
5074 + |
|
5075 +This statement accepts the address if the client host has authenticated itself. |
|
5076 +Submission mode is again specified, on the grounds that such messages are most |
|
5077 +likely to come from MUAs. The default configuration does not define any |
|
5078 +authenticators, though it does include some nearly complete commented-out |
|
5079 +examples described in 7.7. This means that no client can in fact authenticate |
|
5080 +until you complete the authenticator definitions. |
|
5081 + |
|
5082 +require message = relay not permitted |
|
5083 + domains = +local_domains : +relay_domains |
|
5084 + |
|
5085 +This statement rejects the address if its domain is neither a local domain nor |
|
5086 +one of the domains for which this host is a relay. |
|
5087 + |
|
5088 +require verify = recipient |
|
5089 + |
|
5090 +This statement requires the recipient address to be verified; if verification |
|
5091 +fails, the address is rejected. |
|
5092 + |
|
5093 +# deny message = rejected because $sender_host_address \ |
|
5094 +# is in a black list at $dnslist_domain\n\ |
|
5095 +# $dnslist_text |
|
5096 +# dnslists = black.list.example |
|
5097 +# |
|
5098 +# warn dnslists = black.list.example |
|
5099 +# add_header = X-Warning: $sender_host_address is in \ |
|
5100 +# a black list at $dnslist_domain |
|
5101 +# log_message = found in $dnslist_domain |
|
5102 + |
|
5103 +These commented-out lines are examples of how you could configure Exim to check |
|
5104 +sending hosts against a DNS black list. The first statement rejects messages |
|
5105 +from blacklisted hosts, whereas the second just inserts a warning header line. |
|
5106 + |
|
5107 +# require verify = csa |
|
5108 + |
|
5109 +This commented-out line is an example of how you could turn on client SMTP |
|
5110 +authorization (CSA) checking. Such checks do DNS lookups for special SRV |
|
5111 +records. |
|
5112 + |
|
5113 +accept |
|
5114 + |
|
5115 +The final statement in the first ACL unconditionally accepts any recipient |
|
5116 +address that has successfully passed all the previous tests. |
|
5117 + |
|
5118 +acl_check_data: |
|
5119 + |
|
5120 +This line marks the start of the second ACL, and names it. Most of the contents |
|
5121 +of this ACL are commented out: |
|
5122 + |
|
5123 +# deny malware = * |
|
5124 +# message = This message contains a virus \ |
|
5125 +# ($malware_name). |
|
5126 + |
|
5127 +These lines are examples of how to arrange for messages to be scanned for |
|
5128 +viruses when Exim has been compiled with the content-scanning extension, and a |
|
5129 +suitable virus scanner is installed. If the message is found to contain a |
|
5130 +virus, it is rejected with the given custom error message. |
|
5131 + |
|
5132 +# warn spam = nobody |
|
5133 +# message = X-Spam_score: $spam_score\n\ |
|
5134 +# X-Spam_score_int: $spam_score_int\n\ |
|
5135 +# X-Spam_bar: $spam_bar\n\ |
|
5136 +# X-Spam_report: $spam_report |
|
5137 + |
|
5138 +These lines are an example of how to arrange for messages to be scanned by |
|
5139 +SpamAssassin when Exim has been compiled with the content-scanning extension, |
|
5140 +and SpamAssassin has been installed. The SpamAssassin check is run with |
|
5141 +"nobody" as its user parameter, and the results are added to the message as a |
|
5142 +series of extra header line. In this case, the message is not rejected, |
|
5143 +whatever the spam score. |
|
5144 + |
|
5145 +accept |
|
5146 + |
|
5147 +This final line in the DATA ACL accepts the message unconditionally. |
|
5148 + |
|
5149 +7.3Â Router configuration |
|
5150 + |
|
5151 +The router configuration comes next in the default configuration, introduced by |
|
5152 +the line |
|
5153 + |
|
5154 +begin routers |
|
5155 + |
|
5156 +Routers are the modules in Exim that make decisions about where to send |
|
5157 +messages. An address is passed to each router in turn, until it is either |
|
5158 +accepted, or failed. This means that the order in which you define the routers |
|
5159 +matters. Each router is fully described in its own chapter later in this |
|
5160 +manual. Here we give only brief overviews. |
|
5161 + |
|
5162 +# domain_literal: |
|
5163 +# driver = ipliteral |
|
5164 +# domains = !+local_domains |
|
5165 +# transport = remote_smtp |
|
5166 + |
|
5167 +This router is commented out because the majority of sites do not want to |
|
5168 +support domain literal addresses (those of the form user@[10.9.8.7]). If you |
|
5169 +uncomment this router, you also need to uncomment the setting of |
|
5170 +allow_domain_literals in the main part of the configuration. |
|
5171 + |
|
5172 +dnslookup: |
|
5173 + driver = dnslookup |
|
5174 + domains = ! +local_domains |
|
5175 + transport = remote_smtp |
|
5176 + ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 |
|
5177 + no_more |
|
5178 + |
|
5179 +The first uncommented router handles addresses that do not involve any local |
|
5180 +domains. This is specified by the line |
|
5181 + |
|
5182 +domains = ! +local_domains |
|
5183 + |
|
5184 +The domains option lists the domains to which this router applies, but the |
|
5185 +exclamation mark is a negation sign, so the router is used only for domains |
|
5186 +that are not in the domain list called local_domains (which was defined at the |
|
5187 +start of the configuration). The plus sign before local_domains indicates that |
|
5188 +it is referring to a named list. Addresses in other domains are passed on to |
|
5189 +the following routers. |
|
5190 + |
|
5191 +The name of the router driver is dnslookup, and is specified by the driver |
|
5192 +option. Do not be confused by the fact that the name of this router instance is |
|
5193 +the same as the name of the driver. The instance name is arbitrary, but the |
|
5194 +name set in the driver option must be one of the driver modules that is in the |
|
5195 +Exim binary. |
|
5196 + |
|
5197 +The dnslookup router routes addresses by looking up their domains in the DNS in |
|
5198 +order to obtain a list of hosts to which the address is routed. If the router |
|
5199 +succeeds, the address is queued for the remote_smtp transport, as specified by |
|
5200 +the transport option. If the router does not find the domain in the DNS, no |
|
5201 +further routers are tried because of the no_more setting, so the address fails |
|
5202 +and is bounced. |
|
5203 + |
|
5204 +The ignore_target_hosts option specifies a list of IP addresses that are to be |
|
5205 +entirely ignored. This option is present because a number of cases have been |
|
5206 +encountered where MX records in the DNS point to host names whose IP addresses |
|
5207 +are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1). Completely ignoring |
|
5208 +these IP addresses causes Exim to fail to route the email address, so it |
|
5209 +bounces. Otherwise, Exim would log a routing problem, and continue to try to |
|
5210 +deliver the message periodically until the address timed out. |
|
5211 + |
|
5212 +system_aliases: |
|
5213 + driver = redirect |
|
5214 + allow_fail |
|
5215 + allow_defer |
|
5216 + data = ${lookup{$local_part}lsearch{/etc/aliases}} |
|
5217 +# user = exim |
|
5218 + file_transport = address_file |
|
5219 + pipe_transport = address_pipe |
|
5220 + |
|
5221 +Control reaches this and subsequent routers only for addresses in the local |
|
5222 +domains. This router checks to see whether the local part is defined as an |
|
5223 +alias in the /etc/aliases file, and if so, redirects it according to the data |
|
5224 +that it looks up from that file. If no data is found for the local part, the |
|
5225 +value of the data option is empty, causing the address to be passed to the next |
|
5226 +router. |
|
5227 + |
|
5228 +/etc/aliases is a conventional name for the system aliases file that is often |
|
5229 +used. That is why it is referenced by from the default configuration file. |
|
5230 +However, you can change this by setting SYSTEM_ALIASES_FILE in Local/Makefile |
|
5231 +before building Exim. |
|
5232 + |
|
5233 +userforward: |
|
5234 + driver = redirect |
|
5235 + check_local_user |
|
5236 +# local_part_suffix = +* : -* |
|
5237 +# local_part_suffix_optional |
|
5238 + file = $home/.forward |
|
5239 +# allow_filter |
|
5240 + no_verify |
|
5241 + no_expn |
|
5242 + check_ancestor |
|
5243 + file_transport = address_file |
|
5244 + pipe_transport = address_pipe |
|
5245 + reply_transport = address_reply |
|
5246 + |
|
5247 +This is the most complicated router in the default configuration. It is another |
|
5248 +redirection router, but this time it is looking for forwarding data set up by |
|
5249 +individual users. The check_local_user setting specifies a check that the local |
|
5250 +part of the address is the login name of a local user. If it is not, the router |
|
5251 +is skipped. The two commented options that follow check_local_user, namely: |
|
5252 + |
|
5253 +# local_part_suffix = +* : -* |
|
5254 +# local_part_suffix_optional |
|
5255 + |
|
5256 +show how you can specify the recognition of local part suffixes. If the first |
|
5257 +is uncommented, a suffix beginning with either a plus or a minus sign, followed |
|
5258 +by any sequence of characters, is removed from the local part and placed in the |
|
5259 +variable $local_part_suffix. The second suffix option specifies that the |
|
5260 +presence of a suffix in the local part is optional. When a suffix is present, |
|
5261 +the check for a local login uses the local part with the suffix removed. |
|
5262 + |
|
5263 +When a local user account is found, the file called .forward in the user's home |
|
5264 +directory is consulted. If it does not exist, or is empty, the router declines. |
|
5265 +Otherwise, the contents of .forward are interpreted as redirection data (see |
|
5266 +chapter 22 for more details). |
|
5267 + |
|
5268 +Traditional .forward files contain just a list of addresses, pipes, or files. |
|
5269 +Exim supports this by default. However, if allow_filter is set (it is commented |
|
5270 +out by default), the contents of the file are interpreted as a set of Exim or |
|
5271 +Sieve filtering instructions, provided the file begins with "#Exim filter" or " |
|
5272 +#Sieve filter", respectively. User filtering is discussed in the separate |
|
5273 +document entitled Exim's interfaces to mail filtering. |
|
5274 + |
|
5275 +The no_verify and no_expn options mean that this router is skipped when |
|
5276 +verifying addresses, or when running as a consequence of an SMTP EXPN command. |
|
5277 +There are two reasons for doing this: |
|
5278 + |
|
5279 + 1. Whether or not a local user has a .forward file is not really relevant when |
|
5280 + checking an address for validity; it makes sense not to waste resources |
|
5281 + doing unnecessary work. |
|
5282 + |
|
5283 + 2. More importantly, when Exim is verifying addresses or handling an EXPN |
|
5284 + command during an SMTP session, it is running as the Exim user, not as |
|
5285 + root. The group is the Exim group, and no additional groups are set up. It |
|
5286 + may therefore not be possible for Exim to read users' .forward files at |
|
5287 + this time. |
|
5288 + |
|
5289 +The setting of check_ancestor prevents the router from generating a new address |
|
5290 +that is the same as any previous address that was redirected. (This works round |
|
5291 +a problem concerning a bad interaction between aliasing and forwarding - see |
|
5292 +section 22.5). |
|
5293 + |
|
5294 +The final three option settings specify the transports that are to be used when |
|
5295 +forwarding generates a direct delivery to a file, or to a pipe, or sets up an |
|
5296 +auto-reply, respectively. For example, if a .forward file contains |
|
5297 + |
|
5298 +a.nother@elsewhere.example, /home/spqr/archive |
|
5299 + |
|
5300 +the delivery to /home/spqr/archive is done by running the address_file |
|
5301 +transport. |
|
5302 + |
|
5303 +localuser: |
|
5304 + driver = accept |
|
5305 + check_local_user |
|
5306 +# local_part_suffix = +* : -* |
|
5307 +# local_part_suffix_optional |
|
5308 + transport = local_delivery |
|
5309 + |
|
5310 +The final router sets up delivery into local mailboxes, provided that the local |
|
5311 +part is the name of a local login, by accepting the address and assigning it to |
|
5312 +the local_delivery transport. Otherwise, we have reached the end of the |
|
5313 +routers, so the address is bounced. The commented suffix settings fulfil the |
|
5314 +same purpose as they do for the userforward router. |
|
5315 + |
|
5316 +7.4Â Transport configuration |
|
5317 + |
|
5318 +Transports define mechanisms for actually delivering messages. They operate |
|
5319 +only when referenced from routers, so the order in which they are defined does |
|
5320 +not matter. The transports section of the configuration starts with |
|
5321 + |
|
5322 +begin transports |
|
5323 + |
|
5324 +One remote transport and four local transports are defined. |
|
5325 + |
|
5326 +remote_smtp: |
|
5327 + driver = smtp |
|
5328 + |
|
5329 +This transport is used for delivering messages over SMTP connections. All its |
|
5330 +options are defaulted. The list of remote hosts comes from the router. |
|
5331 + |
|
5332 +local_delivery: |
|
5333 + driver = appendfile |
|
5334 + file = /var/mail/$local_part |
|
5335 + delivery_date_add |
|
5336 + envelope_to_add |
|
5337 + return_path_add |
|
5338 +# group = mail |
|
5339 +# mode = 0660 |
|
5340 + |
|
5341 +This appendfile transport is used for local delivery to user mailboxes in |
|
5342 +traditional BSD mailbox format. By default it runs under the uid and gid of the |
|
5343 +local user, which requires the sticky bit to be set on the /var/mail directory. |
|
5344 +Some systems use the alternative approach of running mail deliveries under a |
|
5345 +particular group instead of using the sticky bit. The commented options show |
|
5346 +how this can be done. |
|
5347 + |
|
5348 +Exim adds three headers to the message as it delivers it: Delivery-date:, |
|
5349 +Envelope-to: and Return-path:. This action is requested by the three |
|
5350 +similarly-named options above. |
|
5351 + |
|
5352 +address_pipe: |
|
5353 + driver = pipe |
|
5354 + return_output |
|
5355 + |
|
5356 +This transport is used for handling deliveries to pipes that are generated by |
|
5357 +redirection (aliasing or users' .forward files). The return_output option |
|
5358 +specifies that any output generated by the pipe is to be returned to the |
|
5359 +sender. |
|
5360 + |
|
5361 +address_file: |
|
5362 + driver = appendfile |
|
5363 + delivery_date_add |
|
5364 + envelope_to_add |
|
5365 + return_path_add |
|
5366 + |
|
5367 +This transport is used for handling deliveries to files that are generated by |
|
5368 +redirection. The name of the file is not specified in this instance of |
|
5369 +appendfile, because it comes from the redirect router. |
|
5370 + |
|
5371 +address_reply: |
|
5372 + driver = autoreply |
|
5373 + |
|
5374 +This transport is used for handling automatic replies generated by users' |
|
5375 +filter files. |
|
5376 + |
|
5377 +7.5Â Default retry rule |
|
5378 + |
|
5379 +The retry section of the configuration file contains rules which affect the way |
|
5380 +Exim retries deliveries that cannot be completed at the first attempt. It is |
|
5381 +introduced by the line |
|
5382 + |
|
5383 +begin retry |
|
5384 + |
|
5385 +In the default configuration, there is just one rule, which applies to all |
|
5386 +errors: |
|
5387 + |
|
5388 +* * F,2h,15m; G,16h,1h,1.5; F,4d,6h |
|
5389 + |
|
5390 +This causes any temporarily failing address to be retried every 15 minutes for |
|
5391 +2 hours, then at intervals starting at one hour and increasing by a factor of |
|
5392 +1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address |
|
5393 +is not delivered after 4 days of temporary failure, it is bounced. |
|
5394 + |
|
5395 +If the retry section is removed from the configuration, or is empty (that is, |
|
5396 +if no retry rules are defined), Exim will not retry deliveries. This turns |
|
5397 +temporary errors into permanent errors. |
|
5398 + |
|
5399 +7.6Â Rewriting configuration |
|
5400 + |
|
5401 +The rewriting section of the configuration, introduced by |
|
5402 + |
|
5403 +begin rewrite |
|
5404 + |
|
5405 +contains rules for rewriting addresses in messages as they arrive. There are no |
|
5406 +rewriting rules in the default configuration file. |
|
5407 + |
|
5408 +7.7Â Authenticators configuration |
|
5409 + |
|
5410 +The authenticators section of the configuration, introduced by |
|
5411 + |
|
5412 +begin authenticators |
|
5413 + |
|
5414 +defines mechanisms for the use of the SMTP AUTH command. The default |
|
5415 +configuration file contains two commented-out example authenticators which |
|
5416 +support plaintext username/password authentication using the standard PLAIN |
|
5417 +mechanism and the traditional but non-standard LOGIN mechanism, with Exim |
|
5418 +acting as the server. PLAIN and LOGIN are enough to support most MUA software. |
|
5419 + |
|
5420 +The example PLAIN authenticator looks like this: |
|
5421 + |
|
5422 +#PLAIN: |
|
5423 +# driver = plaintext |
|
5424 +# server_set_id = $auth2 |
|
5425 +# server_prompts = : |
|
5426 +# server_condition = Authentication is not yet configured |
|
5427 +# server_advertise_condition = ${if def:tls_cipher } |
|
5428 + |
|
5429 +And the example LOGIN authenticator looks like this: |
|
5430 + |
|
5431 +#LOGIN: |
|
5432 +# driver = plaintext |
|
5433 +# server_set_id = $auth1 |
|
5434 +# server_prompts = <| Username: | Password: |
|
5435 +# server_condition = Authentication is not yet configured |
|
5436 +# server_advertise_condition = ${if def:tls_cipher } |
|
5437 + |
|
5438 +The server_set_id option makes Exim remember the authenticated username in |
|
5439 +$authenticated_id, which can be used later in ACLs or routers. The |
|
5440 +server_prompts option configures the plaintext authenticator so that it |
|
5441 +implements the details of the specific authentication mechanism, i.e. PLAIN or |
|
5442 +LOGIN. The server_advertise_condition setting controls when Exim offers |
|
5443 +authentication to clients; in the examples, this is only when TLS or SSL has |
|
5444 +been started, so to enable the authenticators you also need to add support for |
|
5445 +TLS as described in 7.1. |
|
5446 + |
|
5447 +The server_condition setting defines how to verify that the username and |
|
5448 +password are correct. In the examples it just produces an error message. To |
|
5449 +make the authenticators work, you can use a string expansion expression like |
|
5450 +one of the examples in 34. |
|
5451 + |
|
5452 +Beware that the sequence of the parameters to PLAIN and LOGIN differ; the |
|
5453 +usercode and password are in different positions. 34 covers both. |
|
5454 + |
|
5455 +8. Regular expressions |
|
5456 + |
|
5457 +Exim supports the use of regular expressions in many of its options. It uses |
|
5458 +the PCRE regular expression library; this provides regular expression matching |
|
5459 +that is compatible with Perl 5. The syntax and semantics of regular expressions |
|
5460 +is discussed in many Perl reference books, and also in Jeffrey Friedl's |
|
5461 +Mastering Regular Expressions, which is published by O'Reilly (see http:// |
|
5462 +www.oreilly.com/catalog/regex2/). |
|
5463 + |
|
5464 +The documentation for the syntax and semantics of the regular expressions that |
|
5465 +are supported by PCRE is included in the PCRE distribution, and no further |
|
5466 +description is included here. The PCRE functions are called from Exim using the |
|
5467 +default option settings (that is, with no PCRE options set), except that the |
|
5468 +PCRE_CASELESS option is set when the matching is required to be |
|
5469 +case-insensitive. |
|
5470 + |
|
5471 +In most cases, when a regular expression is required in an Exim configuration, |
|
5472 +it has to start with a circumflex, in order to distinguish it from plain text |
|
5473 +or an "ends with" wildcard. In this example of a configuration setting, the |
|
5474 +second item in the colon-separated list is a regular expression. |
|
5475 + |
|
5476 +domains = a.b.c : ^\\d{3} : *.y.z : ... |
|
5477 + |
|
5478 +The doubling of the backslash is required because of string expansion that |
|
5479 +precedes interpretation - see section 11.1 for more discussion of this issue, |
|
5480 +and a way of avoiding the need for doubling backslashes. The regular expression |
|
5481 +that is eventually used in this example contains just one backslash. The |
|
5482 +circumflex is included in the regular expression, and has the normal effect of |
|
5483 +"anchoring" it to the start of the string that is being matched. |
|
5484 + |
|
5485 +There are, however, two cases where a circumflex is not required for the |
|
5486 +recognition of a regular expression: these are the match condition in a string |
|
5487 +expansion, and the matches condition in an Exim filter file. In these cases, |
|
5488 +the relevant string is always treated as a regular expression; if it does not |
|
5489 +start with a circumflex, the expression is not anchored, and can match anywhere |
|
5490 +in the subject string. |
|
5491 + |
|
5492 +In all cases, if you want a regular expression to match at the end of a string, |
|
5493 +you must code the $ metacharacter to indicate this. For example: |
|
5494 + |
|
5495 +domains = ^\\d{3}\\.example |
|
5496 + |
|
5497 +matches the domain 123.example, but it also matches 123.example.com. You need |
|
5498 +to use: |
|
5499 + |
|
5500 +domains = ^\\d{3}\\.example\$ |
|
5501 + |
|
5502 +if you want example to be the top-level domain. The backslash before the $ is |
|
5503 +needed because string expansion also interprets dollar characters. |
|
5504 + |
|
5505 +9. File and database lookups |
|
5506 + |
|
5507 +Exim can be configured to look up data in files or databases as it processes |
|
5508 +messages. Two different kinds of syntax are used: |
|
5509 + |
|
5510 + 1. A string that is to be expanded may contain explicit lookup requests. These |
|
5511 + cause parts of the string to be replaced by data that is obtained from the |
|
5512 + lookup. Lookups of this type are conditional expansion items. Different |
|
5513 + results can be defined for the cases of lookup success and failure. See |
|
5514 + chapter 11, where string expansions are described in detail. |
|
5515 + |
|
5516 + 2. Lists of domains, hosts, and email addresses can contain lookup requests as |
|
5517 + a way of avoiding excessively long linear lists. In this case, the data |
|
5518 + that is returned by the lookup is often (but not always) discarded; whether |
|
5519 + the lookup succeeds or fails is what really counts. These kinds of list are |
|
5520 + described in chapter 10. |
|
5521 + |
|
5522 +String expansions, lists, and lookups interact with each other in such a way |
|
5523 +that there is no order in which to describe any one of them that does not |
|
5524 +involve references to the others. Each of these three chapters makes more sense |
|
5525 +if you have read the other two first. If you are reading this for the first |
|
5526 +time, be aware that some of it will make a lot more sense after you have read |
|
5527 +chapters 10 and 11. |
|
5528 + |
|
5529 +9.1Â Examples of different lookup syntax |
|
5530 + |
|
5531 +It is easy to confuse the two different kinds of lookup, especially as the |
|
5532 +lists that may contain the second kind are always expanded before being |
|
5533 +processed as lists. Therefore, they may also contain lookups of the first kind. |
|
5534 +Be careful to distinguish between the following two examples: |
|
5535 + |
|
5536 +domains = ${lookup{$sender_host_address}lsearch{/some/file}} |
|
5537 +domains = lsearch;/some/file |
|
5538 + |
|
5539 +The first uses a string expansion, the result of which must be a domain list. |
|
5540 +No strings have been specified for a successful or a failing lookup; the |
|
5541 +defaults in this case are the looked-up data and an empty string, respectively. |
|
5542 +The expansion takes place before the string is processed as a list, and the |
|
5543 +file that is searched could contain lines like this: |
|
5544 + |
|
5545 +192.168.3.4: domain1:domain2:... |
|
5546 +192.168.1.9: domain3:domain4:... |
|
5547 + |
|
5548 +When the lookup succeeds, the result of the expansion is a list of domains (and |
|
5549 +possibly other types of item that are allowed in domain lists). |
|
5550 + |
|
5551 +In the second example, the lookup is a single item in a domain list. It causes |
|
5552 +Exim to use a lookup to see if the domain that is being processed can be found |
|
5553 +in the file. The file could contains lines like this: |
|
5554 + |
|
5555 +domain1: |
|
5556 +domain2: |
|
5557 + |
|
5558 +Any data that follows the keys is not relevant when checking that the domain |
|
5559 +matches the list item. |
|
5560 + |
|
5561 +It is possible, though no doubt confusing, to use both kinds of lookup at once. |
|
5562 +Consider a file containing lines like this: |
|
5563 + |
|
5564 +192.168.5.6: lsearch;/another/file |
|
5565 + |
|
5566 +If the value of $sender_host_address is 192.168.5.6, expansion of the first |
|
5567 +domains setting above generates the second setting, which therefore causes a |
|
5568 +second lookup to occur. |
|
5569 + |
|
5570 +The rest of this chapter describes the different lookup types that are |
|
5571 +available. Any of them can be used in any part of the configuration where a |
|
5572 +lookup is permitted. |
|
5573 + |
|
5574 +9.2Â Lookup types |
|
5575 + |
|
5576 +Two different types of data lookup are implemented: |
|
5577 + |
|
5578 + * The single-key type requires the specification of a file in which to look, |
|
5579 + and a single key to search for. The key must be a non-empty string for the |
|
5580 + lookup to succeed. The lookup type determines how the file is searched. |
|
5581 + |
|
5582 + * The query-style type accepts a generalized database query. No particular |
|
5583 + key value is assumed by Exim for query-style lookups. You can use whichever |
|
5584 + Exim variables you need to construct the database query. |
|
5585 + |
|
5586 +The code for each lookup type is in a separate source file that is included in |
|
5587 +the binary of Exim only if the corresponding compile-time option is set. The |
|
5588 +default settings in src/EDITME are: |
|
5589 + |
|
5590 +LOOKUP_DBM=yes |
|
5591 +LOOKUP_LSEARCH=yes |
|
5592 + |
|
5593 +which means that only linear searching and DBM lookups are included by default. |
|
5594 +For some types of lookup (e.g. SQL databases), you need to install appropriate |
|
5595 +libraries and header files before building Exim. |
|
5596 + |
|
5597 +9.3Â Single-key lookup types |
|
5598 + |
|
5599 +The following single-key lookup types are implemented: |
|
5600 + |
|
5601 + * cdb: The given file is searched as a Constant DataBase file, using the key |
|
5602 + string without a terminating binary zero. The cdb format is designed for |
|
5603 + indexed files that are read frequently and never updated, except by total |
|
5604 + re-creation. As such, it is particularly suitable for large files |
|
5605 + containing aliases or other indexed data referenced by an MTA. Information |
|
5606 + about cdb can be found in several places: |
|
5607 + |
|
5608 + http://www.pobox.com/~djb/cdb.html |
|
5609 + ftp://ftp.corpit.ru/pub/tinycdb/ |
|
5610 + http://packages.debian.org/stable/utils/freecdb.html |
|
5611 + |
|
5612 + A cdb distribution is not needed in order to build Exim with cdb support, |
|
5613 + because the code for reading cdb files is included directly in Exim itself. |
|
5614 + However, no means of building or testing cdb files is provided with Exim, |
|
5615 + so you need to obtain a cdb distribution in order to do this. |
|
5616 + |
|
5617 + * dbm: Calls to DBM library functions are used to extract data from the given |
|
5618 + DBM file by looking up the record with the given key. A terminating binary |
|
5619 + zero is included in the key that is passed to the DBM library. See section |
|
5620 + 4.4 for a discussion of DBM libraries. |
|
5621 + |
|
5622 + For all versions of Berkeley DB, Exim uses the DB_HASH style of database |
|
5623 + when building DBM files using the exim_dbmbuild utility. However, when |
|
5624 + using Berkeley DB versions 3 or 4, it opens existing databases for reading |
|
5625 + with the DB_UNKNOWN option. This enables it to handle any of the types of |
|
5626 + database that the library supports, and can be useful for accessing DBM |
|
5627 + files created by other applications. (For earlier DB versions, DB_HASH is |
|
5628 + always used.) |
|
5629 + |
|
5630 + * dbmnz: This is the same as dbm, except that a terminating binary zero is |
|
5631 + not included in the key that is passed to the DBM library. You may need |
|
5632 + this if you want to look up data in files that are created by or shared |
|
5633 + with some other application that does not use terminating zeros. For |
|
5634 + example, you need to use dbmnz rather than dbm if you want to authenticate |
|
5635 + incoming SMTP calls using the passwords from Courier's /etc/ |
|
5636 + userdbshadow.dat file. Exim's utility program for creating DBM files ( |
|
5637 + exim_dbmbuild) includes the zeros by default, but has an option to omit |
|
5638 + them (see section 50.9). |
|
5639 + |
|
5640 + * dsearch: The given file must be a directory; this is searched for an entry |
|
5641 + whose name is the key by calling the lstat() function. The key may not |
|
5642 + contain any forward slash characters. If lstat() succeeds, the result of |
|
5643 + the lookup is the name of the entry, which may be a file, directory, |
|
5644 + symbolic link, or any other kind of directory entry. An example of how this |
|
5645 + lookup can be used to support virtual domains is given in section 47.7. |
|
5646 + |
|
5647 + * iplsearch: The given file is a text file containing keys and data. A key is |
|
5648 + terminated by a colon or white space or the end of the line. The keys in |
|
5649 + the file must be IP addresses, or IP addresses with CIDR masks. Keys that |
|
5650 + involve IPv6 addresses must be enclosed in quotes to prevent the first |
|
5651 + internal colon being interpreted as a key terminator. For example: |
|
5652 + |
|
5653 + 1.2.3.4: data for 1.2.3.4 |
|
5654 + 192.168.0.0/16: data for 192.168.0.0/16 |
|
5655 + "abcd::cdab": data for abcd::cdab |
|
5656 + "abcd:abcd::/32" data for abcd:abcd::/32 |
|
5657 + |
|
5658 + The key for an iplsearch lookup must be an IP address (without a mask). The |
|
5659 + file is searched linearly, using the CIDR masks where present, until a |
|
5660 + matching key is found. The first key that matches is used; there is no |
|
5661 + attempt to find a "best" match. Apart from the way the keys are matched, |
|
5662 + the processing for iplsearch is the same as for lsearch. |
|
5663 + |
|
5664 + Warning 1: Unlike most other single-key lookup types, a file of data for |
|
5665 + iplsearch can not be turned into a DBM or cdb file, because those lookup |
|
5666 + types support only literal keys. |
|
5667 + |
|
5668 + Warning 2: In a host list, you must always use net-iplsearch so that the |
|
5669 + implicit key is the host's IP address rather than its name (see section |
|
5670 + 10.12). |
|
5671 + |
|
5672 + * lsearch: The given file is a text file that is searched linearly for a line |
|
5673 + beginning with the search key, terminated by a colon or white space or the |
|
5674 + end of the line. The search is case-insensitive; that is, upper and lower |
|
5675 + case letters are treated as the same. The first occurrence of the key that |
|
5676 + is found in the file is used. |
|
5677 + |
|
5678 + White space between the key and the colon is permitted. The remainder of |
|
5679 + the line, with leading and trailing white space removed, is the data. This |
|
5680 + can be continued onto subsequent lines by starting them with any amount of |
|
5681 + white space, but only a single space character is included in the data at |
|
5682 + such a junction. If the data begins with a colon, the key must be |
|
5683 + terminated by a colon, for example: |
|
5684 + |
|
5685 + baduser: :fail: |
|
5686 + |
|
5687 + Empty lines and lines beginning with # are ignored, even if they occur in |
|
5688 + the middle of an item. This is the traditional textual format of alias |
|
5689 + files. Note that the keys in an lsearch file are literal strings. There is |
|
5690 + no wildcarding of any kind. |
|
5691 + |
|
5692 + In most lsearch files, keys are not required to contain colons or # |
|
5693 + characters, or white space. However, if you need this feature, it is |
|
5694 + available. If a key begins with a doublequote character, it is terminated |
|
5695 + only by a matching quote (or end of line), and the normal escaping rules |
|
5696 + apply to its contents (see section 6.16). An optional colon is permitted |
|
5697 + after quoted keys (exactly as for unquoted keys). There is no special |
|
5698 + handling of quotes for the data part of an lsearch line. |
|
5699 + |
|
5700 + * nis: The given file is the name of a NIS map, and a NIS lookup is done with |
|
5701 + the given key, without a terminating binary zero. There is a variant called |
|
5702 + nis0 which does include the terminating binary zero in the key. This is |
|
5703 + reportedly needed for Sun-style alias files. Exim does not recognize NIS |
|
5704 + aliases; the full map names must be used. |
|
5705 + |
|
5706 + * wildlsearch or nwildlsearch: These search a file linearly, like lsearch, |
|
5707 + but instead of being interpreted as a literal string, each key in the file |
|
5708 + may be wildcarded. The difference between these two lookup types is that |
|
5709 + for wildlsearch, each key in the file is string-expanded before being used, |
|
5710 + whereas for nwildlsearch, no expansion takes place. |
|
5711 + |
|
5712 + Like lsearch, the testing is done case-insensitively. However, keys in the |
|
5713 + file that are regular expressions can be made case-sensitive by the use of |
|
5714 + "(-i)" within the pattern. The following forms of wildcard are recognized: |
|
5715 + |
|
5716 + 1. The string may begin with an asterisk to mean "ends with". For example: |
|
5717 + |
|
5718 + *.a.b.c data for anything.a.b.c |
|
5719 + *fish data for anythingfish |
|
5720 + |
|
5721 + 2. The string may begin with a circumflex to indicate a regular |
|
5722 + expression. For example, for wildlsearch: |
|
5723 + |
|
5724 + ^\N\d+\.a\.b\N data for <digits>.a.b |
|
5725 + |
|
5726 + Note the use of "\N" to disable expansion of the contents of the |
|
5727 + regular expression. If you are using nwildlsearch, where the keys are |
|
5728 + not string-expanded, the equivalent entry is: |
|
5729 + |
|
5730 + ^\d+\.a\.b data for <digits>.a.b |
|
5731 + |
|
5732 + The case-insensitive flag is set at the start of compiling the regular |
|
5733 + expression, but it can be turned off by using "(-i)" at an appropriate |
|
5734 + point. For example, to make the entire pattern case-sensitive: |
|
5735 + |
|
5736 + ^(?-i)\d+\.a\.b data for <digits>.a.b |
|
5737 + |
|
5738 + If the regular expression contains white space or colon characters, you |
|
5739 + must either quote it (see lsearch above), or represent these characters |
|
5740 + in other ways. For example, "\s" can be used for white space and "\x3A" |
|
5741 + for a colon. This may be easier than quoting, because if you quote, you |
|
5742 + have to escape all the backslashes inside the quotes. |
|
5743 + |
|
5744 + Note: It is not possible to capture substrings in a regular expression |
|
5745 + match for later use, because the results of all lookups are cached. If |
|
5746 + a lookup is repeated, the result is taken from the cache, and no actual |
|
5747 + pattern matching takes place. The values of all the numeric variables |
|
5748 + are unset after a (n)wildlsearch match. |
|
5749 + |
|
5750 + 3. Although I cannot see it being of much use, the general matching |
|
5751 + function that is used to implement (n)wildlsearch means that the string |
|
5752 + may begin with a lookup name terminated by a semicolon, and followed by |
|
5753 + lookup data. For example: |
|
5754 + |
|
5755 + cdb;/some/file data for keys that match the file |
|
5756 + |
|
5757 + The data that is obtained from the nested lookup is discarded. |
|
5758 + |
|
5759 + Keys that do not match any of these patterns are interpreted literally. The |
|
5760 + continuation rules for the data are the same as for lsearch, and keys may |
|
5761 + be followed by optional colons. |
|
5762 + |
|
5763 + Warning: Unlike most other single-key lookup types, a file of data for (n) |
|
5764 + wildlsearch can not be turned into a DBM or cdb file, because those lookup |
|
5765 + types support only literal keys. |
|
5766 + |
|
5767 +9.4Â Query-style lookup types |
|
5768 + |
|
5769 +The supported query-style lookup types are listed below. Further details about |
|
5770 +many of them are given in later sections. |
|
5771 + |
|
5772 + * dnsdb: This does a DNS search for one or more records whose domain names |
|
5773 + are given in the supplied query. The resulting data is the contents of the |
|
5774 + records. See section 9.10. |
|
5775 + |
|
5776 + * ibase: This does a lookup in an InterBase database. |
|
5777 + |
|
5778 + * ldap: This does an LDAP lookup using a query in the form of a URL, and |
|
5779 + returns attributes from a single entry. There is a variant called ldapm |
|
5780 + that permits values from multiple entries to be returned. A third variant |
|
5781 + called ldapdn returns the Distinguished Name of a single entry instead of |
|
5782 + any attribute values. See section 9.13. |
|
5783 + |
|
5784 + * mysql: The format of the query is an SQL statement that is passed to a |
|
5785 + MySQL database. See section 9.20. |
|
5786 + |
|
5787 + * nisplus: This does a NIS+ lookup using a query that can specify the name of |
|
5788 + the field to be returned. See section 9.19. |
|
5789 + |
|
5790 + * oracle: The format of the query is an SQL statement that is passed to an |
|
5791 + Oracle database. See section 9.20. |
|
5792 + |
|
5793 + * passwd is a query-style lookup with queries that are just user names. The |
|
5794 + lookup calls getpwnam() to interrogate the system password data, and on |
|
5795 + success, the result string is the same as you would get from an lsearch |
|
5796 + lookup on a traditional /etc/passwd file, though with "*" for the password |
|
5797 + value. For example: |
|
5798 + |
|
5799 + *:42:42:King Rat:/home/kr:/bin/bash |
|
5800 + |
|
5801 + * pgsql: The format of the query is an SQL statement that is passed to a |
|
5802 + PostgreSQL database. See section 9.20. |
|
5803 + |
|
5804 + * sqlite: The format of the query is a file name followed by an SQL statement |
|
5805 + that is passed to an SQLite database. See section 9.25. |
|
5806 + |
|
5807 + * testdb: This is a lookup type that is used for testing Exim. It is not |
|
5808 + likely to be useful in normal operation. |
|
5809 + |
|
5810 + * whoson: Whoson (http://whoson.sourceforge.net) is a protocol that allows a |
|
5811 + server to check whether a particular (dynamically allocated) IP address is |
|
5812 + currently allocated to a known (trusted) user and, optionally, to obtain |
|
5813 + the identity of the said user. For SMTP servers, Whoson was popular at one |
|
5814 + time for "POP before SMTP" authentication, but that approach has been |
|
5815 + superseded by SMTP authentication. In Exim, Whoson can be used to implement |
|
5816 + "POP before SMTP" checking using ACL statements such as |
|
5817 + |
|
5818 + require condition = \ |
|
5819 + ${lookup whoson {$sender_host_address}{yes}{no}} |
|
5820 + |
|
5821 + The query consists of a single IP address. The value returned is the name |
|
5822 + of the authenticated user, which is stored in the variable $value. However, |
|
5823 + in this example, the data in $value is not used; the result of the lookup |
|
5824 + is one of the fixed strings "yes" or "no". |
|
5825 + |
|
5826 +9.5Â Temporary errors in lookups |
|
5827 + |
|
5828 +Lookup functions can return temporary error codes if the lookup cannot be |
|
5829 +completed. For example, an SQL or LDAP database might be unavailable. For this |
|
5830 +reason, it is not advisable to use a lookup that might do this for critical |
|
5831 +options such as a list of local domains. |
|
5832 + |
|
5833 +When a lookup cannot be completed in a router or transport, delivery of the |
|
5834 +message (to the relevant address) is deferred, as for any other temporary |
|
5835 +error. In other circumstances Exim may assume the lookup has failed, or may |
|
5836 +give up altogether. |
|
5837 + |
|
5838 +9.6Â Default values in single-key lookups |
|
5839 + |
|
5840 +In this context, a "default value" is a value specified by the administrator |
|
5841 +that is to be used if a lookup fails. |
|
5842 + |
|
5843 +Note: This section applies only to single-key lookups. For query-style lookups, |
|
5844 +the facilities of the query language must be used. An attempt to specify a |
|
5845 +default for a query-style lookup provokes an error. |
|
5846 + |
|
5847 +If "*" is added to a single-key lookup type (for example, lsearch*) and the |
|
5848 +initial lookup fails, the key "*" is looked up in the file to provide a default |
|
5849 +value. See also the section on partial matching below. |
|
5850 + |
|
5851 +Alternatively, if "*@" is added to a single-key lookup type (for example dbm*@) |
|
5852 +then, if the initial lookup fails and the key contains an @ character, a second |
|
5853 +lookup is done with everything before the last @ replaced by *. This makes it |
|
5854 +possible to provide per-domain defaults in alias files that include the domains |
|
5855 +in the keys. If the second lookup fails (or doesn't take place because there is |
|
5856 +no @ in the key), "*" is looked up. For example, a redirect router might |
|
5857 +contain: |
|
5858 + |
|
5859 +data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}} |
|
5860 + |
|
5861 +Suppose the address that is being processed is jane@eyre.example. Exim looks up |
|
5862 +these keys, in this order: |
|
5863 + |
|
5864 +jane@eyre.example |
|
5865 +*@eyre.example |
|
5866 +* |
|
5867 + |
|
5868 +The data is taken from whichever key it finds first. Note: In an lsearch file, |
|
5869 +this does not mean the first of these keys in the file. A complete scan is done |
|
5870 +for each key, and only if it is not found at all does Exim move on to try the |
|
5871 +next key. |
|
5872 + |
|
5873 +9.7Â Partial matching in single-key lookups |
|
5874 + |
|
5875 +The normal operation of a single-key lookup is to search the file for an exact |
|
5876 +match with the given key. However, in a number of situations where domains are |
|
5877 +being looked up, it is useful to be able to do partial matching. In this case, |
|
5878 +information in the file that has a key starting with "*." is matched by any |
|
5879 +domain that ends with the components that follow the full stop. For example, if |
|
5880 +a key in a DBM file is |
|
5881 + |
|
5882 +*.dates.fict.example |
|
5883 + |
|
5884 +then when partial matching is enabled this is matched by (amongst others) |
|
5885 +2001.dates.fict.example and 1984.dates.fict.example. It is also matched by |
|
5886 +dates.fict.example, if that does not appear as a separate key in the file. |
|
5887 + |
|
5888 +Note: Partial matching is not available for query-style lookups. It is also not |
|
5889 +available for any lookup items in address lists (see section 10.19). |
|
5890 + |
|
5891 +Partial matching is implemented by doing a series of separate lookups using |
|
5892 +keys constructed by modifying the original subject key. This means that it can |
|
5893 +be used with any of the single-key lookup types, provided that partial matching |
|
5894 +keys beginning with a special prefix (default "*.") are included in the data |
|
5895 +file. Keys in the file that do not begin with the prefix are matched only by |
|
5896 +unmodified subject keys when partial matching is in use. |
|
5897 + |
|
5898 +Partial matching is requested by adding the string "partial-" to the front of |
|
5899 +the name of a single-key lookup type, for example, partial-dbm. When this is |
|
5900 +done, the subject key is first looked up unmodified; if that fails, "*." is |
|
5901 +added at the start of the subject key, and it is looked up again. If that |
|
5902 +fails, further lookups are tried with dot-separated components removed from the |
|
5903 +start of the subject key, one-by-one, and "*." added on the front of what |
|
5904 +remains. |
|
5905 + |
|
5906 +A minimum number of two non-* components are required. This can be adjusted by |
|
5907 +including a number before the hyphen in the search type. For example, |
|
5908 +partial3-lsearch specifies a minimum of three non-* components in the modified |
|
5909 +keys. Omitting the number is equivalent to "partial2-". If the subject key is |
|
5910 +2250.dates.fict.example then the following keys are looked up when the minimum |
|
5911 +number of non-* components is two: |
|
5912 + |
|
5913 +2250.dates.fict.example |
|
5914 +*.2250.dates.fict.example |
|
5915 +*.dates.fict.example |
|
5916 +*.fict.example |
|
5917 + |
|
5918 +As soon as one key in the sequence is successfully looked up, the lookup |
|
5919 +finishes. |
|
5920 + |
|
5921 +The use of "*." as the partial matching prefix is a default that can be |
|
5922 +changed. The motivation for this feature is to allow Exim to operate with file |
|
5923 +formats that are used by other MTAs. A different prefix can be supplied in |
|
5924 +parentheses instead of the hyphen after "partial". For example: |
|
5925 + |
|
5926 +domains = partial(.)lsearch;/some/file |
|
5927 + |
|
5928 +In this example, if the domain is a.b.c, the sequence of lookups is "a.b.c", |
|
5929 +".a.b.c", and ".b.c" (the default minimum of 2 non-wild components is |
|
5930 +unchanged). The prefix may consist of any punctuation characters other than a |
|
5931 +closing parenthesis. It may be empty, for example: |
|
5932 + |
|
5933 +domains = partial1()cdb;/some/file |
|
5934 + |
|
5935 +For this example, if the domain is a.b.c, the sequence of lookups is "a.b.c", |
|
5936 +"b.c", and "c". |
|
5937 + |
|
5938 +If "partial0" is specified, what happens at the end (when the lookup with just |
|
5939 +one non-wild component has failed, and the original key is shortened right down |
|
5940 +to the null string) depends on the prefix: |
|
5941 + |
|
5942 + * If the prefix has zero length, the whole lookup fails. |
|
5943 + |
|
5944 + * If the prefix has length 1, a lookup for just the prefix is done. For |
|
5945 + example, the final lookup for "partial0(.)" is for "." alone. |
|
5946 + |
|
5947 + * Otherwise, if the prefix ends in a dot, the dot is removed, and the |
|
5948 + remainder is looked up. With the default prefix, therefore, the final |
|
5949 + lookup is for "*" on its own. |
|
5950 + |
|
5951 + * Otherwise, the whole prefix is looked up. |
|
5952 + |
|
5953 +If the search type ends in "*" or "*@" (see section 9.6 above), the search for |
|
5954 +an ultimate default that this implies happens after all partial lookups have |
|
5955 +failed. If "partial0" is specified, adding "*" to the search type has no effect |
|
5956 +with the default prefix, because the "*" key is already included in the |
|
5957 +sequence of partial lookups. However, there might be a use for lookup types |
|
5958 +such as "partial0(.)lsearch*". |
|
5959 + |
|
5960 +The use of "*" in lookup partial matching differs from its use as a wildcard in |
|
5961 +domain lists and the like. Partial matching works only in terms of |
|
5962 +dot-separated components; a key such as "*fict.example" in a database file is |
|
5963 +useless, because the asterisk in a partial matching subject key is always |
|
5964 +followed by a dot. |
|
5965 + |
|
5966 +9.8Â Lookup caching |
|
5967 + |
|
5968 +Exim caches all lookup results in order to avoid needless repetition of |
|
5969 +lookups. However, because (apart from the daemon) Exim operates as a collection |
|
5970 +of independent, short-lived processes, this caching applies only within a |
|
5971 +single Exim process. There is no inter-process lookup caching facility. |
|
5972 + |
|
5973 +For single-key lookups, Exim keeps the relevant files open in case there is |
|
5974 +another lookup that needs them. In some types of configuration this can lead to |
|
5975 +many files being kept open for messages with many recipients. To avoid hitting |
|
5976 +the operating system limit on the number of simultaneously open files, Exim |
|
5977 +closes the least recently used file when it needs to open more files than its |
|
5978 +own internal limit, which can be changed via the lookup_open_max option. |
|
5979 + |
|
5980 +The single-key lookup files are closed and the lookup caches are flushed at |
|
5981 +strategic points during delivery - for example, after all routing is complete. |
|
5982 + |
|
5983 +9.9Â Quoting lookup data |
|
5984 + |
|
5985 +When data from an incoming message is included in a query-style lookup, there |
|
5986 +is the possibility of special characters in the data messing up the syntax of |
|
5987 +the query. For example, a NIS+ query that contains |
|
5988 + |
|
5989 +[name=$local_part] |
|
5990 + |
|
5991 +will be broken if the local part happens to contain a closing square bracket. |
|
5992 +For NIS+, data can be enclosed in double quotes like this: |
|
5993 + |
|
5994 +[name="$local_part"] |
|
5995 + |
|
5996 +but this still leaves the problem of a double quote in the data. The rule for |
|
5997 +NIS+ is that double quotes must be doubled. Other lookup types have different |
|
5998 +rules, and to cope with the differing requirements, an expansion operator of |
|
5999 +the following form is provided: |
|
6000 + |
|
6001 +${quote_<lookup-type>:<string>} |
|
6002 + |
|
6003 +For example, the safest way to write the NIS+ query is |
|
6004 + |
|
6005 +[name="${quote_nisplus:$local_part}"] |
|
6006 + |
|
6007 +See chapter 11 for full coverage of string expansions. The quote operator can |
|
6008 +be used for all lookup types, but has no effect for single-key lookups, since |
|
6009 +no quoting is ever needed in their key strings. |
|
6010 + |
|
6011 +9.10Â More about dnsdb |
|
6012 + |
|
6013 +The dnsdb lookup type uses the DNS as its database. A simple query consists of |
|
6014 +a record type and a domain name, separated by an equals sign. For example, an |
|
6015 +expansion string could contain: |
|
6016 + |
|
6017 +${lookup dnsdb{mx=a.b.example}{$value}fail} |
|
6018 + |
|
6019 +If the lookup succeeds, the result is placed in $value, which in this case is |
|
6020 +used on its own as the result. If the lookup does not succeed, the "fail" |
|
6021 +keyword causes a forced expansion failure - see section 11.4 for an explanation |
|
6022 +of what this means. |
|
6023 + |
|
6024 +The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and, |
|
6025 +when Exim is compiled with IPv6 support, AAAA (and A6 if that is also |
|
6026 +configured). If no type is given, TXT is assumed. When the type is PTR, the |
|
6027 +data can be an IP address, written as normal; inversion and the addition of |
|
6028 +in-addr.arpa or ip6.arpa happens automatically. For example: |
|
6029 + |
|
6030 +${lookup dnsdb{ptr=192.168.4.5}{$value}fail} |
|
6031 + |
|
6032 +If the data for a PTR record is not a syntactically valid IP address, it is not |
|
6033 +altered and nothing is added. |
|
6034 + |
|
6035 +For an MX lookup, both the preference value and the host name are returned for |
|
6036 +each record, separated by a space. For an SRV lookup, the priority, weight, |
|
6037 +port, and host name are returned for each record, separated by spaces. |
|
6038 + |
|
6039 +For any record type, if multiple records are found (or, for A6 lookups, if a |
|
6040 +single record leads to multiple addresses), the data is returned as a |
|
6041 +concatenation, with newline as the default separator. The order, of course, |
|
6042 +depends on the DNS resolver. You can specify a different separator character |
|
6043 +between multiple records by putting a right angle-bracket followed immediately |
|
6044 +by the new separator at the start of the query. For example: |
|
6045 + |
|
6046 +${lookup dnsdb{>: a=host1.example}} |
|
6047 + |
|
6048 +It is permitted to specify a space as the separator character. Further white |
|
6049 +space is ignored. |
|
6050 + |
|
6051 +For TXT records with multiple items of data, only the first item is returned, |
|
6052 +unless a separator for them is specified using a comma after the separator |
|
6053 +character followed immediately by the TXT record item separator. To concatenate |
|
6054 +items without a separator, use a semicolon instead. |
|
6055 + |
|
6056 +${lookup dnsdb{>\n,: txt=a.b.example}} |
|
6057 +${lookup dnsdb{>\n; txt=a.b.example}} |
|
6058 + |
|
6059 +It is permitted to specify a space as the separator character. Further white |
|
6060 +space is ignored. |
|
6061 + |
|
6062 +9.11Â Pseudo dnsdb record types |
|
6063 + |
|
6064 +By default, both the preference value and the host name are returned for each |
|
6065 +MX record, separated by a space. If you want only host names, you can use the |
|
6066 +pseudo-type MXH: |
|
6067 + |
|
6068 +${lookup dnsdb{mxh=a.b.example}} |
|
6069 + |
|
6070 +In this case, the preference values are omitted, and just the host names are |
|
6071 +returned. |
|
6072 + |
|
6073 +Another pseudo-type is ZNS (for "zone NS"). It performs a lookup for NS records |
|
6074 +on the given domain, but if none are found, it removes the first component of |
|
6075 +the domain name, and tries again. This process continues until NS records are |
|
6076 +found or there are no more components left (or there is a DNS error). In other |
|
6077 +words, it may return the name servers for a top-level domain, but it never |
|
6078 +returns the root name servers. If there are no NS records for the top-level |
|
6079 +domain, the lookup fails. Consider these examples: |
|
6080 + |
|
6081 +${lookup dnsdb{zns=xxx.quercite.com}} |
|
6082 +${lookup dnsdb{zns=xxx.edu}} |
|
6083 + |
|
6084 +Assuming that in each case there are no NS records for the full domain name, |
|
6085 +the first returns the name servers for quercite.com, and the second returns the |
|
6086 +name servers for edu. |
|
6087 + |
|
6088 +You should be careful about how you use this lookup because, unless the |
|
6089 +top-level domain does not exist, the lookup always returns some host names. The |
|
6090 +sort of use to which this might be put is for seeing if the name servers for a |
|
6091 +given domain are on a blacklist. You can probably assume that the name servers |
|
6092 +for the high-level domains such as com or co.uk are not going to be on such a |
|
6093 +list. |
|
6094 + |
|
6095 +A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV |
|
6096 +records according to the CSA rules, which are described in section 40.47. |
|
6097 +Although dnsdb supports SRV lookups directly, this is not sufficient because of |
|
6098 +the extra parent domain search behaviour of CSA. The result of a successful |
|
6099 +lookup such as: |
|
6100 + |
|
6101 +${lookup dnsdb {csa=$sender_helo_name}} |
|
6102 + |
|
6103 +has two space-separated fields: an authorization code and a target host name. |
|
6104 +The authorization code can be "Y" for yes, "N" for no, "X" for explicit |
|
6105 +authorization required but absent, or "?" for unknown. |
|
6106 + |
|
6107 +9.12Â Multiple dnsdb lookups |
|
6108 + |
|
6109 +In the previous sections, dnsdb lookups for a single domain are described. |
|
6110 +However, you can specify a list of domains or IP addresses in a single dnsdb |
|
6111 +lookup. The list is specified in the normal Exim way, with colon as the default |
|
6112 +separator, but with the ability to change this. For example: |
|
6113 + |
|
6114 +${lookup dnsdb{one.domain.com:two.domain.com}} |
|
6115 +${lookup dnsdb{a=one.host.com:two.host.com}} |
|
6116 +${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}} |
|
6117 + |
|
6118 +In order to retain backwards compatibility, there is one special case: if the |
|
6119 +lookup type is PTR and no change of separator is specified, Exim looks to see |
|
6120 +if the rest of the string is precisely one IPv6 address. In this case, it does |
|
6121 +not treat it as a list. |
|
6122 + |
|
6123 +The data from each lookup is concatenated, with newline separators by default, |
|
6124 +in the same way that multiple DNS records for a single item are handled. A |
|
6125 +different separator can be specified, as described above. |
|
6126 + |
|
6127 +The dnsdb lookup fails only if all the DNS lookups fail. If there is a |
|
6128 +temporary DNS error for any of them, the behaviour is controlled by an optional |
|
6129 +keyword followed by a comma that may appear before the record type. The |
|
6130 +possible keywords are "defer_strict", "defer_never", and "defer_lax". With |
|
6131 +"strict" behaviour, any temporary DNS error causes the whole lookup to defer. |
|
6132 +With "never" behaviour, a temporary DNS error is ignored, and the behaviour is |
|
6133 +as if the DNS lookup failed to find anything. With "lax" behaviour, all the |
|
6134 +queries are attempted, but a temporary DNS error causes the whole lookup to |
|
6135 +defer only if none of the other lookups succeed. The default is "lax", so the |
|
6136 +following lookups are equivalent: |
|
6137 + |
|
6138 +${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}} |
|
6139 +${lookup dnsdb{a=one.host.com:two.host.com}} |
|
6140 + |
|
6141 +Thus, in the default case, as long as at least one of the DNS lookups yields |
|
6142 +some data, the lookup succeeds. |
|
6143 + |
|
6144 +9.13Â More about LDAP |
|
6145 + |
|
6146 +The original LDAP implementation came from the University of Michigan; this has |
|
6147 +become "Open LDAP", and there are now two different releases. Another |
|
6148 +implementation comes from Netscape, and Solaris 7 and subsequent releases |
|
6149 +contain inbuilt LDAP support. Unfortunately, though these are all compatible at |
|
6150 +the lookup function level, their error handling is different. For this reason |
|
6151 +it is necessary to set a compile-time variable when building Exim with LDAP, to |
|
6152 +indicate which LDAP library is in use. One of the following should appear in |
|
6153 +your Local/Makefile: |
|
6154 + |
|
6155 +LDAP_LIB_TYPE=UMICHIGAN |
|
6156 +LDAP_LIB_TYPE=OPENLDAP1 |
|
6157 +LDAP_LIB_TYPE=OPENLDAP2 |
|
6158 +LDAP_LIB_TYPE=NETSCAPE |
|
6159 +LDAP_LIB_TYPE=SOLARIS |
|
6160 + |
|
6161 +If LDAP_LIB_TYPE is not set, Exim assumes "OPENLDAP1", which has the same |
|
6162 +interface as the University of Michigan version. |
|
6163 + |
|
6164 +There are three LDAP lookup types in Exim. These behave slightly differently in |
|
6165 +the way they handle the results of a query: |
|
6166 + |
|
6167 + * ldap requires the result to contain just one entry; if there are more, it |
|
6168 + gives an error. |
|
6169 + |
|
6170 + * ldapdn also requires the result to contain just one entry, but it is the |
|
6171 + Distinguished Name that is returned rather than any attribute values. |
|
6172 + |
|
6173 + * ldapm permits the result to contain more than one entry; the attributes |
|
6174 + from all of them are returned. |
|
6175 + |
|
6176 +For ldap and ldapm, if a query finds only entries with no attributes, Exim |
|
6177 +behaves as if the entry did not exist, and the lookup fails. The format of the |
|
6178 +data returned by a successful lookup is described in the next section. First we |
|
6179 +explain how LDAP queries are coded. |
|
6180 + |
|
6181 +9.14Â Format of LDAP queries |
|
6182 + |
|
6183 +An LDAP query takes the form of a URL as defined in RFC 2255. For example, in |
|
6184 +the configuration of a redirect router one might have this setting: |
|
6185 + |
|
6186 +data = ${lookup ldap \ |
|
6187 + {ldap:///cn=$local_part,o=University%20of%20Cambridge,\ |
|
6188 + c=UK?mailbox?base?}} |
|
6189 + |
|
6190 +The URL may begin with "ldap" or "ldaps" if your LDAP library supports secure |
|
6191 +(encrypted) LDAP connections. The second of these ensures that an encrypted TLS |
|
6192 +connection is used. |
|
6193 + |
|
6194 +9.15Â LDAP quoting |
|
6195 + |
|
6196 +Two levels of quoting are required in LDAP queries, the first for LDAP itself |
|
6197 +and the second because the LDAP query is represented as a URL. Furthermore, |
|
6198 +within an LDAP query, two different kinds of quoting are required. For this |
|
6199 +reason, there are two different LDAP-specific quoting operators. |
|
6200 + |
|
6201 +The quote_ldap operator is designed for use on strings that are part of filter |
|
6202 +specifications. Conceptually, it first does the following conversions on the |
|
6203 +string: |
|
6204 + |
|
6205 +* => \2A |
|
6206 +( => \28 |
|
6207 +) => \29 |
|
6208 +\ => \5C |
|
6209 + |
|
6210 +in accordance with RFC 2254. The resulting string is then quoted according to |
|
6211 +the rules for URLs, that is, all non-alphanumeric characters except |
|
6212 + |
|
6213 +! $ ' - . _ ( ) * + |
|
6214 + |
|
6215 +are converted to their hex values, preceded by a percent sign. For example: |
|
6216 + |
|
6217 +${quote_ldap: a(bc)*, a<yz>; } |
|
6218 + |
|
6219 +yields |
|
6220 + |
|
6221 +%20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20 |
|
6222 + |
|
6223 +Removing the URL quoting, this is (with a leading and a trailing space): |
|
6224 + |
|
6225 +a\28bc\29\2A, a<yz>; |
|
6226 + |
|
6227 +The quote_ldap_dn operator is designed for use on strings that are part of base |
|
6228 +DN specifications in queries. Conceptually, it first converts the string by |
|
6229 +inserting a backslash in front of any of the following characters: |
|
6230 + |
|
6231 +, + " \ < > ; |
|
6232 + |
|
6233 +It also inserts a backslash before any leading spaces or # characters, and |
|
6234 +before any trailing spaces. (These rules are in RFC 2253.) The resulting string |
|
6235 +is then quoted according to the rules for URLs. For example: |
|
6236 + |
|
6237 +${quote_ldap_dn: a(bc)*, a<yz>; } |
|
6238 + |
|
6239 +yields |
|
6240 + |
|
6241 +%5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20 |
|
6242 + |
|
6243 +Removing the URL quoting, this is (with a trailing space): |
|
6244 + |
|
6245 +\ a(bc)*\, a\<yz\>\;\ |
|
6246 + |
|
6247 +There are some further comments about quoting in the section on LDAP |
|
6248 +authentication below. |
|
6249 + |
|
6250 +9.16Â LDAP connections |
|
6251 + |
|
6252 +The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP |
|
6253 +is in use, via a Unix domain socket. The example given above does not specify |
|
6254 +an LDAP server. A server that is reached by TCP/IP can be specified in a query |
|
6255 +by starting it with |
|
6256 + |
|
6257 +ldap://<hostname>:<port>/... |
|
6258 + |
|
6259 +If the port (and preceding colon) are omitted, the standard LDAP port (389) is |
|
6260 +used. When no server is specified in a query, a list of default servers is |
|
6261 +taken from the ldap_default_servers configuration option. This supplies a |
|
6262 +colon-separated list of servers which are tried in turn until one successfully |
|
6263 +handles a query, or there is a serious error. Successful handling either |
|
6264 +returns the requested data, or indicates that it does not exist. Serious errors |
|
6265 +are syntactical, or multiple values when only a single value is expected. |
|
6266 +Errors which cause the next server to be tried are connection failures, bind |
|
6267 +failures, and timeouts. |
|
6268 + |
|
6269 +For each server name in the list, a port number can be given. The standard way |
|
6270 +of specifying a host and port is to use a colon separator (RFC 1738). Because |
|
6271 +ldap_default_servers is a colon-separated list, such colons have to be doubled. |
|
6272 +For example |
|
6273 + |
|
6274 +ldap_default_servers = ldap1.example.com::145:ldap2.example.com |
|
6275 + |
|
6276 +If ldap_default_servers is unset, a URL with no server name is passed to the |
|
6277 +LDAP library with no server name, and the library's default (normally the local |
|
6278 +host) is used. |
|
6279 + |
|
6280 +If you are using the OpenLDAP library, you can connect to an LDAP server using |
|
6281 +a Unix domain socket instead of a TCP/IP connection. This is specified by using |
|
6282 +"ldapi" instead of "ldap" in LDAP queries. What follows here applies only to |
|
6283 +OpenLDAP. If Exim is compiled with a different LDAP library, this feature is |
|
6284 +not available. |
|
6285 + |
|
6286 +For this type of connection, instead of a host name for the server, a pathname |
|
6287 +for the socket is required, and the port number is not relevant. The pathname |
|
6288 +can be specified either as an item in ldap_default_servers, or inline in the |
|
6289 +query. In the former case, you can have settings such as |
|
6290 + |
|
6291 +ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain |
|
6292 + |
|
6293 +When the pathname is given in the query, you have to escape the slashes as |
|
6294 +"%2F" to fit in with the LDAP URL syntax. For example: |
|
6295 + |
|
6296 +${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=... |
|
6297 + |
|
6298 +When Exim processes an LDAP lookup and finds that the "hostname" is really a |
|
6299 +pathname, it uses the Unix domain socket code, even if the query actually |
|
6300 +specifies "ldap" or "ldaps". In particular, no encryption is used for a socket |
|
6301 +connection. This behaviour means that you can use a setting of |
|
6302 +ldap_default_servers such as in the example above with traditional "ldap" or |
|
6303 +"ldaps" queries, and it will work. First, Exim tries a connection via the Unix |
|
6304 +domain socket; if that fails, it tries a TCP/IP connection to the backup host. |
|
6305 + |
|
6306 +If an explicit "ldapi" type is given in a query when a host name is specified, |
|
6307 +an error is diagnosed. However, if there are more items in ldap_default_servers |
|
6308 +, they are tried. In other words: |
|
6309 + |
|
6310 + * Using a pathname with "ldap" or "ldaps" forces the use of the Unix domain |
|
6311 + interface. |
|
6312 + |
|
6313 + * Using "ldapi" with a host name causes an error. |
|
6314 + |
|
6315 +Using "ldapi" with no host or path in the query, and no setting of |
|
6316 +ldap_default_servers, does whatever the library does by default. |
|
6317 + |
|
6318 +9.17Â LDAP authentication and control information |
|
6319 + |
|
6320 +The LDAP URL syntax provides no way of passing authentication and other control |
|
6321 +information to the server. To make this possible, the URL in an LDAP query may |
|
6322 +be preceded by any number of <name>=<value> settings, separated by spaces. If a |
|
6323 +value contains spaces it must be enclosed in double quotes, and when double |
|
6324 +quotes are used, backslash is interpreted in the usual way inside them. The |
|
6325 +following names are recognized: |
|
6326 + |
|
6327 +DEREFERENCE  set the dereferencing parameter |
|
6328 +NETTIME      set a timeout for a network operation |
|
6329 +USER         set the DN, for authenticating the LDAP bind |
|
6330 +PASS         set the password, likewise |
|
6331 +REFERRALS    set the referrals parameter |
|
6332 +SIZE         set the limit for the number of entries returned |
|
6333 +TIME         set the maximum waiting time for a query |
|
6334 + |
|
6335 +The value of the DEREFERENCE parameter must be one of the words "never", |
|
6336 +"searching", "finding", or "always". The value of the REFERRALS parameter must |
|
6337 +be "follow" (the default) or "nofollow". The latter stops the LDAP library from |
|
6338 +trying to follow referrals issued by the LDAP server. |
|
6339 + |
|
6340 +The name CONNECT is an obsolete name for NETTIME, retained for backwards |
|
6341 +compatibility. This timeout (specified as a number of seconds) is enforced from |
|
6342 +the client end for operations that can be carried out over a network. |
|
6343 +Specifically, it applies to network connections and calls to the ldap_result() |
|
6344 +function. If the value is greater than zero, it is used if |
|
6345 +LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or if |
|
6346 +LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape SDK 4.1). A |
|
6347 +value of zero forces an explicit setting of "no timeout" for Netscape SDK; for |
|
6348 +OpenLDAP no action is taken. |
|
6349 + |
|
6350 +The TIME parameter (also a number of seconds) is passed to the server to set a |
|
6351 +server-side limit on the time taken to complete a search. |
|
6352 + |
|
6353 +Here is an example of an LDAP query in an Exim lookup that uses some of these |
|
6354 +values. This is a single line, folded to fit on the page: |
|
6355 + |
|
6356 +${lookup ldap |
|
6357 + {user="cn=manager,o=University of Cambridge,c=UK" pass=secret |
|
6358 + ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)} |
|
6359 + {$value}fail} |
|
6360 + |
|
6361 +The encoding of spaces as "%20" is a URL thing which should not be done for any |
|
6362 +of the auxiliary data. Exim configuration settings that include lookups which |
|
6363 +contain password information should be preceded by "hide" to prevent non-admin |
|
6364 +users from using the -bP option to see their values. |
|
6365 + |
|
6366 +The auxiliary data items may be given in any order. The default is no |
|
6367 +connection timeout (the system timeout is used), no user or password, no limit |
|
6368 +on the number of entries returned, and no time limit on queries. |
|
6369 + |
|
6370 +When a DN is quoted in the USER= setting for LDAP authentication, Exim removes |
|
6371 +any URL quoting that it may contain before passing it LDAP. Apparently some |
|
6372 +libraries do this for themselves, but some do not. Removing the URL quoting has |
|
6373 +two advantages: |
|
6374 + |
|
6375 + * It makes it possible to use the same quote_ldap_dn expansion for USER= DNs |
|
6376 + as with DNs inside actual queries. |
|
6377 + |
|
6378 + * It permits spaces inside USER= DNs. |
|
6379 + |
|
6380 +For example, a setting such as |
|
6381 + |
|
6382 +USER=cn=${quote_ldap_dn:$1} |
|
6383 + |
|
6384 +should work even if $1 contains spaces. |
|
6385 + |
|
6386 +Expanded data for the PASS= value should be quoted using the quote expansion |
|
6387 +operator, rather than the LDAP quote operators. The only reason this field |
|
6388 +needs quoting is to ensure that it conforms to the Exim syntax, which does not |
|
6389 +allow unquoted spaces. For example: |
|
6390 + |
|
6391 +PASS=${quote:$3} |
|
6392 + |
|
6393 +The LDAP authentication mechanism can be used to check passwords as part of |
|
6394 +SMTP authentication. See the ldapauth expansion string condition in chapter 11. |
|
6395 + |
|
6396 +9.18Â Format of data returned by LDAP |
|
6397 + |
|
6398 +The ldapdn lookup type returns the Distinguished Name from a single entry as a |
|
6399 +sequence of values, for example |
|
6400 + |
|
6401 +cn=manager, o=University of Cambridge, c=UK |
|
6402 + |
|
6403 +The ldap lookup type generates an error if more than one entry matches the |
|
6404 +search filter, whereas ldapm permits this case, and inserts a newline in the |
|
6405 +result between the data from different entries. It is possible for multiple |
|
6406 +values to be returned for both ldap and ldapm, but in the former case you know |
|
6407 +that whatever values are returned all came from a single entry in the |
|
6408 +directory. |
|
6409 + |
|
6410 +In the common case where you specify a single attribute in your LDAP query, the |
|
6411 +result is not quoted, and does not contain the attribute name. If the attribute |
|
6412 +has multiple values, they are separated by commas. |
|
6413 + |
|
6414 +If you specify multiple attributes, the result contains space-separated, quoted |
|
6415 +strings, each preceded by the attribute name and an equals sign. Within the |
|
6416 +quotes, the quote character, backslash, and newline are escaped with |
|
6417 +backslashes, and commas are used to separate multiple values for the attribute. |
|
6418 +Apart from the escaping, the string within quotes takes the same form as the |
|
6419 +output when a single attribute is requested. Specifying no attributes is the |
|
6420 +same as specifying all of an entry's attributes. |
|
6421 + |
|
6422 +Here are some examples of the output format. The first line of each pair is an |
|
6423 +LDAP query, and the second is the data that is returned. The attribute called |
|
6424 +attr1 has two values, whereas attr2 has only one value: |
|
6425 + |
|
6426 +ldap:///o=base?attr1?sub?(uid=fred) |
|
6427 +value1.1, value1.2 |
|
6428 + |
|
6429 +ldap:///o=base?attr2?sub?(uid=fred) |
|
6430 +value two |
|
6431 + |
|
6432 +ldap:///o=base?attr1,attr2?sub?(uid=fred) |
|
6433 +attr1="value1.1, value1.2" attr2="value two" |
|
6434 + |
|
6435 +ldap:///o=base??sub?(uid=fred) |
|
6436 +objectClass="top" attr1="value1.1, value1.2" attr2="value two" |
|
6437 + |
|
6438 +The extract operator in string expansions can be used to pick out individual |
|
6439 +fields from data that consists of key=value pairs. You can make use of Exim's |
|
6440 +-be option to run expansion tests and thereby check the results of LDAP |
|
6441 +lookups. |
|
6442 + |
|
6443 +9.19Â More about NIS+ |
|
6444 + |
|
6445 +NIS+ queries consist of a NIS+ indexed name followed by an optional colon and |
|
6446 +field name. If this is given, the result of a successful query is the contents |
|
6447 +of the named field; otherwise the result consists of a concatenation of |
|
6448 +field-name=field-value pairs, separated by spaces. Empty values and values |
|
6449 +containing spaces are quoted. For example, the query |
|
6450 + |
|
6451 +[name=mg1456],passwd.org_dir |
|
6452 + |
|
6453 +might return the string |
|
6454 + |
|
6455 +name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre" |
|
6456 +home=/home/mg1456 shell=/bin/bash shadow="" |
|
6457 + |
|
6458 +(split over two lines here to fit on the page), whereas |
|
6459 + |
|
6460 +[name=mg1456],passwd.org_dir:gcos |
|
6461 + |
|
6462 +would just return |
|
6463 + |
|
6464 +Martin Guerre |
|
6465 + |
|
6466 +with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry |
|
6467 +for the given indexed key. The effect of the quote_nisplus expansion operator |
|
6468 +is to double any quote characters within the text. |
|
6469 + |
|
6470 +9.20Â SQL lookups |
|
6471 + |
|
6472 +Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite |
|
6473 +databases. Queries for these databases contain SQL statements, so an example |
|
6474 +might be |
|
6475 + |
|
6476 +${lookup mysql{select mailbox from users where id='userx'}\ |
|
6477 + {$value}fail} |
|
6478 + |
|
6479 +If the result of the query contains more than one field, the data for each |
|
6480 +field in the row is returned, preceded by its name, so the result of |
|
6481 + |
|
6482 +${lookup pgsql{select home,name from users where id='userx'}\ |
|
6483 + {$value}} |
|
6484 + |
|
6485 +might be |
|
6486 + |
|
6487 +home=/home/userx name="Mister X" |
|
6488 + |
|
6489 +Empty values and values containing spaces are double quoted, with embedded |
|
6490 +quotes escaped by a backslash. If the result of the query contains just one |
|
6491 +field, the value is passed back verbatim, without a field name, for example: |
|
6492 + |
|
6493 +Mister X |
|
6494 + |
|
6495 +If the result of the query yields more than one row, it is all concatenated, |
|
6496 +with a newline between the data for each row. |
|
6497 + |
|
6498 +9.21Â More about MySQL, PostgreSQL, Oracle, and InterBase |
|
6499 + |
|
6500 +If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the |
|
6501 +mysql_servers, pgsql_servers, oracle_servers, or ibase_servers option (as |
|
6502 +appropriate) must be set to a colon-separated list of server information. (For |
|
6503 +MySQL and PostgreSQL only, the global option need not be set if all queries |
|
6504 +contain their own server information - see section 9.22.) Each item in the list |
|
6505 +is a slash-separated list of four items: host name, database name, user name, |
|
6506 +and password. In the case of Oracle, the host name field is used for the |
|
6507 +"service name", and the database name field is not used and should be empty. |
|
6508 +For example: |
|
6509 + |
|
6510 +hide oracle_servers = oracle.plc.example//userx/abcdwxyz |
|
6511 + |
|
6512 +Because password data is sensitive, you should always precede the setting with |
|
6513 +"hide", to prevent non-admin users from obtaining the setting via the -bP |
|
6514 +option. Here is an example where two MySQL servers are listed: |
|
6515 + |
|
6516 +hide mysql_servers = localhost/users/root/secret:\ |
|
6517 + otherhost/users/root/othersecret |
|
6518 + |
|
6519 +For MySQL and PostgreSQL, a host may be specified as <name>:<port> but because |
|
6520 +this is a colon-separated list, the colon has to be doubled. For each query, |
|
6521 +these parameter groups are tried in order until a connection is made and a |
|
6522 +query is successfully processed. The result of a query may be that no data is |
|
6523 +found, but that is still a successful query. In other words, the list of |
|
6524 +servers provides a backup facility, not a list of different places to look. |
|
6525 + |
|
6526 +The quote_mysql, quote_pgsql, and quote_oracle expansion operators convert |
|
6527 +newline, tab, carriage return, and backspace to \n, \t, \r, and \b |
|
6528 +respectively, and the characters single-quote, double-quote, and backslash |
|
6529 +itself are escaped with backslashes. The quote_pgsql expansion operator, in |
|
6530 +addition, escapes the percent and underscore characters. This cannot be done |
|
6531 +for MySQL because these escapes are not recognized in contexts where these |
|
6532 +characters are not special. |
|
6533 + |
|
6534 +9.22Â Specifying the server in the query |
|
6535 + |
|
6536 +For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase), |
|
6537 +it is possible to specify a list of servers with an individual query. This is |
|
6538 +done by starting the query with |
|
6539 + |
|
6540 +servers=server1:server2:server3:...; |
|
6541 + |
|
6542 +Each item in the list may take one of two forms: |
|
6543 + |
|
6544 + 1. If it contains no slashes it is assumed to be just a host name. The |
|
6545 + appropriate global option (mysql_servers or pgsql_servers) is searched for |
|
6546 + a host of the same name, and the remaining parameters (database, user, |
|
6547 + password) are taken from there. |
|
6548 + |
|
6549 + 2. If it contains any slashes, it is taken as a complete parameter set. |
|
6550 + |
|
6551 +The list of servers is used in exactly the same way as the global list. Once a |
|
6552 +connection to a server has happened and a query has been successfully executed, |
|
6553 +processing of the lookup ceases. |
|
6554 + |
|
6555 +This feature is intended for use in master/slave situations where updates are |
|
6556 +occurring and you want to update the master rather than a slave. If the master |
|
6557 +is in the list as a backup for reading, you might have a global setting like |
|
6558 +this: |
|
6559 + |
|
6560 +mysql_servers = slave1/db/name/pw:\ |
|
6561 + slave2/db/name/pw:\ |
|
6562 + master/db/name/pw |
|
6563 + |
|
6564 +In an updating lookup, you could then write: |
|
6565 + |
|
6566 +${lookup mysql{servers=master; UPDATE ...} } |
|
6567 + |
|
6568 +That query would then be sent only to the master server. If, on the other hand, |
|
6569 +the master is not to be used for reading, and so is not present in the global |
|
6570 +option, you can still update it by a query of this form: |
|
6571 + |
|
6572 +${lookup pgsql{servers=master/db/name/pw; UPDATE ...} } |
|
6573 + |
|
6574 +9.23Â Special MySQL features |
|
6575 + |
|
6576 +For MySQL, an empty host name or the use of "localhost" in mysql_servers causes |
|
6577 +a connection to the server on the local host by means of a Unix domain socket. |
|
6578 +An alternate socket can be specified in parentheses. The full syntax of each |
|
6579 +item in mysql_servers is: |
|
6580 + |
|
6581 +<hostname>::<port>(<socket name>)/<database>/<user>/<password> |
|
6582 + |
|
6583 +Any of the three sub-parts of the first field can be omitted. For normal use on |
|
6584 +the local host it can be left blank or set to just "localhost". |
|
6585 + |
|
6586 +No database need be supplied - but if it is absent here, it must be given in |
|
6587 +the queries. |
|
6588 + |
|
6589 +If a MySQL query is issued that does not request any data (an insert, update, |
|
6590 +or delete command), the result of the lookup is the number of rows affected. |
|
6591 + |
|
6592 +Warning: This can be misleading. If an update does not actually change anything |
|
6593 +(for example, setting a field to the value it already has), the result is zero |
|
6594 +because no rows are affected. |
|
6595 + |
|
6596 +9.24Â Special PostgreSQL features |
|
6597 + |
|
6598 +PostgreSQL lookups can also use Unix domain socket connections to the database. |
|
6599 +This is usually faster and costs less CPU time than a TCP/IP connection. |
|
6600 +However it can be used only if the mail server runs on the same machine as the |
|
6601 +database server. A configuration line for PostgreSQL via Unix domain sockets |
|
6602 +looks like this: |
|
6603 + |
|
6604 +hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ... |
|
6605 + |
|
6606 +In other words, instead of supplying a host name, a path to the socket is |
|
6607 +given. The path name is enclosed in parentheses so that its slashes aren't |
|
6608 +visually confused with the delimiters for the other server parameters. |
|
6609 + |
|
6610 +If a PostgreSQL query is issued that does not request any data (an insert, |
|
6611 +update, or delete command), the result of the lookup is the number of rows |
|
6612 +affected. |
|
6613 + |
|
6614 +9.25Â More about SQLite |
|
6615 + |
|
6616 +SQLite is different to the other SQL lookups because a file name is required in |
|
6617 +addition to the SQL query. An SQLite database is a single file, and there is no |
|
6618 +daemon as in the other SQL databases. The interface to Exim requires the name |
|
6619 +of the file, as an absolute path, to be given at the start of the query. It is |
|
6620 +separated from the query by white space. This means that the path name cannot |
|
6621 +contain white space. Here is a lookup expansion example: |
|
6622 + |
|
6623 +${lookup sqlite {/some/thing/sqlitedb \ |
|
6624 + select name from aliases where id='userx';}} |
|
6625 + |
|
6626 +In a list, the syntax is similar. For example: |
|
6627 + |
|
6628 +domainlist relay_domains = sqlite;/some/thing/sqlitedb \ |
|
6629 + select * from relays where ip='$sender_host_address'; |
|
6630 + |
|
6631 +The only character affected by the quote_sqlite operator is a single quote, |
|
6632 +which it doubles. |
|
6633 + |
|
6634 +The SQLite library handles multiple simultaneous accesses to the database |
|
6635 +internally. Multiple readers are permitted, but only one process can update at |
|
6636 +once. Attempts to access the database while it is being updated are rejected |
|
6637 +after a timeout period, during which the SQLite library waits for the lock to |
|
6638 +be released. In Exim, the default timeout is set to 5 seconds, but it can be |
|
6639 +changed by means of the sqlite_lock_timeout option. |
|
6640 + |
|
6641 +10. Domain, host, address, and local part lists |
|
6642 + |
|
6643 +A number of Exim configuration options contain lists of domains, hosts, email |
|
6644 +addresses, or local parts. For example, the hold_domains option contains a list |
|
6645 +of domains whose delivery is currently suspended. These lists are also used as |
|
6646 +data in ACL statements (see chapter 40), and as arguments to expansion |
|
6647 +conditions such as match_domain. |
|
6648 + |
|
6649 +Each item in one of these lists is a pattern to be matched against a domain, |
|
6650 +host, email address, or local part, respectively. In the sections below, the |
|
6651 +different types of pattern for each case are described, but first we cover some |
|
6652 +general facilities that apply to all four kinds of list. |
|
6653 + |
|
6654 +10.1Â Expansion of lists |
|
6655 + |
|
6656 +Each list is expanded as a single string before it is used. The result of |
|
6657 +expansion must be a list, possibly containing empty items, which is split up |
|
6658 +into separate items for matching. By default, colon is the separator character, |
|
6659 +but this can be varied if necessary. See sections 6.19 and 6.21 for details of |
|
6660 +the list syntax; the second of these discusses the way to specify empty list |
|
6661 +items. |
|
6662 + |
|
6663 +If the string expansion is forced to fail, Exim behaves as if the item it is |
|
6664 +testing (domain, host, address, or local part) is not in the list. Other |
|
6665 +expansion failures cause temporary errors. |
|
6666 + |
|
6667 +If an item in a list is a regular expression, backslashes, dollars and possibly |
|
6668 +other special characters in the expression must be protected against |
|
6669 +misinterpretation by the string expander. The easiest way to do this is to use |
|
6670 +the "\N" expansion feature to indicate that the contents of the regular |
|
6671 +expression should not be expanded. For example, in an ACL you might have: |
|
6672 + |
|
6673 +deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \ |
|
6674 + ${lookup{$domain}lsearch{/badsenders/bydomain}} |
|
6675 + |
|
6676 +The first item is a regular expression that is protected from expansion by "\ |
|
6677 +N", whereas the second uses the expansion to obtain a list of unwanted senders |
|
6678 +based on the receiving domain. |
|
6679 + |
|
6680 +10.2Â Negated items in lists |
|
6681 + |
|
6682 +Items in a list may be positive or negative. Negative items are indicated by a |
|
6683 +leading exclamation mark, which may be followed by optional white space. A list |
|
6684 +defines a set of items (domains, etc). When Exim processes one of these lists, |
|
6685 +it is trying to find out whether a domain, host, address, or local part |
|
6686 +(respectively) is in the set that is defined by the list. It works like this: |
|
6687 + |
|
6688 +The list is scanned from left to right. If a positive item is matched, the |
|
6689 +subject that is being checked is in the set; if a negative item is matched, the |
|
6690 +subject is not in the set. If the end of the list is reached without the |
|
6691 +subject having matched any of the patterns, it is in the set if the last item |
|
6692 +was a negative one, but not if it was a positive one. For example, the list in |
|
6693 + |
|
6694 +domainlist relay_domains = !a.b.c : *.b.c |
|
6695 + |
|
6696 +matches any domain ending in .b.c except for a.b.c. Domains that match neither |
|
6697 +a.b.c nor *.b.c do not match, because the last item in the list is positive. |
|
6698 +However, if the setting were |
|
6699 + |
|
6700 +domainlist relay_domains = !a.b.c |
|
6701 + |
|
6702 +then all domains other than a.b.c would match because the last item in the list |
|
6703 +is negative. In other words, a list that ends with a negative item behaves as |
|
6704 +if it had an extra item ":*" on the end. |
|
6705 + |
|
6706 +Another way of thinking about positive and negative items in lists is to read |
|
6707 +the connector as "or" after a positive item and as "and" after a negative item. |
|
6708 + |
|
6709 +10.3Â File names in lists |
|
6710 + |
|
6711 +If an item in a domain, host, address, or local part list is an absolute file |
|
6712 +name (beginning with a slash character), each line of the file is read and |
|
6713 +processed as if it were an independent item in the list, except that further |
|
6714 +file names are not allowed, and no expansion of the data from the file takes |
|
6715 +place. Empty lines in the file are ignored, and the file may also contain |
|
6716 +comment lines: |
|
6717 + |
|
6718 + * For domain and host lists, if a # character appears anywhere in a line of |
|
6719 + the file, it and all following characters are ignored. |
|
6720 + |
|
6721 + * Because local parts may legitimately contain # characters, a comment in an |
|
6722 + address list or local part list file is recognized only if # is preceded by |
|
6723 + white space or the start of the line. For example: |
|
6724 + |
|
6725 + not#comment@x.y.z # but this is a comment |
|
6726 + |
|
6727 +Putting a file name in a list has the same effect as inserting each line of the |
|
6728 +file as an item in the list (blank lines and comments excepted). However, there |
|
6729 +is one important difference: the file is read each time the list is processed, |
|
6730 +so if its contents vary over time, Exim's behaviour changes. |
|
6731 + |
|
6732 +If a file name is preceded by an exclamation mark, the sense of any match |
|
6733 +within the file is inverted. For example, if |
|
6734 + |
|
6735 +hold_domains = !/etc/nohold-domains |
|
6736 + |
|
6737 +and the file contains the lines |
|
6738 + |
|
6739 +!a.b.c |
|
6740 +*.b.c |
|
6741 + |
|
6742 +then a.b.c is in the set of domains defined by hold_domains, whereas any domain |
|
6743 +matching "*.b.c" is not. |
|
6744 + |
|
6745 +10.4Â An lsearch file is not an out-of-line list |
|
6746 + |
|
6747 +As will be described in the sections that follow, lookups can be used in lists |
|
6748 +to provide indexed methods of checking list membership. There has been some |
|
6749 +confusion about the way lsearch lookups work in lists. Because an lsearch file |
|
6750 +contains plain text and is scanned sequentially, it is sometimes thought that |
|
6751 +it is allowed to contain wild cards and other kinds of non-constant pattern. |
|
6752 +This is not the case. The keys in an lsearch file are always fixed strings, |
|
6753 +just as for any other single-key lookup type. |
|
6754 + |
|
6755 +If you want to use a file to contain wild-card patterns that form part of a |
|
6756 +list, just give the file name on its own, without a search type, as described |
|
6757 +in the previous section. You could also use the wildlsearch or nwildlsearch, |
|
6758 +but there is no advantage in doing this. |
|
6759 + |
|
6760 +10.5Â Named lists |
|
6761 + |
|
6762 +A list of domains, hosts, email addresses, or local parts can be given a name |
|
6763 +which is then used to refer to the list elsewhere in the configuration. This is |
|
6764 +particularly convenient if the same list is required in several different |
|
6765 +places. It also allows lists to be given meaningful names, which can improve |
|
6766 +the readability of the configuration. For example, it is conventional to define |
|
6767 +a domain list called local_domains for all the domains that are handled locally |
|
6768 +on a host, using a configuration line such as |
|
6769 + |
|
6770 +domainlist local_domains = localhost:my.dom.example |
|
6771 + |
|
6772 +Named lists are referenced by giving their name preceded by a plus sign, so, |
|
6773 +for example, a router that is intended to handle local domains would be |
|
6774 +configured with the line |
|
6775 + |
|
6776 +domains = +local_domains |
|
6777 + |
|
6778 +The first router in a configuration is often one that handles all domains |
|
6779 +except the local ones, using a configuration with a negated item like this: |
|
6780 + |
|
6781 +dnslookup: |
|
6782 + driver = dnslookup |
|
6783 + domains = ! +local_domains |
|
6784 + transport = remote_smtp |
|
6785 + no_more |
|
6786 + |
|
6787 +The four kinds of named list are created by configuration lines starting with |
|
6788 +the words domainlist, hostlist, addresslist, or localpartlist, respectively. |
|
6789 +Then there follows the name that you are defining, followed by an equals sign |
|
6790 +and the list itself. For example: |
|
6791 + |
|
6792 +hostlist relay_hosts = 192.168.23.0/24 : my.friend.example |
|
6793 +addresslist bad_senders = cdb;/etc/badsenders |
|
6794 + |
|
6795 +A named list may refer to other named lists: |
|
6796 + |
|
6797 +domainlist dom1 = first.example : second.example |
|
6798 +domainlist dom2 = +dom1 : third.example |
|
6799 +domainlist dom3 = fourth.example : +dom2 : fifth.example |
|
6800 + |
|
6801 +Warning: If the last item in a referenced list is a negative one, the effect |
|
6802 +may not be what you intended, because the negation does not propagate out to |
|
6803 +the higher level. For example, consider: |
|
6804 + |
|
6805 +domainlist dom1 = !a.b |
|
6806 +domainlist dom2 = +dom1 : *.b |
|
6807 + |
|
6808 +The second list specifies "either in the dom1 list or *.b". The first list |
|
6809 +specifies just "not a.b", so the domain x.y matches it. That means it matches |
|
6810 +the second list as well. The effect is not the same as |
|
6811 + |
|
6812 +domainlist dom2 = !a.b : *.b |
|
6813 + |
|
6814 +where x.y does not match. It's best to avoid negation altogether in referenced |
|
6815 +lists if you can. |
|
6816 + |
|
6817 +Named lists may have a performance advantage. When Exim is routing an address |
|
6818 +or checking an incoming message, it caches the result of tests on named lists. |
|
6819 +So, if you have a setting such as |
|
6820 + |
|
6821 +domains = +local_domains |
|
6822 + |
|
6823 +on several of your routers or in several ACL statements, the actual test is |
|
6824 +done only for the first one. However, the caching works only if there are no |
|
6825 +expansions within the list itself or any sublists that it references. In other |
|
6826 +words, caching happens only for lists that are known to be the same each time |
|
6827 +they are referenced. |
|
6828 + |
|
6829 +By default, there may be up to 16 named lists of each type. This limit can be |
|
6830 +extended by changing a compile-time variable. The use of domain and host lists |
|
6831 +is recommended for concepts such as local domains, relay domains, and relay |
|
6832 +hosts. The default configuration is set up like this. |
|
6833 + |
|
6834 +10.6Â Named lists compared with macros |
|
6835 + |
|
6836 +At first sight, named lists might seem to be no different from macros in the |
|
6837 +configuration file. However, macros are just textual substitutions. If you |
|
6838 +write |
|
6839 + |
|
6840 +ALIST = host1 : host2 |
|
6841 +auth_advertise_hosts = !ALIST |
|
6842 + |
|
6843 +it probably won't do what you want, because that is exactly the same as |
|
6844 + |
|
6845 +auth_advertise_hosts = !host1 : host2 |
|
6846 + |
|
6847 +Notice that the second host name is not negated. However, if you use a host |
|
6848 +list, and write |
|
6849 + |
|
6850 +hostlist alist = host1 : host2 |
|
6851 +auth_advertise_hosts = ! +alist |
|
6852 + |
|
6853 +the negation applies to the whole list, and so that is equivalent to |
|
6854 + |
|
6855 +auth_advertise_hosts = !host1 : !host2 |
|
6856 + |
|
6857 +10.7Â Named list caching |
|
6858 + |
|
6859 +While processing a message, Exim caches the result of checking a named list if |
|
6860 +it is sure that the list is the same each time. In practice, this means that |
|
6861 +the cache operates only if the list contains no $ characters, which guarantees |
|
6862 +that it will not change when it is expanded. Sometimes, however, you may have |
|
6863 +an expanded list that you know will be the same each time within a given |
|
6864 +message. For example: |
|
6865 + |
|
6866 +domainlist special_domains = \ |
|
6867 + ${lookup{$sender_host_address}cdb{/some/file}} |
|
6868 + |
|
6869 +This provides a list of domains that depends only on the sending host's IP |
|
6870 +address. If this domain list is referenced a number of times (for example, in |
|
6871 +several ACL lines, or in several routers) the result of the check is not cached |
|
6872 +by default, because Exim does not know that it is going to be the same list |
|
6873 +each time. |
|
6874 + |
|
6875 +By appending "_cache" to "domainlist" you can tell Exim to go ahead and cache |
|
6876 +the result anyway. For example: |
|
6877 + |
|
6878 +domainlist_cache special_domains = ${lookup{... |
|
6879 + |
|
6880 +If you do this, you should be absolutely sure that caching is going to do the |
|
6881 +right thing in all cases. When in doubt, leave it out. |
|
6882 + |
|
6883 +10.8Â Domain lists |
|
6884 + |
|
6885 +Domain lists contain patterns that are to be matched against a mail domain. The |
|
6886 +following types of item may appear in domain lists: |
|
6887 + |
|
6888 + * If a pattern consists of a single @ character, it matches the local host |
|
6889 + name, as set by the primary_hostname option (or defaulted). This makes it |
|
6890 + possible to use the same configuration file on several different hosts that |
|
6891 + differ only in their names. |
|
6892 + |
|
6893 + * If a pattern consists of the string "@[]" it matches an IP address enclosed |
|
6894 + in square brackets (as in an email address that contains a domain literal), |
|
6895 + but only if that IP address is recognized as local for email routing |
|
6896 + purposes. The local_interfaces and extra_local_interfaces options can be |
|
6897 + used to control which of a host's several IP addresses are treated as |
|
6898 + local. In today's Internet, the use of domain literals is controversial. |
|
6899 + |
|
6900 + * If a pattern consists of the string "@mx_any" it matches any domain that |
|
6901 + has an MX record pointing to the local host or to any host that is listed |
|
6902 + in hosts_treat_as_local. The items "@mx_primary" and "@mx_secondary" are |
|
6903 + similar, except that the first matches only when a primary MX target is the |
|
6904 + local host, and the second only when no primary MX target is the local |
|
6905 + host, but a secondary MX target is. "Primary" means an MX record with the |
|
6906 + lowest preference value - there may of course be more than one of them. |
|
6907 + |
|
6908 + The MX lookup that takes place when matching a pattern of this type is |
|
6909 + performed with the resolver options for widening names turned off. Thus, |
|
6910 + for example, a single-component domain will not be expanded by adding the |
|
6911 + resolver's default domain. See the qualify_single and search_parents |
|
6912 + options of the dnslookup router for a discussion of domain widening. |
|
6913 + |
|
6914 + Sometimes you may want to ignore certain IP addresses when using one of |
|
6915 + these patterns. You can specify this by following the pattern with "/ignore |
|
6916 + ="<ip list>, where <ip list> is a list of IP addresses. These addresses are |
|
6917 + ignored when processing the pattern (compare the ignore_target_hosts option |
|
6918 + on a router). For example: |
|
6919 + |
|
6920 + domains = @mx_any/ignore=127.0.0.1 |
|
6921 + |
|
6922 + This example matches any domain that has an MX record pointing to one of |
|
6923 + the local host's IP addresses other than 127.0.0.1. |
|
6924 + |
|
6925 + The list of IP addresses is in fact processed by the same code that |
|
6926 + processes host lists, so it may contain CIDR-coded network specifications |
|
6927 + and it may also contain negative items. |
|
6928 + |
|
6929 + Because the list of IP addresses is a sublist within a domain list, you |
|
6930 + have to be careful about delimiters if there is more than one address. Like |
|
6931 + any other list, the default delimiter can be changed. Thus, you might have: |
|
6932 + |
|
6933 + domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \ |
|
6934 + an.other.domain : ... |
|
6935 + |
|
6936 + so that the sublist uses semicolons for delimiters. When IPv6 addresses are |
|
6937 + involved, it is easiest to change the delimiter for the main list as well: |
|
6938 + |
|
6939 + domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \ |
|
6940 + an.other.domain ? ... |
|
6941 + |
|
6942 + * If a pattern starts with an asterisk, the remaining characters of the |
|
6943 + pattern are compared with the terminating characters of the domain. The use |
|
6944 + of "*" in domain lists differs from its use in partial matching lookups. In |
|
6945 + a domain list, the character following the asterisk need not be a dot, |
|
6946 + whereas partial matching works only in terms of dot-separated components. |
|
6947 + For example, a domain list item such as "*key.ex" matches donkey.ex as well |
|
6948 + as cipher.key.ex. |
|
6949 + |
|
6950 + * If a pattern starts with a circumflex character, it is treated as a regular |
|
6951 + expression, and matched against the domain using a regular expression |
|
6952 + matching function. The circumflex is treated as part of the regular |
|
6953 + expression. Email domains are case-independent, so this regular expression |
|
6954 + match is by default case-independent, but you can make it case-dependent by |
|
6955 + starting it with "(?-i)". References to descriptions of the syntax of |
|
6956 + regular expressions are given in chapter 8. |
|
6957 + |
|
6958 + Warning: Because domain lists are expanded before being processed, you must |
|
6959 + escape any backslash and dollar characters in the regular expression, or |
|
6960 + use the special "\N" sequence (see chapter 11) to specify that it is not to |
|
6961 + be expanded (unless you really do want to build a regular expression by |
|
6962 + expansion, of course). |
|
6963 + |
|
6964 + * If a pattern starts with the name of a single-key lookup type followed by a |
|
6965 + semicolon (for example, "dbm;" or "lsearch;"), the remainder of the pattern |
|
6966 + must be a file name in a suitable format for the lookup type. For example, |
|
6967 + for "cdb;" it must be an absolute path: |
|
6968 + |
|
6969 + domains = cdb;/etc/mail/local_domains.cdb |
|
6970 + |
|
6971 + The appropriate type of lookup is done on the file using the domain name as |
|
6972 + the key. In most cases, the data that is looked up is not used; Exim is |
|
6973 + interested only in whether or not the key is present in the file. However, |
|
6974 + when a lookup is used for the domains option on a router or a domains |
|
6975 + condition in an ACL statement, the data is preserved in the $domain_data |
|
6976 + variable and can be referred to in other router options or other statements |
|
6977 + in the same ACL. |
|
6978 + |
|
6979 + * Any of the single-key lookup type names may be preceded by "partial"<n>"-", |
|
6980 + where the <n> is optional, for example, |
|
6981 + |
|
6982 + domains = partial-dbm;/partial/domains |
|
6983 + |
|
6984 + This causes partial matching logic to be invoked; a description of how this |
|
6985 + works is given in section 9.7. |
|
6986 + |
|
6987 + * Any of the single-key lookup types may be followed by an asterisk. This |
|
6988 + causes a default lookup for a key consisting of a single asterisk to be |
|
6989 + done if the original lookup fails. This is not a useful feature when using |
|
6990 + a domain list to select particular domains (because any domain would |
|
6991 + match), but it might have value if the result of the lookup is being used |
|
6992 + via the $domain_data expansion variable. |
|
6993 + |
|
6994 + * If the pattern starts with the name of a query-style lookup type followed |
|
6995 + by a semicolon (for example, "nisplus;" or "ldap;"), the remainder of the |
|
6996 + pattern must be an appropriate query for the lookup type, as described in |
|
6997 + chapter 9. For example: |
|
6998 + |
|
6999 + hold_domains = mysql;select domain from holdlist \ |
|
7000 + where domain = '$domain'; |
|
7001 + |
|
7002 + In most cases, the data that is looked up is not used (so for an SQL query, |
|
7003 + for example, it doesn't matter what field you select). Exim is interested |
|
7004 + only in whether or not the query succeeds. However, when a lookup is used |
|
7005 + for the domains option on a router, the data is preserved in the |
|
7006 + $domain_data variable and can be referred to in other options. |
|
7007 + |
|
7008 + * If none of the above cases apply, a caseless textual comparison is made |
|
7009 + between the pattern and the domain. |
|
7010 + |
|
7011 +Here is an example that uses several different kinds of pattern: |
|
7012 + |
|
7013 +domainlist funny_domains = \ |
|
7014 + @ : \ |
|
7015 + lib.unseen.edu : \ |
|
7016 + *.foundation.fict.example : \ |
|
7017 + \N^[1-2]\d{3}\.fict\.example$\N : \ |
|
7018 + partial-dbm;/opt/data/penguin/book : \ |
|
7019 + nis;domains.byname : \ |
|
7020 + nisplus;[name=$domain,status=local],domains.org_dir |
|
7021 + |
|
7022 +There are obvious processing trade-offs among the various matching modes. Using |
|
7023 +an asterisk is faster than a regular expression, and listing a few names |
|
7024 +explicitly probably is too. The use of a file or database lookup is expensive, |
|
7025 +but may be the only option if hundreds of names are required. Because the |
|
7026 +patterns are tested in order, it makes sense to put the most commonly matched |
|
7027 +patterns earlier. |
|
7028 + |
|
7029 +10.9Â Host lists |
|
7030 + |
|
7031 +Host lists are used to control what remote hosts are allowed to do. For |
|
7032 +example, some hosts may be allowed to use the local host as a relay, and some |
|
7033 +may be permitted to use the SMTP ETRN command. Hosts can be identified in two |
|
7034 +different ways, by name or by IP address. In a host list, some types of pattern |
|
7035 +are matched to a host name, and some are matched to an IP address. You need to |
|
7036 +be particularly careful with this when single-key lookups are involved, to |
|
7037 +ensure that the right value is being used as the key. |
|
7038 + |
|
7039 +10.10Â Special host list patterns |
|
7040 + |
|
7041 +If a host list item is the empty string, it matches only when no remote host is |
|
7042 +involved. This is the case when a message is being received from a local |
|
7043 +process using SMTP on the standard input, that is, when a TCP/IP connection is |
|
7044 +not used. |
|
7045 + |
|
7046 +The special pattern "*" in a host list matches any host or no host. Neither the |
|
7047 +IP address nor the name is actually inspected. |
|
7048 + |
|
7049 +10.11Â Host list patterns that match by IP address |
|
7050 + |
|
7051 +If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket, |
|
7052 +the incoming address actually appears in the IPv6 host as "::ffff:"<v4address>. |
|
7053 +When such an address is tested against a host list, it is converted into a |
|
7054 +traditional IPv4 address first. (Not all operating systems accept IPv4 calls on |
|
7055 +IPv6 sockets, as there have been some security concerns.) |
|
7056 + |
|
7057 +The following types of pattern in a host list check the remote host by |
|
7058 +inspecting its IP address: |
|
7059 + |
|
7060 + * If the pattern is a plain domain name (not a regular expression, not |
|
7061 + starting with *, not a lookup of any kind), Exim calls the operating system |
|
7062 + function to find the associated IP address(es). Exim uses the newer |
|
7063 + getipnodebyname() function when available, otherwise gethostbyname(). This |
|
7064 + typically causes a forward DNS lookup of the name. The result is compared |
|
7065 + with the IP address of the subject host. |
|
7066 + |
|
7067 + If there is a temporary problem (such as a DNS timeout) with the host name |
|
7068 + lookup, a temporary error occurs. For example, if the list is being used in |
|
7069 + an ACL condition, the ACL gives a "defer" response, usually leading to a |
|
7070 + temporary SMTP error code. If no IP address can be found for the host name, |
|
7071 + what happens is described in section 10.14 below. |
|
7072 + |
|
7073 + * If the pattern is "@", the primary host name is substituted and used as a |
|
7074 + domain name, as just described. |
|
7075 + |
|
7076 + * If the pattern is an IP address, it is matched against the IP address of |
|
7077 + the subject host. IPv4 addresses are given in the normal "dotted-quad" |
|
7078 + notation. IPv6 addresses can be given in colon-separated format, but the |
|
7079 + colons have to be doubled so as not to be taken as item separators when the |
|
7080 + default list separator is used. IPv6 addresses are recognized even when |
|
7081 + Exim is compiled without IPv6 support. This means that if they appear in a |
|
7082 + host list on an IPv4-only host, Exim will not treat them as host names. |
|
7083 + They are just addresses that can never match a client host. |
|
7084 + |
|
7085 + * If the pattern is "@[]", it matches the IP address of any IP interface on |
|
7086 + the local host. For example, if the local host is an IPv4 host with one |
|
7087 + interface address 10.45.23.56, these two ACL statements have the same |
|
7088 + effect: |
|
7089 + |
|
7090 + accept hosts = 127.0.0.1 : 10.45.23.56 |
|
7091 + accept hosts = @[] |
|
7092 + |
|
7093 + * If the pattern is an IP address followed by a slash and a mask length (for |
|
7094 + example 10.11.42.0/24), it is matched against the IP address of the subject |
|
7095 + host under the given mask. This allows, an entire network of hosts to be |
|
7096 + included (or excluded) by a single item. The mask uses CIDR notation; it |
|
7097 + specifies the number of address bits that must match, starting from the |
|
7098 + most significant end of the address. |
|
7099 + |
|
7100 + Note: The mask is not a count of addresses, nor is it the high number of a |
|
7101 + range of addresses. It is the number of bits in the network portion of the |
|
7102 + address. The above example specifies a 24-bit netmask, so it matches all |
|
7103 + 256 addresses in the 10.11.42.0 network. An item such as |
|
7104 + |
|
7105 + 192.168.23.236/31 |
|
7106 + |
|
7107 + matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value |
|
7108 + of 32 for an IPv4 address is the same as no mask at all; just a single |
|
7109 + address matches. |
|
7110 + |
|
7111 + Here is another example which shows an IPv4 and an IPv6 network: |
|
7112 + |
|
7113 + recipient_unqualified_hosts = 192.168.0.0/16: \ |
|
7114 + 3ffe::ffff::836f::::/48 |
|
7115 + |
|
7116 + The doubling of list separator characters applies only when these items |
|
7117 + appear inline in a host list. It is not required when indirecting via a |
|
7118 + file. For example: |
|
7119 + |
|
7120 + recipient_unqualified_hosts = /opt/exim/unqualnets |
|
7121 + |
|
7122 + could make use of a file containing |
|
7123 + |
|
7124 + 172.16.0.0/12 |
|
7125 + 3ffe:ffff:836f::/48 |
|
7126 + |
|
7127 + to have exactly the same effect as the previous example. When listing IPv6 |
|
7128 + addresses inline, it is usually more convenient to use the facility for |
|
7129 + changing separator characters. This list contains the same two networks: |
|
7130 + |
|
7131 + recipient_unqualified_hosts = <; 172.16.0.0/12; \ |
|
7132 + 3ffe:ffff:836f::/48 |
|
7133 + |
|
7134 + The separator is changed to semicolon by the leading "<;" at the start of |
|
7135 + the list. |
|
7136 + |
|
7137 +10.12Â Host list patterns for single-key lookups by host address |
|
7138 + |
|
7139 +When a host is to be identified by a single-key lookup of its complete IP |
|
7140 +address, the pattern takes this form: |
|
7141 + |
|
7142 +net-<single-key-search-type>;<search-data> |
|
7143 + |
|
7144 +For example: |
|
7145 + |
|
7146 +hosts_lookup = net-cdb;/hosts-by-ip.db |
|
7147 + |
|
7148 +The text form of the IP address of the subject host is used as the lookup key. |
|
7149 +IPv6 addresses are converted to an unabbreviated form, using lower case |
|
7150 +letters, with dots as separators because colon is the key terminator in lsearch |
|
7151 +files. [Colons can in fact be used in keys in lsearch files by quoting the |
|
7152 +keys, but this is a facility that was added later.] The data returned by the |
|
7153 +lookup is not used. |
|
7154 + |
|
7155 +Single-key lookups can also be performed using masked IP addresses, using |
|
7156 +patterns of this form: |
|
7157 + |
|
7158 +net<number>-<single-key-search-type>;<search-data> |
|
7159 + |
|
7160 +For example: |
|
7161 + |
|
7162 +net24-dbm;/networks.db |
|
7163 + |
|
7164 +The IP address of the subject host is masked using <number> as the mask length. |
|
7165 +A textual string is constructed from the masked value, followed by the mask, |
|
7166 +and this is used as the lookup key. For example, if the host's IP address is |
|
7167 +192.168.34.6, the key that is looked up for the above example is "192.168.34.0/ |
|
7168 +24". |
|
7169 + |
|
7170 +When an IPv6 address is converted to a string, dots are normally used instead |
|
7171 +of colons, so that keys in lsearch files need not contain colons (which |
|
7172 +terminate lsearch keys). This was implemented some time before the ability to |
|
7173 +quote keys was made available in lsearch files. However, the more recently |
|
7174 +implemented iplsearch files do require colons in IPv6 keys (notated using the |
|
7175 +quoting facility) so as to distinguish them from IPv4 keys. For this reason, |
|
7176 +when the lookup type is iplsearch, IPv6 addresses are converted using colons |
|
7177 +and not dots. In all cases, full, unabbreviated IPv6 addresses are always used. |
|
7178 + |
|
7179 +Ideally, it would be nice to tidy up this anomalous situation by changing to |
|
7180 +colons in all cases, given that quoting is now available for lsearch. However, |
|
7181 +this would be an incompatible change that might break some existing |
|
7182 +configurations. |
|
7183 + |
|
7184 +Warning: Specifying net32- (for an IPv4 address) or net128- (for an IPv6 |
|
7185 +address) is not the same as specifying just net- without a number. In the |
|
7186 +former case the key strings include the mask value, whereas in the latter case |
|
7187 +the IP address is used on its own. |
|
7188 + |
|
7189 +10.13Â Host list patterns that match by host name |
|
7190 + |
|
7191 +There are several types of pattern that require Exim to know the name of the |
|
7192 +remote host. These are either wildcard patterns or lookups by name. (If a |
|
7193 +complete hostname is given without any wildcarding, it is used to find an IP |
|
7194 +address to match against, as described in the section 10.11 above.) |
|
7195 + |
|
7196 +If the remote host name is not already known when Exim encounters one of these |
|
7197 +patterns, it has to be found from the IP address. Although many sites on the |
|
7198 +Internet are conscientious about maintaining reverse DNS data for their hosts, |
|
7199 +there are also many that do not do this. Consequently, a name cannot always be |
|
7200 +found, and this may lead to unwanted effects. Take care when configuring host |
|
7201 +lists with wildcarded name patterns. Consider what will happen if a name cannot |
|
7202 +be found. |
|
7203 + |
|
7204 +Because of the problems of determining host names from IP addresses, matching |
|
7205 +against host names is not as common as matching against IP addresses. |
|
7206 + |
|
7207 +By default, in order to find a host name, Exim first does a reverse DNS lookup; |
|
7208 +if no name is found in the DNS, the system function (gethostbyaddr() or |
|
7209 +getipnodebyaddr() if available) is tried. The order in which these lookups are |
|
7210 +done can be changed by setting the host_lookup_order option. For security, once |
|
7211 +Exim has found one or more names, it looks up the IP addresses for these names |
|
7212 +and compares them with the IP address that it started with. Only those names |
|
7213 +whose IP addresses match are accepted. Any other names are discarded. If no |
|
7214 +names are left, Exim behaves as if the host name cannot be found. In the most |
|
7215 +common case there is only one name and one IP address. |
|
7216 + |
|
7217 +There are some options that control what happens if a host name cannot be |
|
7218 +found. These are described in section 10.14 below. |
|
7219 + |
|
7220 +As a result of aliasing, hosts may have more than one name. When processing any |
|
7221 +of the following types of pattern, all the host's names are checked: |
|
7222 + |
|
7223 + * If a pattern starts with "*" the remainder of the item must match the end |
|
7224 + of the host name. For example, "*.b.c" matches all hosts whose names end in |
|
7225 + .b.c. This special simple form is provided because this is a very common |
|
7226 + requirement. Other kinds of wildcarding require the use of a regular |
|
7227 + expression. |
|
7228 + |
|
7229 + * If the item starts with "^" it is taken to be a regular expression which is |
|
7230 + matched against the host name. Host names are case-independent, so this |
|
7231 + regular expression match is by default case-independent, but you can make |
|
7232 + it case-dependent by starting it with "(?-i)". References to descriptions |
|
7233 + of the syntax of regular expressions are given in chapter 8. For example, |
|
7234 + |
|
7235 + ^(a|b)\.c\.d$ |
|
7236 + |
|
7237 + is a regular expression that matches either of the two hosts a.c.d or b.c.d |
|
7238 + . When a regular expression is used in a host list, you must take care that |
|
7239 + backslash and dollar characters are not misinterpreted as part of the |
|
7240 + string expansion. The simplest way to do this is to use "\N" to mark that |
|
7241 + part of the string as non-expandable. For example: |
|
7242 + |
|
7243 + sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : .... |
|
7244 + |
|
7245 + Warning: If you want to match a complete host name, you must include the |
|
7246 + "$" terminating metacharacter in the regular expression, as in the above |
|
7247 + example. Without it, a match at the start of the host name is all that is |
|
7248 + required. |
|
7249 + |
|
7250 +10.14Â Behaviour when an IP address or name cannot be found |
|
7251 + |
|
7252 +While processing a host list, Exim may need to look up an IP address from a |
|
7253 +name (see section 10.11), or it may need to look up a host name from an IP |
|
7254 +address (see section 10.13). In either case, the behaviour when it fails to |
|
7255 +find the information it is seeking is the same. |
|
7256 + |
|
7257 +Note: This section applies to permanent lookup failures. It does not apply to |
|
7258 +temporary DNS errors, whose handling is described in the next section. |
|
7259 + |
|
7260 +By default, Exim behaves as if the host does not match the list. This may not |
|
7261 +always be what you want to happen. To change Exim's behaviour, the special |
|
7262 +items "+include_unknown" or "+ignore_unknown" may appear in the list (at top |
|
7263 +level - they are not recognized in an indirected file). |
|
7264 + |
|
7265 + * If any item that follows "+include_unknown" requires information that |
|
7266 + cannot found, Exim behaves as if the host does match the list. For example, |
|
7267 + |
|
7268 + host_reject_connection = +include_unknown:*.enemy.ex |
|
7269 + |
|
7270 + rejects connections from any host whose name matches "*.enemy.ex", and also |
|
7271 + any hosts whose name it cannot find. |
|
7272 + |
|
7273 + * If any item that follows "+ignore_unknown" requires information that cannot |
|
7274 + be found, Exim ignores that item and proceeds to the rest of the list. For |
|
7275 + example: |
|
7276 + |
|
7277 + accept hosts = +ignore_unknown : friend.example : \ |
|
7278 + 192.168.4.5 |
|
7279 + |
|
7280 + accepts from any host whose name is friend.example and from 192.168.4.5, |
|
7281 + whether or not its host name can be found. Without "+ignore_unknown", if no |
|
7282 + name can be found for 192.168.4.5, it is rejected. |
|
7283 + |
|
7284 +Both "+include_unknown" and "+ignore_unknown" may appear in the same list. The |
|
7285 +effect of each one lasts until the next, or until the end of the list. |
|
7286 + |
|
7287 +10.15Â Temporary DNS errors when looking up host information |
|
7288 + |
|
7289 +A temporary DNS lookup failure normally causes a defer action (except when |
|
7290 +dns_again_means_nonexist converts it into a permanent error). However, host |
|
7291 +lists can include "+ignore_defer" and "+include_defer", analagous to |
|
7292 +"+ignore_unknown" and "+include_unknown", as described in the previous section. |
|
7293 +These options should be used with care, probably only in non-critical host |
|
7294 +lists such as whitelists. |
|
7295 + |
|
7296 +10.16Â Host list patterns for single-key lookups by host name |
|
7297 + |
|
7298 +If a pattern is of the form |
|
7299 + |
|
7300 +<single-key-search-type>;<search-data> |
|
7301 + |
|
7302 +for example |
|
7303 + |
|
7304 +dbm;/host/accept/list |
|
7305 + |
|
7306 +a single-key lookup is performed, using the host name as its key. If the lookup |
|
7307 +succeeds, the host matches the item. The actual data that is looked up is not |
|
7308 +used. |
|
7309 + |
|
7310 +Reminder: With this kind of pattern, you must have host names as keys in the |
|
7311 +file, not IP addresses. If you want to do lookups based on IP addresses, you |
|
7312 +must precede the search type with "net-" (see section 10.12). There is, |
|
7313 +however, no reason why you could not use two items in the same list, one doing |
|
7314 +an address lookup and one doing a name lookup, both using the same file. |
|
7315 + |
|
7316 +10.17Â Host list patterns for query-style lookups |
|
7317 + |
|
7318 +If a pattern is of the form |
|
7319 + |
|
7320 +<query-style-search-type>;<query> |
|
7321 + |
|
7322 +the query is obeyed, and if it succeeds, the host matches the item. The actual |
|
7323 +data that is looked up is not used. The variables $sender_host_address and |
|
7324 +$sender_host_name can be used in the query. For example: |
|
7325 + |
|
7326 +hosts_lookup = pgsql;\ |
|
7327 + select ip from hostlist where ip='$sender_host_address' |
|
7328 + |
|
7329 +The value of $sender_host_address for an IPv6 address contains colons. You can |
|
7330 +use the sg expansion item to change this if you need to. If you want to use |
|
7331 +masked IP addresses in database queries, you can use the mask expansion |
|
7332 +operator. |
|
7333 + |
|
7334 +If the query contains a reference to $sender_host_name, Exim automatically |
|
7335 +looks up the host name if has not already done so. (See section 10.13 for |
|
7336 +comments on finding host names.) |
|
7337 + |
|
7338 +Historical note: prior to release 4.30, Exim would always attempt to find a |
|
7339 +host name before running the query, unless the search type was preceded by |
|
7340 +"net-". This is no longer the case. For backwards compatibility, "net-" is |
|
7341 +still recognized for query-style lookups, but its presence or absence has no |
|
7342 +effect. (Of course, for single-key lookups, "net-" is important. See section |
|
7343 +10.12.) |
|
7344 + |
|
7345 +10.18Â Mixing wildcarded host names and addresses in host lists |
|
7346 + |
|
7347 +If you have name lookups or wildcarded host names and IP addresses in the same |
|
7348 +host list, you should normally put the IP addresses first. For example, in an |
|
7349 +ACL you could have: |
|
7350 + |
|
7351 +accept hosts = 10.9.8.7 : *.friend.example |
|
7352 + |
|
7353 +The reason for this lies in the left-to-right way that Exim processes lists. It |
|
7354 +can test IP addresses without doing any DNS lookups, but when it reaches an |
|
7355 +item that requires a host name, it fails if it cannot find a host name to |
|
7356 +compare with the pattern. If the above list is given in the opposite order, the |
|
7357 +accept statement fails for a host whose name cannot be found, even if its IP |
|
7358 +address is 10.9.8.7. |
|
7359 + |
|
7360 +If you really do want to do the name check first, and still recognize the IP |
|
7361 +address, you can rewrite the ACL like this: |
|
7362 + |
|
7363 +accept hosts = *.friend.example |
|
7364 +accept hosts = 10.9.8.7 |
|
7365 + |
|
7366 +If the first accept fails, Exim goes on to try the second one. See chapter 40 |
|
7367 +for details of ACLs. |
|
7368 + |
|
7369 +10.19Â Address lists |
|
7370 + |
|
7371 +Address lists contain patterns that are matched against mail addresses. There |
|
7372 +is one special case to be considered: the sender address of a bounce message is |
|
7373 +always empty. You can test for this by providing an empty item in an address |
|
7374 +list. For example, you can set up a router to process bounce messages by using |
|
7375 +this option setting: |
|
7376 + |
|
7377 +senders = : |
|
7378 + |
|
7379 +The presence of the colon creates an empty item. If you do not provide any |
|
7380 +data, the list is empty and matches nothing. The empty sender can also be |
|
7381 +detected by a regular expression that matches an empty string, and by a |
|
7382 +query-style lookup that succeeds when $sender_address is empty. |
|
7383 + |
|
7384 +Non-empty items in an address list can be straightforward email addresses. For |
|
7385 +example: |
|
7386 + |
|
7387 +senders = jbc@askone.example : hs@anacreon.example |
|
7388 + |
|
7389 +A certain amount of wildcarding is permitted. If a pattern contains an @ |
|
7390 +character, but is not a regular expression and does not begin with a |
|
7391 +semicolon-terminated lookup type (described below), the local part of the |
|
7392 +subject address is compared with the local part of the pattern, which may start |
|
7393 +with an asterisk. If the local parts match, the domain is checked in exactly |
|
7394 +the same way as for a pattern in a domain list. For example, the domain can be |
|
7395 +wildcarded, refer to a named list, or be a lookup: |
|
7396 + |
|
7397 +deny senders = *@*.spamming.site:\ |
|
7398 + *@+hostile_domains:\ |
|
7399 + bozo@partial-lsearch;/list/of/dodgy/sites:\ |
|
7400 + *@dbm;/bad/domains.db |
|
7401 + |
|
7402 +If a local part that begins with an exclamation mark is required, it has to be |
|
7403 +specified using a regular expression, because otherwise the exclamation mark is |
|
7404 +treated as a sign of negation, as is standard in lists. |
|
7405 + |
|
7406 +If a non-empty pattern that is not a regular expression or a lookup does not |
|
7407 +contain an @ character, it is matched against the domain part of the subject |
|
7408 +address. The only two formats that are recognized this way are a literal |
|
7409 +domain, or a domain pattern that starts with *. In both these cases, the effect |
|
7410 +is the same as if "*@" preceded the pattern. For example: |
|
7411 + |
|
7412 +deny senders = enemy.domain : *.enemy.domain |
|
7413 + |
|
7414 +The following kinds of more complicated address list pattern can match any |
|
7415 +address, including the empty address that is characteristic of bounce message |
|
7416 +senders: |
|
7417 + |
|
7418 + * If (after expansion) a pattern starts with "^", a regular expression match |
|
7419 + is done against the complete address, with the pattern as the regular |
|
7420 + expression. You must take care that backslash and dollar characters are not |
|
7421 + misinterpreted as part of the string expansion. The simplest way to do this |
|
7422 + is to use "\N" to mark that part of the string as non-expandable. For |
|
7423 + example: |
|
7424 + |
|
7425 + deny senders = \N^.*this.*@example\.com$\N : \ |
|
7426 + \N^\d{8}.+@spamhaus.example$\N : ... |
|
7427 + |
|
7428 + The "\N" sequences are removed by the expansion, so these items do indeed |
|
7429 + start with "^" by the time they are being interpreted as address patterns. |
|
7430 + |
|
7431 + * Complete addresses can be looked up by using a pattern that starts with a |
|
7432 + lookup type terminated by a semicolon, followed by the data for the lookup. |
|
7433 + For example: |
|
7434 + |
|
7435 + deny senders = cdb;/etc/blocked.senders : \ |
|
7436 + mysql;select address from blocked where \ |
|
7437 + address='${quote_mysql:$sender_address}' |
|
7438 + |
|
7439 + Both query-style and single-key lookup types can be used. For a single-key |
|
7440 + lookup type, Exim uses the complete address as the key. However, empty keys |
|
7441 + are not supported for single-key lookups, so a match against the empty |
|
7442 + address always fails. This restriction does not apply to query-style |
|
7443 + lookups. |
|
7444 + |
|
7445 + Partial matching for single-key lookups (section 9.7) cannot be used, and |
|
7446 + is ignored if specified, with an entry being written to the panic log. |
|
7447 + However, you can configure lookup defaults, as described in section 9.6, |
|
7448 + but this is useful only for the "*@" type of default. For example, with |
|
7449 + this lookup: |
|
7450 + |
|
7451 + accept senders = lsearch*@;/some/file |
|
7452 + |
|
7453 + the file could contains lines like this: |
|
7454 + |
|
7455 + user1@domain1.example |
|
7456 + *@domain2.example |
|
7457 + |
|
7458 + and for the sender address nimrod@jaeger.example, the sequence of keys that |
|
7459 + are tried is: |
|
7460 + |
|
7461 + nimrod@jaeger.example |
|
7462 + *@jaeger.example |
|
7463 + * |
|
7464 + |
|
7465 + Warning 1: Do not include a line keyed by "*" in the file, because that |
|
7466 + would mean that every address matches, thus rendering the test useless. |
|
7467 + |
|
7468 + Warning 2: Do not confuse these two kinds of item: |
|
7469 + |
|
7470 + deny recipients = dbm*@;/some/file |
|
7471 + deny recipients = *@dbm;/some/file |
|
7472 + |
|
7473 + The first does a whole address lookup, with defaulting, as just described, |
|
7474 + because it starts with a lookup type. The second matches the local part and |
|
7475 + domain independently, as described in a bullet point below. |
|
7476 + |
|
7477 +The following kinds of address list pattern can match only non-empty addresses. |
|
7478 +If the subject address is empty, a match against any of these pattern types |
|
7479 +always fails. |
|
7480 + |
|
7481 + * If a pattern starts with "@@" followed by a single-key lookup item (for |
|
7482 + example, "@@lsearch;/some/file"), the address that is being checked is |
|
7483 + split into a local part and a domain. The domain is looked up in the file. |
|
7484 + If it is not found, there is no match. If it is found, the data that is |
|
7485 + looked up from the file is treated as a colon-separated list of local part |
|
7486 + patterns, each of which is matched against the subject local part in turn. |
|
7487 + |
|
7488 + The lookup may be a partial one, and/or one involving a search for a |
|
7489 + default keyed by "*" (see section 9.6). The local part patterns that are |
|
7490 + looked up can be regular expressions or begin with "*", or even be further |
|
7491 + lookups. They may also be independently negated. For example, with |
|
7492 + |
|
7493 + deny senders = @@dbm;/etc/reject-by-domain |
|
7494 + |
|
7495 + the data from which the DBM file is built could contain lines like |
|
7496 + |
|
7497 + baddomain.com: !postmaster : * |
|
7498 + |
|
7499 + to reject all senders except postmaster from that domain. |
|
7500 + |
|
7501 + If a local part that actually begins with an exclamation mark is required, |
|
7502 + it has to be specified using a regular expression. In lsearch files, an |
|
7503 + entry may be split over several lines by indenting the second and |
|
7504 + subsequent lines, but the separating colon must still be included at line |
|
7505 + breaks. White space surrounding the colons is ignored. For example: |
|
7506 + |
|
7507 + aol.com: spammer1 : spammer2 : ^[0-9]+$ : |
|
7508 + spammer3 : spammer4 |
|
7509 + |
|
7510 + As in all colon-separated lists in Exim, a colon can be included in an item |
|
7511 + by doubling. |
|
7512 + |
|
7513 + If the last item in the list starts with a right angle-bracket, the |
|
7514 + remainder of the item is taken as a new key to look up in order to obtain a |
|
7515 + continuation list of local parts. The new key can be any sequence of |
|
7516 + characters. Thus one might have entries like |
|
7517 + |
|
7518 + aol.com: spammer1 : spammer 2 : >* |
|
7519 + xyz.com: spammer3 : >* |
|
7520 + *: ^\d{8}$ |
|
7521 + |
|
7522 + in a file that was searched with @@dbm*, to specify a match for 8-digit |
|
7523 + local parts for all domains, in addition to the specific local parts listed |
|
7524 + for each domain. Of course, using this feature costs another lookup each |
|
7525 + time a chain is followed, but the effort needed to maintain the data is |
|
7526 + reduced. |
|
7527 + |
|
7528 + It is possible to construct loops using this facility, and in order to |
|
7529 + catch them, the chains may be no more than fifty items long. |
|
7530 + |
|
7531 + * The @@<lookup> style of item can also be used with a query-style lookup, |
|
7532 + but in this case, the chaining facility is not available. The lookup can |
|
7533 + only return a single list of local parts. |
|
7534 + |
|
7535 +Warning: There is an important difference between the address list items in |
|
7536 +these two examples: |
|
7537 + |
|
7538 +senders = +my_list |
|
7539 +senders = *@+my_list |
|
7540 + |
|
7541 +In the first one, "my_list" is a named address list, whereas in the second |
|
7542 +example it is a named domain list. |
|
7543 + |
|
7544 +10.20Â Case of letters in address lists |
|
7545 + |
|
7546 +Domains in email addresses are always handled caselessly, but for local parts |
|
7547 +case may be significant on some systems (see caseful_local_part for how Exim |
|
7548 +deals with this when routing addresses). However, RFC 2505 (Anti-Spam |
|
7549 +Recommendations for SMTP MTAs) suggests that matching of addresses to blocking |
|
7550 +lists should be done in a case-independent manner. Since most address lists in |
|
7551 +Exim are used for this kind of control, Exim attempts to do this by default. |
|
7552 + |
|
7553 +The domain portion of an address is always lowercased before matching it to an |
|
7554 +address list. The local part is lowercased by default, and any string |
|
7555 +comparisons that take place are done caselessly. This means that the data in |
|
7556 +the address list itself, in files included as plain file names, and in any file |
|
7557 +that is looked up using the "@@" mechanism, can be in any case. However, the |
|
7558 +keys in files that are looked up by a search type other than lsearch (which |
|
7559 +works caselessly) must be in lower case, because these lookups are not |
|
7560 +case-independent. |
|
7561 + |
|
7562 +To allow for the possibility of caseful address list matching, if an item in an |
|
7563 +address list is the string "+caseful", the original case of the local part is |
|
7564 +restored for any comparisons that follow, and string comparisons are no longer |
|
7565 +case-independent. This does not affect the domain, which remains in lower case. |
|
7566 +However, although independent matches on the domain alone are still performed |
|
7567 +caselessly, regular expressions that match against an entire address become |
|
7568 +case-sensitive after "+caseful" has been seen. |
|
7569 + |
|
7570 +10.21Â Local part lists |
|
7571 + |
|
7572 +Case-sensitivity in local part lists is handled in the same way as for address |
|
7573 +lists, as just described. The "+caseful" item can be used if required. In a |
|
7574 +setting of the local_parts option in a router with caseful_local_part set |
|
7575 +false, the subject is lowercased and the matching is initially |
|
7576 +case-insensitive. In this case, "+caseful" will restore case-sensitive matching |
|
7577 +in the local part list, but not elsewhere in the router. If caseful_local_part |
|
7578 +is set true in a router, matching in the local_parts option is case-sensitive |
|
7579 +from the start. |
|
7580 + |
|
7581 +If a local part list is indirected to a file (see section 10.3), comments are |
|
7582 +handled in the same way as address lists - they are recognized only if the # is |
|
7583 +preceded by white space or the start of the line. Otherwise, local part lists |
|
7584 +are matched in the same way as domain lists, except that the special items that |
|
7585 +refer to the local host ("@", "@[]", "@mx_any", "@mx_primary", and |
|
7586 +"@mx_secondary") are not recognized. Refer to section 10.8 for details of the |
|
7587 +other available item types. |
|
7588 + |
|
7589 +11. String expansions |
|
7590 + |
|
7591 +Many strings in Exim's run time configuration are expanded before use. Some of |
|
7592 +them are expanded every time they are used; others are expanded only once. |
|
7593 + |
|
7594 +When a string is being expanded it is copied verbatim from left to right except |
|
7595 +when a dollar or backslash character is encountered. A dollar specifies the |
|
7596 +start of a portion of the string that is interpreted and replaced as described |
|
7597 +below in section 11.5 onwards. Backslash is used as an escape character, as |
|
7598 +described in the following section. |
|
7599 + |
|
7600 +11.1Â Literal text in expanded strings |
|
7601 + |
|
7602 +An uninterpreted dollar can be included in an expanded string by putting a |
|
7603 +backslash in front of it. A backslash can be used to prevent any special |
|
7604 +character being treated specially in an expansion, including backslash itself. |
|
7605 +If the string appears in quotes in the configuration file, two backslashes are |
|
7606 +required because the quotes themselves cause interpretation of backslashes when |
|
7607 +the string is read in (see section 6.16). |
|
7608 + |
|
7609 +A portion of the string can specified as non-expandable by placing it between |
|
7610 +two occurrences of "\N". This is particularly useful for protecting regular |
|
7611 +expressions, which often contain backslashes and dollar signs. For example: |
|
7612 + |
|
7613 +deny senders = \N^\d{8}[a-z]@some\.site\.example$\N |
|
7614 + |
|
7615 +On encountering the first "\N", the expander copies subsequent characters |
|
7616 +without interpretation until it reaches the next "\N" or the end of the string. |
|
7617 + |
|
7618 +11.2Â Character escape sequences in expanded strings |
|
7619 + |
|
7620 +A backslash followed by one of the letters "n", "r", or "t" in an expanded |
|
7621 +string is recognized as an escape sequence for the character newline, carriage |
|
7622 +return, or tab, respectively. A backslash followed by up to three octal digits |
|
7623 +is recognized as an octal encoding for a single character, and a backslash |
|
7624 +followed by "x" and up to two hexadecimal digits is a hexadecimal encoding. |
|
7625 + |
|
7626 +These escape sequences are also recognized in quoted strings when they are read |
|
7627 +in. Their interpretation in expansions as well is useful for unquoted strings, |
|
7628 +and for other cases such as looked-up strings that are then expanded. |
|
7629 + |
|
7630 +11.3Â Testing string expansions |
|
7631 + |
|
7632 +Many expansions can be tested by calling Exim with the -be option. This takes |
|
7633 +the command arguments, or lines from the standard input if there are no |
|
7634 +arguments, runs them through the string expansion code, and writes the results |
|
7635 +to the standard output. Variables based on configuration values are set up, but |
|
7636 +since no message is being processed, variables such as $local_part have no |
|
7637 +value. Nevertheless the -be option can be useful for checking out file and |
|
7638 +database lookups, and the use of expansion operators such as sg, substr and |
|
7639 +nhash. |
|
7640 + |
|
7641 +Exim gives up its root privilege when it is called with the -be option, and |
|
7642 +instead runs under the uid and gid it was called with, to prevent users from |
|
7643 +using -be for reading files to which they do not have access. |
|
7644 + |
|
7645 +If you want to test expansions that include variables whose values are taken |
|
7646 +from a message, there are two other options that can be used. The -bem option |
|
7647 +is like -be except that it is followed by a file name. The file is read as a |
|
7648 +message before doing the test expansions. For example: |
|
7649 + |
|
7650 +exim -bem /tmp/test.message '$h_subject:' |
|
7651 + |
|
7652 +The -Mset option is used in conjunction with -be and is followed by an Exim |
|
7653 +message identifier. For example: |
|
7654 + |
|
7655 +exim -be -Mset 1GrA8W-0004WS-LQ '$recipients' |
|
7656 + |
|
7657 +This loads the message from Exim's spool before doing the test expansions, and |
|
7658 +is therefore restricted to admin users. |
|
7659 + |
|
7660 +11.4Â Forced expansion failure |
|
7661 + |
|
7662 +A number of expansions that are described in the following section have |
|
7663 +alternative "true" and "false" substrings, enclosed in brace characters (which |
|
7664 +are sometimes called "curly brackets"). Which of the two strings is used |
|
7665 +depends on some condition that is evaluated as part of the expansion. If, |
|
7666 +instead of a "false" substring, the word "fail" is used (not in braces), the |
|
7667 +entire string expansion fails in a way that can be detected by the code that |
|
7668 +requested the expansion. This is called "forced expansion failure", and its |
|
7669 +consequences depend on the circumstances. In some cases it is no different from |
|
7670 +any other expansion failure, but in others a different action may be taken. |
|
7671 +Such variations are mentioned in the documentation of the option that is being |
|
7672 +expanded. |
|
7673 + |
|
7674 +11.5Â Expansion items |
|
7675 + |
|
7676 +The following items are recognized in expanded strings. White space may be used |
|
7677 +between sub-items that are keywords or substrings enclosed in braces inside an |
|
7678 +outer set of braces, to improve readability. Warning: Within braces, white |
|
7679 +space is significant. |
|
7680 + |
|
7681 +$<variable name> or ${<variable name>} |
|
7682 + |
|
7683 + Substitute the contents of the named variable, for example: |
|
7684 + |
|
7685 + $local_part |
|
7686 + ${domain} |
|
7687 + |
|
7688 + The second form can be used to separate the name from subsequent |
|
7689 + alphanumeric characters. This form (using braces) is available only for |
|
7690 + variables; it does not apply to message headers. The names of the variables |
|
7691 + are given in section 11.9 below. If the name of a non-existent variable is |
|
7692 + given, the expansion fails. |
|
7693 + |
|
7694 +${<op>:<string>} |
|
7695 + |
|
7696 + The string is first itself expanded, and then the operation specified by < |
|
7697 + op> is applied to it. For example: |
|
7698 + |
|
7699 + ${lc:$local_part} |
|
7700 + |
|
7701 + The string starts with the first character after the colon, which may be |
|
7702 + leading white space. A list of operators is given in section 11.6 below. |
|
7703 + The operator notation is used for simple expansion items that have just one |
|
7704 + argument, because it reduces the number of braces and therefore makes the |
|
7705 + string easier to understand. |
|
7706 + |
|
7707 +$bheader_<header name>: or $bh_<header name>: |
|
7708 + |
|
7709 + This item inserts "basic" header lines. It is described with the header |
|
7710 + expansion item below. |
|
7711 + |
|
7712 +${dlfunc{<file>}{<function>}{<arg>}{<arg>}...} |
|
7713 + |
|
7714 + This expansion dynamically loads and then calls a locally-written C |
|
7715 + function. This functionality is available only if Exim is compiled with |
|
7716 + |
|
7717 + EXPAND_DLFUNC=yes |
|
7718 + |
|
7719 + set in Local/Makefile. Once loaded, Exim remembers the dynamically loaded |
|
7720 + object so that it doesn't reload the same object file in the same Exim |
|
7721 + process (but of course Exim does start new processes frequently). |
|
7722 + |
|
7723 + There may be from zero to eight arguments to the function. When compiling a |
|
7724 + local function that is to be called in this way, local_scan.h should be |
|
7725 + included. The Exim variables and functions that are defined by that API are |
|
7726 + also available for dynamically loaded functions. The function itself must |
|
7727 + have the following type: |
|
7728 + |
|
7729 + int dlfunction(uschar **yield, int argc, uschar *argv[]) |
|
7730 + |
|
7731 + Where "uschar" is a typedef for "unsigned char" in local_scan.h. The |
|
7732 + function should return one of the following values: |
|
7733 + |
|
7734 + "OK": Success. The string that is placed in the variable yield is put into |
|
7735 + the expanded string that is being built. |
|
7736 + |
|
7737 + "FAIL": A non-forced expansion failure occurs, with the error message taken |
|
7738 + from yield, if it is set. |
|
7739 + |
|
7740 + "FAIL_FORCED": A forced expansion failure occurs, with the error message |
|
7741 + taken from yield if it is set. |
|
7742 + |
|
7743 + "ERROR": Same as "FAIL", except that a panic log entry is written. |
|
7744 + |
|
7745 + When compiling a function that is to be used in this way with gcc, you need |
|
7746 + to add -shared to the gcc command. Also, in the Exim build-time |
|
7747 + configuration, you must add -export-dynamic to EXTRALIBS. |
|
7748 + |
|
7749 +${extract{<key>}{<string1>}{<string2>}{<string3>}} |
|
7750 + |
|
7751 + The key and <string1> are first expanded separately. Leading and trailing |
|
7752 + white space is removed from the key (but not from any of the strings). The |
|
7753 + key must not consist entirely of digits. The expanded <string1> must be of |
|
7754 + the form: |
|
7755 + |
|
7756 + <key1>Â =Â <value1>Â Â <key2>Â =Â <value2>Â ... |
|
7757 + |
|
7758 + where the equals signs and spaces (but not both) are optional. If any of |
|
7759 + the values contain white space, they must be enclosed in double quotes, and |
|
7760 + any values that are enclosed in double quotes are subject to escape |
|
7761 + processing as described in section 6.16. The expanded <string1> is searched |
|
7762 + for the value that corresponds to the key. The search is case-insensitive. |
|
7763 + If the key is found, <string2> is expanded, and replaces the whole item; |
|
7764 + otherwise <string3> is used. During the expansion of <string2> the variable |
|
7765 + $value contains the value that has been extracted. Afterwards, it is |
|
7766 + restored to any previous value it might have had. |
|
7767 + |
|
7768 + If {<string3>} is omitted, the item is replaced by an empty string if the |
|
7769 + key is not found. If {<string2>} is also omitted, the value that was |
|
7770 + extracted is used. Thus, for example, these two expansions are identical, |
|
7771 + and yield "2001": |
|
7772 + |
|
7773 + ${extract{gid}{uid=1984 gid=2001}} |
|
7774 + ${extract{gid}{uid=1984 gid=2001}{$value}} |
|
7775 + |
|
7776 + Instead of {<string3>} the word "fail" (not in curly brackets) can appear, |
|
7777 + for example: |
|
7778 + |
|
7779 + ${extract{Z}{A=... B=...}{$value} fail } |
|
7780 + |
|
7781 + This forces an expansion failure (see section 11.4); {<string2>} must be |
|
7782 + present for "fail" to be recognized. |
|
7783 + |
|
7784 +${extract{<number>}{<separators>}{<string1>}{<string2>}{<string3>}} |
|
7785 + |
|
7786 + The <number> argument must consist entirely of decimal digits, apart from |
|
7787 + leading and trailing white space, which is ignored. This is what |
|
7788 + distinguishes this form of extract from the previous kind. It behaves in |
|
7789 + the same way, except that, instead of extracting a named field, it extracts |
|
7790 + from <string1> the field whose number is given as the first argument. You |
|
7791 + can use $value in <string2> or "fail" instead of <string3> as before. |
|
7792 + |
|
7793 + The fields in the string are separated by any one of the characters in the |
|
7794 + separator string. These may include space or tab characters. The first |
|
7795 + field is numbered one. If the number is negative, the fields are counted |
|
7796 + from the end of the string, with the rightmost one numbered -1. If the |
|
7797 + number given is zero, the entire string is returned. If the modulus of the |
|
7798 + number is greater than the number of fields in the string, the result is |
|
7799 + the expansion of <string3>, or the empty string if <string3> is not |
|
7800 + provided. For example: |
|
7801 + |
|
7802 + ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}} |
|
7803 + |
|
7804 + yields "42", and |
|
7805 + |
|
7806 + ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}} |
|
7807 + |
|
7808 + yields "99". Two successive separators mean that the field between them is |
|
7809 + empty (for example, the fifth field above). |
|
7810 + |
|
7811 +${filter{<string>}{<condition>}} |
|
7812 + |
|
7813 + After expansion, <string> is interpreted as a list, colon-separated by |
|
7814 + default, but the separator can be changed in the usual way. For each item |
|
7815 + in this list, its value is place in $item, and then the condition is |
|
7816 + evaluated. If the condition is true, $item is added to the output as an |
|
7817 + item in a new list; if the condition is false, the item is discarded. The |
|
7818 + separator used for the output list is the same as the one used for the |
|
7819 + input, but a separator setting is not included in the output. For example: |
|
7820 + |
|
7821 + ${filter{a:b:c}{!eq{$item}{b}} |
|
7822 + |
|
7823 + yields "a:c". At the end of the expansion, the value of $item is restored |
|
7824 + to what it was before. See also the map and reduce expansion items. |
|
7825 + |
|
7826 +${hash{<string1>}{<string2>}{<string3>}} |
|
7827 + |
|
7828 + This is a textual hashing function, and was the first to be implemented in |
|
7829 + early versions of Exim. In current releases, there are other hashing |
|
7830 + functions (numeric, MD5, and SHA-1), which are described below. |
|
7831 + |
|
7832 + The first two strings, after expansion, must be numbers. Call them <m> and |
|
7833 + <n>. If you are using fixed values for these numbers, that is, if <string1> |
|
7834 + and <string2> do not change when they are expanded, you can use the simpler |
|
7835 + operator notation that avoids some of the braces: |
|
7836 + |
|
7837 + ${hash_<n>_<m>:<string>} |
|
7838 + |
|
7839 + The second number is optional (in both notations). If <n> is greater than |
|
7840 + or equal to the length of the string, the expansion item returns the |
|
7841 + string. Otherwise it computes a new string of length <n> by applying a |
|
7842 + hashing function to the string. The new string consists of characters taken |
|
7843 + from the first <m> characters of the string |
|
7844 + |
|
7845 + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789 |
|
7846 + |
|
7847 + If <m> is not present the value 26 is used, so that only lower case letters |
|
7848 + appear. For example: |
|
7849 + |
|
7850 + $hash{3}{monty}}              yields  jmg |
|
7851 + $hash{5}{monty}}              yields  monty |
|
7852 + $hash{4}{62}{monty python}}   yields  fbWx |
|
7853 + |
|
7854 +$header_<header name>: or $h_<header name>:, $bheader_<header name |
|
7855 + >: or $bh_<header name>:, $rheader_<header name>: or $rh_< |
|
7856 + header name>: |
|
7857 + |
|
7858 + Substitute the contents of the named message header line, for example |
|
7859 + |
|
7860 + $header_reply-to: |
|
7861 + |
|
7862 + The newline that terminates a header line is not included in the expansion, |
|
7863 + but internal newlines (caused by splitting the header line over several |
|
7864 + physical lines) may be present. |
|
7865 + |
|
7866 + The difference between rheader, bheader, and header is in the way the data |
|
7867 + in the header line is interpreted. |
|
7868 + |
|
7869 + * rheader gives the original "raw" content of the header line, with no |
|
7870 + processing at all, and without the removal of leading and trailing |
|
7871 + white space. |
|
7872 + |
|
7873 + * bheader removes leading and trailing white space, and then decodes |
|
7874 + base64 or quoted-printable MIME "words" within the header text, but |
|
7875 + does no character set translation. If decoding of what looks |
|
7876 + superficially like a MIME "word" fails, the raw string is returned. If |
|
7877 + decoding produces a binary zero character, it is replaced by a question |
|
7878 + mark - this is what Exim does for binary zeros that are actually |
|
7879 + received in header lines. |
|
7880 + |
|
7881 + * header tries to translate the string as decoded by bheader to a |
|
7882 + standard character set. This is an attempt to produce the same string |
|
7883 + as would be displayed on a user's MUA. If translation fails, the |
|
7884 + bheader string is returned. Translation is attempted only on operating |
|
7885 + systems that support the iconv() function. This is indicated by the |
|
7886 + compile-time macro HAVE_ICONV in a system Makefile or in Local/Makefile |
|
7887 + . |
|
7888 + |
|
7889 + In a filter file, the target character set for header can be specified by a |
|
7890 + command of the following form: |
|
7891 + |
|
7892 + headers charset "UTF-8" |
|
7893 + |
|
7894 + This command affects all references to $h_ (or $header_) expansions in |
|
7895 + subsequently obeyed filter commands. In the absence of this command, the |
|
7896 + target character set in a filter is taken from the setting of the |
|
7897 + headers_charset option in the runtime configuration. The value of this |
|
7898 + option defaults to the value of HEADERS_CHARSET in Local/Makefile. The |
|
7899 + ultimate default is ISO-8859-1. |
|
7900 + |
|
7901 + Header names follow the syntax of RFC 2822, which states that they may |
|
7902 + contain any printing characters except space and colon. Consequently, curly |
|
7903 + brackets do not terminate header names, and should not be used to enclose |
|
7904 + them as if they were variables. Attempting to do so causes a syntax error. |
|
7905 + |
|
7906 + Only header lines that are common to all copies of a message are visible to |
|
7907 + this mechanism. These are the original header lines that are received with |
|
7908 + the message, and any that are added by an ACL statement or by a system |
|
7909 + filter. Header lines that are added to a particular copy of a message by a |
|
7910 + router or transport are not accessible. |
|
7911 + |
|
7912 + For incoming SMTP messages, no header lines are visible in ACLs that are |
|
7913 + obeyed before the DATA ACL, because the header structure is not set up |
|
7914 + until the message is received. Header lines that are added in a RCPT ACL |
|
7915 + (for example) are saved until the message's incoming header lines are |
|
7916 + available, at which point they are added. When a DATA ACL is running, |
|
7917 + however, header lines added by earlier ACLs are visible. |
|
7918 + |
|
7919 + Upper case and lower case letters are synonymous in header names. If the |
|
7920 + following character is white space, the terminating colon may be omitted, |
|
7921 + but this is not recommended, because you may then forget it when it is |
|
7922 + needed. When white space terminates the header name, it is included in the |
|
7923 + expanded string. If the message does not contain the given header, the |
|
7924 + expansion item is replaced by an empty string. (See the def condition in |
|
7925 + section 11.7 for a means of testing for the existence of a header.) |
|
7926 + |
|
7927 + If there is more than one header with the same name, they are all |
|
7928 + concatenated to form the substitution string, up to a maximum length of |
|
7929 + 64K. Unless rheader is being used, leading and trailing white space is |
|
7930 + removed from each header before concatenation, and a completely empty |
|
7931 + header is ignored. A newline character is then inserted between non-empty |
|
7932 + headers, but there is no newline at the very end. For the header and |
|
7933 + bheader expansion, for those headers that contain lists of addresses, a |
|
7934 + comma is also inserted at the junctions between headers. This does not |
|
7935 + happen for the rheader expansion. |
|
7936 + |
|
7937 +${hmac{<hashname>}{<secret>}{<string>}} |
|
7938 + |
|
7939 + This function uses cryptographic hashing (either MD5 or SHA-1) to convert a |
|
7940 + shared secret and some text into a message authentication code, as |
|
7941 + specified in RFC 2104. This differs from "${md5:secret_text...}" or "$ |
|
7942 + {sha1:secret_text...}" in that the hmac step adds a signature to the |
|
7943 + cryptographic hash, allowing for authentication that is not possible with |
|
7944 + MD5 or SHA-1 alone. The hash name must expand to either "md5" or "sha1" at |
|
7945 + present. For example: |
|
7946 + |
|
7947 + ${hmac{md5}{somesecret}{$primary_hostname $tod_log}} |
|
7948 + |
|
7949 + For the hostname mail.example.com and time 2002-10-17 11:30:59, this |
|
7950 + produces: |
|
7951 + |
|
7952 + dd97e3ba5d1a61b5006108f8c8252953 |
|
7953 + |
|
7954 + As an example of how this might be used, you might put in the main part of |
|
7955 + an Exim configuration: |
|
7956 + |
|
7957 + SPAMSCAN_SECRET=cohgheeLei2thahw |
|
7958 + |
|
7959 + In a router or a transport you could then have: |
|
7960 + |
|
7961 + headers_add = \ |
|
7962 + X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \ |
|
7963 + ${hmac{md5}{SPAMSCAN_SECRET}\ |
|
7964 + {${primary_hostname},${message_exim_id},$h_message-id:}} |
|
7965 + |
|
7966 + Then given a message, you can check where it was scanned by looking at the |
|
7967 + X-Spam-Scanned: header line. If you know the secret, you can check that |
|
7968 + this header line is authentic by recomputing the authentication code from |
|
7969 + the host name, message ID and the Message-id: header line. This can be done |
|
7970 + using Exim's -be option, or by other means, for example by using the |
|
7971 + hmac_md5_hex() function in Perl. |
|
7972 + |
|
7973 +${if <condition> {<string1>}{<string2>}} |
|
7974 + |
|
7975 + If <condition> is true, <string1> is expanded and replaces the whole item; |
|
7976 + otherwise <string2> is used. The available conditions are described in |
|
7977 + section 11.7 below. For example: |
|
7978 + |
|
7979 + ${if eq {$local_part}{postmaster} {yes}{no} } |
|
7980 + |
|
7981 + The second string need not be present; if it is not and the condition is |
|
7982 + not true, the item is replaced with nothing. Alternatively, the word "fail" |
|
7983 + may be present instead of the second string (without any curly brackets). |
|
7984 + In this case, the expansion is forced to fail if the condition is not true |
|
7985 + (see section 11.4). |
|
7986 + |
|
7987 + If both strings are omitted, the result is the string "true" if the |
|
7988 + condition is true, and the empty string if the condition is false. This |
|
7989 + makes it less cumbersome to write custom ACL and router conditions. For |
|
7990 + example, instead of |
|
7991 + |
|
7992 + condition = ${if >{$acl_m4}{3}{true}{false}} |
|
7993 + |
|
7994 + you can use |
|
7995 + |
|
7996 + condition = ${if >{$acl_m4}{3}} |
|
7997 + |
|
7998 +${length{<string1>}{<string2>}} |
|
7999 + |
|
8000 + The length item is used to extract the initial portion of a string. Both |
|
8001 + strings are expanded, and the first one must yield a number, <n>, say. If |
|
8002 + you are using a fixed value for the number, that is, if <string1> does not |
|
8003 + change when expanded, you can use the simpler operator notation that avoids |
|
8004 + some of the braces: |
|
8005 + |
|
8006 + ${length_<n>:<string>} |
|
8007 + |
|
8008 + The result of this item is either the first <n> characters or the whole of |
|
8009 + <string2>, whichever is the shorter. Do not confuse length with strlen, |
|
8010 + which gives the length of a string. |
|
8011 + |
|
8012 +${lookup{<key>} <search type> {<file>} {<string1>} {<string2>}} |
|
8013 + |
|
8014 + This is the first of one of two different types of lookup item, which are |
|
8015 + both described in the next item. |
|
8016 + |
|
8017 +${lookup <search type> {<query>} {<string1>} {<string2>}} |
|
8018 + |
|
8019 + The two forms of lookup item specify data lookups in files and databases, |
|
8020 + as discussed in chapter 9. The first form is used for single-key lookups, |
|
8021 + and the second is used for query-style lookups. The <key>, <file>, and < |
|
8022 + query> strings are expanded before use. |
|
8023 + |
|
8024 + If there is any white space in a lookup item which is part of a filter |
|
8025 + command, a retry or rewrite rule, a routing rule for the manualroute |
|
8026 + router, or any other place where white space is significant, the lookup |
|
8027 + item must be enclosed in double quotes. The use of data lookups in users' |
|
8028 + filter files may be locked out by the system administrator. |
|
8029 + |
|
8030 + If the lookup succeeds, <string1> is expanded and replaces the entire item. |
|
8031 + During its expansion, the variable $value contains the data returned by the |
|
8032 + lookup. Afterwards it reverts to the value it had previously (at the outer |
|
8033 + level it is empty). If the lookup fails, <string2> is expanded and replaces |
|
8034 + the entire item. If {<string2>} is omitted, the replacement is the empty |
|
8035 + string on failure. If <string2> is provided, it can itself be a nested |
|
8036 + lookup, thus providing a mechanism for looking up a default value when the |
|
8037 + original lookup fails. |
|
8038 + |
|
8039 + If a nested lookup is used as part of <string1>, $value contains the data |
|
8040 + for the outer lookup while the parameters of the second lookup are |
|
8041 + expanded, and also while <string2> of the second lookup is expanded, should |
|
8042 + the second lookup fail. Instead of {<string2>} the word "fail" can appear, |
|
8043 + and in this case, if the lookup fails, the entire expansion is forced to |
|
8044 + fail (see section 11.4). If both {<string1>} and {<string2>} are omitted, |
|
8045 + the result is the looked up value in the case of a successful lookup, and |
|
8046 + nothing in the case of failure. |
|
8047 + |
|
8048 + For single-key lookups, the string "partial" is permitted to precede the |
|
8049 + search type in order to do partial matching, and * or *@ may follow a |
|
8050 + search type to request default lookups if the key does not match (see |
|
8051 + sections 9.6 and 9.7 for details). |
|
8052 + |
|
8053 + If a partial search is used, the variables $1 and $2 contain the wild and |
|
8054 + non-wild parts of the key during the expansion of the replacement text. |
|
8055 + They return to their previous values at the end of the lookup item. |
|
8056 + |
|
8057 + This example looks up the postmaster alias in the conventional alias file: |
|
8058 + |
|
8059 + ${lookup {postmaster} lsearch {/etc/aliases} {$value}} |
|
8060 + |
|
8061 + This example uses NIS+ to look up the full name of the user corresponding |
|
8062 + to the local part of an address, forcing the expansion to fail if it is not |
|
8063 + found: |
|
8064 + |
|
8065 + ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \ |
|
8066 + {$value}fail} |
|
8067 + |
|
8068 +${map{<string1>}{<string2>}} |
|
8069 + |
|
8070 + After expansion, <string1> is interpreted as a list, colon-separated by |
|
8071 + default, but the separator can be changed in the usual way. For each item |
|
8072 + in this list, its value is place in $item, and then <string2> is expanded |
|
8073 + and added to the output as an item in a new list. The separator used for |
|
8074 + the output list is the same as the one used for the input, but a separator |
|
8075 + setting is not included in the output. For example: |
|
8076 + |
|
8077 + ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}} |
|
8078 + |
|
8079 + expands to "[a]:[b]:[c] (x)-(y)-(z)". At the end of the expansion, the |
|
8080 + value of $item is restored to what it was before. See also the filter and |
|
8081 + reduce expansion items. |
|
8082 + |
|
8083 +${nhash{<string1>}{<string2>}{<string3>}} |
|
8084 + |
|
8085 + The three strings are expanded; the first two must yield numbers. Call them |
|
8086 + <n> and <m>. If you are using fixed values for these numbers, that is, if < |
|
8087 + string1> and <string2> do not change when they are expanded, you can use |
|
8088 + the simpler operator notation that avoids some of the braces: |
|
8089 + |
|
8090 + ${nhash_<n>_<m>:<string>} |
|
8091 + |
|
8092 + The second number is optional (in both notations). If there is only one |
|
8093 + number, the result is a number in the range 0-<n>-1. Otherwise, the string |
|
8094 + is processed by a div/mod hash function that returns two numbers, separated |
|
8095 + by a slash, in the ranges 0 to <n>-1 and 0 to <m>-1, respectively. For |
|
8096 + example, |
|
8097 + |
|
8098 + ${nhash{8}{64}{supercalifragilisticexpialidocious}} |
|
8099 + |
|
8100 + returns the string "6/33". |
|
8101 + |
|
8102 +${perl{<subroutine>}{<arg>}{<arg>}...} |
|
8103 + |
|
8104 + This item is available only if Exim has been built to include an embedded |
|
8105 + Perl interpreter. The subroutine name and the arguments are first |
|
8106 + separately expanded, and then the Perl subroutine is called with those |
|
8107 + arguments. No additional arguments need be given; the maximum number |
|
8108 + permitted, including the name of the subroutine, is nine. |
|
8109 + |
|
8110 + The return value of the subroutine is inserted into the expanded string, |
|
8111 + unless the return value is undef. In that case, the expansion fails in the |
|
8112 + same way as an explicit "fail" on a lookup item. The return value is a |
|
8113 + scalar. Whatever you return is evaluated in a scalar context. For example, |
|
8114 + if you return the name of a Perl vector, the return value is the size of |
|
8115 + the vector, not its contents. |
|
8116 + |
|
8117 + If the subroutine exits by calling Perl's die function, the expansion fails |
|
8118 + with the error message that was passed to die. More details of the embedded |
|
8119 + Perl facility are given in chapter 12. |
|
8120 + |
|
8121 + The redirect router has an option called forbid_filter_perl which locks out |
|
8122 + the use of this expansion item in filter files. |
|
8123 + |
|
8124 +${prvs{<address>}{<secret>}{<keynumber>}} |
|
8125 + |
|
8126 + The first argument is a complete email address and the second is secret |
|
8127 + keystring. The third argument, specifying a key number, is optional. If |
|
8128 + absent, it defaults to 0. The result of the expansion is a prvs-signed |
|
8129 + email address, to be typically used with the return_path option on an smtp |
|
8130 + transport as part of a bounce address tag validation (BATV) scheme. For |
|
8131 + more discussion and an example, see section 40.48. |
|
8132 + |
|
8133 +${prvscheck{<address>}{<secret>}{<string>}} |
|
8134 + |
|
8135 + This expansion item is the complement of the prvs item. It is used for |
|
8136 + checking prvs-signed addresses. If the expansion of the first argument does |
|
8137 + not yield a syntactically valid prvs-signed address, the whole item expands |
|
8138 + to the empty string. When the first argument does expand to a syntactically |
|
8139 + valid prvs-signed address, the second argument is expanded, with the |
|
8140 + prvs-decoded version of the address and the key number extracted from the |
|
8141 + address in the variables $prvscheck_address and $prvscheck_keynum, |
|
8142 + respectively. |
|
8143 + |
|
8144 + These two variables can be used in the expansion of the second argument to |
|
8145 + retrieve the secret. The validity of the prvs-signed address is then |
|
8146 + checked against the secret. The result is stored in the variable |
|
8147 + $prvscheck_result, which is empty for failure or "1" for success. |
|
8148 + |
|
8149 + The third argument is optional; if it is missing, it defaults to an empty |
|
8150 + string. This argument is now expanded. If the result is an empty string, |
|
8151 + the result of the expansion is the decoded version of the address. This is |
|
8152 + the case whether or not the signature was valid. Otherwise, the result of |
|
8153 + the expansion is the expansion of the third argument. |
|
8154 + |
|
8155 + All three variables can be used in the expansion of the third argument. |
|
8156 + However, once the expansion is complete, only $prvscheck_result remains |
|
8157 + set. For more discussion and an example, see section 40.48. |
|
8158 + |
|
8159 +${readfile{<file name>}{<eol string>}} |
|
8160 + |
|
8161 + The file name and end-of-line string are first expanded separately. The |
|
8162 + file is then read, and its contents replace the entire item. All newline |
|
8163 + characters in the file are replaced by the end-of-line string if it is |
|
8164 + present. Otherwise, newlines are left in the string. String expansion is |
|
8165 + not applied to the contents of the file. If you want this, you must wrap |
|
8166 + the item in an expand operator. If the file cannot be read, the string |
|
8167 + expansion fails. |
|
8168 + |
|
8169 + The redirect router has an option called forbid_filter_readfile which locks |
|
8170 + out the use of this expansion item in filter files. |
|
8171 + |
|
8172 +${readsocket{<name>}{<request>}{<timeout>}{<eol string>}{<fail string>}} |
|
8173 + |
|
8174 + This item inserts data from a Unix domain or Internet socket into the |
|
8175 + expanded string. The minimal way of using it uses just two arguments, as in |
|
8176 + these examples: |
|
8177 + |
|
8178 + ${readsocket{/socket/name}{request string}} |
|
8179 + ${readsocket{inet:some.host:1234}{request string}} |
|
8180 + |
|
8181 + For a Unix domain socket, the first substring must be the path to the |
|
8182 + socket. For an Internet socket, the first substring must contain "inet:" |
|
8183 + followed by a host name or IP address, followed by a colon and a port, |
|
8184 + which can be a number or the name of a TCP port in /etc/services. An IP |
|
8185 + address may optionally be enclosed in square brackets. This is best for |
|
8186 + IPv6 addresses. For example: |
|
8187 + |
|
8188 + ${readsocket{inet:[::1]:1234}{request string}} |
|
8189 + |
|
8190 + Only a single host name may be given, but if looking it up yields more than |
|
8191 + one IP address, they are each tried in turn until a connection is made. For |
|
8192 + both kinds of socket, Exim makes a connection, writes the request string |
|
8193 + (unless it is an empty string) and reads from the socket until an |
|
8194 + end-of-file is read. A timeout of 5 seconds is applied. Additional, |
|
8195 + optional arguments extend what can be done. Firstly, you can vary the |
|
8196 + timeout. For example: |
|
8197 + |
|
8198 + ${readsocket{/socket/name}{request string}{3s}} |
|
8199 + |
|
8200 + A fourth argument allows you to change any newlines that are in the data |
|
8201 + that is read, in the same way as for readfile (see above). This example |
|
8202 + turns them into spaces: |
|
8203 + |
|
8204 + ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }} |
|
8205 + |
|
8206 + As with all expansions, the substrings are expanded before the processing |
|
8207 + happens. Errors in these sub-expansions cause the expansion to fail. In |
|
8208 + addition, the following errors can occur: |
|
8209 + |
|
8210 + * Failure to create a socket file descriptor; |
|
8211 + |
|
8212 + * Failure to connect the socket; |
|
8213 + |
|
8214 + * Failure to write the request string; |
|
8215 + |
|
8216 + * Timeout on reading from the socket. |
|
8217 + |
|
8218 + By default, any of these errors causes the expansion to fail. However, if |
|
8219 + you supply a fifth substring, it is expanded and used when any of the above |
|
8220 + errors occurs. For example: |
|
8221 + |
|
8222 + ${readsocket{/socket/name}{request string}{3s}{\n}\ |
|
8223 + {socket failure}} |
|
8224 + |
|
8225 + You can test for the existence of a Unix domain socket by wrapping this |
|
8226 + expansion in "${if exists", but there is a race condition between that test |
|
8227 + and the actual opening of the socket, so it is safer to use the fifth |
|
8228 + argument if you want to be absolutely sure of avoiding an expansion error |
|
8229 + for a non-existent Unix domain socket, or a failure to connect to an |
|
8230 + Internet socket. |
|
8231 + |
|
8232 + The redirect router has an option called forbid_filter_readsocket which |
|
8233 + locks out the use of this expansion item in filter files. |
|
8234 + |
|
8235 +${reduce{<string1>}{<string2>}{<string3>}} |
|
8236 + |
|
8237 + This operation reduces a list to a single, scalar string. After expansion, |
|
8238 + <string1> is interpreted as a list, colon-separated by default, but the |
|
8239 + separator can be changed in the usual way. Then <string2> is expanded and |
|
8240 + assigned to the $value variable. After this, each item in the <string1> |
|
8241 + list is assigned to $item in turn, and <string3> is expanded for each of |
|
8242 + them. The result of that expansion is assigned to $value before the next |
|
8243 + iteration. When the end of the list is reached, the final value of $value |
|
8244 + is added to the expansion output. The reduce expansion item can be used in |
|
8245 + a number of ways. For example, to add up a list of numbers: |
|
8246 + |
|
8247 + ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}} |
|
8248 + |
|
8249 + The result of that expansion would be "6". The maximum of a list of numbers |
|
8250 + can be found: |
|
8251 + |
|
8252 + ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}} |
|
8253 + |
|
8254 + At the end of a reduce expansion, the values of $item and $value are |
|
8255 + restored to what they were before. See also the filter and map expansion |
|
8256 + items. |
|
8257 + |
|
8258 +$rheader_<header name>: or $rh_<header name>: |
|
8259 + |
|
8260 + This item inserts "raw" header lines. It is described with the header |
|
8261 + expansion item above. |
|
8262 + |
|
8263 +${run{<command>Â <args>}{<string1>}{<string2>}} |
|
8264 + |
|
8265 + The command and its arguments are first expanded separately, and then the |
|
8266 + command is run in a separate process, but under the same uid and gid. As in |
|
8267 + other command executions from Exim, a shell is not used by default. If you |
|
8268 + want a shell, you must explicitly code it. |
|
8269 + |
|
8270 + The standard input for the command exists, but is empty. The standard |
|
8271 + output and standard error are set to the same file descriptor. If the |
|
8272 + command succeeds (gives a zero return code) <string1> is expanded and |
|
8273 + replaces the entire item; during this expansion, the standard output/error |
|
8274 + from the command is in the variable $value. If the command fails, <string2 |
|
8275 + >, if present, is expanded and used. Once again, during the expansion, the |
|
8276 + standard output/error from the command is in the variable $value. |
|
8277 + |
|
8278 + If <string2> is absent, the result is empty. Alternatively, <string2> can |
|
8279 + be the word "fail" (not in braces) to force expansion failure if the |
|
8280 + command does not succeed. If both strings are omitted, the result is |
|
8281 + contents of the standard output/error on success, and nothing on failure. |
|
8282 + |
|
8283 + The return code from the command is put in the variable $runrc, and this |
|
8284 + remains set afterwards, so in a filter file you can do things like this: |
|
8285 + |
|
8286 + if "${run{x y z}{}}$runrc" is 1 then ... |
|
8287 + elif $runrc is 2 then ... |
|
8288 + ... |
|
8289 + endif |
|
8290 + |
|
8291 + If execution of the command fails (for example, the command does not |
|
8292 + exist), the return code is 127 - the same code that shells use for |
|
8293 + non-existent commands. |
|
8294 + |
|
8295 + Warning: In a router or transport, you cannot assume the order in which |
|
8296 + option values are expanded, except for those preconditions whose order of |
|
8297 + testing is documented. Therefore, you cannot reliably expect to set $runrc |
|
8298 + by the expansion of one option, and use it in another. |
|
8299 + |
|
8300 + The redirect router has an option called forbid_filter_run which locks out |
|
8301 + the use of this expansion item in filter files. |
|
8302 + |
|
8303 +${sg{<subject>}{<regex>}{<replacement>}} |
|
8304 + |
|
8305 + This item works like Perl's substitution operator (s) with the global (/g) |
|
8306 + option; hence its name. However, unlike the Perl equivalent, Exim does not |
|
8307 + modify the subject string; instead it returns the modified string for |
|
8308 + insertion into the overall expansion. The item takes three arguments: the |
|
8309 + subject string, a regular expression, and a substitution string. For |
|
8310 + example: |
|
8311 + |
|
8312 + ${sg{abcdefabcdef}{abc}{xyz}} |
|
8313 + |
|
8314 + yields "xyzdefxyzdef". Because all three arguments are expanded before use, |
|
8315 + if any $ or \ characters are required in the regular expression or in the |
|
8316 + substitution string, they have to be escaped. For example: |
|
8317 + |
|
8318 + ${sg{abcdef}{^(...)(...)\$}{\$2\$1}} |
|
8319 + |
|
8320 + yields "defabc", and |
|
8321 + |
|
8322 + ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}} |
|
8323 + |
|
8324 + yields "K1=A K4=D K3=C". Note the use of "\N" to protect the contents of |
|
8325 + the regular expression from string expansion. |
|
8326 + |
|
8327 +${substr{<string1>}{<string2>}{<string3>}} |
|
8328 + |
|
8329 + The three strings are expanded; the first two must yield numbers. Call them |
|
8330 + <n> and <m>. If you are using fixed values for these numbers, that is, if < |
|
8331 + string1> and <string2> do not change when they are expanded, you can use |
|
8332 + the simpler operator notation that avoids some of the braces: |
|
8333 + |
|
8334 + ${substr_<n>_<m>:<string>} |
|
8335 + |
|
8336 + The second number is optional (in both notations). If it is absent in the |
|
8337 + simpler format, the preceding underscore must also be omitted. |
|
8338 + |
|
8339 + The substr item can be used to extract more general substrings than length. |
|
8340 + The first number, <n>, is a starting offset, and <m> is the length |
|
8341 + required. For example |
|
8342 + |
|
8343 + ${substr{3}{2}{$local_part}} |
|
8344 + |
|
8345 + If the starting offset is greater than the string length the result is the |
|
8346 + null string; if the length plus starting offset is greater than the string |
|
8347 + length, the result is the right-hand part of the string, starting from the |
|
8348 + given offset. The first character in the string has offset zero. |
|
8349 + |
|
8350 + The substr expansion item can take negative offset values to count from the |
|
8351 + right-hand end of its operand. The last character is offset -1, the |
|
8352 + second-last is offset -2, and so on. Thus, for example, |
|
8353 + |
|
8354 + ${substr{-5}{2}{1234567}} |
|
8355 + |
|
8356 + yields "34". If the absolute value of a negative offset is greater than the |
|
8357 + length of the string, the substring starts at the beginning of the string, |
|
8358 + and the length is reduced by the amount of overshoot. Thus, for example, |
|
8359 + |
|
8360 + ${substr{-5}{2}{12}} |
|
8361 + |
|
8362 + yields an empty string, but |
|
8363 + |
|
8364 + ${substr{-3}{2}{12}} |
|
8365 + |
|
8366 + yields "1". |
|
8367 + |
|
8368 + When the second number is omitted from substr, the remainder of the string |
|
8369 + is taken if the offset is positive. If it is negative, all characters in |
|
8370 + the string preceding the offset point are taken. For example, an offset of |
|
8371 + -1 and no length, as in these semantically identical examples: |
|
8372 + |
|
8373 + ${substr_-1:abcde} |
|
8374 + ${substr{-1}{abcde}} |
|
8375 + |
|
8376 + yields all but the last character of the string, that is, "abcd". |
|
8377 + |
|
8378 +${tr{<subject>}{<characters>}{<replacements>}} |
|
8379 + |
|
8380 + This item does single-character translation on its subject string. The |
|
8381 + second argument is a list of characters to be translated in the subject |
|
8382 + string. Each matching character is replaced by the corresponding character |
|
8383 + from the replacement list. For example |
|
8384 + |
|
8385 + ${tr{abcdea}{ac}{13}} |
|
8386 + |
|
8387 + yields "1b3de1". If there are duplicates in the second character string, |
|
8388 + the last occurrence is used. If the third string is shorter than the |
|
8389 + second, its last character is replicated. However, if it is empty, no |
|
8390 + translation takes place. |
|
8391 + |
|
8392 +11.6Â Expansion operators |
|
8393 + |
|
8394 +For expansion items that perform transformations on a single argument string, |
|
8395 +the "operator" notation is used because it is simpler and uses fewer braces. |
|
8396 +The substring is first expanded before the operation is applied to it. The |
|
8397 +following operations can be performed: |
|
8398 + |
|
8399 +${address:<string>} |
|
8400 + |
|
8401 + The string is interpreted as an RFC 2822 address, as it might appear in a |
|
8402 + header line, and the effective address is extracted from it. If the string |
|
8403 + does not parse successfully, the result is empty. |
|
8404 + |
|
8405 +${addresses:<string>} |
|
8406 + |
|
8407 + The string (after expansion) is interpreted as a list of addresses in RFC |
|
8408 + 2822 format, such as can be found in a To: or Cc: header line. The |
|
8409 + operative address (local-part@domain) is extracted from each item, and the |
|
8410 + result of the expansion is a colon-separated list, with appropriate |
|
8411 + doubling of colons should any happen to be present in the email addresses. |
|
8412 + Syntactically invalid RFC2822 address items are omitted from the output. |
|
8413 + |
|
8414 + It is possible to specify a character other than colon for the output |
|
8415 + separator by starting the string with > followed by the new separator |
|
8416 + character. For example: |
|
8417 + |
|
8418 + ${addresses:>& Chief <ceo@up.stairs>, sec@base.ment (dogsbody)} |
|
8419 + |
|
8420 + expands to "ceo@up.stairs&sec@base.ment". Compare the address (singular) |
|
8421 + expansion item, which extracts the working address from a single RFC2822 |
|
8422 + address. See the filter, map, and reduce items for ways of processing |
|
8423 + lists. |
|
8424 + |
|
8425 +${base62:<digits>} |
|
8426 + |
|
8427 + The string must consist entirely of decimal digits. The number is converted |
|
8428 + to base 62 and output as a string of six characters, including leading |
|
8429 + zeros. In the few operating environments where Exim uses base 36 instead of |
|
8430 + base 62 for its message identifiers (because those systems do not have |
|
8431 + case-sensitive file names), base 36 is used by this operator, despite its |
|
8432 + name. Note: Just to be absolutely clear: this is not base64 encoding. |
|
8433 + |
|
8434 +${base62d:<base-62Â digits>} |
|
8435 + |
|
8436 + The string must consist entirely of base-62 digits, or, in operating |
|
8437 + environments where Exim uses base 36 instead of base 62 for its message |
|
8438 + identifiers, base-36 digits. The number is converted to decimal and output |
|
8439 + as a string. |
|
8440 + |
|
8441 +${domain:<string>} |
|
8442 + |
|
8443 + The string is interpreted as an RFC 2822 address and the domain is |
|
8444 + extracted from it. If the string does not parse successfully, the result is |
|
8445 + empty. |
|
8446 + |
|
8447 +${escape:<string>} |
|
8448 + |
|
8449 + If the string contains any non-printing characters, they are converted to |
|
8450 + escape sequences starting with a backslash. Whether characters with the |
|
8451 + most significant bit set (so-called "8-bit characters") count as printing |
|
8452 + or not is controlled by the print_topbitchars option. |
|
8453 + |
|
8454 +${eval:<string>} and ${eval10:<string>} |
|
8455 + |
|
8456 + These items supports simple arithmetic and bitwise logical operations in |
|
8457 + expansion strings. The string (after expansion) must be a conventional |
|
8458 + arithmetic expression, but it is limited to basic arithmetic operators, |
|
8459 + bitwise logical operators, and parentheses. All operations are carried out |
|
8460 + using integer arithmetic. The operator priorities are as follows (the same |
|
8461 + as in the C programming language): |
|
8462 + |
|
8463 + Â Â Â Â highest: not (~), negate (-) |
|
8464 + Â Â Â Â multiply (*), divide (/), remainder (%) |
|
8465 + Â Â Â Â plus (+), minus (-) |
|
8466 + Â Â Â Â shift-left (<<), shift-right (>>) |
|
8467 + Â Â Â Â and (&) |
|
8468 + Â Â Â Â xor (^) |
|
8469 + Â Â Â Â lowest: or (|) |
|
8470 + |
|
8471 + Binary operators with the same priority are evaluated from left to right. |
|
8472 + White space is permitted before or after operators. |
|
8473 + |
|
8474 + For eval, numbers may be decimal, octal (starting with "0") or hexadecimal |
|
8475 + (starting with "0x"). For eval10, all numbers are taken as decimal, even if |
|
8476 + they start with a leading zero; hexadecimal numbers are not permitted. This |
|
8477 + can be useful when processing numbers extracted from dates or times, which |
|
8478 + often do have leading zeros. |
|
8479 + |
|
8480 + A number may be followed by "K" or "M" to multiply it by 1024 or 1024*1024, |
|
8481 + respectively. Negative numbers are supported. The result of the computation |
|
8482 + is a decimal representation of the answer (without "K" or "M"). For |
|
8483 + example: |
|
8484 + |
|
8485 + ${eval:1+1}              yields 2 |
|
8486 + ${eval:1+2*3}            yields 7 |
|
8487 + ${eval:(1+2)*3}          yields 9 |
|
8488 + ${eval:2+42%5}           yields 4 |
|
8489 + ${eval:0xc&5}            yields 4 |
|
8490 + ${eval:0xc|5}            yields 13 |
|
8491 + ${eval:0xc^5}            yields 9 |
|
8492 + ${eval:0xc>>1}           yields 6 |
|
8493 + ${eval:0xc<<1}           yields 24 |
|
8494 + ${eval:~255&0x1234}      yields 4608 |
|
8495 + ${eval:-(~255&0x1234)}   yields -4608 |
|
8496 + |
|
8497 + As a more realistic example, in an ACL you might have |
|
8498 + |
|
8499 + deny message = Too many bad recipients |
|
8500 + condition = \ |
|
8501 + ${if and { \ |
|
8502 + {>{$rcpt_count}{10}} \ |
|
8503 + { \ |
|
8504 + < \ |
|
8505 + {$recipients_count} \ |
|
8506 + {${eval:$rcpt_count/2}} \ |
|
8507 + } \ |
|
8508 + }{yes}{no}} |
|
8509 + |
|
8510 + The condition is true if there have been more than 10 RCPT commands and |
|
8511 + fewer than half of them have resulted in a valid recipient. |
|
8512 + |
|
8513 +${expand:<string>} |
|
8514 + |
|
8515 + The expand operator causes a string to be expanded for a second time. For |
|
8516 + example, |
|
8517 + |
|
8518 + ${expand:${lookup{$domain}dbm{/some/file}{$value}}} |
|
8519 + |
|
8520 + first looks up a string in a file while expanding the operand for expand, |
|
8521 + and then re-expands what it has found. |
|
8522 + |
|
8523 +${from_utf8:<string>} |
|
8524 + |
|
8525 + The world is slowly moving towards Unicode, although there are no standards |
|
8526 + for email yet. However, other applications (including some databases) are |
|
8527 + starting to store data in Unicode, using UTF-8 encoding. This operator |
|
8528 + converts from a UTF-8 string to an ISO-8859-1 string. UTF-8 code values |
|
8529 + greater than 255 are converted to underscores. The input must be a valid |
|
8530 + UTF-8 string. If it is not, the result is an undefined sequence of bytes. |
|
8531 + |
|
8532 + Unicode code points with values less than 256 are compatible with ASCII and |
|
8533 + ISO-8859-1 (also known as Latin-1). For example, character 169 is the |
|
8534 + copyright symbol in both cases, though the way it is encoded is different. |
|
8535 + In UTF-8, more than one byte is needed for characters with code values |
|
8536 + greater than 127, whereas ISO-8859-1 is a single-byte encoding (but thereby |
|
8537 + limited to 256 characters). This makes translation from UTF-8 to ISO-8859-1 |
|
8538 + straightforward. |
|
8539 + |
|
8540 +${hash_<n>_<m>:<string>} |
|
8541 + |
|
8542 + The hash operator is a simpler interface to the hashing function that can |
|
8543 + be used when the two parameters are fixed numbers (as opposed to strings |
|
8544 + that change when expanded). The effect is the same as |
|
8545 + |
|
8546 + ${hash{<n>}{<m>}{<string>}} |
|
8547 + |
|
8548 + See the description of the general hash item above for details. The |
|
8549 + abbreviation h can be used when hash is used as an operator. |
|
8550 + |
|
8551 +${hex2b64:<hexstring>} |
|
8552 + |
|
8553 + This operator converts a hex string into one that is base64 encoded. This |
|
8554 + can be useful for processing the output of the MD5 and SHA-1 hashing |
|
8555 + functions. |
|
8556 + |
|
8557 +${lc:<string>} |
|
8558 + |
|
8559 + This forces the letters in the string into lower-case, for example: |
|
8560 + |
|
8561 + ${lc:$local_part} |
|
8562 + |
|
8563 +${length_<number>:<string>} |
|
8564 + |
|
8565 + The length operator is a simpler interface to the length function that can |
|
8566 + be used when the parameter is a fixed number (as opposed to a string that |
|
8567 + changes when expanded). The effect is the same as |
|
8568 + |
|
8569 + ${length{<number>}{<string>}} |
|
8570 + |
|
8571 + See the description of the general length item above for details. Note that |
|
8572 + length is not the same as strlen. The abbreviation l can be used when |
|
8573 + length is used as an operator. |
|
8574 + |
|
8575 +${local_part:<string>} |
|
8576 + |
|
8577 + The string is interpreted as an RFC 2822 address and the local part is |
|
8578 + extracted from it. If the string does not parse successfully, the result is |
|
8579 + empty. |
|
8580 + |
|
8581 +${mask:<IP address>/<bit count>} |
|
8582 + |
|
8583 + If the form of the string to be operated on is not an IP address followed |
|
8584 + by a slash and an integer (that is, a network address in CIDR notation), |
|
8585 + the expansion fails. Otherwise, this operator converts the IP address to |
|
8586 + binary, masks off the least significant bits according to the bit count, |
|
8587 + and converts the result back to text, with mask appended. For example, |
|
8588 + |
|
8589 + ${mask:10.111.131.206/28} |
|
8590 + |
|
8591 + returns the string "10.111.131.192/28". Since this operation is expected to |
|
8592 + be mostly used for looking up masked addresses in files, the result for an |
|
8593 + IPv6 address uses dots to separate components instead of colons, because |
|
8594 + colon terminates a key string in lsearch files. So, for example, |
|
8595 + |
|
8596 + ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99} |
|
8597 + |
|
8598 + returns the string |
|
8599 + |
|
8600 + 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99 |
|
8601 + |
|
8602 + Letters in IPv6 addresses are always output in lower case. |
|
8603 + |
|
8604 +${md5:<string>} |
|
8605 + |
|
8606 + The md5 operator computes the MD5 hash value of the string, and returns it |
|
8607 + as a 32-digit hexadecimal number, in which any letters are in lower case. |
|
8608 + |
|
8609 +${nhash_<n>_<m>:<string>} |
|
8610 + |
|
8611 + The nhash operator is a simpler interface to the numeric hashing function |
|
8612 + that can be used when the two parameters are fixed numbers (as opposed to |
|
8613 + strings that change when expanded). The effect is the same as |
|
8614 + |
|
8615 + ${nhash{<n>}{<m>}{<string>}} |
|
8616 + |
|
8617 + See the description of the general nhash item above for details. |
|
8618 + |
|
8619 +${quote:<string>} |
|
8620 + |
|
8621 + The quote operator puts its argument into double quotes if it is an empty |
|
8622 + string or contains anything other than letters, digits, underscores, dots, |
|
8623 + and hyphens. Any occurrences of double quotes and backslashes are escaped |
|
8624 + with a backslash. Newlines and carriage returns are converted to "\n" and " |
|
8625 + \r", respectively For example, |
|
8626 + |
|
8627 + ${quote:ab"*"cd} |
|
8628 + |
|
8629 + becomes |
|
8630 + |
|
8631 + "ab\"*\"cd" |
|
8632 + |
|
8633 + The place where this is useful is when the argument is a substitution from |
|
8634 + a variable or a message header. |
|
8635 + |
|
8636 +${quote_local_part:<string>} |
|
8637 + |
|
8638 + This operator is like quote, except that it quotes the string only if |
|
8639 + required to do so by the rules of RFC 2822 for quoting local parts. For |
|
8640 + example, a plus sign would not cause quoting (but it would for quote). If |
|
8641 + you are creating a new email address from the contents of $local_part (or |
|
8642 + any other unknown data), you should always use this operator. |
|
8643 + |
|
8644 +${quote_<lookup-type>:<string>} |
|
8645 + |
|
8646 + This operator applies lookup-specific quoting rules to the string. Each |
|
8647 + query-style lookup type has its own quoting rules which are described with |
|
8648 + the lookups in chapter 9. For example, |
|
8649 + |
|
8650 + ${quote_ldap:two * two} |
|
8651 + |
|
8652 + returns |
|
8653 + |
|
8654 + two%20%5C2A%20two |
|
8655 + |
|
8656 + For single-key lookup types, no quoting is ever necessary and this operator |
|
8657 + yields an unchanged string. |
|
8658 + |
|
8659 +${randint:<n>} |
|
8660 + |
|
8661 + This operator returns a somewhat random number which is less than the |
|
8662 + supplied number and is at least 0. The quality of this randomness depends |
|
8663 + on how Exim was built; the values are not suitable for keying material. If |
|
8664 + Exim is linked against OpenSSL then RAND_pseudo_bytes() is used. Otherwise, |
|
8665 + the implementation may be arc4random(), random() seeded by srandomdev() or |
|
8666 + srandom(), or a custom implementation even weaker than random(). |
|
8667 + |
|
8668 +${reverse_ip:<ipaddr>} |
|
8669 + |
|
8670 + This operator reverses an IP address; for IPv4 addresses, the result is in |
|
8671 + dotted-quad decimal form, while for IPv6 addreses the result is in |
|
8672 + dotted-nibble hexadecimal form. In both cases, this is the "natural" form |
|
8673 + for DNS. For example, |
|
8674 + |
|
8675 + ${reverse_ip:192.0.2.4} and ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3} |
|
8676 + |
|
8677 + returns |
|
8678 + |
|
8679 + 4.2.0.192 and 3.0.2.0.0.0.0.c.d.c.b.a.1.0.0.0.9.0.0.0.2.4.c.0.8.b.d.0.1.0.0.2 |
|
8680 + |
|
8681 +${rfc2047:<string>} |
|
8682 + |
|
8683 + This operator encodes text according to the rules of RFC 2047. This is an |
|
8684 + encoding that is used in header lines to encode non-ASCII characters. It is |
|
8685 + assumed that the input string is in the encoding specified by the |
|
8686 + headers_charset option, which defaults to ISO-8859-1. If the string |
|
8687 + contains only characters in the range 33-126, and no instances of the |
|
8688 + characters |
|
8689 + |
|
8690 + ? = ( ) < > @ , ; : \ " . [ ] _ |
|
8691 + |
|
8692 + it is not modified. Otherwise, the result is the RFC 2047 encoding of the |
|
8693 + string, using as many "encoded words" as necessary to encode all the |
|
8694 + characters. |
|
8695 + |
|
8696 +${rfc2047d:<string>} |
|
8697 + |
|
8698 + This operator decodes strings that are encoded as per RFC 2047. Binary zero |
|
8699 + bytes are replaced by question marks. Characters are converted into the |
|
8700 + character set defined by headers_charset. Overlong RFC 2047 "words" are not |
|
8701 + recognized unless check_rfc2047_length is set false. |
|
8702 + |
|
8703 + Note: If you use $header_xxx: (or $h_xxx:) to access a header line, RFC |
|
8704 + 2047 decoding is done automatically. You do not need to use this operator |
|
8705 + as well. |
|
8706 + |
|
8707 +${rxquote:<string>} |
|
8708 + |
|
8709 + The rxquote operator inserts a backslash before any non-alphanumeric |
|
8710 + characters in its argument. This is useful when substituting the values of |
|
8711 + variables or headers inside regular expressions. |
|
8712 + |
|
8713 +${sha1:<string>} |
|
8714 + |
|
8715 + The sha1 operator computes the SHA-1 hash value of the string, and returns |
|
8716 + it as a 40-digit hexadecimal number, in which any letters are in upper |
|
8717 + case. |
|
8718 + |
|
8719 +${stat:<string>} |
|
8720 + |
|
8721 + The string, after expansion, must be a file path. A call to the stat() |
|
8722 + function is made for this path. If stat() fails, an error occurs and the |
|
8723 + expansion fails. If it succeeds, the data from the stat replaces the item, |
|
8724 + as a series of <name>=<value> pairs, where the values are all numerical, |
|
8725 + except for the value of "smode". The names are: "mode" (giving the mode as |
|
8726 + a 4-digit octal number), "smode" (giving the mode in symbolic format as a |
|
8727 + 10-character string, as for the ls command), "inode", "device", "links", |
|
8728 + "uid", "gid", "size", "atime", "mtime", and "ctime". You can extract |
|
8729 + individual fields using the extract expansion item. |
|
8730 + |
|
8731 + The use of the stat expansion in users' filter files can be locked out by |
|
8732 + the system administrator. Warning: The file size may be incorrect on 32-bit |
|
8733 + systems for files larger than 2GB. |
|
8734 + |
|
8735 +${str2b64:<string>} |
|
8736 + |
|
8737 + This operator converts a string into one that is base64 encoded. |
|
8738 + |
|
8739 +${strlen:<string>} |
|
8740 + |
|
8741 + The item is replace by the length of the expanded string, expressed as a |
|
8742 + decimal number. Note: Do not confuse strlen with length. |
|
8743 + |
|
8744 +${substr_<start>_<length>:<string>} |
|
8745 + |
|
8746 + The substr operator is a simpler interface to the substr function that can |
|
8747 + be used when the two parameters are fixed numbers (as opposed to strings |
|
8748 + that change when expanded). The effect is the same as |
|
8749 + |
|
8750 + ${substr{<start>}{<length>}{<string>}} |
|
8751 + |
|
8752 + See the description of the general substr item above for details. The |
|
8753 + abbreviation s can be used when substr is used as an operator. |
|
8754 + |
|
8755 +${time_eval:<string>} |
|
8756 + |
|
8757 + This item converts an Exim time interval such as "2d4h5m" into a number of |
|
8758 + seconds. |
|
8759 + |
|
8760 +${time_interval:<string>} |
|
8761 + |
|
8762 + The argument (after sub-expansion) must be a sequence of decimal digits |
|
8763 + that represents an interval of time as a number of seconds. It is converted |
|
8764 + into a number of larger units and output in Exim's normal time format, for |
|
8765 + example, "1w3d4h2m6s". |
|
8766 + |
|
8767 +${uc:<string>} |
|
8768 + |
|
8769 + This forces the letters in the string into upper-case. |
|
8770 + |
|
8771 +11.7Â Expansion conditions |
|
8772 + |
|
8773 +The following conditions are available for testing by the ${if construct while |
|
8774 +expanding strings: |
|
8775 + |
|
8776 +!<condition> |
|
8777 + |
|
8778 + Preceding any condition with an exclamation mark negates the result of the |
|
8779 + condition. |
|
8780 + |
|
8781 +<symbolic operator> {<string1>}{<string2>} |
|
8782 + |
|
8783 + There are a number of symbolic operators for doing numeric comparisons. |
|
8784 + They are: |
|
8785 + |
|
8786 + =Â Â Â Â Â Â equal |
|
8787 + ==Â Â Â Â Â equal |
|
8788 + >Â Â Â Â Â Â greater |
|
8789 + >=     greater or equal |
|
8790 + <Â Â Â Â Â Â less |
|
8791 + <=     less or equal |
|
8792 + |
|
8793 + For example: |
|
8794 + |
|
8795 + ${if >{$message_size}{10M} ... |
|
8796 + |
|
8797 + Note that the general negation operator provides for inequality testing. |
|
8798 + The two strings must take the form of optionally signed decimal integers, |
|
8799 + optionally followed by one of the letters "K" or "M" (in either upper or |
|
8800 + lower case), signifying multiplication by 1024 or 1024*1024, respectively. |
|
8801 + As a special case, the numerical value of an empty string is taken as zero. |
|
8802 + |
|
8803 +bool {<string>} |
|
8804 + |
|
8805 + This condition turns a string holding a true or false representation into a |
|
8806 + boolean state. It parses "true", "false", "yes" and "no" |
|
8807 + (case-insensitively); also positive integer numbers map to true if |
|
8808 + non-zero, false if zero. Leading and trailing whitespace is ignored. All |
|
8809 + other string values will result in expansion failure. |
|
8810 + |
|
8811 + When combined with ACL variables, this expansion condition will let you |
|
8812 + make decisions in one place and act on those decisions in another place. |
|
8813 + For example: |
|
8814 + |
|
8815 + ${if bool{$acl_m_privileged_sender} ... |
|
8816 + |
|
8817 +bool_lax {<string>} |
|
8818 + |
|
8819 + Like bool, this condition turns a string into a boolean state. But where |
|
8820 + bool accepts a strict set of strings, bool_lax uses the same loose |
|
8821 + definition that the Router condition option uses. The empty string and the |
|
8822 + values "false", "no" and "0" map to false, all others map to true. Leading |
|
8823 + and trailing whitespace is ignored. |
|
8824 + |
|
8825 + Note that where "bool{00}" is false, "bool_lax{00}" is true. |
|
8826 + |
|
8827 +crypteq {<string1>}{<string2>} |
|
8828 + |
|
8829 + This condition is included in the Exim binary if it is built to support any |
|
8830 + authentication mechanisms (see chapter 33). Otherwise, it is necessary to |
|
8831 + define SUPPORT_CRYPTEQ in Local/Makefile to get crypteq included in the |
|
8832 + binary. |
|
8833 + |
|
8834 + The crypteq condition has two arguments. The first is encrypted and |
|
8835 + compared against the second, which is already encrypted. The second string |
|
8836 + may be in the LDAP form for storing encrypted strings, which starts with |
|
8837 + the encryption type in curly brackets, followed by the data. If the second |
|
8838 + string does not begin with "{" it is assumed to be encrypted with crypt() |
|
8839 + or crypt16() (see below), since such strings cannot begin with "{". |
|
8840 + Typically this will be a field from a password file. An example of an |
|
8841 + encrypted string in LDAP form is: |
|
8842 + |
|
8843 + {md5}CY9rzUYh03PK3k6DJie09g== |
|
8844 + |
|
8845 + If such a string appears directly in an expansion, the curly brackets have |
|
8846 + to be quoted, because they are part of the expansion syntax. For example: |
|
8847 + |
|
8848 + ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}} |
|
8849 + |
|
8850 + The following encryption types (whose names are matched case-independently) |
|
8851 + are supported: |
|
8852 + |
|
8853 + * {md5} computes the MD5 digest of the first string, and expresses this |
|
8854 + as printable characters to compare with the remainder of the second |
|
8855 + string. If the length of the comparison string is 24, Exim assumes that |
|
8856 + it is base64 encoded (as in the above example). If the length is 32, |
|
8857 + Exim assumes that it is a hexadecimal encoding of the MD5 digest. If |
|
8858 + the length not 24 or 32, the comparison fails. |
|
8859 + |
|
8860 + * {sha1} computes the SHA-1 digest of the first string, and expresses |
|
8861 + this as printable characters to compare with the remainder of the |
|
8862 + second string. If the length of the comparison string is 28, Exim |
|
8863 + assumes that it is base64 encoded. If the length is 40, Exim assumes |
|
8864 + that it is a hexadecimal encoding of the SHA-1 digest. If the length is |
|
8865 + not 28 or 40, the comparison fails. |
|
8866 + |
|
8867 + * {crypt} calls the crypt() function, which traditionally used to use |
|
8868 + only the first eight characters of the password. However, in modern |
|
8869 + operating systems this is no longer true, and in many cases the entire |
|
8870 + password is used, whatever its length. |
|
8871 + |
|
8872 + * {crypt16} calls the crypt16() function, which was originally created to |
|
8873 + use up to 16 characters of the password in some operating systems. |
|
8874 + Again, in modern operating systems, more characters may be used. |
|
8875 + |
|
8876 + Exim has its own version of crypt16(), which is just a double call to crypt |
|
8877 + (). For operating systems that have their own version, setting HAVE_CRYPT16 |
|
8878 + in Local/Makefile when building Exim causes it to use the operating system |
|
8879 + version instead of its own. This option is set by default in the |
|
8880 + OS-dependent Makefile for those operating systems that are known to support |
|
8881 + crypt16(). |
|
8882 + |
|
8883 + Some years after Exim's crypt16() was implemented, a user discovered that |
|
8884 + it was not using the same algorithm as some operating systems' versions. It |
|
8885 + turns out that as well as crypt16() there is a function called bigcrypt() |
|
8886 + in some operating systems. This may or may not use the same algorithm, and |
|
8887 + both of them may be different to Exim's built-in crypt16(). |
|
8888 + |
|
8889 + However, since there is now a move away from the traditional crypt() |
|
8890 + functions towards using SHA1 and other algorithms, tidying up this area of |
|
8891 + Exim is seen as very low priority. |
|
8892 + |
|
8893 + If you do not put a encryption type (in curly brackets) in a crypteq |
|
8894 + comparison, the default is usually either "{crypt}" or "{crypt16}", as |
|
8895 + determined by the setting of DEFAULT_CRYPT in Local/Makefile. The default |
|
8896 + default is "{crypt}". Whatever the default, you can always use either |
|
8897 + function by specifying it explicitly in curly brackets. |
|
8898 + |
|
8899 +def:<variable name> |
|
8900 + |
|
8901 + The def condition must be followed by the name of one of the expansion |
|
8902 + variables defined in section 11.9. The condition is true if the variable |
|
8903 + does not contain the empty string. For example: |
|
8904 + |
|
8905 + ${if def:sender_ident {from $sender_ident}} |
|
8906 + |
|
8907 + Note that the variable name is given without a leading $ character. If the |
|
8908 + variable does not exist, the expansion fails. |
|
8909 + |
|
8910 +def:header_<header name>:  or  def:h_<header name>: |
|
8911 + |
|
8912 + This condition is true if a message is being processed and the named header |
|
8913 + exists in the message. For example, |
|
8914 + |
|
8915 + ${if def:header_reply-to:{$h_reply-to:}{$h_from:}} |
|
8916 + |
|
8917 + Note: No $ appears before header_ or h_ in the condition, and the header |
|
8918 + name must be terminated by a colon if white space does not follow. |
|
8919 + |
|
8920 +eq {<string1>}{<string2>}, eqi {<string1>}{<string2>} |
|
8921 + |
|
8922 + The two substrings are first expanded. The condition is true if the two |
|
8923 + resulting strings are identical. For eq the comparison includes the case of |
|
8924 + letters, whereas for eqi the comparison is case-independent. |
|
8925 + |
|
8926 +exists {<file name>} |
|
8927 + |
|
8928 + The substring is first expanded and then interpreted as an absolute path. |
|
8929 + The condition is true if the named file (or directory) exists. The |
|
8930 + existence test is done by calling the stat() function. The use of the |
|
8931 + exists test in users' filter files may be locked out by the system |
|
8932 + administrator. |
|
8933 + |
|
8934 +first_delivery |
|
8935 + |
|
8936 + This condition, which has no data, is true during a message's first |
|
8937 + delivery attempt. It is false during any subsequent delivery attempts. |
|
8938 + |
|
8939 +forall{<a list>}{<a condition>}, forany{<a list>}{<a condition>} |
|
8940 + |
|
8941 + These conditions iterate over a list. The first argument is expanded to |
|
8942 + form the list. By default, the list separator is a colon, but it can be |
|
8943 + changed by the normal method. The second argument is interpreted as a |
|
8944 + condition that is to be applied to each item in the list in turn. During |
|
8945 + the interpretation of the condition, the current list item is placed in a |
|
8946 + variable called $item. |
|
8947 + |
|
8948 + * For forany, interpretation stops if the condition is true for any item, |
|
8949 + and the result of the whole condition is true. If the condition is |
|
8950 + false for all items in the list, the overall condition is false. |
|
8951 + |
|
8952 + * For forall, interpretation stops if the condition is false for any |
|
8953 + item, and the result of the whole condition is false. If the condition |
|
8954 + is true for all items in the list, the overall condition is true. |
|
8955 + |
|
8956 + Note that negation of forany means that the condition must be false for all |
|
8957 + items for the overall condition to succeed, and negation of forall means |
|
8958 + that the condition must be false for at least one item. In this example, |
|
8959 + the list separator is changed to a comma: |
|
8960 + |
|
8961 + ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}} |
|
8962 + |
|
8963 + The value of $item is saved and restored while forany or forall is being |
|
8964 + processed, to enable these expansion items to be nested. |
|
8965 + |
|
8966 +ge {<string1>}{<string2>}, gei {<string1>}{<string2>} |
|
8967 + |
|
8968 + The two substrings are first expanded. The condition is true if the first |
|
8969 + string is lexically greater than or equal to the second string. For ge the |
|
8970 + comparison includes the case of letters, whereas for gei the comparison is |
|
8971 + case-independent. |
|
8972 + |
|
8973 +gt {<string1>}{<string2>}, gti {<string1>}{<string2>} |
|
8974 + |
|
8975 + The two substrings are first expanded. The condition is true if the first |
|
8976 + string is lexically greater than the second string. For gt the comparison |
|
8977 + includes the case of letters, whereas for gti the comparison is |
|
8978 + case-independent. |
|
8979 + |
|
8980 +isip {<string>}, isip4 {<string>}, isip6 {<string>} |
|
8981 + |
|
8982 + The substring is first expanded, and then tested to see if it has the form |
|
8983 + of an IP address. Both IPv4 and IPv6 addresses are valid for isip, whereas |
|
8984 + isip4 and isip6 test specifically for IPv4 or IPv6 addresses. |
|
8985 + |
|
8986 + For an IPv4 address, the test is for four dot-separated components, each of |
|
8987 + which consists of from one to three digits. For an IPv6 address, up to |
|
8988 + eight colon-separated components are permitted, each containing from one to |
|
8989 + four hexadecimal digits. There may be fewer than eight components if an |
|
8990 + empty component (adjacent colons) is present. Only one empty component is |
|
8991 + permitted. |
|
8992 + |
|
8993 + Note: The checks are just on the form of the address; actual numerical |
|
8994 + values are not considered. Thus, for example, 999.999.999.999 passes the |
|
8995 + IPv4 check. The main use of these tests is to distinguish between IP |
|
8996 + addresses and host names, or between IPv4 and IPv6 addresses. For example, |
|
8997 + you could use |
|
8998 + |
|
8999 + ${if isip4{$sender_host_address}... |
|
9000 + |
|
9001 + to test which IP version an incoming SMTP connection is using. |
|
9002 + |
|
9003 +ldapauth {<ldap query>} |
|
9004 + |
|
9005 + This condition supports user authentication using LDAP. See section 9.13 |
|
9006 + for details of how to use LDAP in lookups and the syntax of queries. For |
|
9007 + this use, the query must contain a user name and password. The query itself |
|
9008 + is not used, and can be empty. The condition is true if the password is not |
|
9009 + empty, and the user name and password are accepted by the LDAP server. An |
|
9010 + empty password is rejected without calling LDAP because LDAP binds with an |
|
9011 + empty password are considered anonymous regardless of the username, and |
|
9012 + will succeed in most configurations. See chapter 33 for details of SMTP |
|
9013 + authentication, and chapter 34 for an example of how this can be used. |
|
9014 + |
|
9015 +le {<string1>}{<string2>}, lei {<string1>}{<string2>} |
|
9016 + |
|
9017 + The two substrings are first expanded. The condition is true if the first |
|
9018 + string is lexically less than or equal to the second string. For le the |
|
9019 + comparison includes the case of letters, whereas for lei the comparison is |
|
9020 + case-independent. |
|
9021 + |
|
9022 +lt {<string1>}{<string2>}, lti {<string1>}{<string2>} |
|
9023 + |
|
9024 + The two substrings are first expanded. The condition is true if the first |
|
9025 + string is lexically less than the second string. For lt the comparison |
|
9026 + includes the case of letters, whereas for lti the comparison is |
|
9027 + case-independent. |
|
9028 + |
|
9029 +match {<string1>}{<string2>} |
|
9030 + |
|
9031 + The two substrings are first expanded. The second is then treated as a |
|
9032 + regular expression and applied to the first. Because of the pre-expansion, |
|
9033 + if the regular expression contains dollar, or backslash characters, they |
|
9034 + must be escaped. Care must also be taken if the regular expression contains |
|
9035 + braces (curly brackets). A closing brace must be escaped so that it is not |
|
9036 + taken as a premature termination of <string2>. The easiest approach is to |
|
9037 + use the "\N" feature to disable expansion of the regular expression. For |
|
9038 + example, |
|
9039 + |
|
9040 + ${if match {$local_part}{\N^\d{3}\N} ... |
|
9041 + |
|
9042 + If the whole expansion string is in double quotes, further escaping of |
|
9043 + backslashes is also required. |
|
9044 + |
|
9045 + The condition is true if the regular expression match succeeds. The regular |
|
9046 + expression is not required to begin with a circumflex metacharacter, but if |
|
9047 + there is no circumflex, the expression is not anchored, and it may match |
|
9048 + anywhere in the subject, not just at the start. If you want the pattern to |
|
9049 + match at the end of the subject, you must include the "$" metacharacter at |
|
9050 + an appropriate point. |
|
9051 + |
|
9052 + At the start of an if expansion the values of the numeric variable |
|
9053 + substitutions $1 etc. are remembered. Obeying a match condition that |
|
9054 + succeeds causes them to be reset to the substrings of that condition and |
|
9055 + they will have these values during the expansion of the success string. At |
|
9056 + the end of the if expansion, the previous values are restored. After |
|
9057 + testing a combination of conditions using or, the subsequent values of the |
|
9058 + numeric variables are those of the condition that succeeded. |
|
9059 + |
|
9060 +match_address {<string1>}{<string2>} |
|
9061 + |
|
9062 + See match_local_part. |
|
9063 + |
|
9064 +match_domain {<string1>}{<string2>} |
|
9065 + |
|
9066 + See match_local_part. |
|
9067 + |
|
9068 +match_ip {<string1>}{<string2>} |
|
9069 + |
|
9070 + This condition matches an IP address to a list of IP address patterns. It |
|
9071 + must be followed by two argument strings. The first (after expansion) must |
|
9072 + be an IP address or an empty string. The second (after expansion) is a |
|
9073 + restricted host list that can match only an IP address, not a host name. |
|
9074 + For example: |
|
9075 + |
|
9076 + ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}} |
|
9077 + |
|
9078 + The specific types of host list item that are permitted in the list are: |
|
9079 + |
|
9080 + * An IP address, optionally with a CIDR mask. |
|
9081 + |
|
9082 + * A single asterisk, which matches any IP address. |
|
9083 + |
|
9084 + * An empty item, which matches only if the IP address is empty. This |
|
9085 + could be useful for testing for a locally submitted message or one from |
|
9086 + specific hosts in a single test such as |
|
9087 + |
|
9088 + ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}} |
|
9089 + |
|
9090 + where the first item in the list is the empty string. |
|
9091 + |
|
9092 + * The item @[] matches any of the local host's interface addresses. |
|
9093 + |
|
9094 + * Single-key lookups are assumed to be like "net-" style lookups in host |
|
9095 + lists, even if "net-" is not specified. There is never any attempt to |
|
9096 + turn the IP address into a host name. The most common type of linear |
|
9097 + search for match_ip is likely to be iplsearch, in which the file can |
|
9098 + contain CIDR masks. For example: |
|
9099 + |
|
9100 + ${if match_ip{$sender_host_address}{iplsearch;/some/file}... |
|
9101 + |
|
9102 + It is of course possible to use other kinds of lookup, and in such a |
|
9103 + case, you do need to specify the "net-" prefix if you want to specify a |
|
9104 + specific address mask, for example: |
|
9105 + |
|
9106 + ${if match_ip{$sender_host_address}{net24-dbm;/some/file}... |
|
9107 + |
|
9108 + However, unless you are combining a match_ip condition with others, it |
|
9109 + is just as easy to use the fact that a lookup is itself a condition, |
|
9110 + and write: |
|
9111 + |
|
9112 + ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}... |
|
9113 + |
|
9114 + Consult section 10.11 for further details of these patterns. |
|
9115 + |
|
9116 +match_local_part {<string1>}{<string2>} |
|
9117 + |
|
9118 + This condition, together with match_address and match_domain, make it |
|
9119 + possible to test domain, address, and local part lists within expansions. |
|
9120 + Each condition requires two arguments: an item and a list to match. A |
|
9121 + trivial example is: |
|
9122 + |
|
9123 + ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}} |
|
9124 + |
|
9125 + In each case, the second argument may contain any of the allowable items |
|
9126 + for a list of the appropriate type. Also, because the second argument |
|
9127 + (after expansion) is a standard form of list, it is possible to refer to a |
|
9128 + named list. Thus, you can use conditions like this: |
|
9129 + |
|
9130 + ${if match_domain{$domain}{+local_domains}{... |
|
9131 + |
|
9132 + For address lists, the matching starts off caselessly, but the "+caseful" |
|
9133 + item can be used, as in all address lists, to cause subsequent items to |
|
9134 + have their local parts matched casefully. Domains are always matched |
|
9135 + caselessly. |
|
9136 + |
|
9137 + Note: Host lists are not supported in this way. This is because hosts have |
|
9138 + two identities: a name and an IP address, and it is not clear how to |
|
9139 + specify cleanly how such a test would work. However, IP addresses can be |
|
9140 + matched using match_ip. |
|
9141 + |
|
9142 +pam {<string1>:<string2>:...} |
|
9143 + |
|
9144 + Pluggable Authentication Modules (http://www.kernel.org/pub/linux/libs/pam/ |
|
9145 + ) are a facility that is available in the latest releases of Solaris and in |
|
9146 + some GNU/Linux distributions. The Exim support, which is intended for use |
|
9147 + in conjunction with the SMTP AUTH command, is available only if Exim is |
|
9148 + compiled with |
|
9149 + |
|
9150 + SUPPORT_PAM=yes |
|
9151 + |
|
9152 + in Local/Makefile. You probably need to add -lpam to EXTRALIBS, and in some |
|
9153 + releases of GNU/Linux -ldl is also needed. |
|
9154 + |
|
9155 + The argument string is first expanded, and the result must be a |
|
9156 + colon-separated list of strings. Leading and trailing white space is |
|
9157 + ignored. The PAM module is initialized with the service name "exim" and the |
|
9158 + user name taken from the first item in the colon-separated data string (< |
|
9159 + string1>). The remaining items in the data string are passed over in |
|
9160 + response to requests from the authentication function. In the simple case |
|
9161 + there will only be one request, for a password, so the data consists of |
|
9162 + just two strings. |
|
9163 + |
|
9164 + There can be problems if any of the strings are permitted to contain colon |
|
9165 + characters. In the usual way, these have to be doubled to avoid being taken |
|
9166 + as separators. If the data is being inserted from a variable, the sg |
|
9167 + expansion item can be used to double any existing colons. For example, the |
|
9168 + configuration of a LOGIN authenticator might contain this setting: |
|
9169 + |
|
9170 + server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}} |
|
9171 + |
|
9172 + For a PLAIN authenticator you could use: |
|
9173 + |
|
9174 + server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}} |
|
9175 + |
|
9176 + In some operating systems, PAM authentication can be done only from a |
|
9177 + process running as root. Since Exim is running as the Exim user when |
|
9178 + receiving messages, this means that PAM cannot be used directly in those |
|
9179 + systems. A patched version of the pam_unix module that comes with the Linux |
|
9180 + PAM package is available from http://www.e-admin.de/pam_exim/. The patched |
|
9181 + module allows one special uid/gid combination, in addition to root, to |
|
9182 + authenticate. If you build the patched module to allow the Exim user and |
|
9183 + group, PAM can then be used from an Exim authenticator. |
|
9184 + |
|
9185 +pwcheck {<string1>:<string2>} |
|
9186 + |
|
9187 + This condition supports user authentication using the Cyrus pwcheck daemon. |
|
9188 + This is one way of making it possible for passwords to be checked by a |
|
9189 + process that is not running as root. Note: The use of pwcheck is now |
|
9190 + deprecated. Its replacement is saslauthd (see below). |
|
9191 + |
|
9192 + The pwcheck support is not included in Exim by default. You need to specify |
|
9193 + the location of the pwcheck daemon's socket in Local/Makefile before |
|
9194 + building Exim. For example: |
|
9195 + |
|
9196 + CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck |
|
9197 + |
|
9198 + You do not need to install the full Cyrus software suite in order to use |
|
9199 + the pwcheck daemon. You can compile and install just the daemon alone from |
|
9200 + the Cyrus SASL library. Ensure that exim is the only user that has access |
|
9201 + to the /var/pwcheck directory. |
|
9202 + |
|
9203 + The pwcheck condition takes one argument, which must be the user name and |
|
9204 + password, separated by a colon. For example, in a LOGIN authenticator |
|
9205 + configuration, you might have this: |
|
9206 + |
|
9207 + server_condition = ${if pwcheck{$auth1:$auth2}} |
|
9208 + |
|
9209 + Again, for a PLAIN authenticator configuration, this would be: |
|
9210 + |
|
9211 + server_condition = ${if pwcheck{$auth2:$auth3}} |
|
9212 + |
|
9213 +queue_running |
|
9214 + |
|
9215 + This condition, which has no data, is true during delivery attempts that |
|
9216 + are initiated by queue runner processes, and false otherwise. |
|
9217 + |
|
9218 +radius {<authentication string>} |
|
9219 + |
|
9220 + Radius authentication (RFC 2865) is supported in a similar way to PAM. You |
|
9221 + must set RADIUS_CONFIG_FILE in Local/Makefile to specify the location of |
|
9222 + the Radius client configuration file in order to build Exim with Radius |
|
9223 + support. |
|
9224 + |
|
9225 + With just that one setting, Exim expects to be linked with the radiusclient |
|
9226 + library, using the original API. If you are using release 0.4.0 or later of |
|
9227 + this library, you need to set |
|
9228 + |
|
9229 + RADIUS_LIB_TYPE=RADIUSCLIENTNEW |
|
9230 + |
|
9231 + in Local/Makefile when building Exim. You can also link Exim with the |
|
9232 + libradius library that comes with FreeBSD. To do this, set |
|
9233 + |
|
9234 + RADIUS_LIB_TYPE=RADLIB |
|
9235 + |
|
9236 + in Local/Makefile, in addition to setting RADIUS_CONFIGURE_FILE. You may |
|
9237 + also have to supply a suitable setting in EXTRALIBS so that the Radius |
|
9238 + library can be found when Exim is linked. |
|
9239 + |
|
9240 + The string specified by RADIUS_CONFIG_FILE is expanded and passed to the |
|
9241 + Radius client library, which calls the Radius server. The condition is true |
|
9242 + if the authentication is successful. For example: |
|
9243 + |
|
9244 + server_condition = ${if radius{<arguments>}} |
|
9245 + |
|
9246 +saslauthd {{<user>}{<password>}{<service>}{<realm>}} |
|
9247 + |
|
9248 + This condition supports user authentication using the Cyrus saslauthd |
|
9249 + daemon. This replaces the older pwcheck daemon, which is now deprecated. |
|
9250 + Using this daemon is one way of making it possible for passwords to be |
|
9251 + checked by a process that is not running as root. |
|
9252 + |
|
9253 + The saslauthd support is not included in Exim by default. You need to |
|
9254 + specify the location of the saslauthd daemon's socket in Local/Makefile |
|
9255 + before building Exim. For example: |
|
9256 + |
|
9257 + CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux |
|
9258 + |
|
9259 + You do not need to install the full Cyrus software suite in order to use |
|
9260 + the saslauthd daemon. You can compile and install just the daemon alone |
|
9261 + from the Cyrus SASL library. |
|
9262 + |
|
9263 + Up to four arguments can be supplied to the saslauthd condition, but only |
|
9264 + two are mandatory. For example: |
|
9265 + |
|
9266 + server_condition = ${if saslauthd{{$auth1}{$auth2}}} |
|
9267 + |
|
9268 + The service and the realm are optional (which is why the arguments are |
|
9269 + enclosed in their own set of braces). For details of the meaning of the |
|
9270 + service and realm, and how to run the daemon, consult the Cyrus |
|
9271 + documentation. |
|
9272 + |
|
9273 +11.8Â Combining expansion conditions |
|
9274 + |
|
9275 +Several conditions can be tested at once by combining them using the and and or |
|
9276 +combination conditions. Note that and and or are complete conditions on their |
|
9277 +own, and precede their lists of sub-conditions. Each sub-condition must be |
|
9278 +enclosed in braces within the overall braces that contain the list. No |
|
9279 +repetition of if is used. |
|
9280 + |
|
9281 +or {{<cond1>}{<cond2>}...} |
|
9282 + |
|
9283 + The sub-conditions are evaluated from left to right. The condition is true |
|
9284 + if any one of the sub-conditions is true. For example, |
|
9285 + |
|
9286 + ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}... |
|
9287 + |
|
9288 + When a true sub-condition is found, the following ones are parsed but not |
|
9289 + evaluated. If there are several "match" sub-conditions the values of the |
|
9290 + numeric variables afterwards are taken from the first one that succeeds. |
|
9291 + |
|
9292 +and {{<cond1>}{<cond2>}...} |
|
9293 + |
|
9294 + The sub-conditions are evaluated from left to right. The condition is true |
|
9295 + if all of the sub-conditions are true. If there are several "match" |
|
9296 + sub-conditions, the values of the numeric variables afterwards are taken |
|
9297 + from the last one. When a false sub-condition is found, the following ones |
|
9298 + are parsed but not evaluated. |
|
9299 + |
|
9300 +11.9Â Expansion variables |
|
9301 + |
|
9302 +This section contains an alphabetical list of all the expansion variables. Some |
|
9303 +of them are available only when Exim is compiled with specific options such as |
|
9304 +support for TLS or the content scanning extension. |
|
9305 + |
|
9306 +$0, $1, etc |
|
9307 + |
|
9308 + When a match expansion condition succeeds, these variables contain the |
|
9309 + captured substrings identified by the regular expression during subsequent |
|
9310 + processing of the success string of the containing if expansion item. |
|
9311 + However, they do not retain their values afterwards; in fact, their |
|
9312 + previous values are restored at the end of processing an if item. The |
|
9313 + numerical variables may also be set externally by some other matching |
|
9314 + process which precedes the expansion of the string. For example, the |
|
9315 + commands available in Exim filter files include an if command with its own |
|
9316 + regular expression matching condition. |
|
9317 + |
|
9318 +$acl_c... |
|
9319 + |
|
9320 + Values can be placed in these variables by the set modifier in an ACL. They |
|
9321 + can be given any name that starts with $acl_c and is at least six |
|
9322 + characters long, but the sixth character must be either a digit or an |
|
9323 + underscore. For example: $acl_c5, $acl_c_mycount. The values of the |
|
9324 + $acl_c... variables persist throughout the lifetime of an SMTP connection. |
|
9325 + They can be used to pass information between ACLs and between different |
|
9326 + invocations of the same ACL. When a message is received, the values of |
|
9327 + these variables are saved with the message, and can be accessed by filters, |
|
9328 + routers, and transports during subsequent delivery. |
|
9329 + |
|
9330 +$acl_m... |
|
9331 + |
|
9332 + These variables are like the $acl_c... variables, except that their values |
|
9333 + are reset after a message has been received. Thus, if several messages are |
|
9334 + received in one SMTP connection, $acl_m... values are not passed on from |
|
9335 + one message to the next, as $acl_c... values are. The $acl_m... variables |
|
9336 + are also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. |
|
9337 + When a message is received, the values of these variables are saved with |
|
9338 + the message, and can be accessed by filters, routers, and transports during |
|
9339 + subsequent delivery. |
|
9340 + |
|
9341 +$acl_verify_message |
|
9342 + |
|
9343 + After an address verification has failed, this variable contains the |
|
9344 + failure message. It retains its value for use in subsequent modifiers. The |
|
9345 + message can be preserved by coding like this: |
|
9346 + |
|
9347 + warn !verify = sender |
|
9348 + set acl_m0 = $acl_verify_message |
|
9349 + |
|
9350 + You can use $acl_verify_message during the expansion of the message or |
|
9351 + log_message modifiers, to include information about the verification |
|
9352 + failure. |
|
9353 + |
|
9354 +$address_data |
|
9355 + |
|
9356 + This variable is set by means of the address_data option in routers. The |
|
9357 + value then remains with the address while it is processed by subsequent |
|
9358 + routers and eventually a transport. If the transport is handling multiple |
|
9359 + addresses, the value from the first address is used. See chapter 15 for |
|
9360 + more details. Note: The contents of $address_data are visible in user |
|
9361 + filter files. |
|
9362 + |
|
9363 + If $address_data is set when the routers are called from an ACL to verify a |
|
9364 + recipient address, the final value is still in the variable for subsequent |
|
9365 + conditions and modifiers of the ACL statement. If routing the address |
|
9366 + caused it to be redirected to just one address, the child address is also |
|
9367 + routed as part of the verification, and in this case the final value of |
|
9368 + $address_data is from the child's routing. |
|
9369 + |
|
9370 + If $address_data is set when the routers are called from an ACL to verify a |
|
9371 + sender address, the final value is also preserved, but this time in |
|
9372 + $sender_address_data, to distinguish it from data from a recipient address. |
|
9373 + |
|
9374 + In both cases (recipient and sender verification), the value does not |
|
9375 + persist after the end of the current ACL statement. If you want to preserve |
|
9376 + these values for longer, you can save them in ACL variables. |
|
9377 + |
|
9378 +$address_file |
|
9379 + |
|
9380 + When, as a result of aliasing, forwarding, or filtering, a message is |
|
9381 + directed to a specific file, this variable holds the name of the file when |
|
9382 + the transport is running. At other times, the variable is empty. For |
|
9383 + example, using the default configuration, if user r2d2 has a .forward file |
|
9384 + containing |
|
9385 + |
|
9386 + /home/r2d2/savemail |
|
9387 + |
|
9388 + then when the address_file transport is running, $address_file contains the |
|
9389 + text string "/home/r2d2/savemail". For Sieve filters, the value may be |
|
9390 + "inbox" or a relative folder name. It is then up to the transport |
|
9391 + configuration to generate an appropriate absolute path to the relevant |
|
9392 + file. |
|
9393 + |
|
9394 +$address_pipe |
|
9395 + |
|
9396 + When, as a result of aliasing or forwarding, a message is directed to a |
|
9397 + pipe, this variable holds the pipe command when the transport is running. |
|
9398 + |
|
9399 +$auth1 - $auth3 |
|
9400 + |
|
9401 + These variables are used in SMTP authenticators (see chapters 34-38). |
|
9402 + Elsewhere, they are empty. |
|
9403 + |
|
9404 +$authenticated_id |
|
9405 + |
|
9406 + When a server successfully authenticates a client it may be configured to |
|
9407 + preserve some of the authentication information in the variable |
|
9408 + $authenticated_id (see chapter 33). For example, a user/password |
|
9409 + authenticator configuration might preserve the user name for use in the |
|
9410 + routers. Note that this is not the same information that is saved in |
|
9411 + $sender_host_authenticated. When a message is submitted locally (that is, |
|
9412 + not over a TCP connection) the value of $authenticated_id is normally the |
|
9413 + login name of the calling process. However, a trusted user can override |
|
9414 + this by means of the -oMai command line option. |
|
9415 + |
|
9416 +$authenticated_sender |
|
9417 + |
|
9418 + When acting as a server, Exim takes note of the AUTH= parameter on an |
|
9419 + incoming SMTP MAIL command if it believes the sender is sufficiently |
|
9420 + trusted, as described in section 33.2. Unless the data is the string "<>", |
|
9421 + it is set as the authenticated sender of the message, and the value is |
|
9422 + available during delivery in the $authenticated_sender variable. If the |
|
9423 + sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the |
|
9424 + data. |
|
9425 + |
|
9426 + When a message is submitted locally (that is, not over a TCP connection), |
|
9427 + the value of $authenticated_sender is an address constructed from the login |
|
9428 + name of the calling process and $qualify_domain, except that a trusted user |
|
9429 + can override this by means of the -oMas command line option. |
|
9430 + |
|
9431 +$authentication_failed |
|
9432 + |
|
9433 + This variable is set to "1" in an Exim server if a client issues an AUTH |
|
9434 + command that does not succeed. Otherwise it is set to "0". This makes it |
|
9435 + possible to distinguish between "did not try to authenticate" ( |
|
9436 + $sender_host_authenticated is empty and $authentication_failed is set to |
|
9437 + "0") and "tried to authenticate but failed" ($sender_host_authenticated is |
|
9438 + empty and $authentication_failed is set to "1"). Failure includes any |
|
9439 + negative response to an AUTH command, including (for example) an attempt to |
|
9440 + use an undefined mechanism. |
|
9441 + |
|
9442 +$body_linecount |
|
9443 + |
|
9444 + When a message is being received or delivered, this variable contains the |
|
9445 + number of lines in the message's body. See also $message_linecount. |
|
9446 + |
|
9447 +$body_zerocount |
|
9448 + |
|
9449 + When a message is being received or delivered, this variable contains the |
|
9450 + number of binary zero bytes in the message's body. |
|
9451 + |
|
9452 +$bounce_recipient |
|
9453 + |
|
9454 + This is set to the recipient address of a bounce message while Exim is |
|
9455 + creating it. It is useful if a customized bounce message text file is in |
|
9456 + use (see chapter 46). |
|
9457 + |
|
9458 +$bounce_return_size_limit |
|
9459 + |
|
9460 + This contains the value set in the bounce_return_size_limit option, rounded |
|
9461 + up to a multiple of 1000. It is useful when a customized error message text |
|
9462 + file is in use (see chapter 46). |
|
9463 + |
|
9464 +$caller_gid |
|
9465 + |
|
9466 + The real group id under which the process that called Exim was running. |
|
9467 + This is not the same as the group id of the originator of a message (see |
|
9468 + $originator_gid). If Exim re-execs itself, this variable in the new |
|
9469 + incarnation normally contains the Exim gid. |
|
9470 + |
|
9471 +$caller_uid |
|
9472 + |
|
9473 + The real user id under which the process that called Exim was running. This |
|
9474 + is not the same as the user id of the originator of a message (see |
|
9475 + $originator_uid). If Exim re-execs itself, this variable in the new |
|
9476 + incarnation normally contains the Exim uid. |
|
9477 + |
|
9478 +$compile_date |
|
9479 + |
|
9480 + The date on which the Exim binary was compiled. |
|
9481 + |
|
9482 +$compile_number |
|
9483 + |
|
9484 + The building process for Exim keeps a count of the number of times it has |
|
9485 + been compiled. This serves to distinguish different compilations of the |
|
9486 + same version of the program. |
|
9487 + |
|
9488 +$demime_errorlevel |
|
9489 + |
|
9490 + This variable is available when Exim is compiled with the content-scanning |
|
9491 + extension and the obsolete demime condition. For details, see section 41.6. |
|
9492 + |
|
9493 +$demime_reason |
|
9494 + |
|
9495 + This variable is available when Exim is compiled with the content-scanning |
|
9496 + extension and the obsolete demime condition. For details, see section 41.6. |
|
9497 + |
|
9498 +$dnslist_domain, $dnslist_matched, $dnslist_text, $dnslist_value |
|
9499 + |
|
9500 + When a DNS (black) list lookup succeeds, these variables are set to contain |
|
9501 + the following data from the lookup: the list's domain name, the key that |
|
9502 + was looked up, the contents of any associated TXT record, and the value |
|
9503 + from the main A record. See section 40.30 for more details. |
|
9504 + |
|
9505 +$domain |
|
9506 + |
|
9507 + When an address is being routed, or delivered on its own, this variable |
|
9508 + contains the domain. Uppercase letters in the domain are converted into |
|
9509 + lower case for $domain. |
|
9510 + |
|
9511 + Global address rewriting happens when a message is received, so the value |
|
9512 + of $domain during routing and delivery is the value after rewriting. |
|
9513 + $domain is set during user filtering, but not during system filtering, |
|
9514 + because a message may have many recipients and the system filter is called |
|
9515 + just once. |
|
9516 + |
|
9517 + When more than one address is being delivered at once (for example, several |
|
9518 + RCPT commands in one SMTP delivery), $domain is set only if they all have |
|
9519 + the same domain. Transports can be restricted to handling only one domain |
|
9520 + at a time if the value of $domain is required at transport time - this is |
|
9521 + the default for local transports. For further details of the environment in |
|
9522 + which local transports are run, see chapter 23. |
|
9523 + |
|
9524 + At the end of a delivery, if all deferred addresses have the same domain, |
|
9525 + it is set in $domain during the expansion of delay_warning_condition. |
|
9526 + |
|
9527 + The $domain variable is also used in some other circumstances: |
|
9528 + |
|
9529 + * When an ACL is running for a RCPT command, $domain contains the domain |
|
9530 + of the recipient address. The domain of the sender address is in |
|
9531 + $sender_address_domain at both MAIL time and at RCPT time. $domain is |
|
9532 + not normally set during the running of the MAIL ACL. However, if the |
|
9533 + sender address is verified with a callout during the MAIL ACL, the |
|
9534 + sender domain is placed in $domain during the expansions of hosts, |
|
9535 + interface, and port in the smtp transport. |
|
9536 + |
|
9537 + * When a rewrite item is being processed (see chapter 31), $domain |
|
9538 + contains the domain portion of the address that is being rewritten; it |
|
9539 + can be used in the expansion of the replacement address, for example, |
|
9540 + to rewrite domains by file lookup. |
|
9541 + |
|
9542 + * With one important exception, whenever a domain list is being scanned, |
|
9543 + $domain contains the subject domain. Exception: When a domain list in a |
|
9544 + sender_domains condition in an ACL is being processed, the subject |
|
9545 + domain is in $sender_address_domain and not in $domain. It works this |
|
9546 + way so that, in a RCPT ACL, the sender domain list can be dependent on |
|
9547 + the recipient domain (which is what is in $domain at this time). |
|
9548 + |
|
9549 + * When the smtp_etrn_command option is being expanded, $domain contains |
|
9550 + the complete argument of the ETRN command (see section 45.8). |
|
9551 + |
|
9552 +$domain_data |
|
9553 + |
|
9554 + When the domains option on a router matches a domain by means of a lookup, |
|
9555 + the data read by the lookup is available during the running of the router |
|
9556 + as $domain_data. In addition, if the driver routes the address to a |
|
9557 + transport, the value is available in that transport. If the transport is |
|
9558 + handling multiple addresses, the value from the first address is used. |
|
9559 + |
|
9560 + $domain_data is also set when the domains condition in an ACL matches a |
|
9561 + domain by means of a lookup. The data read by the lookup is available |
|
9562 + during the rest of the ACL statement. In all other situations, this |
|
9563 + variable expands to nothing. |
|
9564 + |
|
9565 +$exim_gid |
|
9566 + |
|
9567 + This variable contains the numerical value of the Exim group id. |
|
9568 + |
|
9569 +$exim_path |
|
9570 + |
|
9571 + This variable contains the path to the Exim binary. |
|
9572 + |
|
9573 +$exim_uid |
|
9574 + |
|
9575 + This variable contains the numerical value of the Exim user id. |
|
9576 + |
|
9577 +$found_extension |
|
9578 + |
|
9579 + This variable is available when Exim is compiled with the content-scanning |
|
9580 + extension and the obsolete demime condition. For details, see section 41.6. |
|
9581 + |
|
9582 +$header_<name> |
|
9583 + |
|
9584 + This is not strictly an expansion variable. It is expansion syntax for |
|
9585 + inserting the message header line with the given name. Note that the name |
|
9586 + must be terminated by colon or white space, because it may contain a wide |
|
9587 + variety of characters. Note also that braces must not be used. |
|
9588 + |
|
9589 +$home |
|
9590 + |
|
9591 + When the check_local_user option is set for a router, the user's home |
|
9592 + directory is placed in $home when the check succeeds. In particular, this |
|
9593 + means it is set during the running of users' filter files. A router may |
|
9594 + also explicitly set a home directory for use by a transport; this can be |
|
9595 + overridden by a setting on the transport itself. |
|
9596 + |
|
9597 + When running a filter test via the -bf option, $home is set to the value of |
|
9598 + the environment variable HOME. |
|
9599 + |
|
9600 +$host |
|
9601 + |
|
9602 + If a router assigns an address to a transport (any transport), and passes a |
|
9603 + list of hosts with the address, the value of $host when the transport |
|
9604 + starts to run is the name of the first host on the list. Note that this |
|
9605 + applies both to local and remote transports. |
|
9606 + |
|
9607 + For the smtp transport, if there is more than one host, the value of $host |
|
9608 + changes as the transport works its way through the list. In particular, |
|
9609 + when the smtp transport is expanding its options for encryption using TLS, |
|
9610 + or for specifying a transport filter (see chapter 24), $host contains the |
|
9611 + name of the host to which it is connected. |
|
9612 + |
|
9613 + When used in the client part of an authenticator configuration (see chapter |
|
9614 + 33), $host contains the name of the server to which the client is |
|
9615 + connected. |
|
9616 + |
|
9617 +$host_address |
|
9618 + |
|
9619 + This variable is set to the remote host's IP address whenever $host is set |
|
9620 + for a remote connection. It is also set to the IP address that is being |
|
9621 + checked when the ignore_target_hosts option is being processed. |
|
9622 + |
|
9623 +$host_data |
|
9624 + |
|
9625 + If a hosts condition in an ACL is satisfied by means of a lookup, the |
|
9626 + result of the lookup is made available in the $host_data variable. This |
|
9627 + allows you, for example, to do things like this: |
|
9628 + |
|
9629 + deny hosts = net-lsearch;/some/file |
|
9630 + message = $host_data |
|
9631 + |
|
9632 +$host_lookup_deferred |
|
9633 + |
|
9634 + This variable normally contains "0", as does $host_lookup_failed. When a |
|
9635 + message comes from a remote host and there is an attempt to look up the |
|
9636 + host's name from its IP address, and the attempt is not successful, one of |
|
9637 + these variables is set to "1". |
|
9638 + |
|
9639 + * If the lookup receives a definite negative response (for example, a DNS |
|
9640 + lookup succeeded, but no records were found), $host_lookup_failed is |
|
9641 + set to "1". |
|
9642 + |
|
9643 + * If there is any kind of problem during the lookup, such that Exim |
|
9644 + cannot tell whether or not the host name is defined (for example, a |
|
9645 + timeout for a DNS lookup), $host_lookup_deferred is set to "1". |
|
9646 + |
|
9647 + Looking up a host's name from its IP address consists of more than just a |
|
9648 + single reverse lookup. Exim checks that a forward lookup of at least one of |
|
9649 + the names it receives from a reverse lookup yields the original IP address. |
|
9650 + If this is not the case, Exim does not accept the looked up name(s), and |
|
9651 + $host_lookup_failed is set to "1". Thus, being able to find a name from an |
|
9652 + IP address (for example, the existence of a PTR record in the DNS) is not |
|
9653 + sufficient on its own for the success of a host name lookup. If the reverse |
|
9654 + lookup succeeds, but there is a lookup problem such as a timeout when |
|
9655 + checking the result, the name is not accepted, and $host_lookup_deferred is |
|
9656 + set to "1". See also $sender_host_name. |
|
9657 + |
|
9658 +$host_lookup_failed |
|
9659 + |
|
9660 + See $host_lookup_deferred. |
|
9661 + |
|
9662 +$inode |
|
9663 + |
|
9664 + The only time this variable is set is while expanding the directory_file |
|
9665 + option in the appendfile transport. The variable contains the inode number |
|
9666 + of the temporary file which is about to be renamed. It can be used to |
|
9667 + construct a unique name for the file. |
|
9668 + |
|
9669 +$interface_address |
|
9670 + |
|
9671 + This is an obsolete name for $received_ip_address. |
|
9672 + |
|
9673 +$interface_port |
|
9674 + |
|
9675 + This is an obsolete name for $received_port. |
|
9676 + |
|
9677 +$item |
|
9678 + |
|
9679 + This variable is used during the expansion of forall and forany conditions |
|
9680 + (see section 11.7), and filter, map, and reduce items (see section 11.7). |
|
9681 + In other circumstances, it is empty. |
|
9682 + |
|
9683 +$ldap_dn |
|
9684 + |
|
9685 + This variable, which is available only when Exim is compiled with LDAP |
|
9686 + support, contains the DN from the last entry in the most recently |
|
9687 + successful LDAP lookup. |
|
9688 + |
|
9689 +$load_average |
|
9690 + |
|
9691 + This variable contains the system load average, multiplied by 1000 so that |
|
9692 + it is an integer. For example, if the load average is 0.21, the value of |
|
9693 + the variable is 210. The value is recomputed every time the variable is |
|
9694 + referenced. |
|
9695 + |
|
9696 +$local_part |
|
9697 + |
|
9698 + When an address is being routed, or delivered on its own, this variable |
|
9699 + contains the local part. When a number of addresses are being delivered |
|
9700 + together (for example, multiple RCPT commands in an SMTP session), |
|
9701 + $local_part is not set. |
|
9702 + |
|
9703 + Global address rewriting happens when a message is received, so the value |
|
9704 + of $local_part during routing and delivery is the value after rewriting. |
|
9705 + $local_part is set during user filtering, but not during system filtering, |
|
9706 + because a message may have many recipients and the system filter is called |
|
9707 + just once. |
|
9708 + |
|
9709 + If a local part prefix or suffix has been recognized, it is not included in |
|
9710 + the value of $local_part during routing and subsequent delivery. The values |
|
9711 + of any prefix or suffix are in $local_part_prefix and $local_part_suffix, |
|
9712 + respectively. |
|
9713 + |
|
9714 + When a message is being delivered to a file, pipe, or autoreply transport |
|
9715 + as a result of aliasing or forwarding, $local_part is set to the local part |
|
9716 + of the parent address, not to the file name or command (see $address_file |
|
9717 + and $address_pipe). |
|
9718 + |
|
9719 + When an ACL is running for a RCPT command, $local_part contains the local |
|
9720 + part of the recipient address. |
|
9721 + |
|
9722 + When a rewrite item is being processed (see chapter 31), $local_part |
|
9723 + contains the local part of the address that is being rewritten; it can be |
|
9724 + used in the expansion of the replacement address, for example. |
|
9725 + |
|
9726 + In all cases, all quoting is removed from the local part. For example, for |
|
9727 + both the addresses |
|
9728 + |
|
9729 + "abc:xyz"@test.example |
|
9730 + abc\:xyz@test.example |
|
9731 + |
|
9732 + the value of $local_part is |
|
9733 + |
|
9734 + abc:xyz |
|
9735 + |
|
9736 + If you use $local_part to create another address, you should always wrap it |
|
9737 + inside a quoting operator. For example, in a redirect router you could |
|
9738 + have: |
|
9739 + |
|
9740 + data = ${quote_local_part:$local_part}@new.domain.example |
|
9741 + |
|
9742 + Note: The value of $local_part is normally lower cased. If you want to |
|
9743 + process local parts in a case-dependent manner in a router, you can set the |
|
9744 + caseful_local_part option (see chapter 15). |
|
9745 + |
|
9746 +$local_part_data |
|
9747 + |
|
9748 + When the local_parts option on a router matches a local part by means of a |
|
9749 + lookup, the data read by the lookup is available during the running of the |
|
9750 + router as $local_part_data. In addition, if the driver routes the address |
|
9751 + to a transport, the value is available in that transport. If the transport |
|
9752 + is handling multiple addresses, the value from the first address is used. |
|
9753 + |
|
9754 + $local_part_data is also set when the local_parts condition in an ACL |
|
9755 + matches a local part by means of a lookup. The data read by the lookup is |
|
9756 + available during the rest of the ACL statement. In all other situations, |
|
9757 + this variable expands to nothing. |
|
9758 + |
|
9759 +$local_part_prefix |
|
9760 + |
|
9761 + When an address is being routed or delivered, and a specific prefix for the |
|
9762 + local part was recognized, it is available in this variable, having been |
|
9763 + removed from $local_part. |
|
9764 + |
|
9765 +$local_part_suffix |
|
9766 + |
|
9767 + When an address is being routed or delivered, and a specific suffix for the |
|
9768 + local part was recognized, it is available in this variable, having been |
|
9769 + removed from $local_part. |
|
9770 + |
|
9771 +$local_scan_data |
|
9772 + |
|
9773 + This variable contains the text returned by the local_scan() function when |
|
9774 + a message is received. See chapter 42 for more details. |
|
9775 + |
|
9776 +$local_user_gid |
|
9777 + |
|
9778 + See $local_user_uid. |
|
9779 + |
|
9780 +$local_user_uid |
|
9781 + |
|
9782 + This variable and $local_user_gid are set to the uid and gid after the |
|
9783 + check_local_user router precondition succeeds. This means that their values |
|
9784 + are available for the remaining preconditions (senders, require_files, and |
|
9785 + condition), for the address_data expansion, and for any router-specific |
|
9786 + expansions. At all other times, the values in these variables are "(uid_t) |
|
9787 + (-1)" and "(gid_t)(-1)", respectively. |
|
9788 + |
|
9789 +$localhost_number |
|
9790 + |
|
9791 + This contains the expanded value of the localhost_number option. The |
|
9792 + expansion happens after the main options have been read. |
|
9793 + |
|
9794 +$log_inodes |
|
9795 + |
|
9796 + The number of free inodes in the disk partition where Exim's log files are |
|
9797 + being written. The value is recalculated whenever the variable is |
|
9798 + referenced. If the relevant file system does not have the concept of |
|
9799 + inodes, the value of is -1. See also the check_log_inodes option. |
|
9800 + |
|
9801 +$log_space |
|
9802 + |
|
9803 + The amount of free space (as a number of kilobytes) in the disk partition |
|
9804 + where Exim's log files are being written. The value is recalculated |
|
9805 + whenever the variable is referenced. If the operating system does not have |
|
9806 + the ability to find the amount of free space (only true for experimental |
|
9807 + systems), the space value is -1. See also the check_log_space option. |
|
9808 + |
|
9809 +$mailstore_basename |
|
9810 + |
|
9811 + This variable is set only when doing deliveries in "mailstore" format in |
|
9812 + the appendfile transport. During the expansion of the mailstore_prefix, |
|
9813 + mailstore_suffix, message_prefix, and message_suffix options, it contains |
|
9814 + the basename of the files that are being written, that is, the name without |
|
9815 + the ".tmp", ".env", or ".msg" suffix. At all other times, this variable is |
|
9816 + empty. |
|
9817 + |
|
9818 +$malware_name |
|
9819 + |
|
9820 + This variable is available when Exim is compiled with the content-scanning |
|
9821 + extension. It is set to the name of the virus that was found when the ACL |
|
9822 + malware condition is true (see section 41.1). |
|
9823 + |
|
9824 +$max_received_linelength |
|
9825 + |
|
9826 + This variable contains the number of bytes in the longest line that was |
|
9827 + received as part of the message, not counting the line termination |
|
9828 + character(s). |
|
9829 + |
|
9830 +$message_age |
|
9831 + |
|
9832 + This variable is set at the start of a delivery attempt to contain the |
|
9833 + number of seconds since the message was received. It does not change during |
|
9834 + a single delivery attempt. |
|
9835 + |
|
9836 +$message_body |
|
9837 + |
|
9838 + This variable contains the initial portion of a message's body while it is |
|
9839 + being delivered, and is intended mainly for use in filter files. The |
|
9840 + maximum number of characters of the body that are put into the variable is |
|
9841 + set by the message_body_visible configuration option; the default is 500. |
|
9842 + |
|
9843 + By default, newlines are converted into spaces in $message_body, to make it |
|
9844 + easier to search for phrases that might be split over a line break. |
|
9845 + However, this can be disabled by setting message_body_newlines to be true. |
|
9846 + Binary zeros are always converted into spaces. |
|
9847 + |
|
9848 +$message_body_end |
|
9849 + |
|
9850 + This variable contains the final portion of a message's body while it is |
|
9851 + being delivered. The format and maximum size are as for $message_body. |
|
9852 + |
|
9853 +$message_body_size |
|
9854 + |
|
9855 + When a message is being delivered, this variable contains the size of the |
|
9856 + body in bytes. The count starts from the character after the blank line |
|
9857 + that separates the body from the header. Newlines are included in the |
|
9858 + count. See also $message_size, $body_linecount, and $body_zerocount. |
|
9859 + |
|
9860 +$message_exim_id |
|
9861 + |
|
9862 + When a message is being received or delivered, this variable contains the |
|
9863 + unique message id that is generated and used by Exim to identify the |
|
9864 + message. An id is not created for a message until after its header has been |
|
9865 + successfully received. Note: This is not the contents of the Message-ID: |
|
9866 + header line; it is the local id that Exim assigns to the message, for |
|
9867 + example: "1BXTIK-0001yO-VA". |
|
9868 + |
|
9869 +$message_headers |
|
9870 + |
|
9871 + This variable contains a concatenation of all the header lines when a |
|
9872 + message is being processed, except for lines added by routers or |
|
9873 + transports. The header lines are separated by newline characters. Their |
|
9874 + contents are decoded in the same way as a header line that is inserted by |
|
9875 + bheader. |
|
9876 + |
|
9877 +$message_headers_raw |
|
9878 + |
|
9879 + This variable is like $message_headers except that no processing of the |
|
9880 + contents of header lines is done. |
|
9881 + |
|
9882 +$message_id |
|
9883 + |
|
9884 + This is an old name for $message_exim_id, which is now deprecated. |
|
9885 + |
|
9886 +$message_linecount |
|
9887 + |
|
9888 + This variable contains the total number of lines in the header and body of |
|
9889 + the message. Compare $body_linecount, which is the count for the body only. |
|
9890 + During the DATA and content-scanning ACLs, $message_linecount contains the |
|
9891 + number of lines received. Before delivery happens (that is, before filters, |
|
9892 + routers, and transports run) the count is increased to include the |
|
9893 + Received: header line that Exim standardly adds, and also any other header |
|
9894 + lines that are added by ACLs. The blank line that separates the message |
|
9895 + header from the body is not counted. Here is an example of the use of this |
|
9896 + variable in a DATA ACL: |
|
9897 + |
|
9898 + deny message = Too many lines in message header |
|
9899 + condition = \ |
|
9900 + ${if <{250}{${eval:$message_linecount - $body_linecount}}} |
|
9901 + |
|
9902 + In the MAIL and RCPT ACLs, the value is zero because at that stage the |
|
9903 + message has not yet been received. |
|
9904 + |
|
9905 +$message_size |
|
9906 + |
|
9907 + When a message is being processed, this variable contains its size in |
|
9908 + bytes. In most cases, the size includes those headers that were received |
|
9909 + with the message, but not those (such as Envelope-to:) that are added to |
|
9910 + individual deliveries as they are written. However, there is one special |
|
9911 + case: during the expansion of the maildir_tag option in the appendfile |
|
9912 + transport while doing a delivery in maildir format, the value of |
|
9913 + $message_size is the precise size of the file that has been written. See |
|
9914 + also $message_body_size, $body_linecount, and $body_zerocount. |
|
9915 + |
|
9916 + While running a per message ACL (mail/rcpt/predata), $message_size contains |
|
9917 + the size supplied on the MAIL command, or -1 if no size was given. The |
|
9918 + value may not, of course, be truthful. |
|
9919 + |
|
9920 +$mime_xxx |
|
9921 + |
|
9922 + A number of variables whose names start with $mime are available when Exim |
|
9923 + is compiled with the content-scanning extension. For details, see section |
|
9924 + 41.4. |
|
9925 + |
|
9926 +$n0 - $n9 |
|
9927 + |
|
9928 + These variables are counters that can be incremented by means of the add |
|
9929 + command in filter files. |
|
9930 + |
|
9931 +$original_domain |
|
9932 + |
|
9933 + When a top-level address is being processed for delivery, this contains the |
|
9934 + same value as $domain. However, if a "child" address (for example, |
|
9935 + generated by an alias, forward, or filter file) is being processed, this |
|
9936 + variable contains the domain of the original address (lower cased). This |
|
9937 + differs from $parent_domain only when there is more than one level of |
|
9938 + aliasing or forwarding. When more than one address is being delivered in a |
|
9939 + single transport run, $original_domain is not set. |
|
9940 + |
|
9941 + If a new address is created by means of a deliver command in a system |
|
9942 + filter, it is set up with an artificial "parent" address. This has the |
|
9943 + local part system-filter and the default qualify domain. |
|
9944 + |
|
9945 +$original_local_part |
|
9946 + |
|
9947 + When a top-level address is being processed for delivery, this contains the |
|
9948 + same value as $local_part, unless a prefix or suffix was removed from the |
|
9949 + local part, because $original_local_part always contains the full local |
|
9950 + part. When a "child" address (for example, generated by an alias, forward, |
|
9951 + or filter file) is being processed, this variable contains the full local |
|
9952 + part of the original address. |
|
9953 + |
|
9954 + If the router that did the redirection processed the local part |
|
9955 + case-insensitively, the value in $original_local_part is in lower case. |
|
9956 + This variable differs from $parent_local_part only when there is more than |
|
9957 + one level of aliasing or forwarding. When more than one address is being |
|
9958 + delivered in a single transport run, $original_local_part is not set. |
|
9959 + |
|
9960 + If a new address is created by means of a deliver command in a system |
|
9961 + filter, it is set up with an artificial "parent" address. This has the |
|
9962 + local part system-filter and the default qualify domain. |
|
9963 + |
|
9964 +$originator_gid |
|
9965 + |
|
9966 + This variable contains the value of $caller_gid that was set when the |
|
9967 + message was received. For messages received via the command line, this is |
|
9968 + the gid of the sending user. For messages received by SMTP over TCP/IP, |
|
9969 + this is normally the gid of the Exim user. |
|
9970 + |
|
9971 +$originator_uid |
|
9972 + |
|
9973 + The value of $caller_uid that was set when the message was received. For |
|
9974 + messages received via the command line, this is the uid of the sending |
|
9975 + user. For messages received by SMTP over TCP/IP, this is normally the uid |
|
9976 + of the Exim user. |
|
9977 + |
|
9978 +$parent_domain |
|
9979 + |
|
9980 + This variable is similar to $original_domain (see above), except that it |
|
9981 + refers to the immediately preceding parent address. |
|
9982 + |
|
9983 +$parent_local_part |
|
9984 + |
|
9985 + This variable is similar to $original_local_part (see above), except that |
|
9986 + it refers to the immediately preceding parent address. |
|
9987 + |
|
9988 +$pid |
|
9989 + |
|
9990 + This variable contains the current process id. |
|
9991 + |
|
9992 +$pipe_addresses |
|
9993 + |
|
9994 + This is not an expansion variable, but is mentioned here because the string |
|
9995 + "$pipe_addresses" is handled specially in the command specification for the |
|
9996 + pipe transport (chapter 29) and in transport filters (described under |
|
9997 + transport_filter in chapter 24). It cannot be used in general expansion |
|
9998 + strings, and provokes an "unknown variable" error if encountered. |
|
9999 + |
|
10000 +$primary_hostname |
|
10001 + |
|
10002 + This variable contains the value set by primary_hostname in the |
|
10003 + configuration file, or read by the uname() function. If uname() returns a |
|
10004 + single-component name, Exim calls gethostbyname() (or getipnodebyname() |
|
10005 + where available) in an attempt to acquire a fully qualified host name. See |
|
10006 + also $smtp_active_hostname. |
|
10007 + |
|
10008 +$prvscheck_address |
|
10009 + |
|
10010 + This variable is used in conjunction with the prvscheck expansion item, |
|
10011 + which is described in sections 11.5 and 40.48. |
|
10012 + |
|
10013 +$prvscheck_keynum |
|
10014 + |
|
10015 + This variable is used in conjunction with the prvscheck expansion item, |
|
10016 + which is described in sections 11.5 and 40.48. |
|
10017 + |
|
10018 +$prvscheck_result |
|
10019 + |
|
10020 + This variable is used in conjunction with the prvscheck expansion item, |
|
10021 + which is described in sections 11.5 and 40.48. |
|
10022 + |
|
10023 +$qualify_domain |
|
10024 + |
|
10025 + The value set for the qualify_domain option in the configuration file. |
|
10026 + |
|
10027 +$qualify_recipient |
|
10028 + |
|
10029 + The value set for the qualify_recipient option in the configuration file, |
|
10030 + or if not set, the value of $qualify_domain. |
|
10031 + |
|
10032 +$rcpt_count |
|
10033 + |
|
10034 + When a message is being received by SMTP, this variable contains the number |
|
10035 + of RCPT commands received for the current message. If this variable is used |
|
10036 + in a RCPT ACL, its value includes the current command. |
|
10037 + |
|
10038 +$rcpt_defer_count |
|
10039 + |
|
10040 + When a message is being received by SMTP, this variable contains the number |
|
10041 + of RCPT commands in the current message that have previously been rejected |
|
10042 + with a temporary (4xx) response. |
|
10043 + |
|
10044 +$rcpt_fail_count |
|
10045 + |
|
10046 + When a message is being received by SMTP, this variable contains the number |
|
10047 + of RCPT commands in the current message that have previously been rejected |
|
10048 + with a permanent (5xx) response. |
|
10049 + |
|
10050 +$received_count |
|
10051 + |
|
10052 + This variable contains the number of Received: header lines in the message, |
|
10053 + including the one added by Exim (so its value is always greater than zero). |
|
10054 + It is available in the DATA ACL, the non-SMTP ACL, and while routing and |
|
10055 + delivering. |
|
10056 + |
|
10057 +$received_for |
|
10058 + |
|
10059 + If there is only a single recipient address in an incoming message, this |
|
10060 + variable contains that address when the Received: header line is being |
|
10061 + built. The value is copied after recipient rewriting has happened, but |
|
10062 + before the local_scan() function is run. |
|
10063 + |
|
10064 +$received_ip_address |
|
10065 + |
|
10066 + As soon as an Exim server starts processing an incoming TCP/IP connection, |
|
10067 + this variable is set to the address of the local IP interface, and |
|
10068 + $received_port is set to the local port number. (The remote IP address and |
|
10069 + port are in $sender_host_address and $sender_host_port.) When testing with |
|
10070 + -bh, the port value is -1 unless it has been set using the -oMi command |
|
10071 + line option. |
|
10072 + |
|
10073 + As well as being useful in ACLs (including the "connect" ACL), these |
|
10074 + variable could be used, for example, to make the file name for a TLS |
|
10075 + certificate depend on which interface and/or port is being used for the |
|
10076 + incoming connection. The values of $received_ip_address and $received_port |
|
10077 + are saved with any messages that are received, thus making these variables |
|
10078 + available at delivery time. |
|
10079 + |
|
10080 + Note: There are no equivalent variables for outgoing connections, because |
|
10081 + the values are unknown (unless they are explicitly set by options of the |
|
10082 + smtp transport). |
|
10083 + |
|
10084 +$received_port |
|
10085 + |
|
10086 + See $received_ip_address. |
|
10087 + |
|
10088 +$received_protocol |
|
10089 + |
|
10090 + When a message is being processed, this variable contains the name of the |
|
10091 + protocol by which it was received. Most of the names used by Exim are |
|
10092 + defined by RFCs 821, 2821, and 3848. They start with "smtp" (the client |
|
10093 + used HELO) or "esmtp" (the client used EHLO). This can be followed by "s" |
|
10094 + for secure (encrypted) and/or "a" for authenticated. Thus, for example, if |
|
10095 + the protocol is set to "esmtpsa", the message was received over an |
|
10096 + encrypted SMTP connection and the client was successfully authenticated. |
|
10097 + |
|
10098 + Exim uses the protocol name "smtps" for the case when encryption is |
|
10099 + automatically set up on connection without the use of STARTTLS (see |
|
10100 + tls_on_connect_ports), and the client uses HELO to initiate the encrypted |
|
10101 + SMTP session. The name "smtps" is also used for the rare situation where |
|
10102 + the client initially uses EHLO, sets up an encrypted connection using |
|
10103 + STARTTLS, and then uses HELO afterwards. |
|
10104 + |
|
10105 + The -oMr option provides a way of specifying a custom protocol name for |
|
10106 + messages that are injected locally by trusted callers. This is commonly |
|
10107 + used to identify messages that are being re-injected after some kind of |
|
10108 + scanning. |
|
10109 + |
|
10110 +$received_time |
|
10111 + |
|
10112 + This variable contains the date and time when the current message was |
|
10113 + received, as a number of seconds since the start of the Unix epoch. |
|
10114 + |
|
10115 +$recipient_data |
|
10116 + |
|
10117 + This variable is set after an indexing lookup success in an ACL recipients |
|
10118 + condition. It contains the data from the lookup, and the value remains set |
|
10119 + until the next recipients test. Thus, you can do things like this: |
|
10120 + |
|
10121 + require recipients  = cdb*@;/some/file |
|
10122 + deny    some further test involving $recipient_data |
|
10123 + |
|
10124 + Warning: This variable is set only when a lookup is used as an indexing |
|
10125 + method in the address list, using the semicolon syntax as in the example |
|
10126 + above. The variable is not set for a lookup that is used as part of the |
|
10127 + string expansion that all such lists undergo before being interpreted. |
|
10128 + |
|
10129 +$recipient_verify_failure |
|
10130 + |
|
10131 + In an ACL, when a recipient verification fails, this variable contains |
|
10132 + information about the failure. It is set to one of the following words: |
|
10133 + |
|
10134 + * "qualify": The address was unqualified (no domain), and the message was |
|
10135 + neither local nor came from an exempted host. |
|
10136 + |
|
10137 + * "route": Routing failed. |
|
10138 + |
|
10139 + * "mail": Routing succeeded, and a callout was attempted; rejection |
|
10140 + occurred at or before the MAIL command (that is, on initial connection, |
|
10141 + HELO, or MAIL). |
|
10142 + |
|
10143 + * "recipient": The RCPT command in a callout was rejected. |
|
10144 + |
|
10145 + * "postmaster": The postmaster check in a callout was rejected. |
|
10146 + |
|
10147 + The main use of this variable is expected to be to distinguish between |
|
10148 + rejections of MAIL and rejections of RCPT. |
|
10149 + |
|
10150 +$recipients |
|
10151 + |
|
10152 + This variable contains a list of envelope recipients for a message. A comma |
|
10153 + and a space separate the addresses in the replacement text. However, the |
|
10154 + variable is not generally available, to prevent exposure of Bcc recipients |
|
10155 + in unprivileged users' filter files. You can use $recipients only in these |
|
10156 + cases: |
|
10157 + |
|
10158 + 1. In a system filter file. |
|
10159 + |
|
10160 + 2. In the ACLs associated with the DATA command and with non-SMTP |
|
10161 + messages, that is, the ACLs defined by acl_smtp_predata, acl_smtp_data, |
|
10162 + acl_smtp_mime, acl_not_smtp_start, acl_not_smtp, and acl_not_smtp_mime. |
|
10163 + |
|
10164 + 3. From within a local_scan() function. |
|
10165 + |
|
10166 +$recipients_count |
|
10167 + |
|
10168 + When a message is being processed, this variable contains the number of |
|
10169 + envelope recipients that came with the message. Duplicates are not excluded |
|
10170 + from the count. While a message is being received over SMTP, the number |
|
10171 + increases for each accepted recipient. It can be referenced in an ACL. |
|
10172 + |
|
10173 +$regex_match_string |
|
10174 + |
|
10175 + This variable is set to contain the matching regular expression after a |
|
10176 + regex ACL condition has matched (see section 41.5). |
|
10177 + |
|
10178 +$reply_address |
|
10179 + |
|
10180 + When a message is being processed, this variable contains the contents of |
|
10181 + the Reply-To: header line if one exists and it is not empty, or otherwise |
|
10182 + the contents of the From: header line. Apart from the removal of leading |
|
10183 + white space, the value is not processed in any way. In particular, no RFC |
|
10184 + 2047 decoding or character code translation takes place. |
|
10185 + |
|
10186 +$return_path |
|
10187 + |
|
10188 + When a message is being delivered, this variable contains the return path - |
|
10189 + the sender field that will be sent as part of the envelope. It is not |
|
10190 + enclosed in <> characters. At the start of routing an address, $return_path |
|
10191 + has the same value as $sender_address, but if, for example, an incoming |
|
10192 + message to a mailing list has been expanded by a router which specifies a |
|
10193 + different address for bounce messages, $return_path subsequently contains |
|
10194 + the new bounce address, whereas $sender_address always contains the |
|
10195 + original sender address that was received with the message. In other words, |
|
10196 + $sender_address contains the incoming envelope sender, and $return_path |
|
10197 + contains the outgoing envelope sender. |
|
10198 + |
|
10199 +$return_size_limit |
|
10200 + |
|
10201 + This is an obsolete name for $bounce_return_size_limit. |
|
10202 + |
|
10203 +$runrc |
|
10204 + |
|
10205 + This variable contains the return code from a command that is run by the $ |
|
10206 + {run...} expansion item. Warning: In a router or transport, you cannot |
|
10207 + assume the order in which option values are expanded, except for those |
|
10208 + preconditions whose order of testing is documented. Therefore, you cannot |
|
10209 + reliably expect to set $runrc by the expansion of one option, and use it in |
|
10210 + another. |
|
10211 + |
|
10212 +$self_hostname |
|
10213 + |
|
10214 + When an address is routed to a supposedly remote host that turns out to be |
|
10215 + the local host, what happens is controlled by the self generic router |
|
10216 + option. One of its values causes the address to be passed to another |
|
10217 + router. When this happens, $self_hostname is set to the name of the local |
|
10218 + host that the original router encountered. In other circumstances its |
|
10219 + contents are null. |
|
10220 + |
|
10221 +$sender_address |
|
10222 + |
|
10223 + When a message is being processed, this variable contains the sender's |
|
10224 + address that was received in the message's envelope. The case of letters in |
|
10225 + the address is retained, in both the local part and the domain. For bounce |
|
10226 + messages, the value of this variable is the empty string. See also |
|
10227 + $return_path. |
|
10228 + |
|
10229 +$sender_address_data |
|
10230 + |
|
10231 + If $address_data is set when the routers are called from an ACL to verify a |
|
10232 + sender address, the final value is preserved in $sender_address_data, to |
|
10233 + distinguish it from data from a recipient address. The value does not |
|
10234 + persist after the end of the current ACL statement. If you want to preserve |
|
10235 + it for longer, you can save it in an ACL variable. |
|
10236 + |
|
10237 +$sender_address_domain |
|
10238 + |
|
10239 + The domain portion of $sender_address. |
|
10240 + |
|
10241 +$sender_address_local_part |
|
10242 + |
|
10243 + The local part portion of $sender_address. |
|
10244 + |
|
10245 +$sender_data |
|
10246 + |
|
10247 + This variable is set after a lookup success in an ACL senders condition or |
|
10248 + in a router senders option. It contains the data from the lookup, and the |
|
10249 + value remains set until the next senders test. Thus, you can do things like |
|
10250 + this: |
|
10251 + |
|
10252 + require senders      = cdb*@;/some/file |
|
10253 + deny    some further test involving $sender_data |
|
10254 + |
|
10255 + Warning: This variable is set only when a lookup is used as an indexing |
|
10256 + method in the address list, using the semicolon syntax as in the example |
|
10257 + above. The variable is not set for a lookup that is used as part of the |
|
10258 + string expansion that all such lists undergo before being interpreted. |
|
10259 + |
|
10260 +$sender_fullhost |
|
10261 + |
|
10262 + When a message is received from a remote host, this variable contains the |
|
10263 + host name and IP address in a single string. It ends with the IP address in |
|
10264 + square brackets, followed by a colon and a port number if the logging of |
|
10265 + ports is enabled. The format of the rest of the string depends on whether |
|
10266 + the host issued a HELO or EHLO SMTP command, and whether the host name was |
|
10267 + verified by looking up its IP address. (Looking up the IP address can be |
|
10268 + forced by the host_lookup option, independent of verification.) A plain |
|
10269 + host name at the start of the string is a verified host name; if this is |
|
10270 + not present, verification either failed or was not requested. A host name |
|
10271 + in parentheses is the argument of a HELO or EHLO command. This is omitted |
|
10272 + if it is identical to the verified host name or to the host's IP address in |
|
10273 + square brackets. |
|
10274 + |
|
10275 +$sender_helo_name |
|
10276 + |
|
10277 + When a message is received from a remote host that has issued a HELO or |
|
10278 + EHLO command, the argument of that command is placed in this variable. It |
|
10279 + is also set if HELO or EHLO is used when a message is received using SMTP |
|
10280 + locally via the -bs or -bS options. |
|
10281 + |
|
10282 +$sender_host_address |
|
10283 + |
|
10284 + When a message is received from a remote host, this variable contains that |
|
10285 + host's IP address. For locally submitted messages, it is empty. |
|
10286 + |
|
10287 +$sender_host_authenticated |
|
10288 + |
|
10289 + This variable contains the name (not the public name) of the authenticator |
|
10290 + driver that successfully authenticated the client from which the message |
|
10291 + was received. It is empty if there was no successful authentication. See |
|
10292 + also $authenticated_id. |
|
10293 + |
|
10294 +$sender_host_name |
|
10295 + |
|
10296 + When a message is received from a remote host, this variable contains the |
|
10297 + host's name as obtained by looking up its IP address. For messages received |
|
10298 + by other means, this variable is empty. |
|
10299 + |
|
10300 + If the host name has not previously been looked up, a reference to |
|
10301 + $sender_host_name triggers a lookup (for messages from remote hosts). A |
|
10302 + looked up name is accepted only if it leads back to the original IP address |
|
10303 + via a forward lookup. If either the reverse or the forward lookup fails to |
|
10304 + find any data, or if the forward lookup does not yield the original IP |
|
10305 + address, $sender_host_name remains empty, and $host_lookup_failed is set to |
|
10306 + "1". |
|
10307 + |
|
10308 + However, if either of the lookups cannot be completed (for example, there |
|
10309 + is a DNS timeout), $host_lookup_deferred is set to "1", and |
|
10310 + $host_lookup_failed remains set to "0". |
|
10311 + |
|
10312 + Once $host_lookup_failed is set to "1", Exim does not try to look up the |
|
10313 + host name again if there is a subsequent reference to $sender_host_name in |
|
10314 + the same Exim process, but it does try again if $host_lookup_deferred is |
|
10315 + set to "1". |
|
10316 + |
|
10317 + Exim does not automatically look up every calling host's name. If you want |
|
10318 + maximum efficiency, you should arrange your configuration so that it avoids |
|
10319 + these lookups altogether. The lookup happens only if one or more of the |
|
10320 + following are true: |
|
10321 + |
|
10322 + * A string containing $sender_host_name is expanded. |
|
10323 + |
|
10324 + * The calling host matches the list in host_lookup. In the default |
|
10325 + configuration, this option is set to *, so it must be changed if |
|
10326 + lookups are to be avoided. (In the code, the default for host_lookup is |
|
10327 + unset.) |
|
10328 + |
|
10329 + * Exim needs the host name in order to test an item in a host list. The |
|
10330 + items that require this are described in sections 10.13 and 10.16. |
|
10331 + |
|
10332 + * The calling host matches helo_try_verify_hosts or helo_verify_hosts. In |
|
10333 + this case, the host name is required to compare with the name quoted in |
|
10334 + any EHLO or HELO commands that the client issues. |
|
10335 + |
|
10336 + * The remote host issues a EHLO or HELO command that quotes one of the |
|
10337 + domains in helo_lookup_domains. The default value of this option is |
|
10338 + |
|
10339 + helo_lookup_domains = @ : @[] |
|
10340 + |
|
10341 + which causes a lookup if a remote host (incorrectly) gives the server's |
|
10342 + name or IP address in an EHLO or HELO command. |
|
10343 + |
|
10344 +$sender_host_port |
|
10345 + |
|
10346 + When a message is received from a remote host, this variable contains the |
|
10347 + port number that was used on the remote host. |
|
10348 + |
|
10349 +$sender_ident |
|
10350 + |
|
10351 + When a message is received from a remote host, this variable contains the |
|
10352 + identification received in response to an RFC 1413 request. When a message |
|
10353 + has been received locally, this variable contains the login name of the |
|
10354 + user that called Exim. |
|
10355 + |
|
10356 +$sender_rate_xxx |
|
10357 + |
|
10358 + A number of variables whose names begin $sender_rate_ are set as part of |
|
10359 + the ratelimit ACL condition. Details are given in section 40.36. |
|
10360 + |
|
10361 +$sender_rcvhost |
|
10362 + |
|
10363 + This is provided specifically for use in Received: headers. It starts with |
|
10364 + either the verified host name (as obtained from a reverse DNS lookup) or, |
|
10365 + if there is no verified host name, the IP address in square brackets. After |
|
10366 + that there may be text in parentheses. When the first item is a verified |
|
10367 + host name, the first thing in the parentheses is the IP address in square |
|
10368 + brackets, followed by a colon and a port number if port logging is enabled. |
|
10369 + When the first item is an IP address, the port is recorded as "port=xxxx" |
|
10370 + inside the parentheses. |
|
10371 + |
|
10372 + There may also be items of the form "helo=xxxx" if HELO or EHLO was used |
|
10373 + and its argument was not identical to the real host name or IP address, and |
|
10374 + "ident=xxxx" if an RFC 1413 ident string is available. If all three items |
|
10375 + are present in the parentheses, a newline and tab are inserted into the |
|
10376 + string, to improve the formatting of the Received: header. |
|
10377 + |
|
10378 +$sender_verify_failure |
|
10379 + |
|
10380 + In an ACL, when a sender verification fails, this variable contains |
|
10381 + information about the failure. The details are the same as for |
|
10382 + $recipient_verify_failure. |
|
10383 + |
|
10384 +$sending_ip_address |
|
10385 + |
|
10386 + This variable is set whenever an outgoing SMTP connection to another host |
|
10387 + has been set up. It contains the IP address of the local interface that is |
|
10388 + being used. This is useful if a host that has more than one IP address |
|
10389 + wants to take on different personalities depending on which one is being |
|
10390 + used. For incoming connections, see $received_ip_address. |
|
10391 + |
|
10392 +$sending_port |
|
10393 + |
|
10394 + This variable is set whenever an outgoing SMTP connection to another host |
|
10395 + has been set up. It contains the local port that is being used. For |
|
10396 + incoming connections, see $received_port. |
|
10397 + |
|
10398 +$smtp_active_hostname |
|
10399 + |
|
10400 + During an incoming SMTP session, this variable contains the value of the |
|
10401 + active host name, as specified by the smtp_active_hostname option. The |
|
10402 + value of $smtp_active_hostname is saved with any message that is received, |
|
10403 + so its value can be consulted during routing and delivery. |
|
10404 + |
|
10405 +$smtp_command |
|
10406 + |
|
10407 + During the processing of an incoming SMTP command, this variable contains |
|
10408 + the entire command. This makes it possible to distinguish between HELO and |
|
10409 + EHLO in the HELO ACL, and also to distinguish between commands such as |
|
10410 + these: |
|
10411 + |
|
10412 + MAIL FROM:<> |
|
10413 + MAIL FROM: <> |
|
10414 + |
|
10415 + For a MAIL command, extra parameters such as SIZE can be inspected. For a |
|
10416 + RCPT command, the address in $smtp_command is the original address before |
|
10417 + any rewriting, whereas the values in $local_part and $domain are taken from |
|
10418 + the address after SMTP-time rewriting. |
|
10419 + |
|
10420 +$smtp_command_argument |
|
10421 + |
|
10422 + While an ACL is running to check an SMTP command, this variable contains |
|
10423 + the argument, that is, the text that follows the command name, with leading |
|
10424 + white space removed. Following the introduction of $smtp_command, this |
|
10425 + variable is somewhat redundant, but is retained for backwards |
|
10426 + compatibility. |
|
10427 + |
|
10428 +$smtp_count_at_connection_start |
|
10429 + |
|
10430 + This variable is set greater than zero only in processes spawned by the |
|
10431 + Exim daemon for handling incoming SMTP connections. The name is |
|
10432 + deliberately long, in order to emphasize what the contents are. When the |
|
10433 + daemon accepts a new connection, it increments this variable. A copy of the |
|
10434 + variable is passed to the child process that handles the connection, but |
|
10435 + its value is fixed, and never changes. It is only an approximation of how |
|
10436 + many incoming connections there actually are, because many other |
|
10437 + connections may come and go while a single connection is being processed. |
|
10438 + When a child process terminates, the daemon decrements its copy of the |
|
10439 + variable. |
|
10440 + |
|
10441 +$sn0 - $sn9 |
|
10442 + |
|
10443 + These variables are copies of the values of the $n0 - $n9 accumulators that |
|
10444 + were current at the end of the system filter file. This allows a system |
|
10445 + filter file to set values that can be tested in users' filter files. For |
|
10446 + example, a system filter could set a value indicating how likely it is that |
|
10447 + a message is junk mail. |
|
10448 + |
|
10449 +$spam_xxx |
|
10450 + |
|
10451 + A number of variables whose names start with $spam are available when Exim |
|
10452 + is compiled with the content-scanning extension. For details, see section |
|
10453 + 41.2. |
|
10454 + |
|
10455 +$spool_directory |
|
10456 + |
|
10457 + The name of Exim's spool directory. |
|
10458 + |
|
10459 +$spool_inodes |
|
10460 + |
|
10461 + The number of free inodes in the disk partition where Exim's spool files |
|
10462 + are being written. The value is recalculated whenever the variable is |
|
10463 + referenced. If the relevant file system does not have the concept of |
|
10464 + inodes, the value of is -1. See also the check_spool_inodes option. |
|
10465 + |
|
10466 +$spool_space |
|
10467 + |
|
10468 + The amount of free space (as a number of kilobytes) in the disk partition |
|
10469 + where Exim's spool files are being written. The value is recalculated |
|
10470 + whenever the variable is referenced. If the operating system does not have |
|
10471 + the ability to find the amount of free space (only true for experimental |
|
10472 + systems), the space value is -1. For example, to check in an ACL that there |
|
10473 + is at least 50 megabytes free on the spool, you could write: |
|
10474 + |
|
10475 + condition = ${if > {$spool_space}{50000}} |
|
10476 + |
|
10477 + See also the check_spool_space option. |
|
10478 + |
|
10479 +$thisaddress |
|
10480 + |
|
10481 + This variable is set only during the processing of the foranyaddress |
|
10482 + command in a filter file. Its use is explained in the description of that |
|
10483 + command, which can be found in the separate document entitled Exim's |
|
10484 + interfaces to mail filtering. |
|
10485 + |
|
10486 +$tls_certificate_verified |
|
10487 + |
|
10488 + This variable is set to "1" if a TLS certificate was verified when the |
|
10489 + message was received, and "0" otherwise. |
|
10490 + |
|
10491 +$tls_cipher |
|
10492 + |
|
10493 + When a message is received from a remote host over an encrypted SMTP |
|
10494 + connection, this variable is set to the cipher suite that was negotiated, |
|
10495 + for example DES-CBC3-SHA. In other circumstances, in particular, for |
|
10496 + message received over unencrypted connections, the variable is empty. |
|
10497 + Testing $tls_cipher for emptiness is one way of distinguishing between |
|
10498 + encrypted and non-encrypted connections during ACL processing. |
|
10499 + |
|
10500 + The $tls_cipher variable retains its value during message delivery, except |
|
10501 + when an outward SMTP delivery takes place via the smtp transport. In this |
|
10502 + case, $tls_cipher is cleared before any outgoing SMTP connection is made, |
|
10503 + and then set to the outgoing cipher suite if one is negotiated. See chapter |
|
10504 + 39 for details of TLS support and chapter 30 for details of the smtp |
|
10505 + transport. |
|
10506 + |
|
10507 +$tls_peerdn |
|
10508 + |
|
10509 + When a message is received from a remote host over an encrypted SMTP |
|
10510 + connection, and Exim is configured to request a certificate from the |
|
10511 + client, the value of the Distinguished Name of the certificate is made |
|
10512 + available in the $tls_peerdn during subsequent processing. Like $tls_cipher |
|
10513 + , the value is retained during message delivery, except during outbound |
|
10514 + SMTP deliveries. |
|
10515 + |
|
10516 +$tod_bsdinbox |
|
10517 + |
|
10518 + The time of day and the date, in the format required for BSD-style mailbox |
|
10519 + files, for example: Thu Oct 17 17:14:09 1995. |
|
10520 + |
|
10521 +$tod_epoch |
|
10522 + |
|
10523 + The time and date as a number of seconds since the start of the Unix epoch. |
|
10524 + |
|
10525 +$tod_full |
|
10526 + |
|
10527 + A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40 |
|
10528 + +0100. The timezone is always given as a numerical offset from UTC, with |
|
10529 + positive values used for timezones that are ahead (east) of UTC, and |
|
10530 + negative values for those that are behind (west). |
|
10531 + |
|
10532 +$tod_log |
|
10533 + |
|
10534 + The time and date in the format used for writing Exim's log files, for |
|
10535 + example: 1995-10-12 15:32:29, but without a timezone. |
|
10536 + |
|
10537 +$tod_logfile |
|
10538 + |
|
10539 + This variable contains the date in the format yyyymmdd. This is the format |
|
10540 + that is used for datestamping log files when log_file_path contains the |
|
10541 + "%D" flag. |
|
10542 + |
|
10543 +$tod_zone |
|
10544 + |
|
10545 + This variable contains the numerical value of the local timezone, for |
|
10546 + example: -0500. |
|
10547 + |
|
10548 +$tod_zulu |
|
10549 + |
|
10550 + This variable contains the UTC date and time in "Zulu" format, as specified |
|
10551 + by ISO 8601, for example: 20030221154023Z. |
|
10552 + |
|
10553 +$value |
|
10554 + |
|
10555 + This variable contains the result of an expansion lookup, extraction |
|
10556 + operation, or external command, as described above. It is also used during |
|
10557 + a reduce expansion. |
|
10558 + |
|
10559 +$version_number |
|
10560 + |
|
10561 + The version number of Exim. |
|
10562 + |
|
10563 +$warn_message_delay |
|
10564 + |
|
10565 + This variable is set only during the creation of a message warning about a |
|
10566 + delivery delay. Details of its use are explained in section 46.2. |
|
10567 + |
|
10568 +$warn_message_recipients |
|
10569 + |
|
10570 + This variable is set only during the creation of a message warning about a |
|
10571 + delivery delay. Details of its use are explained in section 46.2. |
|
10572 + |
|
10573 +12. Embedded Perl |
|
10574 + |
|
10575 +Exim can be built to include an embedded Perl interpreter. When this is done, |
|
10576 +Perl subroutines can be called as part of the string expansion process. To make |
|
10577 +use of the Perl support, you need version 5.004 or later of Perl installed on |
|
10578 +your system. To include the embedded interpreter in the Exim binary, include |
|
10579 +the line |
|
10580 + |
|
10581 +EXIM_PERL = perl.o |
|
10582 + |
|
10583 +in your Local/Makefile and then build Exim in the normal way. |
|
10584 + |
|
10585 +12.1Â Setting up so Perl can be used |
|
10586 + |
|
10587 +Access to Perl subroutines is via a global configuration option called |
|
10588 +perl_startup and an expansion string operator ${perl ...}. If there is no |
|
10589 +perl_startup option in the Exim configuration file then no Perl interpreter is |
|
10590 +started and there is almost no overhead for Exim (since none of the Perl |
|
10591 +library will be paged in unless used). If there is a perl_startup option then |
|
10592 +the associated value is taken to be Perl code which is executed in a newly |
|
10593 +created Perl interpreter. |
|
10594 + |
|
10595 +The value of perl_startup is not expanded in the Exim sense, so you do not need |
|
10596 +backslashes before any characters to escape special meanings. The option should |
|
10597 +usually be something like |
|
10598 + |
|
10599 +perl_startup = do '/etc/exim.pl' |
|
10600 + |
|
10601 +where /etc/exim.pl is Perl code which defines any subroutines you want to use |
|
10602 +from Exim. Exim can be configured either to start up a Perl interpreter as soon |
|
10603 +as it is entered, or to wait until the first time it is needed. Starting the |
|
10604 +interpreter at the beginning ensures that it is done while Exim still has its |
|
10605 +setuid privilege, but can impose an unnecessary overhead if Perl is not in fact |
|
10606 +used in a particular run. Also, note that this does not mean that Exim is |
|
10607 +necessarily running as root when Perl is called at a later time. By default, |
|
10608 +the interpreter is started only when it is needed, but this can be changed in |
|
10609 +two ways: |
|
10610 + |
|
10611 + * Setting perl_at_start (a boolean option) in the configuration requests a |
|
10612 + startup when Exim is entered. |
|
10613 + |
|
10614 + * The command line option -ps also requests a startup when Exim is entered, |
|
10615 + overriding the setting of perl_at_start. |
|
10616 + |
|
10617 +There is also a command line option -pd (for delay) which suppresses the |
|
10618 +initial startup, even if perl_at_start is set. |
|
10619 + |
|
10620 +12.2Â Calling Perl subroutines |
|
10621 + |
|
10622 +When the configuration file includes a perl_startup option you can make use of |
|
10623 +the string expansion item to call the Perl subroutines that are defined by the |
|
10624 +perl_startup code. The operator is used in any of the following forms: |
|
10625 + |
|
10626 +${perl{foo}} |
|
10627 +${perl{foo}{argument}} |
|
10628 +${perl{foo}{argument1}{argument2} ... } |
|
10629 + |
|
10630 +which calls the subroutine foo with the given arguments. A maximum of eight |
|
10631 +arguments may be passed. Passing more than this results in an expansion failure |
|
10632 +with an error message of the form |
|
10633 + |
|
10634 +Too many arguments passed to Perl subroutine "foo" (max is 8) |
|
10635 + |
|
10636 +The return value of the Perl subroutine is evaluated in a scalar context before |
|
10637 +it is passed back to Exim to be inserted into the expanded string. If the |
|
10638 +return value is undef, the expansion is forced to fail in the same way as an |
|
10639 +explicit "fail" on an if or lookup item. If the subroutine aborts by obeying |
|
10640 +Perl's die function, the expansion fails with the error message that was passed |
|
10641 +to die. |
|
10642 + |
|
10643 +12.3Â Calling Exim functions from Perl |
|
10644 + |
|
10645 +Within any Perl code called from Exim, the function Exim::expand_string() is |
|
10646 +available to call back into Exim's string expansion function. For example, the |
|
10647 +Perl code |
|
10648 + |
|
10649 +my $lp = Exim::expand_string('$local_part'); |
|
10650 + |
|
10651 +makes the current Exim $local_part available in the Perl variable $lp. Note |
|
10652 +those are single quotes and not double quotes to protect against $local_part |
|
10653 +being interpolated as a Perl variable. |
|
10654 + |
|
10655 +If the string expansion is forced to fail by a "fail" item, the result of |
|
10656 +Exim::expand_string() is undef. If there is a syntax error in the expansion |
|
10657 +string, the Perl call from the original expansion string fails with an |
|
10658 +appropriate error message, in the same way as if die were used. |
|
10659 + |
|
10660 +Two other Exim functions are available for use from within Perl code. |
|
10661 +Exim::debug_write() writes a string to the standard error stream if Exim's |
|
10662 +debugging is enabled. If you want a newline at the end, you must supply it. |
|
10663 +Exim::log_write() writes a string to Exim's main log, adding a leading |
|
10664 +timestamp. In this case, you should not supply a terminating newline. |
|
10665 + |
|
10666 +12.4Â Use of standard output and error by Perl |
|
10667 + |
|
10668 +You should not write to the standard error or output streams from within your |
|
10669 +Perl code, as it is not defined how these are set up. In versions of Exim |
|
10670 +before 4.50, it is possible for the standard output or error to refer to the |
|
10671 +SMTP connection during message reception via the daemon. Writing to this stream |
|
10672 +is certain to cause chaos. From Exim 4.50 onwards, the standard output and |
|
10673 +error streams are connected to /dev/null in the daemon. The chaos is avoided, |
|
10674 +but the output is lost. |
|
10675 + |
|
10676 +The Perl warn statement writes to the standard error stream by default. Calls |
|
10677 +to warn may be embedded in Perl modules that you use, but over which you have |
|
10678 +no control. When Exim starts up the Perl interpreter, it arranges for output |
|
10679 +from the warn statement to be written to the Exim main log. You can change this |
|
10680 +by including appropriate Perl magic somewhere in your Perl code. For example, |
|
10681 +to discard warn output completely, you need this: |
|
10682 + |
|
10683 +$SIG{__WARN__} = sub { }; |
|
10684 + |
|
10685 +Whenever a warn is obeyed, the anonymous subroutine is called. In this example, |
|
10686 +the code for the subroutine is empty, so it does nothing, but you can include |
|
10687 +any Perl code that you like. The text of the warn message is passed as the |
|
10688 +first subroutine argument. |
|
10689 + |
|
10690 +13. Starting the daemon and the use of network interfaces |
|
10691 + |
|
10692 +A host that is connected to a TCP/IP network may have one or more physical |
|
10693 +hardware network interfaces. Each of these interfaces may be configured as one |
|
10694 +or more "logical" interfaces, which are the entities that a program actually |
|
10695 +works with. Each of these logical interfaces is associated with an IP address. |
|
10696 +In addition, TCP/IP software supports "loopback" interfaces (127.0.0.1 in IPv4 |
|
10697 +and ::1 in IPv6), which do not use any physical hardware. Exim requires |
|
10698 +knowledge about the host's interfaces for use in three different circumstances: |
|
10699 + |
|
10700 + 1. When a listening daemon is started, Exim needs to know which interfaces and |
|
10701 + ports to listen on. |
|
10702 + |
|
10703 + 2. When Exim is routing an address, it needs to know which IP addresses are |
|
10704 + associated with local interfaces. This is required for the correct |
|
10705 + processing of MX lists by removing the local host and others with the same |
|
10706 + or higher priority values. Also, Exim needs to detect cases when an address |
|
10707 + is routed to an IP address that in fact belongs to the local host. Unless |
|
10708 + the self router option or the allow_localhost option of the smtp transport |
|
10709 + is set (as appropriate), this is treated as an error situation. |
|
10710 + |
|
10711 + 3. When Exim connects to a remote host, it may need to know which interface to |
|
10712 + use for the outgoing connection. |
|
10713 + |
|
10714 +Exim's default behaviour is likely to be appropriate in the vast majority of |
|
10715 +cases. If your host has only one interface, and you want all its IP addresses |
|
10716 +to be treated in the same way, and you are using only the standard SMTP port, |
|
10717 +you should not need to take any special action. The rest of this chapter does |
|
10718 +not apply to you. |
|
10719 + |
|
10720 +In a more complicated situation you may want to listen only on certain |
|
10721 +interfaces, or on different ports, and for this reason there are a number of |
|
10722 +options that can be used to influence Exim's behaviour. The rest of this |
|
10723 +chapter describes how they operate. |
|
10724 + |
|
10725 +When a message is received over TCP/IP, the interface and port that were |
|
10726 +actually used are set in $received_ip_address and $received_port. |
|
10727 + |
|
10728 +13.1Â Starting a listening daemon |
|
10729 + |
|
10730 +When a listening daemon is started (by means of the -bd command line option), |
|
10731 +the interfaces and ports on which it listens are controlled by the following |
|
10732 +options: |
|
10733 + |
|
10734 + * daemon_smtp_ports contains a list of default ports. (For backward |
|
10735 + compatibility, this option can also be specified in the singular.) |
|
10736 + |
|
10737 + * local_interfaces contains list of interface IP addresses on which to |
|
10738 + listen. Each item may optionally also specify a port. |
|
10739 + |
|
10740 +The default list separator in both cases is a colon, but this can be changed as |
|
10741 +described in section 6.19. When IPv6 addresses are involved, it is usually best |
|
10742 +to change the separator to avoid having to double all the colons. For example: |
|
10743 + |
|
10744 +local_interfaces = <; 127.0.0.1 ; \ |
|
10745 + 192.168.23.65 ; \ |
|
10746 + ::1 ; \ |
|
10747 + 3ffe:ffff:836f::fe86:a061 |
|
10748 + |
|
10749 +There are two different formats for specifying a port along with an IP address |
|
10750 +in local_interfaces: |
|
10751 + |
|
10752 + 1. The port is added onto the address with a dot separator. For example, to |
|
10753 + listen on port 1234 on two different IP addresses: |
|
10754 + |
|
10755 + local_interfaces = <; 192.168.23.65.1234 ; \ |
|
10756 + 3ffe:ffff:836f::fe86:a061.1234 |
|
10757 + |
|
10758 + 2. The IP address is enclosed in square brackets, and the port is added with a |
|
10759 + colon separator, for example: |
|
10760 + |
|
10761 + local_interfaces = <; [192.168.23.65]:1234 ; \ |
|
10762 + [3ffe:ffff:836f::fe86:a061]:1234 |
|
10763 + |
|
10764 +When a port is not specified, the value of daemon_smtp_ports is used. The |
|
10765 +default setting contains just one port: |
|
10766 + |
|
10767 +daemon_smtp_ports = smtp |
|
10768 + |
|
10769 +If more than one port is listed, each interface that does not have its own port |
|
10770 +specified listens on all of them. Ports that are listed in daemon_smtp_ports |
|
10771 +can be identified either by name (defined in /etc/services) or by number. |
|
10772 +However, when ports are given with individual IP addresses in local_interfaces, |
|
10773 +only numbers (not names) can be used. |
|
10774 + |
|
10775 +13.2Â Special IP listening addresses |
|
10776 + |
|
10777 +The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted as |
|
10778 +"all IPv4 interfaces" and "all IPv6 interfaces", respectively. In each case, |
|
10779 +Exim tells the TCP/IP stack to "listen on all IPvx interfaces" instead of |
|
10780 +setting up separate listening sockets for each interface. The default value of |
|
10781 +local_interfaces is |
|
10782 + |
|
10783 +local_interfaces = 0.0.0.0 |
|
10784 + |
|
10785 +when Exim is built without IPv6 support; otherwise it is: |
|
10786 + |
|
10787 +local_interfaces = <; ::0 ; 0.0.0.0 |
|
10788 + |
|
10789 +Thus, by default, Exim listens on all available interfaces, on the SMTP port. |
|
10790 + |
|
10791 +13.3Â Overriding local_interfaces and daemon_smtp_ports |
|
10792 + |
|
10793 +The -oX command line option can be used to override the values of |
|
10794 +daemon_smtp_ports and/or local_interfaces for a particular daemon instance. |
|
10795 +Another way of doing this would be to use macros and the -D option. However, |
|
10796 +-oX can be used by any admin user, whereas modification of the runtime |
|
10797 +configuration by -D is allowed only when the caller is root or exim. |
|
10798 + |
|
10799 +The value of -oX is a list of items. The default colon separator can be changed |
|
10800 +in the usual way if required. If there are any items that do not contain dots |
|
10801 +or colons (that is, are not IP addresses), the value of daemon_smtp_ports is |
|
10802 +replaced by the list of those items. If there are any items that do contain |
|
10803 +dots or colons, the value of local_interfaces is replaced by those items. Thus, |
|
10804 +for example, |
|
10805 + |
|
10806 +-oX 1225 |
|
10807 + |
|
10808 +overrides daemon_smtp_ports, but leaves local_interfaces unchanged, whereas |
|
10809 + |
|
10810 +-oX 192.168.34.5.1125 |
|
10811 + |
|
10812 +overrides local_interfaces, leaving daemon_smtp_ports unchanged. (However, |
|
10813 +since local_interfaces now contains no items without ports, the value of |
|
10814 +daemon_smtp_ports is no longer relevant in this example.) |
|
10815 + |
|
10816 +13.4Â Support for the obsolete SSMTP (or SMTPS) protocol |
|
10817 + |
|
10818 +Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used |
|
10819 +before the STARTTLS command was standardized for SMTP. Some legacy clients |
|
10820 +still use this protocol. If the tls_on_connect_ports option is set to a list of |
|
10821 +port numbers, connections to those ports must use SSMTP. The most common use of |
|
10822 +this option is expected to be |
|
10823 + |
|
10824 +tls_on_connect_ports = 465 |
|
10825 + |
|
10826 +because 465 is the usual port number used by the legacy clients. There is also |
|
10827 +a command line option -tls-on-connect, which forces all ports to behave in this |
|
10828 +way when a daemon is started. |
|
10829 + |
|
10830 +Warning: Setting tls_on_connect_ports does not of itself cause the daemon to |
|
10831 +listen on those ports. You must still specify them in daemon_smtp_ports, |
|
10832 +local_interfaces, or the -oX option. (This is because tls_on_connect_ports |
|
10833 +applies to inetd connections as well as to connections via the daemon.) |
|
10834 + |
|
10835 +13.5Â IPv6 address scopes |
|
10836 + |
|
10837 +IPv6 addresses have "scopes", and a host with multiple hardware interfaces can, |
|
10838 +in principle, have the same link-local IPv6 address on different interfaces. |
|
10839 +Thus, additional information is needed, over and above the IP address, to |
|
10840 +distinguish individual interfaces. A convention of using a percent sign |
|
10841 +followed by something (often the interface name) has been adopted in some |
|
10842 +cases, leading to addresses like this: |
|
10843 + |
|
10844 +fe80::202:b3ff:fe03:45c1%eth0 |
|
10845 + |
|
10846 +To accommodate this usage, a percent sign followed by an arbitrary string is |
|
10847 +allowed at the end of an IPv6 address. By default, Exim calls getaddrinfo() to |
|
10848 +convert a textual IPv6 address for actual use. This function recognizes the |
|
10849 +percent convention in operating systems that support it, and it processes the |
|
10850 +address appropriately. Unfortunately, some older libraries have problems with |
|
10851 +getaddrinfo(). If |
|
10852 + |
|
10853 +IPV6_USE_INET_PTON=yes |
|
10854 + |
|
10855 +is set in Local/Makefile (or an OS-dependent Makefile) when Exim is built, Exim |
|
10856 +uses inet_pton() to convert a textual IPv6 address for actual use, instead of |
|
10857 +getaddrinfo(). (Before version 4.14, it always used this function.) Of course, |
|
10858 +this means that the additional functionality of getaddrinfo() - recognizing |
|
10859 +scoped addresses - is lost. |
|
10860 + |
|
10861 +13.6Â Disabling IPv6 |
|
10862 + |
|
10863 +Sometimes it happens that an Exim binary that was compiled with IPv6 support is |
|
10864 +run on a host whose kernel does not support IPv6. The binary will fall back to |
|
10865 +using IPv4, but it may waste resources looking up AAAA records, and trying to |
|
10866 +connect to IPv6 addresses, causing delays to mail delivery. If you set the |
|
10867 +disable_ipv6 option true, even if the Exim binary has IPv6 support, no IPv6 |
|
10868 +activities take place. AAAA records are never looked up, and any IPv6 addresses |
|
10869 +that are listed in local_interfaces, data for the manualroute router, etc. are |
|
10870 +ignored. If IP literals are enabled, the ipliteral router declines to handle |
|
10871 +IPv6 literal addresses. |
|
10872 + |
|
10873 +On the other hand, when IPv6 is in use, there may be times when you want to |
|
10874 +disable it for certain hosts or domains. You can use the dns_ipv4_lookup option |
|
10875 +to globally suppress the lookup of AAAA records for specified domains, and you |
|
10876 +can use the ignore_target_hosts generic router option to ignore IPv6 addresses |
|
10877 +in an individual router. |
|
10878 + |
|
10879 +13.7Â Examples of starting a listening daemon |
|
10880 + |
|
10881 +The default case in an IPv6 environment is |
|
10882 + |
|
10883 +daemon_smtp_ports = smtp |
|
10884 +local_interfaces = <; ::0 ; 0.0.0.0 |
|
10885 + |
|
10886 +This specifies listening on the smtp port on all IPv6 and IPv4 interfaces. |
|
10887 +Either one or two sockets may be used, depending on the characteristics of the |
|
10888 +TCP/IP stack. (This is complicated and messy; for more information, read the |
|
10889 +comments in the daemon.c source file.) |
|
10890 + |
|
10891 +To specify listening on ports 25 and 26 on all interfaces: |
|
10892 + |
|
10893 +daemon_smtp_ports = 25 : 26 |
|
10894 + |
|
10895 +(leaving local_interfaces at the default setting) or, more explicitly: |
|
10896 + |
|
10897 +local_interfaces = <; ::0.25 ; ::0.26 \ |
|
10898 + 0.0.0.0.25 ; 0.0.0.0.26 |
|
10899 + |
|
10900 +To listen on the default port on all IPv4 interfaces, and on port 26 on the |
|
10901 +IPv4 loopback address only: |
|
10902 + |
|
10903 +local_interfaces = 0.0.0.0 : 127.0.0.1.26 |
|
10904 + |
|
10905 +To specify listening on the default port on specific interfaces only: |
|
10906 + |
|
10907 +local_interfaces = 192.168.34.67 : 192.168.34.67 |
|
10908 + |
|
10909 +Warning: Such a setting excludes listening on the loopback interfaces. |
|
10910 + |
|
10911 +13.8Â Recognizing the local host |
|
10912 + |
|
10913 +The local_interfaces option is also used when Exim needs to determine whether |
|
10914 +or not an IP address refers to the local host. That is, the IP addresses of all |
|
10915 +the interfaces on which a daemon is listening are always treated as local. |
|
10916 + |
|
10917 +For this usage, port numbers in local_interfaces are ignored. If either of the |
|
10918 +items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of available |
|
10919 +interfaces from the operating system, and extracts the relevant (that is, IPv4 |
|
10920 +or IPv6) addresses to use for checking. |
|
10921 + |
|
10922 +Some systems set up large numbers of virtual interfaces in order to provide |
|
10923 +many virtual web servers. In this situation, you may want to listen for email |
|
10924 +on only a few of the available interfaces, but nevertheless treat all |
|
10925 +interfaces as local when routing. You can do this by setting |
|
10926 +extra_local_interfaces to a list of IP addresses, possibly including the "all" |
|
10927 +wildcard values. These addresses are recognized as local, but are not used for |
|
10928 +listening. Consider this example: |
|
10929 + |
|
10930 +local_interfaces = <; 127.0.0.1 ; ::1 ; \ |
|
10931 + 192.168.53.235 ; \ |
|
10932 + 3ffe:2101:12:1:a00:20ff:fe86:a061 |
|
10933 + |
|
10934 +extra_local_interfaces = <; ::0 ; 0.0.0.0 |
|
10935 + |
|
10936 +The daemon listens on the loopback interfaces and just one IPv4 and one IPv6 |
|
10937 +address, but all available interface addresses are treated as local when Exim |
|
10938 +is routing. |
|
10939 + |
|
10940 +In some environments the local host name may be in an MX list, but with an IP |
|
10941 +address that is not assigned to any local interface. In other cases it may be |
|
10942 +desirable to treat other host names as if they referred to the local host. Both |
|
10943 +these cases can be handled by setting the hosts_treat_as_local option. This |
|
10944 +contains host names rather than IP addresses. When a host is referenced during |
|
10945 +routing, either via an MX record or directly, it is treated as the local host |
|
10946 +if its name matches hosts_treat_as_local, or if any of its IP addresses match |
|
10947 +local_interfaces or extra_local_interfaces. |
|
10948 + |
|
10949 +13.9Â Delivering to a remote host |
|
10950 + |
|
10951 +Delivery to a remote host is handled by the smtp transport. By default, it |
|
10952 +allows the system's TCP/IP functions to choose which interface to use (if there |
|
10953 +is more than one) when connecting to a remote host. However, the interface |
|
10954 +option can be set to specify which interface is used. See the description of |
|
10955 +the smtp transport in chapter 30 for more details. |
|
10956 + |
|
10957 +14. Main configuration |
|
10958 + |
|
10959 +The first part of the run time configuration file contains three types of item: |
|
10960 + |
|
10961 + * Macro definitions: These lines start with an upper case letter. See section |
|
10962 + 6.4 for details of macro processing. |
|
10963 + |
|
10964 + * Named list definitions: These lines start with one of the words |
|
10965 + "domainlist", "hostlist", "addresslist", or "localpartlist". Their use is |
|
10966 + described in section 10.5. |
|
10967 + |
|
10968 + * Main configuration settings: Each setting occupies one line of the file |
|
10969 + (with possible continuations). If any setting is preceded by the word |
|
10970 + "hide", the -bP command line option displays its value to admin users only. |
|
10971 + See section 6.10 for a description of the syntax of these option settings. |
|
10972 + |
|
10973 +This chapter specifies all the main configuration options, along with their |
|
10974 +types and default values. For ease of finding a particular option, they appear |
|
10975 +in alphabetical order in section 14.23 below. However, because there are now so |
|
10976 +many options, they are first listed briefly in functional groups, as an aid to |
|
10977 +finding the name of the option you are looking for. Some options are listed in |
|
10978 +more than one group. |
|
10979 + |
|
10980 +14.1Â Miscellaneous |
|
10981 + |
|
10982 +bi_command to run for -bi command line option |
|
10983 +disable_ipv6 do no IPv6 processing |
|
10984 +keep_malformed for broken files - should not happen |
|
10985 +localhost_number for unique message ids in clusters |
|
10986 +message_body_newlines retain newlines in $message_body |
|
10987 +message_body_visible how much to show in $message_body |
|
10988 +mua_wrapper run in "MUA wrapper" mode |
|
10989 +print_topbitchars top-bit characters are printing |
|
10990 +timezone force time zone |
|
10991 + |
|
10992 +14.2Â Exim parameters |
|
10993 + |
|
10994 +exim_group override compiled-in value |
|
10995 +exim_path override compiled-in value |
|
10996 +exim_user override compiled-in value |
|
10997 +primary_hostname default from uname() |
|
10998 +split_spool_directory use multiple directories |
|
10999 +spool_directory override compiled-in value |
|
11000 + |
|
11001 +14.3Â Privilege controls |
|
11002 + |
|
11003 +admin_groups groups that are Exim admin users |
|
11004 +deliver_drop_privilege drop root for delivery processes |
|
11005 +local_from_check insert Sender: if necessary |
|
11006 +local_from_prefix for testing From: for local sender |
|
11007 +local_from_suffix for testing From: for local sender |
|
11008 +local_sender_retain keep Sender: from untrusted user |
|
11009 +never_users do not run deliveries as these |
|
11010 +prod_requires_admin forced delivery requires admin user |
|
11011 +queue_list_requires_admin queue listing requires admin user |
|
11012 +trusted_groups groups that are trusted |
|
11013 +trusted_users users that are trusted |
|
11014 + |
|
11015 +14.4Â Logging |
|
11016 + |
|
11017 +hosts_connection_nolog exemption from connect logging |
|
11018 +log_file_path override compiled-in value |
|
11019 +log_selector set/unset optional logging |
|
11020 +log_timezone add timezone to log lines |
|
11021 +message_logs create per-message logs |
|
11022 +preserve_message_logs after message completion |
|
11023 +process_log_path for SIGUSR1 and exiwhat |
|
11024 +syslog_duplication controls duplicate log lines on syslog |
|
11025 +syslog_facility set syslog "facility" field |
|
11026 +syslog_processname set syslog "ident" field |
|
11027 +syslog_timestamp timestamp syslog lines |
|
11028 +write_rejectlog control use of message log |
|
11029 + |
|
11030 +14.5Â Frozen messages |
|
11031 + |
|
11032 +auto_thaw sets time for retrying frozen messages |
|
11033 +freeze_tell send message when freezing |
|
11034 +move_frozen_messages to another directory |
|
11035 +timeout_frozen_after keep frozen messages only so long |
|
11036 + |
|
11037 +14.6Â Data lookups |
|
11038 + |
|
11039 +ibase_servers InterBase servers |
|
11040 +ldap_default_servers used if no server in query |
|
11041 +ldap_version set protocol version |
|
11042 +lookup_open_max lookup files held open |
|
11043 +mysql_servers default MySQL servers |
|
11044 +oracle_servers Oracle servers |
|
11045 +pgsql_servers default PostgreSQL servers |
|
11046 +sqlite_lock_timeout as it says |
|
11047 + |
|
11048 +14.7Â Message ids |
|
11049 + |
|
11050 +message_id_header_domain used to build Message-ID: header |
|
11051 +message_id_header_text ditto |
|
11052 + |
|
11053 +14.8Â Embedded Perl Startup |
|
11054 + |
|
11055 +perl_at_start always start the interpreter |
|
11056 +perl_startup code to obey when starting Perl |
|
11057 + |
|
11058 +14.9Â Daemon |
|
11059 + |
|
11060 +daemon_smtp_ports default ports |
|
11061 +daemon_startup_retries number of times to retry |
|
11062 +daemon_startup_sleep time to sleep between tries |
|
11063 +extra_local_interfaces not necessarily listened on |
|
11064 +local_interfaces on which to listen, with optional ports |
|
11065 +pid_file_path override compiled-in value |
|
11066 +queue_run_max maximum simultaneous queue runners |
|
11067 + |
|
11068 +14.10Â Resource control |
|
11069 + |
|
11070 +check_log_inodes before accepting a message |
|
11071 +check_log_space before accepting a message |
|
11072 +check_spool_inodes before accepting a message |
|
11073 +check_spool_space before accepting a message |
|
11074 +deliver_queue_load_max no queue deliveries if load high |
|
11075 +queue_only_load queue incoming if load high |
|
11076 +queue_only_load_latch don't re-evaluate load for each message |
|
11077 +queue_run_max maximum simultaneous queue runners |
|
11078 +remote_max_parallel parallel SMTP delivery per message |
|
11079 +smtp_accept_max simultaneous incoming connections |
|
11080 +smtp_accept_max_nonmail non-mail commands |
|
11081 +smtp_accept_max_nonmail_hosts hosts to which the limit applies |
|
11082 +smtp_accept_max_per_connection messages per connection |
|
11083 +smtp_accept_max_per_host connections from one host |
|
11084 +smtp_accept_queue queue mail if more connections |
|
11085 +smtp_accept_queue_per_connection queue if more messages per connection |
|
11086 +smtp_accept_reserve only reserve hosts if more connections |
|
11087 +smtp_check_spool_space from SIZE on MAIL command |
|
11088 +smtp_connect_backlog passed to TCP/IP stack |
|
11089 +smtp_load_reserve SMTP from reserved hosts if load high |
|
11090 +smtp_reserve_hosts these are the reserve hosts |
|
11091 + |
|
11092 +14.11Â Policy controls |
|
11093 + |
|
11094 +acl_not_smtp ACL for non-SMTP messages |
|
11095 +acl_not_smtp_mime ACL for non-SMTP MIME parts |
|
11096 +acl_not_smtp_start ACL for start of non-SMTP message |
|
11097 +acl_smtp_auth ACL for AUTH |
|
11098 +acl_smtp_connect ACL for connection |
|
11099 +acl_smtp_data ACL for DATA |
|
11100 +acl_smtp_dkim ACL for DKIM verification |
|
11101 +acl_smtp_etrn ACL for ETRN |
|
11102 +acl_smtp_expn ACL for EXPN |
|
11103 +acl_smtp_helo ACL for EHLO or HELO |
|
11104 +acl_smtp_mail ACL for MAIL |
|
11105 +acl_smtp_mailauth ACL for AUTH on MAIL command |
|
11106 +acl_smtp_mime ACL for MIME parts |
|
11107 +acl_smtp_predata ACL for start of data |
|
11108 +acl_smtp_quit ACL for QUIT |
|
11109 +acl_smtp_rcpt ACL for RCPT |
|
11110 +acl_smtp_starttls ACL for STARTTLS |
|
11111 +acl_smtp_vrfy ACL for VRFY |
|
11112 +av_scanner specify virus scanner |
|
11113 +check_rfc2047_length check length of RFC 2047 "encoded words" |
|
11114 +dns_csa_search_limit control CSA parent search depth |
|
11115 +dns_csa_use_reverse en/disable CSA IP reverse search |
|
11116 +header_maxsize total size of message header |
|
11117 +header_line_maxsize individual header line limit |
|
11118 +helo_accept_junk_hosts allow syntactic junk from these hosts |
|
11119 +helo_allow_chars allow illegal chars in HELO names |
|
11120 +helo_lookup_domains lookup hostname for these HELO names |
|
11121 +helo_try_verify_hosts HELO soft-checked for these hosts |
|
11122 +helo_verify_hosts HELO hard-checked for these hosts |
|
11123 +host_lookup host name looked up for these hosts |
|
11124 +host_lookup_order order of DNS and local name lookups |
|
11125 +host_reject_connection reject connection from these hosts |
|
11126 +hosts_treat_as_local useful in some cluster configurations |
|
11127 +local_scan_timeout timeout for local_scan() |
|
11128 +message_size_limit for all messages |
|
11129 +percent_hack_domains recognize %-hack for these domains |
|
11130 +spamd_address set interface to SpamAssassin |
|
11131 +strict_acl_vars object to unset ACL variables |
|
11132 + |
|
11133 +14.12Â Callout cache |
|
11134 + |
|
11135 +callout_domain_negative_expire timeout for negative domain cache item |
|
11136 +callout_domain_positive_expire timeout for positive domain cache item |
|
11137 +callout_negative_expire timeout for negative address cache item |
|
11138 +callout_positive_expire timeout for positive address cache item |
|
11139 +callout_random_local_part string to use for "random" testing |
|
11140 + |
|
11141 +14.13Â TLS |
|
11142 + |
|
11143 +gnutls_require_kx control GnuTLS key exchanges |
|
11144 +gnutls_require_mac control GnuTLS MAC algorithms |
|
11145 +gnutls_require_protocols control GnuTLS protocols |
|
11146 +gnutls_compat_mode use GnuTLS compatibility mode |
|
11147 +openssl_options adjust OpenSSL compatibility options |
|
11148 +tls_advertise_hosts advertise TLS to these hosts |
|
11149 +tls_certificate location of server certificate |
|
11150 +tls_crl certificate revocation list |
|
11151 +tls_dhparam DH parameters for server |
|
11152 +tls_on_connect_ports specify SSMTP (SMTPS) ports |
|
11153 +tls_privatekey location of server private key |
|
11154 +tls_remember_esmtp don't reset after starting TLS |
|
11155 +tls_require_ciphers specify acceptable ciphers |
|
11156 +tls_try_verify_hosts try to verify client certificate |
|
11157 +tls_verify_certificates expected client certificates |
|
11158 +tls_verify_hosts insist on client certificate verify |
|
11159 + |
|
11160 +14.14Â Local user handling |
|
11161 + |
|
11162 +finduser_retries useful in NIS environments |
|
11163 +gecos_name used when creating Sender: |
|
11164 +gecos_pattern ditto |
|
11165 +max_username_length for systems that truncate |
|
11166 +unknown_login used when no login name found |
|
11167 +unknown_username ditto |
|
11168 +uucp_from_pattern for recognizing "From " lines |
|
11169 +uucp_from_sender ditto |
|
11170 + |
|
11171 +14.15Â All incoming messages (SMTP and non-SMTP) |
|
11172 + |
|
11173 +header_maxsize total size of message header |
|
11174 +header_line_maxsize individual header line limit |
|
11175 +message_size_limit applies to all messages |
|
11176 +percent_hack_domains recognize %-hack for these domains |
|
11177 +received_header_text expanded to make Received: |
|
11178 +received_headers_max for mail loop detection |
|
11179 +recipients_max limit per message |
|
11180 +recipients_max_reject permanently reject excess recipients |
|
11181 + |
|
11182 +14.16Â Non-SMTP incoming messages |
|
11183 + |
|
11184 +receive_timeout for non-SMTP messages |
|
11185 + |
|
11186 +14.17Â Incoming SMTP messages |
|
11187 + |
|
11188 +See also the Policy controls section above. |
|
11189 + |
|
11190 +host_lookup host name looked up for these hosts |
|
11191 +host_lookup_order order of DNS and local name lookups |
|
11192 +recipient_unqualified_hosts may send unqualified recipients |
|
11193 +rfc1413_hosts make ident calls to these hosts |
|
11194 +rfc1413_query_timeout zero disables ident calls |
|
11195 +sender_unqualified_hosts may send unqualified senders |
|
11196 +smtp_accept_keepalive some TCP/IP magic |
|
11197 +smtp_accept_max simultaneous incoming connections |
|
11198 +smtp_accept_max_nonmail non-mail commands |
|
11199 +smtp_accept_max_nonmail_hosts hosts to which the limit applies |
|
11200 +smtp_accept_max_per_connection messages per connection |
|
11201 +smtp_accept_max_per_host connections from one host |
|
11202 +smtp_accept_queue queue mail if more connections |
|
11203 +smtp_accept_queue_per_connection queue if more messages per connection |
|
11204 +smtp_accept_reserve only reserve hosts if more connections |
|
11205 +smtp_active_hostname host name to use in messages |
|
11206 +smtp_banner text for welcome banner |
|
11207 +smtp_check_spool_space from SIZE on MAIL command |
|
11208 +smtp_connect_backlog passed to TCP/IP stack |
|
11209 +smtp_enforce_sync of SMTP command/responses |
|
11210 +smtp_etrn_command what to run for ETRN |
|
11211 +smtp_etrn_serialize only one at once |
|
11212 +smtp_load_reserve only reserve hosts if this load |
|
11213 +smtp_max_unknown_commands before dropping connection |
|
11214 +smtp_ratelimit_hosts apply ratelimiting to these hosts |
|
11215 +smtp_ratelimit_mail ratelimit for MAIL commands |
|
11216 +smtp_ratelimit_rcpt ratelimit for RCPT commands |
|
11217 +smtp_receive_timeout per command or data line |
|
11218 +smtp_reserve_hosts these are the reserve hosts |
|
11219 +smtp_return_error_details give detail on rejections |
|
11220 + |
|
11221 +14.18Â SMTP extensions |
|
11222 + |
|
11223 +accept_8bitmime advertise 8BITMIME |
|
11224 +auth_advertise_hosts advertise AUTH to these hosts |
|
11225 +ignore_fromline_hosts allow "From " from these hosts |
|
11226 +ignore_fromline_local allow "From " from local SMTP |
|
11227 +pipelining_advertise_hosts advertise pipelining to these hosts |
|
11228 +tls_advertise_hosts advertise TLS to these hosts |
|
11229 + |
|
11230 +14.19Â Processing messages |
|
11231 + |
|
11232 +allow_domain_literals recognize domain literal syntax |
|
11233 +allow_mx_to_ip allow MX to point to IP address |
|
11234 +allow_utf8_domains in addresses |
|
11235 +check_rfc2047_length check length of RFC 2047 "encoded words" |
|
11236 +delivery_date_remove from incoming messages |
|
11237 +envelope_to_remove from incoming messages |
|
11238 +extract_addresses_remove_arguments affects -t processing |
|
11239 +headers_charset default for translations |
|
11240 +qualify_domain default for senders |
|
11241 +qualify_recipient default for recipients |
|
11242 +return_path_remove from incoming messages |
|
11243 +strip_excess_angle_brackets in addresses |
|
11244 +strip_trailing_dot at end of addresses |
|
11245 +untrusted_set_sender untrusted can set envelope sender |
|
11246 + |
|
11247 +14.20Â System filter |
|
11248 + |
|
11249 +system_filter locate system filter |
|
11250 +system_filter_directory_transport transport for delivery to a directory |
|
11251 +system_filter_file_transport transport for delivery to a file |
|
11252 +system_filter_group group for filter running |
|
11253 +system_filter_pipe_transport transport for delivery to a pipe |
|
11254 +system_filter_reply_transport transport for autoreply delivery |
|
11255 +system_filter_user user for filter running |
|
11256 + |
|
11257 +14.21Â Routing and delivery |
|
11258 + |
|
11259 +disable_ipv6 do no IPv6 processing |
|
11260 +dns_again_means_nonexist for broken domains |
|
11261 +dns_check_names_pattern pre-DNS syntax check |
|
11262 +dns_ipv4_lookup only v4 lookup for these domains |
|
11263 +dns_retrans parameter for resolver |
|
11264 +dns_retry parameter for resolver |
|
11265 +hold_domains hold delivery for these domains |
|
11266 +local_interfaces for routing checks |
|
11267 +queue_domains no immediate delivery for these |
|
11268 +queue_only no immediate delivery at all |
|
11269 +queue_only_file no immediate delivery if file exists |
|
11270 +queue_only_load no immediate delivery if load is high |
|
11271 +queue_only_load_latch don't re-evaluate load for each message |
|
11272 +queue_only_override allow command line to override |
|
11273 +queue_run_in_order order of arrival |
|
11274 +queue_run_max of simultaneous queue runners |
|
11275 +queue_smtp_domains no immediate SMTP delivery for these |
|
11276 +remote_max_parallel parallel SMTP delivery per message |
|
11277 +remote_sort_domains order of remote deliveries |
|
11278 +retry_data_expire timeout for retry data |
|
11279 +retry_interval_max safety net for retry rules |
|
11280 + |
|
11281 +14.22Â Bounce and warning messages |
|
11282 + |
|
11283 +bounce_message_file content of bounce |
|
11284 +bounce_message_text content of bounce |
|
11285 +bounce_return_body include body if returning message |
|
11286 +bounce_return_message include original message in bounce |
|
11287 +bounce_return_size_limit limit on returned message |
|
11288 +bounce_sender_authentication send authenticated sender with bounce |
|
11289 +dsn_from set From: contents in bounces |
|
11290 +errors_copy copy bounce messages |
|
11291 +errors_reply_to Reply-to: in bounces |
|
11292 +delay_warning time schedule |
|
11293 +delay_warning_condition condition for warning messages |
|
11294 +ignore_bounce_errors_after discard undeliverable bounces |
|
11295 +smtp_return_error_details give detail on rejections |
|
11296 +warn_message_file content of warning message |
|
11297 + |
|
11298 +14.23Â Alphabetical list of main options |
|
11299 + |
|
11300 +Those options that undergo string expansion before use are marked with *. |
|
11301 + |
|
11302 ++------------------------------------------------------+ |
|
11303 +|accept_8bitmime|Use: main|Type: boolean|Default: false| |
|
11304 ++------------------------------------------------------+ |
|
11305 + |
|
11306 +This option causes Exim to send 8BITMIME in its response to an SMTP EHLO |
|
11307 +command, and to accept the BODY= parameter on MAIL commands. However, though |
|
11308 +Exim is 8-bit clean, it is not a protocol converter, and it takes no steps to |
|
11309 +do anything special with messages received by this route. Consequently, this |
|
11310 +option is turned off by default. |
|
11311 + |
|
11312 ++---------------------------------------------------+ |
|
11313 +|acl_not_smtp|Use: main|Type: string*|Default: unset| |
|
11314 ++---------------------------------------------------+ |
|
11315 + |
|
11316 +This option defines the ACL that is run when a non-SMTP message has been read |
|
11317 +and is on the point of being accepted. See chapter 40 for further details. |
|
11318 + |
|
11319 ++--------------------------------------------------------+ |
|
11320 +|acl_not_smtp_mime|Use: main|Type: string*|Default: unset| |
|
11321 ++--------------------------------------------------------+ |
|
11322 + |
|
11323 +This option defines the ACL that is run for individual MIME parts of non-SMTP |
|
11324 +messages. It operates in exactly the same way as acl_smtp_mime operates for |
|
11325 +SMTP messages. |
|
11326 + |
|
11327 ++---------------------------------------------------------+ |
|
11328 +|acl_not_smtp_start|Use: main|Type: string*|Default: unset| |
|
11329 ++---------------------------------------------------------+ |
|
11330 + |
|
11331 +This option defines the ACL that is run before Exim starts reading a non-SMTP |
|
11332 +message. See chapter 40 for further details. |
|
11333 + |
|
11334 ++----------------------------------------------------+ |
|
11335 +|acl_smtp_auth|Use: main|Type: string*|Default: unset| |
|
11336 ++----------------------------------------------------+ |
|
11337 + |
|
11338 +This option defines the ACL that is run when an SMTP AUTH command is received. |
|
11339 +See chapter 40 for further details. |
|
11340 + |
|
11341 ++-------------------------------------------------------+ |
|
11342 +|acl_smtp_connect|Use: main|Type: string*|Default: unset| |
|
11343 ++-------------------------------------------------------+ |
|
11344 + |
|
11345 +This option defines the ACL that is run when an SMTP connection is received. |
|
11346 +See chapter 40 for further details. |
|
11347 + |
|
11348 ++----------------------------------------------------+ |
|
11349 +|acl_smtp_data|Use: main|Type: string*|Default: unset| |
|
11350 ++----------------------------------------------------+ |
|
11351 + |
|
11352 +This option defines the ACL that is run after an SMTP DATA command has been |
|
11353 +processed and the message itself has been received, but before the final |
|
11354 +acknowledgment is sent. See chapter 40 for further details. |
|
11355 + |
|
11356 ++----------------------------------------------------+ |
|
11357 +|acl_smtp_etrn|Use: main|Type: string*|Default: unset| |
|
11358 ++----------------------------------------------------+ |
|
11359 + |
|
11360 +This option defines the ACL that is run when an SMTP ETRN command is received. |
|
11361 +See chapter 40 for further details. |
|
11362 + |
|
11363 ++----------------------------------------------------+ |
|
11364 +|acl_smtp_expn|Use: main|Type: string*|Default: unset| |
|
11365 ++----------------------------------------------------+ |
|
11366 + |
|
11367 +This option defines the ACL that is run when an SMTP EXPN command is received. |
|
11368 +See chapter 40 for further details. |
|
11369 + |
|
11370 ++----------------------------------------------------+ |
|
11371 +|acl_smtp_helo|Use: main|Type: string*|Default: unset| |
|
11372 ++----------------------------------------------------+ |
|
11373 + |
|
11374 +This option defines the ACL that is run when an SMTP EHLO or HELO command is |
|
11375 +received. See chapter 40 for further details. |
|
11376 + |
|
11377 ++----------------------------------------------------+ |
|
11378 +|acl_smtp_mail|Use: main|Type: string*|Default: unset| |
|
11379 ++----------------------------------------------------+ |
|
11380 + |
|
11381 +This option defines the ACL that is run when an SMTP MAIL command is received. |
|
11382 +See chapter 40 for further details. |
|
11383 + |
|
11384 ++--------------------------------------------------------+ |
|
11385 +|acl_smtp_mailauth|Use: main|Type: string*|Default: unset| |
|
11386 ++--------------------------------------------------------+ |
|
11387 + |
|
11388 +This option defines the ACL that is run when there is an AUTH parameter on a |
|
11389 +MAIL command. See chapter 40 for details of ACLs, and chapter 33 for details of |
|
11390 +authentication. |
|
11391 + |
|
11392 ++----------------------------------------------------+ |
|
11393 +|acl_smtp_mime|Use: main|Type: string*|Default: unset| |
|
11394 ++----------------------------------------------------+ |
|
11395 + |
|
11396 +This option is available when Exim is built with the content-scanning |
|
11397 +extension. It defines the ACL that is run for each MIME part in a message. See |
|
11398 +section 41.4 for details. |
|
11399 + |
|
11400 ++-------------------------------------------------------+ |
|
11401 +|acl_smtp_predata|Use: main|Type: string*|Default: unset| |
|
11402 ++-------------------------------------------------------+ |
|
11403 + |
|
11404 +This option defines the ACL that is run when an SMTP DATA command is received, |
|
11405 +before the message itself is received. See chapter 40 for further details. |
|
11406 + |
|
11407 ++----------------------------------------------------+ |
|
11408 +|acl_smtp_quit|Use: main|Type: string*|Default: unset| |
|
11409 ++----------------------------------------------------+ |
|
11410 + |
|
11411 +This option defines the ACL that is run when an SMTP QUIT command is received. |
|
11412 +See chapter 40 for further details. |
|
11413 + |
|
11414 ++----------------------------------------------------+ |
|
11415 +|acl_smtp_rcpt|Use: main|Type: string*|Default: unset| |
|
11416 ++----------------------------------------------------+ |
|
11417 + |
|
11418 +This option defines the ACL that is run when an SMTP RCPT command is received. |
|
11419 +See chapter 40 for further details. |
|
11420 + |
|
11421 ++--------------------------------------------------------+ |
|
11422 +|acl_smtp_starttls|Use: main|Type: string*|Default: unset| |
|
11423 ++--------------------------------------------------------+ |
|
11424 + |
|
11425 +This option defines the ACL that is run when an SMTP STARTTLS command is |
|
11426 +received. See chapter 40 for further details. |
|
11427 + |
|
11428 ++----------------------------------------------------+ |
|
11429 +|acl_smtp_vrfy|Use: main|Type: string*|Default: unset| |
|
11430 ++----------------------------------------------------+ |
|
11431 + |
|
11432 +This option defines the ACL that is run when an SMTP VRFY command is received. |
|
11433 +See chapter 40 for further details. |
|
11434 + |
|
11435 ++--------------------------------------------------------+ |
|
11436 +|admin_groups|Use: main|Type: string list*|Default: unset| |
|
11437 ++--------------------------------------------------------+ |
|
11438 + |
|
11439 +This option is expanded just once, at the start of Exim's processing. If the |
|
11440 +current group or any of the supplementary groups of an Exim caller is in this |
|
11441 +colon-separated list, the caller has admin privileges. If all your system |
|
11442 +programmers are in a specific group, for example, you can give them all Exim |
|
11443 +admin privileges by putting that group in admin_groups. However, this does not |
|
11444 +permit them to read Exim's spool files (whose group owner is the Exim gid). To |
|
11445 +permit this, you have to add individuals to the Exim group. |
|
11446 + |
|
11447 ++------------------------------------------------------------+ |
|
11448 +|allow_domain_literals|Use: main|Type: boolean|Default: false| |
|
11449 ++------------------------------------------------------------+ |
|
11450 + |
|
11451 +If this option is set, the RFC 2822 domain literal format is permitted in email |
|
11452 +addresses. The option is not set by default, because the domain literal format |
|
11453 +is not normally required these days, and few people know about it. It has, |
|
11454 +however, been exploited by mail abusers. |
|
11455 + |
|
11456 +Unfortunately, it seems that some DNS black list maintainers are using this |
|
11457 +format to report black listing to postmasters. If you want to accept messages |
|
11458 +addressed to your hosts by IP address, you need to set allow_domain_literals |
|
11459 +true, and also to add "@[]" to the list of local domains (defined in the named |
|
11460 +domain list local_domains in the default configuration). This "magic string" |
|
11461 +matches the domain literal form of all the local host's IP addresses. |
|
11462 + |
|
11463 ++-----------------------------------------------------+ |
|
11464 +|allow_mx_to_ip|Use: main|Type: boolean|Default: false| |
|
11465 ++-----------------------------------------------------+ |
|
11466 + |
|
11467 +It appears that more and more DNS zone administrators are breaking the rules |
|
11468 +and putting domain names that look like IP addresses on the right hand side of |
|
11469 +MX records. Exim follows the rules and rejects this, giving an error message |
|
11470 +that explains the mis-configuration. However, some other MTAs support this |
|
11471 +practice, so to avoid "Why can't Exim do this?" complaints, allow_mx_to_ip |
|
11472 +exists, in order to enable this heinous activity. It is not recommended, except |
|
11473 +when you have no other choice. |
|
11474 + |
|
11475 ++---------------------------------------------------------+ |
|
11476 +|allow_utf8_domains|Use: main|Type: boolean|Default: false| |
|
11477 ++---------------------------------------------------------+ |
|
11478 + |
|
11479 +Lots of discussion is going on about internationalized domain names. One camp |
|
11480 +is strongly in favour of just using UTF-8 characters, and it seems that at |
|
11481 +least two other MTAs permit this. This option allows Exim users to experiment |
|
11482 +if they wish. |
|
11483 + |
|
11484 +If it is set true, Exim's domain parsing function allows valid UTF-8 |
|
11485 +multicharacters to appear in domain name components, in addition to letters, |
|
11486 +digits, and hyphens. However, just setting this option is not enough; if you |
|
11487 +want to look up these domain names in the DNS, you must also adjust the value |
|
11488 +of dns_check_names_pattern to match the extended form. A suitable setting is: |
|
11489 + |
|
11490 +dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\ |
|
11491 + (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$ |
|
11492 + |
|
11493 +Alternatively, you can just disable this feature by setting |
|
11494 + |
|
11495 +dns_check_names_pattern = |
|
11496 + |
|
11497 +That is, set the option to an empty string so that no check is done. |
|
11498 + |
|
11499 ++----------------------------------------------------------+ |
|
11500 +|auth_advertise_hosts|Use: main|Type: host list*|Default: *| |
|
11501 ++----------------------------------------------------------+ |
|
11502 + |
|
11503 +If any server authentication mechanisms are configured, Exim advertises them in |
|
11504 +response to an EHLO command only if the calling host matches this list. |
|
11505 +Otherwise, Exim does not advertise AUTH. Exim does not accept AUTH commands |
|
11506 +from clients to which it has not advertised the availability of AUTH. The |
|
11507 +advertising of individual authentication mechanisms can be controlled by the |
|
11508 +use of the server_advertise_condition generic authenticator option on the |
|
11509 +individual authenticators. See chapter 33 for further details. |
|
11510 + |
|
11511 +Certain mail clients (for example, Netscape) require the user to provide a name |
|
11512 +and password for authentication if AUTH is advertised, even though it may not |
|
11513 +be needed (the host may accept messages from hosts on its local LAN without |
|
11514 +authentication, for example). The auth_advertise_hosts option can be used to |
|
11515 +make these clients more friendly by excluding them from the set of hosts to |
|
11516 +which Exim advertises AUTH. |
|
11517 + |
|
11518 +If you want to advertise the availability of AUTH only when the connection is |
|
11519 +encrypted using TLS, you can make use of the fact that the value of this option |
|
11520 +is expanded, with a setting like this: |
|
11521 + |
|
11522 +auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}} |
|
11523 + |
|
11524 +If $tls_cipher is empty, the session is not encrypted, and the result of the |
|
11525 +expansion is empty, thus matching no hosts. Otherwise, the result of the |
|
11526 +expansion is *, which matches all hosts. |
|
11527 + |
|
11528 ++------------------------------------------+ |
|
11529 +|auto_thaw|Use: main|Type: time|Default: 0s| |
|
11530 ++------------------------------------------+ |
|
11531 + |
|
11532 +If this option is set to a time greater than zero, a queue runner will try a |
|
11533 +new delivery attempt on any frozen message, other than a bounce message, if |
|
11534 +this much time has passed since it was frozen. This may result in the message |
|
11535 +being re-frozen if nothing has changed since the last attempt. It is a way of |
|
11536 +saying "keep on trying, even though there are big problems". |
|
11537 + |
|
11538 +Note: This is an old option, which predates timeout_frozen_after and |
|
11539 +ignore_bounce_errors_after. It is retained for compatibility, but it is not |
|
11540 +thought to be very useful any more, and its use should probably be avoided. |
|
11541 + |
|
11542 ++----------------------------------------------------+ |
|
11543 +|av_scanner|Use: main|Type: string|Default: see below| |
|
11544 ++----------------------------------------------------+ |
|
11545 + |
|
11546 +This option is available if Exim is built with the content-scanning extension. |
|
11547 +It specifies which anti-virus scanner to use. The default value is: |
|
11548 + |
|
11549 +sophie:/var/run/sophie |
|
11550 + |
|
11551 +If the value of av_scanner starts with a dollar character, it is expanded |
|
11552 +before use. See section 41.1 for further details. |
|
11553 + |
|
11554 ++------------------------------------------------+ |
|
11555 +|bi_command|Use: main|Type: string|Default: unset| |
|
11556 ++------------------------------------------------+ |
|
11557 + |
|
11558 +This option supplies the name of a command that is run when Exim is called with |
|
11559 +the -bi option (see chapter 5). The string value is just the command name, it |
|
11560 +is not a complete command line. If an argument is required, it must come from |
|
11561 +the -oA command line option. |
|
11562 + |
|
11563 ++---------------------------------------------------------+ |
|
11564 +|bounce_message_file|Use: main|Type: string|Default: unset| |
|
11565 ++---------------------------------------------------------+ |
|
11566 + |
|
11567 +This option defines a template file containing paragraphs of text to be used |
|
11568 +for constructing bounce messages. Details of the file's contents are given in |
|
11569 +chapter 46. See also warn_message_file. |
|
11570 + |
|
11571 ++---------------------------------------------------------+ |
|
11572 +|bounce_message_text|Use: main|Type: string|Default: unset| |
|
11573 ++---------------------------------------------------------+ |
|
11574 + |
|
11575 +When this option is set, its contents are included in the default bounce |
|
11576 +message immediately after "This message was created automatically by mail |
|
11577 +delivery software." It is not used if bounce_message_file is set. |
|
11578 + |
|
11579 ++--------------------------------------------------------+ |
|
11580 +|bounce_return_body|Use: main|Type: boolean|Default: true| |
|
11581 ++--------------------------------------------------------+ |
|
11582 + |
|
11583 +This option controls whether the body of an incoming message is included in a |
|
11584 +bounce message when bounce_return_message is true. The default setting causes |
|
11585 +the entire message, both header and body, to be returned (subject to the value |
|
11586 +of bounce_return_size_limit). If this option is false, only the message header |
|
11587 +is included. In the case of a non-SMTP message containing an error that is |
|
11588 +detected during reception, only those header lines preceding the point at which |
|
11589 +the error was detected are returned. |
|
11590 + |
|
11591 ++-----------------------------------------------------------+ |
|
11592 +|bounce_return_message|Use: main|Type: boolean|Default: true| |
|
11593 ++-----------------------------------------------------------+ |
|
11594 + |
|
11595 +If this option is set false, none of the original message is included in bounce |
|
11596 +messages generated by Exim. See also bounce_return_size_limit and |
|
11597 +bounce_return_body. |
|
11598 + |
|
11599 ++--------------------------------------------------------------+ |
|
11600 +|bounce_return_size_limit|Use: main|Type: integer|Default: 100K| |
|
11601 ++--------------------------------------------------------------+ |
|
11602 + |
|
11603 +This option sets a limit in bytes on the size of messages that are returned to |
|
11604 +senders as part of bounce messages when bounce_return_message is true. The |
|
11605 +limit should be less than the value of the global message_size_limit and of any |
|
11606 +message_size_limit settings on transports, to allow for the bounce text that |
|
11607 +Exim generates. If this option is set to zero there is no limit. |
|
11608 + |
|
11609 +When the body of any message that is to be included in a bounce message is |
|
11610 +greater than the limit, it is truncated, and a comment pointing this out is |
|
11611 +added at the top. The actual cutoff may be greater than the value given, owing |
|
11612 +to the use of buffering for transferring the message in chunks (typically 8K in |
|
11613 +size). The idea is to save bandwidth on those undeliverable 15-megabyte |
|
11614 +messages. |
|
11615 + |
|
11616 ++------------------------------------------------------------------+ |
|
11617 +|bounce_sender_authentication|Use: main|Type: string|Default: unset| |
|
11618 ++------------------------------------------------------------------+ |
|
11619 + |
|
11620 +This option provides an authenticated sender address that is sent with any |
|
11621 +bounce messages generated by Exim that are sent over an authenticated SMTP |
|
11622 +connection. A typical setting might be: |
|
11623 + |
|
11624 +bounce_sender_authentication = mailer-daemon@my.domain.example |
|
11625 + |
|
11626 +which would cause bounce messages to be sent using the SMTP command: |
|
11627 + |
|
11628 +MAIL FROM:<> AUTH=mailer-daemon@my.domain.example |
|
11629 + |
|
11630 +The value of bounce_sender_authentication must always be a complete email |
|
11631 +address. |
|
11632 + |
|
11633 ++---------------------------------------------------------------+ |
|
11634 +|callout_domain_negative_expire|Use: main|Type: time|Default: 3h| |
|
11635 ++---------------------------------------------------------------+ |
|
11636 + |
|
11637 +This option specifies the expiry time for negative callout cache data for a |
|
11638 +domain. See section 40.42 for details of callout verification, and section |
|
11639 +40.44 for details of the caching. |
|
11640 + |
|
11641 ++---------------------------------------------------------------+ |
|
11642 +|callout_domain_positive_expire|Use: main|Type: time|Default: 7d| |
|
11643 ++---------------------------------------------------------------+ |
|
11644 + |
|
11645 +This option specifies the expiry time for positive callout cache data for a |
|
11646 +domain. See section 40.42 for details of callout verification, and section |
|
11647 +40.44 for details of the caching. |
|
11648 + |
|
11649 ++--------------------------------------------------------+ |
|
11650 +|callout_negative_expire|Use: main|Type: time|Default: 2h| |
|
11651 ++--------------------------------------------------------+ |
|
11652 + |
|
11653 +This option specifies the expiry time for negative callout cache data for an |
|
11654 +address. See section 40.42 for details of callout verification, and section |
|
11655 +40.44 for details of the caching. |
|
11656 + |
|
11657 ++---------------------------------------------------------+ |
|
11658 +|callout_positive_expire|Use: main|Type: time|Default: 24h| |
|
11659 ++---------------------------------------------------------+ |
|
11660 + |
|
11661 +This option specifies the expiry time for positive callout cache data for an |
|
11662 +address. See section 40.42 for details of callout verification, and section |
|
11663 +40.44 for details of the caching. |
|
11664 + |
|
11665 ++--------------------------------------------------------------------+ |
|
11666 +|callout_random_local_part|Use: main|Type: string*|Default: see below| |
|
11667 ++--------------------------------------------------------------------+ |
|
11668 + |
|
11669 +This option defines the "random" local part that can be used as part of callout |
|
11670 +verification. The default value is |
|
11671 + |
|
11672 +$primary_host_name-$tod_epoch-testing |
|
11673 + |
|
11674 +See section 40.43 for details of how this value is used. |
|
11675 + |
|
11676 ++---------------------------------------------------+ |
|
11677 +|check_log_inodes|Use: main|Type: integer|Default: 0| |
|
11678 ++---------------------------------------------------+ |
|
11679 + |
|
11680 +See check_spool_space below. |
|
11681 + |
|
11682 ++--------------------------------------------------+ |
|
11683 +|check_log_space|Use: main|Type: integer|Default: 0| |
|
11684 ++--------------------------------------------------+ |
|
11685 + |
|
11686 +See check_spool_space below. |
|
11687 + |
|
11688 ++----------------------------------------------------------+ |
|
11689 +|check_rfc2047_length|Use: main|Type: boolean|Default: true| |
|
11690 ++----------------------------------------------------------+ |
|
11691 + |
|
11692 +RFC 2047 defines a way of encoding non-ASCII characters in headers using a |
|
11693 +system of "encoded words". The RFC specifies a maximum length for an encoded |
|
11694 +word; strings to be encoded that exceed this length are supposed to use |
|
11695 +multiple encoded words. By default, Exim does not recognize encoded words that |
|
11696 +exceed the maximum length. However, it seems that some software, in violation |
|
11697 +of the RFC, generates overlong encoded words. If check_rfc2047_length is set |
|
11698 +false, Exim recognizes encoded words of any length. |
|
11699 + |
|
11700 ++-----------------------------------------------------+ |
|
11701 +|check_spool_inodes|Use: main|Type: integer|Default: 0| |
|
11702 ++-----------------------------------------------------+ |
|
11703 + |
|
11704 +See check_spool_space below. |
|
11705 + |
|
11706 ++----------------------------------------------------+ |
|
11707 +|check_spool_space|Use: main|Type: integer|Default: 0| |
|
11708 ++----------------------------------------------------+ |
|
11709 + |
|
11710 +The four check_... options allow for checking of disk resources before a |
|
11711 +message is accepted. |
|
11712 + |
|
11713 +When any of these options are set, they apply to all incoming messages. If you |
|
11714 +want to apply different checks to different kinds of message, you can do so by |
|
11715 +testing the variables $log_inodes, $log_space, $spool_inodes, and $spool_space |
|
11716 +in an ACL with appropriate additional conditions. |
|
11717 + |
|
11718 +check_spool_space and check_spool_inodes check the spool partition if either |
|
11719 +value is greater than zero, for example: |
|
11720 + |
|
11721 +check_spool_space = 10M |
|
11722 +check_spool_inodes = 100 |
|
11723 + |
|
11724 +The spool partition is the one that contains the directory defined by |
|
11725 +SPOOL_DIRECTORY in Local/Makefile. It is used for holding messages in transit. |
|
11726 + |
|
11727 +check_log_space and check_log_inodes check the partition in which log files are |
|
11728 +written if either is greater than zero. These should be set only if |
|
11729 +log_file_path and spool_directory refer to different partitions. |
|
11730 + |
|
11731 +If there is less space or fewer inodes than requested, Exim refuses to accept |
|
11732 +incoming mail. In the case of SMTP input this is done by giving a 452 temporary |
|
11733 +error response to the MAIL command. If ESMTP is in use and there was a SIZE |
|
11734 +parameter on the MAIL command, its value is added to the check_spool_space |
|
11735 +value, and the check is performed even if check_spool_space is zero, unless |
|
11736 +no_smtp_check_spool_space is set. |
|
11737 + |
|
11738 +The values for check_spool_space and check_log_space are held as a number of |
|
11739 +kilobytes. If a non-multiple of 1024 is specified, it is rounded up. |
|
11740 + |
|
11741 +For non-SMTP input and for batched SMTP input, the test is done at start-up; on |
|
11742 +failure a message is written to stderr and Exim exits with a non-zero code, as |
|
11743 +it obviously cannot send an error message of any kind. |
|
11744 + |
|
11745 ++--------------------------------------------------------+ |
|
11746 +|daemon_smtp_ports|Use: main|Type: string|Default: "smtp"| |
|
11747 ++--------------------------------------------------------+ |
|
11748 + |
|
11749 +This option specifies one or more default SMTP ports on which the Exim daemon |
|
11750 +listens. See chapter 13 for details of how it is used. For backward |
|
11751 +compatibility, daemon_smtp_port (singular) is a synonym. |
|
11752 + |
|
11753 ++---------------------------------------------------------+ |
|
11754 +|daemon_startup_retries|Use: main|Type: integer|Default: 9| |
|
11755 ++---------------------------------------------------------+ |
|
11756 + |
|
11757 +This option, along with daemon_startup_sleep, controls the retrying done by the |
|
11758 +daemon at startup when it cannot immediately bind a listening socket (typically |
|
11759 +because the socket is already in use): daemon_startup_retries defines the |
|
11760 +number of retries after the first failure, and daemon_startup_sleep defines the |
|
11761 +length of time to wait between retries. |
|
11762 + |
|
11763 ++------------------------------------------------------+ |
|
11764 +|daemon_startup_sleep|Use: main|Type: time|Default: 30s| |
|
11765 ++------------------------------------------------------+ |
|
11766 + |
|
11767 +See daemon_startup_retries. |
|
11768 + |
|
11769 ++----------------------------------------------------+ |
|
11770 +|delay_warning|Use: main|Type: time list|Default: 24h| |
|
11771 ++----------------------------------------------------+ |
|
11772 + |
|
11773 +When a message is delayed, Exim sends a warning message to the sender at |
|
11774 +intervals specified by this option. The data is a colon-separated list of times |
|
11775 +after which to send warning messages. If the value of the option is an empty |
|
11776 +string or a zero time, no warnings are sent. Up to 10 times may be given. If a |
|
11777 +message has been on the queue for longer than the last time, the last interval |
|
11778 +between the times is used to compute subsequent warning times. For example, |
|
11779 +with |
|
11780 + |
|
11781 +delay_warning = 4h:8h:24h |
|
11782 + |
|
11783 +the first message is sent after 4 hours, the second after 8 hours, and the |
|
11784 +third one after 24 hours. After that, messages are sent every 16 hours, because |
|
11785 +that is the interval between the last two times on the list. If you set just |
|
11786 +one time, it specifies the repeat interval. For example, with: |
|
11787 + |
|
11788 +delay_warning = 6h |
|
11789 + |
|
11790 +messages are repeated every six hours. To stop warnings after a given time, set |
|
11791 +a very large time at the end of the list. For example: |
|
11792 + |
|
11793 +delay_warning = 2h:12h:99d |
|
11794 + |
|
11795 ++------------------------------------------------------------------+ |
|
11796 +|delay_warning_condition|Use: main|Type: string*|Default: see below| |
|
11797 ++------------------------------------------------------------------+ |
|
11798 + |
|
11799 +The string is expanded at the time a warning message might be sent. If all the |
|
11800 +deferred addresses have the same domain, it is set in $domain during the |
|
11801 +expansion. Otherwise $domain is empty. If the result of the expansion is a |
|
11802 +forced failure, an empty string, or a string matching any of "0", "no" or |
|
11803 +"false" (the comparison being done caselessly) then the warning message is not |
|
11804 +sent. The default is: |
|
11805 + |
|
11806 +delay_warning_condition = ${if or {\ |
|
11807 + { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\ |
|
11808 + { match{$h_precedence:}{(?i)bulk|list|junk} }\ |
|
11809 + { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\ |
|
11810 + } {no}{yes}} |
|
11811 + |
|
11812 +This suppresses the sending of warnings for messages that contain List-ID:, |
|
11813 +List-Post:, or List-Subscribe: headers, or have "bulk", "list" or "junk" in a |
|
11814 +Precedence: header, or have "auto-generated" or "auto-replied" in an |
|
11815 +Auto-Submitted: header. |
|
11816 + |
|
11817 ++-------------------------------------------------------------+ |
|
11818 +|deliver_drop_privilege|Use: main|Type: boolean|Default: false| |
|
11819 ++-------------------------------------------------------------+ |
|
11820 + |
|
11821 +If this option is set true, Exim drops its root privilege at the start of a |
|
11822 +delivery process, and runs as the Exim user throughout. This severely restricts |
|
11823 +the kinds of local delivery that are possible, but is viable in certain types |
|
11824 +of configuration. There is a discussion about the use of root privilege in |
|
11825 +chapter 52. |
|
11826 + |
|
11827 ++-----------------------------------------------------------------+ |
|
11828 +|deliver_queue_load_max|Use: main|Type: fixed-point|Default: unset| |
|
11829 ++-----------------------------------------------------------------+ |
|
11830 + |
|
11831 +When this option is set, a queue run is abandoned if the system load average |
|
11832 +becomes greater than the value of the option. The option has no effect on |
|
11833 +ancient operating systems on which Exim cannot determine the load average. See |
|
11834 +also queue_only_load and smtp_load_reserve. |
|
11835 + |
|
11836 ++----------------------------------------------------------+ |
|
11837 +|delivery_date_remove|Use: main|Type: boolean|Default: true| |
|
11838 ++----------------------------------------------------------+ |
|
11839 + |
|
11840 +Exim's transports have an option for adding a Delivery-date: header to a |
|
11841 +message when it is delivered, in exactly the same way as Return-path: is |
|
11842 +handled. Delivery-date: records the actual time of delivery. Such headers |
|
11843 +should not be present in incoming messages, and this option causes them to be |
|
11844 +removed at the time the message is received, to avoid any problems that might |
|
11845 +occur when a delivered message is subsequently sent on to some other recipient. |
|
11846 + |
|
11847 ++----------------------------------------------------+ |
|
11848 +|disable_fsync|Use: main|Type: boolean|Default: false| |
|
11849 ++----------------------------------------------------+ |
|
11850 + |
|
11851 +This option is available only if Exim was built with the compile-time option |
|
11852 +ENABLE_DISABLE_FSYNC. When this is not set, a reference to disable_fsync in a |
|
11853 +runtime configuration generates an "unknown option" error. You should not build |
|
11854 +Exim with ENABLE_DISABLE_FSYNC or set disable_fsync unless you really, really, |
|
11855 +really understand what you are doing. No pre-compiled distributions of Exim |
|
11856 +should ever make this option available. |
|
11857 + |
|
11858 +When disable_fsync is set true, Exim no longer calls fsync() to force updated |
|
11859 +files' data to be written to disc before continuing. Unexpected events such as |
|
11860 +crashes and power outages may cause data to be lost or scrambled. Here be |
|
11861 +Dragons. Beware. |
|
11862 + |
|
11863 ++---------------------------------------------------+ |
|
11864 +|disable_ipv6|Use: main|Type: boolean|Default: false| |
|
11865 ++---------------------------------------------------+ |
|
11866 + |
|
11867 +If this option is set true, even if the Exim binary has IPv6 support, no IPv6 |
|
11868 +activities take place. AAAA records are never looked up, and any IPv6 addresses |
|
11869 +that are listed in local_interfaces, data for the manualroute router, etc. are |
|
11870 +ignored. If IP literals are enabled, the ipliteral router declines to handle |
|
11871 +IPv6 literal addresses. |
|
11872 + |
|
11873 ++--------------------------------------------------------------------+ |
|
11874 +|dns_again_means_nonexist|Use: main|Type: domain list*|Default: unset| |
|
11875 ++--------------------------------------------------------------------+ |
|
11876 + |
|
11877 +DNS lookups give a "try again" response for the DNS errors "non-authoritative |
|
11878 +host not found" and "SERVERFAIL". This can cause Exim to keep trying to deliver |
|
11879 +a message, or to give repeated temporary errors to incoming mail. Sometimes the |
|
11880 +effect is caused by a badly set up name server and may persist for a long time. |
|
11881 +If a domain which exhibits this problem matches anything in |
|
11882 +dns_again_means_nonexist, it is treated as if it did not exist. This option |
|
11883 +should be used with care. You can make it apply to reverse lookups by a setting |
|
11884 +such as this: |
|
11885 + |
|
11886 +dns_again_means_nonexist = *.in-addr.arpa |
|
11887 + |
|
11888 +This option applies to all DNS lookups that Exim does. It also applies when the |
|
11889 +gethostbyname() or getipnodebyname() functions give temporary errors, since |
|
11890 +these are most likely to be caused by DNS lookup problems. The dnslookup router |
|
11891 +has some options of its own for controlling what happens when lookups for MX or |
|
11892 +SRV records give temporary errors. These more specific options are applied |
|
11893 +after this global option. |
|
11894 + |
|
11895 ++-----------------------------------------------------------------+ |
|
11896 +|dns_check_names_pattern|Use: main|Type: string|Default: see below| |
|
11897 ++-----------------------------------------------------------------+ |
|
11898 + |
|
11899 +When this option is set to a non-empty string, it causes Exim to check domain |
|
11900 +names for characters that are not allowed in host names before handing them to |
|
11901 +the DNS resolver, because some resolvers give temporary errors for names that |
|
11902 +contain unusual characters. If a domain name contains any unwanted characters, |
|
11903 +a "not found" result is forced, and the resolver is not called. The check is |
|
11904 +done by matching the domain name against a regular expression, which is the |
|
11905 +value of this option. The default pattern is |
|
11906 + |
|
11907 +dns_check_names_pattern = \ |
|
11908 + (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$ |
|
11909 + |
|
11910 +which permits only letters, digits, slashes, and hyphens in components, but |
|
11911 +they must start and end with a letter or digit. Slashes are not, in fact, |
|
11912 +permitted in host names, but they are found in certain NS records (which can be |
|
11913 +accessed in Exim by using a dnsdb lookup). If you set allow_utf8_domains, you |
|
11914 +must modify this pattern, or set the option to an empty string. |
|
11915 + |
|
11916 ++-------------------------------------------------------+ |
|
11917 +|dns_csa_search_limit|Use: main|Type: integer|Default: 5| |
|
11918 ++-------------------------------------------------------+ |
|
11919 + |
|
11920 +This option controls the depth of parental searching for CSA SRV records in the |
|
11921 +DNS, as described in more detail in section 40.47. |
|
11922 + |
|
11923 ++---------------------------------------------------------+ |
|
11924 +|dns_csa_use_reverse|Use: main|Type: boolean|Default: true| |
|
11925 ++---------------------------------------------------------+ |
|
11926 + |
|
11927 +This option controls whether or not an IP address, given as a CSA domain, is |
|
11928 +reversed and looked up in the reverse DNS, as described in more detail in |
|
11929 +section 40.47. |
|
11930 + |
|
11931 ++-----------------------------------------------------------+ |
|
11932 +|dns_ipv4_lookup|Use: main|Type: domain list*|Default: unset| |
|
11933 ++-----------------------------------------------------------+ |
|
11934 + |
|
11935 +When Exim is compiled with IPv6 support and disable_ipv6 is not set, it looks |
|
11936 +for IPv6 address records (AAAA records) as well as IPv4 address records (A |
|
11937 +records) when trying to find IP addresses for hosts, unless the host's domain |
|
11938 +matches this list. |
|
11939 + |
|
11940 +This is a fudge to help with name servers that give big delays or otherwise do |
|
11941 +not work for the AAAA record type. In due course, when the world's name servers |
|
11942 +have all been upgraded, there should be no need for this option. |
|
11943 + |
|
11944 ++--------------------------------------------+ |
|
11945 +|dns_retrans|Use: main|Type: time|Default: 0s| |
|
11946 ++--------------------------------------------+ |
|
11947 + |
|
11948 +The options dns_retrans and dns_retry can be used to set the retransmission and |
|
11949 +retry parameters for DNS lookups. Values of zero (the defaults) leave the |
|
11950 +system default settings unchanged. The first value is the time between retries, |
|
11951 +and the second is the number of retries. It isn't totally clear exactly how |
|
11952 +these settings affect the total time a DNS lookup may take. I haven't found any |
|
11953 +documentation about timeouts on DNS lookups; these parameter values are |
|
11954 +available in the external resolver interface structure, but nowhere does it |
|
11955 +seem to describe how they are used or what you might want to set in them. |
|
11956 + |
|
11957 ++--------------------------------------------+ |
|
11958 +|dns_retry|Use: main|Type: integer|Default: 0| |
|
11959 ++--------------------------------------------+ |
|
11960 + |
|
11961 +See dns_retrans above. |
|
11962 + |
|
11963 ++----------------------------------------------+ |
|
11964 +|drop_cr|Use: main|Type: boolean|Default: false| |
|
11965 ++----------------------------------------------+ |
|
11966 + |
|
11967 +This is an obsolete option that is now a no-op. It used to affect the way Exim |
|
11968 +handled CR and LF characters in incoming messages. What happens now is |
|
11969 +described in section 44.2. |
|
11970 + |
|
11971 ++---------------------------------------------------+ |
|
11972 +|dsn_from|Use: main|Type: string*|Default: see below| |
|
11973 ++---------------------------------------------------+ |
|
11974 + |
|
11975 +This option can be used to vary the contents of From: header lines in bounces |
|
11976 +and other automatically generated messages ("Delivery Status Notifications" - |
|
11977 +hence the name of the option). The default setting is: |
|
11978 + |
|
11979 +dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain> |
|
11980 + |
|
11981 +The value is expanded every time it is needed. If the expansion fails, a panic |
|
11982 +is logged, and the default value is used. |
|
11983 + |
|
11984 ++--------------------------------------------------------+ |
|
11985 +|envelope_to_remove|Use: main|Type: boolean|Default: true| |
|
11986 ++--------------------------------------------------------+ |
|
11987 + |
|
11988 +Exim's transports have an option for adding an Envelope-to: header to a message |
|
11989 +when it is delivered, in exactly the same way as Return-path: is handled. |
|
11990 +Envelope-to: records the original recipient address from the messages's |
|
11991 +envelope that caused the delivery to happen. Such headers should not be present |
|
11992 +in incoming messages, and this option causes them to be removed at the time the |
|
11993 +message is received, to avoid any problems that might occur when a delivered |
|
11994 +message is subsequently sent on to some other recipient. |
|
11995 + |
|
11996 ++-------------------------------------------------------+ |
|
11997 +|errors_copy|Use: main|Type: string list*|Default: unset| |
|
11998 ++-------------------------------------------------------+ |
|
11999 + |
|
12000 +Setting this option causes Exim to send bcc copies of bounce messages that it |
|
12001 +generates to other addresses. Note: This does not apply to bounce messages |
|
12002 +coming from elsewhere. The value of the option is a colon-separated list of |
|
12003 +items. Each item consists of a pattern, terminated by white space, followed by |
|
12004 +a comma-separated list of email addresses. If a pattern contains spaces, it |
|
12005 +must be enclosed in double quotes. |
|
12006 + |
|
12007 +Each pattern is processed in the same way as a single item in an address list |
|
12008 +(see section 10.19). When a pattern matches the recipient of the bounce |
|
12009 +message, the message is copied to the addresses on the list. The items are |
|
12010 +scanned in order, and once a matching one is found, no further items are |
|
12011 +examined. For example: |
|
12012 + |
|
12013 +errors_copy = spqr@mydomain postmaster@mydomain.example :\ |
|
12014 + rqps@mydomain hostmaster@mydomain.example,\ |
|
12015 + postmaster@mydomain.example |
|
12016 + |
|
12017 +The address list is expanded before use. The expansion variables $local_part |
|
12018 +and $domain are set from the original recipient of the error message, and if |
|
12019 +there was any wildcard matching in the pattern, the expansion variables $0, $1, |
|
12020 +etc. are set in the normal way. |
|
12021 + |
|
12022 ++-----------------------------------------------------+ |
|
12023 +|errors_reply_to|Use: main|Type: string|Default: unset| |
|
12024 ++-----------------------------------------------------+ |
|
12025 + |
|
12026 +By default, Exim's bounce and delivery warning messages contain the header line |
|
12027 + |
|
12028 +From: Mail Delivery System <Mailer-Daemon@qualify-domain> |
|
12029 + |
|
12030 +where qualify-domain is the value of the qualify_domain option. A warning |
|
12031 +message that is generated by the quota_warn_message option in an appendfile |
|
12032 +transport may contain its own From: header line that overrides the default. |
|
12033 + |
|
12034 +Experience shows that people reply to bounce messages. If the errors_reply_to |
|
12035 +option is set, a Reply-To: header is added to bounce and warning messages. For |
|
12036 +example: |
|
12037 + |
|
12038 +errors_reply_to = postmaster@my.domain.example |
|
12039 + |
|
12040 +The value of the option is not expanded. It must specify a valid RFC 2822 |
|
12041 +address. However, if a warning message that is generated by the |
|
12042 +quota_warn_message option in an appendfile transport contain its own Reply-To: |
|
12043 +header line, the value of the errors_reply_to option is not used. |
|
12044 + |
|
12045 ++------------------------------------------------------------------+ |
|
12046 +|exim_group|Use: main|Type: string|Default: compile-time configured| |
|
12047 ++------------------------------------------------------------------+ |
|
12048 + |
|
12049 +This option changes the gid under which Exim runs when it gives up root |
|
12050 +privilege. The default value is compiled into the binary. The value of this |
|
12051 +option is used only when exim_user is also set. Unless it consists entirely of |
|
12052 +digits, the string is looked up using getgrnam(), and failure causes a |
|
12053 +configuration error. See chapter 52 for a discussion of security issues. |
|
12054 + |
|
12055 ++---------------------------------------------------+ |
|
12056 +|exim_path|Use: main|Type: string|Default: see below| |
|
12057 ++---------------------------------------------------+ |
|
12058 + |
|
12059 +This option specifies the path name of the Exim binary, which is used when Exim |
|
12060 +needs to re-exec itself. The default is set up to point to the file exim in the |
|
12061 +directory configured at compile time by the BIN_DIRECTORY setting. It is |
|
12062 +necessary to change exim_path if, exceptionally, Exim is run from some other |
|
12063 +place. Warning: Do not use a macro to define the value of this option, because |
|
12064 +you will break those Exim utilities that scan the configuration file to find |
|
12065 +where the binary is. (They then use the -bP option to extract option settings |
|
12066 +such as the value of spool_directory.) |
|
12067 + |
|
12068 ++-----------------------------------------------------------------+ |
|
12069 +|exim_user|Use: main|Type: string|Default: compile-time configured| |
|
12070 ++-----------------------------------------------------------------+ |
|
12071 + |
|
12072 +This option changes the uid under which Exim runs when it gives up root |
|
12073 +privilege. The default value is compiled into the binary. Ownership of the run |
|
12074 +time configuration file and the use of the -C and -D command line options is |
|
12075 +checked against the values in the binary, not what is set here. |
|
12076 + |
|
12077 +Unless it consists entirely of digits, the string is looked up using getpwnam() |
|
12078 +, and failure causes a configuration error. If exim_group is not also supplied, |
|
12079 +the gid is taken from the result of getpwnam() if it is used. See chapter 52 |
|
12080 +for a discussion of security issues. |
|
12081 + |
|
12082 ++-----------------------------------------------------------------+ |
|
12083 +|extra_local_interfaces|Use: main|Type: string list|Default: unset| |
|
12084 ++-----------------------------------------------------------------+ |
|
12085 + |
|
12086 +This option defines network interfaces that are to be considered local when |
|
12087 +routing, but which are not used for listening by the daemon. See section 13.8 |
|
12088 +for details. |
|
12089 + |
|
12090 ++-----------------------------------------------------------------------------+ |
|
12091 +|extract_addresses_remove_ Â Â arguments|Use: main|Type: boolean|Default: true| |
|
12092 ++-----------------------------------------------------------------------------+ |
|
12093 + |
|
12094 +According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses |
|
12095 +are present on the command line when the -t option is used to build an envelope |
|
12096 +from a message's To:, Cc: and Bcc: headers, the command line addresses are |
|
12097 +removed from the recipients list. This is also how Smail behaves. However, |
|
12098 +other Sendmail documentation (the O'Reilly book) states that command line |
|
12099 +addresses are added to those obtained from the header lines. When |
|
12100 +extract_addresses_remove_arguments is true (the default), Exim subtracts |
|
12101 +argument headers. If it is set false, Exim adds rather than removes argument |
|
12102 +addresses. |
|
12103 + |
|
12104 ++---------------------------------------------------+ |
|
12105 +|finduser_retries|Use: main|Type: integer|Default: 0| |
|
12106 ++---------------------------------------------------+ |
|
12107 + |
|
12108 +On systems running NIS or other schemes in which user and group information is |
|
12109 +distributed from a remote system, there can be times when getpwnam() and |
|
12110 +related functions fail, even when given valid data, because things time out. |
|
12111 +Unfortunately these failures cannot be distinguished from genuine "not found" |
|
12112 +errors. If finduser_retries is set greater than zero, Exim will try that many |
|
12113 +extra times to find a user or a group, waiting for one second between retries. |
|
12114 + |
|
12115 +You should not set this option greater than zero if your user information is in |
|
12116 +a traditional /etc/passwd file, because it will cause Exim needlessly to search |
|
12117 +the file multiple times for non-existent users, and also cause delay. |
|
12118 + |
|
12119 ++-----------------------------------------------------------------------+ |
|
12120 +|freeze_tell|Use: main|Type: string list, comma separated|Default: unset| |
|
12121 ++-----------------------------------------------------------------------+ |
|
12122 + |
|
12123 +On encountering certain errors, or when configured to do so in a system filter, |
|
12124 +ACL, or special router, Exim freezes a message. This means that no further |
|
12125 +delivery attempts take place until an administrator thaws the message, or the |
|
12126 +auto_thaw, ignore_bounce_errors_after, or timeout_frozen_after feature cause it |
|
12127 +to be processed. If freeze_tell is set, Exim generates a warning message |
|
12128 +whenever it freezes something, unless the message it is freezing is a |
|
12129 +locally-generated bounce message. (Without this exception there is the |
|
12130 +possibility of looping.) The warning message is sent to the addresses supplied |
|
12131 +as the comma-separated value of this option. If several of the message's |
|
12132 +addresses cause freezing, only a single message is sent. If the freezing was |
|
12133 +automatic, the reason(s) for freezing can be found in the message log. If you |
|
12134 +configure freezing in a filter or ACL, you must arrange for any logging that |
|
12135 +you require. |
|
12136 + |
|
12137 ++-------------------------------------------------+ |
|
12138 +|gecos_name|Use: main|Type: string*|Default: unset| |
|
12139 ++-------------------------------------------------+ |
|
12140 + |
|
12141 +Some operating systems, notably HP-UX, use the "gecos" field in the system |
|
12142 +password file to hold other information in addition to users' real names. Exim |
|
12143 +looks up this field for use when it is creating Sender: or From: headers. If |
|
12144 +either gecos_pattern or gecos_name are unset, the contents of the field are |
|
12145 +used unchanged, except that, if an ampersand is encountered, it is replaced by |
|
12146 +the user's login name with the first character forced to upper case, since this |
|
12147 +is a convention that is observed on many systems. |
|
12148 + |
|
12149 +When these options are set, gecos_pattern is treated as a regular expression |
|
12150 +that is to be applied to the field (again with & replaced by the login name), |
|
12151 +and if it matches, gecos_name is expanded and used as the user's name. |
|
12152 + |
|
12153 +Numeric variables such as $1, $2, etc. can be used in the expansion to pick up |
|
12154 +sub-fields that were matched by the pattern. In HP-UX, where the user's name |
|
12155 +terminates at the first comma, the following can be used: |
|
12156 + |
|
12157 +gecos_pattern = ([^,]*) |
|
12158 +gecos_name = $1 |
|
12159 + |
|
12160 ++---------------------------------------------------+ |
|
12161 +|gecos_pattern|Use: main|Type: string|Default: unset| |
|
12162 ++---------------------------------------------------+ |
|
12163 + |
|
12164 +See gecos_name above. |
|
12165 + |
|
12166 ++-------------------------------------------------------+ |
|
12167 +|gnutls_require_kx|Use: main|Type: string|Default: unset| |
|
12168 ++-------------------------------------------------------+ |
|
12169 + |
|
12170 +This option controls the key exchange mechanisms when GnuTLS is used in an Exim |
|
12171 +server. For details, see section 39.5. |
|
12172 + |
|
12173 ++--------------------------------------------------------+ |
|
12174 +|gnutls_require_mac|Use: main|Type: string|Default: unset| |
|
12175 ++--------------------------------------------------------+ |
|
12176 + |
|
12177 +This option controls the MAC algorithms when GnuTLS is used in an Exim server. |
|
12178 +For details, see section 39.5. |
|
12179 + |
|
12180 ++--------------------------------------------------------------+ |
|
12181 +|gnutls_require_protocols|Use: main|Type: string|Default: unset| |
|
12182 ++--------------------------------------------------------------+ |
|
12183 + |
|
12184 +This option controls the protocols when GnuTLS is used in an Exim server. For |
|
12185 +details, see section 39.5. |
|
12186 + |
|
12187 ++---------------------------------------------------------+ |
|
12188 +|gnutls_compat_mode|Use: main|Type: boolean|Default: unset| |
|
12189 ++---------------------------------------------------------+ |
|
12190 + |
|
12191 +This option controls whether GnuTLS is used in compatibility mode in an Exim |
|
12192 +server. This reduces security slightly, but improves interworking with older |
|
12193 +implementations of TLS. |
|
12194 + |
|
12195 ++---------------------------------------------------------+ |
|
12196 +|headers_charset|Use: main|Type: string|Default: see below| |
|
12197 ++---------------------------------------------------------+ |
|
12198 + |
|
12199 +This option sets a default character set for translating from encoded MIME |
|
12200 +"words" in header lines, when referenced by an $h_xxx expansion item. The |
|
12201 +default is the value of HEADERS_CHARSET in Local/Makefile. The ultimate default |
|
12202 +is ISO-8859-1. For more details see the description of header insertions in |
|
12203 +section 11.5. |
|
12204 + |
|
12205 ++---------------------------------------------------------+ |
|
12206 +|header_maxsize|Use: main|Type: integer|Default: see below| |
|
12207 ++---------------------------------------------------------+ |
|
12208 + |
|
12209 +This option controls the overall maximum size of a message's header section. |
|
12210 +The default is the value of HEADER_MAXSIZE in Local/Makefile; the default for |
|
12211 +that is 1M. Messages with larger header sections are rejected. |
|
12212 + |
|
12213 ++------------------------------------------------------+ |
|
12214 +|header_line_maxsize|Use: main|Type: integer|Default: 0| |
|
12215 ++------------------------------------------------------+ |
|
12216 + |
|
12217 +This option limits the length of any individual header line in a message, after |
|
12218 +all the continuations have been joined together. Messages with individual |
|
12219 +header lines that are longer than the limit are rejected. The default value of |
|
12220 +zero means "no limit". |
|
12221 + |
|
12222 ++----------------------------------------------------------------+ |
|
12223 +|helo_accept_junk_hosts|Use: main|Type: host list*|Default: unset| |
|
12224 ++----------------------------------------------------------------+ |
|
12225 + |
|
12226 +Exim checks the syntax of HELO and EHLO commands for incoming SMTP mail, and |
|
12227 +gives an error response for invalid data. Unfortunately, there are some SMTP |
|
12228 +clients that send syntactic junk. They can be accommodated by setting this |
|
12229 +option. Note that this is a syntax check only. See helo_verify_hosts if you |
|
12230 +want to do semantic checking. See also helo_allow_chars for a way of extending |
|
12231 +the permitted character set. |
|
12232 + |
|
12233 ++------------------------------------------------------+ |
|
12234 +|helo_allow_chars|Use: main|Type: string|Default: unset| |
|
12235 ++------------------------------------------------------+ |
|
12236 + |
|
12237 +This option can be set to a string of rogue characters that are permitted in |
|
12238 +all EHLO and HELO names in addition to the standard letters, digits, hyphens, |
|
12239 +and dots. If you really must allow underscores, you can set |
|
12240 + |
|
12241 +helo_allow_chars = _ |
|
12242 + |
|
12243 +Note that the value is one string, not a list. |
|
12244 + |
|
12245 ++-----------------------------------------------------------------+ |
|
12246 +|helo_lookup_domains|Use: main|Type: domain list*|Default: "@:@[]"| |
|
12247 ++-----------------------------------------------------------------+ |
|
12248 + |
|
12249 +If the domain given by a client in a HELO or EHLO command matches this list, a |
|
12250 +reverse lookup is done in order to establish the host's true name. The default |
|
12251 +forces a lookup if the client host gives the server's name or any of its IP |
|
12252 +addresses (in brackets), something that broken clients have been seen to do. |
|
12253 + |
|
12254 ++---------------------------------------------------------------+ |
|
12255 +|helo_try_verify_hosts|Use: main|Type: host list*|Default: unset| |
|
12256 ++---------------------------------------------------------------+ |
|
12257 + |
|
12258 +By default, Exim just checks the syntax of HELO and EHLO commands (see |
|
12259 +helo_accept_junk_hosts and helo_allow_chars). However, some sites like to do |
|
12260 +more extensive checking of the data supplied by these commands. The ACL |
|
12261 +condition "verify = helo" is provided to make this possible. Formerly, it was |
|
12262 +necessary also to set this option (helo_try_verify_hosts) to force the check to |
|
12263 +occur. From release 4.53 onwards, this is no longer necessary. If the check has |
|
12264 +not been done before "verify = helo" is encountered, it is done at that time. |
|
12265 +Consequently, this option is obsolete. Its specification is retained here for |
|
12266 +backwards compatibility. |
|
12267 + |
|
12268 +When an EHLO or HELO command is received, if the calling host matches |
|
12269 +helo_try_verify_hosts, Exim checks that the host name given in the HELO or EHLO |
|
12270 +command either: |
|
12271 + |
|
12272 + * is an IP literal matching the calling address of the host, or |
|
12273 + |
|
12274 + * matches the host name that Exim obtains by doing a reverse lookup of the |
|
12275 + calling host address, or |
|
12276 + |
|
12277 + * when looked up using gethostbyname() (or getipnodebyname() when available) |
|
12278 + yields the calling host address. |
|
12279 + |
|
12280 +However, the EHLO or HELO command is not rejected if any of the checks fail. |
|
12281 +Processing continues, but the result of the check is remembered, and can be |
|
12282 +detected later in an ACL by the "verify = helo" condition. |
|
12283 + |
|
12284 ++-----------------------------------------------------------+ |
|
12285 +|helo_verify_hosts|Use: main|Type: host list*|Default: unset| |
|
12286 ++-----------------------------------------------------------+ |
|
12287 + |
|
12288 +Like helo_try_verify_hosts, this option is obsolete, and retained only for |
|
12289 +backwards compatibility. For hosts that match this option, Exim checks the host |
|
12290 +name given in the HELO or EHLO in the same way as for helo_try_verify_hosts. If |
|
12291 +the check fails, the HELO or EHLO command is rejected with a 550 error, and |
|
12292 +entries are written to the main and reject logs. If a MAIL command is received |
|
12293 +before EHLO or HELO, it is rejected with a 503 error. |
|
12294 + |
|
12295 ++--------------------------------------------------------+ |
|
12296 +|hold_domains|Use: main|Type: domain list*|Default: unset| |
|
12297 ++--------------------------------------------------------+ |
|
12298 + |
|
12299 +This option allows mail for particular domains to be held on the queue |
|
12300 +manually. The option is overridden if a message delivery is forced with the -M, |
|
12301 +-qf, -Rf or -Sf options, and also while testing or verifying addresses using |
|
12302 +-bt or -bv. Otherwise, if a domain matches an item in hold_domains, no routing |
|
12303 +or delivery for that address is done, and it is deferred every time the message |
|
12304 +is looked at. |
|
12305 + |
|
12306 +This option is intended as a temporary operational measure for delaying the |
|
12307 +delivery of mail while some problem is being sorted out, or some new |
|
12308 +configuration tested. If you just want to delay the processing of some domains |
|
12309 +until a queue run occurs, you should use queue_domains or queue_smtp_domains, |
|
12310 +not hold_domains. |
|
12311 + |
|
12312 +A setting of hold_domains does not override Exim's code for removing messages |
|
12313 +from the queue if they have been there longer than the longest retry time in |
|
12314 +any retry rule. If you want to hold messages for longer than the normal retry |
|
12315 +times, insert a dummy retry rule with a long retry time. |
|
12316 + |
|
12317 ++-----------------------------------------------------+ |
|
12318 +|host_lookup|Use: main|Type: host list*|Default: unset| |
|
12319 ++-----------------------------------------------------+ |
|
12320 + |
|
12321 +Exim does not look up the name of a calling host from its IP address unless it |
|
12322 +is required to compare against some host list, or the host matches |
|
12323 +helo_try_verify_hosts or helo_verify_hosts, or the host matches this option |
|
12324 +(which normally contains IP addresses rather than host names). The default |
|
12325 +configuration file contains |
|
12326 + |
|
12327 +host_lookup = * |
|
12328 + |
|
12329 +which causes a lookup to happen for all hosts. If the expense of these lookups |
|
12330 +is felt to be too great, the setting can be changed or removed. |
|
12331 + |
|
12332 +After a successful reverse lookup, Exim does a forward lookup on the name it |
|
12333 +has obtained, to verify that it yields the IP address that it started with. If |
|
12334 +this check fails, Exim behaves as if the name lookup failed. |
|
12335 + |
|
12336 +After any kind of failure, the host name (in $sender_host_name) remains unset, |
|
12337 +and $host_lookup_failed is set to the string "1". See also |
|
12338 +dns_again_means_nonexist, helo_lookup_domains, and "verify = |
|
12339 +reverse_host_lookup" in ACLs. |
|
12340 + |
|
12341 ++---------------------------------------------------------------------+ |
|
12342 +|host_lookup_order|Use: main|Type: string list|Default: "bydns:byaddr"| |
|
12343 ++---------------------------------------------------------------------+ |
|
12344 + |
|
12345 +This option specifies the order of different lookup methods when Exim is trying |
|
12346 +to find a host name from an IP address. The default is to do a DNS lookup |
|
12347 +first, and then to try a local lookup (using gethostbyaddr() or equivalent) if |
|
12348 +that fails. You can change the order of these lookups, or omit one entirely, if |
|
12349 +you want. |
|
12350 + |
|
12351 +Warning: The "byaddr" method does not always yield aliases when there are |
|
12352 +multiple PTR records in the DNS and the IP address is not listed in /etc/hosts. |
|
12353 +Different operating systems give different results in this case. That is why |
|
12354 +the default tries a DNS lookup first. |
|
12355 + |
|
12356 ++----------------------------------------------------------------+ |
|
12357 +|host_reject_connection|Use: main|Type: host list*|Default: unset| |
|
12358 ++----------------------------------------------------------------+ |
|
12359 + |
|
12360 +If this option is set, incoming SMTP calls from the hosts listed are rejected |
|
12361 +as soon as the connection is made. This option is obsolete, and retained only |
|
12362 +for backward compatibility, because nowadays the ACL specified by |
|
12363 +acl_smtp_connect can also reject incoming connections immediately. |
|
12364 + |
|
12365 +The ability to give an immediate rejection (either by this option or using an |
|
12366 +ACL) is provided for use in unusual cases. Many hosts will just try again, |
|
12367 +sometimes without much delay. Normally, it is better to use an ACL to reject |
|
12368 +incoming messages at a later stage, such as after RCPT commands. See chapter 40 |
|
12369 +. |
|
12370 + |
|
12371 ++----------------------------------------------------------------+ |
|
12372 +|hosts_connection_nolog|Use: main|Type: host list*|Default: unset| |
|
12373 ++----------------------------------------------------------------+ |
|
12374 + |
|
12375 +This option defines a list of hosts for which connection logging does not |
|
12376 +happen, even though the smtp_connection log selector is set. For example, you |
|
12377 +might want not to log SMTP connections from local processes, or from 127.0.0.1, |
|
12378 +or from your local LAN. This option is consulted in the main loop of the |
|
12379 +daemon; you should therefore strive to restrict its value to a short inline |
|
12380 +list of IP addresses and networks. To disable logging SMTP connections from |
|
12381 +local processes, you must create a host list with an empty item. For example: |
|
12382 + |
|
12383 +hosts_connection_nolog = : |
|
12384 + |
|
12385 +If the smtp_connection log selector is not set, this option has no effect. |
|
12386 + |
|
12387 ++----------------------------------------------------------------+ |
|
12388 +|hosts_treat_as_local|Use: main|Type: domain list*|Default: unset| |
|
12389 ++----------------------------------------------------------------+ |
|
12390 + |
|
12391 +If this option is set, any host names that match the domain list are treated as |
|
12392 +if they were the local host when Exim is scanning host lists obtained from MX |
|
12393 +records or other sources. Note that the value of this option is a domain list, |
|
12394 +not a host list, because it is always used to check host names, not IP |
|
12395 +addresses. |
|
12396 + |
|
12397 +This option also applies when Exim is matching the special items "@mx_any", |
|
12398 +"@mx_primary", and "@mx_secondary" in a domain list (see section 10.8), and |
|
12399 +when checking the hosts option in the smtp transport for the local host (see |
|
12400 +the allow_localhost option in that transport). See also local_interfaces, |
|
12401 +extra_local_interfaces, and chapter 13, which contains a discussion about local |
|
12402 +network interfaces and recognizing the local host. |
|
12403 + |
|
12404 ++--------------------------------------------------------+ |
|
12405 +|ibase_servers|Use: main|Type: string list|Default: unset| |
|
12406 ++--------------------------------------------------------+ |
|
12407 + |
|
12408 +This option provides a list of InterBase servers and associated connection |
|
12409 +data, to be used in conjunction with ibase lookups (see section 9.21). The |
|
12410 +option is available only if Exim has been built with InterBase support. |
|
12411 + |
|
12412 ++------------------------------------------------------------+ |
|
12413 +|ignore_bounce_errors_after|Use: main|Type: time|Default: 10w| |
|
12414 ++------------------------------------------------------------+ |
|
12415 + |
|
12416 +This option affects the processing of bounce messages that cannot be delivered, |
|
12417 +that is, those that suffer a permanent delivery failure. (Bounce messages that |
|
12418 +suffer temporary delivery failures are of course retried in the usual way.) |
|
12419 + |
|
12420 +After a permanent delivery failure, bounce messages are frozen, because there |
|
12421 +is no sender to whom they can be returned. When a frozen bounce message has |
|
12422 +been on the queue for more than the given time, it is unfrozen at the next |
|
12423 +queue run, and a further delivery is attempted. If delivery fails again, the |
|
12424 +bounce message is discarded. This makes it possible to keep failed bounce |
|
12425 +messages around for a shorter time than the normal maximum retry time for |
|
12426 +frozen messages. For example, |
|
12427 + |
|
12428 +ignore_bounce_errors_after = 12h |
|
12429 + |
|
12430 +retries failed bounce message deliveries after 12 hours, discarding any further |
|
12431 +failures. If the value of this option is set to a zero time period, bounce |
|
12432 +failures are discarded immediately. Setting a very long time (as in the default |
|
12433 +value) has the effect of disabling this option. For ways of automatically |
|
12434 +dealing with other kinds of frozen message, see auto_thaw and |
|
12435 +timeout_frozen_after. |
|
12436 + |
|
12437 ++---------------------------------------------------------------+ |
|
12438 +|ignore_fromline_hosts|Use: main|Type: host list*|Default: unset| |
|
12439 ++---------------------------------------------------------------+ |
|
12440 + |
|
12441 +Some broken SMTP clients insist on sending a UUCP-like "From " line before the |
|
12442 +headers of a message. By default this is treated as the start of the message's |
|
12443 +body, which means that any following headers are not recognized as such. Exim |
|
12444 +can be made to ignore it by setting ignore_fromline_hosts to match those hosts |
|
12445 +that insist on sending it. If the sender is actually a local process rather |
|
12446 +than a remote host, and is using -bs to inject the messages, |
|
12447 +ignore_fromline_local must be set to achieve this effect. |
|
12448 + |
|
12449 ++------------------------------------------------------------+ |
|
12450 +|ignore_fromline_local|Use: main|Type: boolean|Default: false| |
|
12451 ++------------------------------------------------------------+ |
|
12452 + |
|
12453 +See ignore_fromline_hosts above. |
|
12454 + |
|
12455 ++-----------------------------------------------+ |
|
12456 +|keep_malformed|Use: main|Type: time|Default: 4d| |
|
12457 ++-----------------------------------------------+ |
|
12458 + |
|
12459 +This option specifies the length of time to keep messages whose spool files |
|
12460 +have been corrupted in some way. This should, of course, never happen. At the |
|
12461 +next attempt to deliver such a message, it gets removed. The incident is |
|
12462 +logged. |
|
12463 + |
|
12464 ++---------------------------------------------------------------+ |
|
12465 +|ldap_default_servers|Use: main|Type: string list|Default: unset| |
|
12466 ++---------------------------------------------------------------+ |
|
12467 + |
|
12468 +This option provides a list of LDAP servers which are tried in turn when an |
|
12469 +LDAP query does not contain a server. See section 9.14 for details of LDAP |
|
12470 +queries. This option is available only when Exim has been built with LDAP |
|
12471 +support. |
|
12472 + |
|
12473 ++---------------------------------------------------+ |
|
12474 +|ldap_version|Use: main|Type: integer|Default: unset| |
|
12475 ++---------------------------------------------------+ |
|
12476 + |
|
12477 +This option can be used to force Exim to set a specific protocol version for |
|
12478 +LDAP. If it option is unset, it is shown by the -bP command line option as -1. |
|
12479 +When this is the case, the default is 3 if LDAP_VERSION3 is defined in the LDAP |
|
12480 +headers; otherwise it is 2. This option is available only when Exim has been |
|
12481 +built with LDAP support. |
|
12482 + |
|
12483 ++------------------------------------------------------+ |
|
12484 +|local_from_check|Use: main|Type: boolean|Default: true| |
|
12485 ++------------------------------------------------------+ |
|
12486 + |
|
12487 +When a message is submitted locally (that is, not over a TCP/IP connection) by |
|
12488 +an untrusted user, Exim removes any existing Sender: header line, and checks |
|
12489 +that the From: header line matches the login of the calling user and the domain |
|
12490 +specified by qualify_domain. |
|
12491 + |
|
12492 +Note: An unqualified address (no domain) in the From: header in a locally |
|
12493 +submitted message is automatically qualified by Exim, unless the -bnq command |
|
12494 +line option is used. |
|
12495 + |
|
12496 +You can use local_from_prefix and local_from_suffix to permit affixes on the |
|
12497 +local part. If the From: header line does not match, Exim adds a Sender: header |
|
12498 +with an address constructed from the calling user's login and the default |
|
12499 +qualify domain. |
|
12500 + |
|
12501 +If local_from_check is set false, the From: header check is disabled, and no |
|
12502 +Sender: header is ever added. If, in addition, you want to retain Sender: |
|
12503 +header lines supplied by untrusted users, you must also set local_sender_retain |
|
12504 +to be true. |
|
12505 + |
|
12506 +These options affect only the header lines in the message. The envelope sender |
|
12507 +is still forced to be the login id at the qualify domain unless |
|
12508 +untrusted_set_sender permits the user to supply an envelope sender. |
|
12509 + |
|
12510 +For messages received over TCP/IP, an ACL can specify "submission mode" to |
|
12511 +request similar header line checking. See section 44.16, which has more details |
|
12512 +about Sender: processing. |
|
12513 + |
|
12514 ++-------------------------------------------------------+ |
|
12515 +|local_from_prefix|Use: main|Type: string|Default: unset| |
|
12516 ++-------------------------------------------------------+ |
|
12517 + |
|
12518 +When Exim checks the From: header line of locally submitted messages for |
|
12519 +matching the login id (see local_from_check above), it can be configured to |
|
12520 +ignore certain prefixes and suffixes in the local part of the address. This is |
|
12521 +done by setting local_from_prefix and/or local_from_suffix to appropriate |
|
12522 +lists, in the same form as the local_part_prefix and local_part_suffix router |
|
12523 +options (see chapter 15). For example, if |
|
12524 + |
|
12525 +local_from_prefix = *- |
|
12526 + |
|
12527 +is set, a From: line containing |
|
12528 + |
|
12529 +From: anything-user@your.domain.example |
|
12530 + |
|
12531 +will not cause a Sender: header to be added if user@your.domain.example matches |
|
12532 +the actual sender address that is constructed from the login name and qualify |
|
12533 +domain. |
|
12534 + |
|
12535 ++-------------------------------------------------------+ |
|
12536 +|local_from_suffix|Use: main|Type: string|Default: unset| |
|
12537 ++-------------------------------------------------------+ |
|
12538 + |
|
12539 +See local_from_prefix above. |
|
12540 + |
|
12541 ++---------------------------------------------------------------+ |
|
12542 +|local_interfaces|Use: main|Type: string list|Default: see below| |
|
12543 ++---------------------------------------------------------------+ |
|
12544 + |
|
12545 +This option controls which network interfaces are used by the daemon for |
|
12546 +listening; they are also used to identify the local host when routing. Chapter |
|
12547 +13 contains a full description of this option and the related options |
|
12548 +daemon_smtp_ports, extra_local_interfaces, hosts_treat_as_local, and |
|
12549 +tls_on_connect_ports. The default value for local_interfaces is |
|
12550 + |
|
12551 +local_interfaces = 0.0.0.0 |
|
12552 + |
|
12553 +when Exim is built without IPv6 support; otherwise it is |
|
12554 + |
|
12555 +local_interfaces = <; ::0 ; 0.0.0.0 |
|
12556 + |
|
12557 ++---------------------------------------------------+ |
|
12558 +|local_scan_timeout|Use: main|Type: time|Default: 5m| |
|
12559 ++---------------------------------------------------+ |
|
12560 + |
|
12561 +This timeout applies to the local_scan() function (see chapter 42). Zero means |
|
12562 +"no timeout". If the timeout is exceeded, the incoming message is rejected with |
|
12563 +a temporary error if it is an SMTP message. For a non-SMTP message, the message |
|
12564 +is dropped and Exim ends with a non-zero code. The incident is logged on the |
|
12565 +main and reject logs. |
|
12566 + |
|
12567 ++----------------------------------------------------------+ |
|
12568 +|local_sender_retain|Use: main|Type: boolean|Default: false| |
|
12569 ++----------------------------------------------------------+ |
|
12570 + |
|
12571 +When a message is submitted locally (that is, not over a TCP/IP connection) by |
|
12572 +an untrusted user, Exim removes any existing Sender: header line. If you do not |
|
12573 +want this to happen, you must set local_sender_retain, and you must also set |
|
12574 +local_from_check to be false (Exim will complain if you do not). See also the |
|
12575 +ACL modifier "control = suppress_local_fixups". Section 44.16 has more details |
|
12576 +about Sender: processing. |
|
12577 + |
|
12578 ++-------------------------------------------------------+ |
|
12579 +|localhost_number|Use: main|Type: string*|Default: unset| |
|
12580 ++-------------------------------------------------------+ |
|
12581 + |
|
12582 +Exim's message ids are normally unique only within the local host. If |
|
12583 +uniqueness among a set of hosts is required, each host must set a different |
|
12584 +value for the localhost_number option. The string is expanded immediately after |
|
12585 +reading the configuration file (so that a number can be computed from the host |
|
12586 +name, for example) and the result of the expansion must be a number in the |
|
12587 +range 0-16 (or 0-10 on operating systems with case-insensitive file systems). |
|
12588 +This is available in subsequent string expansions via the variable |
|
12589 +$localhost_number. When localhost_number is set, the final two characters of |
|
12590 +the message id, instead of just being a fractional part of the time, are |
|
12591 +computed from the time and the local host number as described in section 3.4. |
|
12592 + |
|
12593 ++-----------------------------------------------------------------------+ |
|
12594 +|log_file_path|Use: main|Type: string list*|Default: set at compile time| |
|
12595 ++-----------------------------------------------------------------------+ |
|
12596 + |
|
12597 +This option sets the path which is used to determine the names of Exim's log |
|
12598 +files, or indicates that logging is to be to syslog, or both. It is expanded |
|
12599 +when Exim is entered, so it can, for example, contain a reference to the host |
|
12600 +name. If no specific path is set for the log files at compile or run time, they |
|
12601 +are written in a sub-directory called log in Exim's spool directory. Chapter 49 |
|
12602 +contains further details about Exim's logging, and section 49.1 describes how |
|
12603 +the contents of log_file_path are used. If this string is fixed at your |
|
12604 +installation (contains no expansion variables) it is recommended that you do |
|
12605 +not set this option in the configuration file, but instead supply the path |
|
12606 +using LOG_FILE_PATH in Local/Makefile so that it is available to Exim for |
|
12607 +logging errors detected early on - in particular, failure to read the |
|
12608 +configuration file. |
|
12609 + |
|
12610 ++--------------------------------------------------+ |
|
12611 +|log_selector|Use: main|Type: string|Default: unset| |
|
12612 ++--------------------------------------------------+ |
|
12613 + |
|
12614 +This option can be used to reduce or increase the number of things that Exim |
|
12615 +writes to its log files. Its argument is made up of names preceded by plus or |
|
12616 +minus characters. For example: |
|
12617 + |
|
12618 +log_selector = +arguments -retry_defer |
|
12619 + |
|
12620 +A list of possible names and what they control is given in the chapter on |
|
12621 +logging, in section 49.15. |
|
12622 + |
|
12623 ++---------------------------------------------------+ |
|
12624 +|log_timezone|Use: main|Type: boolean|Default: false| |
|
12625 ++---------------------------------------------------+ |
|
12626 + |
|
12627 +By default, the timestamps on log lines are in local time without the timezone. |
|
12628 +This means that if your timezone changes twice a year, the timestamps in log |
|
12629 +lines are ambiguous for an hour when the clocks go back. One way of avoiding |
|
12630 +this problem is to set the timezone to UTC. An alternative is to set |
|
12631 +log_timezone true. This turns on the addition of the timezone offset to |
|
12632 +timestamps in log lines. Turning on this option can add quite a lot to the size |
|
12633 +of log files because each line is extended by 6 characters. Note that the |
|
12634 +$tod_log variable contains the log timestamp without the zone, but there is |
|
12635 +another variable called $tod_zone that contains just the timezone offset. |
|
12636 + |
|
12637 ++---------------------------------------------------+ |
|
12638 +|lookup_open_max|Use: main|Type: integer|Default: 25| |
|
12639 ++---------------------------------------------------+ |
|
12640 + |
|
12641 +This option limits the number of simultaneously open files for single-key |
|
12642 +lookups that use regular files (that is, lsearch, dbm, and cdb). Exim normally |
|
12643 +keeps these files open during routing, because often the same file is required |
|
12644 +several times. If the limit is reached, Exim closes the least recently used |
|
12645 +file. Note that if you are using the ndbm library, it actually opens two files |
|
12646 +for each logical DBM database, though it still counts as one for the purposes |
|
12647 +of lookup_open_max. If you are getting "too many open files" errors with NDBM, |
|
12648 +you need to reduce the value of lookup_open_max. |
|
12649 + |
|
12650 ++------------------------------------------------------+ |
|
12651 +|max_username_length|Use: main|Type: integer|Default: 0| |
|
12652 ++------------------------------------------------------+ |
|
12653 + |
|
12654 +Some operating systems are broken in that they truncate long arguments to |
|
12655 +getpwnam() to eight characters, instead of returning "no such user". If this |
|
12656 +option is set greater than zero, any attempt to call getpwnam() with an |
|
12657 +argument that is longer behaves as if getpwnam() failed. |
|
12658 + |
|
12659 ++---------------------------------------------------------+ |
|
12660 +|message_body_newlines|Use: main|Type: bool|Default: false| |
|
12661 ++---------------------------------------------------------+ |
|
12662 + |
|
12663 +By default, newlines in the message body are replaced by spaces when setting |
|
12664 +the $message_body and $message_body_end expansion variables. If this option is |
|
12665 +set true, this no longer happens. |
|
12666 + |
|
12667 ++---------------------------------------------------------+ |
|
12668 +|message_body_visible|Use: main|Type: integer|Default: 500| |
|
12669 ++---------------------------------------------------------+ |
|
12670 + |
|
12671 +This option specifies how much of a message's body is to be included in the |
|
12672 +$message_body and $message_body_end expansion variables. |
|
12673 + |
|
12674 ++---------------------------------------------------------------+ |
|
12675 +|message_id_header_domain|Use: main|Type: string*|Default: unset| |
|
12676 ++---------------------------------------------------------------+ |
|
12677 + |
|
12678 +If this option is set, the string is expanded and used as the right hand side |
|
12679 +(domain) of the Message-ID: header that Exim creates if a locally-originated |
|
12680 +incoming message does not have one. "Locally-originated" means "not received |
|
12681 +over TCP/IP." Otherwise, the primary host name is used. Only letters, digits, |
|
12682 +dot and hyphen are accepted; any other characters are replaced by hyphens. If |
|
12683 +the expansion is forced to fail, or if the result is an empty string, the |
|
12684 +option is ignored. |
|
12685 + |
|
12686 ++-------------------------------------------------------------+ |
|
12687 +|message_id_header_text|Use: main|Type: string*|Default: unset| |
|
12688 ++-------------------------------------------------------------+ |
|
12689 + |
|
12690 +If this variable is set, the string is expanded and used to augment the text of |
|
12691 +the Message-id: header that Exim creates if a locally-originated incoming |
|
12692 +message does not have one. The text of this header is required by RFC 2822 to |
|
12693 +take the form of an address. By default, Exim uses its internal message id as |
|
12694 +the local part, and the primary host name as the domain. If this option is set, |
|
12695 +it is expanded, and provided the expansion is not forced to fail, and does not |
|
12696 +yield an empty string, the result is inserted into the header immediately |
|
12697 +before the @, separated from the internal message id by a dot. Any characters |
|
12698 +that are illegal in an address are automatically converted into hyphens. This |
|
12699 +means that variables such as $tod_log can be used, because the spaces and |
|
12700 +colons will become hyphens. |
|
12701 + |
|
12702 ++--------------------------------------------------+ |
|
12703 +|message_logs|Use: main|Type: boolean|Default: true| |
|
12704 ++--------------------------------------------------+ |
|
12705 + |
|
12706 +If this option is turned off, per-message log files are not created in the |
|
12707 +msglog spool sub-directory. This reduces the amount of disk I/O required by |
|
12708 +Exim, by reducing the number of files involved in handling a message from a |
|
12709 +minimum of four (header spool file, body spool file, delivery journal, and |
|
12710 +per-message log) to three. The other major I/O activity is Exim's main log, |
|
12711 +which is not affected by this option. |
|
12712 + |
|
12713 ++-------------------------------------------------------+ |
|
12714 +|message_size_limit|Use: main|Type: string*|Default: 50M| |
|
12715 ++-------------------------------------------------------+ |
|
12716 + |
|
12717 +This option limits the maximum size of message that Exim will process. The |
|
12718 +value is expanded for each incoming connection so, for example, it can be made |
|
12719 +to depend on the IP address of the remote host for messages arriving via TCP/ |
|
12720 +IP. After expansion, the value must be a sequence of decimal digits, optionally |
|
12721 +followed by K or M. |
|
12722 + |
|
12723 +Note: This limit cannot be made to depend on a message's sender or any other |
|
12724 +properties of an individual message, because it has to be advertised in the |
|
12725 +server's response to EHLO. String expansion failure causes a temporary error. A |
|
12726 +value of zero means no limit, but its use is not recommended. See also |
|
12727 +bounce_return_size_limit. |
|
12728 + |
|
12729 +Incoming SMTP messages are failed with a 552 error if the limit is exceeded; |
|
12730 +locally-generated messages either get a stderr message or a delivery failure |
|
12731 +message to the sender, depending on the -oe setting. Rejection of an oversized |
|
12732 +message is logged in both the main and the reject logs. See also the generic |
|
12733 +transport option message_size_limit, which limits the size of message that an |
|
12734 +individual transport can process. |
|
12735 + |
|
12736 +If you use a virus-scanner and set this option to to a value larger than the |
|
12737 +maximum size that your virus-scanner is configured to support, you may get |
|
12738 +failures triggered by large mails. The right size to configure for the |
|
12739 +virus-scanner depends upon what data is passed and the options in use but it's |
|
12740 +probably safest to just set it to a little larger than this value. Eg, with a |
|
12741 +default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M, |
|
12742 +some problems may result. |
|
12743 + |
|
12744 ++-----------------------------------------------------------+ |
|
12745 +|move_frozen_messages|Use: main|Type: boolean|Default: false| |
|
12746 ++-----------------------------------------------------------+ |
|
12747 + |
|
12748 +This option, which is available only if Exim has been built with the setting |
|
12749 + |
|
12750 +SUPPORT_MOVE_FROZEN_MESSAGES=yes |
|
12751 + |
|
12752 +in Local/Makefile, causes frozen messages and their message logs to be moved |
|
12753 +from the input and msglog directories on the spool to Finput and Fmsglog, |
|
12754 +respectively. There is currently no support in Exim or the standard utilities |
|
12755 +for handling such moved messages, and they do not show up in lists generated by |
|
12756 +-bp or by the Exim monitor. |
|
12757 + |
|
12758 ++--------------------------------------------------+ |
|
12759 +|mua_wrapper|Use: main|Type: boolean|Default: false| |
|
12760 ++--------------------------------------------------+ |
|
12761 + |
|
12762 +Setting this option true causes Exim to run in a very restrictive mode in which |
|
12763 +it passes messages synchronously to a smart host. Chapter 48 contains a full |
|
12764 +description of this facility. |
|
12765 + |
|
12766 ++--------------------------------------------------------+ |
|
12767 +|mysql_servers|Use: main|Type: string list|Default: unset| |
|
12768 ++--------------------------------------------------------+ |
|
12769 + |
|
12770 +This option provides a list of MySQL servers and associated connection data, to |
|
12771 +be used in conjunction with mysql lookups (see section 9.21). The option is |
|
12772 +available only if Exim has been built with MySQL support. |
|
12773 + |
|
12774 ++-------------------------------------------------------+ |
|
12775 +|never_users|Use: main|Type: string list*|Default: unset| |
|
12776 ++-------------------------------------------------------+ |
|
12777 + |
|
12778 +This option is expanded just once, at the start of Exim's processing. Local |
|
12779 +message deliveries are normally run in processes that are setuid to the |
|
12780 +recipient, and remote deliveries are normally run under Exim's own uid and gid. |
|
12781 +It is usually desirable to prevent any deliveries from running as root, as a |
|
12782 +safety precaution. |
|
12783 + |
|
12784 +When Exim is built, an option called FIXED_NEVER_USERS can be set to a list of |
|
12785 +users that must not be used for local deliveries. This list is fixed in the |
|
12786 +binary and cannot be overridden by the configuration file. By default, it |
|
12787 +contains just the single user name "root". The never_users runtime option can |
|
12788 +be used to add more users to the fixed list. |
|
12789 + |
|
12790 +If a message is to be delivered as one of the users on the fixed list or the |
|
12791 +never_users list, an error occurs, and delivery is deferred. A common example |
|
12792 +is |
|
12793 + |
|
12794 +never_users = root:daemon:bin |
|
12795 + |
|
12796 +Including root is redundant if it is also on the fixed list, but it does no |
|
12797 +harm. This option overrides the pipe_as_creator option of the pipe transport |
|
12798 +driver. |
|
12799 + |
|
12800 ++-----------------------------------------------------------------------------+ |
|
12801 +|openssl_options| Use: | Type: string | Default: | |
|
12802 +| | main | list | +dont_insert_empty_fragments| |
|
12803 ++-----------------------------------------------------------------------------+ |
|
12804 + |
|
12805 +This option allows an administrator to adjust the SSL options applied by |
|
12806 +OpenSSL to connections. It is given as a space-separated list of items, each |
|
12807 +one to be +added or -subtracted from the current value. The default value is |
|
12808 +one option which happens to have been set historically. You can remove all |
|
12809 +options with: |
|
12810 + |
|
12811 +openssl_options = -all |
|
12812 + |
|
12813 +This option is only available if Exim is built against OpenSSL. The values |
|
12814 +available for this option vary according to the age of your OpenSSL install. |
|
12815 +The "all" value controls a subset of flags which are available, typically the |
|
12816 +bug workaround options. The SSL_CTX_set_options man page will list the values |
|
12817 +known on your system and Exim should support all the "bug workaround" options |
|
12818 +and many of the "modifying" options. The Exim names lose the leading "SSL_OP_" |
|
12819 +and are lower-cased. |
|
12820 + |
|
12821 +Note that adjusting the options can have severe impact upon the security of SSL |
|
12822 +as used by Exim. It is possible to disable safety checks and shoot yourself in |
|
12823 +the foot in various unpleasant ways. This option should not be adjusted |
|
12824 +lightly. An unrecognised item will be detected at by invoking Exim with the -bV |
|
12825 +flag. |
|
12826 + |
|
12827 +An example: |
|
12828 + |
|
12829 +openssl_options = -all +microsoft_big_sslv3_buffer |
|
12830 + |
|
12831 ++---------------------------------------------------------+ |
|
12832 +|oracle_servers|Use: main|Type: string list|Default: unset| |
|
12833 ++---------------------------------------------------------+ |
|
12834 + |
|
12835 +This option provides a list of Oracle servers and associated connection data, |
|
12836 +to be used in conjunction with oracle lookups (see section 9.21). The option is |
|
12837 +available only if Exim has been built with Oracle support. |
|
12838 + |
|
12839 ++----------------------------------------------------------------+ |
|
12840 +|percent_hack_domains|Use: main|Type: domain list*|Default: unset| |
|
12841 ++----------------------------------------------------------------+ |
|
12842 + |
|
12843 +The "percent hack" is the convention whereby a local part containing a percent |
|
12844 +sign is re-interpreted as a new email address, with the percent replaced by @. |
|
12845 +This is sometimes called "source routing", though that term is also applied to |
|
12846 +RFC 2822 addresses that begin with an @ character. If this option is set, Exim |
|
12847 +implements the percent facility for those domains listed, but no others. This |
|
12848 +happens before an incoming SMTP address is tested against an ACL. |
|
12849 + |
|
12850 +Warning: The "percent hack" has often been abused by people who are trying to |
|
12851 +get round relaying restrictions. For this reason, it is best avoided if at all |
|
12852 +possible. Unfortunately, a number of less security-conscious MTAs implement it |
|
12853 +unconditionally. If you are running Exim on a gateway host, and routing mail |
|
12854 +through to internal MTAs without processing the local parts, it is a good idea |
|
12855 +to reject recipient addresses with percent characters in their local parts. |
|
12856 +Exim's default configuration does this. |
|
12857 + |
|
12858 ++----------------------------------------------------+ |
|
12859 +|perl_at_start|Use: main|Type: boolean|Default: false| |
|
12860 ++----------------------------------------------------+ |
|
12861 + |
|
12862 +This option is available only when Exim is built with an embedded Perl |
|
12863 +interpreter. See chapter 12 for details of its use. |
|
12864 + |
|
12865 ++--------------------------------------------------+ |
|
12866 +|perl_startup|Use: main|Type: string|Default: unset| |
|
12867 ++--------------------------------------------------+ |
|
12868 + |
|
12869 +This option is available only when Exim is built with an embedded Perl |
|
12870 +interpreter. See chapter 12 for details of its use. |
|
12871 + |
|
12872 ++--------------------------------------------------------+ |
|
12873 +|pgsql_servers|Use: main|Type: string list|Default: unset| |
|
12874 ++--------------------------------------------------------+ |
|
12875 + |
|
12876 +This option provides a list of PostgreSQL servers and associated connection |
|
12877 +data, to be used in conjunction with pgsql lookups (see section 9.21). The |
|
12878 +option is available only if Exim has been built with PostgreSQL support. |
|
12879 + |
|
12880 ++------------------------------------------------------------------+ |
|
12881 +|pid_file_path|Use: main|Type: string*|Default: set at compile time| |
|
12882 ++------------------------------------------------------------------+ |
|
12883 + |
|
12884 +This option sets the name of the file to which the Exim daemon writes its |
|
12885 +process id. The string is expanded, so it can contain, for example, references |
|
12886 +to the host name: |
|
12887 + |
|
12888 +pid_file_path = /var/log/$primary_hostname/exim.pid |
|
12889 + |
|
12890 +If no path is set, the pid is written to the file exim-daemon.pid in Exim's |
|
12891 +spool directory. The value set by the option can be overridden by the -oP |
|
12892 +command line option. A pid file is not written if a "non-standard" daemon is |
|
12893 +run by means of the -oX option, unless a path is explicitly supplied by -oP. |
|
12894 + |
|
12895 ++----------------------------------------------------------------+ |
|
12896 +|pipelining_advertise_hosts|Use: main|Type: host list*|Default: *| |
|
12897 ++----------------------------------------------------------------+ |
|
12898 + |
|
12899 +This option can be used to suppress the advertisement of the SMTP PIPELINING |
|
12900 +extension to specific hosts. See also the no_pipelining control in section |
|
12901 +40.21. When PIPELINING is not advertised and smtp_enforce_sync is true, an Exim |
|
12902 +server enforces strict synchronization for each SMTP command and response. When |
|
12903 +PIPELINING is advertised, Exim assumes that clients will use it; "out of order" |
|
12904 +commands that are "expected" do not count as protocol errors (see |
|
12905 +smtp_max_synprot_errors). |
|
12906 + |
|
12907 ++------------------------------------------------------------+ |
|
12908 +|preserve_message_logs|Use: main|Type: boolean|Default: false| |
|
12909 ++------------------------------------------------------------+ |
|
12910 + |
|
12911 +If this option is set, message log files are not deleted when messages are |
|
12912 +completed. Instead, they are moved to a sub-directory of the spool directory |
|
12913 +called msglog.OLD, where they remain available for statistical or debugging |
|
12914 +purposes. This is a dangerous option to set on systems with any appreciable |
|
12915 +volume of mail. Use with care! |
|
12916 + |
|
12917 ++----------------------------------------------------------+ |
|
12918 +|primary_hostname|Use: main|Type: string|Default: see below| |
|
12919 ++----------------------------------------------------------+ |
|
12920 + |
|
12921 +This specifies the name of the current host. It is used in the default EHLO or |
|
12922 +HELO command for outgoing SMTP messages (changeable via the helo_data option in |
|
12923 +the smtp transport), and as the default for qualify_domain. The value is also |
|
12924 +used by default in some SMTP response messages from an Exim server. This can be |
|
12925 +changed dynamically by setting smtp_active_hostname. |
|
12926 + |
|
12927 +If primary_hostname is not set, Exim calls uname() to find the host name. If |
|
12928 +this fails, Exim panics and dies. If the name returned by uname() contains only |
|
12929 +one component, Exim passes it to gethostbyname() (or getipnodebyname() when |
|
12930 +available) in order to obtain the fully qualified version. The variable |
|
12931 +$primary_hostname contains the host name, whether set explicitly by this |
|
12932 +option, or defaulted. |
|
12933 + |
|
12934 ++--------------------------------------------------------+ |
|
12935 +|print_topbitchars|Use: main|Type: boolean|Default: false| |
|
12936 ++--------------------------------------------------------+ |
|
12937 + |
|
12938 +By default, Exim considers only those characters whose codes lie in the range |
|
12939 +32-126 to be printing characters. In a number of circumstances (for example, |
|
12940 +when writing log entries) non-printing characters are converted into escape |
|
12941 +sequences, primarily to avoid messing up the layout. If print_topbitchars is |
|
12942 +set, code values of 128 and above are also considered to be printing |
|
12943 +characters. |
|
12944 + |
|
12945 +This option also affects the header syntax checks performed by the autoreply |
|
12946 +transport, and whether Exim uses RFC 2047 encoding of the user's full name when |
|
12947 +constructing From: and Sender: addresses (as described in section 44.18). |
|
12948 +Setting this option can cause Exim to generate eight bit message headers that |
|
12949 +do not conform to the standards. |
|
12950 + |
|
12951 ++------------------------------------------------------+ |
|
12952 +|process_log_path|Use: main|Type: string|Default: unset| |
|
12953 ++------------------------------------------------------+ |
|
12954 + |
|
12955 +This option sets the name of the file to which an Exim process writes its |
|
12956 +"process log" when sent a USR1 signal. This is used by the exiwhat utility |
|
12957 +script. If this option is unset, the file called exim-process.info in Exim's |
|
12958 +spool directory is used. The ability to specify the name explicitly can be |
|
12959 +useful in environments where two different Exims are running, using different |
|
12960 +spool directories. |
|
12961 + |
|
12962 ++---------------------------------------------------------+ |
|
12963 +|prod_requires_admin|Use: main|Type: boolean|Default: true| |
|
12964 ++---------------------------------------------------------+ |
|
12965 + |
|
12966 +The -M, -R, and -q command-line options require the caller to be an admin user |
|
12967 +unless prod_requires_admin is set false. See also queue_list_requires_admin. |
|
12968 + |
|
12969 ++--------------------------------------------------------+ |
|
12970 +|qualify_domain|Use: main|Type: string|Default: see below| |
|
12971 ++--------------------------------------------------------+ |
|
12972 + |
|
12973 +This option specifies the domain name that is added to any envelope sender |
|
12974 +addresses that do not have a domain qualification. It also applies to recipient |
|
12975 +addresses if qualify_recipient is not set. Unqualified addresses are accepted |
|
12976 +by default only for locally-generated messages. Qualification is also applied |
|
12977 +to addresses in header lines such as From: and To: for locally-generated |
|
12978 +messages, unless the -bnq command line option is used. |
|
12979 + |
|
12980 +Messages from external sources must always contain fully qualified addresses, |
|
12981 +unless the sending host matches sender_unqualified_hosts or |
|
12982 +recipient_unqualified_hosts (as appropriate), in which case incoming addresses |
|
12983 +are qualified with qualify_domain or qualify_recipient as necessary. |
|
12984 +Internally, Exim always works with fully qualified envelope addresses. If |
|
12985 +qualify_domain is not set, it defaults to the primary_hostname value. |
|
12986 + |
|
12987 ++-----------------------------------------------------------+ |
|
12988 +|qualify_recipient|Use: main|Type: string|Default: see below| |
|
12989 ++-----------------------------------------------------------+ |
|
12990 + |
|
12991 +This option allows you to specify a different domain for qualifying recipient |
|
12992 +addresses to the one that is used for senders. See qualify_domain above. |
|
12993 + |
|
12994 ++---------------------------------------------------------+ |
|
12995 +|queue_domains|Use: main|Type: domain list*|Default: unset| |
|
12996 ++---------------------------------------------------------+ |
|
12997 + |
|
12998 +This option lists domains for which immediate delivery is not required. A |
|
12999 +delivery process is started whenever a message is received, but only those |
|
13000 +domains that do not match are processed. All other deliveries wait until the |
|
13001 +next queue run. See also hold_domains and queue_smtp_domains. |
|
13002 + |
|
13003 ++---------------------------------------------------------------+ |
|
13004 +|queue_list_requires_admin|Use: main|Type: boolean|Default: true| |
|
13005 ++---------------------------------------------------------------+ |
|
13006 + |
|
13007 +The -bp command-line option, which lists the messages that are on the queue, |
|
13008 +requires the caller to be an admin user unless queue_list_requires_admin is set |
|
13009 +false. See also prod_requires_admin. |
|
13010 + |
|
13011 ++-------------------------------------------------+ |
|
13012 +|queue_only|Use: main|Type: boolean|Default: false| |
|
13013 ++-------------------------------------------------+ |
|
13014 + |
|
13015 +If queue_only is set, a delivery process is not automatically started whenever |
|
13016 +a message is received. Instead, the message waits on the queue for the next |
|
13017 +queue run. Even if queue_only is false, incoming messages may not get delivered |
|
13018 +immediately when certain conditions (such as heavy load) occur. |
|
13019 + |
|
13020 +The -odq command line has the same effect as queue_only. The -odb and -odi |
|
13021 +command line options override queue_only unless queue_only_override is set |
|
13022 +false. See also queue_only_file, queue_only_load, and smtp_accept_queue. |
|
13023 + |
|
13024 ++-----------------------------------------------------+ |
|
13025 +|queue_only_file|Use: main|Type: string|Default: unset| |
|
13026 ++-----------------------------------------------------+ |
|
13027 + |
|
13028 +This option can be set to a colon-separated list of absolute path names, each |
|
13029 +one optionally preceded by "smtp". When Exim is receiving a message, it tests |
|
13030 +for the existence of each listed path using a call to stat(). For each path |
|
13031 +that exists, the corresponding queueing option is set. For paths with no |
|
13032 +prefix, queue_only is set; for paths prefixed by "smtp", queue_smtp_domains is |
|
13033 +set to match all domains. So, for example, |
|
13034 + |
|
13035 +queue_only_file = smtp/some/file |
|
13036 + |
|
13037 +causes Exim to behave as if queue_smtp_domains were set to "*" whenever /some/ |
|
13038 +file exists. |
|
13039 + |
|
13040 ++----------------------------------------------------------+ |
|
13041 +|queue_only_load|Use: main|Type: fixed-point|Default: unset| |
|
13042 ++----------------------------------------------------------+ |
|
13043 + |
|
13044 +If the system load average is higher than this value, incoming messages from |
|
13045 +all sources are queued, and no automatic deliveries are started. If this |
|
13046 +happens during local or remote SMTP input, all subsequent messages received on |
|
13047 +the same SMTP connection are queued by default, whatever happens to the load in |
|
13048 +the meantime, but this can be changed by setting queue_only_load_latch false. |
|
13049 + |
|
13050 +Deliveries will subsequently be performed by queue runner processes. This |
|
13051 +option has no effect on ancient operating systems on which Exim cannot |
|
13052 +determine the load average. See also deliver_queue_load_max and |
|
13053 +smtp_load_reserve. |
|
13054 + |
|
13055 ++-----------------------------------------------------------+ |
|
13056 +|queue_only_load_latch|Use: main|Type: boolean|Default: true| |
|
13057 ++-----------------------------------------------------------+ |
|
13058 + |
|
13059 +When this option is true (the default), once one message has been queued |
|
13060 +because the load average is higher than the value set by queue_only_load, all |
|
13061 +subsequent messages received on the same SMTP connection are also queued. This |
|
13062 +is a deliberate choice; even though the load average may fall below the |
|
13063 +threshold, it doesn't seem right to deliver later messages on the same |
|
13064 +connection when not delivering earlier ones. However, there are special |
|
13065 +circumstances such as very long-lived connections from scanning appliances |
|
13066 +where this is not the best strategy. In such cases, queue_only_load_latch |
|
13067 +should be set false. This causes the value of the load average to be |
|
13068 +re-evaluated for each message. |
|
13069 + |
|
13070 ++---------------------------------------------------------+ |
|
13071 +|queue_only_override|Use: main|Type: boolean|Default: true| |
|
13072 ++---------------------------------------------------------+ |
|
13073 + |
|
13074 +When this option is true, the -odx command line options override the setting of |
|
13075 +queue_only or queue_only_file in the configuration file. If queue_only_override |
|
13076 +is set false, the -odx options cannot be used to override; they are accepted, |
|
13077 +but ignored. |
|
13078 + |
|
13079 ++---------------------------------------------------------+ |
|
13080 +|queue_run_in_order|Use: main|Type: boolean|Default: false| |
|
13081 ++---------------------------------------------------------+ |
|
13082 + |
|
13083 +If this option is set, queue runs happen in order of message arrival instead of |
|
13084 +in an arbitrary order. For this to happen, a complete list of the entire queue |
|
13085 +must be set up before the deliveries start. When the queue is all held in a |
|
13086 +single directory (the default), a single list is created for both the ordered |
|
13087 +and the non-ordered cases. However, if split_spool_directory is set, a single |
|
13088 +list is not created when queue_run_in_order is false. In this case, the |
|
13089 +sub-directories are processed one at a time (in a random order), and this |
|
13090 +avoids setting up one huge list for the whole queue. Thus, setting |
|
13091 +queue_run_in_order with split_spool_directory may degrade performance when the |
|
13092 +queue is large, because of the extra work in setting up the single, large list. |
|
13093 +In most situations, queue_run_in_order should not be set. |
|
13094 + |
|
13095 ++------------------------------------------------+ |
|
13096 +|queue_run_max|Use: main|Type: integer|Default: 5| |
|
13097 ++------------------------------------------------+ |
|
13098 + |
|
13099 +This controls the maximum number of queue runner processes that an Exim daemon |
|
13100 +can run simultaneously. This does not mean that it starts them all at once, but |
|
13101 +rather that if the maximum number are still running when the time comes to |
|
13102 +start another one, it refrains from starting another one. This can happen with |
|
13103 +very large queues and/or very sluggish deliveries. This option does not, |
|
13104 +however, interlock with other processes, so additional queue runners can be |
|
13105 +started by other means, or by killing and restarting the daemon. |
|
13106 + |
|
13107 +Setting this option to zero does not suppress queue runs; rather, it disables |
|
13108 +the limit, allowing any number of simultaneous queue runner processes to be |
|
13109 +run. If you do not want queue runs to occur, omit the -qxx setting on the |
|
13110 +daemon's command line. |
|
13111 + |
|
13112 ++--------------------------------------------------------------+ |
|
13113 +|queue_smtp_domains|Use: main|Type: domain list*|Default: unset| |
|
13114 ++--------------------------------------------------------------+ |
|
13115 + |
|
13116 +When this option is set, a delivery process is started whenever a message is |
|
13117 +received, routing is performed, and local deliveries take place. However, if |
|
13118 +any SMTP deliveries are required for domains that match queue_smtp_domains, |
|
13119 +they are not immediately delivered, but instead the message waits on the queue |
|
13120 +for the next queue run. Since routing of the message has taken place, Exim |
|
13121 +knows to which remote hosts it must be delivered, and so when the queue run |
|
13122 +happens, multiple messages for the same host are delivered over a single SMTP |
|
13123 +connection. The -odqs command line option causes all SMTP deliveries to be |
|
13124 +queued in this way, and is equivalent to setting queue_smtp_domains to "*". See |
|
13125 +also hold_domains and queue_domains. |
|
13126 + |
|
13127 ++------------------------------------------------+ |
|
13128 +|receive_timeout|Use: main|Type: time|Default: 0s| |
|
13129 ++------------------------------------------------+ |
|
13130 + |
|
13131 +This option sets the timeout for accepting a non-SMTP message, that is, the |
|
13132 +maximum time that Exim waits when reading a message on the standard input. If |
|
13133 +the value is zero, it will wait for ever. This setting is overridden by the -or |
|
13134 +command line option. The timeout for incoming SMTP messages is controlled by |
|
13135 +smtp_receive_timeout. |
|
13136 + |
|
13137 ++---------------------------------------------------------------+ |
|
13138 +|received_header_text|Use: main|Type: string*|Default: see below| |
|
13139 ++---------------------------------------------------------------+ |
|
13140 + |
|
13141 +This string defines the contents of the Received: message header that is added |
|
13142 +to each message, except for the timestamp, which is automatically added on at |
|
13143 +the end (preceded by a semicolon). The string is expanded each time it is used. |
|
13144 +If the expansion yields an empty string, no Received: header line is added to |
|
13145 +the message. Otherwise, the string should start with the text "Received:" and |
|
13146 +conform to the RFC 2822 specification for Received: header lines. The default |
|
13147 +setting is: |
|
13148 + |
|
13149 +received_header_text = Received: \ |
|
13150 + ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\ |
|
13151 + {${if def:sender_ident \ |
|
13152 + {from ${quote_local_part:$sender_ident} }}\ |
|
13153 + ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\ |
|
13154 + by $primary_hostname \ |
|
13155 + ${if def:received_protocol {with $received_protocol}} \ |
|
13156 + ${if def:tls_cipher {($tls_cipher)\n\t}}\ |
|
13157 + (Exim $version_number)\n\t\ |
|
13158 + ${if def:sender_address \ |
|
13159 + {(envelope-from <$sender_address>)\n\t}}\ |
|
13160 + id $message_exim_id\ |
|
13161 + ${if def:received_for {\n\tfor $received_for}} |
|
13162 + |
|
13163 +The reference to the TLS cipher is omitted when Exim is built without TLS |
|
13164 +support. The use of conditional expansions ensures that this works for both |
|
13165 +locally generated messages and messages received from remote hosts, giving |
|
13166 +header lines such as the following: |
|
13167 + |
|
13168 +Received: from scrooge.carol.example ([192.168.12.25] ident=root) |
|
13169 +by marley.carol.example with esmtp (Exim 4.00) |
|
13170 +(envelope-from <bob@carol.example>) |
|
13171 +id 16IOWa-00019l-00 |
|
13172 +for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000 |
|
13173 +Received: by scrooge.carol.example with local (Exim 4.00) |
|
13174 +id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000 |
|
13175 + |
|
13176 +Until the body of the message has been received, the timestamp is the time when |
|
13177 +the message started to be received. Once the body has arrived, and all policy |
|
13178 +checks have taken place, the timestamp is updated to the time at which the |
|
13179 +message was accepted. |
|
13180 + |
|
13181 ++--------------------------------------------------------+ |
|
13182 +|received_headers_max|Use: main|Type: integer|Default: 30| |
|
13183 ++--------------------------------------------------------+ |
|
13184 + |
|
13185 +When a message is to be delivered, the number of Received: headers is counted, |
|
13186 +and if it is greater than this parameter, a mail loop is assumed to have |
|
13187 +occurred, the delivery is abandoned, and an error message is generated. This |
|
13188 +applies to both local and remote deliveries. |
|
13189 + |
|
13190 ++---------------------------------------------------------------------+ |
|
13191 +|recipient_unqualified_hosts|Use: main|Type: host list*|Default: unset| |
|
13192 ++---------------------------------------------------------------------+ |
|
13193 + |
|
13194 +This option lists those hosts from which Exim is prepared to accept unqualified |
|
13195 +recipient addresses in message envelopes. The addresses are made fully |
|
13196 +qualified by the addition of the qualify_recipient value. This option also |
|
13197 +affects message header lines. Exim does not reject unqualified recipient |
|
13198 +addresses in headers, but it qualifies them only if the message came from a |
|
13199 +host that matches recipient_unqualified_hosts, or if the message was submitted |
|
13200 +locally (not using TCP/IP), and the -bnq option was not set. |
|
13201 + |
|
13202 ++-------------------------------------------------+ |
|
13203 +|recipients_max|Use: main|Type: integer|Default: 0| |
|
13204 ++-------------------------------------------------+ |
|
13205 + |
|
13206 +If this option is set greater than zero, it specifies the maximum number of |
|
13207 +original recipients for any message. Additional recipients that are generated |
|
13208 +by aliasing or forwarding do not count. SMTP messages get a 452 response for |
|
13209 +all recipients over the limit; earlier recipients are delivered as normal. |
|
13210 +Non-SMTP messages with too many recipients are failed, and no deliveries are |
|
13211 +done. |
|
13212 + |
|
13213 +Note: The RFCs specify that an SMTP server should accept at least 100 RCPT |
|
13214 +commands in a single message. |
|
13215 + |
|
13216 ++------------------------------------------------------------+ |
|
13217 +|recipients_max_reject|Use: main|Type: boolean|Default: false| |
|
13218 ++------------------------------------------------------------+ |
|
13219 + |
|
13220 +If this option is set true, Exim rejects SMTP messages containing too many |
|
13221 +recipients by giving 552 errors to the surplus RCPT commands, and a 554 error |
|
13222 +to the eventual DATA command. Otherwise (the default) it gives a 452 error to |
|
13223 +the surplus RCPT commands and accepts the message on behalf of the initial set |
|
13224 +of recipients. The remote server should then re-send the message for the |
|
13225 +remaining recipients at a later time. |
|
13226 + |
|
13227 ++------------------------------------------------------+ |
|
13228 +|remote_max_parallel|Use: main|Type: integer|Default: 2| |
|
13229 ++------------------------------------------------------+ |
|
13230 + |
|
13231 +This option controls parallel delivery of one message to a number of remote |
|
13232 +hosts. If the value is less than 2, parallel delivery is disabled, and Exim |
|
13233 +does all the remote deliveries for a message one by one. Otherwise, if a single |
|
13234 +message has to be delivered to more than one remote host, or if several copies |
|
13235 +have to be sent to the same remote host, up to remote_max_parallel deliveries |
|
13236 +are done simultaneously. If more than remote_max_parallel deliveries are |
|
13237 +required, the maximum number of processes are started, and as each one |
|
13238 +finishes, another is begun. The order of starting processes is the same as if |
|
13239 +sequential delivery were being done, and can be controlled by the |
|
13240 +remote_sort_domains option. If parallel delivery takes place while running with |
|
13241 +debugging turned on, the debugging output from each delivery process is tagged |
|
13242 +with its process id. |
|
13243 + |
|
13244 +This option controls only the maximum number of parallel deliveries for one |
|
13245 +message in one Exim delivery process. Because Exim has no central queue |
|
13246 +manager, there is no way of controlling the total number of simultaneous |
|
13247 +deliveries if the configuration allows a delivery attempt as soon as a message |
|
13248 +is received. |
|
13249 + |
|
13250 +If you want to control the total number of deliveries on the system, you need |
|
13251 +to set the queue_only option. This ensures that all incoming messages are added |
|
13252 +to the queue without starting a delivery process. Then set up an Exim daemon to |
|
13253 +start queue runner processes at appropriate intervals (probably fairly often, |
|
13254 +for example, every minute), and limit the total number of queue runners by |
|
13255 +setting the queue_run_max parameter. Because each queue runner delivers only |
|
13256 +one message at a time, the maximum number of deliveries that can then take |
|
13257 +place at once is queue_run_max multiplied by remote_max_parallel. |
|
13258 + |
|
13259 +If it is purely remote deliveries you want to control, use queue_smtp_domains |
|
13260 +instead of queue_only. This has the added benefit of doing the SMTP routing |
|
13261 +before queueing, so that several messages for the same host will eventually get |
|
13262 +delivered down the same connection. |
|
13263 + |
|
13264 ++---------------------------------------------------------------+ |
|
13265 +|remote_sort_domains|Use: main|Type: domain list*|Default: unset| |
|
13266 ++---------------------------------------------------------------+ |
|
13267 + |
|
13268 +When there are a number of remote deliveries for a message, they are sorted by |
|
13269 +domain into the order given by this list. For example, |
|
13270 + |
|
13271 +remote_sort_domains = *.cam.ac.uk:*.uk |
|
13272 + |
|
13273 +would attempt to deliver to all addresses in the cam.ac.uk domain first, then |
|
13274 +to those in the uk domain, then to any others. |
|
13275 + |
|
13276 ++--------------------------------------------------+ |
|
13277 +|retry_data_expire|Use: main|Type: time|Default: 7d| |
|
13278 ++--------------------------------------------------+ |
|
13279 + |
|
13280 +This option sets a "use before" time on retry information in Exim's hints |
|
13281 +database. Any older retry data is ignored. This means that, for example, once a |
|
13282 +host has not been tried for 7 days, Exim behaves as if it has no knowledge of |
|
13283 +past failures. |
|
13284 + |
|
13285 ++----------------------------------------------------+ |
|
13286 +|retry_interval_max|Use: main|Type: time|Default: 24h| |
|
13287 ++----------------------------------------------------+ |
|
13288 + |
|
13289 +Chapter 32 describes Exim's mechanisms for controlling the intervals between |
|
13290 +delivery attempts for messages that cannot be delivered straight away. This |
|
13291 +option sets an overall limit to the length of time between retries. It cannot |
|
13292 +be set greater than 24 hours; any attempt to do so forces the default value. |
|
13293 + |
|
13294 ++--------------------------------------------------------+ |
|
13295 +|return_path_remove|Use: main|Type: boolean|Default: true| |
|
13296 ++--------------------------------------------------------+ |
|
13297 + |
|
13298 +RFC 2821, section 4.4, states that an SMTP server must insert a Return-path: |
|
13299 +header line into a message when it makes a "final delivery". The Return-path: |
|
13300 +header preserves the sender address as received in the MAIL command. This |
|
13301 +description implies that this header should not be present in an incoming |
|
13302 +message. If return_path_remove is true, any existing Return-path: headers are |
|
13303 +removed from messages at the time they are received. Exim's transports have |
|
13304 +options for adding Return-path: headers at the time of delivery. They are |
|
13305 +normally used only for final local deliveries. |
|
13306 + |
|
13307 ++-------------------------------------------------------+ |
|
13308 +|return_size_limit|Use: main|Type: integer|Default: 100K| |
|
13309 ++-------------------------------------------------------+ |
|
13310 + |
|
13311 +This option is an obsolete synonym for bounce_return_size_limit. |
|
13312 + |
|
13313 ++---------------------------------------------------+ |
|
13314 +|rfc1413_hosts|Use: main|Type: host list*|Default: *| |
|
13315 ++---------------------------------------------------+ |
|
13316 + |
|
13317 +RFC 1413 identification calls are made to any client host which matches an item |
|
13318 +in the list. |
|
13319 + |
|
13320 ++------------------------------------------------------+ |
|
13321 +|rfc1413_query_timeout|Use: main|Type: time|Default: 5s| |
|
13322 ++------------------------------------------------------+ |
|
13323 + |
|
13324 +This sets the timeout on RFC 1413 identification calls. If it is set to zero, |
|
13325 +no RFC 1413 calls are ever made. |
|
13326 + |
|
13327 ++------------------------------------------------------------------+ |
|
13328 +|sender_unqualified_hosts|Use: main|Type: host list*|Default: unset| |
|
13329 ++------------------------------------------------------------------+ |
|
13330 + |
|
13331 +This option lists those hosts from which Exim is prepared to accept unqualified |
|
13332 +sender addresses. The addresses are made fully qualified by the addition of |
|
13333 +qualify_domain. This option also affects message header lines. Exim does not |
|
13334 +reject unqualified addresses in headers that contain sender addresses, but it |
|
13335 +qualifies them only if the message came from a host that matches |
|
13336 +sender_unqualified_hosts, or if the message was submitted locally (not using |
|
13337 +TCP/IP), and the -bnq option was not set. |
|
13338 + |
|
13339 ++-----------------------------------------------------------+ |
|
13340 +|smtp_accept_keepalive|Use: main|Type: boolean|Default: true| |
|
13341 ++-----------------------------------------------------------+ |
|
13342 + |
|
13343 +This option controls the setting of the SO_KEEPALIVE option on incoming TCP/IP |
|
13344 +socket connections. When set, it causes the kernel to probe idle connections |
|
13345 +periodically, by sending packets with "old" sequence numbers. The other end of |
|
13346 +the connection should send an acknowledgment if the connection is still okay or |
|
13347 +a reset if the connection has been aborted. The reason for doing this is that |
|
13348 +it has the beneficial effect of freeing up certain types of connection that can |
|
13349 +get stuck when the remote host is disconnected without tidying up the TCP/IP |
|
13350 +call properly. The keepalive mechanism takes several hours to detect |
|
13351 +unreachable hosts. |
|
13352 + |
|
13353 ++---------------------------------------------------+ |
|
13354 +|smtp_accept_max|Use: main|Type: integer|Default: 20| |
|
13355 ++---------------------------------------------------+ |
|
13356 + |
|
13357 +This option specifies the maximum number of simultaneous incoming SMTP calls |
|
13358 +that Exim will accept. It applies only to the listening daemon; there is no |
|
13359 +control (in Exim) when incoming SMTP is being handled by inetd. If the value is |
|
13360 +set to zero, no limit is applied. However, it is required to be non-zero if |
|
13361 +either smtp_accept_max_per_host or smtp_accept_queue is set. See also |
|
13362 +smtp_accept_reserve and smtp_load_reserve. |
|
13363 + |
|
13364 +A new SMTP connection is immediately rejected if the smtp_accept_max limit has |
|
13365 +been reached. If not, Exim first checks smtp_accept_max_per_host. If that limit |
|
13366 +has not been reached for the client host, smtp_accept_reserve and |
|
13367 +smtp_load_reserve are then checked before accepting the connection. |
|
13368 + |
|
13369 ++-----------------------------------------------------------+ |
|
13370 +|smtp_accept_max_nonmail|Use: main|Type: integer|Default: 10| |
|
13371 ++-----------------------------------------------------------+ |
|
13372 + |
|
13373 +Exim counts the number of "non-mail" commands in an SMTP session, and drops the |
|
13374 +connection if there are too many. This option defines "too many". The check |
|
13375 +catches some denial-of-service attacks, repeated failing AUTHs, or a mad client |
|
13376 +looping sending EHLO, for example. The check is applied only if the client host |
|
13377 +matches smtp_accept_max_nonmail_hosts. |
|
13378 + |
|
13379 +When a new message is expected, one occurrence of RSET is not counted. This |
|
13380 +allows a client to send one RSET between messages (this is not necessary, but |
|
13381 +some clients do it). Exim also allows one uncounted occurrence of HELO or EHLO, |
|
13382 +and one occurrence of STARTTLS between messages. After starting up a TLS |
|
13383 +session, another EHLO is expected, and so it too is not counted. The first |
|
13384 +occurrence of AUTH in a connection, or immediately following STARTTLS is not |
|
13385 +counted. Otherwise, all commands other than MAIL, RCPT, DATA, and QUIT are |
|
13386 +counted. |
|
13387 + |
|
13388 ++-------------------------------------------------------------------+ |
|
13389 +|smtp_accept_max_nonmail_hosts|Use: main|Type: host list*|Default: *| |
|
13390 ++-------------------------------------------------------------------+ |
|
13391 + |
|
13392 +You can control which hosts are subject to the smtp_accept_max_nonmail check by |
|
13393 +setting this option. The default value makes it apply to all hosts. By changing |
|
13394 +the value, you can exclude any badly-behaved hosts that you have to live with. |
|
13395 + |
|
13396 ++-------------------------------------------------------------------------+ |
|
13397 +|smtp_accept_max_per_ Â Â connection|Use: main|Type: integer|Default: 1000| |
|
13398 ++-------------------------------------------------------------------------+ |
|
13399 + |
|
13400 +The value of this option limits the number of MAIL commands that Exim is |
|
13401 +prepared to accept over a single SMTP connection, whether or not each command |
|
13402 +results in the transfer of a message. After the limit is reached, a 421 |
|
13403 +response is given to subsequent MAIL commands. This limit is a safety |
|
13404 +precaution against a client that goes mad (incidents of this type have been |
|
13405 +seen). |
|
13406 + |
|
13407 ++---------------------------------------------------------------+ |
|
13408 +|smtp_accept_max_per_host|Use: main|Type: string*|Default: unset| |
|
13409 ++---------------------------------------------------------------+ |
|
13410 + |
|
13411 +This option restricts the number of simultaneous IP connections from a single |
|
13412 +host (strictly, from a single IP address) to the Exim daemon. The option is |
|
13413 +expanded, to enable different limits to be applied to different hosts by |
|
13414 +reference to $sender_host_address. Once the limit is reached, additional |
|
13415 +connection attempts from the same host are rejected with error code 421. This |
|
13416 +is entirely independent of smtp_accept_reserve. The option's default value of |
|
13417 +zero imposes no limit. If this option is set greater than zero, it is required |
|
13418 +that smtp_accept_max be non-zero. |
|
13419 + |
|
13420 +Warning: When setting this option you should not use any expansion |
|
13421 +constructions that take an appreciable amount of time. The expansion and test |
|
13422 +happen in the main daemon loop, in order to reject additional connections |
|
13423 +without forking additional processes (otherwise a denial-of-service attack |
|
13424 +could cause a vast number or processes to be created). While the daemon is |
|
13425 +doing this processing, it cannot accept any other incoming connections. |
|
13426 + |
|
13427 ++----------------------------------------------------+ |
|
13428 +|smtp_accept_queue|Use: main|Type: integer|Default: 0| |
|
13429 ++----------------------------------------------------+ |
|
13430 + |
|
13431 +If the number of simultaneous incoming SMTP connections being handled via the |
|
13432 +listening daemon exceeds this value, messages received by SMTP are just placed |
|
13433 +on the queue; no delivery processes are started automatically. The count is |
|
13434 +fixed at the start of an SMTP connection. It cannot be updated in the |
|
13435 +subprocess that receives messages, and so the queueing or not queueing applies |
|
13436 +to all messages received in the same connection. |
|
13437 + |
|
13438 +A value of zero implies no limit, and clearly any non-zero value is useful only |
|
13439 +if it is less than the smtp_accept_max value (unless that is zero). See also |
|
13440 +queue_only, queue_only_load, queue_smtp_domains, and the various -odx command |
|
13441 +line options. |
|
13442 + |
|
13443 ++-------------------------------------------------------------------------+ |
|
13444 +|smtp_accept_queue_per_ Â Â connection|Use: main|Type: integer|Default: 10| |
|
13445 ++-------------------------------------------------------------------------+ |
|
13446 + |
|
13447 +This option limits the number of delivery processes that Exim starts |
|
13448 +automatically when receiving messages via SMTP, whether via the daemon or by |
|
13449 +the use of -bs or -bS. If the value of the option is greater than zero, and the |
|
13450 +number of messages received in a single SMTP session exceeds this number, |
|
13451 +subsequent messages are placed on the queue, but no delivery processes are |
|
13452 +started. This helps to limit the number of Exim processes when a server |
|
13453 +restarts after downtime and there is a lot of mail waiting for it on other |
|
13454 +systems. On large systems, the default should probably be increased, and on |
|
13455 +dial-in client systems it should probably be set to zero (that is, disabled). |
|
13456 + |
|
13457 ++------------------------------------------------------+ |
|
13458 +|smtp_accept_reserve|Use: main|Type: integer|Default: 0| |
|
13459 ++------------------------------------------------------+ |
|
13460 + |
|
13461 +When smtp_accept_max is set greater than zero, this option specifies a number |
|
13462 +of SMTP connections that are reserved for connections from the hosts that are |
|
13463 +specified in smtp_reserve_hosts. The value set in smtp_accept_max includes this |
|
13464 +reserve pool. The specified hosts are not restricted to this number of |
|
13465 +connections; the option specifies a minimum number of connection slots for |
|
13466 +them, not a maximum. It is a guarantee that this group of hosts can always get |
|
13467 +at least smtp_accept_reserve connections. However, the limit specified by |
|
13468 +smtp_accept_max_per_host is still applied to each individual host. |
|
13469 + |
|
13470 +For example, if smtp_accept_max is set to 50 and smtp_accept_reserve is set to |
|
13471 +5, once there are 45 active connections (from any hosts), new connections are |
|
13472 +accepted only from hosts listed in smtp_reserve_hosts, provided the other |
|
13473 +criteria for acceptance are met. |
|
13474 + |
|
13475 ++-----------------------------------------------------------+ |
|
13476 +|smtp_active_hostname|Use: main|Type: string*|Default: unset| |
|
13477 ++-----------------------------------------------------------+ |
|
13478 + |
|
13479 +This option is provided for multi-homed servers that want to masquerade as |
|
13480 +several different hosts. At the start of an incoming SMTP connection, its value |
|
13481 +is expanded and used instead of the value of $primary_hostname in SMTP |
|
13482 +responses. For example, it is used as domain name in the response to an |
|
13483 +incoming HELO or EHLO command. |
|
13484 + |
|
13485 +The active hostname is placed in the $smtp_active_hostname variable, which is |
|
13486 +saved with any messages that are received. It is therefore available for use in |
|
13487 +routers and transports when the message is later delivered. |
|
13488 + |
|
13489 +If this option is unset, or if its expansion is forced to fail, or if the |
|
13490 +expansion results in an empty string, the value of $primary_hostname is used. |
|
13491 +Other expansion failures cause a message to be written to the main and panic |
|
13492 +logs, and the SMTP command receives a temporary error. Typically, the value of |
|
13493 +smtp_active_hostname depends on the incoming interface address. For example: |
|
13494 + |
|
13495 +smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\ |
|
13496 + {cox.mydomain}{box.mydomain}} |
|
13497 + |
|
13498 +Although $smtp_active_hostname is primarily concerned with incoming messages, |
|
13499 +it is also used as the default for HELO commands in callout verification if |
|
13500 +there is no remote transport from which to obtain a helo_data value. |
|
13501 + |
|
13502 ++------------------------------------------------------+ |
|
13503 +|smtp_banner|Use: main|Type: string*|Default: see below| |
|
13504 ++------------------------------------------------------+ |
|
13505 + |
|
13506 +This string, which is expanded every time it is used, is output as the initial |
|
13507 +positive response to an SMTP connection. The default setting is: |
|
13508 + |
|
13509 +smtp_banner = $smtp_active_hostname ESMTP Exim \ |
|
13510 + $version_number $tod_full |
|
13511 + |
|
13512 +Failure to expand the string causes a panic error. If you want to create a |
|
13513 +multiline response to the initial SMTP connection, use "\n" in the string at |
|
13514 +appropriate points, but not at the end. Note that the 220 code is not included |
|
13515 +in this string. Exim adds it automatically (several times in the case of a |
|
13516 +multiline response). |
|
13517 + |
|
13518 ++------------------------------------------------------------+ |
|
13519 +|smtp_check_spool_space|Use: main|Type: boolean|Default: true| |
|
13520 ++------------------------------------------------------------+ |
|
13521 + |
|
13522 +When this option is set, if an incoming SMTP session encounters the SIZE option |
|
13523 +on a MAIL command, it checks that there is enough space in the spool |
|
13524 +directory's partition to accept a message of that size, while still leaving |
|
13525 +free the amount specified by check_spool_space (even if that value is zero). If |
|
13526 +there isn't enough space, a temporary error code is returned. |
|
13527 + |
|
13528 ++--------------------------------------------------------+ |
|
13529 +|smtp_connect_backlog|Use: main|Type: integer|Default: 20| |
|
13530 ++--------------------------------------------------------+ |
|
13531 + |
|
13532 +This option specifies a maximum number of waiting SMTP connections. Exim passes |
|
13533 +this value to the TCP/IP system when it sets up its listener. Once this number |
|
13534 +of connections are waiting for the daemon's attention, subsequent connection |
|
13535 +attempts are refused at the TCP/IP level. At least, that is what the manuals |
|
13536 +say; in some circumstances such connection attempts have been observed to time |
|
13537 +out instead. For large systems it is probably a good idea to increase the value |
|
13538 +(to 50, say). It also gives some protection against denial-of-service attacks |
|
13539 +by SYN flooding. |
|
13540 + |
|
13541 ++-------------------------------------------------------+ |
|
13542 +|smtp_enforce_sync|Use: main|Type: boolean|Default: true| |
|
13543 ++-------------------------------------------------------+ |
|
13544 + |
|
13545 +The SMTP protocol specification requires the client to wait for a response from |
|
13546 +the server at certain points in the dialogue. Without PIPELINING these |
|
13547 +synchronization points are after every command; with PIPELINING they are fewer, |
|
13548 +but they still exist. |
|
13549 + |
|
13550 +Some spamming sites send out a complete set of SMTP commands without waiting |
|
13551 +for any response. Exim protects against this by rejecting a message if the |
|
13552 +client has sent further input when it should not have. The error response "554 |
|
13553 +SMTP synchronization error" is sent, and the connection is dropped. Testing for |
|
13554 +this error cannot be perfect because of transmission delays (unexpected input |
|
13555 +may be on its way but not yet received when Exim checks). However, it does |
|
13556 +detect many instances. |
|
13557 + |
|
13558 +The check can be globally disabled by setting smtp_enforce_sync false. If you |
|
13559 +want to disable the check selectively (for example, only for certain hosts), |
|
13560 +you can do so by an appropriate use of a control modifier in an ACL (see |
|
13561 +section 40.21). See also pipelining_advertise_hosts. |
|
13562 + |
|
13563 ++--------------------------------------------------------+ |
|
13564 +|smtp_etrn_command|Use: main|Type: string*|Default: unset| |
|
13565 ++--------------------------------------------------------+ |
|
13566 + |
|
13567 +If this option is set, the given command is run whenever an SMTP ETRN command |
|
13568 +is received from a host that is permitted to issue such commands (see chapter |
|
13569 +40). The string is split up into separate arguments which are independently |
|
13570 +expanded. The expansion variable $domain is set to the argument of the ETRN |
|
13571 +command, and no syntax checking is done on it. For example: |
|
13572 + |
|
13573 +smtp_etrn_command = /etc/etrn_command $domain \ |
|
13574 + $sender_host_address |
|
13575 + |
|
13576 +A new process is created to run the command, but Exim does not wait for it to |
|
13577 +complete. Consequently, its status cannot be checked. If the command cannot be |
|
13578 +run, a line is written to the panic log, but the ETRN caller still receives a |
|
13579 +250 success response. Exim is normally running under its own uid when receiving |
|
13580 +SMTP, so it is not possible for it to change the uid before running the |
|
13581 +command. |
|
13582 + |
|
13583 ++---------------------------------------------------------+ |
|
13584 +|smtp_etrn_serialize|Use: main|Type: boolean|Default: true| |
|
13585 ++---------------------------------------------------------+ |
|
13586 + |
|
13587 +When this option is set, it prevents the simultaneous execution of more than |
|
13588 +one identical command as a result of ETRN in an SMTP connection. See section |
|
13589 +45.8 for details. |
|
13590 + |
|
13591 ++------------------------------------------------------------+ |
|
13592 +|smtp_load_reserve|Use: main|Type: fixed-point|Default: unset| |
|
13593 ++------------------------------------------------------------+ |
|
13594 + |
|
13595 +If the system load average ever gets higher than this, incoming SMTP calls are |
|
13596 +accepted only from those hosts that match an entry in smtp_reserve_hosts. If |
|
13597 +smtp_reserve_hosts is not set, no incoming SMTP calls are accepted when the |
|
13598 +load is over the limit. The option has no effect on ancient operating systems |
|
13599 +on which Exim cannot determine the load average. See also |
|
13600 +deliver_queue_load_max and queue_only_load. |
|
13601 + |
|
13602 ++----------------------------------------------------------+ |
|
13603 +|smtp_max_synprot_errors|Use: main|Type: integer|Default: 3| |
|
13604 ++----------------------------------------------------------+ |
|
13605 + |
|
13606 +Exim rejects SMTP commands that contain syntax or protocol errors. In |
|
13607 +particular, a syntactically invalid email address, as in this command: |
|
13608 + |
|
13609 +RCPT TO:<abc xyz@a.b.c> |
|
13610 + |
|
13611 +causes immediate rejection of the command, before any other tests are done. |
|
13612 +(The ACL cannot be run if there is no valid address to set up for it.) An |
|
13613 +example of a protocol error is receiving RCPT before MAIL. If there are too |
|
13614 +many syntax or protocol errors in one SMTP session, the connection is dropped. |
|
13615 +The limit is set by this option. |
|
13616 + |
|
13617 +When the PIPELINING extension to SMTP is in use, some protocol errors are |
|
13618 +"expected", for instance, a RCPT command after a rejected MAIL command. Exim |
|
13619 +assumes that PIPELINING will be used if it advertises it (see |
|
13620 +pipelining_advertise_hosts), and in this situation, "expected" errors do not |
|
13621 +count towards the limit. |
|
13622 + |
|
13623 ++------------------------------------------------------------+ |
|
13624 +|smtp_max_unknown_commands|Use: main|Type: integer|Default: 3| |
|
13625 ++------------------------------------------------------------+ |
|
13626 + |
|
13627 +If there are too many unrecognized commands in an incoming SMTP session, an |
|
13628 +Exim server drops the connection. This is a defence against some kinds of abuse |
|
13629 +that subvert web clients into making connections to SMTP ports; in these |
|
13630 +circumstances, a number of non-SMTP command lines are sent first. |
|
13631 + |
|
13632 ++--------------------------------------------------------------+ |
|
13633 +|smtp_ratelimit_hosts|Use: main|Type: host list*|Default: unset| |
|
13634 ++--------------------------------------------------------------+ |
|
13635 + |
|
13636 +Some sites find it helpful to be able to limit the rate at which certain hosts |
|
13637 +can send them messages, and the rate at which an individual message can specify |
|
13638 +recipients. |
|
13639 + |
|
13640 +Exim has two rate-limiting facilities. This section describes the older |
|
13641 +facility, which can limit rates within a single connection. The newer ratelimit |
|
13642 +ACL condition can limit rates across all connections. See section 40.36 for |
|
13643 +details of the newer facility. |
|
13644 + |
|
13645 +When a host matches smtp_ratelimit_hosts, the values of smtp_ratelimit_mail and |
|
13646 +smtp_ratelimit_rcpt are used to control the rate of acceptance of MAIL and RCPT |
|
13647 +commands in a single SMTP session, respectively. Each option, if set, must |
|
13648 +contain a set of four comma-separated values: |
|
13649 + |
|
13650 + * A threshold, before which there is no rate limiting. |
|
13651 + |
|
13652 + * An initial time delay. Unlike other times in Exim, numbers with decimal |
|
13653 + fractional parts are allowed here. |
|
13654 + |
|
13655 + * A factor by which to increase the delay each time. |
|
13656 + |
|
13657 + * A maximum value for the delay. This should normally be less than 5 minutes, |
|
13658 + because after that time, the client is liable to timeout the SMTP command. |
|
13659 + |
|
13660 +For example, these settings have been used successfully at the site which first |
|
13661 +suggested this feature, for controlling mail from their customers: |
|
13662 + |
|
13663 +smtp_ratelimit_mail = 2,0.5s,1.05,4m |
|
13664 +smtp_ratelimit_rcpt = 4,0.25s,1.015,4m |
|
13665 + |
|
13666 +The first setting specifies delays that are applied to MAIL commands after two |
|
13667 +have been received over a single connection. The initial delay is 0.5 seconds, |
|
13668 +increasing by a factor of 1.05 each time. The second setting applies delays to |
|
13669 +RCPT commands when more than four occur in a single message. |
|
13670 + |
|
13671 ++---------------------------------------------------------+ |
|
13672 +|smtp_ratelimit_mail|Use: main|Type: string|Default: unset| |
|
13673 ++---------------------------------------------------------+ |
|
13674 + |
|
13675 +See smtp_ratelimit_hosts above. |
|
13676 + |
|
13677 ++---------------------------------------------------------+ |
|
13678 +|smtp_ratelimit_rcpt|Use: main|Type: string|Default: unset| |
|
13679 ++---------------------------------------------------------+ |
|
13680 + |
|
13681 +See smtp_ratelimit_hosts above. |
|
13682 + |
|
13683 ++-----------------------------------------------------+ |
|
13684 +|smtp_receive_timeout|Use: main|Type: time|Default: 5m| |
|
13685 ++-----------------------------------------------------+ |
|
13686 + |
|
13687 +This sets a timeout value for SMTP reception. It applies to all forms of SMTP |
|
13688 +input, including batch SMTP. If a line of input (either an SMTP command or a |
|
13689 +data line) is not received within this time, the SMTP connection is dropped and |
|
13690 +the message is abandoned. A line is written to the log containing one of the |
|
13691 +following messages: |
|
13692 + |
|
13693 +SMTP command timeout on connection from... |
|
13694 +SMTP data timeout on connection from... |
|
13695 + |
|
13696 +The former means that Exim was expecting to read an SMTP command; the latter |
|
13697 +means that it was in the DATA phase, reading the contents of a message. |
|
13698 + |
|
13699 +The value set by this option can be overridden by the -os command-line option. |
|
13700 +A setting of zero time disables the timeout, but this should never be used for |
|
13701 +SMTP over TCP/IP. (It can be useful in some cases of local input using -bs or |
|
13702 +-bS.) For non-SMTP input, the reception timeout is controlled by |
|
13703 +receive_timeout and -or. |
|
13704 + |
|
13705 ++------------------------------------------------------------+ |
|
13706 +|smtp_reserve_hosts|Use: main|Type: host list*|Default: unset| |
|
13707 ++------------------------------------------------------------+ |
|
13708 + |
|
13709 +This option defines hosts for which SMTP connections are reserved; see |
|
13710 +smtp_accept_reserve and smtp_load_reserve above. |
|
13711 + |
|
13712 ++----------------------------------------------------------------+ |
|
13713 +|smtp_return_error_details|Use: main|Type: boolean|Default: false| |
|
13714 ++----------------------------------------------------------------+ |
|
13715 + |
|
13716 +In the default state, Exim uses bland messages such as "Administrative |
|
13717 +prohibition" when it rejects SMTP commands for policy reasons. Many sysadmins |
|
13718 +like this because it gives away little information to spammers. However, some |
|
13719 +other sysadmins who are applying strict checking policies want to give out much |
|
13720 +fuller information about failures. Setting smtp_return_error_details true |
|
13721 +causes Exim to be more forthcoming. For example, instead of "Administrative |
|
13722 +prohibition", it might give: |
|
13723 + |
|
13724 +550-Rejected after DATA: '>' missing at end of address: |
|
13725 +550 failing address in "From" header is: <user@dom.ain |
|
13726 + |
|
13727 ++-------------------------------------------------------+ |
|
13728 +|spamd_address|Use: main|Type: string|Default: see below| |
|
13729 ++-------------------------------------------------------+ |
|
13730 + |
|
13731 +This option is available when Exim is compiled with the content-scanning |
|
13732 +extension. It specifies how Exim connects to SpamAssassin's spamd daemon. The |
|
13733 +default value is |
|
13734 + |
|
13735 +127.0.0.1 783 |
|
13736 + |
|
13737 +See section 41.2 for more details. |
|
13738 + |
|
13739 ++------------------------------------------------------------+ |
|
13740 +|split_spool_directory|Use: main|Type: boolean|Default: false| |
|
13741 ++------------------------------------------------------------+ |
|
13742 + |
|
13743 +If this option is set, it causes Exim to split its input directory into 62 |
|
13744 +subdirectories, each with a single alphanumeric character as its name. The |
|
13745 +sixth character of the message id is used to allocate messages to |
|
13746 +subdirectories; this is the least significant base-62 digit of the time of |
|
13747 +arrival of the message. |
|
13748 + |
|
13749 +Splitting up the spool in this way may provide better performance on systems |
|
13750 +where there are long mail queues, by reducing the number of files in any one |
|
13751 +directory. The msglog directory is also split up in a similar way to the input |
|
13752 +directory; however, if preserve_message_logs is set, all old msglog files are |
|
13753 +still placed in the single directory msglog.OLD. |
|
13754 + |
|
13755 +It is not necessary to take any special action for existing messages when |
|
13756 +changing split_spool_directory. Exim notices messages that are in the "wrong" |
|
13757 +place, and continues to process them. If the option is turned off after a |
|
13758 +period of being on, the subdirectories will eventually empty and be |
|
13759 +automatically deleted. |
|
13760 + |
|
13761 +When split_spool_directory is set, the behaviour of queue runner processes |
|
13762 +changes. Instead of creating a list of all messages in the queue, and then |
|
13763 +trying to deliver each one in turn, it constructs a list of those in one |
|
13764 +sub-directory and tries to deliver them, before moving on to the next |
|
13765 +sub-directory. The sub-directories are processed in a random order. This |
|
13766 +spreads out the scanning of the input directories, and uses less memory. It is |
|
13767 +particularly beneficial when there are lots of messages on the queue. However, |
|
13768 +if queue_run_in_order is set, none of this new processing happens. The entire |
|
13769 +queue has to be scanned and sorted before any deliveries can start. |
|
13770 + |
|
13771 ++--------------------------------------------------------------------+ |
|
13772 +|spool_directory|Use: main|Type: string*|Default: set at compile time| |
|
13773 ++--------------------------------------------------------------------+ |
|
13774 + |
|
13775 +This defines the directory in which Exim keeps its spool, that is, the messages |
|
13776 +it is waiting to deliver. The default value is taken from the compile-time |
|
13777 +configuration setting, if there is one. If not, this option must be set. The |
|
13778 +string is expanded, so it can contain, for example, a reference to |
|
13779 +$primary_hostname. |
|
13780 + |
|
13781 +If the spool directory name is fixed on your installation, it is recommended |
|
13782 +that you set it at build time rather than from this option, particularly if the |
|
13783 +log files are being written to the spool directory (see log_file_path). |
|
13784 +Otherwise log files cannot be used for errors that are detected early on, such |
|
13785 +as failures in the configuration file. |
|
13786 + |
|
13787 +By using this option to override the compiled-in path, it is possible to run |
|
13788 +tests of Exim without using the standard spool. |
|
13789 + |
|
13790 ++----------------------------------------------------+ |
|
13791 +|sqlite_lock_timeout|Use: main|Type: time|Default: 5s| |
|
13792 ++----------------------------------------------------+ |
|
13793 + |
|
13794 +This option controls the timeout that the sqlite lookup uses when trying to |
|
13795 +access an SQLite database. See section 9.25 for more details. |
|
13796 + |
|
13797 ++------------------------------------------------------+ |
|
13798 +|strict_acl_vars|Use: main|Type: boolean|Default: false| |
|
13799 ++------------------------------------------------------+ |
|
13800 + |
|
13801 +This option controls what happens if a syntactically valid but undefined ACL |
|
13802 +variable is referenced. If it is false (the default), an empty string is |
|
13803 +substituted; if it is true, an error is generated. See section 40.18 for |
|
13804 +details of ACL variables. |
|
13805 + |
|
13806 ++------------------------------------------------------------------+ |
|
13807 +|strip_excess_angle_brackets|Use: main|Type: boolean|Default: false| |
|
13808 ++------------------------------------------------------------------+ |
|
13809 + |
|
13810 +If this option is set, redundant pairs of angle brackets round "route-addr" |
|
13811 +items in addresses are stripped. For example, <<xxx@a.b.c.d>> is treated as |
|
13812 +<xxx@a.b.c.d>. If this is in the envelope and the message is passed on to |
|
13813 +another MTA, the excess angle brackets are not passed on. If this option is not |
|
13814 +set, multiple pairs of angle brackets cause a syntax error. |
|
13815 + |
|
13816 ++---------------------------------------------------------+ |
|
13817 +|strip_trailing_dot|Use: main|Type: boolean|Default: false| |
|
13818 ++---------------------------------------------------------+ |
|
13819 + |
|
13820 +If this option is set, a trailing dot at the end of a domain in an address is |
|
13821 +ignored. If this is in the envelope and the message is passed on to another |
|
13822 +MTA, the dot is not passed on. If this option is not set, a dot at the end of a |
|
13823 +domain causes a syntax error. However, addresses in header lines are checked |
|
13824 +only when an ACL requests header syntax checking. |
|
13825 + |
|
13826 ++--------------------------------------------------------+ |
|
13827 +|syslog_duplication|Use: main|Type: boolean|Default: true| |
|
13828 ++--------------------------------------------------------+ |
|
13829 + |
|
13830 +When Exim is logging to syslog, it writes the log lines for its three separate |
|
13831 +logs at different syslog priorities so that they can in principle be separated |
|
13832 +on the logging hosts. Some installations do not require this separation, and in |
|
13833 +those cases, the duplication of certain log lines is a nuisance. If |
|
13834 +syslog_duplication is set false, only one copy of any particular log line is |
|
13835 +written to syslog. For lines that normally go to both the main log and the |
|
13836 +reject log, the reject log version (possibly containing message header lines) |
|
13837 +is written, at LOG_NOTICE priority. Lines that normally go to both the main and |
|
13838 +the panic log are written at the LOG_ALERT priority. |
|
13839 + |
|
13840 ++-----------------------------------------------------+ |
|
13841 +|syslog_facility|Use: main|Type: string|Default: unset| |
|
13842 ++-----------------------------------------------------+ |
|
13843 + |
|
13844 +This option sets the syslog "facility" name, used when Exim is logging to |
|
13845 +syslog. The value must be one of the strings "mail", "user", "news", "uucp", |
|
13846 +"daemon", or "localx" where x is a digit between 0 and 7. If this option is |
|
13847 +unset, "mail" is used. See chapter 49 for details of Exim's logging. |
|
13848 + |
|
13849 ++---------------------------------------------------------+ |
|
13850 +|syslog_processname|Use: main|Type: string|Default: "exim"| |
|
13851 ++---------------------------------------------------------+ |
|
13852 + |
|
13853 +This option sets the syslog "ident" name, used when Exim is logging to syslog. |
|
13854 +The value must be no longer than 32 characters. See chapter 49 for details of |
|
13855 +Exim's logging. |
|
13856 + |
|
13857 ++------------------------------------------------------+ |
|
13858 +|syslog_timestamp|Use: main|Type: boolean|Default: true| |
|
13859 ++------------------------------------------------------+ |
|
13860 + |
|
13861 +If syslog_timestamp is set false, the timestamps on Exim's log lines are |
|
13862 +omitted when these lines are sent to syslog. See chapter 49 for details of |
|
13863 +Exim's logging. |
|
13864 + |
|
13865 ++----------------------------------------------------+ |
|
13866 +|system_filter|Use: main|Type: string*|Default: unset| |
|
13867 ++----------------------------------------------------+ |
|
13868 + |
|
13869 +This option specifies an Exim filter file that is applied to all messages at |
|
13870 +the start of each delivery attempt, before any routing is done. System filters |
|
13871 +must be Exim filters; they cannot be Sieve filters. If the system filter |
|
13872 +generates any deliveries to files or pipes, or any new mail messages, the |
|
13873 +appropriate system_filter_..._transport option(s) must be set, to define which |
|
13874 +transports are to be used. Details of this facility are given in chapter 43. |
|
13875 + |
|
13876 ++------------------------------------------------------------------------+ |
|
13877 +|system_filter_directory_transport|Use: main|Type: string*|Default: unset| |
|
13878 ++------------------------------------------------------------------------+ |
|
13879 + |
|
13880 +This sets the name of the transport driver that is to be used when the save |
|
13881 +command in a system message filter specifies a path ending in "/", implying |
|
13882 +delivery of each message into a separate file in some directory. During the |
|
13883 +delivery, the variable $address_file contains the path name. |
|
13884 + |
|
13885 ++-------------------------------------------------------------------+ |
|
13886 +|system_filter_file_transport|Use: main|Type: string*|Default: unset| |
|
13887 ++-------------------------------------------------------------------+ |
|
13888 + |
|
13889 +This sets the name of the transport driver that is to be used when the save |
|
13890 +command in a system message filter specifies a path not ending in "/". During |
|
13891 +the delivery, the variable $address_file contains the path name. |
|
13892 + |
|
13893 ++---------------------------------------------------------+ |
|
13894 +|system_filter_group|Use: main|Type: string|Default: unset| |
|
13895 ++---------------------------------------------------------+ |
|
13896 + |
|
13897 +This option is used only when system_filter_user is also set. It sets the gid |
|
13898 +under which the system filter is run, overriding any gid that is associated |
|
13899 +with the user. The value may be numerical or symbolic. |
|
13900 + |
|
13901 ++-------------------------------------------------------------------+ |
|
13902 +|system_filter_pipe_transport|Use: main|Type: string*|Default: unset| |
|
13903 ++-------------------------------------------------------------------+ |
|
13904 + |
|
13905 +This specifies the transport driver that is to be used when a pipe command is |
|
13906 +used in a system filter. During the delivery, the variable $address_pipe |
|
13907 +contains the pipe command. |
|
13908 + |
|
13909 ++--------------------------------------------------------------------+ |
|
13910 +|system_filter_reply_transport|Use: main|Type: string*|Default: unset| |
|
13911 ++--------------------------------------------------------------------+ |
|
13912 + |
|
13913 +This specifies the transport driver that is to be used when a mail command is |
|
13914 +used in a system filter. |
|
13915 + |
|
13916 ++--------------------------------------------------------+ |
|
13917 +|system_filter_user|Use: main|Type: string|Default: unset| |
|
13918 ++--------------------------------------------------------+ |
|
13919 + |
|
13920 +If this option is set to root, the system filter is run in the main Exim |
|
13921 +delivery process, as root. Otherwise, the system filter runs in a separate |
|
13922 +process, as the given user, defaulting to the Exim run-time user. Unless the |
|
13923 +string consists entirely of digits, it is looked up in the password data. |
|
13924 +Failure to find the named user causes a configuration error. The gid is either |
|
13925 +taken from the password data, or specified by system_filter_group. When the uid |
|
13926 +is specified numerically, system_filter_group is required to be set. |
|
13927 + |
|
13928 +If the system filter generates any pipe, file, or reply deliveries, the uid |
|
13929 +under which the filter is run is used when transporting them, unless a |
|
13930 +transport option overrides. |
|
13931 + |
|
13932 ++-------------------------------------------------+ |
|
13933 +|tcp_nodelay|Use: main|Type: boolean|Default: true| |
|
13934 ++-------------------------------------------------+ |
|
13935 + |
|
13936 +If this option is set false, it stops the Exim daemon setting the TCP_NODELAY |
|
13937 +option on its listening sockets. Setting TCP_NODELAY turns off the "Nagle |
|
13938 +algorithm", which is a way of improving network performance in interactive |
|
13939 +(character-by-character) situations. Turning it off should improve Exim's |
|
13940 +performance a bit, so that is what happens by default. However, it appears that |
|
13941 +some broken clients cannot cope, and time out. Hence this option. It affects |
|
13942 +only those sockets that are set up for listening by the daemon. Sockets created |
|
13943 +by the smtp transport for delivering mail always set TCP_NODELAY. |
|
13944 + |
|
13945 ++-----------------------------------------------------+ |
|
13946 +|timeout_frozen_after|Use: main|Type: time|Default: 0s| |
|
13947 ++-----------------------------------------------------+ |
|
13948 + |
|
13949 +If timeout_frozen_after is set to a time greater than zero, a frozen message of |
|
13950 +any kind that has been on the queue for longer than the given time is |
|
13951 +automatically cancelled at the next queue run. If the frozen message is a |
|
13952 +bounce message, it is just discarded; otherwise, a bounce is sent to the |
|
13953 +sender, in a similar manner to cancellation by the -Mg command line option. If |
|
13954 +you want to timeout frozen bounce messages earlier than other kinds of frozen |
|
13955 +message, see ignore_bounce_errors_after. |
|
13956 + |
|
13957 +Note: the default value of zero means no timeouts; with this setting, frozen |
|
13958 +messages remain on the queue forever (except for any frozen bounce messages |
|
13959 +that are released by ignore_bounce_errors_after). |
|
13960 + |
|
13961 ++----------------------------------------------+ |
|
13962 +|timezone|Use: main|Type: string|Default: unset| |
|
13963 ++----------------------------------------------+ |
|
13964 + |
|
13965 +The value of timezone is used to set the environment variable TZ while running |
|
13966 +Exim (if it is different on entry). This ensures that all timestamps created by |
|
13967 +Exim are in the required timezone. If you want all your timestamps to be in UTC |
|
13968 +(aka GMT) you should set |
|
13969 + |
|
13970 +timezone = UTC |
|
13971 + |
|
13972 +The default value is taken from TIMEZONE_DEFAULT in Local/Makefile, or, if that |
|
13973 +is not set, from the value of the TZ environment variable when Exim is built. |
|
13974 +If timezone is set to the empty string, either at build or run time, any |
|
13975 +existing TZ variable is removed from the environment when Exim runs. This is |
|
13976 +appropriate behaviour for obtaining wall-clock time on some, but unfortunately |
|
13977 +not all, operating systems. |
|
13978 + |
|
13979 ++-------------------------------------------------------------+ |
|
13980 +|tls_advertise_hosts|Use: main|Type: host list*|Default: unset| |
|
13981 ++-------------------------------------------------------------+ |
|
13982 + |
|
13983 +When Exim is built with support for TLS encrypted connections, the availability |
|
13984 +of the STARTTLS command to set up an encrypted session is advertised in |
|
13985 +response to EHLO only to those client hosts that match this option. See chapter |
|
13986 +39 for details of Exim's support for TLS. |
|
13987 + |
|
13988 ++------------------------------------------------------+ |
|
13989 +|tls_certificate|Use: main|Type: string*|Default: unset| |
|
13990 ++------------------------------------------------------+ |
|
13991 + |
|
13992 +The value of this option is expanded, and must then be the absolute path to a |
|
13993 +file which contains the server's certificates. The server's private key is also |
|
13994 +assumed to be in this file if tls_privatekey is unset. See chapter 39 for |
|
13995 +further details. |
|
13996 + |
|
13997 +Note: The certificates defined by this option are used only when Exim is |
|
13998 +receiving incoming messages as a server. If you want to supply certificates for |
|
13999 +use when sending messages as a client, you must set the tls_certificate option |
|
14000 +in the relevant smtp transport. |
|
14001 + |
|
14002 ++----------------------------------------------+ |
|
14003 +|tls_crl|Use: main|Type: string*|Default: unset| |
|
14004 ++----------------------------------------------+ |
|
14005 + |
|
14006 +This option specifies a certificate revocation list. The expanded value must be |
|
14007 +the name of a file that contains a CRL in PEM format. |
|
14008 + |
|
14009 ++--------------------------------------------------+ |
|
14010 +|tls_dhparam|Use: main|Type: string*|Default: unset| |
|
14011 ++--------------------------------------------------+ |
|
14012 + |
|
14013 +The value of this option is expanded, and must then be the absolute path to a |
|
14014 +file which contains the server's DH parameter values. This is used only for |
|
14015 +OpenSSL. When Exim is linked with GnuTLS, this option is ignored. See section |
|
14016 +39.2 for further details. |
|
14017 + |
|
14018 ++---------------------------------------------------------------+ |
|
14019 +|tls_on_connect_ports|Use: main|Type: string list|Default: unset| |
|
14020 ++---------------------------------------------------------------+ |
|
14021 + |
|
14022 +This option specifies a list of incoming SSMTP (aka SMTPS) ports that should |
|
14023 +operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately |
|
14024 +set up without waiting for the client to issue a STARTTLS command. For further |
|
14025 +details, see section 13.4. |
|
14026 + |
|
14027 ++-----------------------------------------------------+ |
|
14028 +|tls_privatekey|Use: main|Type: string*|Default: unset| |
|
14029 ++-----------------------------------------------------+ |
|
14030 + |
|
14031 +The value of this option is expanded, and must then be the absolute path to a |
|
14032 +file which contains the server's private key. If this option is unset, or if |
|
14033 +the expansion is forced to fail, or the result is an empty string, the private |
|
14034 +key is assumed to be in the same file as the server's certificates. See chapter |
|
14035 +39 for further details. |
|
14036 + |
|
14037 ++---------------------------------------------------------+ |
|
14038 +|tls_remember_esmtp|Use: main|Type: boolean|Default: false| |
|
14039 ++---------------------------------------------------------+ |
|
14040 + |
|
14041 +If this option is set true, Exim violates the RFCs by remembering that it is in |
|
14042 +"esmtp" state after successfully negotiating a TLS session. This provides |
|
14043 +support for broken clients that fail to send a new EHLO after starting a TLS |
|
14044 +session. |
|
14045 + |
|
14046 ++----------------------------------------------------------+ |
|
14047 +|tls_require_ciphers|Use: main|Type: string*|Default: unset| |
|
14048 ++----------------------------------------------------------+ |
|
14049 + |
|
14050 +This option controls which ciphers can be used for incoming TLS connections. |
|
14051 +The smtp transport has an option of the same name for controlling outgoing |
|
14052 +connections. This option is expanded for each connection, so can be varied for |
|
14053 +different clients if required. The value of this option must be a list of |
|
14054 +permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control |
|
14055 +in somewhat different ways. If GnuTLS is being used, the client controls the |
|
14056 +preference order of the available ciphers. Details are given in sections 39.4 |
|
14057 +and 39.5. |
|
14058 + |
|
14059 ++--------------------------------------------------------------+ |
|
14060 +|tls_try_verify_hosts|Use: main|Type: host list*|Default: unset| |
|
14061 ++--------------------------------------------------------------+ |
|
14062 + |
|
14063 +See tls_verify_hosts below. |
|
14064 + |
|
14065 ++--------------------------------------------------------------+ |
|
14066 +|tls_verify_certificates|Use: main|Type: string*|Default: unset| |
|
14067 ++--------------------------------------------------------------+ |
|
14068 + |
|
14069 +The value of this option is expanded, and must then be the absolute path to a |
|
14070 +file containing permitted certificates for clients that match tls_verify_hosts |
|
14071 +or tls_try_verify_hosts. Alternatively, if you are using OpenSSL, you can set |
|
14072 +tls_verify_certificates to the name of a directory containing certificate |
|
14073 +files. This does not work with GnuTLS; the option must be set to the name of a |
|
14074 +single file if you are using GnuTLS. |
|
14075 + |
|
14076 +These certificates should be for the certificate authorities trusted, rather |
|
14077 +than the public cert of individual clients. With both OpenSSL and GnuTLS, if |
|
14078 +the value is a file then the certificates are sent by Exim as a server to |
|
14079 +connecting clients, defining the list of accepted certificate authorities. Thus |
|
14080 +the values defined should be considered public data. To avoid this, use OpenSSL |
|
14081 +with a directory. |
|
14082 + |
|
14083 ++----------------------------------------------------------+ |
|
14084 +|tls_verify_hosts|Use: main|Type: host list*|Default: unset| |
|
14085 ++----------------------------------------------------------+ |
|
14086 + |
|
14087 +This option, along with tls_try_verify_hosts, controls the checking of |
|
14088 +certificates from clients. The expected certificates are defined by |
|
14089 +tls_verify_certificates, which must be set. A configuration error occurs if |
|
14090 +either tls_verify_hosts or tls_try_verify_hosts is set and |
|
14091 +tls_verify_certificates is not set. |
|
14092 + |
|
14093 +Any client that matches tls_verify_hosts is constrained by |
|
14094 +tls_verify_certificates. When the client initiates a TLS session, it must |
|
14095 +present one of the listed certificates. If it does not, the connection is |
|
14096 +aborted. Warning: Including a host in tls_verify_hosts does not require the |
|
14097 +host to use TLS. It can still send SMTP commands through unencrypted |
|
14098 +connections. Forcing a client to use TLS has to be done separately using an ACL |
|
14099 +to reject inappropriate commands when the connection is not encrypted. |
|
14100 + |
|
14101 +A weaker form of checking is provided by tls_try_verify_hosts. If a client |
|
14102 +matches this option (but not tls_verify_hosts), Exim requests a certificate and |
|
14103 +checks it against tls_verify_certificates, but does not abort the connection if |
|
14104 +there is no certificate or if it does not match. This state can be detected in |
|
14105 +an ACL, which makes it possible to implement policies such as "accept for relay |
|
14106 +only if a verified certificate has been received, but accept for local delivery |
|
14107 +if encrypted, even without a verified certificate". |
|
14108 + |
|
14109 +Client hosts that match neither of these lists are not asked to present |
|
14110 +certificates. |
|
14111 + |
|
14112 ++----------------------------------------------------------+ |
|
14113 +|trusted_groups|Use: main|Type: string list*|Default: unset| |
|
14114 ++----------------------------------------------------------+ |
|
14115 + |
|
14116 +This option is expanded just once, at the start of Exim's processing. If this |
|
14117 +option is set, any process that is running in one of the listed groups, or |
|
14118 +which has one of them as a supplementary group, is trusted. The groups can be |
|
14119 +specified numerically or by name. See section 5.2 for details of what trusted |
|
14120 +callers are permitted to do. If neither trusted_groups nor trusted_users is |
|
14121 +set, only root and the Exim user are trusted. |
|
14122 + |
|
14123 ++---------------------------------------------------------+ |
|
14124 +|trusted_users|Use: main|Type: string list*|Default: unset| |
|
14125 ++---------------------------------------------------------+ |
|
14126 + |
|
14127 +This option is expanded just once, at the start of Exim's processing. If this |
|
14128 +option is set, any process that is running as one of the listed users is |
|
14129 +trusted. The users can be specified numerically or by name. See section 5.2 for |
|
14130 +details of what trusted callers are permitted to do. If neither trusted_groups |
|
14131 +nor trusted_users is set, only root and the Exim user are trusted. |
|
14132 + |
|
14133 ++----------------------------------------------------+ |
|
14134 +|unknown_login|Use: main|Type: string*|Default: unset| |
|
14135 ++----------------------------------------------------+ |
|
14136 + |
|
14137 +This is a specialized feature for use in unusual configurations. By default, if |
|
14138 +the uid of the caller of Exim cannot be looked up using getpwuid(), Exim gives |
|
14139 +up. The unknown_login option can be used to set a login name to be used in this |
|
14140 +circumstance. It is expanded, so values like user$caller_uid can be set. When |
|
14141 +unknown_login is used, the value of unknown_username is used for the user's |
|
14142 +real name (gecos field), unless this has been set by the -F option. |
|
14143 + |
|
14144 ++------------------------------------------------------+ |
|
14145 +|unknown_username|Use: main|Type: string|Default: unset| |
|
14146 ++------------------------------------------------------+ |
|
14147 + |
|
14148 +See unknown_login. |
|
14149 + |
|
14150 ++-----------------------------------------------------------------+ |
|
14151 +|untrusted_set_sender|Use: main|Type: address list*|Default: unset| |
|
14152 ++-----------------------------------------------------------------+ |
|
14153 + |
|
14154 +When an untrusted user submits a message to Exim using the standard input, Exim |
|
14155 +normally creates an envelope sender address from the user's login and the |
|
14156 +default qualification domain. Data from the -f option (for setting envelope |
|
14157 +senders on non-SMTP messages) or the SMTP MAIL command (if -bs or -bS is used) |
|
14158 +is ignored. |
|
14159 + |
|
14160 +However, untrusted users are permitted to set an empty envelope sender address, |
|
14161 +to declare that a message should never generate any bounces. For example: |
|
14162 + |
|
14163 +exim -f '<>' user@domain.example |
|
14164 + |
|
14165 +The untrusted_set_sender option allows you to permit untrusted users to set |
|
14166 +other envelope sender addresses in a controlled way. When it is set, untrusted |
|
14167 +users are allowed to set envelope sender addresses that match any of the |
|
14168 +patterns in the list. Like all address lists, the string is expanded. The |
|
14169 +identity of the user is in $sender_ident, so you can, for example, restrict |
|
14170 +users to setting senders that start with their login ids followed by a hyphen |
|
14171 +by a setting like this: |
|
14172 + |
|
14173 +untrusted_set_sender = ^$sender_ident- |
|
14174 + |
|
14175 +If you want to allow untrusted users to set envelope sender addresses without |
|
14176 +restriction, you can use |
|
14177 + |
|
14178 +untrusted_set_sender = * |
|
14179 + |
|
14180 +The untrusted_set_sender option applies to all forms of local input, but only |
|
14181 +to the setting of the envelope sender. It does not permit untrusted users to |
|
14182 +use the other options which trusted user can use to override message |
|
14183 +parameters. Furthermore, it does not stop Exim from removing an existing |
|
14184 +Sender: header in the message, or from adding a Sender: header if necessary. |
|
14185 +See local_sender_retain and local_from_check for ways of overriding these |
|
14186 +actions. The handling of the Sender: header is also described in section 44.16. |
|
14187 + |
|
14188 +The log line for a message's arrival shows the envelope sender following "<=". |
|
14189 +For local messages, the user's login always follows, after "U=". In -bp |
|
14190 +displays, and in the Exim monitor, if an untrusted user sets an envelope sender |
|
14191 +address, the user's login is shown in parentheses after the sender address. |
|
14192 + |
|
14193 ++-----------------------------------------------------------+ |
|
14194 +|uucp_from_pattern|Use: main|Type: string|Default: see below| |
|
14195 ++-----------------------------------------------------------+ |
|
14196 + |
|
14197 +Some applications that pass messages to an MTA via a command line interface use |
|
14198 +an initial line starting with "From " to pass the envelope sender. In |
|
14199 +particular, this is used by UUCP software. Exim recognizes such a line by means |
|
14200 +of a regular expression that is set in uucp_from_pattern. When the pattern |
|
14201 +matches, the sender address is constructed by expanding the contents of |
|
14202 +uucp_from_sender, provided that the caller of Exim is a trusted user. The |
|
14203 +default pattern recognizes lines in the following two forms: |
|
14204 + |
|
14205 +From ph10 Fri Jan 5 12:35 GMT 1996 |
|
14206 +From ph10 Fri, 7 Jan 97 14:00:00 GMT |
|
14207 + |
|
14208 +The pattern can be seen by running |
|
14209 + |
|
14210 +exim -bP uucp_from_pattern |
|
14211 + |
|
14212 +It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit |
|
14213 +year in the second case. The first word after "From " is matched in the |
|
14214 +regular expression by a parenthesized subpattern. The default value for |
|
14215 +uucp_from_sender is "$1", which therefore just uses this first word ("ph10" in |
|
14216 +the example above) as the message's sender. See also ignore_fromline_hosts. |
|
14217 + |
|
14218 ++------------------------------------------------------+ |
|
14219 +|uucp_from_sender|Use: main|Type: string*|Default: "$1"| |
|
14220 ++------------------------------------------------------+ |
|
14221 + |
|
14222 +See uucp_from_pattern above. |
|
14223 + |
|
14224 ++-------------------------------------------------------+ |
|
14225 +|warn_message_file|Use: main|Type: string|Default: unset| |
|
14226 ++-------------------------------------------------------+ |
|
14227 + |
|
14228 +This option defines a template file containing paragraphs of text to be used |
|
14229 +for constructing the warning message which is sent by Exim when a message has |
|
14230 +been on the queue for a specified amount of time, as specified by delay_warning |
|
14231 +. Details of the file's contents are given in chapter 46. See also |
|
14232 +bounce_message_file. |
|
14233 + |
|
14234 ++-----------------------------------------------------+ |
|
14235 +|write_rejectlog|Use: main|Type: boolean|Default: true| |
|
14236 ++-----------------------------------------------------+ |
|
14237 + |
|
14238 +If this option is set false, Exim no longer writes anything to the reject log. |
|
14239 +See chapter 49 for details of what Exim writes to its logs. |
|
14240 + |
|
14241 +15. Generic options for routers |
|
14242 + |
|
14243 +This chapter describes the generic options that apply to all routers. Those |
|
14244 +that are preconditions are marked with ** in the "use" field. |
|
14245 + |
|
14246 +For a general description of how a router operates, see sections 3.10 and 3.12. |
|
14247 +The latter specifies the order in which the preconditions are tested. The order |
|
14248 +of expansion of the options that provide data for a transport is: errors_to, |
|
14249 +headers_add, headers_remove, transport. |
|
14250 + |
|
14251 ++------------------------------------------------------+ |
|
14252 +|address_data|Use: routers|Type: string*|Default: unset| |
|
14253 ++------------------------------------------------------+ |
|
14254 + |
|
14255 +The string is expanded just before the router is run, that is, after all the |
|
14256 +precondition tests have succeeded. If the expansion is forced to fail, the |
|
14257 +router declines, the value of address_data remains unchanged, and the more |
|
14258 +option controls what happens next. Other expansion failures cause delivery of |
|
14259 +the address to be deferred. |
|
14260 + |
|
14261 +When the expansion succeeds, the value is retained with the address, and can be |
|
14262 +accessed using the variable $address_data in the current router, subsequent |
|
14263 +routers, and the eventual transport. |
|
14264 + |
|
14265 +Warning: If the current or any subsequent router is a redirect router that runs |
|
14266 +a user's filter file, the contents of $address_data are accessible in the |
|
14267 +filter. This is not normally a problem, because such data is usually either not |
|
14268 +confidential or it "belongs" to the current user, but if you do put |
|
14269 +confidential data into $address_data you need to remember this point. |
|
14270 + |
|
14271 +Even if the router declines or passes, the value of $address_data remains with |
|
14272 +the address, though it can be changed by another address_data setting on a |
|
14273 +subsequent router. If a router generates child addresses, the value of |
|
14274 +$address_data propagates to them. This also applies to the special kind of |
|
14275 +"child" that is generated by a router with the unseen option. |
|
14276 + |
|
14277 +The idea of address_data is that you can use it to look up a lot of data for |
|
14278 +the address once, and then pick out parts of the data later. For example, you |
|
14279 +could use a single LDAP lookup to return a string of the form |
|
14280 + |
|
14281 +uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward |
|
14282 + |
|
14283 +In the transport you could pick out the mailbox by a setting such as |
|
14284 + |
|
14285 +file = ${extract{mailbox}{$address_data}} |
|
14286 + |
|
14287 +This makes the configuration file less messy, and also reduces the number of |
|
14288 +lookups (though Exim does cache lookups). |
|
14289 + |
|
14290 +The address_data facility is also useful as a means of passing information from |
|
14291 +one router to another, and from a router to a transport. In addition, if |
|
14292 +$address_data is set by a router when verifying a recipient address from an |
|
14293 +ACL, it remains available for use in the rest of the ACL statement. After |
|
14294 +verifying a sender, the value is transferred to $sender_address_data. |
|
14295 + |
|
14296 ++-------------------------------------------------------+ |
|
14297 +|address_test|Use: routers**|Type: boolean|Default: true| |
|
14298 ++-------------------------------------------------------+ |
|
14299 + |
|
14300 +If this option is set false, the router is skipped when routing is being tested |
|
14301 +by means of the -bt command line option. This can be a convenience when your |
|
14302 +first router sends messages to an external scanner, because it saves you having |
|
14303 +to set the "already scanned" indicator when testing real address routing. |
|
14304 + |
|
14305 ++--------------------------------------------------------------+ |
|
14306 +|cannot_route_message|Use: routers|Type: string*|Default: unset| |
|
14307 ++--------------------------------------------------------------+ |
|
14308 + |
|
14309 +This option specifies a text message that is used when an address cannot be |
|
14310 +routed because Exim has run out of routers. The default message is "Unrouteable |
|
14311 +address". This option is useful only on routers that have more set false, or on |
|
14312 +the very last router in a configuration, because the value that is used is |
|
14313 +taken from the last router that is considered. This includes a router that is |
|
14314 +skipped because its preconditions are not met, as well as a router that |
|
14315 +declines. For example, using the default configuration, you could put: |
|
14316 + |
|
14317 +cannot_route_message = Remote domain not found in DNS |
|
14318 + |
|
14319 +on the first router, which is a dnslookup router with more set false, and |
|
14320 + |
|
14321 +cannot_route_message = Unknown local user |
|
14322 + |
|
14323 +on the final router that checks for local users. If string expansion fails for |
|
14324 +this option, the default message is used. Unless the expansion failure was |
|
14325 +explicitly forced, a message about the failure is written to the main and panic |
|
14326 +logs, in addition to the normal message about the routing failure. |
|
14327 + |
|
14328 ++------------------------------------------------------------+ |
|
14329 +|caseful_local_part|Use: routers|Type: boolean|Default: false| |
|
14330 ++------------------------------------------------------------+ |
|
14331 + |
|
14332 +By default, routers handle the local parts of addresses in a case-insensitive |
|
14333 +manner, though the actual case is preserved for transmission with the message. |
|
14334 +If you want the case of letters to be significant in a router, you must set |
|
14335 +this option true. For individual router options that contain address or local |
|
14336 +part lists (for example, local_parts), case-sensitive matching can be turned on |
|
14337 +by "+caseful" as a list item. See section 10.20 for more details. |
|
14338 + |
|
14339 +The value of the $local_part variable is forced to lower case while a router is |
|
14340 +running unless caseful_local_part is set. When a router assigns an address to a |
|
14341 +transport, the value of $local_part when the transport runs is the same as it |
|
14342 +was in the router. Similarly, when a router generates child addresses by |
|
14343 +aliasing or forwarding, the values of $original_local_part and |
|
14344 +$parent_local_part are those that were used by the redirecting router. |
|
14345 + |
|
14346 +This option applies to the processing of an address by a router. When a |
|
14347 +recipient address is being processed in an ACL, there is a separate control |
|
14348 +modifier that can be used to specify case-sensitive processing within the ACL |
|
14349 +(see section 40.21). |
|
14350 + |
|
14351 ++------------------------------------------------------------+ |
|
14352 +|check_local_user|Use: routers**|Type: boolean|Default: false| |
|
14353 ++------------------------------------------------------------+ |
|
14354 + |
|
14355 +When this option is true, Exim checks that the local part of the recipient |
|
14356 +address (with affixes removed if relevant) is the name of an account on the |
|
14357 +local system. The check is done by calling the getpwnam() function rather than |
|
14358 +trying to read /etc/passwd directly. This means that other methods of holding |
|
14359 +password data (such as NIS) are supported. If the local part is a local user, |
|
14360 +$home is set from the password data, and can be tested in other preconditions |
|
14361 +that are evaluated after this one (the order of evaluation is given in section |
|
14362 +3.12). However, the value of $home can be overridden by router_home_directory. |
|
14363 +If the local part is not a local user, the router is skipped. |
|
14364 + |
|
14365 +If you want to check that the local part is either the name of a local user or |
|
14366 +matches something else, you cannot combine check_local_user with a setting of |
|
14367 +local_parts, because that specifies the logical and of the two conditions. |
|
14368 +However, you can use a passwd lookup in a local_parts setting to achieve this. |
|
14369 +For example: |
|
14370 + |
|
14371 +local_parts = passwd;$local_part : lsearch;/etc/other/users |
|
14372 + |
|
14373 +Note, however, that the side effects of check_local_user (such as setting up a |
|
14374 +home directory) do not occur when a passwd lookup is used in a local_parts (or |
|
14375 +any other) precondition. |
|
14376 + |
|
14377 ++-----------------------------------------------------+ |
|
14378 +|condition|Use: routers**|Type: string*|Default: unset| |
|
14379 ++-----------------------------------------------------+ |
|
14380 + |
|
14381 +This option specifies a general precondition test that has to succeed for the |
|
14382 +router to be called. The condition option is the last precondition to be |
|
14383 +evaluated (see section 3.12). The string is expanded, and if the result is a |
|
14384 +forced failure, or an empty string, or one of the strings "0" or "no" or |
|
14385 +"false" (checked without regard to the case of the letters), the router is |
|
14386 +skipped, and the address is offered to the next one. |
|
14387 + |
|
14388 +If the result is any other value, the router is run (as this is the last |
|
14389 +precondition to be evaluated, all the other preconditions must be true). |
|
14390 + |
|
14391 +This option is unique in that multiple condition options may be present. All |
|
14392 +condition options must succeed. |
|
14393 + |
|
14394 +The condition option provides a means of applying custom conditions to the |
|
14395 +running of routers. Note that in the case of a simple conditional expansion, |
|
14396 +the default expansion values are exactly what is wanted. For example: |
|
14397 + |
|
14398 +condition = ${if >{$message_age}{600}} |
|
14399 + |
|
14400 +Because of the default behaviour of the string expansion, this is equivalent to |
|
14401 + |
|
14402 +condition = ${if >{$message_age}{600}{true}{}} |
|
14403 + |
|
14404 +A multiple condition example, which succeeds: |
|
14405 + |
|
14406 +condition = ${if >{$message_age}{600}} |
|
14407 +condition = ${if !eq{${lc:$local_part}}{postmaster}} |
|
14408 +condition = foobar |
|
14409 + |
|
14410 +If the expansion fails (other than forced failure) delivery is deferred. Some |
|
14411 +of the other precondition options are common special cases that could in fact |
|
14412 +be specified using condition. |
|
14413 + |
|
14414 ++-----------------------------------------------------+ |
|
14415 +|debug_print|Use: routers|Type: string*|Default: unset| |
|
14416 ++-----------------------------------------------------+ |
|
14417 + |
|
14418 +If this option is set and debugging is enabled (see the -d command line |
|
14419 +option), the string is expanded and included in the debugging output. If |
|
14420 +expansion of the string fails, the error message is written to the debugging |
|
14421 +output, and Exim carries on processing. This option is provided to help with |
|
14422 +checking out the values of variables and so on when debugging router |
|
14423 +configurations. For example, if a condition option appears not to be working, |
|
14424 +debug_print can be used to output the variables it references. The output |
|
14425 +happens after checks for domains, local_parts, and check_local_user but before |
|
14426 +any other preconditions are tested. A newline is added to the text if it does |
|
14427 +not end with one. |
|
14428 + |
|
14429 ++---------------------------------------------------------+ |
|
14430 +|disable_logging|Use: routers|Type: boolean|Default: false| |
|
14431 ++---------------------------------------------------------+ |
|
14432 + |
|
14433 +If this option is set true, nothing is logged for any routing errors or for any |
|
14434 +deliveries caused by this router. You should not set this option unless you |
|
14435 +really, really know what you are doing. See also the generic transport option |
|
14436 +of the same name. |
|
14437 + |
|
14438 ++--------------------------------------------------------+ |
|
14439 +|domains|Use: routers**|Type: domain list*|Default: unset| |
|
14440 ++--------------------------------------------------------+ |
|
14441 + |
|
14442 +If this option is set, the router is skipped unless the current domain matches |
|
14443 +the list. If the match is achieved by means of a file lookup, the data that the |
|
14444 +lookup returned for the domain is placed in $domain_data for use in string |
|
14445 +expansions of the driver's private options. See section 3.12 for a list of the |
|
14446 +order in which preconditions are evaluated. |
|
14447 + |
|
14448 ++-----------------------------------------------+ |
|
14449 +|driver|Use: routers|Type: string|Default: unset| |
|
14450 ++-----------------------------------------------+ |
|
14451 + |
|
14452 +This option must always be set. It specifies which of the available routers is |
|
14453 +to be used. |
|
14454 + |
|
14455 ++---------------------------------------------------+ |
|
14456 +|errors_to|Use: routers|Type: string*|Default: unset| |
|
14457 ++---------------------------------------------------+ |
|
14458 + |
|
14459 +If a router successfully handles an address, it may assign the address to a |
|
14460 +transport for delivery or it may generate child addresses. In both cases, if |
|
14461 +there is a delivery problem during later processing, the resulting bounce |
|
14462 +message is sent to the address that results from expanding this string, |
|
14463 +provided that the address verifies successfully. The errors_to option is |
|
14464 +expanded before headers_add, headers_remove, and transport. |
|
14465 + |
|
14466 +The errors_to setting associated with an address can be overridden if it |
|
14467 +subsequently passes through other routers that have their own errors_to |
|
14468 +settings, or if the message is delivered by a transport with a return_path |
|
14469 +setting. |
|
14470 + |
|
14471 +If errors_to is unset, or the expansion is forced to fail, or the result of the |
|
14472 +expansion fails to verify, the errors address associated with the incoming |
|
14473 +address is used. At top level, this is the envelope sender. A non-forced |
|
14474 +expansion failure causes delivery to be deferred. |
|
14475 + |
|
14476 +If an address for which errors_to has been set ends up being delivered over |
|
14477 +SMTP, the envelope sender for that delivery is the errors_to value, so that any |
|
14478 +bounces that are generated by other MTAs on the delivery route are also sent |
|
14479 +there. You can set errors_to to the empty string by either of these settings: |
|
14480 + |
|
14481 +errors_to = |
|
14482 +errors_to = "" |
|
14483 + |
|
14484 +An expansion item that yields an empty string has the same effect. If you do |
|
14485 +this, a locally detected delivery error for addresses processed by this router |
|
14486 +no longer gives rise to a bounce message; the error is discarded. If the |
|
14487 +address is delivered to a remote host, the return path is set to "<>", unless |
|
14488 +overridden by the return_path option on the transport. |
|
14489 + |
|
14490 +If for some reason you want to discard local errors, but use a non-empty MAIL |
|
14491 +command for remote delivery, you can preserve the original return path in |
|
14492 +$address_data in the router, and reinstate it in the transport by setting |
|
14493 +return_path. |
|
14494 + |
|
14495 +The most common use of errors_to is to direct mailing list bounces to the |
|
14496 +manager of the list, as described in section 47.2, or to implement VERP |
|
14497 +(Variable Envelope Return Paths) (see section 47.6). |
|
14498 + |
|
14499 ++-----------------------------------------------+ |
|
14500 +|expn|Use: routers**|Type: boolean|Default: true| |
|
14501 ++-----------------------------------------------+ |
|
14502 + |
|
14503 +If this option is turned off, the router is skipped when testing an address as |
|
14504 +a result of processing an SMTP EXPN command. You might, for example, want to |
|
14505 +turn it off on a router for users' .forward files, while leaving it on for the |
|
14506 +system alias file. See section 3.12 for a list of the order in which |
|
14507 +preconditions are evaluated. |
|
14508 + |
|
14509 +The use of the SMTP EXPN command is controlled by an ACL (see chapter 40). When |
|
14510 +Exim is running an EXPN command, it is similar to testing an address with -bt. |
|
14511 +Compare VRFY, whose counterpart is -bv. |
|
14512 + |
|
14513 ++-----------------------------------------------------+ |
|
14514 +|fail_verify|Use: routers|Type: boolean|Default: false| |
|
14515 ++-----------------------------------------------------+ |
|
14516 + |
|
14517 +Setting this option has the effect of setting both fail_verify_sender and |
|
14518 +fail_verify_recipient to the same value. |
|
14519 + |
|
14520 ++---------------------------------------------------------------+ |
|
14521 +|fail_verify_recipient|Use: routers|Type: boolean|Default: false| |
|
14522 ++---------------------------------------------------------------+ |
|
14523 + |
|
14524 +If this option is true and an address is accepted by this router when verifying |
|
14525 +a recipient, verification fails. |
|
14526 + |
|
14527 ++------------------------------------------------------------+ |
|
14528 +|fail_verify_sender|Use: routers|Type: boolean|Default: false| |
|
14529 ++------------------------------------------------------------+ |
|
14530 + |
|
14531 +If this option is true and an address is accepted by this router when verifying |
|
14532 +a sender, verification fails. |
|
14533 + |
|
14534 ++------------------------------------------------------------+ |
|
14535 +|fallback_hosts|Use: routers|Type: string list|Default: unset| |
|
14536 ++------------------------------------------------------------+ |
|
14537 + |
|
14538 +String expansion is not applied to this option. The argument must be a |
|
14539 +colon-separated list of host names or IP addresses. The list separator can be |
|
14540 +changed (see section 6.19), and a port can be specified with each name or |
|
14541 +address. In fact, the format of each item is exactly the same as defined for |
|
14542 +the list of hosts in a manualroute router (see section 20.5). |
|
14543 + |
|
14544 +If a router queues an address for a remote transport, this host list is |
|
14545 +associated with the address, and used instead of the transport's fallback host |
|
14546 +list. If hosts_randomize is set on the transport, the order of the list is |
|
14547 +randomized for each use. See the fallback_hosts option of the smtp transport |
|
14548 +for further details. |
|
14549 + |
|
14550 ++---------------------------------------------------+ |
|
14551 +|group|Use: routers|Type: string*|Default: see below| |
|
14552 ++---------------------------------------------------+ |
|
14553 + |
|
14554 +When a router queues an address for a transport, and the transport does not |
|
14555 +specify a group, the group given here is used when running the delivery |
|
14556 +process. The group may be specified numerically or by name. If expansion fails, |
|
14557 +the error is logged and delivery is deferred. The default is unset, unless |
|
14558 +check_local_user is set, when the default is taken from the password |
|
14559 +information. See also initgroups and user and the discussion in chapter 23. |
|
14560 + |
|
14561 ++-----------------------------------------------------+ |
|
14562 +|headers_add|Use: routers|Type: string*|Default: unset| |
|
14563 ++-----------------------------------------------------+ |
|
14564 + |
|
14565 +This option specifies a string of text that is expanded at routing time, and |
|
14566 +associated with any addresses that are accepted by the router. However, this |
|
14567 +option has no effect when an address is just being verified. The way in which |
|
14568 +the text is used to add header lines at transport time is described in section |
|
14569 +44.17. New header lines are not actually added until the message is in the |
|
14570 +process of being transported. This means that references to header lines in |
|
14571 +string expansions in the transport's configuration do not "see" the added |
|
14572 +header lines. |
|
14573 + |
|
14574 +The headers_add option is expanded after errors_to, but before headers_remove |
|
14575 +and transport. If the expanded string is empty, or if the expansion is forced |
|
14576 +to fail, the option has no effect. Other expansion failures are treated as |
|
14577 +configuration errors. |
|
14578 + |
|
14579 +Warning 1: The headers_add option cannot be used for a redirect router that has |
|
14580 +the one_time option set. |
|
14581 + |
|
14582 +Warning 2: If the unseen option is set on the router, all header additions are |
|
14583 +deleted when the address is passed on to subsequent routers. For a redirect |
|
14584 +router, if a generated address is the same as the incoming address, this can |
|
14585 +lead to duplicate addresses with different header modifications. Exim does not |
|
14586 +do duplicate deliveries (except, in certain circumstances, to pipes -- see |
|
14587 +section 22.7), but it is undefined which of the duplicates is discarded, so |
|
14588 +this ambiguous situation should be avoided. The repeat_use option of the |
|
14589 +redirect router may be of help. |
|
14590 + |
|
14591 ++--------------------------------------------------------+ |
|
14592 +|headers_remove|Use: routers|Type: string*|Default: unset| |
|
14593 ++--------------------------------------------------------+ |
|
14594 + |
|
14595 +This option specifies a string of text that is expanded at routing time, and |
|
14596 +associated with any addresses that are accepted by the router. However, this |
|
14597 +option has no effect when an address is just being verified. The way in which |
|
14598 +the text is used to remove header lines at transport time is described in |
|
14599 +section 44.17. Header lines are not actually removed until the message is in |
|
14600 +the process of being transported. This means that references to header lines in |
|
14601 +string expansions in the transport's configuration still "see" the original |
|
14602 +header lines. |
|
14603 + |
|
14604 +The headers_remove option is expanded after errors_to and headers_add, but |
|
14605 +before transport. If the expansion is forced to fail, the option has no effect. |
|
14606 +Other expansion failures are treated as configuration errors. |
|
14607 + |
|
14608 +Warning 1: The headers_remove option cannot be used for a redirect router that |
|
14609 +has the one_time option set. |
|
14610 + |
|
14611 +Warning 2: If the unseen option is set on the router, all header removal |
|
14612 +requests are deleted when the address is passed on to subsequent routers, and |
|
14613 +this can lead to problems with duplicates -- see the similar warning for |
|
14614 +headers_add above. |
|
14615 + |
|
14616 ++----------------------------------------------------------------+ |
|
14617 +|ignore_target_hosts|Use: routers|Type: host list*|Default: unset| |
|
14618 ++----------------------------------------------------------------+ |
|
14619 + |
|
14620 +Although this option is a host list, it should normally contain IP address |
|
14621 +entries rather than names. If any host that is looked up by the router has an |
|
14622 +IP address that matches an item in this list, Exim behaves as if that IP |
|
14623 +address did not exist. This option allows you to cope with rogue DNS entries |
|
14624 +like |
|
14625 + |
|
14626 +remote.domain.example. A 127.0.0.1 |
|
14627 + |
|
14628 +by setting |
|
14629 + |
|
14630 +ignore_target_hosts = 127.0.0.1 |
|
14631 + |
|
14632 +on the relevant router. If all the hosts found by a dnslookup router are |
|
14633 +discarded in this way, the router declines. In a conventional configuration, an |
|
14634 +attempt to mail to such a domain would normally provoke the "unrouteable |
|
14635 +domain" error, and an attempt to verify an address in the domain would fail. |
|
14636 +Similarly, if ignore_target_hosts is set on an ipliteral router, the router |
|
14637 +declines if presented with one of the listed addresses. |
|
14638 + |
|
14639 +You can use this option to disable the use of IPv4 or IPv6 for mail delivery by |
|
14640 +means of the first or the second of the following settings, respectively: |
|
14641 + |
|
14642 +ignore_target_hosts = 0.0.0.0/0 |
|
14643 +ignore_target_hosts = <; 0::0/0 |
|
14644 + |
|
14645 +The pattern in the first line matches all IPv4 addresses, whereas the pattern |
|
14646 +in the second line matches all IPv6 addresses. |
|
14647 + |
|
14648 +This option may also be useful for ignoring link-local and site-local IPv6 |
|
14649 +addresses. Because, like all host lists, the value of ignore_target_hosts is |
|
14650 +expanded before use as a list, it is possible to make it dependent on the |
|
14651 +domain that is being routed. |
|
14652 + |
|
14653 +During its expansion, $host_address is set to the IP address that is being |
|
14654 +checked. |
|
14655 + |
|
14656 ++----------------------------------------------------+ |
|
14657 +|initgroups|Use: routers|Type: boolean|Default: false| |
|
14658 ++----------------------------------------------------+ |
|
14659 + |
|
14660 +If the router queues an address for a transport, and this option is true, and |
|
14661 +the uid supplied by the router is not overridden by the transport, the |
|
14662 +initgroups() function is called when running the transport to ensure that any |
|
14663 +additional groups associated with the uid are set up. See also group and user |
|
14664 +and the discussion in chapter 23. |
|
14665 + |
|
14666 ++-----------------------------------------------------------------+ |
|
14667 +|local_part_prefix|Use: routers**|Type: string list|Default: unset| |
|
14668 ++-----------------------------------------------------------------+ |
|
14669 + |
|
14670 +If this option is set, the router is skipped unless the local part starts with |
|
14671 +one of the given strings, or local_part_prefix_optional is true. See section |
|
14672 +3.12 for a list of the order in which preconditions are evaluated. |
|
14673 + |
|
14674 +The list is scanned from left to right, and the first prefix that matches is |
|
14675 +used. A limited form of wildcard is available; if the prefix begins with an |
|
14676 +asterisk, it matches the longest possible sequence of arbitrary characters at |
|
14677 +the start of the local part. An asterisk should therefore always be followed by |
|
14678 +some character that does not occur in normal local parts. Wildcarding can be |
|
14679 +used to set up multiple user mailboxes, as described in section 47.8. |
|
14680 + |
|
14681 +During the testing of the local_parts option, and while the router is running, |
|
14682 +the prefix is removed from the local part, and is available in the expansion |
|
14683 +variable $local_part_prefix. When a message is being delivered, if the router |
|
14684 +accepts the address, this remains true during subsequent delivery by a |
|
14685 +transport. In particular, the local part that is transmitted in the RCPT |
|
14686 +command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default. |
|
14687 +This behaviour can be overridden by setting rcpt_include_affixes true on the |
|
14688 +relevant transport. |
|
14689 + |
|
14690 +When an address is being verified, local_part_prefix affects only the behaviour |
|
14691 +of the router. If the callout feature of verification is in use, this means |
|
14692 +that the full address, including the prefix, will be used during the callout. |
|
14693 + |
|
14694 +The prefix facility is commonly used to handle local parts of the form |
|
14695 +owner-something. Another common use is to support local parts of the form |
|
14696 +real-username to bypass a user's .forward file - helpful when trying to tell a |
|
14697 +user their forwarding is broken - by placing a router like this one immediately |
|
14698 +before the router that handles .forward files: |
|
14699 + |
|
14700 +real_localuser: |
|
14701 + driver = accept |
|
14702 + local_part_prefix = real- |
|
14703 + check_local_user |
|
14704 + transport = local_delivery |
|
14705 + |
|
14706 +For security, it would probably be a good idea to restrict the use of this |
|
14707 +router to locally-generated messages, using a condition such as this: |
|
14708 + |
|
14709 + condition = ${if match {$sender_host_address}\ |
|
14710 + {\N^(|127\.0\.0\.1)$\N}} |
|
14711 + |
|
14712 +If both local_part_prefix and local_part_suffix are set for a router, both |
|
14713 +conditions must be met if not optional. Care must be taken if wildcards are |
|
14714 +used in both a prefix and a suffix on the same router. Different separator |
|
14715 +characters must be used to avoid ambiguity. |
|
14716 + |
|
14717 ++--------------------------------------------------------------------+ |
|
14718 +|local_part_prefix_optional|Use: routers|Type: boolean|Default: false| |
|
14719 ++--------------------------------------------------------------------+ |
|
14720 + |
|
14721 +See local_part_prefix above. |
|
14722 + |
|
14723 ++-----------------------------------------------------------------+ |
|
14724 +|local_part_suffix|Use: routers**|Type: string list|Default: unset| |
|
14725 ++-----------------------------------------------------------------+ |
|
14726 + |
|
14727 +This option operates in the same way as local_part_prefix, except that the |
|
14728 +local part must end (rather than start) with the given string, the |
|
14729 +local_part_suffix_optional option determines whether the suffix is mandatory, |
|
14730 +and the wildcard * character, if present, must be the last character of the |
|
14731 +suffix. This option facility is commonly used to handle local parts of the form |
|
14732 +something-request and multiple user mailboxes of the form username-foo. |
|
14733 + |
|
14734 ++--------------------------------------------------------------------+ |
|
14735 +|local_part_suffix_optional|Use: routers|Type: boolean|Default: false| |
|
14736 ++--------------------------------------------------------------------+ |
|
14737 + |
|
14738 +See local_part_suffix above. |
|
14739 + |
|
14740 ++----------------------------------------------------------------+ |
|
14741 +|local_parts|Use: routers**|Type: local part list*|Default: unset| |
|
14742 ++----------------------------------------------------------------+ |
|
14743 + |
|
14744 +The router is run only if the local part of the address matches the list. See |
|
14745 +section 3.12 for a list of the order in which preconditions are evaluated, and |
|
14746 +section 10.21 for a discussion of local part lists. Because the string is |
|
14747 +expanded, it is possible to make it depend on the domain, for example: |
|
14748 + |
|
14749 +local_parts = dbm;/usr/local/specials/$domain |
|
14750 + |
|
14751 +If the match is achieved by a lookup, the data that the lookup returned for the |
|
14752 +local part is placed in the variable $local_part_data for use in expansions of |
|
14753 +the router's private options. You might use this option, for example, if you |
|
14754 +have a large number of local virtual domains, and you want to send all |
|
14755 +postmaster mail to the same place without having to set up an alias in each |
|
14756 +virtual domain: |
|
14757 + |
|
14758 +postmaster: |
|
14759 + driver = redirect |
|
14760 + local_parts = postmaster |
|
14761 + data = postmaster@real.domain.example |
|
14762 + |
|
14763 ++----------------------------------------------------------+ |
|
14764 +|log_as_local|Use: routers|Type: boolean|Default: see below| |
|
14765 ++----------------------------------------------------------+ |
|
14766 + |
|
14767 +Exim has two logging styles for delivery, the idea being to make local |
|
14768 +deliveries stand out more visibly from remote ones. In the "local" style, the |
|
14769 +recipient address is given just as the local part, without a domain. The use of |
|
14770 +this style is controlled by this option. It defaults to true for the accept |
|
14771 +router, and false for all the others. This option applies only when a router |
|
14772 +assigns an address to a transport. It has no effect on routers that redirect |
|
14773 +addresses. |
|
14774 + |
|
14775 ++----------------------------------------------+ |
|
14776 +|more|Use: routers|Type: boolean*|Default: true| |
|
14777 ++----------------------------------------------+ |
|
14778 + |
|
14779 +The result of string expansion for this option must be a valid boolean value, |
|
14780 +that is, one of the strings "yes", "no", "true", or "false". Any other result |
|
14781 +causes an error, and delivery is deferred. If the expansion is forced to fail, |
|
14782 +the default value for the option (true) is used. Other failures cause delivery |
|
14783 +to be deferred. |
|
14784 + |
|
14785 +If this option is set false, and the router declines to handle the address, no |
|
14786 +further routers are tried, routing fails, and the address is bounced. However, |
|
14787 +if the router explicitly passes an address to the following router by means of |
|
14788 +the setting |
|
14789 + |
|
14790 +self = pass |
|
14791 + |
|
14792 +or otherwise, the setting of more is ignored. Also, the setting of more does |
|
14793 +not affect the behaviour if one of the precondition tests fails. In that case, |
|
14794 +the address is always passed to the next router. |
|
14795 + |
|
14796 +Note that address_data is not considered to be a precondition. If its expansion |
|
14797 +is forced to fail, the router declines, and the value of more controls what |
|
14798 +happens next. |
|
14799 + |
|
14800 ++---------------------------------------------------------+ |
|
14801 +|pass_on_timeout|Use: routers|Type: boolean|Default: false| |
|
14802 ++---------------------------------------------------------+ |
|
14803 + |
|
14804 +If a router times out during a host lookup, it normally causes deferral of the |
|
14805 +address. If pass_on_timeout is set, the address is passed on to the next |
|
14806 +router, overriding no_more. This may be helpful for systems that are |
|
14807 +intermittently connected to the Internet, or those that want to pass to a smart |
|
14808 +host any messages that cannot immediately be delivered. |
|
14809 + |
|
14810 +There are occasional other temporary errors that can occur while doing DNS |
|
14811 +lookups. They are treated in the same way as a timeout, and this option applies |
|
14812 +to all of them. |
|
14813 + |
|
14814 ++----------------------------------------------------+ |
|
14815 +|pass_router|Use: routers|Type: string|Default: unset| |
|
14816 ++----------------------------------------------------+ |
|
14817 + |
|
14818 +Routers that recognize the generic self option (dnslookup, ipliteral, and |
|
14819 +manualroute) are able to return "pass", forcing routing to continue, and |
|
14820 +overriding a false setting of more. When one of these routers returns "pass", |
|
14821 +the address is normally handed on to the next router in sequence. This can be |
|
14822 +changed by setting pass_router to the name of another router. However (unlike |
|
14823 +redirect_router) the named router must be below the current router, to avoid |
|
14824 +loops. Note that this option applies only to the special case of "pass". It |
|
14825 +does not apply when a router returns "decline" because it cannot handle an |
|
14826 +address. |
|
14827 + |
|
14828 ++--------------------------------------------------------+ |
|
14829 +|redirect_router|Use: routers|Type: string|Default: unset| |
|
14830 ++--------------------------------------------------------+ |
|
14831 + |
|
14832 +Sometimes an administrator knows that it is pointless to reprocess addresses |
|
14833 +generated from alias or forward files with the same router again. For example, |
|
14834 +if an alias file translates real names into login ids there is no point |
|
14835 +searching the alias file a second time, especially if it is a large file. |
|
14836 + |
|
14837 +The redirect_router option can be set to the name of any router instance. It |
|
14838 +causes the routing of any generated addresses to start at the named router |
|
14839 +instead of at the first router. This option has no effect if the router in |
|
14840 +which it is set does not generate new addresses. |
|
14841 + |
|
14842 ++--------------------------------------------------------------+ |
|
14843 +|require_files|Use: routers**|Type: string list*|Default: unset| |
|
14844 ++--------------------------------------------------------------+ |
|
14845 + |
|
14846 +This option provides a general mechanism for predicating the running of a |
|
14847 +router on the existence or non-existence of certain files or directories. |
|
14848 +Before running a router, as one of its precondition tests, Exim works its way |
|
14849 +through the require_files list, expanding each item separately. |
|
14850 + |
|
14851 +Because the list is split before expansion, any colons in expansion items must |
|
14852 +be doubled, or the facility for using a different list separator must be used. |
|
14853 +If any expansion is forced to fail, the item is ignored. Other expansion |
|
14854 +failures cause routing of the address to be deferred. |
|
14855 + |
|
14856 +If any expanded string is empty, it is ignored. Otherwise, except as described |
|
14857 +below, each string must be a fully qualified file path, optionally preceded by |
|
14858 +"!". The paths are passed to the stat() function to test for the existence of |
|
14859 +the files or directories. The router is skipped if any paths not preceded by "! |
|
14860 +" do not exist, or if any paths preceded by "!" do exist. |
|
14861 + |
|
14862 +If stat() cannot determine whether a file exists or not, delivery of the |
|
14863 +message is deferred. This can happen when NFS-mounted filesystems are |
|
14864 +unavailable. |
|
14865 + |
|
14866 +This option is checked after the domains, local_parts, and senders options, so |
|
14867 +you cannot use it to check for the existence of a file in which to look up a |
|
14868 +domain, local part, or sender. (See section 3.12 for a full list of the order |
|
14869 +in which preconditions are evaluated.) However, as these options are all |
|
14870 +expanded, you can use the exists expansion condition to make such tests. The |
|
14871 +require_files option is intended for checking files that the router may be |
|
14872 +going to use internally, or which are needed by a transport (for example |
|
14873 +.procmailrc). |
|
14874 + |
|
14875 +During delivery, the stat() function is run as root, but there is a facility |
|
14876 +for some checking of the accessibility of a file by another user. This is not a |
|
14877 +proper permissions check, but just a "rough" check that operates as follows: |
|
14878 + |
|
14879 +If an item in a require_files list does not contain any forward slash |
|
14880 +characters, it is taken to be the user (and optional group, separated by a |
|
14881 +comma) to be checked for subsequent files in the list. If no group is specified |
|
14882 +but the user is specified symbolically, the gid associated with the uid is |
|
14883 +used. For example: |
|
14884 + |
|
14885 +require_files = mail:/some/file |
|
14886 +require_files = $local_part:$home/.procmailrc |
|
14887 + |
|
14888 +If a user or group name in a require_files list does not exist, the |
|
14889 +require_files condition fails. |
|
14890 + |
|
14891 +Exim performs the check by scanning along the components of the file path, and |
|
14892 +checking the access for the given uid and gid. It checks for "x" access on |
|
14893 +directories, and "r" access on the final file. Note that this means that file |
|
14894 +access control lists, if the operating system has them, are ignored. |
|
14895 + |
|
14896 +Warning 1: When the router is being run to verify addresses for an incoming |
|
14897 +SMTP message, Exim is not running as root, but under its own uid. This may |
|
14898 +affect the result of a require_files check. In particular, stat() may yield the |
|
14899 +error EACCES ("Permission denied"). This means that the Exim user is not |
|
14900 +permitted to read one of the directories on the file's path. |
|
14901 + |
|
14902 +Warning 2: Even when Exim is running as root while delivering a message, stat() |
|
14903 +can yield EACCES for a file in an NFS directory that is mounted without root |
|
14904 +access. In this case, if a check for access by a particular user is requested, |
|
14905 +Exim creates a subprocess that runs as that user, and tries the check again in |
|
14906 +that process. |
|
14907 + |
|
14908 +The default action for handling an unresolved EACCES is to consider it to be |
|
14909 +caused by a configuration error, and routing is deferred because the existence |
|
14910 +or non-existence of the file cannot be determined. However, in some |
|
14911 +circumstances it may be desirable to treat this condition as if the file did |
|
14912 +not exist. If the file name (or the exclamation mark that precedes the file |
|
14913 +name for non-existence) is preceded by a plus sign, the EACCES error is treated |
|
14914 +as if the file did not exist. For example: |
|
14915 + |
|
14916 +require_files = +/some/file |
|
14917 + |
|
14918 +If the router is not an essential part of verification (for example, it handles |
|
14919 +users' .forward files), another solution is to set the verify option false so |
|
14920 +that the router is skipped when verifying. |
|
14921 + |
|
14922 ++------------------------------------------------------------------+ |
|
14923 +|retry_use_local_part|Use: routers|Type: boolean|Default: see below| |
|
14924 ++------------------------------------------------------------------+ |
|
14925 + |
|
14926 +When a delivery suffers a temporary routing failure, a retry record is created |
|
14927 +in Exim's hints database. For addresses whose routing depends only on the |
|
14928 +domain, the key for the retry record should not involve the local part, but for |
|
14929 +other addresses, both the domain and the local part should be included. |
|
14930 +Usually, remote routing is of the former kind, and local routing is of the |
|
14931 +latter kind. |
|
14932 + |
|
14933 +This option controls whether the local part is used to form the key for retry |
|
14934 +hints for addresses that suffer temporary errors while being handled by this |
|
14935 +router. The default value is true for any router that has check_local_user set, |
|
14936 +and false otherwise. Note that this option does not apply to hints keys for |
|
14937 +transport delays; they are controlled by a generic transport option of the same |
|
14938 +name. |
|
14939 + |
|
14940 +The setting of retry_use_local_part applies only to the router on which it |
|
14941 +appears. If the router generates child addresses, they are routed |
|
14942 +independently; this setting does not become attached to them. |
|
14943 + |
|
14944 ++---------------------------------------------------------------+ |
|
14945 +|router_home_directory|Use: routers|Type: string*|Default: unset| |
|
14946 ++---------------------------------------------------------------+ |
|
14947 + |
|
14948 +This option sets a home directory for use while the router is running. (Compare |
|
14949 +transport_home_directory, which sets a home directory for later transporting.) |
|
14950 +In particular, if used on a redirect router, this option sets a value for $home |
|
14951 +while a filter is running. The value is expanded; forced expansion failure |
|
14952 +causes the option to be ignored - other failures cause the router to defer. |
|
14953 + |
|
14954 +Expansion of router_home_directory happens immediately after the |
|
14955 +check_local_user test (if configured), before any further expansions take |
|
14956 +place. (See section 3.12 for a list of the order in which preconditions are |
|
14957 +evaluated.) While the router is running, router_home_directory overrides the |
|
14958 +value of $home that came from check_local_user. |
|
14959 + |
|
14960 +When a router accepts an address and assigns it to a local transport (including |
|
14961 +the cases when a redirect router generates a pipe, file, or autoreply |
|
14962 +delivery), the home directory setting for the transport is taken from the first |
|
14963 +of these values that is set: |
|
14964 + |
|
14965 + * The home_directory option on the transport; |
|
14966 + |
|
14967 + * The transport_home_directory option on the router; |
|
14968 + |
|
14969 + * The password data if check_local_user is set on the router; |
|
14970 + |
|
14971 + * The router_home_directory option on the router. |
|
14972 + |
|
14973 +In other words, router_home_directory overrides the password data for the |
|
14974 +router, but not for the transport. |
|
14975 + |
|
14976 ++----------------------------------------------+ |
|
14977 +|self|Use: routers|Type: string|Default: freeze| |
|
14978 ++----------------------------------------------+ |
|
14979 + |
|
14980 +This option applies to those routers that use a recipient address to find a |
|
14981 +list of remote hosts. Currently, these are the dnslookup, ipliteral, and |
|
14982 +manualroute routers. Certain configurations of the queryprogram router can also |
|
14983 +specify a list of remote hosts. Usually such routers are configured to send the |
|
14984 +message to a remote host via an smtp transport. The self option specifies what |
|
14985 +happens when the first host on the list turns out to be the local host. The way |
|
14986 +in which Exim checks for the local host is described in section 13.8. |
|
14987 + |
|
14988 +Normally this situation indicates either an error in Exim's configuration (for |
|
14989 +example, the router should be configured not to process this domain), or an |
|
14990 +error in the DNS (for example, the MX should not point to this host). For this |
|
14991 +reason, the default action is to log the incident, defer the address, and |
|
14992 +freeze the message. The following alternatives are provided for use in special |
|
14993 +cases: |
|
14994 + |
|
14995 +defer |
|
14996 + |
|
14997 + Delivery of the message is tried again later, but the message is not |
|
14998 + frozen. |
|
14999 + |
|
15000 +reroute: <domain> |
|
15001 + |
|
15002 + The domain is changed to the given domain, and the address is passed back |
|
15003 + to be reprocessed by the routers. No rewriting of headers takes place. This |
|
15004 + behaviour is essentially a redirection. |
|
15005 + |
|
15006 +reroute: rewrite: <domain> |
|
15007 + |
|
15008 + The domain is changed to the given domain, and the address is passed back |
|
15009 + to be reprocessed by the routers. Any headers that contain the original |
|
15010 + domain are rewritten. |
|
15011 + |
|
15012 +pass |
|
15013 + |
|
15014 + The router passes the address to the next router, or to the router named in |
|
15015 + the pass_router option if it is set. This overrides no_more. During |
|
15016 + subsequent routing and delivery, the variable $self_hostname contains the |
|
15017 + name of the local host that the router encountered. This can be used to |
|
15018 + distinguish between different cases for hosts with multiple names. The |
|
15019 + combination |
|
15020 + |
|
15021 + self = pass |
|
15022 + no_more |
|
15023 + |
|
15024 + ensures that only those addresses that routed to the local host are passed |
|
15025 + on. Without no_more, addresses that were declined for other reasons would |
|
15026 + also be passed to the next router. |
|
15027 + |
|
15028 +fail |
|
15029 + |
|
15030 + Delivery fails and an error report is generated. |
|
15031 + |
|
15032 +send |
|
15033 + |
|
15034 + The anomaly is ignored and the address is queued for the transport. This |
|
15035 + setting should be used with extreme caution. For an smtp transport, it |
|
15036 + makes sense only in cases where the program that is listening on the SMTP |
|
15037 + port is not this version of Exim. That is, it must be some other MTA, or |
|
15038 + Exim with a different configuration file that handles the domain in another |
|
15039 + way. |
|
15040 + |
|
15041 ++---------------------------------------------------------+ |
|
15042 +|senders|Use: routers**|Type: address list*|Default: unset| |
|
15043 ++---------------------------------------------------------+ |
|
15044 + |
|
15045 +If this option is set, the router is skipped unless the message's sender |
|
15046 +address matches something on the list. See section 3.12 for a list of the order |
|
15047 +in which preconditions are evaluated. |
|
15048 + |
|
15049 +There are issues concerning verification when the running of routers is |
|
15050 +dependent on the sender. When Exim is verifying the address in an errors_to |
|
15051 +setting, it sets the sender to the null string. When using the -bt option to |
|
15052 +check a configuration file, it is necessary also to use the -f option to set an |
|
15053 +appropriate sender. For incoming mail, the sender is unset when verifying the |
|
15054 +sender, but is available when verifying any recipients. If the SMTP VRFY |
|
15055 +command is enabled, it must be used after MAIL if the sender address matters. |
|
15056 + |
|
15057 ++--------------------------------------------------------------+ |
|
15058 +|translate_ip_address|Use: routers|Type: string*|Default: unset| |
|
15059 ++--------------------------------------------------------------+ |
|
15060 + |
|
15061 +There exist some rare networking situations (for example, packet radio) where |
|
15062 +it is helpful to be able to translate IP addresses generated by normal routing |
|
15063 +mechanisms into other IP addresses, thus performing a kind of manual IP |
|
15064 +routing. This should be done only if the normal IP routing of the TCP/IP stack |
|
15065 +is inadequate or broken. Because this is an extremely uncommon requirement, the |
|
15066 +code to support this option is not included in the Exim binary unless |
|
15067 +SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in Local/Makefile. |
|
15068 + |
|
15069 +The translate_ip_address string is expanded for every IP address generated by |
|
15070 +the router, with the generated address set in $host_address. If the expansion |
|
15071 +is forced to fail, no action is taken. For any other expansion error, delivery |
|
15072 +of the message is deferred. If the result of the expansion is an IP address, |
|
15073 +that replaces the original address; otherwise the result is assumed to be a |
|
15074 +host name - this is looked up using gethostbyname() (or getipnodebyname() when |
|
15075 +available) to produce one or more replacement IP addresses. For example, to |
|
15076 +subvert all IP addresses in some specific networks, this could be added to a |
|
15077 +router: |
|
15078 + |
|
15079 +translate_ip_address = \ |
|
15080 + ${lookup{${mask:$host_address/26}}lsearch{/some/file}\ |
|
15081 + {$value}fail}} |
|
15082 + |
|
15083 +The file would contain lines like |
|
15084 + |
|
15085 +10.2.3.128/26 some.host |
|
15086 +10.8.4.34/26 10.44.8.15 |
|
15087 + |
|
15088 +You should not make use of this facility unless you really understand what you |
|
15089 +are doing. |
|
15090 + |
|
15091 ++---------------------------------------------------+ |
|
15092 +|transport|Use: routers|Type: string*|Default: unset| |
|
15093 ++---------------------------------------------------+ |
|
15094 + |
|
15095 +This option specifies the transport to be used when a router accepts an address |
|
15096 +and sets it up for delivery. A transport is never needed if a router is used |
|
15097 +only for verification. The value of the option is expanded at routing time, |
|
15098 +after the expansion of errors_to, headers_add, and headers_remove, and result |
|
15099 +must be the name of one of the configured transports. If it is not, delivery is |
|
15100 +deferred. |
|
15101 + |
|
15102 +The transport option is not used by the redirect router, but it does have some |
|
15103 +private options that set up transports for pipe and file deliveries (see |
|
15104 +chapter 22). |
|
15105 + |
|
15106 ++---------------------------------------------------------------------+ |
|
15107 +|transport_current_directory|Use: routers|Type: string*|Default: unset| |
|
15108 ++---------------------------------------------------------------------+ |
|
15109 + |
|
15110 +This option associates a current directory with any address that is routed to a |
|
15111 +local transport. This can happen either because a transport is explicitly |
|
15112 +configured for the router, or because it generates a delivery to a file or a |
|
15113 +pipe. During the delivery process (that is, at transport time), this option |
|
15114 +string is expanded and is set as the current directory, unless overridden by a |
|
15115 +setting on the transport. If the expansion fails for any reason, including |
|
15116 +forced failure, an error is logged, and delivery is deferred. See chapter 23 |
|
15117 +for details of the local delivery environment. |
|
15118 + |
|
15119 ++----------------------------------------------------------------------+ |
|
15120 +|transport_home_directory|Use: routers|Type: string*|Default: see below| |
|
15121 ++----------------------------------------------------------------------+ |
|
15122 + |
|
15123 +This option associates a home directory with any address that is routed to a |
|
15124 +local transport. This can happen either because a transport is explicitly |
|
15125 +configured for the router, or because it generates a delivery to a file or a |
|
15126 +pipe. During the delivery process (that is, at transport time), the option |
|
15127 +string is expanded and is set as the home directory, unless overridden by a |
|
15128 +setting of home_directory on the transport. If the expansion fails for any |
|
15129 +reason, including forced failure, an error is logged, and delivery is deferred. |
|
15130 + |
|
15131 +If the transport does not specify a home directory, and |
|
15132 +transport_home_directory is not set for the router, the home directory for the |
|
15133 +transport is taken from the password data if check_local_user is set for the |
|
15134 +router. Otherwise it is taken from router_home_directory if that option is set; |
|
15135 +if not, no home directory is set for the transport. |
|
15136 + |
|
15137 +See chapter 23 for further details of the local delivery environment. |
|
15138 + |
|
15139 ++-------------------------------------------------+ |
|
15140 +|unseen|Use: routers|Type: boolean*|Default: false| |
|
15141 ++-------------------------------------------------+ |
|
15142 + |
|
15143 +The result of string expansion for this option must be a valid boolean value, |
|
15144 +that is, one of the strings "yes", "no", "true", or "false". Any other result |
|
15145 +causes an error, and delivery is deferred. If the expansion is forced to fail, |
|
15146 +the default value for the option (false) is used. Other failures cause delivery |
|
15147 +to be deferred. |
|
15148 + |
|
15149 +When this option is set true, routing does not cease if the router accepts the |
|
15150 +address. Instead, a copy of the incoming address is passed to the next router, |
|
15151 +overriding a false setting of more. There is little point in setting more false |
|
15152 +if unseen is always true, but it may be useful in cases when the value of |
|
15153 +unseen contains expansion items (and therefore, presumably, is sometimes true |
|
15154 +and sometimes false). |
|
15155 + |
|
15156 +Setting the unseen option has a similar effect to the unseen command qualifier |
|
15157 +in filter files. It can be used to cause copies of messages to be delivered to |
|
15158 +some other destination, while also carrying out a normal delivery. In effect, |
|
15159 +the current address is made into a "parent" that has two children - one that is |
|
15160 +delivered as specified by this router, and a clone that goes on to be routed |
|
15161 +further. For this reason, unseen may not be combined with the one_time option |
|
15162 +in a redirect router. |
|
15163 + |
|
15164 +Warning: Header lines added to the address (or specified for removal) by this |
|
15165 +router or by previous routers affect the "unseen" copy of the message only. The |
|
15166 +clone that continues to be processed by further routers starts with no added |
|
15167 +headers and none specified for removal. For a redirect router, if a generated |
|
15168 +address is the same as the incoming address, this can lead to duplicate |
|
15169 +addresses with different header modifications. Exim does not do duplicate |
|
15170 +deliveries (except, in certain circumstances, to pipes -- see section 22.7), |
|
15171 +but it is undefined which of the duplicates is discarded, so this ambiguous |
|
15172 +situation should be avoided. The repeat_use option of the redirect router may |
|
15173 +be of help. |
|
15174 + |
|
15175 +Unlike the handling of header modifications, any data that was set by the |
|
15176 +address_data option in the current or previous routers is passed on to |
|
15177 +subsequent routers. |
|
15178 + |
|
15179 ++--------------------------------------------------+ |
|
15180 +|user|Use: routers|Type: string*|Default: see below| |
|
15181 ++--------------------------------------------------+ |
|
15182 + |
|
15183 +When a router queues an address for a transport, and the transport does not |
|
15184 +specify a user, the user given here is used when running the delivery process. |
|
15185 +The user may be specified numerically or by name. If expansion fails, the error |
|
15186 +is logged and delivery is deferred. This user is also used by the redirect |
|
15187 +router when running a filter file. The default is unset, except when |
|
15188 +check_local_user is set. In this case, the default is taken from the password |
|
15189 +information. If the user is specified as a name, and group is not set, the |
|
15190 +group associated with the user is used. See also initgroups and group and the |
|
15191 +discussion in chapter 23. |
|
15192 + |
|
15193 ++-------------------------------------------------+ |
|
15194 +|verify|Use: routers**|Type: boolean|Default: true| |
|
15195 ++-------------------------------------------------+ |
|
15196 + |
|
15197 +Setting this option has the effect of setting verify_sender and |
|
15198 +verify_recipient to the same value. |
|
15199 + |
|
15200 ++-------------------------------------------------------+ |
|
15201 +|verify_only|Use: routers**|Type: boolean|Default: false| |
|
15202 ++-------------------------------------------------------+ |
|
15203 + |
|
15204 +If this option is set, the router is used only when verifying an address or |
|
15205 +testing with the -bv option, not when actually doing a delivery, testing with |
|
15206 +the -bt option, or running the SMTP EXPN command. It can be further restricted |
|
15207 +to verifying only senders or recipients by means of verify_sender and |
|
15208 +verify_recipient. |
|
15209 + |
|
15210 +Warning: When the router is being run to verify addresses for an incoming SMTP |
|
15211 +message, Exim is not running as root, but under its own uid. If the router |
|
15212 +accesses any files, you need to make sure that they are accessible to the Exim |
|
15213 +user or group. |
|
15214 + |
|
15215 ++-----------------------------------------------------------+ |
|
15216 +|verify_recipient|Use: routers**|Type: boolean|Default: true| |
|
15217 ++-----------------------------------------------------------+ |
|
15218 + |
|
15219 +If this option is false, the router is skipped when verifying recipient |
|
15220 +addresses or testing recipient verification using -bv. See section 3.12 for a |
|
15221 +list of the order in which preconditions are evaluated. |
|
15222 + |
|
15223 ++--------------------------------------------------------+ |
|
15224 +|verify_sender|Use: routers**|Type: boolean|Default: true| |
|
15225 ++--------------------------------------------------------+ |
|
15226 + |
|
15227 +If this option is false, the router is skipped when verifying sender addresses |
|
15228 +or testing sender verification using -bvs. See section 3.12 for a list of the |
|
15229 +order in which preconditions are evaluated. |
|
15230 + |
|
15231 +16. The accept router |
|
15232 + |
|
15233 +The accept router has no private options of its own. Unless it is being used |
|
15234 +purely for verification (see verify_only) a transport is required to be defined |
|
15235 +by the generic transport option. If the preconditions that are specified by |
|
15236 +generic options are met, the router accepts the address and queues it for the |
|
15237 +given transport. The most common use of this router is for setting up |
|
15238 +deliveries to local mailboxes. For example: |
|
15239 + |
|
15240 +localusers: |
|
15241 + driver = accept |
|
15242 + domains = mydomain.example |
|
15243 + check_local_user |
|
15244 + transport = local_delivery |
|
15245 + |
|
15246 +The domains condition in this example checks the domain of the address, and |
|
15247 +check_local_user checks that the local part is the login of a local user. When |
|
15248 +both preconditions are met, the accept router runs, and queues the address for |
|
15249 +the local_delivery transport. |
|
15250 + |
|
15251 +17. The dnslookup router |
|
15252 + |
|
15253 +The dnslookup router looks up the hosts that handle mail for the recipient's |
|
15254 +domain in the DNS. A transport must always be set for this router, unless |
|
15255 +verify_only is set. |
|
15256 + |
|
15257 +If SRV support is configured (see check_srv below), Exim first searches for SRV |
|
15258 +records. If none are found, or if SRV support is not configured, MX records are |
|
15259 +looked up. If no MX records exist, address records are sought. However, |
|
15260 +mx_domains can be set to disable the direct use of address records. |
|
15261 + |
|
15262 +MX records of equal priority are sorted by Exim into a random order. Exim then |
|
15263 +looks for address records for the host names obtained from MX or SRV records. |
|
15264 +When a host has more than one IP address, they are sorted into a random order, |
|
15265 +except that IPv6 addresses are always sorted before IPv4 addresses. If all the |
|
15266 +IP addresses found are discarded by a setting of the ignore_target_hosts |
|
15267 +generic option, the router declines. |
|
15268 + |
|
15269 +Unless they have the highest priority (lowest MX value), MX records that point |
|
15270 +to the local host, or to any host name that matches hosts_treat_as_local, are |
|
15271 +discarded, together with any other MX records of equal or lower priority. |
|
15272 + |
|
15273 +If the host pointed to by the highest priority MX record, or looked up as an |
|
15274 +address record, is the local host, or matches hosts_treat_as_local, what |
|
15275 +happens is controlled by the generic self option. |
|
15276 + |
|
15277 +17.1Â Problems with DNS lookups |
|
15278 + |
|
15279 +There have been problems with DNS servers when SRV records are looked up. Some |
|
15280 +mis-behaving servers return a DNS error or timeout when a non-existent SRV |
|
15281 +record is sought. Similar problems have in the past been reported for MX |
|
15282 +records. The global dns_again_means_nonexist option can help with this problem, |
|
15283 +but it is heavy-handed because it is a global option. |
|
15284 + |
|
15285 +For this reason, there are two options, srv_fail_domains and mx_fail_domains, |
|
15286 +that control what happens when a DNS lookup in a dnslookup router results in a |
|
15287 +DNS failure or a "try again" response. If an attempt to look up an SRV or MX |
|
15288 +record causes one of these results, and the domain matches the relevant list, |
|
15289 +Exim behaves as if the DNS had responded "no such record". In the case of an |
|
15290 +SRV lookup, this means that the router proceeds to look for MX records; in the |
|
15291 +case of an MX lookup, it proceeds to look for A or AAAA records, unless the |
|
15292 +domain matches mx_domains, in which case routing fails. |
|
15293 + |
|
15294 +17.2Â Private options for dnslookup |
|
15295 + |
|
15296 +The private options for the dnslookup router are as follows: |
|
15297 + |
|
15298 ++--------------------------------------------------------------+ |
|
15299 +|check_secondary_mx|Use: dnslookup|Type: boolean|Default: false| |
|
15300 ++--------------------------------------------------------------+ |
|
15301 + |
|
15302 +If this option is set, the router declines unless the local host is found in |
|
15303 +(and removed from) the list of hosts obtained by MX lookup. This can be used to |
|
15304 +process domains for which the local host is a secondary mail exchanger |
|
15305 +differently to other domains. The way in which Exim decides whether a host is |
|
15306 +the local host is described in section 13.8. |
|
15307 + |
|
15308 ++-----------------------------------------------------+ |
|
15309 +|check_srv|Use: dnslookup|Type: string*|Default: unset| |
|
15310 ++-----------------------------------------------------+ |
|
15311 + |
|
15312 +The dnslookup router supports the use of SRV records (see RFC 2782) in addition |
|
15313 +to MX and address records. The support is disabled by default. To enable SRV |
|
15314 +support, set the check_srv option to the name of the service required. For |
|
15315 +example, |
|
15316 + |
|
15317 +check_srv = smtp |
|
15318 + |
|
15319 +looks for SRV records that refer to the normal smtp service. The option is |
|
15320 +expanded, so the service name can vary from message to message or address to |
|
15321 +address. This might be helpful if SRV records are being used for a submission |
|
15322 +service. If the expansion is forced to fail, the check_srv option is ignored, |
|
15323 +and the router proceeds to look for MX records in the normal way. |
|
15324 + |
|
15325 +When the expansion succeeds, the router searches first for SRV records for the |
|
15326 +given service (it assumes TCP protocol). A single SRV record with a host name |
|
15327 +that consists of just a single dot indicates "no such service for this domain"; |
|
15328 +if this is encountered, the router declines. If other kinds of SRV record are |
|
15329 +found, they are used to construct a host list for delivery according to the |
|
15330 +rules of RFC 2782. MX records are not sought in this case. |
|
15331 + |
|
15332 +When no SRV records are found, MX records (and address records) are sought in |
|
15333 +the traditional way. In other words, SRV records take precedence over MX |
|
15334 +records, just as MX records take precedence over address records. Note that |
|
15335 +this behaviour is not sanctioned by RFC 2782, though a previous draft RFC |
|
15336 +defined it. It is apparently believed that MX records are sufficient for email |
|
15337 +and that SRV records should not be used for this purpose. However, SRV records |
|
15338 +have an additional "weight" feature which some people might find useful when |
|
15339 +trying to split an SMTP load between hosts of different power. |
|
15340 + |
|
15341 +See section 17.1 above for a discussion of Exim's behaviour when there is a DNS |
|
15342 +lookup error. |
|
15343 + |
|
15344 ++-----------------------------------------------------------+ |
|
15345 +|mx_domains|Use: dnslookup|Type: domain list*|Default: unset| |
|
15346 ++-----------------------------------------------------------+ |
|
15347 + |
|
15348 +A domain that matches mx_domains is required to have either an MX or an SRV |
|
15349 +record in order to be recognized. (The name of this option could be improved.) |
|
15350 +For example, if all the mail hosts in fict.example are known to have MX |
|
15351 +records, except for those in discworld.fict.example, you could use this |
|
15352 +setting: |
|
15353 + |
|
15354 +mx_domains = ! *.discworld.fict.example : *.fict.example |
|
15355 + |
|
15356 +This specifies that messages addressed to a domain that matches the list but |
|
15357 +has no MX record should be bounced immediately instead of being routed using |
|
15358 +the address record. |
|
15359 + |
|
15360 ++----------------------------------------------------------------+ |
|
15361 +|mx_fail_domains|Use: dnslookup|Type: domain list*|Default: unset| |
|
15362 ++----------------------------------------------------------------+ |
|
15363 + |
|
15364 +If the DNS lookup for MX records for one of the domains in this list causes a |
|
15365 +DNS lookup error, Exim behaves as if no MX records were found. See section 17.1 |
|
15366 +for more discussion. |
|
15367 + |
|
15368 ++---------------------------------------------------------+ |
|
15369 +|qualify_single|Use: dnslookup|Type: boolean|Default: true| |
|
15370 ++---------------------------------------------------------+ |
|
15371 + |
|
15372 +When this option is true, the resolver option RES_DEFNAMES is set for DNS |
|
15373 +lookups. Typically, but not standardly, this causes the resolver to qualify |
|
15374 +single-component names with the default domain. For example, on a machine |
|
15375 +called dictionary.ref.example, the domain thesaurus would be changed to |
|
15376 +thesaurus.ref.example inside the resolver. For details of what your resolver |
|
15377 +actually does, consult your man pages for resolver and resolv.conf. |
|
15378 + |
|
15379 ++----------------------------------------------------------+ |
|
15380 +|rewrite_headers|Use: dnslookup|Type: boolean|Default: true| |
|
15381 ++----------------------------------------------------------+ |
|
15382 + |
|
15383 +If the domain name in the address that is being processed is not fully |
|
15384 +qualified, it may be expanded to its full form by a DNS lookup. For example, if |
|
15385 +an address is specified as dormouse@teaparty, the domain might be expanded to |
|
15386 +teaparty.wonderland.fict.example. Domain expansion can also occur as a result |
|
15387 +of setting the widen_domains option. If rewrite_headers is true, all |
|
15388 +occurrences of the abbreviated domain name in any Bcc:, Cc:, From:, Reply-to:, |
|
15389 +Sender:, and To: header lines of the message are rewritten with the full domain |
|
15390 +name. |
|
15391 + |
|
15392 +This option should be turned off only when it is known that no message is ever |
|
15393 +going to be sent outside an environment where the abbreviation makes sense. |
|
15394 + |
|
15395 +When an MX record is looked up in the DNS and matches a wildcard record, name |
|
15396 +servers normally return a record containing the name that has been looked up, |
|
15397 +making it impossible to detect whether a wildcard was present or not. However, |
|
15398 +some name servers have recently been seen to return the wildcard entry. If the |
|
15399 +name returned by a DNS lookup begins with an asterisk, it is not used for |
|
15400 +header rewriting. |
|
15401 + |
|
15402 ++--------------------------------------------------------------------+ |
|
15403 +|same_domain_copy_routing|Use: dnslookup|Type: boolean|Default: false| |
|
15404 ++--------------------------------------------------------------------+ |
|
15405 + |
|
15406 +Addresses with the same domain are normally routed by the dnslookup router to |
|
15407 +the same list of hosts. However, this cannot be presumed, because the router |
|
15408 +options and preconditions may refer to the local part of the address. By |
|
15409 +default, therefore, Exim routes each address in a message independently. DNS |
|
15410 +servers run caches, so repeated DNS lookups are not normally expensive, and in |
|
15411 +any case, personal messages rarely have more than a few recipients. |
|
15412 + |
|
15413 +If you are running mailing lists with large numbers of subscribers at the same |
|
15414 +domain, and you are using a dnslookup router which is independent of the local |
|
15415 +part, you can set same_domain_copy_routing to bypass repeated DNS lookups for |
|
15416 +identical domains in one message. In this case, when dnslookup routes an |
|
15417 +address to a remote transport, any other unrouted addresses in the message that |
|
15418 +have the same domain are automatically given the same routing without |
|
15419 +processing them independently, provided the following conditions are met: |
|
15420 + |
|
15421 + * No router that processed the address specified headers_add or |
|
15422 + headers_remove. |
|
15423 + |
|
15424 + * The router did not change the address in any way, for example, by |
|
15425 + "widening" the domain. |
|
15426 + |
|
15427 ++----------------------------------------------------------+ |
|
15428 +|search_parents|Use: dnslookup|Type: boolean|Default: false| |
|
15429 ++----------------------------------------------------------+ |
|
15430 + |
|
15431 +When this option is true, the resolver option RES_DNSRCH is set for DNS |
|
15432 +lookups. This is different from the qualify_single option in that it applies to |
|
15433 +domains containing dots. Typically, but not standardly, it causes the resolver |
|
15434 +to search for the name in the current domain and in parent domains. For |
|
15435 +example, on a machine in the fict.example domain, if looking up |
|
15436 +teaparty.wonderland failed, the resolver would try |
|
15437 +teaparty.wonderland.fict.example. For details of what your resolver actually |
|
15438 +does, consult your man pages for resolver and resolv.conf. |
|
15439 + |
|
15440 +Setting this option true can cause problems in domains that have a wildcard MX |
|
15441 +record, because any domain that does not have its own MX record matches the |
|
15442 +local wildcard. |
|
15443 + |
|
15444 ++-----------------------------------------------------------------+ |
|
15445 +|srv_fail_domains|Use: dnslookup|Type: domain list*|Default: unset| |
|
15446 ++-----------------------------------------------------------------+ |
|
15447 + |
|
15448 +If the DNS lookup for SRV records for one of the domains in this list causes a |
|
15449 +DNS lookup error, Exim behaves as if no SRV records were found. See section |
|
15450 +17.1 for more discussion. |
|
15451 + |
|
15452 ++-------------------------------------------------------------+ |
|
15453 +|widen_domains|Use: dnslookup|Type: string list|Default: unset| |
|
15454 ++-------------------------------------------------------------+ |
|
15455 + |
|
15456 +If a DNS lookup fails and this option is set, each of its strings in turn is |
|
15457 +added onto the end of the domain, and the lookup is tried again. For example, |
|
15458 +if |
|
15459 + |
|
15460 +widen_domains = fict.example:ref.example |
|
15461 + |
|
15462 +is set and a lookup of klingon.dictionary fails, |
|
15463 +klingon.dictionary.fict.example is looked up, and if this fails, |
|
15464 +klingon.dictionary.ref.example is tried. Note that the qualify_single and |
|
15465 +search_parents options can cause some widening to be undertaken inside the DNS |
|
15466 +resolver. widen_domains is not applied to sender addresses when verifying, |
|
15467 +unless rewrite_headers is false (not the default). |
|
15468 + |
|
15469 +17.3Â Effect of qualify_single and search_parents |
|
15470 + |
|
15471 +When a domain from an envelope recipient is changed by the resolver as a result |
|
15472 +of the qualify_single or search_parents options, Exim rewrites the |
|
15473 +corresponding address in the message's header lines unless rewrite_headers is |
|
15474 +set false. Exim then re-routes the address, using the full domain. |
|
15475 + |
|
15476 +These two options affect only the DNS lookup that takes place inside the router |
|
15477 +for the domain of the address that is being routed. They do not affect lookups |
|
15478 +such as that implied by |
|
15479 + |
|
15480 +domains = @mx_any |
|
15481 + |
|
15482 +that may happen while processing a router precondition before the router is |
|
15483 +entered. No widening ever takes place for these lookups. |
|
15484 + |
|
15485 +18. The ipliteral router |
|
15486 + |
|
15487 +This router has no private options. Unless it is being used purely for |
|
15488 +verification (see verify_only) a transport is required to be defined by the |
|
15489 +generic transport option. The router accepts the address if its domain part |
|
15490 +takes the form of an RFC 2822 domain literal. For example, the ipliteral router |
|
15491 +handles the address |
|
15492 + |
|
15493 +root@[192.168.1.1] |
|
15494 + |
|
15495 +by setting up delivery to the host with that IP address. IPv4 domain literals |
|
15496 +consist of an IPv4 address enclosed in square brackets. IPv6 domain literals |
|
15497 +are similar, but the address is preceded by "ipv6:". For example: |
|
15498 + |
|
15499 +postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678] |
|
15500 + |
|
15501 +Exim allows "ipv4:" before IPv4 addresses, for consistency, and on the grounds |
|
15502 +that sooner or later somebody will try it. |
|
15503 + |
|
15504 +If the IP address matches something in ignore_target_hosts, the router |
|
15505 +declines. If an IP literal turns out to refer to the local host, the generic |
|
15506 +self option determines what happens. |
|
15507 + |
|
15508 +The RFCs require support for domain literals; however, their use is |
|
15509 +controversial in today's Internet. If you want to use this router, you must |
|
15510 +also set the main configuration option allow_domain_literals. Otherwise, Exim |
|
15511 +will not recognize the domain literal syntax in addresses. |
|
15512 + |
|
15513 +19. The iplookup router |
|
15514 + |
|
15515 +The iplookup router was written to fulfil a specific requirement in Cambridge |
|
15516 +University (which in fact no longer exists). For this reason, it is not |
|
15517 +included in the binary of Exim by default. If you want to include it, you must |
|
15518 +set |
|
15519 + |
|
15520 +ROUTER_IPLOOKUP=yes |
|
15521 + |
|
15522 +in your Local/Makefile configuration file. |
|
15523 + |
|
15524 +The iplookup router routes an address by sending it over a TCP or UDP |
|
15525 +connection to one or more specific hosts. The host can then return the same or |
|
15526 +a different address - in effect rewriting the recipient address in the |
|
15527 +message's envelope. The new address is then passed on to subsequent routers. If |
|
15528 +this process fails, the address can be passed on to other routers, or delivery |
|
15529 +can be deferred. Since iplookup is just a rewriting router, a transport must |
|
15530 +not be specified for it. |
|
15531 + |
|
15532 ++-----------------------------------------------+ |
|
15533 +|hosts|Use: iplookup|Type: string|Default: unset| |
|
15534 ++-----------------------------------------------+ |
|
15535 + |
|
15536 +This option must be supplied. Its value is a colon-separated list of host |
|
15537 +names. The hosts are looked up using gethostbyname() (or getipnodebyname() when |
|
15538 +available) and are tried in order until one responds to the query. If none |
|
15539 +respond, what happens is controlled by optional. |
|
15540 + |
|
15541 ++---------------------------------------------------+ |
|
15542 +|optional|Use: iplookup|Type: boolean|Default: false| |
|
15543 ++---------------------------------------------------+ |
|
15544 + |
|
15545 +If optional is true, if no response is obtained from any host, the address is |
|
15546 +passed to the next router, overriding no_more. If optional is false, delivery |
|
15547 +to the address is deferred. |
|
15548 + |
|
15549 ++-------------------------------------------+ |
|
15550 +|port|Use: iplookup|Type: integer|Default: 0| |
|
15551 ++-------------------------------------------+ |
|
15552 + |
|
15553 +This option must be supplied. It specifies the port number for the TCP or UDP |
|
15554 +call. |
|
15555 + |
|
15556 ++------------------------------------------------+ |
|
15557 +|protocol|Use: iplookup|Type: string|Default: udp| |
|
15558 ++------------------------------------------------+ |
|
15559 + |
|
15560 +This option can be set to "udp" or "tcp" to specify which of the two protocols |
|
15561 +is to be used. |
|
15562 + |
|
15563 ++----------------------------------------------------+ |
|
15564 +|query|Use: iplookup|Type: string*|Default: see below| |
|
15565 ++----------------------------------------------------+ |
|
15566 + |
|
15567 +This defines the content of the query that is sent to the remote hosts. The |
|
15568 +default value is: |
|
15569 + |
|
15570 +$local_part@$domain $local_part@$domain |
|
15571 + |
|
15572 +The repetition serves as a way of checking that a response is to the correct |
|
15573 +query in the default case (see response_pattern below). |
|
15574 + |
|
15575 ++--------------------------------------------------+ |
|
15576 +|reroute|Use: iplookup|Type: string*|Default: unset| |
|
15577 ++--------------------------------------------------+ |
|
15578 + |
|
15579 +If this option is not set, the rerouted address is precisely the byte string |
|
15580 +returned by the remote host, up to the first white space, if any. If set, the |
|
15581 +string is expanded to form the rerouted address. It can include parts matched |
|
15582 +in the response by response_pattern by means of numeric variables such as $1, |
|
15583 +$2, etc. The variable $0 refers to the entire input string, whether or not a |
|
15584 +pattern is in use. In all cases, the rerouted address must end up in the form |
|
15585 +local_part@domain. |
|
15586 + |
|
15587 ++----------------------------------------------------------+ |
|
15588 +|response_pattern|Use: iplookup|Type: string|Default: unset| |
|
15589 ++----------------------------------------------------------+ |
|
15590 + |
|
15591 +This option can be set to a regular expression that is applied to the string |
|
15592 +returned from the remote host. If the pattern does not match the response, the |
|
15593 +router declines. If response_pattern is not set, no checking of the response is |
|
15594 +done, unless the query was defaulted, in which case there is a check that the |
|
15595 +text returned after the first white space is the original address. This checks |
|
15596 +that the answer that has been received is in response to the correct question. |
|
15597 +For example, if the response is just a new domain, the following could be used: |
|
15598 + |
|
15599 +response_pattern = ^([^@]+)$ |
|
15600 +reroute = $local_part@$1 |
|
15601 + |
|
15602 ++--------------------------------------------+ |
|
15603 +|timeout|Use: iplookup|Type: time|Default: 5s| |
|
15604 ++--------------------------------------------+ |
|
15605 + |
|
15606 +This specifies the amount of time to wait for a response from the remote |
|
15607 +machine. The same timeout is used for the connect() function for a TCP call. It |
|
15608 +does not apply to UDP. |
|
15609 + |
|
15610 +20. The manualroute router |
|
15611 + |
|
15612 +The manualroute router is so-called because it provides a way of manually |
|
15613 +routing an address according to its domain. It is mainly used when you want to |
|
15614 +route addresses to remote hosts according to your own rules, bypassing the |
|
15615 +normal DNS routing that looks up MX records. However, manualroute can also |
|
15616 +route to local transports, a facility that may be useful if you want to save |
|
15617 +messages for dial-in hosts in local files. |
|
15618 + |
|
15619 +The manualroute router compares a list of domain patterns with the domain it is |
|
15620 +trying to route. If there is no match, the router declines. Each pattern has |
|
15621 +associated with it a list of hosts and some other optional data, which may |
|
15622 +include a transport. The combination of a pattern and its data is called a |
|
15623 +"routing rule". For patterns that do not have an associated transport, the |
|
15624 +generic transport option must specify a transport, unless the router is being |
|
15625 +used purely for verification (see verify_only). |
|
15626 + |
|
15627 +In the case of verification, matching the domain pattern is sufficient for the |
|
15628 +router to accept the address. When actually routing an address for delivery, an |
|
15629 +address that matches a domain pattern is queued for the associated transport. |
|
15630 +If the transport is not a local one, a host list must be associated with the |
|
15631 +pattern; IP addresses are looked up for the hosts, and these are passed to the |
|
15632 +transport along with the mail address. For local transports, a host list is |
|
15633 +optional. If it is present, it is passed in $host as a single text string. |
|
15634 + |
|
15635 +The list of routing rules can be provided as an inline string in route_list, or |
|
15636 +the data can be obtained by looking up the domain in a file or database by |
|
15637 +setting route_data. Only one of these settings may appear in any one instance |
|
15638 +of manualroute. The format of routing rules is described below, following the |
|
15639 +list of private options. |
|
15640 + |
|
15641 +20.1Â Private options for manualroute |
|
15642 + |
|
15643 +The private options for the manualroute router are as follows: |
|
15644 + |
|
15645 ++-------------------------------------------------------------+ |
|
15646 +|host_all_ignored|Use: manualroute|Type: string|Default: defer| |
|
15647 ++-------------------------------------------------------------+ |
|
15648 + |
|
15649 +See host_find_failed. |
|
15650 + |
|
15651 ++--------------------------------------------------------------+ |
|
15652 +|host_find_failed|Use: manualroute|Type: string|Default: freeze| |
|
15653 ++--------------------------------------------------------------+ |
|
15654 + |
|
15655 +This option controls what happens when manualroute tries to find an IP address |
|
15656 +for a host, and the host does not exist. The option can be set to one of the |
|
15657 +following values: |
|
15658 + |
|
15659 +decline |
|
15660 +defer |
|
15661 +fail |
|
15662 +freeze |
|
15663 +ignore |
|
15664 +pass |
|
15665 + |
|
15666 +The default ("freeze") assumes that this state is a serious configuration |
|
15667 +error. The difference between "pass" and "decline" is that the former forces |
|
15668 +the address to be passed to the next router (or the router defined by |
|
15669 +pass_router), overriding no_more, whereas the latter passes the address to the |
|
15670 +next router only if more is true. |
|
15671 + |
|
15672 +The value "ignore" causes Exim to completely ignore a host whose IP address |
|
15673 +cannot be found. If all the hosts in the list are ignored, the behaviour is |
|
15674 +controlled by the host_all_ignored option. This takes the same values as |
|
15675 +host_find_failed, except that it cannot be set to "ignore". |
|
15676 + |
|
15677 +The host_find_failed option applies only to a definite "does not exist" state; |
|
15678 +if a host lookup gets a temporary error, delivery is deferred unless the |
|
15679 +generic pass_on_timeout option is set. |
|
15680 + |
|
15681 ++-------------------------------------------------------------+ |
|
15682 +|hosts_randomize|Use: manualroute|Type: boolean|Default: false| |
|
15683 ++-------------------------------------------------------------+ |
|
15684 + |
|
15685 +If this option is set, the order of the items in a host list in a routing rule |
|
15686 +is randomized each time the list is used, unless an option in the routing rule |
|
15687 +overrides (see below). Randomizing the order of a host list can be used to do |
|
15688 +crude load sharing. However, if more than one mail address is routed by the |
|
15689 +same router to the same host list, the host lists are considered to be the same |
|
15690 +(even though they may be randomized into different orders) for the purpose of |
|
15691 +deciding whether to batch the deliveries into a single SMTP transaction. |
|
15692 + |
|
15693 +When hosts_randomize is true, a host list may be split into groups whose order |
|
15694 +is separately randomized. This makes it possible to set up MX-like behaviour. |
|
15695 +The boundaries between groups are indicated by an item that is just "+" in the |
|
15696 +host list. For example: |
|
15697 + |
|
15698 +route_list = * host1:host2:host3:+:host4:host5 |
|
15699 + |
|
15700 +The order of the first three hosts and the order of the last two hosts is |
|
15701 +randomized for each use, but the first three always end up before the last two. |
|
15702 +If hosts_randomize is not set, a "+" item in the list is ignored. If a |
|
15703 +randomized host list is passed to an smtp transport that also has |
|
15704 +hosts_randomize set, the list is not re-randomized. |
|
15705 + |
|
15706 ++--------------------------------------------------------+ |
|
15707 +|route_data|Use: manualroute|Type: string*|Default: unset| |
|
15708 ++--------------------------------------------------------+ |
|
15709 + |
|
15710 +If this option is set, it must expand to yield the data part of a routing rule. |
|
15711 +Typically, the expansion string includes a lookup based on the domain. For |
|
15712 +example: |
|
15713 + |
|
15714 +route_data = ${lookup{$domain}dbm{/etc/routes}} |
|
15715 + |
|
15716 +If the expansion is forced to fail, or the result is an empty string, the |
|
15717 +router declines. Other kinds of expansion failure cause delivery to be |
|
15718 +deferred. |
|
15719 + |
|
15720 ++------------------------------------------------------------+ |
|
15721 +|route_list|Use: manualroute|Type: string list|Default: unset| |
|
15722 ++------------------------------------------------------------+ |
|
15723 + |
|
15724 +This string is a list of routing rules, in the form defined below. Note that, |
|
15725 +unlike most string lists, the items are separated by semicolons. This is so |
|
15726 +that they may contain colon-separated host lists. |
|
15727 + |
|
15728 ++----------------------------------------------------------------------+ |
|
15729 +|same_domain_copy_routing|Use: manualroute|Type: boolean|Default: false| |
|
15730 ++----------------------------------------------------------------------+ |
|
15731 + |
|
15732 +Addresses with the same domain are normally routed by the manualroute router to |
|
15733 +the same list of hosts. However, this cannot be presumed, because the router |
|
15734 +options and preconditions may refer to the local part of the address. By |
|
15735 +default, therefore, Exim routes each address in a message independently. DNS |
|
15736 +servers run caches, so repeated DNS lookups are not normally expensive, and in |
|
15737 +any case, personal messages rarely have more than a few recipients. |
|
15738 + |
|
15739 +If you are running mailing lists with large numbers of subscribers at the same |
|
15740 +domain, and you are using a manualroute router which is independent of the |
|
15741 +local part, you can set same_domain_copy_routing to bypass repeated DNS lookups |
|
15742 +for identical domains in one message. In this case, when manualroute routes an |
|
15743 +address to a remote transport, any other unrouted addresses in the message that |
|
15744 +have the same domain are automatically given the same routing without |
|
15745 +processing them independently. However, this is only done if headers_add and |
|
15746 +headers_remove are unset. |
|
15747 + |
|
15748 +20.2Â Routing rules in route_list |
|
15749 + |
|
15750 +The value of route_list is a string consisting of a sequence of routing rules, |
|
15751 +separated by semicolons. If a semicolon is needed in a rule, it can be entered |
|
15752 +as two semicolons. Alternatively, the list separator can be changed as |
|
15753 +described (for colon-separated lists) in section 6.19. Empty rules are ignored. |
|
15754 +The format of each rule is |
|
15755 + |
|
15756 +<domain pattern>  <list of hosts>  <options> |
|
15757 + |
|
15758 +The following example contains two rules, each with a simple domain pattern and |
|
15759 +no options: |
|
15760 + |
|
15761 +route_list = \ |
|
15762 + dict.ref.example mail-1.ref.example:mail-2.ref.example ; \ |
|
15763 + thes.ref.example mail-3.ref.example:mail-4.ref.example |
|
15764 + |
|
15765 +The three parts of a rule are separated by white space. The pattern and the |
|
15766 +list of hosts can be enclosed in quotes if necessary, and if they are, the |
|
15767 +usual quoting rules apply. Each rule in a route_list must start with a single |
|
15768 +domain pattern, which is the only mandatory item in the rule. The pattern is in |
|
15769 +the same format as one item in a domain list (see section 10.8), except that it |
|
15770 +may not be the name of an interpolated file. That is, it may be wildcarded, or |
|
15771 +a regular expression, or a file or database lookup (with semicolons doubled, |
|
15772 +because of the use of semicolon as a separator in a route_list). |
|
15773 + |
|
15774 +The rules in route_list are searched in order until one of the patterns matches |
|
15775 +the domain that is being routed. The list of hosts and then options are then |
|
15776 +used as described below. If there is no match, the router declines. When |
|
15777 +route_list is set, route_data must not be set. |
|
15778 + |
|
15779 +20.3Â Routing rules in route_data |
|
15780 + |
|
15781 +The use of route_list is convenient when there are only a small number of |
|
15782 +routing rules. For larger numbers, it is easier to use a file or database to |
|
15783 +hold the routing information, and use the route_data option instead. The value |
|
15784 +of route_data is a list of hosts, followed by (optional) options. Most |
|
15785 +commonly, route_data is set as a string that contains an expansion lookup. For |
|
15786 +example, suppose we place two routing rules in a file like this: |
|
15787 + |
|
15788 +dict.ref.example: mail-1.ref.example:mail-2.ref.example |
|
15789 +thes.ref.example: mail-3.ref.example:mail-4.ref.example |
|
15790 + |
|
15791 +This data can be accessed by setting |
|
15792 + |
|
15793 +route_data = ${lookup{$domain}lsearch{/the/file/name}} |
|
15794 + |
|
15795 +Failure of the lookup results in an empty string, causing the router to |
|
15796 +decline. However, you do not have to use a lookup in route_data. The only |
|
15797 +requirement is that the result of expanding the string is a list of hosts, |
|
15798 +possibly followed by options, separated by white space. The list of hosts must |
|
15799 +be enclosed in quotes if it contains white space. |
|
15800 + |
|
15801 +20.4Â Format of the list of hosts |
|
15802 + |
|
15803 +A list of hosts, whether obtained via route_data or route_list, is always |
|
15804 +separately expanded before use. If the expansion fails, the router declines. |
|
15805 +The result of the expansion must be a colon-separated list of names and/or IP |
|
15806 +addresses, optionally also including ports. The format of each item in the list |
|
15807 +is described in the next section. The list separator can be changed as |
|
15808 +described in section 6.19. |
|
15809 + |
|
15810 +If the list of hosts was obtained from a route_list item, the following |
|
15811 +variables are set during its expansion: |
|
15812 + |
|
15813 + * If the domain was matched against a regular expression, the numeric |
|
15814 + variables $1, $2, etc. may be set. For example: |
|
15815 + |
|
15816 + route_list = ^domain(\d+) host-$1.text.example |
|
15817 + |
|
15818 + * $0 is always set to the entire domain. |
|
15819 + |
|
15820 + * $1 is also set when partial matching is done in a file lookup. |
|
15821 + |
|
15822 + * If the pattern that matched the domain was a lookup item, the data that was |
|
15823 + looked up is available in the expansion variable $value. For example: |
|
15824 + |
|
15825 + route_list = lsearch;;/some/file.routes $value |
|
15826 + |
|
15827 +Note the doubling of the semicolon in the pattern that is necessary because |
|
15828 +semicolon is the default route list separator. |
|
15829 + |
|
15830 +20.5Â Format of one host item |
|
15831 + |
|
15832 +Each item in the list of hosts is either a host name or an IP address, |
|
15833 +optionally with an attached port number. When no port is given, an IP address |
|
15834 +is not enclosed in brackets. When a port is specified, it overrides the port |
|
15835 +specification on the transport. The port is separated from the name or address |
|
15836 +by a colon. This leads to some complications: |
|
15837 + |
|
15838 + * Because colon is the default separator for the list of hosts, either the |
|
15839 + colon that specifies a port must be doubled, or the list separator must be |
|
15840 + changed. The following two examples have the same effect: |
|
15841 + |
|
15842 + route_list = * "host1.tld::1225 : host2.tld::1226" |
|
15843 + route_list = * "<+ host1.tld:1225 + host2.tld:1226" |
|
15844 + |
|
15845 + * When IPv6 addresses are involved, it gets worse, because they contain |
|
15846 + colons of their own. To make this case easier, it is permitted to enclose |
|
15847 + an IP address (either v4 or v6) in square brackets if a port number |
|
15848 + follows. For example: |
|
15849 + |
|
15850 + route_list = * "</ [10.1.1.1]:1225 / [::1]:1226" |
|
15851 + |
|
15852 +20.6Â How the list of hosts is used |
|
15853 + |
|
15854 +When an address is routed to an smtp transport by manualroute, each of the |
|
15855 +hosts is tried, in the order specified, when carrying out the SMTP delivery. |
|
15856 +However, the order can be changed by setting the hosts_randomize option, either |
|
15857 +on the router (see section 20.1 above), or on the transport. |
|
15858 + |
|
15859 +Hosts may be listed by name or by IP address. An unadorned name in the list of |
|
15860 +hosts is interpreted as a host name. A name that is followed by "/MX" is |
|
15861 +interpreted as an indirection to a sublist of hosts obtained by looking up MX |
|
15862 +records in the DNS. For example: |
|
15863 + |
|
15864 +route_list = * x.y.z:p.q.r/MX:e.f.g |
|
15865 + |
|
15866 +If this feature is used with a port specifier, the port must come last. For |
|
15867 +example: |
|
15868 + |
|
15869 +route_list = * dom1.tld/mx::1225 |
|
15870 + |
|
15871 +If the hosts_randomize option is set, the order of the items in the list is |
|
15872 +randomized before any lookups are done. Exim then scans the list; for any name |
|
15873 +that is not followed by "/MX" it looks up an IP address. If this turns out to |
|
15874 +be an interface on the local host and the item is not the first in the list, |
|
15875 +Exim discards it and any subsequent items. If it is the first item, what |
|
15876 +happens is controlled by the self option of the router. |
|
15877 + |
|
15878 +A name on the list that is followed by "/MX" is replaced with the list of hosts |
|
15879 +obtained by looking up MX records for the name. This is always a DNS lookup; |
|
15880 +the bydns and byname options (see section 20.7 below) are not relevant here. |
|
15881 +The order of these hosts is determined by the preference values in the MX |
|
15882 +records, according to the usual rules. Because randomizing happens before the |
|
15883 +MX lookup, it does not affect the order that is defined by MX preferences. |
|
15884 + |
|
15885 +If the local host is present in the sublist obtained from MX records, but is |
|
15886 +not the most preferred host in that list, it and any equally or less preferred |
|
15887 +hosts are removed before the sublist is inserted into the main list. |
|
15888 + |
|
15889 +If the local host is the most preferred host in the MX list, what happens |
|
15890 +depends on where in the original list of hosts the "/MX" item appears. If it is |
|
15891 +not the first item (that is, there are previous hosts in the main list), Exim |
|
15892 +discards this name and any subsequent items in the main list. |
|
15893 + |
|
15894 +If the MX item is first in the list of hosts, and the local host is the most |
|
15895 +preferred host, what happens is controlled by the self option of the router. |
|
15896 + |
|
15897 +DNS failures when lookup up the MX records are treated in the same way as DNS |
|
15898 +failures when looking up IP addresses: pass_on_timeout and host_find_failed are |
|
15899 +used when relevant. |
|
15900 + |
|
15901 +The generic ignore_target_hosts option applies to all hosts in the list, |
|
15902 +whether obtained from an MX lookup or not. |
|
15903 + |
|
15904 +20.7Â How the options are used |
|
15905 + |
|
15906 +The options are a sequence of words; in practice no more than three are ever |
|
15907 +present. One of the words can be the name of a transport; this overrides the |
|
15908 +transport option on the router for this particular routing rule only. The other |
|
15909 +words (if present) control randomization of the list of hosts on a per-rule |
|
15910 +basis, and how the IP addresses of the hosts are to be found when routing to a |
|
15911 +remote transport. These options are as follows: |
|
15912 + |
|
15913 + * randomize: randomize the order of the hosts in this list, overriding the |
|
15914 + setting of hosts_randomize for this routing rule only. |
|
15915 + |
|
15916 + * no_randomize: do not randomize the order of the hosts in this list, |
|
15917 + overriding the setting of hosts_randomize for this routing rule only. |
|
15918 + |
|
15919 + * byname: use getipnodebyname() (gethostbyname() on older systems) to find IP |
|
15920 + addresses. This function may ultimately cause a DNS lookup, but it may also |
|
15921 + look in /etc/hosts or other sources of information. |
|
15922 + |
|
15923 + * bydns: look up address records for the hosts directly in the DNS; fail if |
|
15924 + no address records are found. If there is a temporary DNS error (such as a |
|
15925 + timeout), delivery is deferred. |
|
15926 + |
|
15927 +For example: |
|
15928 + |
|
15929 +route_list = domain1 host1:host2:host3 randomize bydns;\ |
|
15930 + domain2 host4:host5 |
|
15931 + |
|
15932 +If neither byname nor bydns is given, Exim behaves as follows: First, a DNS |
|
15933 +lookup is done. If this yields anything other than HOST_NOT_FOUND, that result |
|
15934 +is used. Otherwise, Exim goes on to try a call to getipnodebyname() or |
|
15935 +gethostbyname(), and the result of the lookup is the result of that call. |
|
15936 + |
|
15937 +Warning: It has been discovered that on some systems, if a DNS lookup called |
|
15938 +via getipnodebyname() times out, HOST_NOT_FOUND is returned instead of |
|
15939 +TRY_AGAIN. That is why the default action is to try a DNS lookup first. Only if |
|
15940 +that gives a definite "no such host" is the local function called. |
|
15941 + |
|
15942 +If no IP address for a host can be found, what happens is controlled by the |
|
15943 +host_find_failed option. |
|
15944 + |
|
15945 +When an address is routed to a local transport, IP addresses are not looked up. |
|
15946 +The host list is passed to the transport in the $host variable. |
|
15947 + |
|
15948 +20.8Â Manualroute examples |
|
15949 + |
|
15950 +In some of the examples that follow, the presence of the remote_smtp transport, |
|
15951 +as defined in the default configuration file, is assumed: |
|
15952 + |
|
15953 + * The manualroute router can be used to forward all external mail to a smart |
|
15954 + host. If you have set up, in the main part of the configuration, a named |
|
15955 + domain list that contains your local domains, for example: |
|
15956 + |
|
15957 + domainlist local_domains = my.domain.example |
|
15958 + |
|
15959 + You can arrange for all other domains to be routed to a smart host by |
|
15960 + making your first router something like this: |
|
15961 + |
|
15962 + smart_route: |
|
15963 + driver = manualroute |
|
15964 + domains = !+local_domains |
|
15965 + transport = remote_smtp |
|
15966 + route_list = * smarthost.ref.example |
|
15967 + |
|
15968 + This causes all non-local addresses to be sent to the single host |
|
15969 + smarthost.ref.example. If a colon-separated list of smart hosts is given, |
|
15970 + they are tried in order (but you can use hosts_randomize to vary the order |
|
15971 + each time). Another way of configuring the same thing is this: |
|
15972 + |
|
15973 + smart_route: |
|
15974 + driver = manualroute |
|
15975 + transport = remote_smtp |
|
15976 + route_list = !+local_domains smarthost.ref.example |
|
15977 + |
|
15978 + There is no difference in behaviour between these two routers as they |
|
15979 + stand. However, they behave differently if no_more is added to them. In the |
|
15980 + first example, the router is skipped if the domain does not match the |
|
15981 + domains precondition; the following router is always tried. If the router |
|
15982 + runs, it always matches the domain and so can never decline. Therefore, |
|
15983 + no_more would have no effect. In the second case, the router is never |
|
15984 + skipped; it always runs. However, if it doesn't match the domain, it |
|
15985 + declines. In this case no_more would prevent subsequent routers from |
|
15986 + running. |
|
15987 + |
|
15988 + * A mail hub is a host which receives mail for a number of domains via MX |
|
15989 + records in the DNS and delivers it via its own private routing mechanism. |
|
15990 + Often the final destinations are behind a firewall, with the mail hub being |
|
15991 + the one machine that can connect to machines both inside and outside the |
|
15992 + firewall. The manualroute router is usually used on a mail hub to route |
|
15993 + incoming messages to the correct hosts. For a small number of domains, the |
|
15994 + routing can be inline, using the route_list option, but for a larger number |
|
15995 + a file or database lookup is easier to manage. |
|
15996 + |
|
15997 + If the domain names are in fact the names of the machines to which the mail |
|
15998 + is to be sent by the mail hub, the configuration can be quite simple. For |
|
15999 + example: |
|
16000 + |
|
16001 + hub_route: |
|
16002 + driver = manualroute |
|
16003 + transport = remote_smtp |
|
16004 + route_list = *.rhodes.tvs.example $domain |
|
16005 + |
|
16006 + This configuration routes domains that match "*.rhodes.tvs.example" to |
|
16007 + hosts whose names are the same as the mail domains. A similar approach can |
|
16008 + be taken if the host name can be obtained from the domain name by a string |
|
16009 + manipulation that the expansion facilities can handle. Otherwise, a lookup |
|
16010 + based on the domain can be used to find the host: |
|
16011 + |
|
16012 + through_firewall: |
|
16013 + driver = manualroute |
|
16014 + transport = remote_smtp |
|
16015 + route_data = ${lookup {$domain} cdb {/internal/host/routes}} |
|
16016 + |
|
16017 + The result of the lookup must be the name or IP address of the host (or |
|
16018 + hosts) to which the address is to be routed. If the lookup fails, the route |
|
16019 + data is empty, causing the router to decline. The address then passes to |
|
16020 + the next router. |
|
16021 + |
|
16022 + * You can use manualroute to deliver messages to pipes or files in batched |
|
16023 + SMTP format for onward transportation by some other means. This is one way |
|
16024 + of storing mail for a dial-up host when it is not connected. The route list |
|
16025 + entry can be as simple as a single domain name in a configuration like |
|
16026 + this: |
|
16027 + |
|
16028 + save_in_file: |
|
16029 + driver = manualroute |
|
16030 + transport = batchsmtp_appendfile |
|
16031 + route_list = saved.domain.example |
|
16032 + |
|
16033 + though often a pattern is used to pick up more than one domain. If there |
|
16034 + are several domains or groups of domains with different transport |
|
16035 + requirements, different transports can be listed in the routing |
|
16036 + information: |
|
16037 + |
|
16038 + save_in_file: |
|
16039 + driver = manualroute |
|
16040 + route_list = \ |
|
16041 + *.saved.domain1.example $domain batch_appendfile; \ |
|
16042 + *.saved.domain2.example \ |
|
16043 + ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \ |
|
16044 + batch_pipe |
|
16045 + |
|
16046 + The first of these just passes the domain in the $host variable, which |
|
16047 + doesn't achieve much (since it is also in $domain), but the second does a |
|
16048 + file lookup to find a value to pass, causing the router to decline to |
|
16049 + handle the address if the lookup fails. |
|
16050 + |
|
16051 + * Routing mail directly to UUCP software is a specific case of the use of |
|
16052 + manualroute in a gateway to another mail environment. This is an example of |
|
16053 + one way it can be done: |
|
16054 + |
|
16055 + # Transport |
|
16056 + uucp: |
|
16057 + driver = pipe |
|
16058 + user = nobody |
|
16059 + command = /usr/local/bin/uux -r - \ |
|
16060 + ${substr_-5:$host}!rmail ${local_part} |
|
16061 + return_fail_output = true |
|
16062 + |
|
16063 + # Router |
|
16064 + uucphost: |
|
16065 + transport = uucp |
|
16066 + driver = manualroute |
|
16067 + route_data = \ |
|
16068 + ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}} |
|
16069 + |
|
16070 + The file /usr/local/exim/uucphosts contains entries like |
|
16071 + |
|
16072 + darksite.ethereal.example: darksite.UUCP |
|
16073 + |
|
16074 + It can be set up more simply without adding and removing ".UUCP" but this |
|
16075 + way makes clear the distinction between the domain name |
|
16076 + darksite.ethereal.example and the UUCP host name darksite. |
|
16077 + |
|
16078 +21. The queryprogram router |
|
16079 + |
|
16080 +The queryprogram router routes an address by running an external command and |
|
16081 +acting on its output. This is an expensive way to route, and is intended mainly |
|
16082 +for use in lightly-loaded systems, or for performing experiments. However, if |
|
16083 +it is possible to use the precondition options (domains, local_parts, etc) to |
|
16084 +skip this router for most addresses, it could sensibly be used in special |
|
16085 +cases, even on a busy host. There are the following private options: |
|
16086 + |
|
16087 ++------------------------------------------------------+ |
|
16088 +|command|Use: queryprogram|Type: string*|Default: unset| |
|
16089 ++------------------------------------------------------+ |
|
16090 + |
|
16091 +This option must be set. It specifies the command that is to be run. The |
|
16092 +command is split up into a command name and arguments, and then each is |
|
16093 +expanded separately (exactly as for a pipe transport, described in chapter 29). |
|
16094 + |
|
16095 ++-----------------------------------------------------------+ |
|
16096 +|command_group|Use: queryprogram|Type: string|Default: unset| |
|
16097 ++-----------------------------------------------------------+ |
|
16098 + |
|
16099 +This option specifies a gid to be set when running the command while routing an |
|
16100 +address for deliver. It must be set if command_user specifies a numerical uid. |
|
16101 +If it begins with a digit, it is interpreted as the numerical value of the gid. |
|
16102 +Otherwise it is looked up using getgrnam(). |
|
16103 + |
|
16104 ++----------------------------------------------------------+ |
|
16105 +|command_user|Use: queryprogram|Type: string|Default: unset| |
|
16106 ++----------------------------------------------------------+ |
|
16107 + |
|
16108 +This option must be set. It specifies the uid which is set when running the |
|
16109 +command while routing an address for delivery. If the value begins with a |
|
16110 +digit, it is interpreted as the numerical value of the uid. Otherwise, it is |
|
16111 +looked up using getpwnam() to obtain a value for the uid and, if command_group |
|
16112 +is not set, a value for the gid also. |
|
16113 + |
|
16114 +Warning: Changing uid and gid is possible only when Exim is running as root, |
|
16115 +which it does during a normal delivery in a conventional configuration. |
|
16116 +However, when an address is being verified during message reception, Exim is |
|
16117 +usually running as the Exim user, not as root. If the queryprogram router is |
|
16118 +called from a non-root process, Exim cannot change uid or gid before running |
|
16119 +the command. In this circumstance the command runs under the current uid and |
|
16120 +gid. |
|
16121 + |
|
16122 ++-----------------------------------------------------------+ |
|
16123 +|current_directory|Use: queryprogram|Type: string|Default: /| |
|
16124 ++-----------------------------------------------------------+ |
|
16125 + |
|
16126 +This option specifies an absolute path which is made the current directory |
|
16127 +before running the command. |
|
16128 + |
|
16129 ++------------------------------------------------+ |
|
16130 +|timeout|Use: queryprogram|Type: time|Default: 1h| |
|
16131 ++------------------------------------------------+ |
|
16132 + |
|
16133 +If the command does not complete within the timeout period, its process group |
|
16134 +is killed and the message is frozen. A value of zero time specifies no timeout. |
|
16135 + |
|
16136 +The standard output of the command is connected to a pipe, which is read when |
|
16137 +the command terminates. It should consist of a single line of output, |
|
16138 +containing up to five fields, separated by white space. The maximum length of |
|
16139 +the line is 1023 characters. Longer lines are silently truncated. The first |
|
16140 +field is one of the following words (case-insensitive): |
|
16141 + |
|
16142 + * Accept: routing succeeded; the remaining fields specify what to do (see |
|
16143 + below). |
|
16144 + |
|
16145 + * Decline: the router declines; pass the address to the next router, unless |
|
16146 + no_more is set. |
|
16147 + |
|
16148 + * Fail: routing failed; do not pass the address to any more routers. Any |
|
16149 + subsequent text on the line is an error message. If the router is run as |
|
16150 + part of address verification during an incoming SMTP message, the message |
|
16151 + is included in the SMTP response. |
|
16152 + |
|
16153 + * Defer: routing could not be completed at this time; try again later. Any |
|
16154 + subsequent text on the line is an error message which is logged. It is not |
|
16155 + included in any SMTP response. |
|
16156 + |
|
16157 + * Freeze: the same as defer, except that the message is frozen. |
|
16158 + |
|
16159 + * Pass: pass the address to the next router (or the router specified by |
|
16160 + pass_router), overriding no_more. |
|
16161 + |
|
16162 + * Redirect: the message is redirected. The remainder of the line is a list of |
|
16163 + new addresses, which are routed independently, starting with the first |
|
16164 + router, or the router specified by redirect_router, if set. |
|
16165 + |
|
16166 +When the first word is accept, the remainder of the line consists of a number |
|
16167 +of keyed data values, as follows (split into two lines here, to fit on the |
|
16168 +page): |
|
16169 + |
|
16170 +ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts> |
|
16171 +LOOKUP=byname|bydns DATA=<text> |
|
16172 + |
|
16173 +The data items can be given in any order, and all are optional. If no transport |
|
16174 +is included, the transport specified by the generic transport option is used. |
|
16175 +The list of hosts and the lookup type are needed only if the transport is an |
|
16176 +smtp transport that does not itself supply a list of hosts. |
|
16177 + |
|
16178 +The format of the list of hosts is the same as for the manualroute router. As |
|
16179 +well as host names and IP addresses with optional port numbers, as described in |
|
16180 +section 20.5, it may contain names followed by "/MX" to specify sublists of |
|
16181 +hosts that are obtained by looking up MX records (see section 20.6). |
|
16182 + |
|
16183 +If the lookup type is not specified, Exim behaves as follows when trying to |
|
16184 +find an IP address for each host: First, a DNS lookup is done. If this yields |
|
16185 +anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim goes |
|
16186 +on to try a call to getipnodebyname() or gethostbyname(), and the result of the |
|
16187 +lookup is the result of that call. |
|
16188 + |
|
16189 +If the DATA field is set, its value is placed in the $address_data variable. |
|
16190 +For example, this return line |
|
16191 + |
|
16192 +accept hosts=x1.y.example:x2.y.example data="rule1" |
|
16193 + |
|
16194 +routes the address to the default transport, passing a list of two hosts. When |
|
16195 +the transport runs, the string "rule1" is in $address_data. |
|
16196 + |
|
16197 +22. The redirect router |
|
16198 + |
|
16199 +The redirect router handles several kinds of address redirection. Its most |
|
16200 +common uses are for resolving local part aliases from a central alias file |
|
16201 +(usually called /etc/aliases) and for handling users' personal .forward files, |
|
16202 +but it has many other potential uses. The incoming address can be redirected in |
|
16203 +several different ways: |
|
16204 + |
|
16205 + * It can be replaced by one or more new addresses which are themselves routed |
|
16206 + independently. |
|
16207 + |
|
16208 + * It can be routed to be delivered to a given file or directory. |
|
16209 + |
|
16210 + * It can be routed to be delivered to a specified pipe command. |
|
16211 + |
|
16212 + * It can cause an automatic reply to be generated. |
|
16213 + |
|
16214 + * It can be forced to fail, optionally with a custom error message. |
|
16215 + |
|
16216 + * It can be temporarily deferred, optionally with a custom message. |
|
16217 + |
|
16218 + * It can be discarded. |
|
16219 + |
|
16220 +The generic transport option must not be set for redirect routers. However, |
|
16221 +there are some private options which define transports for delivery to files |
|
16222 +and pipes, and for generating autoreplies. See the file_transport, |
|
16223 +pipe_transport and reply_transport descriptions below. |
|
16224 + |
|
16225 +22.1Â Redirection data |
|
16226 + |
|
16227 +The router operates by interpreting a text string which it obtains either by |
|
16228 +expanding the contents of the data option, or by reading the entire contents of |
|
16229 +a file whose name is given in the file option. These two options are mutually |
|
16230 +exclusive. The first is commonly used for handling system aliases, in a |
|
16231 +configuration like this: |
|
16232 + |
|
16233 +system_aliases: |
|
16234 + driver = redirect |
|
16235 + data = ${lookup{$local_part}lsearch{/etc/aliases}} |
|
16236 + |
|
16237 +If the lookup fails, the expanded string in this example is empty. When the |
|
16238 +expansion of data results in an empty string, the router declines. A forced |
|
16239 +expansion failure also causes the router to decline; other expansion failures |
|
16240 +cause delivery to be deferred. |
|
16241 + |
|
16242 +A configuration using file is commonly used for handling users' .forward files, |
|
16243 +like this: |
|
16244 + |
|
16245 +userforward: |
|
16246 + driver = redirect |
|
16247 + check_local_user |
|
16248 + file = $home/.forward |
|
16249 + no_verify |
|
16250 + |
|
16251 +If the file does not exist, or causes no action to be taken (for example, it is |
|
16252 +empty or consists only of comments), the router declines. Warning: This is not |
|
16253 +the case when the file contains syntactically valid items that happen to yield |
|
16254 +empty addresses, for example, items containing only RFC 2822 address comments. |
|
16255 + |
|
16256 +22.2Â Forward files and address verification |
|
16257 + |
|
16258 +It is usual to set no_verify on redirect routers which handle users' .forward |
|
16259 +files, as in the example above. There are two reasons for this: |
|
16260 + |
|
16261 + * When Exim is receiving an incoming SMTP message from a remote host, it is |
|
16262 + running under the Exim uid, not as root. Exim is unable to change uid to |
|
16263 + read the file as the user, and it may not be able to read it as the Exim |
|
16264 + user. So in practice the router may not be able to operate. |
|
16265 + |
|
16266 + * However, even when the router can operate, the existence of a .forward file |
|
16267 + is unimportant when verifying an address. What should be checked is whether |
|
16268 + the local part is a valid user name or not. Cutting out the redirection |
|
16269 + processing saves some resources. |
|
16270 + |
|
16271 +22.3Â Interpreting redirection data |
|
16272 + |
|
16273 +The contents of the data string, whether obtained from data or file, can be |
|
16274 +interpreted in two different ways: |
|
16275 + |
|
16276 + * If the allow_filter option is set true, and the data begins with the text " |
|
16277 + #Exim filter" or "#Sieve filter", it is interpreted as a list of filtering |
|
16278 + instructions in the form of an Exim or Sieve filter file, respectively. |
|
16279 + Details of the syntax and semantics of filter files are described in a |
|
16280 + separate document entitled Exim's interfaces to mail filtering; this |
|
16281 + document is intended for use by end users. |
|
16282 + |
|
16283 + * Otherwise, the data must be a comma-separated list of redirection items, as |
|
16284 + described in the next section. |
|
16285 + |
|
16286 +When a message is redirected to a file (a "mail folder"), the file name given |
|
16287 +in a non-filter redirection list must always be an absolute path. A filter may |
|
16288 +generate a relative path - how this is handled depends on the transport's |
|
16289 +configuration. See section 26.1 for a discussion of this issue for the |
|
16290 +appendfile transport. |
|
16291 + |
|
16292 +22.4Â Items in a non-filter redirection list |
|
16293 + |
|
16294 +When the redirection data is not an Exim or Sieve filter, for example, if it |
|
16295 +comes from a conventional alias or forward file, it consists of a list of |
|
16296 +addresses, file names, pipe commands, or certain special items (see section |
|
16297 +22.6 below). The special items can be individually enabled or disabled by means |
|
16298 +of options whose names begin with allow_ or forbid_, depending on their default |
|
16299 +values. The items in the list are separated by commas or newlines. If a comma |
|
16300 +is required in an item, the entire item must be enclosed in double quotes. |
|
16301 + |
|
16302 +Lines starting with a # character are comments, and are ignored, and # may also |
|
16303 +appear following a comma, in which case everything between the # and the next |
|
16304 +newline character is ignored. |
|
16305 + |
|
16306 +If an item is entirely enclosed in double quotes, these are removed. Otherwise |
|
16307 +double quotes are retained because some forms of mail address require their use |
|
16308 +(but never to enclose the entire address). In the following description, "item" |
|
16309 +refers to what remains after any surrounding double quotes have been removed. |
|
16310 + |
|
16311 +Warning: If you use an Exim expansion to construct a redirection address, and |
|
16312 +the expansion contains a reference to $local_part, you should make use of the |
|
16313 +quote_local_part expansion operator, in case the local part contains special |
|
16314 +characters. For example, to redirect all mail for the domain obsolete.example, |
|
16315 +retaining the existing local part, you could use this setting: |
|
16316 + |
|
16317 +data = ${quote_local_part:$local_part}@newdomain.example |
|
16318 + |
|
16319 +22.5Â Redirecting to a local mailbox |
|
16320 + |
|
16321 +A redirection item may safely be the same as the address currently under |
|
16322 +consideration. This does not cause a routing loop, because a router is |
|
16323 +automatically skipped if any ancestor of the address that is being processed is |
|
16324 +the same as the current address and was processed by the current router. Such |
|
16325 +an address is therefore passed to the following routers, so it is handled as if |
|
16326 +there were no redirection. When making this loop-avoidance test, the complete |
|
16327 +local part, including any prefix or suffix, is used. |
|
16328 + |
|
16329 +Specifying the same local part without a domain is a common usage in personal |
|
16330 +filter files when the user wants to have messages delivered to the local |
|
16331 +mailbox and also forwarded elsewhere. For example, the user whose login is cleo |
|
16332 +might have a .forward file containing this: |
|
16333 + |
|
16334 +cleo, cleopatra@egypt.example |
|
16335 + |
|
16336 +For compatibility with other MTAs, such unqualified local parts may be preceded |
|
16337 +by "\", but this is not a requirement for loop prevention. However, it does |
|
16338 +make a difference if more than one domain is being handled synonymously. |
|
16339 + |
|
16340 +If an item begins with "\" and the rest of the item parses as a valid RFC 2822 |
|
16341 +address that does not include a domain, the item is qualified using the domain |
|
16342 +of the incoming address. In the absence of a leading "\", unqualified addresses |
|
16343 +are qualified using the value in qualify_recipient, but you can force the |
|
16344 +incoming domain to be used by setting qualify_preserve_domain. |
|
16345 + |
|
16346 +Care must be taken if there are alias names for local users. Consider an MTA |
|
16347 +handling a single local domain where the system alias file contains: |
|
16348 + |
|
16349 +Sam.Reman: spqr |
|
16350 + |
|
16351 +Now suppose that Sam (whose login id is spqr) wants to save copies of messages |
|
16352 +in the local mailbox, and also forward copies elsewhere. He creates this |
|
16353 +forward file: |
|
16354 + |
|
16355 +Sam.Reman, spqr@reme.elsewhere.example |
|
16356 + |
|
16357 +With these settings, an incoming message addressed to Sam.Reman fails. The |
|
16358 +redirect router for system aliases does not process Sam.Reman the second time |
|
16359 +round, because it has previously routed it, and the following routers |
|
16360 +presumably cannot handle the alias. The forward file should really contain |
|
16361 + |
|
16362 +spqr, spqr@reme.elsewhere.example |
|
16363 + |
|
16364 +but because this is such a common error, the check_ancestor option (see below) |
|
16365 +exists to provide a way to get round it. This is normally set on a redirect |
|
16366 +router that is handling users' .forward files. |
|
16367 + |
|
16368 +22.6Â Special items in redirection lists |
|
16369 + |
|
16370 +In addition to addresses, the following types of item may appear in redirection |
|
16371 +lists (that is, in non-filter redirection data): |
|
16372 + |
|
16373 + * An item is treated as a pipe command if it begins with "|" and does not |
|
16374 + parse as a valid RFC 2822 address that includes a domain. A transport for |
|
16375 + running the command must be specified by the pipe_transport option. |
|
16376 + Normally, either the router or the transport specifies a user and a group |
|
16377 + under which to run the delivery. The default is to use the Exim user and |
|
16378 + group. |
|
16379 + |
|
16380 + Single or double quotes can be used for enclosing the individual arguments |
|
16381 + of the pipe command; no interpretation of escapes is done for single |
|
16382 + quotes. If the command contains a comma character, it is necessary to put |
|
16383 + the whole item in double quotes, for example: |
|
16384 + |
|
16385 + "|/some/command ready,steady,go" |
|
16386 + |
|
16387 + since items in redirection lists are terminated by commas. Do not, however, |
|
16388 + quote just the command. An item such as |
|
16389 + |
|
16390 + |"/some/command ready,steady,go" |
|
16391 + |
|
16392 + is interpreted as a pipe with a rather strange command name, and no |
|
16393 + arguments. |
|
16394 + |
|
16395 + * An item is interpreted as a path name if it begins with "/" and does not |
|
16396 + parse as a valid RFC 2822 address that includes a domain. For example, |
|
16397 + |
|
16398 + /home/world/minbari |
|
16399 + |
|
16400 + is treated as a file name, but |
|
16401 + |
|
16402 + /s=molari/o=babylon/@x400gate.way |
|
16403 + |
|
16404 + is treated as an address. For a file name, a transport must be specified |
|
16405 + using the file_transport option. However, if the generated path name ends |
|
16406 + with a forward slash character, it is interpreted as a directory name |
|
16407 + rather than a file name, and directory_transport is used instead. |
|
16408 + |
|
16409 + Normally, either the router or the transport specifies a user and a group |
|
16410 + under which to run the delivery. The default is to use the Exim user and |
|
16411 + group. |
|
16412 + |
|
16413 + However, if a redirection item is the path /dev/null, delivery to it is |
|
16414 + bypassed at a high level, and the log entry shows "**bypassed**" instead of |
|
16415 + a transport name. In this case the user and group are not used. |
|
16416 + |
|
16417 + * If an item is of the form |
|
16418 + |
|
16419 + :include:<path name> |
|
16420 + |
|
16421 + a list of further items is taken from the given file and included at that |
|
16422 + point. Note: Such a file can not be a filter file; it is just an |
|
16423 + out-of-line addition to the list. The items in the included list are |
|
16424 + separated by commas or newlines and are not subject to expansion. If this |
|
16425 + is the first item in an alias list in an lsearch file, a colon must be used |
|
16426 + to terminate the alias name. This example is incorrect: |
|
16427 + |
|
16428 + list1 :include:/opt/lists/list1 |
|
16429 + |
|
16430 + It must be given as |
|
16431 + |
|
16432 + list1: :include:/opt/lists/list1 |
|
16433 + |
|
16434 + * Sometimes you want to throw away mail to a particular local part. Making |
|
16435 + the data option expand to an empty string does not work, because that |
|
16436 + causes the router to decline. Instead, the alias item :blackhole: can be |
|
16437 + used. It does what its name implies. No delivery is done, and no error |
|
16438 + message is generated. This has the same effect as specifing /dev/null as a |
|
16439 + destination, but it can be independently disabled. |
|
16440 + |
|
16441 + Warning: If :blackhole: appears anywhere in a redirection list, no delivery |
|
16442 + is done for the original local part, even if other redirection items are |
|
16443 + present. If you are generating a multi-item list (for example, by reading a |
|
16444 + database) and need the ability to provide a no-op item, you must use /dev/ |
|
16445 + null. |
|
16446 + |
|
16447 + * An attempt to deliver a particular address can be deferred or forced to |
|
16448 + fail by redirection items of the form |
|
16449 + |
|
16450 + :defer: |
|
16451 + :fail: |
|
16452 + |
|
16453 + respectively. When a redirection list contains such an item, it applies to |
|
16454 + the entire redirection; any other items in the list are ignored. Any text |
|
16455 + following :fail: or :defer: is placed in the error text associated with the |
|
16456 + failure. For example, an alias file might contain: |
|
16457 + |
|
16458 + X.Employee: :fail: Gone away, no forwarding address |
|
16459 + |
|
16460 + In the case of an address that is being verified from an ACL or as the |
|
16461 + subject of a VRFY command, the text is included in the SMTP error response |
|
16462 + by default. The text is not included in the response to an EXPN command. In |
|
16463 + non-SMTP cases the text is included in the error message that Exim |
|
16464 + generates. |
|
16465 + |
|
16466 + By default, Exim sends a 451 SMTP code for a :defer:, and 550 for :fail:. |
|
16467 + However, if the message starts with three digits followed by a space, |
|
16468 + optionally followed by an extended code of the form n.n.n, also followed by |
|
16469 + a space, and the very first digit is the same as the default error code, |
|
16470 + the code from the message is used instead. If the very first digit is |
|
16471 + incorrect, a panic error is logged, and the default code is used. You can |
|
16472 + suppress the use of the supplied code in a redirect router by setting the |
|
16473 + forbid_smtp_code option true. In this case, any SMTP code is quietly |
|
16474 + ignored. |
|
16475 + |
|
16476 + In an ACL, an explicitly provided message overrides the default, but the |
|
16477 + default message is available in the variable $acl_verify_message and can |
|
16478 + therefore be included in a custom message if this is desired. |
|
16479 + |
|
16480 + Normally the error text is the rest of the redirection list - a comma does |
|
16481 + not terminate it - but a newline does act as a terminator. Newlines are not |
|
16482 + normally present in alias expansions. In lsearch lookups they are removed |
|
16483 + as part of the continuation process, but they may exist in other kinds of |
|
16484 + lookup and in :include: files. |
|
16485 + |
|
16486 + During routing for message delivery (as opposed to verification), a |
|
16487 + redirection containing :fail: causes an immediate failure of the incoming |
|
16488 + address, whereas :defer: causes the message to remain on the queue so that |
|
16489 + a subsequent delivery attempt can happen at a later time. If an address is |
|
16490 + deferred for too long, it will ultimately fail, because the normal retry |
|
16491 + rules still apply. |
|
16492 + |
|
16493 + * Sometimes it is useful to use a single-key search type with a default (see |
|
16494 + chapter 9) to look up aliases. However, there may be a need for exceptions |
|
16495 + to the default. These can be handled by aliasing them to :unknown:. This |
|
16496 + differs from :fail: in that it causes the redirect router to decline, |
|
16497 + whereas :fail: forces routing to fail. A lookup which results in an empty |
|
16498 + redirection list has the same effect. |
|
16499 + |
|
16500 +22.7Â Duplicate addresses |
|
16501 + |
|
16502 +Exim removes duplicate addresses from the list to which it is delivering, so as |
|
16503 +to deliver just one copy to each address. This does not apply to deliveries |
|
16504 +routed to pipes by different immediate parent addresses, but an indirect |
|
16505 +aliasing scheme of the type |
|
16506 + |
|
16507 +pipe: |/some/command $local_part |
|
16508 +localpart1: pipe |
|
16509 +localpart2: pipe |
|
16510 + |
|
16511 +does not work with a message that is addressed to both local parts, because |
|
16512 +when the second is aliased to the intermediate local part "pipe" it gets |
|
16513 +discarded as being the same as a previously handled address. However, a scheme |
|
16514 +such as |
|
16515 + |
|
16516 +localpart1: |/some/command $local_part |
|
16517 +localpart2: |/some/command $local_part |
|
16518 + |
|
16519 +does result in two different pipe deliveries, because the immediate parents of |
|
16520 +the pipes are distinct. |
|
16521 + |
|
16522 +22.8Â Repeated redirection expansion |
|
16523 + |
|
16524 +When a message cannot be delivered to all of its recipients immediately, |
|
16525 +leading to two or more delivery attempts, redirection expansion is carried out |
|
16526 +afresh each time for those addresses whose children were not all previously |
|
16527 +delivered. If redirection is being used as a mailing list, this can lead to new |
|
16528 +members of the list receiving copies of old messages. The one_time option can |
|
16529 +be used to avoid this. |
|
16530 + |
|
16531 +22.9Â Errors in redirection lists |
|
16532 + |
|
16533 +If skip_syntax_errors is set, a malformed address that causes a parsing error |
|
16534 +is skipped, and an entry is written to the main log. This may be useful for |
|
16535 +mailing lists that are automatically managed. Otherwise, if an error is |
|
16536 +detected while generating the list of new addresses, the original address is |
|
16537 +deferred. See also syntax_errors_to. |
|
16538 + |
|
16539 +22.10Â Private options for the redirect router |
|
16540 + |
|
16541 +The private options for the redirect router are as follows: |
|
16542 + |
|
16543 ++------------------------------------------------------+ |
|
16544 +|allow_defer|Use: redirect|Type: boolean|Default: false| |
|
16545 ++------------------------------------------------------+ |
|
16546 + |
|
16547 +Setting this option allows the use of :defer: in non-filter redirection data, |
|
16548 +or the defer command in an Exim filter file. |
|
16549 + |
|
16550 ++-----------------------------------------------------+ |
|
16551 +|allow_fail|Use: redirect|Type: boolean|Default: false| |
|
16552 ++-----------------------------------------------------+ |
|
16553 + |
|
16554 +If this option is true, the :fail: item can be used in a redirection list, and |
|
16555 +the fail command may be used in an Exim filter file. |
|
16556 + |
|
16557 ++-------------------------------------------------------+ |
|
16558 +|allow_filter|Use: redirect|Type: boolean|Default: false| |
|
16559 ++-------------------------------------------------------+ |
|
16560 + |
|
16561 +Setting this option allows Exim to interpret redirection data that starts with |
|
16562 +"#Exim filter" or "#Sieve filter" as a set of filtering instructions. There are |
|
16563 +some features of Exim filter files that some administrators may wish to lock |
|
16564 +out; see the forbid_filter_xxx options below. |
|
16565 + |
|
16566 +It is also possible to lock out Exim filters or Sieve filters while allowing |
|
16567 +the other type; see forbid_exim_filter and forbid_sieve_filter. |
|
16568 + |
|
16569 +The filter is run using the uid and gid set by the generic user and group |
|
16570 +options. These take their defaults from the password data if check_local_user |
|
16571 +is set, so in the normal case of users' personal filter files, the filter is |
|
16572 +run as the relevant user. When allow_filter is set true, Exim insists that |
|
16573 +either check_local_user or user is set. |
|
16574 + |
|
16575 ++-------------------------------------------------------+ |
|
16576 +|allow_freeze|Use: redirect|Type: boolean|Default: false| |
|
16577 ++-------------------------------------------------------+ |
|
16578 + |
|
16579 +Setting this option allows the use of the freeze command in an Exim filter. |
|
16580 +This command is more normally encountered in system filters, and is disabled by |
|
16581 +default for redirection filters because it isn't something you usually want to |
|
16582 +let ordinary users do. |
|
16583 + |
|
16584 ++---------------------------------------------------------+ |
|
16585 +|check_ancestor|Use: redirect|Type: boolean|Default: false| |
|
16586 ++---------------------------------------------------------+ |
|
16587 + |
|
16588 +This option is concerned with handling generated addresses that are the same as |
|
16589 +some address in the list of redirection ancestors of the current address. |
|
16590 +Although it is turned off by default in the code, it is set in the default |
|
16591 +configuration file for handling users' .forward files. It is recommended for |
|
16592 +this use of the redirect router. |
|
16593 + |
|
16594 +When check_ancestor is set, if a generated address (including the domain) is |
|
16595 +the same as any ancestor of the current address, it is replaced by a copy of |
|
16596 +the current address. This helps in the case where local part A is aliased to B, |
|
16597 +and B has a .forward file pointing back to A. For example, within a single |
|
16598 +domain, the local part "Joe.Bloggs" is aliased to "jb" and  jb/.forward |
|
16599 +contains: |
|
16600 + |
|
16601 +\Joe.Bloggs, <other item(s)> |
|
16602 + |
|
16603 +Without the check_ancestor setting, either local part ("jb" or "joe.bloggs") |
|
16604 +gets processed once by each router and so ends up as it was originally. If "jb" |
|
16605 +is the real mailbox name, mail to "jb" gets delivered (having been turned into |
|
16606 +"joe.bloggs" by the .forward file and back to "jb" by the alias), but mail to |
|
16607 +"joe.bloggs" fails. Setting check_ancestor on the redirect router that handles |
|
16608 +the .forward file prevents it from turning "jb" back into "joe.bloggs" when |
|
16609 +that was the original address. See also the repeat_use option below. |
|
16610 + |
|
16611 ++----------------------------------------------------------+ |
|
16612 +|check_group|Use: redirect|Type: boolean|Default: see below| |
|
16613 ++----------------------------------------------------------+ |
|
16614 + |
|
16615 +When the file option is used, the group owner of the file is checked only when |
|
16616 +this option is set. The permitted groups are those listed in the owngroups |
|
16617 +option, together with the user's default group if check_local_user is set. If |
|
16618 +the file has the wrong group, routing is deferred. The default setting for this |
|
16619 +option is true if check_local_user is set and the modemask option permits the |
|
16620 +group write bit, or if the owngroups option is set. Otherwise it is false, and |
|
16621 +no group check occurs. |
|
16622 + |
|
16623 ++----------------------------------------------------------+ |
|
16624 +|check_owner|Use: redirect|Type: boolean|Default: see below| |
|
16625 ++----------------------------------------------------------+ |
|
16626 + |
|
16627 +When the file option is used, the owner of the file is checked only when this |
|
16628 +option is set. If check_local_user is set, the local user is permitted; |
|
16629 +otherwise the owner must be one of those listed in the owners option. The |
|
16630 +default value for this option is true if check_local_user or owners is set. |
|
16631 +Otherwise the default is false, and no owner check occurs. |
|
16632 + |
|
16633 ++-----------------------------------------------+ |
|
16634 +|data|Use: redirect|Type: string*|Default: unset| |
|
16635 ++-----------------------------------------------+ |
|
16636 + |
|
16637 +This option is mutually exclusive with file. One or other of them must be set, |
|
16638 +but not both. The contents of data are expanded, and then used as the list of |
|
16639 +forwarding items, or as a set of filtering instructions. If the expansion is |
|
16640 +forced to fail, or the result is an empty string or a string that has no effect |
|
16641 +(consists entirely of comments), the router declines. |
|
16642 + |
|
16643 +When filtering instructions are used, the string must begin with "#Exim |
|
16644 +filter", and all comments in the string, including this initial one, must be |
|
16645 +terminated with newline characters. For example: |
|
16646 + |
|
16647 +data = #Exim filter\n\ |
|
16648 + if $h_to: contains Exim then save $home/mail/exim endif |
|
16649 + |
|
16650 +If you are reading the data from a database where newlines cannot be included, |
|
16651 +you can use the ${sg} expansion item to turn the escape string of your choice |
|
16652 +into a newline. |
|
16653 + |
|
16654 ++--------------------------------------------------------------+ |
|
16655 +|directory_transport|Use: redirect|Type: string*|Default: unset| |
|
16656 ++--------------------------------------------------------------+ |
|
16657 + |
|
16658 +A redirect router sets up a direct delivery to a directory when a path name |
|
16659 +ending with a slash is specified as a new "address". The transport used is |
|
16660 +specified by this option, which, after expansion, must be the name of a |
|
16661 +configured transport. This should normally be an appendfile transport. |
|
16662 + |
|
16663 ++-----------------------------------------------+ |
|
16664 +|file|Use: redirect|Type: string*|Default: unset| |
|
16665 ++-----------------------------------------------+ |
|
16666 + |
|
16667 +This option specifies the name of a file that contains the redirection data. It |
|
16668 +is mutually exclusive with the data option. The string is expanded before use; |
|
16669 +if the expansion is forced to fail, the router declines. Other expansion |
|
16670 +failures cause delivery to be deferred. The result of a successful expansion |
|
16671 +must be an absolute path. The entire file is read and used as the redirection |
|
16672 +data. If the data is an empty string or a string that has no effect (consists |
|
16673 +entirely of comments), the router declines. |
|
16674 + |
|
16675 +If the attempt to open the file fails with a "does not exist" error, Exim runs |
|
16676 +a check on the containing directory, unless ignore_enotdir is true (see below). |
|
16677 +If the directory does not appear to exist, delivery is deferred. This can |
|
16678 +happen when users' .forward files are in NFS-mounted directories, and there is |
|
16679 +a mount problem. If the containing directory does exist, but the file does not, |
|
16680 +the router declines. |
|
16681 + |
|
16682 ++---------------------------------------------------------+ |
|
16683 +|file_transport|Use: redirect|Type: string*|Default: unset| |
|
16684 ++---------------------------------------------------------+ |
|
16685 + |
|
16686 +A redirect router sets up a direct delivery to a file when a path name not |
|
16687 +ending in a slash is specified as a new "address". The transport used is |
|
16688 +specified by this option, which, after expansion, must be the name of a |
|
16689 +configured transport. This should normally be an appendfile transport. When it |
|
16690 +is running, the file name is in $address_file. |
|
16691 + |
|
16692 ++-------------------------------------------------------------+ |
|
16693 +|filter_prepend_home|Use: redirect|Type: boolean|Default: true| |
|
16694 ++-------------------------------------------------------------+ |
|
16695 + |
|
16696 +When this option is true, if a save command in an Exim filter specifies a |
|
16697 +relative path, and $home is defined, it is automatically prepended to the |
|
16698 +relative path. If this option is set false, this action does not happen. The |
|
16699 +relative path is then passed to the transport unmodified. |
|
16700 + |
|
16701 ++-----------------------------------------------------------+ |
|
16702 +|forbid_blackhole|Use: redirect|Type: boolean|Default: false| |
|
16703 ++-----------------------------------------------------------+ |
|
16704 + |
|
16705 +If this option is true, the :blackhole: item may not appear in a redirection |
|
16706 +list. |
|
16707 + |
|
16708 ++-------------------------------------------------------------+ |
|
16709 +|forbid_exim_filter|Use: redirect|Type: boolean|Default: false| |
|
16710 ++-------------------------------------------------------------+ |
|
16711 + |
|
16712 +If this option is set true, only Sieve filters are permitted when allow_filter |
|
16713 +is true. |
|
16714 + |
|
16715 ++------------------------------------------------------+ |
|
16716 +|forbid_file|Use: redirect|Type: boolean|Default: false| |
|
16717 ++------------------------------------------------------+ |
|
16718 + |
|
16719 +If this option is true, this router may not generate a new address that |
|
16720 +specifies delivery to a local file or directory, either from a filter or from a |
|
16721 +conventional forward file. This option is forced to be true if one_time is set. |
|
16722 +It applies to Sieve filters as well as to Exim filters, but if true, it locks |
|
16723 +out the Sieve's "keep" facility. |
|
16724 + |
|
16725 ++---------------------------------------------------------------+ |
|
16726 +|forbid_filter_dlfunc|Use: redirect|Type: boolean|Default: false| |
|
16727 ++---------------------------------------------------------------+ |
|
16728 + |
|
16729 +If this option is true, string expansions in Exim filters are not allowed to |
|
16730 +make use of the dlfunc expansion facility to run dynamically loaded functions. |
|
16731 + |
|
16732 ++-------------------------------------------------------------------+ |
|
16733 +|forbid_filter_existstest|Use: redirect|Type: boolean|Default: false| |
|
16734 ++-------------------------------------------------------------------+ |
|
16735 + |
|
16736 +If this option is true, string expansions in Exim filters are not allowed to |
|
16737 +make use of the exists condition or the stat expansion item. |
|
16738 + |
|
16739 ++-----------------------------------------------------------------+ |
|
16740 +|forbid_filter_logwrite|Use: redirect|Type: boolean|Default: false| |
|
16741 ++-----------------------------------------------------------------+ |
|
16742 + |
|
16743 +If this option is true, use of the logging facility in Exim filters is not |
|
16744 +permitted. Logging is in any case available only if the filter is being run |
|
16745 +under some unprivileged uid (which is normally the case for ordinary users' |
|
16746 +.forward files). |
|
16747 + |
|
16748 ++---------------------------------------------------------------+ |
|
16749 +|forbid_filter_lookup|Use: redirect|Type: boolean|Default: false| |
|
16750 ++---------------------------------------------------------------+ |
|
16751 + |
|
16752 +If this option is true, string expansions in Exim filter files are not allowed |
|
16753 +to make use of lookup items. |
|
16754 + |
|
16755 ++-------------------------------------------------------------+ |
|
16756 +|forbid_filter_perl|Use: redirect|Type: boolean|Default: false| |
|
16757 ++-------------------------------------------------------------+ |
|
16758 + |
|
16759 +This option has an effect only if Exim is built with embedded Perl support. If |
|
16760 +it is true, string expansions in Exim filter files are not allowed to make use |
|
16761 +of the embedded Perl support. |
|
16762 + |
|
16763 ++-----------------------------------------------------------------+ |
|
16764 +|forbid_filter_readfile|Use: redirect|Type: boolean|Default: false| |
|
16765 ++-----------------------------------------------------------------+ |
|
16766 + |
|
16767 +If this option is true, string expansions in Exim filter files are not allowed |
|
16768 +to make use of readfile items. |
|
16769 + |
|
16770 ++-------------------------------------------------------------------+ |
|
16771 +|forbid_filter_readsocket|Use: redirect|Type: boolean|Default: false| |
|
16772 ++-------------------------------------------------------------------+ |
|
16773 + |
|
16774 +If this option is true, string expansions in Exim filter files are not allowed |
|
16775 +to make use of readsocket items. |
|
16776 + |
|
16777 ++--------------------------------------------------------------+ |
|
16778 +|forbid_filter_reply|Use: redirect|Type: boolean|Default: false| |
|
16779 ++--------------------------------------------------------------+ |
|
16780 + |
|
16781 +If this option is true, this router may not generate an automatic reply |
|
16782 +message. Automatic replies can be generated only from Exim or Sieve filter |
|
16783 +files, not from traditional forward files. This option is forced to be true if |
|
16784 +one_time is set. |
|
16785 + |
|
16786 ++------------------------------------------------------------+ |
|
16787 +|forbid_filter_run|Use: redirect|Type: boolean|Default: false| |
|
16788 ++------------------------------------------------------------+ |
|
16789 + |
|
16790 +If this option is true, string expansions in Exim filter files are not allowed |
|
16791 +to make use of run items. |
|
16792 + |
|
16793 ++---------------------------------------------------------+ |
|
16794 +|forbid_include|Use: redirect|Type: boolean|Default: false| |
|
16795 ++---------------------------------------------------------+ |
|
16796 + |
|
16797 +If this option is true, items of the form |
|
16798 + |
|
16799 +:include:<path name> |
|
16800 + |
|
16801 +are not permitted in non-filter redirection lists. |
|
16802 + |
|
16803 ++------------------------------------------------------+ |
|
16804 +|forbid_pipe|Use: redirect|Type: boolean|Default: false| |
|
16805 ++------------------------------------------------------+ |
|
16806 + |
|
16807 +If this option is true, this router may not generate a new address which |
|
16808 +specifies delivery to a pipe, either from an Exim filter or from a conventional |
|
16809 +forward file. This option is forced to be true if one_time is set. |
|
16810 + |
|
16811 ++--------------------------------------------------------------+ |
|
16812 +|forbid_sieve_filter|Use: redirect|Type: boolean|Default: false| |
|
16813 ++--------------------------------------------------------------+ |
|
16814 + |
|
16815 +If this option is set true, only Exim filters are permitted when allow_filter |
|
16816 +is true. |
|
16817 + |
|
16818 ++-----------------------------------------------------------+ |
|
16819 +|forbid_smtp_code|Use: redirect|Type: boolean|Default: false| |
|
16820 ++-----------------------------------------------------------+ |
|
16821 + |
|
16822 +If this option is set true, any SMTP error codes that are present at the start |
|
16823 +of messages specified for ":defer:" or ":fail:" are quietly ignored, and the |
|
16824 +default codes (451 and 550, respectively) are always used. |
|
16825 + |
|
16826 ++---------------------------------------------------------------+ |
|
16827 +|hide_child_in_errmsg|Use: redirect|Type: boolean|Default: false| |
|
16828 ++---------------------------------------------------------------+ |
|
16829 + |
|
16830 +If this option is true, it prevents Exim from quoting a child address if it |
|
16831 +generates a bounce or delay message for it. Instead it says "an address |
|
16832 +generated from <the top level address>". Of course, this applies only to |
|
16833 +bounces generated locally. If a message is forwarded to another host, its |
|
16834 +bounce may well quote the generated address. |
|
16835 + |
|
16836 ++--------------------------------------------------------+ |
|
16837 +|ignore_eacces|Use: redirect|Type: boolean|Default: false| |
|
16838 ++--------------------------------------------------------+ |
|
16839 + |
|
16840 +If this option is set and an attempt to open a redirection file yields the |
|
16841 +EACCES error (permission denied), the redirect router behaves as if the file |
|
16842 +did not exist. |
|
16843 + |
|
16844 ++---------------------------------------------------------+ |
|
16845 +|ignore_enotdir|Use: redirect|Type: boolean|Default: false| |
|
16846 ++---------------------------------------------------------+ |
|
16847 + |
|
16848 +If this option is set and an attempt to open a redirection file yields the |
|
16849 +ENOTDIR error (something on the path is not a directory), the redirect router |
|
16850 +behaves as if the file did not exist. |
|
16851 + |
|
16852 +Setting ignore_enotdir has another effect as well: When a redirect router that |
|
16853 +has the file option set discovers that the file does not exist (the ENOENT |
|
16854 +error), it tries to stat() the parent directory, as a check against unmounted |
|
16855 +NFS directories. If the parent can not be statted, delivery is deferred. |
|
16856 +However, it seems wrong to do this check when ignore_enotdir is set, because |
|
16857 +that option tells Exim to ignore "something on the path is not a directory" |
|
16858 +(the ENOTDIR error). This is a confusing area, because it seems that some |
|
16859 +operating systems give ENOENT where others give ENOTDIR. |
|
16860 + |
|
16861 ++-----------------------------------------------------------+ |
|
16862 +|include_directory|Use: redirect|Type: string|Default: unset| |
|
16863 ++-----------------------------------------------------------+ |
|
16864 + |
|
16865 +If this option is set, the path names of any :include: items in a redirection |
|
16866 +list must start with this directory. |
|
16867 + |
|
16868 ++-------------------------------------------------------+ |
|
16869 +|modemask|Use: redirect|Type: octal integer|Default: 022| |
|
16870 ++-------------------------------------------------------+ |
|
16871 + |
|
16872 +This specifies mode bits which must not be set for a file specified by the file |
|
16873 +option. If any of the forbidden bits are set, delivery is deferred. |
|
16874 + |
|
16875 ++---------------------------------------------------+ |
|
16876 +|one_time|Use: redirect|Type: boolean|Default: false| |
|
16877 ++---------------------------------------------------+ |
|
16878 + |
|
16879 +Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection |
|
16880 +files each time it tries to deliver a message causes a problem when one or more |
|
16881 +of the generated addresses fails be delivered at the first attempt. The problem |
|
16882 +is not one of duplicate delivery - Exim is clever enough to handle that - but |
|
16883 +of what happens when the redirection list changes during the time that the |
|
16884 +message is on Exim's queue. This is particularly true in the case of mailing |
|
16885 +lists, where new subscribers might receive copies of messages that were posted |
|
16886 +before they subscribed. |
|
16887 + |
|
16888 +If one_time is set and any addresses generated by the router fail to deliver at |
|
16889 +the first attempt, the failing addresses are added to the message as "top |
|
16890 +level" addresses, and the parent address that generated them is marked |
|
16891 +"delivered". Thus, redirection does not happen again at the next delivery |
|
16892 +attempt. |
|
16893 + |
|
16894 +Warning 1: Any header line addition or removal that is specified by this router |
|
16895 +would be lost if delivery did not succeed at the first attempt. For this |
|
16896 +reason, the headers_add and headers_remove generic options are not permitted |
|
16897 +when one_time is set. |
|
16898 + |
|
16899 +Warning 2: To ensure that the router generates only addresses (as opposed to |
|
16900 +pipe or file deliveries or auto-replies) forbid_file, forbid_pipe, and |
|
16901 +forbid_filter_reply are forced to be true when one_time is set. |
|
16902 + |
|
16903 +Warning 3: The unseen generic router option may not be set with one_time. |
|
16904 + |
|
16905 +The original top-level address is remembered with each of the generated |
|
16906 +addresses, and is output in any log messages. However, any intermediate parent |
|
16907 +addresses are not recorded. This makes a difference to the log only if |
|
16908 +all_parents log selector is set. It is expected that one_time will typically be |
|
16909 +used for mailing lists, where there is normally just one level of expansion. |
|
16910 + |
|
16911 ++-----------------------------------------------------+ |
|
16912 +|owners|Use: redirect|Type: string list|Default: unset| |
|
16913 ++-----------------------------------------------------+ |
|
16914 + |
|
16915 +This specifies a list of permitted owners for the file specified by file. This |
|
16916 +list is in addition to the local user when check_local_user is set. See |
|
16917 +check_owner above. |
|
16918 + |
|
16919 ++--------------------------------------------------------+ |
|
16920 +|owngroups|Use: redirect|Type: string list|Default: unset| |
|
16921 ++--------------------------------------------------------+ |
|
16922 + |
|
16923 +This specifies a list of permitted groups for the file specified by file. The |
|
16924 +list is in addition to the local user's primary group when check_local_user is |
|
16925 +set. See check_group above. |
|
16926 + |
|
16927 ++---------------------------------------------------------+ |
|
16928 +|pipe_transport|Use: redirect|Type: string*|Default: unset| |
|
16929 ++---------------------------------------------------------+ |
|
16930 + |
|
16931 +A redirect router sets up a direct delivery to a pipe when a string starting |
|
16932 +with a vertical bar character is specified as a new "address". The transport |
|
16933 +used is specified by this option, which, after expansion, must be the name of a |
|
16934 +configured transport. This should normally be a pipe transport. When the |
|
16935 +transport is run, the pipe command is in $address_pipe. |
|
16936 + |
|
16937 ++---------------------------------------------------------+ |
|
16938 +|qualify_domain|Use: redirect|Type: string*|Default: unset| |
|
16939 ++---------------------------------------------------------+ |
|
16940 + |
|
16941 +If this option is set, and an unqualified address (one without a domain) is |
|
16942 +generated, and that address would normally be qualified by the global setting |
|
16943 +in qualify_recipient, it is instead qualified with the domain specified by |
|
16944 +expanding this string. If the expansion fails, the router declines. If you want |
|
16945 +to revert to the default, you can have the expansion generate |
|
16946 +$qualify_recipient. |
|
16947 + |
|
16948 +This option applies to all unqualified addresses generated by Exim filters, but |
|
16949 +for traditional .forward files, it applies only to addresses that are not |
|
16950 +preceded by a backslash. Sieve filters cannot generate unqualified addresses. |
|
16951 + |
|
16952 ++------------------------------------------------------------------+ |
|
16953 +|qualify_preserve_domain|Use: redirect|Type: boolean|Default: false| |
|
16954 ++------------------------------------------------------------------+ |
|
16955 + |
|
16956 +If this option is set, the router's local qualify_domain option must not be set |
|
16957 +(a configuration error occurs if it is). If an unqualified address (one without |
|
16958 +a domain) is generated, it is qualified with the domain of the parent address |
|
16959 +(the immediately preceding ancestor) instead of the global qualify_recipient |
|
16960 +value. In the case of a traditional .forward file, this applies whether or not |
|
16961 +the address is preceded by a backslash. |
|
16962 + |
|
16963 ++----------------------------------------------------+ |
|
16964 +|repeat_use|Use: redirect|Type: boolean|Default: true| |
|
16965 ++----------------------------------------------------+ |
|
16966 + |
|
16967 +If this option is set false, the router is skipped for a child address that has |
|
16968 +any ancestor that was routed by this router. This test happens before any of |
|
16969 +the other preconditions are tested. Exim's default anti-looping rules skip only |
|
16970 +when the ancestor is the same as the current address. See also check_ancestor |
|
16971 +above and the generic redirect_router option. |
|
16972 + |
|
16973 ++----------------------------------------------------------+ |
|
16974 +|reply_transport|Use: redirect|Type: string*|Default: unset| |
|
16975 ++----------------------------------------------------------+ |
|
16976 + |
|
16977 +A redirect router sets up an automatic reply when a mail or vacation command is |
|
16978 +used in a filter file. The transport used is specified by this option, which, |
|
16979 +after expansion, must be the name of a configured transport. This should |
|
16980 +normally be an autoreply transport. Other transports are unlikely to do |
|
16981 +anything sensible or useful. |
|
16982 + |
|
16983 ++-------------------------------------------------+ |
|
16984 +|rewrite|Use: redirect|Type: boolean|Default: true| |
|
16985 ++-------------------------------------------------+ |
|
16986 + |
|
16987 +If this option is set false, addresses generated by the router are not subject |
|
16988 +to address rewriting. Otherwise, they are treated like new addresses and are |
|
16989 +rewritten according to the global rewriting rules. |
|
16990 + |
|
16991 ++-----------------------------------------------------------+ |
|
16992 +|sieve_subaddress|Use: redirect|Type: string*|Default: unset| |
|
16993 ++-----------------------------------------------------------+ |
|
16994 + |
|
16995 +The value of this option is passed to a Sieve filter to specify the :subaddress |
|
16996 +part of an address. |
|
16997 + |
|
16998 ++------------------------------------------------------------+ |
|
16999 +|sieve_useraddress|Use: redirect|Type: string*|Default: unset| |
|
17000 ++------------------------------------------------------------+ |
|
17001 + |
|
17002 +The value of this option is passed to a Sieve filter to specify the :user part |
|
17003 +of an address. However, if it is unset, the entire original local part |
|
17004 +(including any prefix or suffix) is used for :user. |
|
17005 + |
|
17006 ++-------------------------------------------------------------------+ |
|
17007 +|sieve_vacation_directory|Use: redirect|Type: string*|Default: unset| |
|
17008 ++-------------------------------------------------------------------+ |
|
17009 + |
|
17010 +To enable the "vacation" extension for Sieve filters, you must set |
|
17011 +sieve_vacation_directory to the directory where vacation databases are held (do |
|
17012 +not put anything else in that directory), and ensure that the reply_transport |
|
17013 +option refers to an autoreply transport. Each user needs their own directory; |
|
17014 +Exim will create it if necessary. |
|
17015 + |
|
17016 ++-------------------------------------------------------------+ |
|
17017 +|skip_syntax_errors|Use: redirect|Type: boolean|Default: false| |
|
17018 ++-------------------------------------------------------------+ |
|
17019 + |
|
17020 +If skip_syntax_errors is set, syntactically malformed addresses in non-filter |
|
17021 +redirection data are skipped, and each failing address is logged. If |
|
17022 +syntax_errors_to is set, a message is sent to the address it defines, giving |
|
17023 +details of the failures. If syntax_errors_text is set, its contents are |
|
17024 +expanded and placed at the head of the error message generated by |
|
17025 +syntax_errors_to. Usually it is appropriate to set syntax_errors_to to be the |
|
17026 +same address as the generic errors_to option. The skip_syntax_errors option is |
|
17027 +often used when handling mailing lists. |
|
17028 + |
|
17029 +If all the addresses in a redirection list are skipped because of syntax |
|
17030 +errors, the router declines to handle the original address, and it is passed to |
|
17031 +the following routers. |
|
17032 + |
|
17033 +If skip_syntax_errors is set when an Exim filter is interpreted, any syntax |
|
17034 +error in the filter causes filtering to be abandoned without any action being |
|
17035 +taken. The incident is logged, and the router declines to handle the address, |
|
17036 +so it is passed to the following routers. |
|
17037 + |
|
17038 +Syntax errors in a Sieve filter file cause the "keep" action to occur. This |
|
17039 +action is specified by RFC 3028. The values of skip_syntax_errors, |
|
17040 +syntax_errors_to, and syntax_errors_text are not used. |
|
17041 + |
|
17042 +skip_syntax_errors can be used to specify that errors in users' forward lists |
|
17043 +or filter files should not prevent delivery. The syntax_errors_to option, used |
|
17044 +with an address that does not get redirected, can be used to notify users of |
|
17045 +these errors, by means of a router like this: |
|
17046 + |
|
17047 +userforward: |
|
17048 + driver = redirect |
|
17049 + allow_filter |
|
17050 + check_local_user |
|
17051 + file = $home/.forward |
|
17052 + file_transport = address_file |
|
17053 + pipe_transport = address_pipe |
|
17054 + reply_transport = address_reply |
|
17055 + no_verify |
|
17056 + skip_syntax_errors |
|
17057 + syntax_errors_to = real-$local_part@$domain |
|
17058 + syntax_errors_text = \ |
|
17059 + This is an automatically generated message. An error has\n\ |
|
17060 + been found in your .forward file. Details of the error are\n\ |
|
17061 + reported below. While this error persists, you will receive\n\ |
|
17062 + a copy of this message for every message that is addressed\n\ |
|
17063 + to you. If your .forward file is a filter file, or if it is\n\ |
|
17064 + a non-filter file containing no valid forwarding addresses,\n\ |
|
17065 + a copy of each incoming message will be put in your normal\n\ |
|
17066 + mailbox. If a non-filter file contains at least one valid\n\ |
|
17067 + forwarding address, forwarding to the valid addresses will\n\ |
|
17068 + happen, and those will be the only deliveries that occur. |
|
17069 + |
|
17070 +You also need a router to ensure that local addresses that are prefixed by |
|
17071 +"real-" are recognized, but not forwarded or filtered. For example, you could |
|
17072 +put this immediately before the userforward router: |
|
17073 + |
|
17074 +real_localuser: |
|
17075 + driver = accept |
|
17076 + check_local_user |
|
17077 + local_part_prefix = real- |
|
17078 + transport = local_delivery |
|
17079 + |
|
17080 +For security, it would probably be a good idea to restrict the use of this |
|
17081 +router to locally-generated messages, using a condition such as this: |
|
17082 + |
|
17083 + condition = ${if match {$sender_host_address}\ |
|
17084 + {\N^(|127\.0\.0\.1)$\N}} |
|
17085 + |
|
17086 ++-------------------------------------------------------------+ |
|
17087 +|syntax_errors_text|Use: redirect|Type: string*|Default: unset| |
|
17088 ++-------------------------------------------------------------+ |
|
17089 + |
|
17090 +See skip_syntax_errors above. |
|
17091 + |
|
17092 ++----------------------------------------------------------+ |
|
17093 +|syntax_errors_to|Use: redirect|Type: string|Default: unset| |
|
17094 ++----------------------------------------------------------+ |
|
17095 + |
|
17096 +See skip_syntax_errors above. |
|
17097 + |
|
17098 +23. Environment for running local transports |
|
17099 + |
|
17100 +Local transports handle deliveries to files and pipes. (The autoreply transport |
|
17101 +can be thought of as similar to a pipe.) Exim always runs transports in |
|
17102 +subprocesses, under specified uids and gids. Typical deliveries to local |
|
17103 +mailboxes run under the uid and gid of the local user. |
|
17104 + |
|
17105 +Exim also sets a specific current directory while running the transport; for |
|
17106 +some transports a home directory setting is also relevant. The pipe transport |
|
17107 +is the only one that sets up environment variables; see section 29.4 for |
|
17108 +details. |
|
17109 + |
|
17110 +The values used for the uid, gid, and the directories may come from several |
|
17111 +different places. In many cases, the router that handles the address associates |
|
17112 +settings with that address as a result of its check_local_user, group, or user |
|
17113 +options. However, values may also be given in the transport's own |
|
17114 +configuration, and these override anything that comes from the router. |
|
17115 + |
|
17116 +23.1Â Concurrent deliveries |
|
17117 + |
|
17118 +If two different messages for the same local recipient arrive more or less |
|
17119 +simultaneously, the two delivery processes are likely to run concurrently. When |
|
17120 +the appendfile transport is used to write to a file, Exim applies locking rules |
|
17121 +to stop concurrent processes from writing to the same file at the same time. |
|
17122 + |
|
17123 +However, when you use a pipe transport, it is up to you to arrange any locking |
|
17124 +that is needed. Here is a silly example: |
|
17125 + |
|
17126 +my_transport: |
|
17127 + driver = pipe |
|
17128 + command = /bin/sh -c 'cat >>/some/file' |
|
17129 + |
|
17130 +This is supposed to write the message at the end of the file. However, if two |
|
17131 +messages arrive at the same time, the file will be scrambled. You can use the |
|
17132 +exim_lock utility program (see section 50.15) to lock a file using the same |
|
17133 +algorithm that Exim itself uses. |
|
17134 + |
|
17135 +23.2Â Uids and gids |
|
17136 + |
|
17137 +All transports have the options group and user. If group is set, it overrides |
|
17138 +any group that the router set in the address, even if user is not set for the |
|
17139 +transport. This makes it possible, for example, to run local mail delivery |
|
17140 +under the uid of the recipient (set by the router), but in a special group (set |
|
17141 +by the transport). For example: |
|
17142 + |
|
17143 +# Routers ... |
|
17144 +# User/group are set by check_local_user in this router |
|
17145 +local_users: |
|
17146 + driver = accept |
|
17147 + check_local_user |
|
17148 + transport = group_delivery |
|
17149 + |
|
17150 +# Transports ... |
|
17151 +# This transport overrides the group |
|
17152 +group_delivery: |
|
17153 + driver = appendfile |
|
17154 + file = /var/spool/mail/$local_part |
|
17155 + group = mail |
|
17156 + |
|
17157 +If user is set for a transport, its value overrides what is set in the address |
|
17158 +by the router. If user is non-numeric and group is not set, the gid associated |
|
17159 +with the user is used. If user is numeric, group must be set. |
|
17160 + |
|
17161 +When the uid is taken from the transport's configuration, the initgroups() |
|
17162 +function is called for the groups associated with that uid if the initgroups |
|
17163 +option is set for the transport. When the uid is not specified by the |
|
17164 +transport, but is associated with the address by a router, the option for |
|
17165 +calling initgroups() is taken from the router configuration. |
|
17166 + |
|
17167 +The pipe transport contains the special option pipe_as_creator. If this is set |
|
17168 +and user is not set, the uid of the process that called Exim to receive the |
|
17169 +message is used, and if group is not set, the corresponding original gid is |
|
17170 +also used. |
|
17171 + |
|
17172 +This is the detailed preference order for obtaining a gid; the first of the |
|
17173 +following that is set is used: |
|
17174 + |
|
17175 + * A group setting of the transport; |
|
17176 + |
|
17177 + * A group setting of the router; |
|
17178 + |
|
17179 + * A gid associated with a user setting of the router, either as a result of |
|
17180 + check_local_user or an explicit non-numeric user setting; |
|
17181 + |
|
17182 + * The group associated with a non-numeric user setting of the transport; |
|
17183 + |
|
17184 + * In a pipe transport, the creator's gid if deliver_as_creator is set and the |
|
17185 + uid is the creator's uid; |
|
17186 + |
|
17187 + * The Exim gid if the Exim uid is being used as a default. |
|
17188 + |
|
17189 +If, for example, the user is specified numerically on the router and there are |
|
17190 +no group settings, no gid is available. In this situation, an error occurs. |
|
17191 +This is different for the uid, for which there always is an ultimate default. |
|
17192 +The first of the following that is set is used: |
|
17193 + |
|
17194 + * A user setting of the transport; |
|
17195 + |
|
17196 + * In a pipe transport, the creator's uid if deliver_as_creator is set; |
|
17197 + |
|
17198 + * A user setting of the router; |
|
17199 + |
|
17200 + * A check_local_user setting of the router; |
|
17201 + |
|
17202 + * The Exim uid. |
|
17203 + |
|
17204 +Of course, an error will still occur if the uid that is chosen is on the |
|
17205 +never_users list. |
|
17206 + |
|
17207 +23.3Â Current and home directories |
|
17208 + |
|
17209 +Routers may set current and home directories for local transports by means of |
|
17210 +the transport_current_directory and transport_home_directory options. However, |
|
17211 +if the transport's current_directory or home_directory options are set, they |
|
17212 +override the router's values. In detail, the home directory for a local |
|
17213 +transport is taken from the first of these values that is set: |
|
17214 + |
|
17215 + * The home_directory option on the transport; |
|
17216 + |
|
17217 + * The transport_home_directory option on the router; |
|
17218 + |
|
17219 + * The password data if check_local_user is set on the router; |
|
17220 + |
|
17221 + * The router_home_directory option on the router. |
|
17222 + |
|
17223 +The current directory is taken from the first of these values that is set: |
|
17224 + |
|
17225 + * The current_directory option on the transport; |
|
17226 + |
|
17227 + * The transport_current_directory option on the router. |
|
17228 + |
|
17229 +If neither the router nor the transport sets a current directory, Exim uses the |
|
17230 +value of the home directory, if it is set. Otherwise it sets the current |
|
17231 +directory to / before running a local transport. |
|
17232 + |
|
17233 +23.4Â Expansion variables derived from the address |
|
17234 + |
|
17235 +Normally a local delivery is handling a single address, and in that case the |
|
17236 +variables such as $domain and $local_part are set during local deliveries. |
|
17237 +However, in some circumstances more than one address may be handled at once |
|
17238 +(for example, while writing batch SMTP for onward transmission by some other |
|
17239 +means). In this case, the variables associated with the local part are never |
|
17240 +set, $domain is set only if all the addresses have the same domain, and |
|
17241 +$original_domain is never set. |
|
17242 + |
|
17243 +24. Generic options for transports |
|
17244 + |
|
17245 +The following generic options apply to all transports: |
|
17246 + |
|
17247 ++------------------------------------------------------+ |
|
17248 +|body_only|Use: transports|Type: boolean|Default: false| |
|
17249 ++------------------------------------------------------+ |
|
17250 + |
|
17251 +If this option is set, the message's headers are not transported. It is |
|
17252 +mutually exclusive with headers_only. If it is used with the appendfile or pipe |
|
17253 +transports, the settings of message_prefix and message_suffix should be |
|
17254 +checked, because this option does not automatically suppress them. |
|
17255 + |
|
17256 ++--------------------------------------------------------------+ |
|
17257 +|current_directory|Use: transports|Type: string*|Default: unset| |
|
17258 ++--------------------------------------------------------------+ |
|
17259 + |
|
17260 +This specifies the current directory that is to be set while running the |
|
17261 +transport, overriding any value that may have been set by the router. If the |
|
17262 +expansion fails for any reason, including forced failure, an error is logged, |
|
17263 +and delivery is deferred. |
|
17264 + |
|
17265 ++------------------------------------------------------------+ |
|
17266 +|disable_logging|Use: transports|Type: boolean|Default: false| |
|
17267 ++------------------------------------------------------------+ |
|
17268 + |
|
17269 +If this option is set true, nothing is logged for any deliveries by the |
|
17270 +transport or for any transport errors. You should not set this option unless |
|
17271 +you really, really know what you are doing. |
|
17272 + |
|
17273 ++--------------------------------------------------------+ |
|
17274 +|debug_print|Use: transports|Type: string*|Default: unset| |
|
17275 ++--------------------------------------------------------+ |
|
17276 + |
|
17277 +If this option is set and debugging is enabled (see the -d command line |
|
17278 +option), the string is expanded and included in the debugging output when the |
|
17279 +transport is run. If expansion of the string fails, the error message is |
|
17280 +written to the debugging output, and Exim carries on processing. This facility |
|
17281 +is provided to help with checking out the values of variables and so on when |
|
17282 +debugging driver configurations. For example, if a headers_add option is not |
|
17283 +working properly, debug_print could be used to output the variables it |
|
17284 +references. A newline is added to the text if it does not end with one. |
|
17285 + |
|
17286 ++--------------------------------------------------------------+ |
|
17287 +|delivery_date_add|Use: transports|Type: boolean|Default: false| |
|
17288 ++--------------------------------------------------------------+ |
|
17289 + |
|
17290 +If this option is true, a Delivery-date: header is added to the message. This |
|
17291 +gives the actual time the delivery was made. As this is not a standard header, |
|
17292 +Exim has a configuration option (delivery_date_remove) which requests its |
|
17293 +removal from incoming messages, so that delivered messages can safely be resent |
|
17294 +to other recipients. |
|
17295 + |
|
17296 ++--------------------------------------------------+ |
|
17297 +|driver|Use: transports|Type: string|Default: unset| |
|
17298 ++--------------------------------------------------+ |
|
17299 + |
|
17300 +This specifies which of the available transport drivers is to be used. There is |
|
17301 +no default, and this option must be set for every transport. |
|
17302 + |
|
17303 ++------------------------------------------------------------+ |
|
17304 +|envelope_to_add|Use: transports|Type: boolean|Default: false| |
|
17305 ++------------------------------------------------------------+ |
|
17306 + |
|
17307 +If this option is true, an Envelope-to: header is added to the message. This |
|
17308 +gives the original address(es) in the incoming envelope that caused this |
|
17309 +delivery to happen. More than one address may be present if the transport is |
|
17310 +configured to handle several addresses at once, or if more than one original |
|
17311 +address was redirected to the same final address. As this is not a standard |
|
17312 +header, Exim has a configuration option (envelope_to_remove) which requests its |
|
17313 +removal from incoming messages, so that delivered messages can safely be resent |
|
17314 +to other recipients. |
|
17315 + |
|
17316 ++-------------------------------------------------------+ |
|
17317 +|group|Use: transports|Type: string*|Default: Exim group| |
|
17318 ++-------------------------------------------------------+ |
|
17319 + |
|
17320 +This option specifies a gid for running the transport process, overriding any |
|
17321 +value that the router supplies, and also overriding any value associated with |
|
17322 +user (see below). |
|
17323 + |
|
17324 ++--------------------------------------------------------+ |
|
17325 +|headers_add|Use: transports|Type: string*|Default: unset| |
|
17326 ++--------------------------------------------------------+ |
|
17327 + |
|
17328 +This option specifies a string of text that is expanded and added to the header |
|
17329 +portion of a message as it is transported, as described in section 44.17. |
|
17330 +Additional header lines can also be specified by routers. If the result of the |
|
17331 +expansion is an empty string, or if the expansion is forced to fail, no action |
|
17332 +is taken. Other expansion failures are treated as errors and cause the delivery |
|
17333 +to be deferred. |
|
17334 + |
|
17335 ++---------------------------------------------------------+ |
|
17336 +|headers_only|Use: transports|Type: boolean|Default: false| |
|
17337 ++---------------------------------------------------------+ |
|
17338 + |
|
17339 +If this option is set, the message's body is not transported. It is mutually |
|
17340 +exclusive with body_only. If it is used with the appendfile or pipe transports, |
|
17341 +the settings of message_prefix and message_suffix should be checked, since this |
|
17342 +option does not automatically suppress them. |
|
17343 + |
|
17344 ++-----------------------------------------------------------+ |
|
17345 +|headers_remove|Use: transports|Type: string*|Default: unset| |
|
17346 ++-----------------------------------------------------------+ |
|
17347 + |
|
17348 +This option specifies a string that is expanded into a list of header names; |
|
17349 +these headers are omitted from the message as it is transported, as described |
|
17350 +in section 44.17. Header removal can also be specified by routers. If the |
|
17351 +result of the expansion is an empty string, or if the expansion is forced to |
|
17352 +fail, no action is taken. Other expansion failures are treated as errors and |
|
17353 +cause the delivery to be deferred. |
|
17354 + |
|
17355 ++-----------------------------------------------------------+ |
|
17356 +|headers_rewrite|Use: transports|Type: string|Default: unset| |
|
17357 ++-----------------------------------------------------------+ |
|
17358 + |
|
17359 +This option allows addresses in header lines to be rewritten at transport time, |
|
17360 +that is, as the message is being copied to its destination. The contents of the |
|
17361 +option are a colon-separated list of rewriting rules. Each rule is in exactly |
|
17362 +the same form as one of the general rewriting rules that are applied when a |
|
17363 +message is received. These are described in chapter 31. For example, |
|
17364 + |
|
17365 +headers_rewrite = a@b c@d f : \ |
|
17366 + x@y w@z |
|
17367 + |
|
17368 +changes a@b into c@d in From: header lines, and x@y into w@z in all |
|
17369 +address-bearing header lines. The rules are applied to the header lines just |
|
17370 +before they are written out at transport time, so they affect only those copies |
|
17371 +of the message that pass through the transport. However, only the message's |
|
17372 +original header lines, and any that were added by a system filter, are |
|
17373 +rewritten. If a router or transport adds header lines, they are not affected by |
|
17374 +this option. These rewriting rules are not applied to the envelope. You can |
|
17375 +change the return path using return_path, but you cannot change envelope |
|
17376 +recipients at this time. |
|
17377 + |
|
17378 ++-----------------------------------------------------------+ |
|
17379 +|home_directory|Use: transports|Type: string*|Default: unset| |
|
17380 ++-----------------------------------------------------------+ |
|
17381 + |
|
17382 +This option specifies a home directory setting for a local transport, |
|
17383 +overriding any value that may be set by the router. The home directory is |
|
17384 +placed in $home while expanding the transport's private options. It is also |
|
17385 +used as the current directory if no current directory is set by the |
|
17386 +current_directory option on the transport or the transport_current_directory |
|
17387 +option on the router. If the expansion fails for any reason, including forced |
|
17388 +failure, an error is logged, and delivery is deferred. |
|
17389 + |
|
17390 ++-------------------------------------------------------+ |
|
17391 +|initgroups|Use: transports|Type: boolean|Default: false| |
|
17392 ++-------------------------------------------------------+ |
|
17393 + |
|
17394 +If this option is true and the uid for the delivery process is provided by the |
|
17395 +transport, the initgroups() function is called when running the transport to |
|
17396 +ensure that any additional groups associated with the uid are set up. |
|
17397 + |
|
17398 ++-----------------------------------------------------------+ |
|
17399 +|message_size_limit|Use: transports|Type: string*|Default: 0| |
|
17400 ++-----------------------------------------------------------+ |
|
17401 + |
|
17402 +This option controls the size of messages passed through the transport. It is |
|
17403 +expanded before use; the result of the expansion must be a sequence of decimal |
|
17404 +digits, optionally followed by K or M. If the expansion fails for any reason, |
|
17405 +including forced failure, or if the result is not of the required form, |
|
17406 +delivery is deferred. If the value is greater than zero and the size of a |
|
17407 +message exceeds this limit, the address is failed. If there is any chance that |
|
17408 +the resulting bounce message could be routed to the same transport, you should |
|
17409 +ensure that return_size_limit is less than the transport's message_size_limit, |
|
17410 +as otherwise the bounce message will fail to get delivered. |
|
17411 + |
|
17412 ++-----------------------------------------------------------------+ |
|
17413 +|rcpt_include_affixes|Use: transports|Type: boolean|Default: false| |
|
17414 ++-----------------------------------------------------------------+ |
|
17415 + |
|
17416 +When this option is false (the default), and an address that has had any |
|
17417 +affixes (prefixes or suffixes) removed from the local part is delivered by any |
|
17418 +form of SMTP or LMTP, the affixes are not included. For example, if a router |
|
17419 +that contains |
|
17420 + |
|
17421 +local_part_prefix = *- |
|
17422 + |
|
17423 +routes the address abc-xyz@some.domain to an SMTP transport, the envelope is |
|
17424 +delivered with |
|
17425 + |
|
17426 +RCPT TO:<xyz@some.domain> |
|
17427 + |
|
17428 +This is also the case when an ACL-time callout is being used to verify a |
|
17429 +recipient address. However, if rcpt_include_affixes is set true, the whole |
|
17430 +local part is included in the RCPT command. This option applies to BSMTP |
|
17431 +deliveries by the appendfile and pipe transports as well as to the lmtp and |
|
17432 +smtp transports. |
|
17433 + |
|
17434 ++---------------------------------------------------------------------+ |
|
17435 +|retry_use_local_part|Use: transports|Type: boolean|Default: see below| |
|
17436 ++---------------------------------------------------------------------+ |
|
17437 + |
|
17438 +When a delivery suffers a temporary failure, a retry record is created in |
|
17439 +Exim's hints database. For remote deliveries, the key for the retry record is |
|
17440 +based on the name and/or IP address of the failing remote host. For local |
|
17441 +deliveries, the key is normally the entire address, including both the local |
|
17442 +part and the domain. This is suitable for most common cases of local delivery |
|
17443 +temporary failure - for example, exceeding a mailbox quota should delay only |
|
17444 +deliveries to that mailbox, not to the whole domain. |
|
17445 + |
|
17446 +However, in some special cases you may want to treat a temporary local delivery |
|
17447 +as a failure associated with the domain, and not with a particular local part. |
|
17448 +(For example, if you are storing all mail for some domain in files.) You can do |
|
17449 +this by setting retry_use_local_part false. |
|
17450 + |
|
17451 +For all the local transports, its default value is true. For remote transports, |
|
17452 +the default value is false for tidiness, but changing the value has no effect |
|
17453 +on a remote transport in the current implementation. |
|
17454 + |
|
17455 ++--------------------------------------------------------+ |
|
17456 +|return_path|Use: transports|Type: string*|Default: unset| |
|
17457 ++--------------------------------------------------------+ |
|
17458 + |
|
17459 +If this option is set, the string is expanded at transport time and replaces |
|
17460 +the existing return path (envelope sender) value in the copy of the message |
|
17461 +that is being delivered. An empty return path is permitted. This feature is |
|
17462 +designed for remote deliveries, where the value of this option is used in the |
|
17463 +SMTP MAIL command. If you set return_path for a local transport, the only |
|
17464 +effect is to change the address that is placed in the Return-path: header line, |
|
17465 +if one is added to the message (see the next option). |
|
17466 + |
|
17467 +Note: A changed return path is not logged unless you add |
|
17468 +return_path_on_delivery to the log selector. |
|
17469 + |
|
17470 +The expansion can refer to the existing value via $return_path. This is either |
|
17471 +the message's envelope sender, or an address set by the errors_to option on a |
|
17472 +router. If the expansion is forced to fail, no replacement occurs; if it fails |
|
17473 +for another reason, delivery is deferred. This option can be used to support |
|
17474 +VERP (Variable Envelope Return Paths) - see section 47.6. |
|
17475 + |
|
17476 +Note: If a delivery error is detected locally, including the case when a remote |
|
17477 +server rejects a message at SMTP time, the bounce message is not sent to the |
|
17478 +value of this option. It is sent to the previously set errors address. This |
|
17479 +defaults to the incoming sender address, but can be changed by setting |
|
17480 +errors_to in a router. |
|
17481 + |
|
17482 ++------------------------------------------------------------+ |
|
17483 +|return_path_add|Use: transports|Type: boolean|Default: false| |
|
17484 ++------------------------------------------------------------+ |
|
17485 + |
|
17486 +If this option is true, a Return-path: header is added to the message. Although |
|
17487 +the return path is normally available in the prefix line of BSD mailboxes, this |
|
17488 +is commonly not displayed by MUAs, and so the user does not have easy access to |
|
17489 +it. |
|
17490 + |
|
17491 +RFC 2821 states that the Return-path: header is added to a message "when the |
|
17492 +delivery SMTP server makes the final delivery". This implies that this header |
|
17493 +should not be present in incoming messages. Exim has a configuration option, |
|
17494 +return_path_remove, which requests removal of this header from incoming |
|
17495 +messages, so that delivered messages can safely be resent to other recipients. |
|
17496 + |
|
17497 ++-------------------------------------------------------------+ |
|
17498 +|shadow_condition|Use: transports|Type: string*|Default: unset| |
|
17499 ++-------------------------------------------------------------+ |
|
17500 + |
|
17501 +See shadow_transport below. |
|
17502 + |
|
17503 ++------------------------------------------------------------+ |
|
17504 +|shadow_transport|Use: transports|Type: string|Default: unset| |
|
17505 ++------------------------------------------------------------+ |
|
17506 + |
|
17507 +A local transport may set the shadow_transport option to the name of another |
|
17508 +local transport. Shadow remote transports are not supported. |
|
17509 + |
|
17510 +Whenever a delivery to the main transport succeeds, and either shadow_condition |
|
17511 +is unset, or its expansion does not result in the empty string or one of the |
|
17512 +strings "0" or "no" or "false", the message is also passed to the shadow |
|
17513 +transport, with the same delivery address or addresses. If expansion fails, no |
|
17514 +action is taken except that non-forced expansion failures cause a log line to |
|
17515 +be written. |
|
17516 + |
|
17517 +The result of the shadow transport is discarded and does not affect the |
|
17518 +subsequent processing of the message. Only a single level of shadowing is |
|
17519 +provided; the shadow_transport option is ignored on any transport when it is |
|
17520 +running as a shadow. Options concerned with output from pipes are also ignored. |
|
17521 +The log line for the successful delivery has an item added on the end, of the |
|
17522 +form |
|
17523 + |
|
17524 +ST=<shadow transport name> |
|
17525 + |
|
17526 +If the shadow transport did not succeed, the error message is put in |
|
17527 +parentheses afterwards. Shadow transports can be used for a number of different |
|
17528 +purposes, including keeping more detailed log information than Exim normally |
|
17529 +provides, and implementing automatic acknowledgment policies based on message |
|
17530 +headers that some sites insist on. |
|
17531 + |
|
17532 ++-------------------------------------------------------------+ |
|
17533 +|transport_filter|Use: transports|Type: string*|Default: unset| |
|
17534 ++-------------------------------------------------------------+ |
|
17535 + |
|
17536 +This option sets up a filtering (in the Unix shell sense) process for messages |
|
17537 +at transport time. It should not be confused with mail filtering as set up by |
|
17538 +individual users or via a system filter. |
|
17539 + |
|
17540 +When the message is about to be written out, the command specified by |
|
17541 +transport_filter is started up in a separate, parallel process, and the entire |
|
17542 +message, including the header lines, is passed to it on its standard input |
|
17543 +(this in fact is done from a third process, to avoid deadlock). The command |
|
17544 +must be specified as an absolute path. |
|
17545 + |
|
17546 +The lines of the message that are written to the transport filter are |
|
17547 +terminated by newline ("\n"). The message is passed to the filter before any |
|
17548 +SMTP-specific processing, such as turning "\n" into "\r\n" and escaping lines |
|
17549 +beginning with a dot, and also before any processing implied by the settings of |
|
17550 +check_string and escape_string in the appendfile or pipe transports. |
|
17551 + |
|
17552 +The standard error for the filter process is set to the same destination as its |
|
17553 +standard output; this is read and written to the message's ultimate |
|
17554 +destination. The process that writes the message to the filter, the filter |
|
17555 +itself, and the original process that reads the result and delivers it are all |
|
17556 +run in parallel, like a shell pipeline. |
|
17557 + |
|
17558 +The filter can perform any transformations it likes, but of course should take |
|
17559 +care not to break RFC 2822 syntax. Exim does not check the result, except to |
|
17560 +test for a final newline when SMTP is in use. All messages transmitted over |
|
17561 +SMTP must end with a newline, so Exim supplies one if it is missing. |
|
17562 + |
|
17563 +A transport filter can be used to provide content-scanning on a per-user basis |
|
17564 +at delivery time if the only required effect of the scan is to modify the |
|
17565 +message. For example, a content scan could insert a new header line containing |
|
17566 +a spam score. This could be interpreted by a filter in the user's MUA. It is |
|
17567 +not possible to discard a message at this stage. |
|
17568 + |
|
17569 +A problem might arise if the filter increases the size of a message that is |
|
17570 +being sent down an SMTP connection. If the receiving SMTP server has indicated |
|
17571 +support for the SIZE parameter, Exim will have sent the size of the message at |
|
17572 +the start of the SMTP session. If what is actually sent is substantially more, |
|
17573 +the server might reject the message. This can be worked round by setting the |
|
17574 +size_addition option on the smtp transport, either to allow for additions to |
|
17575 +the message, or to disable the use of SIZE altogether. |
|
17576 + |
|
17577 +The value of the transport_filter option is the command string for starting the |
|
17578 +filter, which is run directly from Exim, not under a shell. The string is |
|
17579 +parsed by Exim in the same way as a command string for the pipe transport: Exim |
|
17580 +breaks it up into arguments and then expands each argument separately (see |
|
17581 +section 29.3). Any kind of expansion failure causes delivery to be deferred. |
|
17582 +The special argument $pipe_addresses is replaced by a number of arguments, one |
|
17583 +for each address that applies to this delivery. (This isn't an ideal name for |
|
17584 +this feature here, but as it was already implemented for the pipe transport, it |
|
17585 +seemed sensible not to change it.) |
|
17586 + |
|
17587 +The expansion variables $host and $host_address are available when the |
|
17588 +transport is a remote one. They contain the name and IP address of the host to |
|
17589 +which the message is being sent. For example: |
|
17590 + |
|
17591 +transport_filter = /some/directory/transport-filter.pl \ |
|
17592 + $host $host_address $sender_address $pipe_addresses |
|
17593 + |
|
17594 +Two problems arise if you want to use more complicated expansion items to |
|
17595 +generate transport filter commands, both of which due to the fact that the |
|
17596 +command is split up before expansion. |
|
17597 + |
|
17598 + * If an expansion item contains white space, you must quote it, so that it is |
|
17599 + all part of the same command item. If the entire option setting is one such |
|
17600 + expansion item, you have to take care what kind of quoting you use. For |
|
17601 + example: |
|
17602 + |
|
17603 + transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}' |
|
17604 + |
|
17605 + This runs the command /bin/cmd1 if the host name is a.b.c, and /bin/cmd2 |
|
17606 + otherwise. If double quotes had been used, they would have been stripped by |
|
17607 + Exim when it read the option's value. When the value is used, if the single |
|
17608 + quotes were missing, the line would be split into two items, "/bin/cmd${if" |
|
17609 + and "eq{$host}{a.b.c}{1}{2}", and an error would occur when Exim tried to |
|
17610 + expand the first one. |
|
17611 + |
|
17612 + * Except for the special case of $pipe_addresses that is mentioned above, an |
|
17613 + expansion cannot generate multiple arguments, or a command name followed by |
|
17614 + arguments. Consider this example: |
|
17615 + |
|
17616 + transport_filter = ${lookup{$host}lsearch{/a/file}\ |
|
17617 + {$value}{/bin/cat}} |
|
17618 + |
|
17619 + The result of the lookup is interpreted as the name of the command, even if |
|
17620 + it contains white space. The simplest way round this is to use a shell: |
|
17621 + |
|
17622 + transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\ |
|
17623 + {$value}{/bin/cat}} |
|
17624 + |
|
17625 +The filter process is run under the same uid and gid as the normal delivery. |
|
17626 +For remote deliveries this is the Exim uid/gid by default. The command should |
|
17627 +normally yield a zero return code. Transport filters are not supposed to fail. |
|
17628 +A non-zero code is taken to mean that the transport filter encountered some |
|
17629 +serious problem. Delivery of the message is deferred; the message remains on |
|
17630 +the queue and is tried again later. It is not possible to cause a message to be |
|
17631 +bounced from a transport filter. |
|
17632 + |
|
17633 +If a transport filter is set on an autoreply transport, the original message is |
|
17634 +passed through the filter as it is being copied into the newly generated |
|
17635 +message, which happens if the return_message option is set. |
|
17636 + |
|
17637 ++---------------------------------------------------------------+ |
|
17638 +|transport_filter_timeout|Use: transports|Type: time|Default: 5m| |
|
17639 ++---------------------------------------------------------------+ |
|
17640 + |
|
17641 +When Exim is reading the output of a transport filter, it a applies a timeout |
|
17642 +that can be set by this option. Exceeding the timeout is normally treated as a |
|
17643 +temporary delivery failure. However, if a transport filter is used with a pipe |
|
17644 +transport, a timeout in the transport filter is treated in the same way as a |
|
17645 +timeout in the pipe command itself. By default, a timeout is a hard error, but |
|
17646 +if the pipe transport's timeout_defer option is set true, it becomes a |
|
17647 +temporary error. |
|
17648 + |
|
17649 ++-----------------------------------------------------+ |
|
17650 +|user|Use: transports|Type: string*|Default: Exim user| |
|
17651 ++-----------------------------------------------------+ |
|
17652 + |
|
17653 +This option specifies the user under whose uid the delivery process is to be |
|
17654 +run, overriding any uid that may have been set by the router. If the user is |
|
17655 +given as a name, the uid is looked up from the password data, and the |
|
17656 +associated group is taken as the value of the gid to be used if the group |
|
17657 +option is not set. |
|
17658 + |
|
17659 +For deliveries that use local transports, a user and group are normally |
|
17660 +specified explicitly or implicitly (for example, as a result of |
|
17661 +check_local_user) by the router or transport. |
|
17662 + |
|
17663 +For remote transports, you should leave this option unset unless you really are |
|
17664 +sure you know what you are doing. When a remote transport is running, it needs |
|
17665 +to be able to access Exim's hints databases, because each host may have its own |
|
17666 +retry data. |
|
17667 + |
|
17668 +25. Address batching in local transports |
|
17669 + |
|
17670 +The only remote transport (smtp) is normally configured to handle more than one |
|
17671 +address at a time, so that when several addresses are routed to the same remote |
|
17672 +host, just one copy of the message is sent. Local transports, however, normally |
|
17673 +handle one address at a time. That is, a separate instance of the transport is |
|
17674 +run for each address that is routed to the transport. A separate copy of the |
|
17675 +message is delivered each time. |
|
17676 + |
|
17677 +In special cases, it may be desirable to handle several addresses at once in a |
|
17678 +local transport, for example: |
|
17679 + |
|
17680 + * In an appendfile transport, when storing messages in files for later |
|
17681 + delivery by some other means, a single copy of the message with multiple |
|
17682 + recipients saves space. |
|
17683 + |
|
17684 + * In an lmtp transport, when delivering over "local SMTP" to some process, a |
|
17685 + single copy saves time, and is the normal way LMTP is expected to work. |
|
17686 + |
|
17687 + * In a pipe transport, when passing the message to a scanner program or to |
|
17688 + some other delivery mechanism such as UUCP, multiple recipients may be |
|
17689 + acceptable. |
|
17690 + |
|
17691 +These three local transports all have the same options for controlling multiple |
|
17692 +("batched") deliveries, namely batch_max and batch_id. To save repeating the |
|
17693 +information for each transport, these options are described here. |
|
17694 + |
|
17695 +The batch_max option specifies the maximum number of addresses that can be |
|
17696 +delivered together in a single run of the transport. Its default value is one |
|
17697 +(no batching). When more than one address is routed to a transport that has a |
|
17698 +batch_max value greater than one, the addresses are delivered in a batch (that |
|
17699 +is, in a single run of the transport with multiple recipients), subject to |
|
17700 +certain conditions: |
|
17701 + |
|
17702 + * If any of the transport's options contain a reference to $local_part, no |
|
17703 + batching is possible. |
|
17704 + |
|
17705 + * If any of the transport's options contain a reference to $domain, only |
|
17706 + addresses with the same domain are batched. |
|
17707 + |
|
17708 + * If batch_id is set, it is expanded for each address, and only those |
|
17709 + addresses with the same expanded value are batched. This allows you to |
|
17710 + specify customized batching conditions. Failure of the expansion for any |
|
17711 + reason, including forced failure, disables batching, but it does not stop |
|
17712 + the delivery from taking place. |
|
17713 + |
|
17714 + * Batched addresses must also have the same errors address (where to send |
|
17715 + delivery errors), the same header additions and removals, the same user and |
|
17716 + group for the transport, and if a host list is present, the first host must |
|
17717 + be the same. |
|
17718 + |
|
17719 +In the case of the appendfile and pipe transports, batching applies both when |
|
17720 +the file or pipe command is specified in the transport, and when it is |
|
17721 +specified by a redirect router, but all the batched addresses must of course be |
|
17722 +routed to the same file or pipe command. These two transports have an option |
|
17723 +called use_bsmtp, which causes them to deliver the message in "batched SMTP" |
|
17724 +format, with the envelope represented as SMTP commands. The check_string and |
|
17725 +escape_string options are forced to the values |
|
17726 + |
|
17727 +check_string = "." |
|
17728 +escape_string = ".." |
|
17729 + |
|
17730 +when batched SMTP is in use. A full description of the batch SMTP mechanism is |
|
17731 +given in section 45.10. The lmtp transport does not have a use_bsmtp option, |
|
17732 +because it always delivers using the SMTP protocol. |
|
17733 + |
|
17734 +If the generic envelope_to_add option is set for a batching transport, the |
|
17735 +Envelope-to: header that is added to the message contains all the addresses |
|
17736 +that are being processed together. If you are using a batching appendfile |
|
17737 +transport without use_bsmtp, the only way to preserve the recipient addresses |
|
17738 +is to set the envelope_to_add option. |
|
17739 + |
|
17740 +If you are using a pipe transport without BSMTP, and setting the transport's |
|
17741 +command option, you can include $pipe_addresses as part of the command. This is |
|
17742 +not a true variable; it is a bit of magic that causes each of the recipient |
|
17743 +addresses to be inserted into the command as a separate argument. This provides |
|
17744 +a way of accessing all the addresses that are being delivered in the batch. |
|
17745 +Note: This is not possible for pipe commands that are specified by a redirect |
|
17746 +router. |
|
17747 + |
|
17748 +26. The appendfile transport |
|
17749 + |
|
17750 +The appendfile transport delivers a message by appending it to an existing |
|
17751 +file, or by creating an entirely new file in a specified directory. Single |
|
17752 +files to which messages are appended can be in the traditional Unix mailbox |
|
17753 +format, or optionally in the MBX format supported by the Pine MUA and |
|
17754 +University of Washington IMAP daemon, inter alia. When each message is being |
|
17755 +delivered as a separate file, "maildir" format can optionally be used to give |
|
17756 +added protection against failures that happen part-way through the delivery. A |
|
17757 +third form of separate-file delivery known as "mailstore" is also supported. |
|
17758 +For all file formats, Exim attempts to create as many levels of directory as |
|
17759 +necessary, provided that create_directory is set. |
|
17760 + |
|
17761 +The code for the optional formats is not included in the Exim binary by |
|
17762 +default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or |
|
17763 +SUPPORT_MAILSTORE in Local/Makefile to have the appropriate code included. |
|
17764 + |
|
17765 +Exim recognizes system quota errors, and generates an appropriate message. Exim |
|
17766 +also supports its own quota control within the transport, for use when the |
|
17767 +system facility is unavailable or cannot be used for some reason. |
|
17768 + |
|
17769 +If there is an error while appending to a file (for example, quota exceeded or |
|
17770 +partition filled), Exim attempts to reset the file's length and last |
|
17771 +modification time back to what they were before. If there is an error while |
|
17772 +creating an entirely new file, the new file is removed. |
|
17773 + |
|
17774 +Before appending to a file, a number of security checks are made, and the file |
|
17775 +is locked. A detailed description is given below, after the list of private |
|
17776 +options. |
|
17777 + |
|
17778 +The appendfile transport is most commonly used for local deliveries to users' |
|
17779 +mailboxes. However, it can also be used as a pseudo-remote transport for |
|
17780 +putting messages into files for remote delivery by some means other than Exim. |
|
17781 +"Batch SMTP" format is often used in this case (see the use_bsmtp option). |
|
17782 + |
|
17783 +26.1Â The file and directory options |
|
17784 + |
|
17785 +The file option specifies a single file, to which the message is appended; the |
|
17786 +directory option specifies a directory, in which a new file containing the |
|
17787 +message is created. Only one of these two options can be set, and for normal |
|
17788 +deliveries to mailboxes, one of them must be set. |
|
17789 + |
|
17790 +However, appendfile is also used for delivering messages to files or |
|
17791 +directories whose names (or parts of names) are obtained from alias, |
|
17792 +forwarding, or filtering operations (for example, a save command in a user's |
|
17793 +Exim filter). When such a transport is running, $local_part contains the local |
|
17794 +part that was aliased or forwarded, and $address_file contains the name (or |
|
17795 +partial name) of the file or directory generated by the redirection operation. |
|
17796 +There are two cases: |
|
17797 + |
|
17798 + * If neither file nor directory is set, the redirection operation must |
|
17799 + specify an absolute path (one that begins with "/"). This is the most |
|
17800 + common case when users with local accounts use filtering to sort mail into |
|
17801 + different folders. See for example, the address_file transport in the |
|
17802 + default configuration. If the path ends with a slash, it is assumed to be |
|
17803 + the name of a directory. A delivery to a directory can also be forced by |
|
17804 + setting maildir_format or mailstore_format. |
|
17805 + |
|
17806 + * If file or directory is set for a delivery from a redirection, it is used |
|
17807 + to determine the file or directory name for the delivery. Normally, the |
|
17808 + contents of $address_file are used in some way in the string expansion. |
|
17809 + |
|
17810 +As an example of the second case, consider an environment where users do not |
|
17811 +have home directories. They may be permitted to use Exim filter commands of the |
|
17812 +form: |
|
17813 + |
|
17814 +save folder23 |
|
17815 + |
|
17816 +or Sieve filter commands of the form: |
|
17817 + |
|
17818 +require "fileinto"; |
|
17819 +fileinto "folder23"; |
|
17820 + |
|
17821 +In this situation, the expansion of file or directory in the transport must |
|
17822 +transform the relative path into an appropriate absolute file name. In the case |
|
17823 +of Sieve filters, the name inbox must be handled. It is the name that is used |
|
17824 +as a result of a "keep" action in the filter. This example shows one way of |
|
17825 +handling this requirement: |
|
17826 + |
|
17827 +file = ${if eq{$address_file}{inbox} \ |
|
17828 + {/var/mail/$local_part} \ |
|
17829 + {${if eq{${substr_0_1:$address_file}}{/} \ |
|
17830 + {$address_file} \ |
|
17831 + {$home/mail/$address_file} \ |
|
17832 + }} \ |
|
17833 + } |
|
17834 + |
|
17835 +With this setting of file, inbox refers to the standard mailbox location, |
|
17836 +absolute paths are used without change, and other folders are in the mail |
|
17837 +directory within the home directory. |
|
17838 + |
|
17839 +Note 1: While processing an Exim filter, a relative path such as folder23 is |
|
17840 +turned into an absolute path if a home directory is known to the router. In |
|
17841 +particular, this is the case if check_local_user is set. If you want to prevent |
|
17842 +this happening at routing time, you can set router_home_directory empty. This |
|
17843 +forces the router to pass the relative path to the transport. |
|
17844 + |
|
17845 +Note 2: An absolute path in $address_file is not treated specially; the file or |
|
17846 +directory option is still used if it is set. |
|
17847 + |
|
17848 +26.2Â Private options for appendfile |
|
17849 + |
|
17850 ++-------------------------------------------------------+ |
|
17851 +|allow_fifo|Use: appendfile|Type: boolean|Default: false| |
|
17852 ++-------------------------------------------------------+ |
|
17853 + |
|
17854 +Setting this option permits delivery to named pipes (FIFOs) as well as to |
|
17855 +regular files. If no process is reading the named pipe at delivery time, the |
|
17856 +delivery is deferred. |
|
17857 + |
|
17858 ++----------------------------------------------------------+ |
|
17859 +|allow_symlink|Use: appendfile|Type: boolean|Default: false| |
|
17860 ++----------------------------------------------------------+ |
|
17861 + |
|
17862 +By default, appendfile will not deliver if the path name for the file is that |
|
17863 +of a symbolic link. Setting this option relaxes that constraint, but there are |
|
17864 +security issues involved in the use of symbolic links. Be sure you know what |
|
17865 +you are doing if you set this. Details of exactly what this option affects are |
|
17866 +included in the discussion which follows this list of options. |
|
17867 + |
|
17868 ++-----------------------------------------------------+ |
|
17869 +|batch_id|Use: appendfile|Type: string*|Default: unset| |
|
17870 ++-----------------------------------------------------+ |
|
17871 + |
|
17872 +See the description of local delivery batching in chapter 25. However, batching |
|
17873 +is automatically disabled for appendfile deliveries that happen as a result of |
|
17874 +forwarding or aliasing or other redirection directly to a file. |
|
17875 + |
|
17876 ++--------------------------------------------------+ |
|
17877 +|batch_max|Use: appendfile|Type: integer|Default: 1| |
|
17878 ++--------------------------------------------------+ |
|
17879 + |
|
17880 +See the description of local delivery batching in chapter 25. |
|
17881 + |
|
17882 ++--------------------------------------------------------+ |
|
17883 +|check_group|Use: appendfile|Type: boolean|Default: false| |
|
17884 ++--------------------------------------------------------+ |
|
17885 + |
|
17886 +When this option is set, the group owner of the file defined by the file option |
|
17887 +is checked to see that it is the same as the group under which the delivery |
|
17888 +process is running. The default setting is false because the default file mode |
|
17889 +is 0600, which means that the group is irrelevant. |
|
17890 + |
|
17891 ++-------------------------------------------------------+ |
|
17892 +|check_owner|Use: appendfile|Type: boolean|Default: true| |
|
17893 ++-------------------------------------------------------+ |
|
17894 + |
|
17895 +When this option is set, the owner of the file defined by the file option is |
|
17896 +checked to ensure that it is the same as the user under which the delivery |
|
17897 +process is running. |
|
17898 + |
|
17899 ++------------------------------------------------------------+ |
|
17900 +|check_string|Use: appendfile|Type: string|Default: see below| |
|
17901 ++------------------------------------------------------------+ |
|
17902 + |
|
17903 +As appendfile writes the message, the start of each line is tested for matching |
|
17904 +check_string, and if it does, the initial matching characters are replaced by |
|
17905 +the contents of escape_string. The value of check_string is a literal string, |
|
17906 +not a regular expression, and the case of any letters it contains is |
|
17907 +significant. |
|
17908 + |
|
17909 +If use_bsmtp is set the values of check_string and escape_string are forced to |
|
17910 +"." and ".." respectively, and any settings in the configuration are ignored. |
|
17911 +Otherwise, they default to "From " and ">From " when the file option is set, |
|
17912 +and unset when any of the directory, maildir, or mailstore options are set. |
|
17913 + |
|
17914 +The default settings, along with message_prefix and message_suffix, are |
|
17915 +suitable for traditional "BSD" mailboxes, where a line beginning with "From " |
|
17916 +indicates the start of a new message. All four options need changing if another |
|
17917 +format is used. For example, to deliver to mailboxes in MMDF format: |
|
17918 + |
|
17919 +check_string = "\1\1\1\1\n" |
|
17920 +escape_string = "\1\1\1\1 \n" |
|
17921 +message_prefix = "\1\1\1\1\n" |
|
17922 +message_suffix = "\1\1\1\1\n" |
|
17923 + |
|
17924 ++------------------------------------------------------------+ |
|
17925 +|create_directory|Use: appendfile|Type: boolean|Default: true| |
|
17926 ++------------------------------------------------------------+ |
|
17927 + |
|
17928 +When this option is true, Exim attempts to create any missing superior |
|
17929 +directories for the file that it is about to write. A created directory's mode |
|
17930 +is given by the directory_mode option. |
|
17931 + |
|
17932 +The group ownership of a newly created directory is highly dependent on the |
|
17933 +operating system (and possibly the file system) that is being used. For |
|
17934 +example, in Solaris, if the parent directory has the setgid bit set, its group |
|
17935 +is propagated to the child; if not, the currently set group is used. However, |
|
17936 +in FreeBSD, the parent's group is always used. |
|
17937 + |
|
17938 ++----------------------------------------------------------+ |
|
17939 +|create_file|Use: appendfile|Type: string|Default: anywhere| |
|
17940 ++----------------------------------------------------------+ |
|
17941 + |
|
17942 +This option constrains the location of files and directories that are created |
|
17943 +by this transport. It applies to files defined by the file option and |
|
17944 +directories defined by the directory option. In the case of maildir delivery, |
|
17945 +it applies to the top level directory, not the maildir directories beneath. |
|
17946 + |
|
17947 +The option must be set to one of the words "anywhere", "inhome", or |
|
17948 +"belowhome". In the second and third cases, a home directory must have been set |
|
17949 +for the transport. This option is not useful when an explicit file name is |
|
17950 +given for normal mailbox deliveries. It is intended for the case when file |
|
17951 +names are generated from users' .forward files. These are usually handled by an |
|
17952 +appendfile transport called address_file. See also file_must_exist. |
|
17953 + |
|
17954 ++------------------------------------------------------+ |
|
17955 +|directory|Use: appendfile|Type: string*|Default: unset| |
|
17956 ++------------------------------------------------------+ |
|
17957 + |
|
17958 +This option is mutually exclusive with the file option, but one of file or |
|
17959 +directory must be set, unless the delivery is the direct result of a |
|
17960 +redirection (see section 26.1). |
|
17961 + |
|
17962 +When directory is set, the string is expanded, and the message is delivered |
|
17963 +into a new file or files in or below the given directory, instead of being |
|
17964 +appended to a single mailbox file. A number of different formats are provided |
|
17965 +(see maildir_format and mailstore_format), and see section 26.4 for further |
|
17966 +details of this form of delivery. |
|
17967 + |
|
17968 ++---------------------------------------------------------------+ |
|
17969 +|directory_file|Use: appendfile|Type: string*|Default: see below| |
|
17970 ++---------------------------------------------------------------+ |
|
17971 + |
|
17972 +When directory is set, but neither maildir_format nor mailstore_format is set, |
|
17973 +appendfile delivers each message into a file whose name is obtained by |
|
17974 +expanding this string. The default value is: |
|
17975 + |
|
17976 +q${base62:$tod_epoch}-$inode |
|
17977 + |
|
17978 +This generates a unique name from the current time, in base 62 form, and the |
|
17979 +inode of the file. The variable $inode is available only when expanding this |
|
17980 +option. |
|
17981 + |
|
17982 ++----------------------------------------------------------------+ |
|
17983 +|directory_mode|Use: appendfile|Type: octal integer|Default: 0700| |
|
17984 ++----------------------------------------------------------------+ |
|
17985 + |
|
17986 +If appendfile creates any directories as a result of the create_directory |
|
17987 +option, their mode is specified by this option. |
|
17988 + |
|
17989 ++-------------------------------------------------------------------+ |
|
17990 +|escape_string|Use: appendfile|Type: string|Default: see description| |
|
17991 ++-------------------------------------------------------------------+ |
|
17992 + |
|
17993 +See check_string above. |
|
17994 + |
|
17995 ++-------------------------------------------------+ |
|
17996 +|file|Use: appendfile|Type: string*|Default: unset| |
|
17997 ++-------------------------------------------------+ |
|
17998 + |
|
17999 +This option is mutually exclusive with the directory option, but one of file or |
|
18000 +directory must be set, unless the delivery is the direct result of a |
|
18001 +redirection (see section 26.1). The file option specifies a single file, to |
|
18002 +which the message is appended. One or more of use_fcntl_lock, use_flock_lock, |
|
18003 +or use_lockfile must be set with file. |
|
18004 + |
|
18005 +If you are using more than one host to deliver over NFS into the same |
|
18006 +mailboxes, you should always use lock files. |
|
18007 + |
|
18008 +The string value is expanded for each delivery, and must yield an absolute |
|
18009 +path. The most common settings of this option are variations on one of these |
|
18010 +examples: |
|
18011 + |
|
18012 +file = /var/spool/mail/$local_part |
|
18013 +file = /home/$local_part/inbox |
|
18014 +file = $home/inbox |
|
18015 + |
|
18016 +In the first example, all deliveries are done into the same directory. If Exim |
|
18017 +is configured to use lock files (see use_lockfile below) it must be able to |
|
18018 +create a file in the directory, so the "sticky" bit must be turned on for |
|
18019 +deliveries to be possible, or alternatively the group option can be used to run |
|
18020 +the delivery under a group id which has write access to the directory. |
|
18021 + |
|
18022 ++-------------------------------------------------------+ |
|
18023 +|file_format|Use: appendfile|Type: string|Default: unset| |
|
18024 ++-------------------------------------------------------+ |
|
18025 + |
|
18026 +This option requests the transport to check the format of an existing file |
|
18027 +before adding to it. The check consists of matching a specific string at the |
|
18028 +start of the file. The value of the option consists of an even number of |
|
18029 +colon-separated strings. The first of each pair is the test string, and the |
|
18030 +second is the name of a transport. If the transport associated with a matched |
|
18031 +string is not the current transport, control is passed over to the other |
|
18032 +transport. For example, suppose the standard local_delivery transport has this |
|
18033 +added to it: |
|
18034 + |
|
18035 +file_format = "From : local_delivery :\ |
|
18036 + \1\1\1\1\n : local_mmdf_delivery" |
|
18037 + |
|
18038 +Mailboxes that begin with "From" are still handled by this transport, but if a |
|
18039 +mailbox begins with four binary ones followed by a newline, control is passed |
|
18040 +to a transport called local_mmdf_delivery, which presumably is configured to do |
|
18041 +the delivery in MMDF format. If a mailbox does not exist or is empty, it is |
|
18042 +assumed to match the current transport. If the start of a mailbox doesn't match |
|
18043 +any string, or if the transport named for a given string is not defined, |
|
18044 +delivery is deferred. |
|
18045 + |
|
18046 ++------------------------------------------------------------+ |
|
18047 +|file_must_exist|Use: appendfile|Type: boolean|Default: false| |
|
18048 ++------------------------------------------------------------+ |
|
18049 + |
|
18050 +If this option is true, the file specified by the file option must exist. A |
|
18051 +temporary error occurs if it does not, causing delivery to be deferred. If this |
|
18052 +option is false, the file is created if it does not exist. |
|
18053 + |
|
18054 ++---------------------------------------------------------+ |
|
18055 +|lock_fcntl_timeout|Use: appendfile|Type: time|Default: 0s| |
|
18056 ++---------------------------------------------------------+ |
|
18057 + |
|
18058 +By default, the appendfile transport uses non-blocking calls to fcntl() when |
|
18059 +locking an open mailbox file. If the call fails, the delivery process sleeps |
|
18060 +for lock_interval and tries again, up to lock_retries times. Non-blocking calls |
|
18061 +are used so that the file is not kept open during the wait for the lock; the |
|
18062 +reason for this is to make it as safe as possible for deliveries over NFS in |
|
18063 +the case when processes might be accessing an NFS mailbox without using a lock |
|
18064 +file. This should not be done, but misunderstandings and hence |
|
18065 +misconfigurations are not unknown. |
|
18066 + |
|
18067 +On a busy system, however, the performance of a non-blocking lock approach is |
|
18068 +not as good as using a blocking lock with a timeout. In this case, the waiting |
|
18069 +is done inside the system call, and Exim's delivery process acquires the lock |
|
18070 +and can proceed as soon as the previous lock holder releases it. |
|
18071 + |
|
18072 +If lock_fcntl_timeout is set to a non-zero time, blocking locks, with that |
|
18073 +timeout, are used. There may still be some retrying: the maximum number of |
|
18074 +retries is |
|
18075 + |
|
18076 +(lock_retries * lock_interval) / lock_fcntl_timeout |
|
18077 + |
|
18078 +rounded up to the next whole number. In other words, the total time during |
|
18079 +which appendfile is trying to get a lock is roughly the same, unless |
|
18080 +lock_fcntl_timeout is set very large. |
|
18081 + |
|
18082 +You should consider setting this option if you are getting a lot of delayed |
|
18083 +local deliveries because of errors of the form |
|
18084 + |
|
18085 +failed to lock mailbox /some/file (fcntl) |
|
18086 + |
|
18087 ++---------------------------------------------------------+ |
|
18088 +|lock_flock_timeout|Use: appendfile|Type: time|Default: 0s| |
|
18089 ++---------------------------------------------------------+ |
|
18090 + |
|
18091 +This timeout applies to file locking when using flock() (see use_flock); the |
|
18092 +timeout operates in a similar manner to lock_fcntl_timeout. |
|
18093 + |
|
18094 ++----------------------------------------------------+ |
|
18095 +|lock_interval|Use: appendfile|Type: time|Default: 3s| |
|
18096 ++----------------------------------------------------+ |
|
18097 + |
|
18098 +This specifies the time to wait between attempts to lock the file. See below |
|
18099 +for details of locking. |
|
18100 + |
|
18101 ++------------------------------------------------------+ |
|
18102 +|lock_retries|Use: appendfile|Type: integer|Default: 10| |
|
18103 ++------------------------------------------------------+ |
|
18104 + |
|
18105 +This specifies the maximum number of attempts to lock the file. A value of zero |
|
18106 +is treated as 1. See below for details of locking. |
|
18107 + |
|
18108 ++---------------------------------------------------------------+ |
|
18109 +|lockfile_mode|Use: appendfile|Type: octal integer|Default: 0600| |
|
18110 ++---------------------------------------------------------------+ |
|
18111 + |
|
18112 +This specifies the mode of the created lock file, when a lock file is being |
|
18113 +used (see use_lockfile and use_mbx_lock). |
|
18114 + |
|
18115 ++--------------------------------------------------------+ |
|
18116 +|lockfile_timeout|Use: appendfile|Type: time|Default: 30m| |
|
18117 ++--------------------------------------------------------+ |
|
18118 + |
|
18119 +When a lock file is being used (see use_lockfile), if a lock file already |
|
18120 +exists and is older than this value, it is assumed to have been left behind by |
|
18121 +accident, and Exim attempts to remove it. |
|
18122 + |
|
18123 ++--------------------------------------------------------------+ |
|
18124 +|mailbox_filecount|Use: appendfile|Type: string*|Default: unset| |
|
18125 ++--------------------------------------------------------------+ |
|
18126 + |
|
18127 +If this option is set, it is expanded, and the result is taken as the current |
|
18128 +number of files in the mailbox. It must be a decimal number, optionally |
|
18129 +followed by K or M. This provides a way of obtaining this information from an |
|
18130 +external source that maintains the data. |
|
18131 + |
|
18132 ++---------------------------------------------------------+ |
|
18133 +|mailbox_size|Use: appendfile|Type: string*|Default: unset| |
|
18134 ++---------------------------------------------------------+ |
|
18135 + |
|
18136 +If this option is set, it is expanded, and the result is taken as the current |
|
18137 +size the mailbox. It must be a decimal number, optionally followed by K or M. |
|
18138 +This provides a way of obtaining this information from an external source that |
|
18139 +maintains the data. This is likely to be helpful for maildir deliveries where |
|
18140 +it is computationally expensive to compute the size of a mailbox. |
|
18141 + |
|
18142 ++-----------------------------------------------------------+ |
|
18143 +|maildir_format|Use: appendfile|Type: boolean|Default: false| |
|
18144 ++-----------------------------------------------------------+ |
|
18145 + |
|
18146 +If this option is set with the directory option, the delivery is into a new |
|
18147 +file, in the "maildir" format that is used by other mail software. When the |
|
18148 +transport is activated directly from a redirect router (for example, the |
|
18149 +address_file transport in the default configuration), setting maildir_format |
|
18150 +causes the path received from the router to be treated as a directory, whether |
|
18151 +or not it ends with "/". This option is available only if SUPPORT_MAILDIR is |
|
18152 +present in Local/Makefile. See section 26.5 below for further details. |
|
18153 + |
|
18154 ++-----------------------------------------------------------------------------+ |
|
18155 +|maildir_quota_directory_regex|Use: appendfile|Type: string|Default: See below| |
|
18156 ++-----------------------------------------------------------------------------+ |
|
18157 + |
|
18158 +This option is relevant only when maildir_use_size_file is set. It defines a |
|
18159 +regular expression for specifying directories, relative to the quota directory |
|
18160 +(see quota_directory), that should be included in the quota calculation. The |
|
18161 +default value is: |
|
18162 + |
|
18163 +maildir_quota_directory_regex = ^(?:cur|new|\..*)$ |
|
18164 + |
|
18165 +This includes the cur and new directories, and any maildir++ folders |
|
18166 +(directories whose names begin with a dot). If you want to exclude the Trash |
|
18167 +folder from the count (as some sites do), you need to change this setting to |
|
18168 + |
|
18169 +maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$ |
|
18170 + |
|
18171 +This uses a negative lookahead in the regular expression to exclude the |
|
18172 +directory whose name is .Trash. When a directory is excluded from quota |
|
18173 +calculations, quota processing is bypassed for any messages that are delivered |
|
18174 +directly into that directory. |
|
18175 + |
|
18176 ++---------------------------------------------------------+ |
|
18177 +|maildir_retries|Use: appendfile|Type: integer|Default: 10| |
|
18178 ++---------------------------------------------------------+ |
|
18179 + |
|
18180 +This option specifies the number of times to retry when writing a file in |
|
18181 +"maildir" format. See section 26.5 below. |
|
18182 + |
|
18183 ++--------------------------------------------------------+ |
|
18184 +|maildir_tag|Use: appendfile|Type: string*|Default: unset| |
|
18185 ++--------------------------------------------------------+ |
|
18186 + |
|
18187 +This option applies only to deliveries in maildir format, and is described in |
|
18188 +section 26.5 below. |
|
18189 + |
|
18190 ++------------------------------------------------------------------+ |
|
18191 +|maildir_use_size_file|Use: appendfile|Type: boolean|Default: false| |
|
18192 ++------------------------------------------------------------------+ |
|
18193 + |
|
18194 +Setting this option true enables support for maildirsize files. Exim creates a |
|
18195 +maildirsize file in a maildir if one does not exist, taking the quota from the |
|
18196 +quota option of the transport. If quota is unset, the value is zero. See |
|
18197 +maildir_quota_directory_regex above and section 26.5 below for further details. |
|
18198 + |
|
18199 ++----------------------------------------------------------------------+ |
|
18200 +|maildirfolder_create_regex|Use: appendfile|Type: string|Default: unset| |
|
18201 ++----------------------------------------------------------------------+ |
|
18202 + |
|
18203 +The value of this option is a regular expression. If it is unset, it has no |
|
18204 +effect. Otherwise, before a maildir delivery takes place, the pattern is |
|
18205 +matched against the name of the maildir directory, that is, the directory |
|
18206 +containing the new and tmp subdirectories that will be used for the delivery. |
|
18207 +If there is a match, Exim checks for the existence of a file called |
|
18208 +maildirfolder in the directory, and creates it if it does not exist. See |
|
18209 +section 26.5 for more details. |
|
18210 + |
|
18211 ++-------------------------------------------------------------+ |
|
18212 +|mailstore_format|Use: appendfile|Type: boolean|Default: false| |
|
18213 ++-------------------------------------------------------------+ |
|
18214 + |
|
18215 +If this option is set with the directory option, the delivery is into two new |
|
18216 +files in "mailstore" format. The option is available only if SUPPORT_MAILSTORE |
|
18217 +is present in Local/Makefile. See section 26.4 below for further details. |
|
18218 + |
|
18219 ++-------------------------------------------------------------+ |
|
18220 +|mailstore_prefix|Use: appendfile|Type: string*|Default: unset| |
|
18221 ++-------------------------------------------------------------+ |
|
18222 + |
|
18223 +This option applies only to deliveries in mailstore format, and is described in |
|
18224 +section 26.4 below. |
|
18225 + |
|
18226 ++-------------------------------------------------------------+ |
|
18227 +|mailstore_suffix|Use: appendfile|Type: string*|Default: unset| |
|
18228 ++-------------------------------------------------------------+ |
|
18229 + |
|
18230 +This option applies only to deliveries in mailstore format, and is described in |
|
18231 +section 26.4 below. |
|
18232 + |
|
18233 ++-------------------------------------------------------+ |
|
18234 +|mbx_format|Use: appendfile|Type: boolean|Default: false| |
|
18235 ++-------------------------------------------------------+ |
|
18236 + |
|
18237 +This option is available only if Exim has been compiled with SUPPORT_MBX set in |
|
18238 +Local/Makefile. If mbx_format is set with the file option, the message is |
|
18239 +appended to the mailbox file in MBX format instead of traditional Unix format. |
|
18240 +This format is supported by Pine4 and its associated IMAP and POP daemons, by |
|
18241 +means of the c-client library that they all use. |
|
18242 + |
|
18243 +Note: The message_prefix and message_suffix options are not automatically |
|
18244 +changed by the use of mbx_format. They should normally be set empty when using |
|
18245 +MBX format, so this option almost always appears in this combination: |
|
18246 + |
|
18247 +mbx_format = true |
|
18248 +message_prefix = |
|
18249 +message_suffix = |
|
18250 + |
|
18251 +If none of the locking options are mentioned in the configuration, use_mbx_lock |
|
18252 +is assumed and the other locking options default to false. It is possible to |
|
18253 +specify the other kinds of locking with mbx_format, but use_fcntl_lock and |
|
18254 +use_mbx_lock are mutually exclusive. MBX locking interworks with c-client, |
|
18255 +providing for shared access to the mailbox. It should not be used if any |
|
18256 +program that does not use this form of locking is going to access the mailbox, |
|
18257 +nor should it be used if the mailbox file is NFS mounted, because it works only |
|
18258 +when the mailbox is accessed from a single host. |
|
18259 + |
|
18260 +If you set use_fcntl_lock with an MBX-format mailbox, you cannot use the |
|
18261 +standard version of c-client, because as long as it has a mailbox open (this |
|
18262 +means for the whole of a Pine or IMAP session), Exim will not be able to append |
|
18263 +messages to it. |
|
18264 + |
|
18265 ++---------------------------------------------------------------+ |
|
18266 +|message_prefix|Use: appendfile|Type: string*|Default: see below| |
|
18267 ++---------------------------------------------------------------+ |
|
18268 + |
|
18269 +The string specified here is expanded and output at the start of every message. |
|
18270 +The default is unset unless file is specified and use_bsmtp is not set, in |
|
18271 +which case it is: |
|
18272 + |
|
18273 +message_prefix = "From ${if def:return_path{$return_path}\ |
|
18274 + {MAILER-DAEMON}} $tod_bsdinbox\n" |
|
18275 + |
|
18276 +Note: If you set use_crlf true, you must change any occurrences of "\n" to "\r\ |
|
18277 +n" in message_prefix. |
|
18278 + |
|
18279 ++---------------------------------------------------------------+ |
|
18280 +|message_suffix|Use: appendfile|Type: string*|Default: see below| |
|
18281 ++---------------------------------------------------------------+ |
|
18282 + |
|
18283 +The string specified here is expanded and output at the end of every message. |
|
18284 +The default is unset unless file is specified and use_bsmtp is not set, in |
|
18285 +which case it is a single newline character. The suffix can be suppressed by |
|
18286 +setting |
|
18287 + |
|
18288 +message_suffix = |
|
18289 + |
|
18290 +Note: If you set use_crlf true, you must change any occurrences of "\n" to "\r\ |
|
18291 +n" in message_suffix. |
|
18292 + |
|
18293 ++------------------------------------------------------+ |
|
18294 +|mode|Use: appendfile|Type: octal integer|Default: 0600| |
|
18295 ++------------------------------------------------------+ |
|
18296 + |
|
18297 +If the output file is created, it is given this mode. If it already exists and |
|
18298 +has wider permissions, they are reduced to this mode. If it has narrower |
|
18299 +permissions, an error occurs unless mode_fail_narrower is false. However, if |
|
18300 +the delivery is the result of a save command in a filter file specifying a |
|
18301 +particular mode, the mode of the output file is always forced to take that |
|
18302 +value, and this option is ignored. |
|
18303 + |
|
18304 ++--------------------------------------------------------------+ |
|
18305 +|mode_fail_narrower|Use: appendfile|Type: boolean|Default: true| |
|
18306 ++--------------------------------------------------------------+ |
|
18307 + |
|
18308 +This option applies in the case when an existing mailbox file has a narrower |
|
18309 +mode than that specified by the mode option. If mode_fail_narrower is true, the |
|
18310 +delivery is deferred ("mailbox has the wrong mode"); otherwise Exim continues |
|
18311 +with the delivery attempt, using the existing mode of the file. |
|
18312 + |
|
18313 ++----------------------------------------------------------+ |
|
18314 +|notify_comsat|Use: appendfile|Type: boolean|Default: false| |
|
18315 ++----------------------------------------------------------+ |
|
18316 + |
|
18317 +If this option is true, the comsat daemon is notified after every successful |
|
18318 +delivery to a user mailbox. This is the daemon that notifies logged on users |
|
18319 +about incoming mail. |
|
18320 + |
|
18321 ++--------------------------------------------------+ |
|
18322 +|quota|Use: appendfile|Type: string*|Default: unset| |
|
18323 ++--------------------------------------------------+ |
|
18324 + |
|
18325 +This option imposes a limit on the size of the file to which Exim is appending, |
|
18326 +or to the total space used in the directory tree when the directory option is |
|
18327 +set. In the latter case, computation of the space used is expensive, because |
|
18328 +all the files in the directory (and any sub-directories) have to be |
|
18329 +individually inspected and their sizes summed. (See quota_size_regex and |
|
18330 +maildir_use_size_file for ways to avoid this in environments where users have |
|
18331 +no shell access to their mailboxes). |
|
18332 + |
|
18333 +As there is no interlock against two simultaneous deliveries into a multi-file |
|
18334 +mailbox, it is possible for the quota to be overrun in this case. For |
|
18335 +single-file mailboxes, of course, an interlock is a necessity. |
|
18336 + |
|
18337 +A file's size is taken as its used value. Because of blocking effects, this may |
|
18338 +be a lot less than the actual amount of disk space allocated to the file. If |
|
18339 +the sizes of a number of files are being added up, the rounding effect can |
|
18340 +become quite noticeable, especially on systems that have large block sizes. |
|
18341 +Nevertheless, it seems best to stick to the used figure, because this is the |
|
18342 +obvious value which users understand most easily. |
|
18343 + |
|
18344 +The value of the option is expanded, and must then be a numerical value |
|
18345 +(decimal point allowed), optionally followed by one of the letters K, M, or G, |
|
18346 +for kilobytes, megabytes, or gigabytes. If Exim is running on a system with |
|
18347 +large file support (Linux and FreeBSD have this), mailboxes larger than 2G can |
|
18348 +be handled. |
|
18349 + |
|
18350 +Note: A value of zero is interpreted as "no quota". |
|
18351 + |
|
18352 +The expansion happens while Exim is running as root, before it changes uid for |
|
18353 +the delivery. This means that files that are inaccessible to the end user can |
|
18354 +be used to hold quota values that are looked up in the expansion. When delivery |
|
18355 +fails because this quota is exceeded, the handling of the error is as for |
|
18356 +system quota failures. |
|
18357 + |
|
18358 +By default, Exim's quota checking mimics system quotas, and restricts the |
|
18359 +mailbox to the specified maximum size, though the value is not accurate to the |
|
18360 +last byte, owing to separator lines and additional headers that may get added |
|
18361 +during message delivery. When a mailbox is nearly full, large messages may get |
|
18362 +refused even though small ones are accepted, because the size of the current |
|
18363 +message is added to the quota when the check is made. This behaviour can be |
|
18364 +changed by setting quota_is_inclusive false. When this is done, the check for |
|
18365 +exceeding the quota does not include the current message. Thus, deliveries |
|
18366 +continue until the quota has been exceeded; thereafter, no further messages are |
|
18367 +delivered. See also quota_warn_threshold. |
|
18368 + |
|
18369 ++------------------------------------------------------------+ |
|
18370 +|quota_directory|Use: appendfile|Type: string*|Default: unset| |
|
18371 ++------------------------------------------------------------+ |
|
18372 + |
|
18373 +This option defines the directory to check for quota purposes when delivering |
|
18374 +into individual files. The default is the delivery directory, or, if a file |
|
18375 +called maildirfolder exists in a maildir directory, the parent of the delivery |
|
18376 +directory. |
|
18377 + |
|
18378 ++--------------------------------------------------------+ |
|
18379 +|quota_filecount|Use: appendfile|Type: string*|Default: 0| |
|
18380 ++--------------------------------------------------------+ |
|
18381 + |
|
18382 +This option applies when the directory option is set. It limits the total |
|
18383 +number of files in the directory (compare the inode limit in system quotas). It |
|
18384 +can only be used if quota is also set. The value is expanded; an expansion |
|
18385 +failure causes delivery to be deferred. A value of zero is interpreted as "no |
|
18386 +quota". |
|
18387 + |
|
18388 ++--------------------------------------------------------------+ |
|
18389 +|quota_is_inclusive|Use: appendfile|Type: boolean|Default: true| |
|
18390 ++--------------------------------------------------------------+ |
|
18391 + |
|
18392 +See quota above. |
|
18393 + |
|
18394 ++------------------------------------------------------------+ |
|
18395 +|quota_size_regex|Use: appendfile|Type: string|Default: unset| |
|
18396 ++------------------------------------------------------------+ |
|
18397 + |
|
18398 +This option applies when one of the delivery modes that writes a separate file |
|
18399 +for each message is being used. When Exim wants to find the size of one of |
|
18400 +these files in order to test the quota, it first checks quota_size_regex. If |
|
18401 +this is set to a regular expression that matches the file name, and it captures |
|
18402 +one string, that string is interpreted as a representation of the file's size. |
|
18403 +The value of quota_size_regex is not expanded. |
|
18404 + |
|
18405 +This feature is useful only when users have no shell access to their mailboxes |
|
18406 +- otherwise they could defeat the quota simply by renaming the files. This |
|
18407 +facility can be used with maildir deliveries, by setting maildir_tag to add the |
|
18408 +file length to the file name. For example: |
|
18409 + |
|
18410 +maildir_tag = ,S=$message_size |
|
18411 +quota_size_regex = ,S=(\d+) |
|
18412 + |
|
18413 +An alternative to $message_size is $message_linecount, which contains the |
|
18414 +number of lines in the message. |
|
18415 + |
|
18416 +The regular expression should not assume that the length is at the end of the |
|
18417 +file name (even though maildir_tag puts it there) because maildir MUAs |
|
18418 +sometimes add other information onto the ends of message file names. |
|
18419 + |
|
18420 +Section 26.7 contains further information. |
|
18421 + |
|
18422 ++-------------------------------------------------------------------+ |
|
18423 +|quota_warn_message|Use: appendfile|Type: string*|Default: see below| |
|
18424 ++-------------------------------------------------------------------+ |
|
18425 + |
|
18426 +See below for the use of this option. If it is not set when |
|
18427 +quota_warn_threshold is set, it defaults to |
|
18428 + |
|
18429 +quota_warn_message = "\ |
|
18430 + To: $local_part@$domain\n\ |
|
18431 + Subject: Your mailbox\n\n\ |
|
18432 + This message is automatically created \ |
|
18433 + by mail delivery software.\n\n\ |
|
18434 + The size of your mailbox has exceeded \ |
|
18435 + a warning threshold that is\n\ |
|
18436 + set by the system administrator.\n" |
|
18437 + |
|
18438 ++-------------------------------------------------------------+ |
|
18439 +|quota_warn_threshold|Use: appendfile|Type: string*|Default: 0| |
|
18440 ++-------------------------------------------------------------+ |
|
18441 + |
|
18442 +This option is expanded in the same way as quota (see above). If the resulting |
|
18443 +value is greater than zero, and delivery of the message causes the size of the |
|
18444 +file or total space in the directory tree to cross the given threshold, a |
|
18445 +warning message is sent. If quota is also set, the threshold may be specified |
|
18446 +as a percentage of it by following the value with a percent sign. For example: |
|
18447 + |
|
18448 +quota = 10M |
|
18449 +quota_warn_threshold = 75% |
|
18450 + |
|
18451 +If quota is not set, a setting of quota_warn_threshold that ends with a percent |
|
18452 +sign is ignored. |
|
18453 + |
|
18454 +The warning message itself is specified by the quota_warn_message option, and |
|
18455 +it must start with a To: header line containing the recipient(s) of the warning |
|
18456 +message. These do not necessarily have to include the recipient(s) of the |
|
18457 +original message. A Subject: line should also normally be supplied. You can |
|
18458 +include any other header lines that you want. If you do not include a From: |
|
18459 +line, the default is: |
|
18460 + |
|
18461 +From: Mail Delivery System <mailer-daemon@$qualify_domain_sender> |
|
18462 + |
|
18463 +If you supply a Reply-To: line, it overrides the global errors_reply_to option. |
|
18464 + |
|
18465 +The quota option does not have to be set in order to use this option; they are |
|
18466 +independent of one another except when the threshold is specified as a |
|
18467 +percentage. |
|
18468 + |
|
18469 ++------------------------------------------------------+ |
|
18470 +|use_bsmtp|Use: appendfile|Type: boolean|Default: false| |
|
18471 ++------------------------------------------------------+ |
|
18472 + |
|
18473 +If this option is set true, appendfile writes messages in "batch SMTP" format, |
|
18474 +with the envelope sender and recipient(s) included as SMTP commands. If you |
|
18475 +want to include a leading HELO command with such messages, you can do so by |
|
18476 +setting the message_prefix option. See section 45.10 for details of batch SMTP. |
|
18477 + |
|
18478 ++-----------------------------------------------------+ |
|
18479 +|use_crlf|Use: appendfile|Type: boolean|Default: false| |
|
18480 ++-----------------------------------------------------+ |
|
18481 + |
|
18482 +This option causes lines to be terminated with the two-character CRLF sequence |
|
18483 +(carriage return, linefeed) instead of just a linefeed character. In the case |
|
18484 +of batched SMTP, the byte sequence written to the file is then an exact image |
|
18485 +of what would be sent down a real SMTP connection. |
|
18486 + |
|
18487 +Note: The contents of the message_prefix and message_suffix options (which are |
|
18488 +used to supply the traditional "From " and blank line separators in |
|
18489 +Berkeley-style mailboxes) are written verbatim, so must contain their own |
|
18490 +carriage return characters if these are needed. In cases where these options |
|
18491 +have non-empty defaults, the values end with a single linefeed, so they must be |
|
18492 +changed to end with "\r\n" if use_crlf is set. |
|
18493 + |
|
18494 ++---------------------------------------------------------------+ |
|
18495 +|use_fcntl_lock|Use: appendfile|Type: boolean|Default: see below| |
|
18496 ++---------------------------------------------------------------+ |
|
18497 + |
|
18498 +This option controls the use of the fcntl() function to lock a file for |
|
18499 +exclusive use when a message is being appended. It is set by default unless |
|
18500 +use_flock_lock is set. Otherwise, it should be turned off only if you know that |
|
18501 +all your MUAs use lock file locking. When both use_fcntl_lock and |
|
18502 +use_flock_lock are unset, use_lockfile must be set. |
|
18503 + |
|
18504 ++-----------------------------------------------------------+ |
|
18505 +|use_flock_lock|Use: appendfile|Type: boolean|Default: false| |
|
18506 ++-----------------------------------------------------------+ |
|
18507 + |
|
18508 +This option is provided to support the use of flock() for file locking, for the |
|
18509 +few situations where it is needed. Most modern operating systems support fcntl |
|
18510 +() and lockf() locking, and these two functions interwork with each other. Exim |
|
18511 +uses fcntl() locking by default. |
|
18512 + |
|
18513 +This option is required only if you are using an operating system where flock() |
|
18514 +is used by programs that access mailboxes (typically MUAs), and where flock() |
|
18515 +does not correctly interwork with fcntl(). You can use both fcntl() and flock() |
|
18516 +locking simultaneously if you want. |
|
18517 + |
|
18518 +Not all operating systems provide flock(). Some versions of Solaris do not have |
|
18519 +it (and some, I think, provide a not quite right version built on top of lockf |
|
18520 +()). If the OS does not have flock(), Exim will be built without the ability to |
|
18521 +use it, and any attempt to do so will cause a configuration error. |
|
18522 + |
|
18523 +Warning: flock() locks do not work on NFS files (unless flock() is just being |
|
18524 +mapped onto fcntl() by the OS). |
|
18525 + |
|
18526 ++-------------------------------------------------------------+ |
|
18527 +|use_lockfile|Use: appendfile|Type: boolean|Default: see below| |
|
18528 ++-------------------------------------------------------------+ |
|
18529 + |
|
18530 +If this option is turned off, Exim does not attempt to create a lock file when |
|
18531 +appending to a mailbox file. In this situation, the only locking is by fcntl(). |
|
18532 +You should only turn use_lockfile off if you are absolutely sure that every MUA |
|
18533 +that is ever going to look at your users' mailboxes uses fcntl() rather than a |
|
18534 +lock file, and even then only when you are not delivering over NFS from more |
|
18535 +than one host. |
|
18536 + |
|
18537 +In order to append to an NFS file safely from more than one host, it is |
|
18538 +necessary to take out a lock before opening the file, and the lock file |
|
18539 +achieves this. Otherwise, even with fcntl() locking, there is a risk of file |
|
18540 +corruption. |
|
18541 + |
|
18542 +The use_lockfile option is set by default unless use_mbx_lock is set. It is not |
|
18543 +possible to turn both use_lockfile and use_fcntl_lock off, except when |
|
18544 +mbx_format is set. |
|
18545 + |
|
18546 ++-------------------------------------------------------------+ |
|
18547 +|use_mbx_lock|Use: appendfile|Type: boolean|Default: see below| |
|
18548 ++-------------------------------------------------------------+ |
|
18549 + |
|
18550 +This option is available only if Exim has been compiled with SUPPORT_MBX set in |
|
18551 +Local/Makefile. Setting the option specifies that special MBX locking rules be |
|
18552 +used. It is set by default if mbx_format is set and none of the locking options |
|
18553 +are mentioned in the configuration. The locking rules are the same as are used |
|
18554 +by the c-client library that underlies Pine and the IMAP4 and POP daemons that |
|
18555 +come with it (see the discussion below). The rules allow for shared access to |
|
18556 +the mailbox. However, this kind of locking does not work when the mailbox is |
|
18557 +NFS mounted. |
|
18558 + |
|
18559 +You can set use_mbx_lock with either (or both) of use_fcntl_lock and |
|
18560 +use_flock_lock to control what kind of locking is used in implementing the MBX |
|
18561 +locking rules. The default is to use fcntl() if use_mbx_lock is set without |
|
18562 +use_fcntl_lock or use_flock_lock. |
|
18563 + |
|
18564 +26.3Â Operational details for appending |
|
18565 + |
|
18566 +Before appending to a file, the following preparations are made: |
|
18567 + |
|
18568 + * If the name of the file is /dev/null, no action is taken, and a success |
|
18569 + return is given. |
|
18570 + |
|
18571 + * If any directories on the file's path are missing, Exim creates them if the |
|
18572 + create_directory option is set. A created directory's mode is given by the |
|
18573 + directory_mode option. |
|
18574 + |
|
18575 + * If file_format is set, the format of an existing file is checked. If this |
|
18576 + indicates that a different transport should be used, control is passed to |
|
18577 + that transport. |
|
18578 + |
|
18579 + * If use_lockfile is set, a lock file is built in a way that will work |
|
18580 + reliably over NFS, as follows: |
|
18581 + |
|
18582 + 1. Create a "hitching post" file whose name is that of the lock file with |
|
18583 + the current time, primary host name, and process id added, by opening |
|
18584 + for writing as a new file. If this fails with an access error, delivery |
|
18585 + is deferred. |
|
18586 + |
|
18587 + 2. Close the hitching post file, and hard link it to the lock file name. |
|
18588 + |
|
18589 + 3. If the call to link() succeeds, creation of the lock file has |
|
18590 + succeeded. Unlink the hitching post name. |
|
18591 + |
|
18592 + 4. Otherwise, use stat() to get information about the hitching post file, |
|
18593 + and then unlink hitching post name. If the number of links is exactly |
|
18594 + two, creation of the lock file succeeded but something (for example, an |
|
18595 + NFS server crash and restart) caused this fact not to be communicated |
|
18596 + to the link() call. |
|
18597 + |
|
18598 + 5. If creation of the lock file failed, wait for lock_interval and try |
|
18599 + again, up to lock_retries times. However, since any program that writes |
|
18600 + to a mailbox should complete its task very quickly, it is reasonable to |
|
18601 + time out old lock files that are normally the result of user agent and |
|
18602 + system crashes. If an existing lock file is older than lockfile_timeout |
|
18603 + Exim attempts to unlink it before trying again. |
|
18604 + |
|
18605 + * A call is made to lstat() to discover whether the main file exists, and if |
|
18606 + so, what its characteristics are. If lstat() fails for any reason other |
|
18607 + than non-existence, delivery is deferred. |
|
18608 + |
|
18609 + * If the file does exist and is a symbolic link, delivery is deferred, unless |
|
18610 + the allow_symlink option is set, in which case the ownership of the link is |
|
18611 + checked, and then stat() is called to find out about the real file, which |
|
18612 + is then subjected to the checks below. The check on the top-level link |
|
18613 + ownership prevents one user creating a link for another's mailbox in a |
|
18614 + sticky directory, though allowing symbolic links in this case is definitely |
|
18615 + not a good idea. If there is a chain of symbolic links, the intermediate |
|
18616 + ones are not checked. |
|
18617 + |
|
18618 + * If the file already exists but is not a regular file, or if the file's |
|
18619 + owner and group (if the group is being checked - see check_group above) are |
|
18620 + different from the user and group under which the delivery is running, |
|
18621 + delivery is deferred. |
|
18622 + |
|
18623 + * If the file's permissions are more generous than specified, they are |
|
18624 + reduced. If they are insufficient, delivery is deferred, unless |
|
18625 + mode_fail_narrower is set false, in which case the delivery is tried using |
|
18626 + the existing permissions. |
|
18627 + |
|
18628 + * The file's inode number is saved, and the file is then opened for |
|
18629 + appending. If this fails because the file has vanished, appendfile behaves |
|
18630 + as if it hadn't existed (see below). For any other failures, delivery is |
|
18631 + deferred. |
|
18632 + |
|
18633 + * If the file is opened successfully, check that the inode number hasn't |
|
18634 + changed, that it is still a regular file, and that the owner and |
|
18635 + permissions have not changed. If anything is wrong, defer delivery and |
|
18636 + freeze the message. |
|
18637 + |
|
18638 + * If the file did not exist originally, defer delivery if the file_must_exist |
|
18639 + option is set. Otherwise, check that the file is being created in a |
|
18640 + permitted directory if the create_file option is set (deferring on |
|
18641 + failure), and then open for writing as a new file, with the O_EXCL and |
|
18642 + O_CREAT options, except when dealing with a symbolic link (the |
|
18643 + allow_symlink option must be set). In this case, which can happen if the |
|
18644 + link points to a non-existent file, the file is opened for writing using |
|
18645 + O_CREAT but not O_EXCL, because that prevents link following. |
|
18646 + |
|
18647 + * If opening fails because the file exists, obey the tests given above for |
|
18648 + existing files. However, to avoid looping in a situation where the file is |
|
18649 + being continuously created and destroyed, the exists/not-exists loop is |
|
18650 + broken after 10 repetitions, and the message is then frozen. |
|
18651 + |
|
18652 + * If opening fails with any other error, defer delivery. |
|
18653 + |
|
18654 + * Once the file is open, unless both use_fcntl_lock and use_flock_lock are |
|
18655 + false, it is locked using fcntl() or flock() or both. If use_mbx_lock is |
|
18656 + false, an exclusive lock is requested in each case. However, if |
|
18657 + use_mbx_lock is true, Exim takes out a shared lock on the open file, and an |
|
18658 + exclusive lock on the file whose name is |
|
18659 + |
|
18660 + /tmp/.<device-number>.<inode-number> |
|
18661 + |
|
18662 + using the device and inode numbers of the open mailbox file, in accordance |
|
18663 + with the MBX locking rules. This file is created with a mode that is |
|
18664 + specified by the lockfile_mode option. |
|
18665 + |
|
18666 + If Exim fails to lock the file, there are two possible courses of action, |
|
18667 + depending on the value of the locking timeout. This is obtained from |
|
18668 + lock_fcntl_timeout or lock_flock_timeout, as appropriate. |
|
18669 + |
|
18670 + If the timeout value is zero, the file is closed, Exim waits for |
|
18671 + lock_interval, and then goes back and re-opens the file as above and tries |
|
18672 + to lock it again. This happens up to lock_retries times, after which the |
|
18673 + delivery is deferred. |
|
18674 + |
|
18675 + If the timeout has a value greater than zero, blocking calls to fcntl() or |
|
18676 + flock() are used (with the given timeout), so there has already been some |
|
18677 + waiting involved by the time locking fails. Nevertheless, Exim does not |
|
18678 + give up immediately. It retries up to |
|
18679 + |
|
18680 + (lock_retries * lock_interval) / <timeout> |
|
18681 + |
|
18682 + times (rounded up). |
|
18683 + |
|
18684 +At the end of delivery, Exim closes the file (which releases the fcntl() and/or |
|
18685 +flock() locks) and then deletes the lock file if one was created. |
|
18686 + |
|
18687 +26.4Â Operational details for delivery to a new file |
|
18688 + |
|
18689 +When the directory option is set instead of file, each message is delivered |
|
18690 +into a newly-created file or set of files. When appendfile is activated |
|
18691 +directly from a redirect router, neither file nor directory is normally set, |
|
18692 +because the path for delivery is supplied by the router. (See for example, the |
|
18693 +address_file transport in the default configuration.) In this case, delivery is |
|
18694 +to a new file if either the path name ends in "/", or the maildir_format or |
|
18695 +mailstore_format option is set. |
|
18696 + |
|
18697 +No locking is required while writing the message to a new file, so the various |
|
18698 +locking options of the transport are ignored. The "From" line that by default |
|
18699 +separates messages in a single file is not normally needed, nor is the escaping |
|
18700 +of message lines that start with "From", and there is no need to ensure a |
|
18701 +newline at the end of each message. Consequently, the default values for |
|
18702 +check_string, message_prefix, and message_suffix are all unset when any of |
|
18703 +directory, maildir_format, or mailstore_format is set. |
|
18704 + |
|
18705 +If Exim is required to check a quota setting, it adds up the sizes of all the |
|
18706 +files in the delivery directory by default. However, you can specify a |
|
18707 +different directory by setting quota_directory. Also, for maildir deliveries |
|
18708 +(see below) the maildirfolder convention is honoured. |
|
18709 + |
|
18710 +There are three different ways in which delivery to individual files can be |
|
18711 +done, controlled by the settings of the maildir_format and mailstore_format |
|
18712 +options. Note that code to support maildir or mailstore formats is not included |
|
18713 +in the binary unless SUPPORT_MAILDIR or SUPPORT_MAILSTORE, respectively, is set |
|
18714 +in Local/Makefile. |
|
18715 + |
|
18716 +In all three cases an attempt is made to create the directory and any necessary |
|
18717 +sub-directories if they do not exist, provided that the create_directory option |
|
18718 +is set (the default). The location of a created directory can be constrained by |
|
18719 +setting create_file. A created directory's mode is given by the directory_mode |
|
18720 +option. If creation fails, or if the create_directory option is not set when |
|
18721 +creation is required, delivery is deferred. |
|
18722 + |
|
18723 +26.5Â Maildir delivery |
|
18724 + |
|
18725 +If the maildir_format option is true, Exim delivers each message by writing it |
|
18726 +to a file whose name is tmp/<stime>.H<mtime>P<pid>.<host> in the directory that |
|
18727 +is defined by the directory option (the "delivery directory"). If the delivery |
|
18728 +is successful, the file is renamed into the new subdirectory. |
|
18729 + |
|
18730 +In the file name, <stime> is the current time of day in seconds, and <mtime> is |
|
18731 +the microsecond fraction of the time. After a maildir delivery, Exim checks |
|
18732 +that the time-of-day clock has moved on by at least one microsecond before |
|
18733 +terminating the delivery process. This guarantees uniqueness for the file name. |
|
18734 +However, as a precaution, Exim calls stat() for the file before opening it. If |
|
18735 +any response other than ENOENT (does not exist) is given, Exim waits 2 seconds |
|
18736 +and tries again, up to maildir_retries times. |
|
18737 + |
|
18738 +Before Exim carries out a maildir delivery, it ensures that subdirectories |
|
18739 +called new, cur, and tmp exist in the delivery directory. If they do not exist, |
|
18740 +Exim tries to create them and any superior directories in their path, subject |
|
18741 +to the create_directory and create_file options. If the |
|
18742 +maildirfolder_create_regex option is set, and the regular expression it |
|
18743 +contains matches the delivery directory, Exim also ensures that a file called |
|
18744 +maildirfolder exists in the delivery directory. If a missing directory or |
|
18745 +maildirfolder file cannot be created, delivery is deferred. |
|
18746 + |
|
18747 +These features make it possible to use Exim to create all the necessary files |
|
18748 +and directories in a maildir mailbox, including subdirectories for maildir++ |
|
18749 +folders. Consider this example: |
|
18750 + |
|
18751 +maildir_format = true |
|
18752 +directory = /var/mail/$local_part\ |
|
18753 + ${if eq{$local_part_suffix}{}{}\ |
|
18754 + {/.${substr_1:$local_part_suffix}}} |
|
18755 +maildirfolder_create_regex = /\.[^/]+$ |
|
18756 + |
|
18757 +If $local_part_suffix is empty (there was no suffix for the local part), |
|
18758 +delivery is into a toplevel maildir with a name like /var/mail/pimbo (for the |
|
18759 +user called pimbo). The pattern in maildirfolder_create_regex does not match |
|
18760 +this name, so Exim will not look for or create the file /var/mail/pimbo/ |
|
18761 +maildirfolder, though it will create /var/mail/pimbo/{cur,new,tmp} if |
|
18762 +necessary. |
|
18763 + |
|
18764 +However, if $local_part_suffix contains "-eximusers" (for example), delivery is |
|
18765 +into the maildir++ folder /var/mail/pimbo/.eximusers, which does match |
|
18766 +maildirfolder_create_regex. In this case, Exim will create /var/mail/pimbo |
|
18767 +/.eximusers/maildirfolder as well as the three maildir directories /var/mail/ |
|
18768 +pimbo/.eximusers/{cur,new,tmp}. |
|
18769 + |
|
18770 +Warning: Take care when setting maildirfolder_create_regex that it does not |
|
18771 +inadvertently match the toplevel maildir directory, because a maildirfolder |
|
18772 +file at top level would completely break quota calculations. |
|
18773 + |
|
18774 +If Exim is required to check a quota setting before a maildir delivery, and |
|
18775 +quota_directory is not set, it looks for a file called maildirfolder in the |
|
18776 +maildir directory (alongside new, cur, tmp). If this exists, Exim assumes the |
|
18777 +directory is a maildir++ folder directory, which is one level down from the |
|
18778 +user's top level mailbox directory. This causes it to start at the parent |
|
18779 +directory instead of the current directory when calculating the amount of space |
|
18780 +used. |
|
18781 + |
|
18782 +One problem with delivering into a multi-file mailbox is that it is |
|
18783 +computationally expensive to compute the size of the mailbox for quota |
|
18784 +checking. Various approaches have been taken to reduce the amount of work |
|
18785 +needed. The next two sections describe two of them. A third alternative is to |
|
18786 +use some external process for maintaining the size data, and use the expansion |
|
18787 +of the mailbox_size option as a way of importing it into Exim. |
|
18788 + |
|
18789 +26.6Â Using tags to record message sizes |
|
18790 + |
|
18791 +If maildir_tag is set, the string is expanded for each delivery. When the |
|
18792 +maildir file is renamed into the new sub-directory, the tag is added to its |
|
18793 +name. However, if adding the tag takes the length of the name to the point |
|
18794 +where the test stat() call fails with ENAMETOOLONG, the tag is dropped and the |
|
18795 +maildir file is created with no tag. |
|
18796 + |
|
18797 +Tags can be used to encode the size of files in their names; see |
|
18798 +quota_size_regex above for an example. The expansion of maildir_tag happens |
|
18799 +after the message has been written. The value of the $message_size variable is |
|
18800 +set to the number of bytes actually written. If the expansion is forced to |
|
18801 +fail, the tag is ignored, but a non-forced failure causes delivery to be |
|
18802 +deferred. The expanded tag may contain any printing characters except "/". |
|
18803 +Non-printing characters in the string are ignored; if the resulting string is |
|
18804 +empty, it is ignored. If it starts with an alphanumeric character, a leading |
|
18805 +colon is inserted. |
|
18806 + |
10 +Please note, that normally you want to use |
18807 +Please note, that normally you want to use |
11 + |
18808 + |
12 + maildir_tag = ,S=${message_size} |
18809 + maildir_tag = ,S=${message_size} |
13 + |
18810 + |
14 +The default prefix choosen (a colon) may be misinterpreted by other maildir |
18811 +The default prefix choosen (a colon) may be misinterpreted by other maildir |
15 +clients. Please check their documentation about the expected format of |
18812 +clients. Please check their documentation about the expected format of |
16 +the filename; |
18813 +the filename. |
17 + |
18814 + |
18 26.7Â Using a maildirsize file |
18815 +If Exim should use this tag, you need to set the quota_size_regex as |
19 |
18816 +described above. Otherwise Exim will do expensive stat() calls each time |
20 If maildir_use_size_file is true, Exim implements the maildir++ rules for |
18817 +the sizes need to be known. |
|
18818 + |
|
18819 +26.7Â Using a maildirsize file |
|
18820 + |
|
18821 +If maildir_use_size_file is true, Exim implements the maildir++ rules for |
|
18822 +storing quota and message size information in a file called maildirsize within |
|
18823 +the toplevel maildir directory. If this file does not exist, Exim creates it, |
|
18824 +setting the quota from the quota option of the transport. If the maildir |
|
18825 +directory itself does not exist, it is created before any attempt to write a |
|
18826 +maildirsize file. |
|
18827 + |
|
18828 +The maildirsize file is used to hold information about the sizes of messages in |
|
18829 +the maildir, thus speeding up quota calculations. The quota value in the file |
|
18830 +is just a cache; if the quota is changed in the transport, the new value |
|
18831 +overrides the cached value when the next message is delivered. The cache is |
|
18832 +maintained for the benefit of other programs that access the maildir and need |
|
18833 +to know the quota. |
|
18834 + |
|
18835 +If the quota option in the transport is unset or zero, the maildirsize file is |
|
18836 +maintained (with a zero quota setting), but no quota is imposed. |
|
18837 + |
|
18838 +A regular expression is available for controlling which directories in the |
|
18839 +maildir participate in quota calculations when a maildirsizefile is in use. See |
|
18840 +the description of the maildir_quota_directory_regex option above for details. |
|
18841 + |
|
18842 +26.8Â Mailstore delivery |
|
18843 + |
|
18844 +If the mailstore_format option is true, each message is written as two files in |
|
18845 +the given directory. A unique base name is constructed from the message id and |
|
18846 +the current delivery process, and the files that are written use this base name |
|
18847 +plus the suffixes .env and .msg. The .env file contains the message's envelope, |
|
18848 +and the .msg file contains the message itself. The base name is placed in the |
|
18849 +variable $mailstore_basename. |
|
18850 + |
|
18851 +During delivery, the envelope is first written to a file with the suffix .tmp. |
|
18852 +The .msg file is then written, and when it is complete, the .tmp file is |
|
18853 +renamed as the .env file. Programs that access messages in mailstore format |
|
18854 +should wait for the presence of both a .msg and a .env file before accessing |
|
18855 +either of them. An alternative approach is to wait for the absence of a .tmp |
|
18856 +file. |
|
18857 + |
|
18858 +The envelope file starts with any text defined by the mailstore_prefix option, |
|
18859 +expanded and terminated by a newline if there isn't one. Then follows the |
|
18860 +sender address on one line, then all the recipient addresses, one per line. |
|
18861 +There can be more than one recipient only if the batch_max option is set |
|
18862 +greater than one. Finally, mailstore_suffix is expanded and the result appended |
|
18863 +to the file, followed by a newline if it does not end with one. |
|
18864 + |
|
18865 +If expansion of mailstore_prefix or mailstore_suffix ends with a forced |
|
18866 +failure, it is ignored. Other expansion errors are treated as serious |
|
18867 +configuration errors, and delivery is deferred. The variable |
|
18868 +$mailstore_basename is available for use during these expansions. |
|
18869 + |
|
18870 +26.9Â Non-special new file delivery |
|
18871 + |
|
18872 +If neither maildir_format nor mailstore_format is set, a single new file is |
|
18873 +created directly in the named directory. For example, when delivering messages |
|
18874 +into files in batched SMTP format for later delivery to some host (see section |
|
18875 +45.10), a setting such as |
|
18876 + |
|
18877 +directory = /var/bsmtp/$host |
|
18878 + |
|
18879 +might be used. A message is written to a file with a temporary name, which is |
|
18880 +then renamed when the delivery is complete. The final name is obtained by |
|
18881 +expanding the contents of the directory_file option. |
|
18882 + |
|
18883 +27. The autoreply transport |
|
18884 + |
|
18885 +The autoreply transport is not a true transport in that it does not cause the |
|
18886 +message to be transmitted. Instead, it generates a new mail message as an |
|
18887 +automatic reply to the incoming message. References: and Auto-Submitted: header |
|
18888 +lines are included. These are constructed according to the rules in RFCs 2822 |
|
18889 +and 3834, respectively. |
|
18890 + |
|
18891 +If the router that passes the message to this transport does not have the |
|
18892 +unseen option set, the original message (for the current recipient) is not |
|
18893 +delivered anywhere. However, when the unseen option is set on the router that |
|
18894 +passes the message to this transport, routing of the address continues, so |
|
18895 +another router can set up a normal message delivery. |
|
18896 + |
|
18897 +The autoreply transport is usually run as the result of mail filtering, a |
|
18898 +"vacation" message being the standard example. However, it can also be run |
|
18899 +directly from a router like any other transport. To reduce the possibility of |
|
18900 +message cascades, messages created by the autoreply transport always have empty |
|
18901 +envelope sender addresses, like bounce messages. |
|
18902 + |
|
18903 +The parameters of the message to be sent can be specified in the configuration |
|
18904 +by options described below. However, these are used only when the address |
|
18905 +passed to the transport does not contain its own reply information. When the |
|
18906 +transport is run as a consequence of a mail or vacation command in a filter |
|
18907 +file, the parameters of the message are supplied by the filter, and passed with |
|
18908 +the address. The transport's options that define the message are then ignored |
|
18909 +(so they are not usually set in this case). The message is specified entirely |
|
18910 +by the filter or by the transport; it is never built from a mixture of options. |
|
18911 +However, the file_optional, mode, and return_message options apply in all |
|
18912 +cases. |
|
18913 + |
|
18914 +Autoreply is implemented as a local transport. When used as a result of a |
|
18915 +command in a user's filter file, autoreply normally runs under the uid and gid |
|
18916 +of the user, and with appropriate current and home directories (see chapter 23 |
|
18917 +). |
|
18918 + |
|
18919 +There is a subtle difference between routing a message to a pipe transport that |
|
18920 +generates some text to be returned to the sender, and routing it to an |
|
18921 +autoreply transport. This difference is noticeable only if more than one |
|
18922 +address from the same message is so handled. In the case of a pipe, the |
|
18923 +separate outputs from the different addresses are gathered up and returned to |
|
18924 +the sender in a single message, whereas if autoreply is used, a separate |
|
18925 +message is generated for each address that is passed to it. |
|
18926 + |
|
18927 +Non-printing characters are not permitted in the header lines generated for the |
|
18928 +message that autoreply creates, with the exception of newlines that are |
|
18929 +immediately followed by white space. If any non-printing characters are found, |
|
18930 +the transport defers. Whether characters with the top bit set count as printing |
|
18931 +characters or not is controlled by the print_topbitchars global option. |
|
18932 + |
|
18933 +If any of the generic options for manipulating headers (for example, |
|
18934 +headers_add) are set on an autoreply transport, they apply to the copy of the |
|
18935 +original message that is included in the generated message when return_message |
|
18936 +is set. They do not apply to the generated message itself. |
|
18937 + |
|
18938 +If the autoreply transport receives return code 2 from Exim when it submits the |
|
18939 +message, indicating that there were no recipients, it does not treat this as an |
|
18940 +error. This means that autoreplies sent to $sender_address when this is empty |
|
18941 +(because the incoming message is a bounce message) do not cause problems. They |
|
18942 +are just discarded. |
|
18943 + |
|
18944 +27.1Â Private options for autoreply |
|
18945 + |
|
18946 ++-----------------------------------------------+ |
|
18947 +|bcc|Use: autoreply|Type: string*|Default: unset| |
|
18948 ++-----------------------------------------------+ |
|
18949 + |
|
18950 +This specifies the addresses that are to receive "blind carbon copies" of the |
|
18951 +message when the message is specified by the transport. |
|
18952 + |
|
18953 ++----------------------------------------------+ |
|
18954 +|cc|Use: autoreply|Type: string*|Default: unset| |
|
18955 ++----------------------------------------------+ |
|
18956 + |
|
18957 +This specifies recipients of the message and the contents of the Cc: header |
|
18958 +when the message is specified by the transport. |
|
18959 + |
|
18960 ++------------------------------------------------+ |
|
18961 +|file|Use: autoreply|Type: string*|Default: unset| |
|
18962 ++------------------------------------------------+ |
|
18963 + |
|
18964 +The contents of the file are sent as the body of the message when the message |
|
18965 +is specified by the transport. If both file and text are set, the text string |
|
18966 +comes first. |
|
18967 + |
|
18968 ++-------------------------------------------------------+ |
|
18969 +|file_expand|Use: autoreply|Type: boolean|Default: false| |
|
18970 ++-------------------------------------------------------+ |
|
18971 + |
|
18972 +If this is set, the contents of the file named by the file option are subjected |
|
18973 +to string expansion as they are added to the message. |
|
18974 + |
|
18975 ++---------------------------------------------------------+ |
|
18976 +|file_optional|Use: autoreply|Type: boolean|Default: false| |
|
18977 ++---------------------------------------------------------+ |
|
18978 + |
|
18979 +If this option is true, no error is generated if the file named by the file |
|
18980 +option or passed with the address does not exist or cannot be read. |
|
18981 + |
|
18982 ++------------------------------------------------+ |
|
18983 +|from|Use: autoreply|Type: string*|Default: unset| |
|
18984 ++------------------------------------------------+ |
|
18985 + |
|
18986 +This specifies the contents of the From: header when the message is specified |
|
18987 +by the transport. |
|
18988 + |
|
18989 ++---------------------------------------------------+ |
|
18990 +|headers|Use: autoreply|Type: string*|Default: unset| |
|
18991 ++---------------------------------------------------+ |
|
18992 + |
|
18993 +This specifies additional RFC 2822 headers that are to be added to the message |
|
18994 +when the message is specified by the transport. Several can be given by using " |
|
18995 +\n" to separate them. There is no check on the format. |
|
18996 + |
|
18997 ++-----------------------------------------------+ |
|
18998 +|log|Use: autoreply|Type: string*|Default: unset| |
|
18999 ++-----------------------------------------------+ |
|
19000 + |
|
19001 +This option names a file in which a record of every message sent is logged when |
|
19002 +the message is specified by the transport. |
|
19003 + |
|
19004 ++-----------------------------------------------------+ |
|
19005 +|mode|Use: autoreply|Type: octal integer|Default: 0600| |
|
19006 ++-----------------------------------------------------+ |
|
19007 + |
|
19008 +If either the log file or the "once" file has to be created, this mode is used. |
|
19009 + |
|
19010 ++------------------------------------------------------------+ |
|
19011 +|never_mail|Use: autoreply|Type: address list*|Default: unset| |
|
19012 ++------------------------------------------------------------+ |
|
19013 + |
|
19014 +If any run of the transport creates a message with a recipient that matches any |
|
19015 +item in the list, that recipient is quietly discarded. If all recipients are |
|
19016 +discarded, no message is created. This applies both when the recipients are |
|
19017 +generated by a filter and when they are specified in the transport. |
|
19018 + |
|
19019 ++------------------------------------------------+ |
|
19020 +|once|Use: autoreply|Type: string*|Default: unset| |
|
19021 ++------------------------------------------------+ |
|
19022 + |
|
19023 +This option names a file or DBM database in which a record of each To: |
|
19024 +recipient is kept when the message is specified by the transport. Note: This |
|
19025 +does not apply to Cc: or Bcc: recipients. |
|
19026 + |
|
19027 +If once is unset, or is set to an empty string, the message is always sent. By |
|
19028 +default, if once is set to a non-empty file name, the message is not sent if a |
|
19029 +potential recipient is already listed in the database. However, if the |
|
19030 +once_repeat option specifies a time greater than zero, the message is sent if |
|
19031 +that much time has elapsed since a message was last sent to this recipient. A |
|
19032 +setting of zero time for once_repeat (the default) prevents a message from |
|
19033 +being sent a second time - in this case, zero means infinity. |
|
19034 + |
|
19035 +If once_file_size is zero, a DBM database is used to remember recipients, and |
|
19036 +it is allowed to grow as large as necessary. If once_file_size is set greater |
|
19037 +than zero, it changes the way Exim implements the once option. Instead of using |
|
19038 +a DBM file to record every recipient it sends to, it uses a regular file, whose |
|
19039 +size will never get larger than the given value. |
|
19040 + |
|
19041 +In the file, Exim keeps a linear list of recipient addresses and the times at |
|
19042 +which they were sent messages. If the file is full when a new address needs to |
|
19043 +be added, the oldest address is dropped. If once_repeat is not set, this means |
|
19044 +that a given recipient may receive multiple messages, but at unpredictable |
|
19045 +intervals that depend on the rate of turnover of addresses in the file. If |
|
19046 +once_repeat is set, it specifies a maximum time between repeats. |
|
19047 + |
|
19048 ++------------------------------------------------------+ |
|
19049 +|once_file_size|Use: autoreply|Type: integer|Default: 0| |
|
19050 ++------------------------------------------------------+ |
|
19051 + |
|
19052 +See once above. |
|
19053 + |
|
19054 ++--------------------------------------------------+ |
|
19055 +|once_repeat|Use: autoreply|Type: time*|Default: 0s| |
|
19056 ++--------------------------------------------------+ |
|
19057 + |
|
19058 +See once above. After expansion, the value of this option must be a valid time |
|
19059 +value. |
|
19060 + |
|
19061 ++----------------------------------------------------+ |
|
19062 +|reply_to|Use: autoreply|Type: string*|Default: unset| |
|
19063 ++----------------------------------------------------+ |
|
19064 + |
|
19065 +This specifies the contents of the Reply-To: header when the message is |
|
19066 +specified by the transport. |
|
19067 + |
|
19068 ++----------------------------------------------------------+ |
|
19069 +|return_message|Use: autoreply|Type: boolean|Default: false| |
|
19070 ++----------------------------------------------------------+ |
|
19071 + |
|
19072 +If this is set, a copy of the original message is returned with the new |
|
19073 +message, subject to the maximum size set in the return_size_limit global |
|
19074 +configuration option. |
|
19075 + |
|
19076 ++---------------------------------------------------+ |
|
19077 +|subject|Use: autoreply|Type: string*|Default: unset| |
|
19078 ++---------------------------------------------------+ |
|
19079 + |
|
19080 +This specifies the contents of the Subject: header when the message is |
|
19081 +specified by the transport. It is tempting to quote the original subject in |
|
19082 +automatic responses. For example: |
|
19083 + |
|
19084 +subject = Re: $h_subject: |
|
19085 + |
|
19086 +There is a danger in doing this, however. It may allow a third party to |
|
19087 +subscribe your users to an opt-in mailing list, provided that the list accepts |
|
19088 +bounce messages as subscription confirmations. Well-managed lists require a |
|
19089 +non-bounce message to confirm a subscription, so the danger is relatively |
|
19090 +small. |
|
19091 + |
|
19092 ++------------------------------------------------+ |
|
19093 +|text|Use: autoreply|Type: string*|Default: unset| |
|
19094 ++------------------------------------------------+ |
|
19095 + |
|
19096 +This specifies a single string to be used as the body of the message when the |
|
19097 +message is specified by the transport. If both text and file are set, the text |
|
19098 +comes first. |
|
19099 + |
|
19100 ++----------------------------------------------+ |
|
19101 +|to|Use: autoreply|Type: string*|Default: unset| |
|
19102 ++----------------------------------------------+ |
|
19103 + |
|
19104 +This specifies recipients of the message and the contents of the To: header |
|
19105 +when the message is specified by the transport. |
|
19106 + |
|
19107 +28. The lmtp transport |
|
19108 + |
|
19109 +The lmtp transport runs the LMTP protocol (RFC 2033) over a pipe to a specified |
|
19110 +command or by interacting with a Unix domain socket. This transport is |
|
19111 +something of a cross between the pipe and smtp transports. Exim also has |
|
19112 +support for using LMTP over TCP/IP; this is implemented as an option for the |
|
19113 +smtp transport. Because LMTP is expected to be of minority interest, the |
|
19114 +default build-time configure in src/EDITME has it commented out. You need to |
|
19115 +ensure that |
|
19116 + |
|
19117 +TRANSPORT_LMTP=yes |
|
19118 + |
|
19119 +is present in your Local/Makefile in order to have the lmtp transport included |
|
19120 +in the Exim binary. The private options of the lmtp transport are as follows: |
|
19121 + |
|
19122 ++-----------------------------------------------+ |
|
19123 +|batch_id|Use: lmtp|Type: string*|Default: unset| |
|
19124 ++-----------------------------------------------+ |
|
19125 + |
|
19126 +See the description of local delivery batching in chapter 25. |
|
19127 + |
|
19128 ++--------------------------------------------+ |
|
19129 +|batch_max|Use: lmtp|Type: integer|Default: 1| |
|
19130 ++--------------------------------------------+ |
|
19131 + |
|
19132 +This limits the number of addresses that can be handled in a single delivery. |
|
19133 +Most LMTP servers can handle several addresses at once, so it is normally a |
|
19134 +good idea to increase this value. See the description of local delivery |
|
19135 +batching in chapter 25. |
|
19136 + |
|
19137 ++----------------------------------------------+ |
|
19138 +|command|Use: lmtp|Type: string*|Default: unset| |
|
19139 ++----------------------------------------------+ |
|
19140 + |
|
19141 +This option must be set if socket is not set. The string is a command which is |
|
19142 +run in a separate process. It is split up into a command name and list of |
|
19143 +arguments, each of which is separately expanded (so expansion cannot change the |
|
19144 +number of arguments). The command is run directly, not via a shell. The message |
|
19145 +is passed to the new process using the standard input and output to operate the |
|
19146 +LMTP protocol. |
|
19147 + |
|
19148 ++---------------------------------------------------+ |
|
19149 +|ignore_quota|Use: lmtp|Type: boolean|Default: false| |
|
19150 ++---------------------------------------------------+ |
|
19151 + |
|
19152 +If this option is set true, the string "IGNOREQUOTA" is added to RCPT commands, |
|
19153 +provided that the LMTP server has advertised support for IGNOREQUOTA in its |
|
19154 +response to the LHLO command. |
|
19155 + |
|
19156 ++---------------------------------------------+ |
|
19157 +|socket|Use: lmtp|Type: string*|Default: unset| |
|
19158 ++---------------------------------------------+ |
|
19159 + |
|
19160 +This option must be set if command is not set. The result of expansion must be |
|
19161 +the name of a Unix domain socket. The transport connects to the socket and |
|
19162 +delivers the message to it using the LMTP protocol. |
|
19163 + |
|
19164 ++----------------------------------------+ |
|
19165 +|timeout|Use: lmtp|Type: time|Default: 5m| |
|
19166 ++----------------------------------------+ |
|
19167 + |
|
19168 +The transport is aborted if the created process or Unix domain socket does not |
|
19169 +respond to LMTP commands or message input within this timeout. Delivery is |
|
19170 +deferred, and will be tried again later. Here is an example of a typical LMTP |
|
19171 +transport: |
|
19172 + |
|
19173 +lmtp: |
|
19174 + driver = lmtp |
|
19175 + command = /some/local/lmtp/delivery/program |
|
19176 + batch_max = 20 |
|
19177 + user = exim |
|
19178 + |
|
19179 +This delivers up to 20 addresses at a time, in a mixture of domains if |
|
19180 +necessary, running as the user exim. |
|
19181 + |
|
19182 +29. The pipe transport |
|
19183 + |
|
19184 +The pipe transport is used to deliver messages via a pipe to a command running |
|
19185 +in another process. One example is the use of pipe as a pseudo-remote transport |
|
19186 +for passing messages to some other delivery mechanism (such as UUCP). Another |
|
19187 +is the use by individual users to automatically process their incoming |
|
19188 +messages. The pipe transport can be used in one of the following ways: |
|
19189 + |
|
19190 + * A router routes one address to a transport in the normal way, and the |
|
19191 + transport is configured as a pipe transport. In this case, $local_part |
|
19192 + contains the local part of the address (as usual), and the command that is |
|
19193 + run is specified by the command option on the transport. |
|
19194 + |
|
19195 + * If the batch_max option is set greater than 1 (the default is 1), the |
|
19196 + transport can handle more than one address in a single run. In this case, |
|
19197 + when more than one address is routed to the transport, $local_part is not |
|
19198 + set (because it is not unique). However, the pseudo-variable |
|
19199 + $pipe_addresses (described in section 29.3 below) contains all the |
|
19200 + addresses that are routed to the transport. |
|
19201 + |
|
19202 + * A router redirects an address directly to a pipe command (for example, from |
|
19203 + an alias or forward file). In this case, $address_pipe contains the text of |
|
19204 + the pipe command, and the command option on the transport is ignored. If |
|
19205 + only one address is being transported (batch_max is not greater than one, |
|
19206 + or only one address was redirected to this pipe command), $local_part |
|
19207 + contains the local part that was redirected. |
|
19208 + |
|
19209 +The pipe transport is a non-interactive delivery method. Exim can also deliver |
|
19210 +messages over pipes using the LMTP interactive protocol. This is implemented by |
|
19211 +the lmtp transport. |
|
19212 + |
|
19213 +In the case when pipe is run as a consequence of an entry in a local user's |
|
19214 +.forward file, the command runs under the uid and gid of that user. In other |
|
19215 +cases, the uid and gid have to be specified explicitly, either on the transport |
|
19216 +or on the router that handles the address. Current and "home" directories are |
|
19217 +also controllable. See chapter 23 for details of the local delivery environment |
|
19218 +and chapter 25 for a discussion of local delivery batching. |
|
19219 + |
|
19220 +29.1Â Concurrent delivery |
|
19221 + |
|
19222 +If two messages arrive at almost the same time, and both are routed to a pipe |
|
19223 +delivery, the two pipe transports may be run concurrently. You must ensure that |
|
19224 +any pipe commands you set up are robust against this happening. If the commands |
|
19225 +write to a file, the exim_lock utility might be of use. |
|
19226 + |
|
19227 +29.2Â Returned status and data |
|
19228 + |
|
19229 +If the command exits with a non-zero return code, the delivery is deemed to |
|
19230 +have failed, unless either the ignore_status option is set (in which case the |
|
19231 +return code is treated as zero), or the return code is one of those listed in |
|
19232 +the temp_errors option, which are interpreted as meaning "try again later". In |
|
19233 +this case, delivery is deferred. Details of a permanent failure are logged, but |
|
19234 +are not included in the bounce message, which merely contains "local delivery |
|
19235 +failed". |
|
19236 + |
|
19237 +If the return code is greater than 128 and the command being run is a shell |
|
19238 +script, it normally means that the script was terminated by a signal whose |
|
19239 +value is the return code minus 128. |
|
19240 + |
|
19241 +If Exim is unable to run the command (that is, if execve() fails), the return |
|
19242 +code is set to 127. This is the value that a shell returns if it is asked to |
|
19243 +run a non-existent command. The wording for the log line suggests that a |
|
19244 +non-existent command may be the problem. |
|
19245 + |
|
19246 +The return_output option can affect the result of a pipe delivery. If it is set |
|
19247 +and the command produces any output on its standard output or standard error |
|
19248 +streams, the command is considered to have failed, even if it gave a zero |
|
19249 +return code or if ignore_status is set. The output from the command is included |
|
19250 +as part of the bounce message. The return_fail_output option is similar, except |
|
19251 +that output is returned only when the command exits with a failure return code, |
|
19252 +that is, a value other than zero or a code that matches temp_errors. |
|
19253 + |
|
19254 +29.3Â How the command is run |
|
19255 + |
|
19256 +The command line is (by default) broken down into a command name and arguments |
|
19257 +by the pipe transport itself. The allow_commands and restrict_to_path options |
|
19258 +can be used to restrict the commands that may be run. |
|
19259 + |
|
19260 +Unquoted arguments are delimited by white space. If an argument appears in |
|
19261 +double quotes, backslash is interpreted as an escape character in the usual |
|
19262 +way. If an argument appears in single quotes, no escaping is done. |
|
19263 + |
|
19264 +String expansion is applied to the command line except when it comes from a |
|
19265 +traditional .forward file (commands from a filter file are expanded). The |
|
19266 +expansion is applied to each argument in turn rather than to the whole line. |
|
19267 +For this reason, any string expansion item that contains white space must be |
|
19268 +quoted so as to be contained within a single argument. A setting such as |
|
19269 + |
|
19270 +command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}} |
|
19271 + |
|
19272 +will not work, because the expansion item gets split between several arguments. |
|
19273 +You have to write |
|
19274 + |
|
19275 +command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}" |
|
19276 + |
|
19277 +to ensure that it is all in one argument. The expansion is done in this way, |
|
19278 +argument by argument, so that the number of arguments cannot be changed as a |
|
19279 +result of expansion, and quotes or backslashes in inserted variables do not |
|
19280 +interact with external quoting. However, this leads to problems if you want to |
|
19281 +generate multiple arguments (or the command name plus arguments) from a single |
|
19282 +expansion. In this situation, the simplest solution is to use a shell. For |
|
19283 +example: |
|
19284 + |
|
19285 +command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}} |
|
19286 + |
|
19287 +Special handling takes place when an argument consists of precisely the text |
|
19288 +"$pipe_addresses". This is not a general expansion variable; the only place |
|
19289 +this string is recognized is when it appears as an argument for a pipe or |
|
19290 +transport filter command. It causes each address that is being handled to be |
|
19291 +inserted in the argument list at that point as a separate argument. This avoids |
|
19292 +any problems with spaces or shell metacharacters, and is of use when a pipe |
|
19293 +transport is handling groups of addresses in a batch. |
|
19294 + |
|
19295 +After splitting up into arguments and expansion, the resulting command is run |
|
19296 +in a subprocess directly from the transport, not under a shell. The message |
|
19297 +that is being delivered is supplied on the standard input, and the standard |
|
19298 +output and standard error are both connected to a single pipe that is read by |
|
19299 +Exim. The max_output option controls how much output the command may produce, |
|
19300 +and the return_output and return_fail_output options control what is done with |
|
19301 +it. |
|
19302 + |
|
19303 +Not running the command under a shell (by default) lessens the security risks |
|
19304 +in cases when a command from a user's filter file is built out of data that was |
|
19305 +taken from an incoming message. If a shell is required, it can of course be |
|
19306 +explicitly specified as the command to be run. However, there are circumstances |
|
19307 +where existing commands (for example, in .forward files) expect to be run under |
|
19308 +a shell and cannot easily be modified. To allow for these cases, there is an |
|
19309 +option called use_shell, which changes the way the pipe transport works. |
|
19310 +Instead of breaking up the command line as just described, it expands it as a |
|
19311 +single string and passes the result to /bin/sh. The restrict_to_path option and |
|
19312 +the $pipe_addresses facility cannot be used with use_shell, and the whole |
|
19313 +mechanism is inherently less secure. |
|
19314 + |
|
19315 +29.4Â Environment variables |
|
19316 + |
|
19317 +The environment variables listed below are set up when the command is invoked. |
|
19318 +This list is a compromise for maximum compatibility with other MTAs. Note that |
|
19319 +the environment option can be used to add additional variables to this |
|
19320 +environment. |
|
19321 + |
|
19322 +DOMAIN               the domain of the address |
|
19323 +HOME                 the home directory, if set |
|
19324 +HOST                 the host name when called from a router |
|
19325 +(see below) |
|
19326 +LOCAL_PART           see below |
|
19327 +LOCAL_PART_PREFIX    see below |
|
19328 +LOCAL_PART_SUFFIX    see below |
|
19329 +LOGNAME              see below |
|
19330 +MESSAGE_ID           Exim's local ID for the message |
|
19331 +PATH                 as specified by the path |
|
19332 + option below |
|
19333 +QUALIFY_DOMAIN       the sender qualification domain |
|
19334 +RECIPIENT            the complete recipient address |
|
19335 +SENDER               the sender of the message |
|
19336 +(empty if a bounce) |
|
19337 +SHELLÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â /bin/sh |
|
19338 +TZ                   the value of the timezone |
|
19339 + option, if set |
|
19340 +USER                 see below |
|
19341 + |
|
19342 +When a pipe transport is called directly from (for example) an accept router, |
|
19343 +LOCAL_PART is set to the local part of the address. When it is called as a |
|
19344 +result of a forward or alias expansion, LOCAL_PART is set to the local part of |
|
19345 +the address that was expanded. In both cases, any affixes are removed from the |
|
19346 +local part, and made available in LOCAL_PART_PREFIX and LOCAL_PART_SUFFIX, |
|
19347 +respectively. LOGNAME and USER are set to the same value as LOCAL_PART for |
|
19348 +compatibility with other MTAs. |
|
19349 + |
|
19350 +HOST is set only when a pipe transport is called from a router that associates |
|
19351 +hosts with an address, typically when using pipe as a pseudo-remote transport. |
|
19352 +HOST is set to the first host name specified by the router. |
|
19353 + |
|
19354 +If the transport's generic home_directory option is set, its value is used for |
|
19355 +the HOME environment variable. Otherwise, a home directory may be set by the |
|
19356 +router's transport_home_directory option, which defaults to the user's home |
|
19357 +directory if check_local_user is set. |
|
19358 + |
|
19359 +29.5Â Private options for pipe |
|
19360 + |
|
19361 ++----------------------------------------------------------+ |
|
19362 +|allow_commands|Use: pipe|Type: string list*|Default: unset| |
|
19363 ++----------------------------------------------------------+ |
|
19364 + |
|
19365 +The string is expanded, and is then interpreted as a colon-separated list of |
|
19366 +permitted commands. If restrict_to_path is not set, the only commands permitted |
|
19367 +are those in the allow_commands list. They need not be absolute paths; the path |
|
19368 +option is still used for relative paths. If restrict_to_path is set with |
|
19369 +allow_commands, the command must either be in the allow_commands list, or a |
|
19370 +name without any slashes that is found on the path. In other words, if neither |
|
19371 +allow_commands nor restrict_to_path is set, there is no restriction on the |
|
19372 +command, but otherwise only commands that are permitted by one or the other are |
|
19373 +allowed. For example, if |
|
19374 + |
|
19375 +allow_commands = /usr/bin/vacation |
|
19376 + |
|
19377 +and restrict_to_path is not set, the only permitted command is /usr/bin/ |
|
19378 +vacation. The allow_commands option may not be set if use_shell is set. |
|
19379 + |
|
19380 ++-----------------------------------------------+ |
|
19381 +|batch_id|Use: pipe|Type: string*|Default: unset| |
|
19382 ++-----------------------------------------------+ |
|
19383 + |
|
19384 +See the description of local delivery batching in chapter 25. |
|
19385 + |
|
19386 ++--------------------------------------------+ |
|
19387 +|batch_max|Use: pipe|Type: integer|Default: 1| |
|
19388 ++--------------------------------------------+ |
|
19389 + |
|
19390 +This limits the number of addresses that can be handled in a single delivery. |
|
19391 +See the description of local delivery batching in chapter 25. |
|
19392 + |
|
19393 ++--------------------------------------------------+ |
|
19394 +|check_string|Use: pipe|Type: string|Default: unset| |
|
19395 ++--------------------------------------------------+ |
|
19396 + |
|
19397 +As pipe writes the message, the start of each line is tested for matching |
|
19398 +check_string, and if it does, the initial matching characters are replaced by |
|
19399 +the contents of escape_string, provided both are set. The value of check_string |
|
19400 +is a literal string, not a regular expression, and the case of any letters it |
|
19401 +contains is significant. When use_bsmtp is set, the contents of check_string |
|
19402 +and escape_string are forced to values that implement the SMTP escaping |
|
19403 +protocol. Any settings made in the configuration file are ignored. |
|
19404 + |
|
19405 ++----------------------------------------------+ |
|
19406 +|command|Use: pipe|Type: string*|Default: unset| |
|
19407 ++----------------------------------------------+ |
|
19408 + |
|
19409 +This option need not be set when pipe is being used to deliver to pipes |
|
19410 +obtained directly from address redirections. In other cases, the option must be |
|
19411 +set, to provide a command to be run. It need not yield an absolute path (see |
|
19412 +the path option below). The command is split up into separate arguments by |
|
19413 +Exim, and each argument is separately expanded, as described in section 29.3 |
|
19414 +above. |
|
19415 + |
|
19416 ++--------------------------------------------------+ |
|
19417 +|environment|Use: pipe|Type: string*|Default: unset| |
|
19418 ++--------------------------------------------------+ |
|
19419 + |
|
19420 +This option is used to add additional variables to the environment in which the |
|
19421 +command runs (see section 29.4 for the default list). Its value is a string |
|
19422 +which is expanded, and then interpreted as a colon-separated list of |
|
19423 +environment settings of the form <name>=<value>. |
|
19424 + |
|
19425 ++---------------------------------------------------+ |
|
19426 +|escape_string|Use: pipe|Type: string|Default: unset| |
|
19427 ++---------------------------------------------------+ |
|
19428 + |
|
19429 +See check_string above. |
|
19430 + |
|
19431 ++-------------------------------------------------------+ |
|
19432 +|freeze_exec_fail|Use: pipe|Type: boolean|Default: false| |
|
19433 ++-------------------------------------------------------+ |
|
19434 + |
|
19435 +Failure to exec the command in a pipe transport is by default treated like any |
|
19436 +other failure while running the command. However, if freeze_exec_fail is set, |
|
19437 +failure to exec is treated specially, and causes the message to be frozen, |
|
19438 +whatever the setting of ignore_status. |
|
19439 + |
|
19440 ++----------------------------------------------------+ |
|
19441 +|ignore_status|Use: pipe|Type: boolean|Default: false| |
|
19442 ++----------------------------------------------------+ |
|
19443 + |
|
19444 +If this option is true, the status returned by the subprocess that is set up to |
|
19445 +run the command is ignored, and Exim behaves as if zero had been returned. |
|
19446 +Otherwise, a non-zero status or termination by signal causes an error return |
|
19447 +from the transport unless the status value is one of those listed in |
|
19448 +temp_errors; these cause the delivery to be deferred and tried again later. |
|
19449 + |
|
19450 +Note: This option does not apply to timeouts, which do not return a status. See |
|
19451 +the timeout_defer option for how timeouts are handled. |
|
19452 + |
|
19453 ++-------------------------------------------------------+ |
|
19454 +|log_defer_output|Use: pipe|Type: boolean|Default: false| |
|
19455 ++-------------------------------------------------------+ |
|
19456 + |
|
19457 +If this option is set, and the status returned by the command is one of the |
|
19458 +codes listed in temp_errors (that is, delivery was deferred), and any output |
|
19459 +was produced, the first line of it is written to the main log. |
|
19460 + |
|
19461 ++------------------------------------------------------+ |
|
19462 +|log_fail_output|Use: pipe|Type: boolean|Default: false| |
|
19463 ++------------------------------------------------------+ |
|
19464 + |
|
19465 +If this option is set, and the command returns any output, and also ends with a |
|
19466 +return code that is neither zero nor one of the return codes listed in |
|
19467 +temp_errors (that is, the delivery failed), the first line of output is written |
|
19468 +to the main log. This option and log_output are mutually exclusive. Only one of |
|
19469 +them may be set. |
|
19470 + |
|
19471 ++-------------------------------------------------+ |
|
19472 +|log_output|Use: pipe|Type: boolean|Default: false| |
|
19473 ++-------------------------------------------------+ |
|
19474 + |
|
19475 +If this option is set and the command returns any output, the first line of |
|
19476 +output is written to the main log, whatever the return code. This option and |
|
19477 +log_fail_output are mutually exclusive. Only one of them may be set. |
|
19478 + |
|
19479 ++-----------------------------------------------+ |
|
19480 +|max_output|Use: pipe|Type: integer|Default: 20K| |
|
19481 ++-----------------------------------------------+ |
|
19482 + |
|
19483 +This specifies the maximum amount of output that the command may produce on its |
|
19484 +standard output and standard error file combined. If the limit is exceeded, the |
|
19485 +process running the command is killed. This is intended as a safety measure to |
|
19486 +catch runaway processes. The limit is applied independently of the settings of |
|
19487 +the options that control what is done with such output (for example, |
|
19488 +return_output). Because of buffering effects, the amount of output may exceed |
|
19489 +the limit by a small amount before Exim notices. |
|
19490 + |
|
19491 ++---------------------------------------------------------+ |
|
19492 +|message_prefix|Use: pipe|Type: string*|Default: see below| |
|
19493 ++---------------------------------------------------------+ |
|
19494 + |
|
19495 +The string specified here is expanded and output at the start of every message. |
|
19496 +The default is unset if use_bsmtp is set. Otherwise it is |
|
19497 + |
|
19498 +message_prefix = \ |
|
19499 + From ${if def:return_path{$return_path}{MAILER-DAEMON}}\ |
|
19500 + ${tod_bsdinbox}\n |
|
19501 + |
|
19502 +This is required by the commonly used /usr/bin/vacation program. However, it |
|
19503 +must not be present if delivery is to the Cyrus IMAP server, or to the tmail |
|
19504 +local delivery agent. The prefix can be suppressed by setting |
|
19505 + |
|
19506 +message_prefix = |
|
19507 + |
|
19508 +Note: If you set use_crlf true, you must change any occurrences of "\n" to "\r\ |
|
19509 +n" in message_prefix. |
|
19510 + |
|
19511 ++---------------------------------------------------------+ |
|
19512 +|message_suffix|Use: pipe|Type: string*|Default: see below| |
|
19513 ++---------------------------------------------------------+ |
|
19514 + |
|
19515 +The string specified here is expanded and output at the end of every message. |
|
19516 +The default is unset if use_bsmtp is set. Otherwise it is a single newline. The |
|
19517 +suffix can be suppressed by setting |
|
19518 + |
|
19519 +message_suffix = |
|
19520 + |
|
19521 +Note: If you set use_crlf true, you must change any occurrences of "\n" to "\r\ |
|
19522 +n" in message_suffix. |
|
19523 + |
|
19524 ++----------------------------------------------+ |
|
19525 +|path|Use: pipe|Type: string|Default: see below| |
|
19526 ++----------------------------------------------+ |
|
19527 + |
|
19528 +This option specifies the string that is set up in the PATH environment |
|
19529 +variable of the subprocess. The default is: |
|
19530 + |
|
19531 +/bin:/usr/bin |
|
19532 + |
|
19533 +If the command option does not yield an absolute path name, the command is |
|
19534 +sought in the PATH directories, in the usual way. Warning: This does not apply |
|
19535 +to a command specified as a transport filter. |
|
19536 + |
|
19537 ++------------------------------------------------------+ |
|
19538 +|permit_coredump|Use: pipe|Type: boolean|Default: false| |
|
19539 ++------------------------------------------------------+ |
|
19540 + |
|
19541 +Normally Exim inhibits core-dumps during delivery. If you have a need to get a |
|
19542 +core-dump of a pipe command, enable this command. This enables core-dumps |
|
19543 +during delivery and affects both the Exim binary and the pipe command run. It |
|
19544 +is recommended that this option remain off unless and until you have a need for |
|
19545 +it and that this only be enabled when needed, as the risk of excessive resource |
|
19546 +consumption can be quite high. Note also that Exim is typically installed as a |
|
19547 +setuid binary and most operating systems will inhibit coredumps of these by |
|
19548 +default, so further OS-specific action may be required. |
|
19549 + |
|
19550 ++------------------------------------------------------+ |
|
19551 +|pipe_as_creator|Use: pipe|Type: boolean|Default: false| |
|
19552 ++------------------------------------------------------+ |
|
19553 + |
|
19554 +If the generic user option is not set and this option is true, the delivery |
|
19555 +process is run under the uid that was in force when Exim was originally called |
|
19556 +to accept the message. If the group id is not otherwise set (via the generic |
|
19557 +group option), the gid that was in force when Exim was originally called to |
|
19558 +accept the message is used. |
|
19559 + |
|
19560 ++-------------------------------------------------------+ |
|
19561 +|restrict_to_path|Use: pipe|Type: boolean|Default: false| |
|
19562 ++-------------------------------------------------------+ |
|
19563 + |
|
19564 +When this option is set, any command name not listed in allow_commands must |
|
19565 +contain no slashes. The command is searched for only in the directories listed |
|
19566 +in the path option. This option is intended for use in the case when a pipe |
|
19567 +command has been generated from a user's .forward file. This is usually handled |
|
19568 +by a pipe transport called address_pipe. |
|
19569 + |
|
19570 ++---------------------------------------------------------+ |
|
19571 +|return_fail_output|Use: pipe|Type: boolean|Default: false| |
|
19572 ++---------------------------------------------------------+ |
|
19573 + |
|
19574 +If this option is true, and the command produced any output and ended with a |
|
19575 +return code other than zero or one of the codes listed in temp_errors (that is, |
|
19576 +the delivery failed), the output is returned in the bounce message. However, if |
|
19577 +the message has a null sender (that is, it is itself a bounce message), output |
|
19578 +from the command is discarded. This option and return_output are mutually |
|
19579 +exclusive. Only one of them may be set. |
|
19580 + |
|
19581 ++----------------------------------------------------+ |
|
19582 +|return_output|Use: pipe|Type: boolean|Default: false| |
|
19583 ++----------------------------------------------------+ |
|
19584 + |
|
19585 +If this option is true, and the command produced any output, the delivery is |
|
19586 +deemed to have failed whatever the return code from the command, and the output |
|
19587 +is returned in the bounce message. Otherwise, the output is just discarded. |
|
19588 +However, if the message has a null sender (that is, it is a bounce message), |
|
19589 +output from the command is always discarded, whatever the setting of this |
|
19590 +option. This option and return_fail_output are mutually exclusive. Only one of |
|
19591 +them may be set. |
|
19592 + |
|
19593 ++----------------------------------------------------------+ |
|
19594 +|temp_errors|Use: pipe|Type: string list|Default: see below| |
|
19595 ++----------------------------------------------------------+ |
|
19596 + |
|
19597 +This option contains either a colon-separated list of numbers, or a single |
|
19598 +asterisk. If ignore_status is false and return_output is not set, and the |
|
19599 +command exits with a non-zero return code, the failure is treated as temporary |
|
19600 +and the delivery is deferred if the return code matches one of the numbers, or |
|
19601 +if the setting is a single asterisk. Otherwise, non-zero return codes are |
|
19602 +treated as permanent errors. The default setting contains the codes defined by |
|
19603 +EX_TEMPFAIL and EX_CANTCREAT in sysexits.h. If Exim is compiled on a system |
|
19604 +that does not define these macros, it assumes values of 75 and 73, |
|
19605 +respectively. |
|
19606 + |
|
19607 ++----------------------------------------+ |
|
19608 +|timeout|Use: pipe|Type: time|Default: 1h| |
|
19609 ++----------------------------------------+ |
|
19610 + |
|
19611 +If the command fails to complete within this time, it is killed. This normally |
|
19612 +causes the delivery to fail (but see timeout_defer). A zero time interval |
|
19613 +specifies no timeout. In order to ensure that any subprocesses created by the |
|
19614 +command are also killed, Exim makes the initial process a process group leader, |
|
19615 +and kills the whole process group on a timeout. However, this can be defeated |
|
19616 +if one of the processes starts a new process group. |
|
19617 + |
|
19618 ++----------------------------------------------------+ |
|
19619 +|timeout_defer|Use: pipe|Type: boolean|Default: false| |
|
19620 ++----------------------------------------------------+ |
|
19621 + |
|
19622 +A timeout in a pipe transport, either in the command that the transport runs, |
|
19623 +or in a transport filter that is associated with it, is by default treated as a |
|
19624 +hard error, and the delivery fails. However, if timeout_defer is set true, both |
|
19625 +kinds of timeout become temporary errors, causing the delivery to be deferred. |
|
19626 + |
|
19627 ++------------------------------------------------+ |
|
19628 +|umask|Use: pipe|Type: octal integer|Default: 022| |
|
19629 ++------------------------------------------------+ |
|
19630 + |
|
19631 +This specifies the umask setting for the subprocess that runs the command. |
|
19632 + |
|
19633 ++------------------------------------------------+ |
|
19634 +|use_bsmtp|Use: pipe|Type: boolean|Default: false| |
|
19635 ++------------------------------------------------+ |
|
19636 + |
|
19637 +If this option is set true, the pipe transport writes messages in "batch SMTP" |
|
19638 +format, with the envelope sender and recipient(s) included as SMTP commands. If |
|
19639 +you want to include a leading HELO command with such messages, you can do so by |
|
19640 +setting the message_prefix option. See section 45.10 for details of batch SMTP. |
|
19641 + |
|
19642 ++---------------------------------------------------------+ |
|
19643 +|use_classresources|Use: pipe|Type: boolean|Default: false| |
|
19644 ++---------------------------------------------------------+ |
|
19645 + |
|
19646 +This option is available only when Exim is running on FreeBSD, NetBSD, or BSD/ |
|
19647 +OS. If it is set true, the setclassresources() function is used to set resource |
|
19648 +limits when a pipe transport is run to perform a delivery. The limits for the |
|
19649 +uid under which the pipe is to run are obtained from the login class database. |
|
19650 + |
|
19651 ++-----------------------------------------------+ |
|
19652 +|use_crlf|Use: pipe|Type: boolean|Default: false| |
|
19653 ++-----------------------------------------------+ |
|
19654 + |
|
19655 +This option causes lines to be terminated with the two-character CRLF sequence |
|
19656 +(carriage return, linefeed) instead of just a linefeed character. In the case |
|
19657 +of batched SMTP, the byte sequence written to the pipe is then an exact image |
|
19658 +of what would be sent down a real SMTP connection. |
|
19659 + |
|
19660 +The contents of the message_prefix and message_suffix options are written |
|
19661 +verbatim, so must contain their own carriage return characters if these are |
|
19662 +needed. When use_bsmtp is not set, the default values for both message_prefix |
|
19663 +and message_suffix end with a single linefeed, so their values must be changed |
|
19664 +to end with "\r\n" if use_crlf is set. |
|
19665 + |
|
19666 ++------------------------------------------------+ |
|
19667 +|use_shell|Use: pipe|Type: boolean|Default: false| |
|
19668 ++------------------------------------------------+ |
|
19669 + |
|
19670 +If this option is set, it causes the command to be passed to /bin/sh instead of |
|
19671 +being run directly from the transport, as described in section 29.3. This is |
|
19672 +less secure, but is needed in some situations where the command is expected to |
|
19673 +be run under a shell and cannot easily be modified. The allow_commands and |
|
19674 +restrict_to_path options, and the "$pipe_addresses" facility are incompatible |
|
19675 +with use_shell. The command is expanded as a single string, and handed to /bin/ |
|
19676 +sh as data for its -c option. |
|
19677 + |
|
19678 +29.6Â Using an external local delivery agent |
|
19679 + |
|
19680 +The pipe transport can be used to pass all messages that require local delivery |
|
19681 +to a separate local delivery agent such as procmail. When doing this, care must |
|
19682 +be taken to ensure that the pipe is run under an appropriate uid and gid. In |
|
19683 +some configurations one wants this to be a uid that is trusted by the delivery |
|
19684 +agent to supply the correct sender of the message. It may be necessary to |
|
19685 +recompile or reconfigure the delivery agent so that it trusts an appropriate |
|
19686 +user. The following is an example transport and router configuration for |
|
19687 +procmail: |
|
19688 + |
|
19689 +# transport |
|
19690 +procmail_pipe: |
|
19691 + driver = pipe |
|
19692 + command = /usr/local/bin/procmail -d $local_part |
|
19693 + return_path_add |
|
19694 + delivery_date_add |
|
19695 + envelope_to_add |
|
19696 + check_string = "From " |
|
19697 + escape_string = ">From " |
|
19698 + umask = 077 |
|
19699 + user = $local_part |
|
19700 + group = mail |
|
19701 + |
|
19702 +# router |
|
19703 +procmail: |
|
19704 + driver = accept |
|
19705 + check_local_user |
|
19706 + transport = procmail_pipe |
|
19707 + |
|
19708 +In this example, the pipe is run as the local user, but with the group set to |
|
19709 +mail. An alternative is to run the pipe as a specific user such as mail or exim |
|
19710 +, but in this case you must arrange for procmail to trust that user to supply a |
|
19711 +correct sender address. If you do not specify either a group or a user option, |
|
19712 +the pipe command is run as the local user. The home directory is the user's |
|
19713 +home directory by default. |
|
19714 + |
|
19715 +Note: The command that the pipe transport runs does not begin with |
|
19716 + |
|
19717 +IFS=" " |
|
19718 + |
|
19719 +as shown in some procmail documentation, because Exim does not by default use a |
|
19720 +shell to run pipe commands. |
|
19721 + |
|
19722 +The next example shows a transport and a router for a system where local |
|
19723 +deliveries are handled by the Cyrus IMAP server. |
|
19724 + |
|
19725 +# transport |
|
19726 +local_delivery_cyrus: |
|
19727 + driver = pipe |
|
19728 + command = /usr/cyrus/bin/deliver \ |
|
19729 + -m ${substr_1:$local_part_suffix} -- $local_part |
|
19730 + user = cyrus |
|
19731 + group = mail |
|
19732 + return_output |
|
19733 + log_output |
|
19734 + message_prefix = |
|
19735 + message_suffix = |
|
19736 + |
|
19737 +# router |
|
19738 +local_user_cyrus: |
|
19739 + driver = accept |
|
19740 + check_local_user |
|
19741 + local_part_suffix = .* |
|
19742 + transport = local_delivery_cyrus |
|
19743 + |
|
19744 +Note the unsetting of message_prefix and message_suffix, and the use of |
|
19745 +return_output to cause any text written by Cyrus to be returned to the sender. |
|
19746 + |
|
19747 +30. The smtp transport |
|
19748 + |
|
19749 +The smtp transport delivers messages over TCP/IP connections using the SMTP or |
|
19750 +LMTP protocol. The list of hosts to try can either be taken from the address |
|
19751 +that is being processed (having been set up by the router), or specified |
|
19752 +explicitly for the transport. Timeout and retry processing (see chapter 32) is |
|
19753 +applied to each IP address independently. |
|
19754 + |
|
19755 +30.1Â Multiple messages on a single connection |
|
19756 + |
|
19757 +The sending of multiple messages over a single TCP/IP connection can arise in |
|
19758 +two ways: |
|
19759 + |
|
19760 + * If a message contains more than max_rcpt (see below) addresses that are |
|
19761 + routed to the same host, more than one copy of the message has to be sent |
|
19762 + to that host. In this situation, multiple copies may be sent in a single |
|
19763 + run of the smtp transport over a single TCP/IP connection. (What Exim |
|
19764 + actually does when it has too many addresses to send in one message also |
|
19765 + depends on the value of the global remote_max_parallel option. Details are |
|
19766 + given in section 45.1.) |
|
19767 + |
|
19768 + * When a message has been successfully delivered over a TCP/IP connection, |
|
19769 + Exim looks in its hints database to see if there are any other messages |
|
19770 + awaiting a connection to the same host. If there are, a new delivery |
|
19771 + process is started for one of them, and the current TCP/IP connection is |
|
19772 + passed on to it. The new process may in turn send multiple copies and |
|
19773 + possibly create yet another process. |
|
19774 + |
|
19775 +For each copy sent over the same TCP/IP connection, a sequence counter is |
|
19776 +incremented, and if it ever gets to the value of connection_max_messages, no |
|
19777 +further messages are sent over that connection. |
|
19778 + |
|
19779 +30.2Â Use of the $host and $host_address variables |
|
19780 + |
|
19781 +At the start of a run of the smtp transport, the values of $host and |
|
19782 +$host_address are the name and IP address of the first host on the host list |
|
19783 +passed by the router. However, when the transport is about to connect to a |
|
19784 +specific host, and while it is connected to that host, $host and $host_address |
|
19785 +are set to the values for that host. These are the values that are in force |
|
19786 +when the helo_data, hosts_try_auth, interface, serialize_hosts, and the various |
|
19787 +TLS options are expanded. |
|
19788 + |
|
19789 +30.3Â Use of $tls_cipher and $tls_peerdn |
|
19790 + |
|
19791 +At the start of a run of the smtp transport, the values of $tls_cipher and |
|
19792 +$tls_peerdn are the values that were set when the message was received. These |
|
19793 +are the values that are used for options that are expanded before any SMTP |
|
19794 +connections are made. Just before each connection is made, these two variables |
|
19795 +are emptied. If TLS is subsequently started, they are set to the appropriate |
|
19796 +values for the outgoing connection, and these are the values that are in force |
|
19797 +when any authenticators are run and when the authenticated_sender option is |
|
19798 +expanded. |
|
19799 + |
|
19800 +30.4Â Private options for smtp |
|
19801 + |
|
19802 +The private options of the smtp transport are as follows: |
|
19803 + |
|
19804 ++------------------------------------------------------------------+ |
|
19805 +|address_retry_include_sender|Use: smtp|Type: boolean|Default: true| |
|
19806 ++------------------------------------------------------------------+ |
|
19807 + |
|
19808 +When an address is delayed because of a 4xx response to a RCPT command, it is |
|
19809 +the combination of sender and recipient that is delayed in subsequent queue |
|
19810 +runs until the retry time is reached. You can delay the recipient without |
|
19811 +reference to the sender (which is what earlier versions of Exim did), by |
|
19812 +setting address_retry_include_sender false. However, this can lead to problems |
|
19813 +with servers that regularly issue 4xx responses to RCPT commands. |
|
19814 + |
|
19815 ++------------------------------------------------------+ |
|
19816 +|allow_localhost|Use: smtp|Type: boolean|Default: false| |
|
19817 ++------------------------------------------------------+ |
|
19818 + |
|
19819 +When a host specified in hosts or fallback_hosts (see below) turns out to be |
|
19820 +the local host, or is listed in hosts_treat_as_local, delivery is deferred by |
|
19821 +default. However, if allow_localhost is set, Exim goes on to do the delivery |
|
19822 +anyway. This should be used only in special cases when the configuration |
|
19823 +ensures that no looping will result (for example, a differently configured Exim |
|
19824 +is listening on the port to which the message is sent). |
|
19825 + |
|
19826 ++-----------------------------------------------------------+ |
|
19827 +|authenticated_sender|Use: smtp|Type: string*|Default: unset| |
|
19828 ++-----------------------------------------------------------+ |
|
19829 + |
|
19830 +When Exim has authenticated as a client, or if authenticated_sender_force is |
|
19831 +true, this option sets a value for the AUTH= item on outgoing MAIL commands, |
|
19832 +overriding any existing authenticated sender value. If the string expansion is |
|
19833 +forced to fail, the option is ignored. Other expansion failures cause delivery |
|
19834 +to be deferred. If the result of expansion is an empty string, that is also |
|
19835 +ignored. |
|
19836 + |
|
19837 +The expansion happens after the outgoing connection has been made and TLS |
|
19838 +started, if required. This means that the $host, $host_address, $tls_cipher, |
|
19839 +and $tls_peerdn variables are set according to the particular connection. |
|
19840 + |
|
19841 +If the SMTP session is not authenticated, the expansion of authenticated_sender |
|
19842 +still happens (and can cause the delivery to be deferred if it fails), but no |
|
19843 +AUTH= item is added to MAIL commands unless authenticated_sender_force is true. |
|
19844 + |
|
19845 +This option allows you to use the smtp transport in LMTP mode to deliver mail |
|
19846 +to Cyrus IMAP and provide the proper local part as the "authenticated sender", |
|
19847 +via a setting such as: |
|
19848 + |
|
19849 +authenticated_sender = $local_part |
|
19850 + |
|
19851 +This removes the need for IMAP subfolders to be assigned special ACLs to allow |
|
19852 +direct delivery to those subfolders. |
|
19853 + |
|
19854 +Because of expected uses such as that just described for Cyrus (when no domain |
|
19855 +is involved), there is no checking on the syntax of the provided value. |
|
19856 + |
|
19857 ++-----------------------------------------------------------------+ |
|
19858 +|authenticated_sender_force|Use: smtp|Type: boolean|Default: false| |
|
19859 ++-----------------------------------------------------------------+ |
|
19860 + |
|
19861 +If this option is set true, the authenticated_sender option's value is used for |
|
19862 +the AUTH= item on outgoing MAIL commands, even if Exim has not authenticated as |
|
19863 +a client. |
|
19864 + |
|
19865 ++------------------------------------------------+ |
|
19866 +|command_timeout|Use: smtp|Type: time|Default: 5m| |
|
19867 ++------------------------------------------------+ |
|
19868 + |
|
19869 +This sets a timeout for receiving a response to an SMTP command that has been |
|
19870 +sent out. It is also used when waiting for the initial banner line from the |
|
19871 +remote host. Its value must not be zero. |
|
19872 + |
|
19873 ++------------------------------------------------+ |
|
19874 +|connect_timeout|Use: smtp|Type: time|Default: 5m| |
|
19875 ++------------------------------------------------+ |
|
19876 + |
|
19877 +This sets a timeout for the connect() function, which sets up a TCP/IP call to |
|
19878 +a remote host. A setting of zero allows the system timeout (typically several |
|
19879 +minutes) to act. To have any effect, the value of this option must be less than |
|
19880 +the system timeout. However, it has been observed that on some systems there is |
|
19881 +no system timeout, which is why the default value for this option is 5 minutes, |
|
19882 +a value recommended by RFC 1123. |
|
19883 + |
|
19884 ++------------------------------------------------------------+ |
|
19885 +|connection_max_messages|Use: smtp|Type: integer|Default: 500| |
|
19886 ++------------------------------------------------------------+ |
|
19887 + |
|
19888 +This controls the maximum number of separate message deliveries that are sent |
|
19889 +over a single TCP/IP connection. If the value is zero, there is no limit. For |
|
19890 +testing purposes, this value can be overridden by the -oB command line option. |
|
19891 + |
|
19892 ++---------------------------------------------+ |
|
19893 +|data_timeout|Use: smtp|Type: time|Default: 5m| |
|
19894 ++---------------------------------------------+ |
|
19895 + |
|
19896 +This sets a timeout for the transmission of each block in the data portion of |
|
19897 +the message. As a result, the overall timeout for a message depends on the size |
|
19898 +of the message. Its value must not be zero. See also final_timeout. |
|
19899 + |
|
19900 ++--------------------------------------------------------+ |
|
19901 +|delay_after_cutoff|Use: smtp|Type: boolean|Default: true| |
|
19902 ++--------------------------------------------------------+ |
|
19903 + |
|
19904 +This option controls what happens when all remote IP addresses for a given |
|
19905 +domain have been inaccessible for so long that they have passed their retry |
|
19906 +cutoff times. |
|
19907 + |
|
19908 +In the default state, if the next retry time has not been reached for any of |
|
19909 +them, the address is bounced without trying any deliveries. In other words, |
|
19910 +Exim delays retrying an IP address after the final cutoff time until a new |
|
19911 +retry time is reached, and can therefore bounce an address without ever trying |
|
19912 +a delivery, when machines have been down for a long time. Some people are |
|
19913 +unhappy at this prospect, so... |
|
19914 + |
|
19915 +If delay_after_cutoff is set false, Exim behaves differently. If all IP |
|
19916 +addresses are past their final cutoff time, Exim tries to deliver to those IP |
|
19917 +addresses that have not been tried since the message arrived. If there are |
|
19918 +none, of if they all fail, the address is bounced. In other words, it does not |
|
19919 +delay when a new message arrives, but immediately tries those expired IP |
|
19920 +addresses that haven't been tried since the message arrived. If there is a |
|
19921 +continuous stream of messages for the dead hosts, unsetting delay_after_cutoff |
|
19922 +means that there will be many more attempts to deliver to them. |
|
19923 + |
|
19924 ++--------------------------------------------------------+ |
|
19925 +|dns_qualify_single|Use: smtp|Type: boolean|Default: true| |
|
19926 ++--------------------------------------------------------+ |
|
19927 + |
|
19928 +If the hosts or fallback_hosts option is being used, and the gethostbyname |
|
19929 +option is false, the RES_DEFNAMES resolver option is set. See the |
|
19930 +qualify_single option in chapter 17 for more details. |
|
19931 + |
|
19932 ++---------------------------------------------------------+ |
|
19933 +|dns_search_parents|Use: smtp|Type: boolean|Default: false| |
|
19934 ++---------------------------------------------------------+ |
|
19935 + |
|
19936 +If the hosts or fallback_hosts option is being used, and the gethostbyname |
|
19937 +option is false, the RES_DNSRCH resolver option is set. See the search_parents |
|
19938 +option in chapter 17 for more details. |
|
19939 + |
|
19940 ++---------------------------------------------------------+ |
|
19941 +|fallback_hosts|Use: smtp|Type: string list|Default: unset| |
|
19942 ++---------------------------------------------------------+ |
|
19943 + |
|
19944 +String expansion is not applied to this option. The argument must be a |
|
19945 +colon-separated list of host names or IP addresses, optionally also including |
|
19946 +port numbers, though the separator can be changed, as described in section 6.19 |
|
19947 +. Each individual item in the list is the same as an item in a route_list |
|
19948 +setting for the manualroute router, as described in section 20.5. |
|
19949 + |
|
19950 +Fallback hosts can also be specified on routers, which associate them with the |
|
19951 +addresses they process. As for the hosts option without hosts_override, |
|
19952 +fallback_hosts specified on the transport is used only if the address does not |
|
19953 +have its own associated fallback host list. Unlike hosts, a setting of |
|
19954 +fallback_hosts on an address is not overridden by hosts_override. However, |
|
19955 +hosts_randomize does apply to fallback host lists. |
|
19956 + |
|
19957 +If Exim is unable to deliver to any of the hosts for a particular address, and |
|
19958 +the errors are not permanent rejections, the address is put on a separate |
|
19959 +transport queue with its host list replaced by the fallback hosts, unless the |
|
19960 +address was routed via MX records and the current host was in the original MX |
|
19961 +list. In that situation, the fallback host list is not used. |
|
19962 + |
|
19963 +Once normal deliveries are complete, the fallback queue is delivered by |
|
19964 +re-running the same transports with the new host lists. If several failing |
|
19965 +addresses have the same fallback hosts (and max_rcpt permits it), a single copy |
|
19966 +of the message is sent. |
|
19967 + |
|
19968 +The resolution of the host names on the fallback list is controlled by the |
|
19969 +gethostbyname option, as for the hosts option. Fallback hosts apply both to |
|
19970 +cases when the host list comes with the address and when it is taken from hosts |
|
19971 +. This option provides a "use a smart host only if delivery fails" facility. |
|
19972 + |
|
19973 ++-----------------------------------------------+ |
|
19974 +|final_timeout|Use: smtp|Type: time|Default: 10m| |
|
19975 ++-----------------------------------------------+ |
|
19976 + |
|
19977 +This is the timeout that applies while waiting for the response to the final |
|
19978 +line containing just "." that terminates a message. Its value must not be zero. |
|
19979 + |
|
19980 ++----------------------------------------------------+ |
|
19981 +|gethostbyname|Use: smtp|Type: boolean|Default: false| |
|
19982 ++----------------------------------------------------+ |
|
19983 + |
|
19984 +If this option is true when the hosts and/or fallback_hosts options are being |
|
19985 +used, names are looked up using gethostbyname() (or getipnodebyname() when |
|
19986 +available) instead of using the DNS. Of course, that function may in fact use |
|
19987 +the DNS, but it may also consult other sources of information such as /etc/ |
|
19988 +hosts. |
|
19989 + |
|
19990 ++-------------------------------------------------------+ |
|
19991 +|gnutls_require_kx|Use: smtp|Type: string|Default: unset| |
|
19992 ++-------------------------------------------------------+ |
|
19993 + |
|
19994 +This option controls the key exchange mechanisms when GnuTLS is used in an Exim |
|
19995 +client. For details, see section 39.5. |
|
19996 + |
|
19997 ++--------------------------------------------------------+ |
|
19998 +|gnutls_require_mac|Use: smtp|Type: string|Default: unset| |
|
19999 ++--------------------------------------------------------+ |
|
20000 + |
|
20001 +This option controls the MAC algorithms when GnuTLS is used in an Exim client. |
|
20002 +For details, see section 39.5. |
|
20003 + |
|
20004 ++--------------------------------------------------------------+ |
|
20005 +|gnutls_require_protocols|Use: smtp|Type: string|Default: unset| |
|
20006 ++--------------------------------------------------------------+ |
|
20007 + |
|
20008 +This option controls the protocols when GnuTLS is used in an Exim client. For |
|
20009 +details, see section 39.5. |
|
20010 + |
|
20011 ++---------------------------------------------------------+ |
|
20012 +|gnutls_compat_mode|Use: smtp|Type: boolean|Default: unset| |
|
20013 ++---------------------------------------------------------+ |
|
20014 + |
|
20015 +This option controls whether GnuTLS is used in compatibility mode in an Exim |
|
20016 +server. This reduces security slightly, but improves interworking with older |
|
20017 +implementations of TLS. |
|
20018 + |
|
20019 ++----------------------------------------------------+ |
|
20020 +|helo_data|Use: smtp|Type: string*|Default: see below| |
|
20021 ++----------------------------------------------------+ |
|
20022 + |
|
20023 +The value of this option is expanded after a connection to a another host has |
|
20024 +been set up. The result is used as the argument for the EHLO, HELO, or LHLO |
|
20025 +command that starts the outgoing SMTP or LMTP session. The default value of the |
|
20026 +option is: |
|
20027 + |
|
20028 +$primary_hostname |
|
20029 + |
|
20030 +During the expansion, the variables $host and $host_address are set to the |
|
20031 +identity of the remote host, and the variables $sending_ip_address and |
|
20032 +$sending_port are set to the local IP address and port number that are being |
|
20033 +used. These variables can be used to generate different values for different |
|
20034 +servers or different local IP addresses. For example, if you want the string |
|
20035 +that is used for helo_data to be obtained by a DNS lookup of the outgoing |
|
20036 +interface address, you could use this: |
|
20037 + |
|
20038 +helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\ |
|
20039 + {$primary_hostname}} |
|
20040 + |
|
20041 +The use of helo_data applies both to sending messages and when doing callouts. |
|
20042 + |
|
20043 ++-------------------------------------------------+ |
|
20044 +|hosts|Use: smtp|Type: string list*|Default: unset| |
|
20045 ++-------------------------------------------------+ |
|
20046 + |
|
20047 +Hosts are associated with an address by a router such as dnslookup, which finds |
|
20048 +the hosts by looking up the address domain in the DNS, or by manualroute, which |
|
20049 +has lists of hosts in its configuration. However, email addresses can be passed |
|
20050 +to the smtp transport by any router, and not all of them can provide an |
|
20051 +associated list of hosts. |
|
20052 + |
|
20053 +The hosts option specifies a list of hosts to be used if the address being |
|
20054 +processed does not have any hosts associated with it. The hosts specified by |
|
20055 +hosts are also used, whether or not the address has its own hosts, if |
|
20056 +hosts_override is set. |
|
20057 + |
|
20058 +The string is first expanded, before being interpreted as a colon-separated |
|
20059 +list of host names or IP addresses, possibly including port numbers. The |
|
20060 +separator may be changed to something other than colon, as described in section |
|
20061 +6.19. Each individual item in the list is the same as an item in a route_list |
|
20062 +setting for the manualroute router, as described in section 20.5. However, note |
|
20063 +that the "/MX" facility of the manualroute router is not available here. |
|
20064 + |
|
20065 +If the expansion fails, delivery is deferred. Unless the failure was caused by |
|
20066 +the inability to complete a lookup, the error is logged to the panic log as |
|
20067 +well as the main log. Host names are looked up either by searching directly for |
|
20068 +address records in the DNS or by calling gethostbyname() (or getipnodebyname() |
|
20069 +when available), depending on the setting of the gethostbyname option. When |
|
20070 +Exim is compiled with IPv6 support, if a host that is looked up in the DNS has |
|
20071 +both IPv4 and IPv6 addresses, both types of address are used. |
|
20072 + |
|
20073 +During delivery, the hosts are tried in order, subject to their retry status, |
|
20074 +unless hosts_randomize is set. |
|
20075 + |
|
20076 ++-----------------------------------------------------------+ |
|
20077 +|hosts_avoid_esmtp|Use: smtp|Type: host list*|Default: unset| |
|
20078 ++-----------------------------------------------------------+ |
|
20079 + |
|
20080 +This option is for use with broken hosts that announce ESMTP facilities (for |
|
20081 +example, PIPELINING) and then fail to implement them properly. When a host |
|
20082 +matches hosts_avoid_esmtp, Exim sends HELO rather than EHLO at the start of the |
|
20083 +SMTP session. This means that it cannot use any of the ESMTP facilities such as |
|
20084 +AUTH, PIPELINING, SIZE, and STARTTLS. |
|
20085 + |
|
20086 ++----------------------------------------------------------------+ |
|
20087 +|hosts_avoid_pipelining|Use: smtp|Type: host list*|Default: unset| |
|
20088 ++----------------------------------------------------------------+ |
|
20089 + |
|
20090 +Exim will not use the SMTP PIPELINING extension when delivering to any host |
|
20091 +that matches this list, even if the server host advertises PIPELINING support. |
|
20092 + |
|
20093 ++---------------------------------------------------------+ |
|
20094 +|hosts_avoid_tls|Use: smtp|Type: host list*|Default: unset| |
|
20095 ++---------------------------------------------------------+ |
|
20096 + |
|
20097 +Exim will not try to start a TLS session when delivering to any host that |
|
20098 +matches this list. See chapter 39 for details of TLS. |
|
20099 + |
|
20100 ++------------------------------------------------+ |
|
20101 +|hosts_max_try|Use: smtp|Type: integer|Default: 5| |
|
20102 ++------------------------------------------------+ |
|
20103 + |
|
20104 +This option limits the number of IP addresses that are tried for any one |
|
20105 +delivery in cases where there are temporary delivery errors. Section 30.5 |
|
20106 +describes in detail how the value of this option is used. |
|
20107 + |
|
20108 ++-----------------------------------------------------------+ |
|
20109 +|hosts_max_try_hardlimit|Use: smtp|Type: integer|Default: 50| |
|
20110 ++-----------------------------------------------------------+ |
|
20111 + |
|
20112 +This is an additional check on the maximum number of IP addresses that Exim |
|
20113 +tries for any one delivery. Section 30.5 describes its use and why it exists. |
|
20114 + |
|
20115 ++----------------------------------------------------------+ |
|
20116 +|hosts_nopass_tls|Use: smtp|Type: host list*|Default: unset| |
|
20117 ++----------------------------------------------------------+ |
|
20118 + |
|
20119 +For any host that matches this list, a connection on which a TLS session has |
|
20120 +been started will not be passed to a new delivery process for sending another |
|
20121 +message on the same connection. See section 39.10 for an explanation of when |
|
20122 +this might be needed. |
|
20123 + |
|
20124 ++-----------------------------------------------------+ |
|
20125 +|hosts_override|Use: smtp|Type: boolean|Default: false| |
|
20126 ++-----------------------------------------------------+ |
|
20127 + |
|
20128 +If this option is set and the hosts option is also set, any hosts that are |
|
20129 +attached to the address are ignored, and instead the hosts specified by the |
|
20130 +hosts option are always used. This option does not apply to fallback_hosts. |
|
20131 + |
|
20132 ++------------------------------------------------------+ |
|
20133 +|hosts_randomize|Use: smtp|Type: boolean|Default: false| |
|
20134 ++------------------------------------------------------+ |
|
20135 + |
|
20136 +If this option is set, and either the list of hosts is taken from the hosts or |
|
20137 +the fallback_hosts option, or the hosts supplied by the router were not |
|
20138 +obtained from MX records (this includes fallback hosts from the router), and |
|
20139 +were not randomized by the router, the order of trying the hosts is randomized |
|
20140 +each time the transport runs. Randomizing the order of a host list can be used |
|
20141 +to do crude load sharing. |
|
20142 + |
|
20143 +When hosts_randomize is true, a host list may be split into groups whose order |
|
20144 +is separately randomized. This makes it possible to set up MX-like behaviour. |
|
20145 +The boundaries between groups are indicated by an item that is just "+" in the |
|
20146 +host list. For example: |
|
20147 + |
|
20148 +hosts = host1:host2:host3:+:host4:host5 |
|
20149 + |
|
20150 +The order of the first three hosts and the order of the last two hosts is |
|
20151 +randomized for each use, but the first three always end up before the last two. |
|
20152 +If hosts_randomize is not set, a "+" item in the list is ignored. |
|
20153 + |
|
20154 ++------------------------------------------------------------+ |
|
20155 +|hosts_require_auth|Use: smtp|Type: host list*|Default: unset| |
|
20156 ++------------------------------------------------------------+ |
|
20157 + |
|
20158 +This option provides a list of servers for which authentication must succeed |
|
20159 +before Exim will try to transfer a message. If authentication fails for servers |
|
20160 +which are not in this list, Exim tries to send unauthenticated. If |
|
20161 +authentication fails for one of these servers, delivery is deferred. This |
|
20162 +temporary error is detectable in the retry rules, so it can be turned into a |
|
20163 +hard failure if required. See also hosts_try_auth, and chapter 33 for details |
|
20164 +of authentication. |
|
20165 + |
|
20166 ++-----------------------------------------------------------+ |
|
20167 +|hosts_require_tls|Use: smtp|Type: host list*|Default: unset| |
|
20168 ++-----------------------------------------------------------+ |
|
20169 + |
|
20170 +Exim will insist on using a TLS session when delivering to any host that |
|
20171 +matches this list. See chapter 39 for details of TLS. Note: This option affects |
|
20172 +outgoing mail only. To insist on TLS for incoming messages, use an appropriate |
|
20173 +ACL. |
|
20174 + |
|
20175 ++--------------------------------------------------------+ |
|
20176 +|hosts_try_auth|Use: smtp|Type: host list*|Default: unset| |
|
20177 ++--------------------------------------------------------+ |
|
20178 + |
|
20179 +This option provides a list of servers to which, provided they announce |
|
20180 +authentication support, Exim will attempt to authenticate as a client when it |
|
20181 +connects. If authentication fails, Exim will try to transfer the message |
|
20182 +unauthenticated. See also hosts_require_auth, and chapter 33 for details of |
|
20183 +authentication. |
|
20184 + |
|
20185 ++-----------------------------------------------------+ |
|
20186 +|interface|Use: smtp|Type: string list*|Default: unset| |
|
20187 ++-----------------------------------------------------+ |
|
20188 + |
|
20189 +This option specifies which interface to bind to when making an outgoing SMTP |
|
20190 +call. The value is an IP address, not an interface name such as "eth0". Do not |
|
20191 +confuse this with the interface address that was used when a message was |
|
20192 +received, which is in $received_ip_address, formerly known as |
|
20193 +$interface_address. The name was changed to minimize confusion with the |
|
20194 +outgoing interface address. There is no variable that contains an outgoing |
|
20195 +interface address because, unless it is set by this option, its value is |
|
20196 +unknown. |
|
20197 + |
|
20198 +During the expansion of the interface option the variables $host and |
|
20199 +$host_address refer to the host to which a connection is about to be made |
|
20200 +during the expansion of the string. Forced expansion failure, or an empty |
|
20201 +string result causes the option to be ignored. Otherwise, after expansion, the |
|
20202 +string must be a list of IP addresses, colon-separated by default, but the |
|
20203 +separator can be changed in the usual way. For example: |
|
20204 + |
|
20205 +interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061 |
|
20206 + |
|
20207 +The first interface of the correct type (IPv4 or IPv6) is used for the outgoing |
|
20208 +connection. If none of them are the correct type, the option is ignored. If |
|
20209 +interface is not set, or is ignored, the system's IP functions choose which |
|
20210 +interface to use if the host has more than one. |
|
20211 + |
|
20212 ++-----------------------------------------------+ |
|
20213 +|keepalive|Use: smtp|Type: boolean|Default: true| |
|
20214 ++-----------------------------------------------+ |
|
20215 + |
|
20216 +This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket |
|
20217 +connections. When set, it causes the kernel to probe idle connections |
|
20218 +periodically, by sending packets with "old" sequence numbers. The other end of |
|
20219 +the connection should send a acknowledgment if the connection is still okay or |
|
20220 +a reset if the connection has been aborted. The reason for doing this is that |
|
20221 +it has the beneficial effect of freeing up certain types of connection that can |
|
20222 +get stuck when the remote host is disconnected without tidying up the TCP/IP |
|
20223 +call properly. The keepalive mechanism takes several hours to detect |
|
20224 +unreachable hosts. |
|
20225 + |
|
20226 ++--------------------------------------------------------+ |
|
20227 +|lmtp_ignore_quota|Use: smtp|Type: boolean|Default: false| |
|
20228 ++--------------------------------------------------------+ |
|
20229 + |
|
20230 +If this option is set true when the protocol option is set to "lmtp", the |
|
20231 +string "IGNOREQUOTA" is added to RCPT commands, provided that the LMTP server |
|
20232 +has advertised support for IGNOREQUOTA in its response to the LHLO command. |
|
20233 + |
|
20234 ++---------------------------------------------+ |
|
20235 +|max_rcpt|Use: smtp|Type: integer|Default: 100| |
|
20236 ++---------------------------------------------+ |
|
20237 + |
|
20238 +This option limits the number of RCPT commands that are sent in a single SMTP |
|
20239 +message transaction. Each set of addresses is treated independently, and so can |
|
20240 +cause parallel connections to the same host if remote_max_parallel permits |
|
20241 +this. |
|
20242 + |
|
20243 ++--------------------------------------------------+ |
|
20244 +|multi_domain|Use: smtp|Type: boolean|Default: true| |
|
20245 ++--------------------------------------------------+ |
|
20246 + |
|
20247 +When this option is set, the smtp transport can handle a number of addresses |
|
20248 +containing a mixture of different domains provided they all resolve to the same |
|
20249 +list of hosts. Turning the option off restricts the transport to handling only |
|
20250 +one domain at a time. This is useful if you want to use $domain in an expansion |
|
20251 +for the transport, because it is set only when there is a single domain |
|
20252 +involved in a remote delivery. |
|
20253 + |
|
20254 ++-----------------------------------------------+ |
|
20255 +|port|Use: smtp|Type: string*|Default: see below| |
|
20256 ++-----------------------------------------------+ |
|
20257 + |
|
20258 +This option specifies the TCP/IP port on the server to which Exim connects. |
|
20259 +Note: Do not confuse this with the port that was used when a message was |
|
20260 +received, which is in $received_port, formerly known as $interface_port. The |
|
20261 +name was changed to minimize confusion with the outgoing port. There is no |
|
20262 +variable that contains an outgoing port. |
|
20263 + |
|
20264 +If the value of this option begins with a digit it is taken as a port number; |
|
20265 +otherwise it is looked up using getservbyname(). The default value is normally |
|
20266 +"smtp", but if protocol is set to "lmtp", the default is "lmtp". If the |
|
20267 +expansion fails, or if a port number cannot be found, delivery is deferred. |
|
20268 + |
|
20269 ++---------------------------------------------+ |
|
20270 +|protocol|Use: smtp|Type: string|Default: smtp| |
|
20271 ++---------------------------------------------+ |
|
20272 + |
|
20273 +If this option is set to "lmtp" instead of "smtp", the default value for the |
|
20274 +port option changes to "lmtp", and the transport operates the LMTP protocol |
|
20275 +(RFC 2033) instead of SMTP. This protocol is sometimes used for local |
|
20276 +deliveries into closed message stores. Exim also has support for running LMTP |
|
20277 +over a pipe to a local process - see chapter 28. |
|
20278 + |
|
20279 ++--------------------------------------------------------------+ |
|
20280 +|retry_include_ip_address|Use: smtp|Type: boolean|Default: true| |
|
20281 ++--------------------------------------------------------------+ |
|
20282 + |
|
20283 +Exim normally includes both the host name and the IP address in the key it |
|
20284 +constructs for indexing retry data after a temporary delivery failure. This |
|
20285 +means that when one of several IP addresses for a host is failing, it gets |
|
20286 +tried periodically (controlled by the retry rules), but use of the other IP |
|
20287 +addresses is not affected. |
|
20288 + |
|
20289 +However, in some dialup environments hosts are assigned a different IP address |
|
20290 +each time they connect. In this situation the use of the IP address as part of |
|
20291 +the retry key leads to undesirable behaviour. Setting this option false causes |
|
20292 +Exim to use only the host name. This should normally be done on a separate |
|
20293 +instance of the smtp transport, set up specially to handle the dialup hosts. |
|
20294 + |
|
20295 ++---------------------------------------------------------+ |
|
20296 +|serialize_hosts|Use: smtp|Type: host list*|Default: unset| |
|
20297 ++---------------------------------------------------------+ |
|
20298 + |
|
20299 +Because Exim operates in a distributed manner, if several messages for the same |
|
20300 +host arrive at around the same time, more than one simultaneous connection to |
|
20301 +the remote host can occur. This is not usually a problem except when there is a |
|
20302 +slow link between the hosts. In that situation it may be helpful to restrict |
|
20303 +Exim to one connection at a time. This can be done by setting serialize_hosts |
|
20304 +to match the relevant hosts. |
|
20305 + |
|
20306 +Exim implements serialization by means of a hints database in which a record is |
|
20307 +written whenever a process connects to one of the restricted hosts. The record |
|
20308 +is deleted when the connection is completed. Obviously there is scope for |
|
20309 +records to get left lying around if there is a system or program crash. To |
|
20310 +guard against this, Exim ignores any records that are more than six hours old. |
|
20311 + |
|
20312 +If you set up this kind of serialization, you should also arrange to delete the |
|
20313 +relevant hints database whenever your system reboots. The names of the files |
|
20314 +start with misc and they are kept in the spool/db directory. There may be one |
|
20315 +or two files, depending on the type of DBM in use. The same files are used for |
|
20316 +ETRN serialization. |
|
20317 + |
|
20318 ++---------------------------------------------------+ |
|
20319 +|size_addition|Use: smtp|Type: integer|Default: 1024| |
|
20320 ++---------------------------------------------------+ |
|
20321 + |
|
20322 +If a remote SMTP server indicates that it supports the SIZE option of the MAIL |
|
20323 +command, Exim uses this to pass over the message size at the start of an SMTP |
|
20324 +transaction. It adds the value of size_addition to the value it sends, to allow |
|
20325 +for headers and other text that may be added during delivery by configuration |
|
20326 +options or in a transport filter. It may be necessary to increase this if a lot |
|
20327 +of text is added to messages. |
|
20328 + |
|
20329 +Alternatively, if the value of size_addition is set negative, it disables the |
|
20330 +use of the SIZE option altogether. |
|
20331 + |
|
20332 ++------------------------------------------------------+ |
|
20333 +|tls_certificate|Use: smtp|Type: string*|Default: unset| |
|
20334 ++------------------------------------------------------+ |
|
20335 + |
|
20336 +The value of this option must be the absolute path to a file which contains the |
|
20337 +client's certificate, for possible use when sending a message over an encrypted |
|
20338 +connection. The values of $host and $host_address are set to the name and |
|
20339 +address of the server during the expansion. See chapter 39 for details of TLS. |
|
20340 + |
|
20341 +Note: This option must be set if you want Exim to be able to use a TLS |
|
20342 +certificate when sending messages as a client. The global option of the same |
|
20343 +name specifies the certificate for Exim as a server; it is not automatically |
|
20344 +assumed that the same certificate should be used when Exim is operating as a |
|
20345 +client. |
|
20346 + |
|
20347 ++----------------------------------------------+ |
|
20348 +|tls_crl|Use: smtp|Type: string*|Default: unset| |
|
20349 ++----------------------------------------------+ |
|
20350 + |
|
20351 +This option specifies a certificate revocation list. The expanded value must be |
|
20352 +the name of a file that contains a CRL in PEM format. |
|
20353 + |
|
20354 ++-----------------------------------------------------+ |
|
20355 +|tls_privatekey|Use: smtp|Type: string*|Default: unset| |
|
20356 ++-----------------------------------------------------+ |
|
20357 + |
|
20358 +The value of this option must be the absolute path to a file which contains the |
|
20359 +client's private key. This is used when sending a message over an encrypted |
|
20360 +connection using a client certificate. The values of $host and $host_address |
|
20361 +are set to the name and address of the server during the expansion. If this |
|
20362 +option is unset, or the expansion is forced to fail, or the result is an empty |
|
20363 +string, the private key is assumed to be in the same file as the certificate. |
|
20364 +See chapter 39 for details of TLS. |
|
20365 + |
|
20366 ++----------------------------------------------------------+ |
|
20367 +|tls_require_ciphers|Use: smtp|Type: string*|Default: unset| |
|
20368 ++----------------------------------------------------------+ |
|
20369 + |
|
20370 +The value of this option must be a list of permitted cipher suites, for use |
|
20371 +when setting up an outgoing encrypted connection. (There is a global option of |
|
20372 +the same name for controlling incoming connections.) The values of $host and |
|
20373 +$host_address are set to the name and address of the server during the |
|
20374 +expansion. See chapter 39 for details of TLS; note that this option is used in |
|
20375 +different ways by OpenSSL and GnuTLS (see sections 39.4 and 39.5). For GnuTLS, |
|
20376 +the order of the ciphers is a preference order. |
|
20377 + |
|
20378 ++-----------------------------------------------------------+ |
|
20379 +|tls_tempfail_tryclear|Use: smtp|Type: boolean|Default: true| |
|
20380 ++-----------------------------------------------------------+ |
|
20381 + |
|
20382 +When the server host is not in hosts_require_tls, and there is a problem in |
|
20383 +setting up a TLS session, this option determines whether or not Exim should try |
|
20384 +to deliver the message unencrypted. If it is set false, delivery to the current |
|
20385 +host is deferred; if there are other hosts, they are tried. If this option is |
|
20386 +set true, Exim attempts to deliver unencrypted after a 4xx response to |
|
20387 +STARTTLS. Also, if STARTTLS is accepted, but the subsequent TLS negotiation |
|
20388 +fails, Exim closes the current connection (because it is in an unknown state), |
|
20389 +opens a new one to the same host, and then tries the delivery in clear. |
|
20390 + |
|
20391 ++--------------------------------------------------------------+ |
|
20392 +|tls_verify_certificates|Use: smtp|Type: string*|Default: unset| |
|
20393 ++--------------------------------------------------------------+ |
|
20394 + |
|
20395 +The value of this option must be the absolute path to a file containing |
|
20396 +permitted server certificates, for use when setting up an encrypted connection. |
|
20397 +Alternatively, if you are using OpenSSL, you can set tls_verify_certificates to |
|
20398 +the name of a directory containing certificate files. This does not work with |
|
20399 +GnuTLS; the option must be set to the name of a single file if you are using |
|
20400 +GnuTLS. The values of $host and $host_address are set to the name and address |
|
20401 +of the server during the expansion of this option. See chapter 39 for details |
|
20402 +of TLS. |
|
20403 + |
|
20404 +30.5Â How the limits for the number of hosts to try are used |
|
20405 + |
|
20406 +There are two options that are concerned with the number of hosts that are |
|
20407 +tried when an SMTP delivery takes place. They are hosts_max_try and |
|
20408 +hosts_max_try_hardlimit. |
|
20409 + |
|
20410 +The hosts_max_try option limits the number of hosts that are tried for a single |
|
20411 +delivery. However, despite the term "host" in its name, the option actually |
|
20412 +applies to each IP address independently. In other words, a multihomed host is |
|
20413 +treated as several independent hosts, just as it is for retrying. |
|
20414 + |
|
20415 +Many of the larger ISPs have multiple MX records which often point to |
|
20416 +multihomed hosts. As a result, a list of a dozen or more IP addresses may be |
|
20417 +created as a result of routing one of these domains. |
|
20418 + |
|
20419 +Trying every single IP address on such a long list does not seem sensible; if |
|
20420 +several at the top of the list fail, it is reasonable to assume there is some |
|
20421 +problem that is likely to affect all of them. Roughly speaking, the value of |
|
20422 +hosts_max_try is the maximum number that are tried before deferring the |
|
20423 +delivery. However, the logic cannot be quite that simple. |
|
20424 + |
|
20425 +Firstly, IP addresses that are skipped because their retry times have not |
|
20426 +arrived do not count, and in addition, addresses that are past their retry |
|
20427 +limits are also not counted, even when they are tried. This means that when |
|
20428 +some IP addresses are past their retry limits, more than the value of |
|
20429 +hosts_max_retry may be tried. The reason for this behaviour is to ensure that |
|
20430 +all IP addresses are considered before timing out an email address (but see |
|
20431 +below for an exception). |
|
20432 + |
|
20433 +Secondly, when the hosts_max_try limit is reached, Exim looks down the host |
|
20434 +list to see if there is a subsequent host with a different (higher valued) MX. |
|
20435 +If there is, that host is considered next, and the current IP address is used |
|
20436 +but not counted. This behaviour helps in the case of a domain with a retry rule |
|
20437 +that hardly ever delays any hosts, as is now explained: |
|
20438 + |
|
20439 +Consider the case of a long list of hosts with one MX value, and a few with a |
|
20440 +higher MX value. If hosts_max_try is small (the default is 5) only a few hosts |
|
20441 +at the top of the list are tried at first. With the default retry rule, which |
|
20442 +specifies increasing retry times, the higher MX hosts are eventually tried when |
|
20443 +those at the top of the list are skipped because they have not reached their |
|
20444 +retry times. |
|
20445 + |
|
20446 +However, it is common practice to put a fixed short retry time on domains for |
|
20447 +large ISPs, on the grounds that their servers are rarely down for very long. |
|
20448 +Unfortunately, these are exactly the domains that tend to resolve to long lists |
|
20449 +of hosts. The short retry time means that the lowest MX hosts are tried every |
|
20450 +time. The attempts may be in a different order because of random sorting, but |
|
20451 +without the special MX check, the higher MX hosts would never be tried until |
|
20452 +all the lower MX hosts had timed out (which might be several days), because |
|
20453 +there are always some lower MX hosts that have reached their retry times. With |
|
20454 +the special check, Exim considers at least one IP address from each MX value at |
|
20455 +every delivery attempt, even if the hosts_max_try limit has already been |
|
20456 +reached. |
|
20457 + |
|
20458 +The above logic means that hosts_max_try is not a hard limit, and in |
|
20459 +particular, Exim normally eventually tries all the IP addresses before timing |
|
20460 +out an email address. When hosts_max_try was implemented, this seemed a |
|
20461 +reasonable thing to do. Recently, however, some lunatic DNS configurations have |
|
20462 +been set up with hundreds of IP addresses for some domains. It can take a very |
|
20463 +long time indeed for an address to time out in these cases. |
|
20464 + |
|
20465 +The hosts_max_try_hardlimit option was added to help with this problem. Exim |
|
20466 +never tries more than this number of IP addresses; if it hits this limit and |
|
20467 +they are all timed out, the email address is bounced, even though not all |
|
20468 +possible IP addresses have been tried. |
|
20469 + |
|
20470 +31. Address rewriting |
|
20471 + |
|
20472 +There are some circumstances in which Exim automatically rewrites domains in |
|
20473 +addresses. The two most common are when an address is given without a domain |
|
20474 +(referred to as an "unqualified address") or when an address contains an |
|
20475 +abbreviated domain that is expanded by DNS lookup. |
|
20476 + |
|
20477 +Unqualified envelope addresses are accepted only for locally submitted |
|
20478 +messages, or for messages that are received from hosts matching |
|
20479 +sender_unqualified_hosts or recipient_unqualified_hosts, as appropriate. |
|
20480 +Unqualified addresses in header lines are qualified if they are in locally |
|
20481 +submitted messages, or messages from hosts that are permitted to send |
|
20482 +unqualified envelope addresses. Otherwise, unqualified addresses in header |
|
20483 +lines are neither qualified nor rewritten. |
|
20484 + |
|
20485 +One situation in which Exim does not automatically rewrite a domain is when it |
|
20486 +is the name of a CNAME record in the DNS. The older RFCs suggest that such a |
|
20487 +domain should be rewritten using the "canonical" name, and some MTAs do this. |
|
20488 +The new RFCs do not contain this suggestion. |
|
20489 + |
|
20490 +31.1Â Explicitly configured address rewriting |
|
20491 + |
|
20492 +This chapter describes the rewriting rules that can be used in the main rewrite |
|
20493 +section of the configuration file, and also in the generic headers_rewrite |
|
20494 +option that can be set on any transport. |
|
20495 + |
|
20496 +Some people believe that configured address rewriting is a Mortal Sin. Others |
|
20497 +believe that life is not possible without it. Exim provides the facility; you |
|
20498 +do not have to use it. |
|
20499 + |
|
20500 +The main rewriting rules that appear in the "rewrite" section of the |
|
20501 +configuration file are applied to addresses in incoming messages, both envelope |
|
20502 +addresses and addresses in header lines. Each rule specifies the types of |
|
20503 +address to which it applies. |
|
20504 + |
|
20505 +Whether or not addresses in header lines are rewritten depends on the origin of |
|
20506 +the headers and the type of rewriting. Global rewriting, that is, rewriting |
|
20507 +rules from the rewrite section of the configuration file, is applied only to |
|
20508 +those headers that were received with the message. Header lines that are added |
|
20509 +by ACLs or by a system filter or by individual routers or transports (which are |
|
20510 +specific to individual recipient addresses) are not rewritten by the global |
|
20511 +rules. |
|
20512 + |
|
20513 +Rewriting at transport time, by means of the headers_rewrite option, applies |
|
20514 +all headers except those added by routers and transports. That is, as well as |
|
20515 +the headers that were received with the message, it also applies to headers |
|
20516 +that were added by an ACL or a system filter. |
|
20517 + |
|
20518 +In general, rewriting addresses from your own system or domain has some |
|
20519 +legitimacy. Rewriting other addresses should be done only with great care and |
|
20520 +in special circumstances. The author of Exim believes that rewriting should be |
|
20521 +used sparingly, and mainly for "regularizing" addresses in your own domains. |
|
20522 +Although it can sometimes be used as a routing tool, this is very strongly |
|
20523 +discouraged. |
|
20524 + |
|
20525 +There are two commonly encountered circumstances where rewriting is used, as |
|
20526 +illustrated by these examples: |
|
20527 + |
|
20528 + * The company whose domain is hitch.fict.example has a number of hosts that |
|
20529 + exchange mail with each other behind a firewall, but there is only a single |
|
20530 + gateway to the outer world. The gateway rewrites *.hitch.fict.example as |
|
20531 + hitch.fict.example when sending mail off-site. |
|
20532 + |
|
20533 + * A host rewrites the local parts of its own users so that, for example, |
|
20534 + fp42@hitch.fict.example becomes Ford.Prefect@hitch.fict.example. |
|
20535 + |
|
20536 +31.2Â When does rewriting happen? |
|
20537 + |
|
20538 +Configured address rewriting can take place at several different stages of a |
|
20539 +message's processing. |
|
20540 + |
|
20541 +At the start of an ACL for MAIL, the sender address may have been rewritten by |
|
20542 +a special SMTP-time rewrite rule (see section 31.9), but no ordinary rewrite |
|
20543 +rules have yet been applied. If, however, the sender address is verified in the |
|
20544 +ACL, it is rewritten before verification, and remains rewritten thereafter. The |
|
20545 +subsequent value of $sender_address is the rewritten address. This also applies |
|
20546 +if sender verification happens in a RCPT ACL. Otherwise, when the sender |
|
20547 +address is not verified, it is rewritten as soon as a message's header lines |
|
20548 +have been received. |
|
20549 + |
|
20550 +Similarly, at the start of an ACL for RCPT, the current recipient's address may |
|
20551 +have been rewritten by a special SMTP-time rewrite rule, but no ordinary |
|
20552 +rewrite rules have yet been applied to it. However, the behaviour is different |
|
20553 +from the sender address when a recipient is verified. The address is rewritten |
|
20554 +for the verification, but the rewriting is not remembered at this stage. The |
|
20555 +value of $local_part and $domain after verification are always the same as they |
|
20556 +were before (that is, they contain the unrewritten - except for SMTP-time |
|
20557 +rewriting - address). |
|
20558 + |
|
20559 +As soon as a message's header lines have been received, all the envelope |
|
20560 +recipient addresses are permanently rewritten, and rewriting is also applied to |
|
20561 +the addresses in the header lines (if configured). This happens before adding |
|
20562 +any header lines that were specified in MAIL or RCPT ACLs, and before the DATA |
|
20563 +ACL and local_scan() functions are run. |
|
20564 + |
|
20565 +When an address is being routed, either for delivery or for verification, |
|
20566 +rewriting is applied immediately to child addresses that are generated by |
|
20567 +redirection, unless no_rewrite is set on the router. |
|
20568 + |
|
20569 +At transport time, additional rewriting of addresses in header lines can be |
|
20570 +specified by setting the generic headers_rewrite option on a transport. This |
|
20571 +option contains rules that are identical in form to those in the rewrite |
|
20572 +section of the configuration file. They are applied to the original message |
|
20573 +header lines and any that were added by ACLs or a system filter. They are not |
|
20574 +applied to header lines that are added by routers or the transport. |
|
20575 + |
|
20576 +The outgoing envelope sender can be rewritten by means of the return_path |
|
20577 +transport option. However, it is not possible to rewrite envelope recipients at |
|
20578 +transport time. |
|
20579 + |
|
20580 +31.3Â Testing the rewriting rules that apply on input |
|
20581 + |
|
20582 +Exim's input rewriting configuration appears in a part of the run time |
|
20583 +configuration file headed by "begin rewrite". It can be tested by the -brw |
|
20584 +command line option. This takes an address (which can be a full RFC 2822 |
|
20585 +address) as its argument. The output is a list of how the address would be |
|
20586 +transformed by the rewriting rules for each of the different places it might |
|
20587 +appear in an incoming message, that is, for each different header and for the |
|
20588 +envelope sender and recipient fields. For example, |
|
20589 + |
|
20590 +exim -brw ph10@exim.workshop.example |
|
20591 + |
|
20592 +might produce the output |
|
20593 + |
|
20594 +sender: Philip.Hazel@exim.workshop.example |
|
20595 +from: Philip.Hazel@exim.workshop.example |
|
20596 +to: ph10@exim.workshop.example |
|
20597 +cc: ph10@exim.workshop.example |
|
20598 +bcc: ph10@exim.workshop.example |
|
20599 +reply-to: Philip.Hazel@exim.workshop.example |
|
20600 +env-from: Philip.Hazel@exim.workshop.example |
|
20601 +env-to: ph10@exim.workshop.example |
|
20602 + |
|
20603 +which shows that rewriting has been set up for that address when used in any of |
|
20604 +the source fields, but not when it appears as a recipient address. At the |
|
20605 +present time, there is no equivalent way of testing rewriting rules that are |
|
20606 +set for a particular transport. |
|
20607 + |
|
20608 +31.4Â Rewriting rules |
|
20609 + |
|
20610 +The rewrite section of the configuration file consists of lines of rewriting |
|
20611 +rules in the form |
|
20612 + |
|
20613 +<source pattern>  <replacement>  <flags> |
|
20614 + |
|
20615 +Rewriting rules that are specified for the headers_rewrite generic transport |
|
20616 +option are given as a colon-separated list. Each item in the list takes the |
|
20617 +same form as a line in the main rewriting configuration (except that any colons |
|
20618 +must be doubled, of course). |
|
20619 + |
|
20620 +The formats of source patterns and replacement strings are described below. |
|
20621 +Each is terminated by white space, unless enclosed in double quotes, in which |
|
20622 +case normal quoting conventions apply inside the quotes. The flags are single |
|
20623 +characters which may appear in any order. Spaces and tabs between them are |
|
20624 +ignored. |
|
20625 + |
|
20626 +For each address that could potentially be rewritten, the rules are scanned in |
|
20627 +order, and replacements for the address from earlier rules can themselves be |
|
20628 +replaced by later rules (but see the "q" and "R" flags). |
|
20629 + |
|
20630 +The order in which addresses are rewritten is undefined, may change between |
|
20631 +releases, and must not be relied on, with one exception: when a message is |
|
20632 +received, the envelope sender is always rewritten first, before any header |
|
20633 +lines are rewritten. For example, the replacement string for a rewrite of an |
|
20634 +address in To: must not assume that the message's address in From: has (or has |
|
20635 +not) already been rewritten. However, a rewrite of From: may assume that the |
|
20636 +envelope sender has already been rewritten. |
|
20637 + |
|
20638 +The variables $local_part and $domain can be used in the replacement string to |
|
20639 +refer to the address that is being rewritten. Note that lookup-driven rewriting |
|
20640 +can be done by a rule of the form |
|
20641 + |
|
20642 +*@* ${lookup ... |
|
20643 + |
|
20644 +where the lookup key uses $1 and $2 or $local_part and $domain to refer to the |
|
20645 +address that is being rewritten. |
|
20646 + |
|
20647 +31.5Â Rewriting patterns |
|
20648 + |
|
20649 +The source pattern in a rewriting rule is any item which may appear in an |
|
20650 +address list (see section 10.19). It is in fact processed as a single-item |
|
20651 +address list, which means that it is expanded before being tested against the |
|
20652 +address. As always, if you use a regular expression as a pattern, you must take |
|
20653 +care to escape dollar and backslash characters, or use the "\N" facility to |
|
20654 +suppress string expansion within the regular expression. |
|
20655 + |
|
20656 +Domains in patterns should be given in lower case. Local parts in patterns are |
|
20657 +case-sensitive. If you want to do case-insensitive matching of local parts, you |
|
20658 +can use a regular expression that starts with "^(?i)". |
|
20659 + |
|
20660 +After matching, the numerical variables $1, $2, etc. may be set, depending on |
|
20661 +the type of match which occurred. These can be used in the replacement string |
|
20662 +to insert portions of the incoming address. $0 always refers to the complete |
|
20663 +incoming address. When a regular expression is used, the numerical variables |
|
20664 +are set from its capturing subexpressions. For other types of pattern they are |
|
20665 +set as follows: |
|
20666 + |
|
20667 + * If a local part or domain starts with an asterisk, the numerical variables |
|
20668 + refer to the character strings matched by asterisks, with $1 associated |
|
20669 + with the first asterisk, and $2 with the second, if present. For example, |
|
20670 + if the pattern |
|
20671 + |
|
20672 + *queen@*.fict.example |
|
20673 + |
|
20674 + is matched against the address hearts-queen@wonderland.fict.example then |
|
20675 + |
|
20676 + $0 = hearts-queen@wonderland.fict.example |
|
20677 + $1 = hearts- |
|
20678 + $2 = wonderland |
|
20679 + |
|
20680 + Note that if the local part does not start with an asterisk, but the domain |
|
20681 + does, it is $1 that contains the wild part of the domain. |
|
20682 + |
|
20683 + * If the domain part of the pattern is a partial lookup, the wild and fixed |
|
20684 + parts of the domain are placed in the next available numerical variables. |
|
20685 + Suppose, for example, that the address foo@bar.baz.example is processed by |
|
20686 + a rewriting rule of the form |
|
20687 + |
|
20688 + *@partial-dbm;/some/dbm/file    <replacement string> |
|
20689 + |
|
20690 + and the key in the file that matches the domain is "*.baz.example". Then |
|
20691 + |
|
20692 + $1 = foo |
|
20693 + $2 = bar |
|
20694 + $3 = baz.example |
|
20695 + |
|
20696 + If the address foo@baz.example is looked up, this matches the same wildcard |
|
20697 + file entry, and in this case $2 is set to the empty string, but $3 is still |
|
20698 + set to baz.example. If a non-wild key is matched in a partial lookup, $2 is |
|
20699 + again set to the empty string and $3 is set to the whole domain. For |
|
20700 + non-partial domain lookups, no numerical variables are set. |
|
20701 + |
|
20702 +31.6Â Rewriting replacements |
|
20703 + |
|
20704 +If the replacement string for a rule is a single asterisk, addresses that match |
|
20705 +the pattern and the flags are not rewritten, and no subsequent rewriting rules |
|
20706 +are scanned. For example, |
|
20707 + |
|
20708 +hatta@lookingglass.fict.example * f |
|
20709 + |
|
20710 +specifies that hatta@lookingglass.fict.example is never to be rewritten in |
|
20711 +From: headers. |
|
20712 + |
|
20713 +If the replacement string is not a single asterisk, it is expanded, and must |
|
20714 +yield a fully qualified address. Within the expansion, the variables |
|
20715 +$local_part and $domain refer to the address that is being rewritten. Any |
|
20716 +letters they contain retain their original case - they are not lower cased. The |
|
20717 +numerical variables are set up according to the type of pattern that matched |
|
20718 +the address, as described above. If the expansion is forced to fail by the |
|
20719 +presence of "fail" in a conditional or lookup item, rewriting by the current |
|
20720 +rule is abandoned, but subsequent rules may take effect. Any other expansion |
|
20721 +failure causes the entire rewriting operation to be abandoned, and an entry |
|
20722 +written to the panic log. |
|
20723 + |
|
20724 +31.7Â Rewriting flags |
|
20725 + |
|
20726 +There are three different kinds of flag that may appear on rewriting rules: |
|
20727 + |
|
20728 + * Flags that specify which headers and envelope addresses to rewrite: E, F, |
|
20729 + T, b, c, f, h, r, s, t. |
|
20730 + |
|
20731 + * A flag that specifies rewriting at SMTP time: S. |
|
20732 + |
|
20733 + * Flags that control the rewriting process: Q, q, R, w. |
|
20734 + |
|
20735 +For rules that are part of the headers_rewrite generic transport option, E, F, |
|
20736 +T, and S are not permitted. |
|
20737 + |
|
20738 +31.8Â Flags specifying which headers and envelope addresses to rewrite |
|
20739 + |
|
20740 +If none of the following flag letters, nor the "S" flag (see section 31.9) are |
|
20741 +present, a main rewriting rule applies to all headers and to both the sender |
|
20742 +and recipient fields of the envelope, whereas a transport-time rewriting rule |
|
20743 +just applies to all headers. Otherwise, the rewriting rule is skipped unless |
|
20744 +the relevant addresses are being processed. |
|
20745 + |
|
20746 +E       rewrite all envelope fields |
|
20747 +F       rewrite the envelope From field |
|
20748 +T       rewrite the envelope To field |
|
20749 +b       rewrite the Bcc: header |
|
20750 +c       rewrite the Cc: header |
|
20751 +f       rewrite the From: header |
|
20752 +h       rewrite all headers |
|
20753 +r       rewrite the Reply-To: header |
|
20754 +s       rewrite the Sender: header |
|
20755 +t       rewrite the To: header |
|
20756 + |
|
20757 +"All headers" means all of the headers listed above that can be selected |
|
20758 +individually, plus their Resent- versions. It does not include other headers |
|
20759 +such as Subject: etc. |
|
20760 + |
|
20761 +You should be particularly careful about rewriting Sender: headers, and |
|
20762 +restrict this to special known cases in your own domains. |
|
20763 + |
|
20764 +31.9Â The SMTP-time rewriting flag |
|
20765 + |
|
20766 +The rewrite flag "S" specifies a rewrite of incoming envelope addresses at SMTP |
|
20767 +time, as soon as an address is received in a MAIL or RCPT command, and before |
|
20768 +any other processing; even before syntax checking. The pattern is required to |
|
20769 +be a regular expression, and it is matched against the whole of the data for |
|
20770 +the command, including any surrounding angle brackets. |
|
20771 + |
|
20772 +This form of rewrite rule allows for the handling of addresses that are not |
|
20773 +compliant with RFCs 2821 and 2822 (for example, "bang paths" in batched SMTP |
|
20774 +input). Because the input is not required to be a syntactically valid address, |
|
20775 +the variables $local_part and $domain are not available during the expansion of |
|
20776 +the replacement string. The result of rewriting replaces the original address |
|
20777 +in the MAIL or RCPT command. |
|
20778 + |
|
20779 +31.10Â Flags controlling the rewriting process |
|
20780 + |
|
20781 +There are four flags which control the way the rewriting process works. These |
|
20782 +take effect only when a rule is invoked, that is, when the address is of the |
|
20783 +correct type (matches the flags) and matches the pattern: |
|
20784 + |
|
20785 + * If the "Q" flag is set on a rule, the rewritten address is permitted to be |
|
20786 + an unqualified local part. It is qualified with qualify_recipient. In the |
|
20787 + absence of "Q" the rewritten address must always include a domain. |
|
20788 + |
|
20789 + * If the "q" flag is set on a rule, no further rewriting rules are |
|
20790 + considered, even if no rewriting actually takes place because of a "fail" |
|
20791 + in the expansion. The "q" flag is not effective if the address is of the |
|
20792 + wrong type (does not match the flags) or does not match the pattern. |
|
20793 + |
|
20794 + * The "R" flag causes a successful rewriting rule to be re-applied to the new |
|
20795 + address, up to ten times. It can be combined with the "q" flag, to stop |
|
20796 + rewriting once it fails to match (after at least one successful rewrite). |
|
20797 + |
|
20798 + * When an address in a header is rewritten, the rewriting normally applies |
|
20799 + only to the working part of the address, with any comments and RFC 2822 |
|
20800 + "phrase" left unchanged. For example, rewriting might change |
|
20801 + |
|
20802 + From: Ford Prefect <fp42@restaurant.hitch.fict.example> |
|
20803 + |
|
20804 + into |
|
20805 + |
|
20806 + From: Ford Prefect <prefectf@hitch.fict.example> |
|
20807 + |
|
20808 + Sometimes there is a need to replace the whole address item, and this can |
|
20809 + be done by adding the flag letter "w" to a rule. If this is set on a rule |
|
20810 + that causes an address in a header line to be rewritten, the entire address |
|
20811 + is replaced, not just the working part. The replacement must be a complete |
|
20812 + RFC 2822 address, including the angle brackets if necessary. If text |
|
20813 + outside angle brackets contains a character whose value is greater than 126 |
|
20814 + or less than 32 (except for tab), the text is encoded according to RFC |
|
20815 + 2047. The character set is taken from headers_charset, which defaults to |
|
20816 + ISO-8859-1. |
|
20817 + |
|
20818 + When the "w" flag is set on a rule that causes an envelope address to be |
|
20819 + rewritten, all but the working part of the replacement address is |
|
20820 + discarded. |
|
20821 + |
|
20822 +31.11Â Rewriting examples |
|
20823 + |
|
20824 +Here is an example of the two common rewriting paradigms: |
|
20825 + |
|
20826 +*@*.hitch.fict.example $1@hitch.fict.example |
|
20827 +*@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\ |
|
20828 + {$value}fail}@hitch.fict.example bctfrF |
|
20829 + |
|
20830 +Note the use of "fail" in the lookup expansion in the second rule, forcing the |
|
20831 +string expansion to fail if the lookup does not succeed. In this context it has |
|
20832 +the effect of leaving the original address unchanged, but Exim goes on to |
|
20833 +consider subsequent rewriting rules, if any, because the "q" flag is not |
|
20834 +present in that rule. An alternative to "fail" would be to supply $1 |
|
20835 +explicitly, which would cause the rewritten address to be the same as before, |
|
20836 +at the cost of a small bit of processing. Not supplying either of these is an |
|
20837 +error, since the rewritten address would then contain no local part. |
|
20838 + |
|
20839 +The first example above replaces the domain with a superior, more general |
|
20840 +domain. This may not be desirable for certain local parts. If the rule |
|
20841 + |
|
20842 +root@*.hitch.fict.example * |
|
20843 + |
|
20844 +were inserted before the first rule, rewriting would be suppressed for the |
|
20845 +local part root at any domain ending in hitch.fict.example. |
|
20846 + |
|
20847 +Rewriting can be made conditional on a number of tests, by making use of ${if |
|
20848 +in the expansion item. For example, to apply a rewriting rule only to messages |
|
20849 +that originate outside the local host: |
|
20850 + |
|
20851 +*@*.hitch.fict.example "${if !eq {$sender_host_address}{}\ |
|
20852 + {$1@hitch.fict.example}fail}" |
|
20853 + |
|
20854 +The replacement string is quoted in this example because it contains white |
|
20855 +space. |
|
20856 + |
|
20857 +Exim does not handle addresses in the form of "bang paths". If it sees such an |
|
20858 +address it treats it as an unqualified local part which it qualifies with the |
|
20859 +local qualification domain (if the source of the message is local or if the |
|
20860 +remote host is permitted to send unqualified addresses). Rewriting can |
|
20861 +sometimes be used to handle simple bang paths with a fixed number of |
|
20862 +components. For example, the rule |
|
20863 + |
|
20864 +\N^([^!]+)!(.*)@your.domain.example$\N $2@$1 |
|
20865 + |
|
20866 +rewrites a two-component bang path host.name!user as the domain address |
|
20867 +user@host.name. However, there is a security implication in using this as a |
|
20868 +global rewriting rule for envelope addresses. It can provide a backdoor method |
|
20869 +for using your system as a relay, because the incoming addresses appear to be |
|
20870 +local. If the bang path addresses are received via SMTP, it is safer to use the |
|
20871 +"S" flag to rewrite them as they are received, so that relay checking can be |
|
20872 +done on the rewritten addresses. |
|
20873 + |
|
20874 +32. Retry configuration |
|
20875 + |
|
20876 +The "retry" section of the runtime configuration file contains a list of retry |
|
20877 +rules that control how often Exim tries to deliver messages that cannot be |
|
20878 +delivered at the first attempt. If there are no retry rules (the section is |
|
20879 +empty or not present), there are no retries. In this situation, temporary |
|
20880 +errors are treated as permanent. The default configuration contains a single, |
|
20881 +general-purpose retry rule (see section 7.5). The -brt command line option can |
|
20882 +be used to test which retry rule will be used for a given address, domain and |
|
20883 +error. |
|
20884 + |
|
20885 +The most common cause of retries is temporary failure to deliver to a remote |
|
20886 +host because the host is down, or inaccessible because of a network problem. |
|
20887 +Exim's retry processing in this case is applied on a per-host (strictly, per IP |
|
20888 +address) basis, not on a per-message basis. Thus, if one message has recently |
|
20889 +been delayed, delivery of a new message to the same host is not immediately |
|
20890 +tried, but waits for the host's retry time to arrive. If the retry_defer log |
|
20891 +selector is set, the message "retry time not reached" is written to the main |
|
20892 +log whenever a delivery is skipped for this reason. Section 45.2 contains more |
|
20893 +details of the handling of errors during remote deliveries. |
|
20894 + |
|
20895 +Retry processing applies to routing as well as to delivering, except as covered |
|
20896 +in the next paragraph. The retry rules do not distinguish between these |
|
20897 +actions. It is not possible, for example, to specify different behaviour for |
|
20898 +failures to route the domain snark.fict.example and failures to deliver to the |
|
20899 +host snark.fict.example. I didn't think anyone would ever need this added |
|
20900 +complication, so did not implement it. However, although they share the same |
|
20901 +retry rule, the actual retry times for routing and transporting a given domain |
|
20902 +are maintained independently. |
|
20903 + |
|
20904 +When a delivery is not part of a queue run (typically an immediate delivery on |
|
20905 +receipt of a message), the routers are always run, and local deliveries are |
|
20906 +always attempted, even if retry times are set for them. This makes for better |
|
20907 +behaviour if one particular message is causing problems (for example, causing |
|
20908 +quota overflow, or provoking an error in a filter file). If such a delivery |
|
20909 +suffers a temporary failure, the retry data is updated as normal, and |
|
20910 +subsequent delivery attempts from queue runs occur only when the retry time for |
|
20911 +the local address is reached. |
|
20912 + |
|
20913 +32.1Â Changing retry rules |
|
20914 + |
|
20915 +If you change the retry rules in your configuration, you should consider |
|
20916 +whether or not to delete the retry data that is stored in Exim's spool area in |
|
20917 +files with names like db/retry. Deleting any of Exim's hints files is always |
|
20918 +safe; that is why they are called "hints". |
|
20919 + |
|
20920 +The hints retry data contains suggested retry times based on the previous |
|
20921 +rules. In the case of a long-running problem with a remote host, it might |
|
20922 +record the fact that the host has timed out. If your new rules increase the |
|
20923 +timeout time for such a host, you should definitely remove the old retry data |
|
20924 +and let Exim recreate it, based on the new rules. Otherwise Exim might bounce |
|
20925 +messages that it should now be retaining. |
|
20926 + |
|
20927 +32.2Â Format of retry rules |
|
20928 + |
|
20929 +Each retry rule occupies one line and consists of three or four parts, |
|
20930 +separated by white space: a pattern, an error name, an optional list of sender |
|
20931 +addresses, and a list of retry parameters. The pattern and sender lists must be |
|
20932 +enclosed in double quotes if they contain white space. The rules are searched |
|
20933 +in order until one is found where the pattern, error name, and sender list (if |
|
20934 +present) match the failing host or address, the error that occurred, and the |
|
20935 +message's sender, respectively. |
|
20936 + |
|
20937 +The pattern is any single item that may appear in an address list (see section |
|
20938 +10.19). It is in fact processed as a one-item address list, which means that it |
|
20939 +is expanded before being tested against the address that has been delayed. A |
|
20940 +negated address list item is permitted. Address list processing treats a plain |
|
20941 +domain name as if it were preceded by "*@", which makes it possible for many |
|
20942 +retry rules to start with just a domain. For example, |
|
20943 + |
|
20944 +lookingglass.fict.example * F,24h,30m; |
|
20945 + |
|
20946 +provides a rule for any address in the lookingglass.fict.example domain, |
|
20947 +whereas |
|
20948 + |
|
20949 +alice@lookingglass.fict.example * F,24h,30m; |
|
20950 + |
|
20951 +applies only to temporary failures involving the local part alice. In practice, |
|
20952 +almost all rules start with a domain name pattern without a local part. |
|
20953 + |
|
20954 +Warning: If you use a regular expression in a routing rule pattern, it must |
|
20955 +match a complete address, not just a domain, because that is how regular |
|
20956 +expressions work in address lists. |
|
20957 + |
|
20958 +^\Nxyz\d+\.abc\.example$\NÂ Â Â Â Â Â Â Â *Â Â G,1h,10m,2Â Â Â Â Â Wrong |
|
20959 +^\N[^@]+@xyz\d+\.abc\.example$\NÂ Â *Â Â G,1h,10m,2Â Â Â Â Â Right |
|
20960 + |
|
20961 +32.3Â Choosing which retry rule to use for address errors |
|
20962 + |
|
20963 +When Exim is looking for a retry rule after a routing attempt has failed (for |
|
20964 +example, after a DNS timeout), each line in the retry configuration is tested |
|
20965 +against the complete address only if retry_use_local_part is set for the |
|
20966 +router. Otherwise, only the domain is used, except when matching against a |
|
20967 +regular expression, when the local part of the address is replaced with "*". A |
|
20968 +domain on its own can match a domain pattern, or a pattern that starts with |
|
20969 +"*@". By default, retry_use_local_part is true for routers where |
|
20970 +check_local_user is true, and false for other routers. |
|
20971 + |
|
20972 +Similarly, when Exim is looking for a retry rule after a local delivery has |
|
20973 +failed (for example, after a mailbox full error), each line in the retry |
|
20974 +configuration is tested against the complete address only if |
|
20975 +retry_use_local_part is set for the transport (it defaults true for all local |
|
20976 +transports). |
|
20977 + |
|
20978 +However, when Exim is looking for a retry rule after a remote delivery attempt |
|
20979 +suffers an address error (a 4xx SMTP response for a recipient address), the |
|
20980 +whole address is always used as the key when searching the retry rules. The |
|
20981 +rule that is found is used to create a retry time for the combination of the |
|
20982 +failing address and the message's sender. It is the combination of sender and |
|
20983 +recipient that is delayed in subsequent queue runs until its retry time is |
|
20984 +reached. You can delay the recipient without regard to the sender by setting |
|
20985 +address_retry_include_sender false in the smtp transport but this can lead to |
|
20986 +problems with servers that regularly issue 4xx responses to RCPT commands. |
|
20987 + |
|
20988 +32.4Â Choosing which retry rule to use for host and message errors |
|
20989 + |
|
20990 +For a temporary error that is not related to an individual address (for |
|
20991 +example, a connection timeout), each line in the retry configuration is checked |
|
20992 +twice. First, the name of the remote host is used as a domain name (preceded by |
|
20993 +"*@" when matching a regular expression). If this does not match the line, the |
|
20994 +domain from the email address is tried in a similar fashion. For example, |
|
20995 +suppose the MX records for a.b.c.example are |
|
20996 + |
|
20997 +a.b.c.example MX 5 x.y.z.example |
|
20998 + MX 6 p.q.r.example |
|
20999 + MX 7 m.n.o.example |
|
21000 + |
|
21001 +and the retry rules are |
|
21002 + |
|
21003 +p.q.r.example * F,24h,30m; |
|
21004 +a.b.c.example * F,4d,45m; |
|
21005 + |
|
21006 +and a delivery to the host x.y.z.example suffers a connection failure. The |
|
21007 +first rule matches neither the host nor the domain, so Exim looks at the second |
|
21008 +rule. This does not match the host, but it does match the domain, so it is used |
|
21009 +to calculate the retry time for the host x.y.z.example. Meanwhile, Exim tries |
|
21010 +to deliver to p.q.r.example. If this also suffers a host error, the first retry |
|
21011 +rule is used, because it matches the host. |
|
21012 + |
|
21013 +In other words, temporary failures to deliver to host p.q.r.example use the |
|
21014 +first rule to determine retry times, but for all the other hosts for the domain |
|
21015 +a.b.c.example, the second rule is used. The second rule is also used if routing |
|
21016 +to a.b.c.example suffers a temporary failure. |
|
21017 + |
|
21018 +Note: The host name is used when matching the patterns, not its IP address. |
|
21019 +However, if a message is routed directly to an IP address without the use of a |
|
21020 +host name, for example, if a manualroute router contains a setting such as: |
|
21021 + |
|
21022 +route_list = *.a.example 192.168.34.23 |
|
21023 + |
|
21024 +then the "host name" that is used when searching for a retry rule is the |
|
21025 +textual form of the IP address. |
|
21026 + |
|
21027 +32.5Â Retry rules for specific errors |
|
21028 + |
|
21029 +The second field in a retry rule is the name of a particular error, or an |
|
21030 +asterisk, which matches any error. The errors that can be tested for are: |
|
21031 + |
|
21032 +auth_failed |
|
21033 + |
|
21034 + Authentication failed when trying to send to a host in the |
|
21035 + hosts_require_auth list in an smtp transport. |
|
21036 + |
|
21037 +data_4xx |
|
21038 + |
|
21039 + A 4xx error was received for an outgoing DATA command, either immediately |
|
21040 + after the command, or after sending the message's data. |
|
21041 + |
|
21042 +mail_4xx |
|
21043 + |
|
21044 + A 4xx error was received for an outgoing MAIL command. |
|
21045 + |
|
21046 +rcpt_4xx |
|
21047 + |
|
21048 + A 4xx error was received for an outgoing RCPT command. |
|
21049 + |
|
21050 +For the three 4xx errors, either the first or both of the x's can be given as |
|
21051 +specific digits, for example: "mail_45x" or "rcpt_436". For example, to |
|
21052 +recognize 452 errors given to RCPT commands for addresses in a certain domain, |
|
21053 +and have retries every ten minutes with a one-hour timeout, you could set up a |
|
21054 +retry rule of this form: |
|
21055 + |
|
21056 +the.domain.name rcpt_452 F,1h,10m |
|
21057 + |
|
21058 +These errors apply to both outgoing SMTP (the smtp transport) and outgoing LMTP |
|
21059 +(either the lmtp transport, or the smtp transport in LMTP mode). |
|
21060 + |
|
21061 +lost_connection |
|
21062 + |
|
21063 + A server unexpectedly closed the SMTP connection. There may, of course, |
|
21064 + legitimate reasons for this (host died, network died), but if it repeats a |
|
21065 + lot for the same host, it indicates something odd. |
|
21066 + |
|
21067 +refused_MX |
|
21068 + |
|
21069 + A connection to a host obtained from an MX record was refused. |
|
21070 + |
|
21071 +refused_A |
|
21072 + |
|
21073 + A connection to a host not obtained from an MX record was refused. |
|
21074 + |
|
21075 +refused |
|
21076 + |
|
21077 + A connection was refused. |
|
21078 + |
|
21079 +timeout_connect_MX |
|
21080 + |
|
21081 + A connection attempt to a host obtained from an MX record timed out. |
|
21082 + |
|
21083 +timeout_connect_A |
|
21084 + |
|
21085 + A connection attempt to a host not obtained from an MX record timed out. |
|
21086 + |
|
21087 +timeout_connect |
|
21088 + |
|
21089 + A connection attempt timed out. |
|
21090 + |
|
21091 +timeout_MX |
|
21092 + |
|
21093 + There was a timeout while connecting or during an SMTP session with a host |
|
21094 + obtained from an MX record. |
|
21095 + |
|
21096 +timeout_A |
|
21097 + |
|
21098 + There was a timeout while connecting or during an SMTP session with a host |
|
21099 + not obtained from an MX record. |
|
21100 + |
|
21101 +timeout |
|
21102 + |
|
21103 + There was a timeout while connecting or during an SMTP session. |
|
21104 + |
|
21105 +tls_required |
|
21106 + |
|
21107 + The server was required to use TLS (it matched hosts_require_tls in the |
|
21108 + smtp transport), but either did not offer TLS, or it responded with 4xx to |
|
21109 + STARTTLS, or there was a problem setting up the TLS connection. |
|
21110 + |
|
21111 +quota |
|
21112 + |
|
21113 + A mailbox quota was exceeded in a local delivery by the appendfile |
|
21114 + transport. |
|
21115 + |
|
21116 +quota_<time> |
|
21117 + |
|
21118 + A mailbox quota was exceeded in a local delivery by the appendfile |
|
21119 + transport, and the mailbox has not been accessed for <time>. For example, |
|
21120 + quota_4d applies to a quota error when the mailbox has not been accessed |
|
21121 + for four days. |
|
21122 + |
|
21123 +The idea of quota_<time> is to make it possible to have shorter timeouts when |
|
21124 +the mailbox is full and is not being read by its owner. Ideally, it should be |
|
21125 +based on the last time that the user accessed the mailbox. However, it is not |
|
21126 +always possible to determine this. Exim uses the following heuristic rules: |
|
21127 + |
|
21128 + * If the mailbox is a single file, the time of last access (the "atime") is |
|
21129 + used. As no new messages are being delivered (because the mailbox is over |
|
21130 + quota), Exim does not access the file, so this is the time of last user |
|
21131 + access. |
|
21132 + |
|
21133 + * For a maildir delivery, the time of last modification of the new |
|
21134 + subdirectory is used. As the mailbox is over quota, no new files are |
|
21135 + created in the new subdirectory, because no new messages are being |
|
21136 + delivered. Any change to the new subdirectory is therefore assumed to be |
|
21137 + the result of an MUA moving a new message to the cur directory when it is |
|
21138 + first read. The time that is used is therefore the last time that the user |
|
21139 + read a new message. |
|
21140 + |
|
21141 + * For other kinds of multi-file mailbox, the time of last access cannot be |
|
21142 + obtained, so a retry rule that uses this type of error field is never |
|
21143 + matched. |
|
21144 + |
|
21145 +The quota errors apply both to system-enforced quotas and to Exim's own quota |
|
21146 +mechanism in the appendfile transport. The quota error also applies when a |
|
21147 +local delivery is deferred because a partition is full (the ENOSPC error). |
|
21148 + |
|
21149 +32.6Â Retry rules for specified senders |
|
21150 + |
|
21151 +You can specify retry rules that apply only when the failing message has a |
|
21152 +specific sender. In particular, this can be used to define retry rules that |
|
21153 +apply only to bounce messages. The third item in a retry rule can be of this |
|
21154 +form: |
|
21155 + |
|
21156 +senders=<address list> |
|
21157 + |
|
21158 +The retry timings themselves are then the fourth item. For example: |
|
21159 + |
|
21160 +* rcpt_4xx senders=: F,1h,30m |
|
21161 + |
|
21162 +matches recipient 4xx errors for bounce messages sent to any address at any |
|
21163 +host. If the address list contains white space, it must be enclosed in quotes. |
|
21164 +For example: |
|
21165 + |
|
21166 +a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5 |
|
21167 + |
|
21168 +Warning: This facility can be unhelpful if it is used for host errors (which do |
|
21169 +not depend on the recipient). The reason is that the sender is used only to |
|
21170 +match the retry rule. Once the rule has been found for a host error, its |
|
21171 +contents are used to set a retry time for the host, and this will apply to all |
|
21172 +messages, not just those with specific senders. |
|
21173 + |
|
21174 +When testing retry rules using -brt, you can supply a sender using the -f |
|
21175 +command line option, like this: |
|
21176 + |
|
21177 +exim -f "" -brt user@dom.ain |
|
21178 + |
|
21179 +If you do not set -f with -brt, a retry rule that contains a senders list is |
|
21180 +never matched. |
|
21181 + |
|
21182 +32.7Â Retry parameters |
|
21183 + |
|
21184 +The third (or fourth, if a senders list is present) field in a retry rule is a |
|
21185 +sequence of retry parameter sets, separated by semicolons. Each set consists of |
|
21186 + |
|
21187 +<letter>,<cutoff time>,<arguments> |
|
21188 + |
|
21189 +The letter identifies the algorithm for computing a new retry time; the cutoff |
|
21190 +time is the time beyond which this algorithm no longer applies, and the |
|
21191 +arguments vary the algorithm's action. The cutoff time is measured from the |
|
21192 +time that the first failure for the domain (combined with the local part if |
|
21193 +relevant) was detected, not from the time the message was received. |
|
21194 + |
|
21195 +The available algorithms are: |
|
21196 + |
|
21197 + * F: retry at fixed intervals. There is a single time parameter specifying |
|
21198 + the interval. |
|
21199 + |
|
21200 + * G: retry at geometrically increasing intervals. The first argument |
|
21201 + specifies a starting value for the interval, and the second a multiplier, |
|
21202 + which is used to increase the size of the interval at each retry. |
|
21203 + |
|
21204 + * H: retry at randomized intervals. The arguments are as for G. For each |
|
21205 + retry, the previous interval is multiplied by the factor in order to get a |
|
21206 + maximum for the next interval. The minimum interval is the first argument |
|
21207 + of the parameter, and an actual interval is chosen randomly between them. |
|
21208 + Such a rule has been found to be helpful in cluster configurations when all |
|
21209 + the members of the cluster restart at once, and may therefore synchronize |
|
21210 + their queue processing times. |
|
21211 + |
|
21212 +When computing the next retry time, the algorithm definitions are scanned in |
|
21213 +order until one whose cutoff time has not yet passed is reached. This is then |
|
21214 +used to compute a new retry time that is later than the current time. In the |
|
21215 +case of fixed interval retries, this simply means adding the interval to the |
|
21216 +current time. For geometrically increasing intervals, retry intervals are |
|
21217 +computed from the rule's parameters until one that is greater than the previous |
|
21218 +interval is found. The main configuration variable retry_interval_max limits |
|
21219 +the maximum interval between retries. It cannot be set greater than "24h", |
|
21220 +which is its default value. |
|
21221 + |
|
21222 +A single remote domain may have a number of hosts associated with it, and each |
|
21223 +host may have more than one IP address. Retry algorithms are selected on the |
|
21224 +basis of the domain name, but are applied to each IP address independently. If, |
|
21225 +for example, a host has two IP addresses and one is unusable, Exim will |
|
21226 +generate retry times for it and will not try to use it until its next retry |
|
21227 +time comes. Thus the good IP address is likely to be tried first most of the |
|
21228 +time. |
|
21229 + |
|
21230 +Retry times are hints rather than promises. Exim does not make any attempt to |
|
21231 +run deliveries exactly at the computed times. Instead, a queue runner process |
|
21232 +starts delivery processes for delayed messages periodically, and these attempt |
|
21233 +new deliveries only for those addresses that have passed their next retry time. |
|
21234 +If a new message arrives for a deferred address, an immediate delivery attempt |
|
21235 +occurs only if the address has passed its retry time. In the absence of new |
|
21236 +messages, the minimum time between retries is the interval between queue runner |
|
21237 +processes. There is not much point in setting retry times of five minutes if |
|
21238 +your queue runners happen only once an hour, unless there are a significant |
|
21239 +number of incoming messages (which might be the case on a system that is |
|
21240 +sending everything to a smart host, for example). |
|
21241 + |
|
21242 +The data in the retry hints database can be inspected by using the exim_dumpdb |
|
21243 +or exim_fixdb utility programs (see chapter 50). The latter utility can also be |
|
21244 +used to change the data. The exinext utility script can be used to find out |
|
21245 +what the next retry times are for the hosts associated with a particular mail |
|
21246 +domain, and also for local deliveries that have been deferred. |
|
21247 + |
|
21248 +32.8Â Retry rule examples |
|
21249 + |
|
21250 +Here are some example retry rules: |
|
21251 + |
|
21252 +alice@wonderland.fict.example quota_5d F,7d,3h |
|
21253 +wonderland.fict.example quota_5d |
|
21254 +wonderland.fict.example * F,1h,15m; G,2d,1h,2; |
|
21255 +lookingglass.fict.example * F,24h,30m; |
|
21256 +* refused_A F,2h,20m; |
|
21257 +* * F,2h,15m; G,16h,1h,1.5; F,5d,8h |
|
21258 + |
|
21259 +The first rule sets up special handling for mail to |
|
21260 +alice@wonderland.fict.example when there is an over-quota error and the mailbox |
|
21261 +has not been read for at least 5 days. Retries continue every three hours for 7 |
|
21262 +days. The second rule handles over-quota errors for all other local parts at |
|
21263 +wonderland.fict.example; the absence of a local part has the same effect as |
|
21264 +supplying "*@". As no retry algorithms are supplied, messages that fail are |
|
21265 +bounced immediately if the mailbox has not been read for at least 5 days. |
|
21266 + |
|
21267 +The third rule handles all other errors at wonderland.fict.example; retries |
|
21268 +happen every 15 minutes for an hour, then with geometrically increasing |
|
21269 +intervals until two days have passed since a delivery first failed. After the |
|
21270 +first hour there is a delay of one hour, then two hours, then four hours, and |
|
21271 +so on (this is a rather extreme example). |
|
21272 + |
|
21273 +The fourth rule controls retries for the domain lookingglass.fict.example. They |
|
21274 +happen every 30 minutes for 24 hours only. The remaining two rules handle all |
|
21275 +other domains, with special action for connection refusal from hosts that were |
|
21276 +not obtained from an MX record. |
|
21277 + |
|
21278 +The final rule in a retry configuration should always have asterisks in the |
|
21279 +first two fields so as to provide a general catch-all for any addresses that do |
|
21280 +not have their own special handling. This example tries every 15 minutes for 2 |
|
21281 +hours, then with intervals starting at one hour and increasing by a factor of |
|
21282 +1.5 up to 16 hours, then every 8 hours up to 5 days. |
|
21283 + |
|
21284 +32.9Â Timeout of retry data |
|
21285 + |
|
21286 +Exim timestamps the data that it writes to its retry hints database. When it |
|
21287 +consults the data during a delivery it ignores any that is older than the value |
|
21288 +set in retry_data_expire (default 7 days). If, for example, a host hasn't been |
|
21289 +tried for 7 days, Exim will try to deliver to it immediately a message arrives, |
|
21290 +and if that fails, it will calculate a retry time as if it were failing for the |
|
21291 +first time. |
|
21292 + |
|
21293 +This improves the behaviour for messages routed to rarely-used hosts such as MX |
|
21294 +backups. If such a host was down at one time, and happens to be down again when |
|
21295 +Exim tries a month later, using the old retry data would imply that it had been |
|
21296 +down all the time, which is not a justified assumption. |
|
21297 + |
|
21298 +If a host really is permanently dead, this behaviour causes a burst of retries |
|
21299 +every now and again, but only if messages routed to it are rare. If there is a |
|
21300 +message at least once every 7 days the retry data never expires. |
|
21301 + |
|
21302 +32.10Â Long-term failures |
|
21303 + |
|
21304 +Special processing happens when an email address has been failing for so long |
|
21305 +that the cutoff time for the last algorithm is reached. For example, using the |
|
21306 +default retry rule: |
|
21307 + |
|
21308 +* * F,2h,15m; G,16h,1h,1.5; F,4d,6h |
|
21309 + |
|
21310 +the cutoff time is four days. Reaching the retry cutoff is independent of how |
|
21311 +long any specific message has been failing; it is the length of continuous |
|
21312 +failure for the recipient address that counts. |
|
21313 + |
|
21314 +When the cutoff time is reached for a local delivery, or for all the IP |
|
21315 +addresses associated with a remote delivery, a subsequent delivery failure |
|
21316 +causes Exim to give up on the address, and a bounce message is generated. In |
|
21317 +order to cater for new messages that use the failing address, a next retry time |
|
21318 +is still computed from the final algorithm, and is used as follows: |
|
21319 + |
|
21320 +For local deliveries, one delivery attempt is always made for any subsequent |
|
21321 +messages. If this delivery fails, the address fails immediately. The |
|
21322 +post-cutoff retry time is not used. |
|
21323 + |
|
21324 +If the delivery is remote, there are two possibilities, controlled by the |
|
21325 +delay_after_cutoff option of the smtp transport. The option is true by default. |
|
21326 +Until the post-cutoff retry time for one of the IP addresses is reached, the |
|
21327 +failing email address is bounced immediately, without a delivery attempt taking |
|
21328 +place. After that time, one new delivery attempt is made to those IP addresses |
|
21329 +that are past their retry times, and if that still fails, the address is |
|
21330 +bounced and new retry times are computed. |
|
21331 + |
|
21332 +In other words, when all the hosts for a given email address have been failing |
|
21333 +for a long time, Exim bounces rather then defers until one of the hosts' retry |
|
21334 +times is reached. Then it tries once, and bounces if that attempt fails. This |
|
21335 +behaviour ensures that few resources are wasted in repeatedly trying to deliver |
|
21336 +to a broken destination, but if the host does recover, Exim will eventually |
|
21337 +notice. |
|
21338 + |
|
21339 +If delay_after_cutoff is set false, Exim behaves differently. If all IP |
|
21340 +addresses are past their final cutoff time, Exim tries to deliver to those IP |
|
21341 +addresses that have not been tried since the message arrived. If there are no |
|
21342 +suitable IP addresses, or if they all fail, the address is bounced. In other |
|
21343 +words, it does not delay when a new message arrives, but tries the expired |
|
21344 +addresses immediately, unless they have been tried since the message arrived. |
|
21345 +If there is a continuous stream of messages for the failing domains, setting |
|
21346 +delay_after_cutoff false means that there will be many more attempts to deliver |
|
21347 +to permanently failing IP addresses than when delay_after_cutoff is true. |
|
21348 + |
|
21349 +32.11Â Deliveries that work intermittently |
|
21350 + |
|
21351 +Some additional logic is needed to cope with cases where a host is |
|
21352 +intermittently available, or when a message has some attribute that prevents |
|
21353 +its delivery when others to the same address get through. In this situation, |
|
21354 +because some messages are successfully delivered, the "retry clock" for the |
|
21355 +host or address keeps getting reset by the successful deliveries, and so |
|
21356 +failing messages remain on the queue for ever because the cutoff time is never |
|
21357 +reached. |
|
21358 + |
|
21359 +Two exceptional actions are applied to prevent this happening. The first |
|
21360 +applies to errors that are related to a message rather than a remote host. |
|
21361 +Section 45.2 has a discussion of the different kinds of error; examples of |
|
21362 +message-related errors are 4xx responses to MAIL or DATA commands, and quota |
|
21363 +failures. For this type of error, if a message's arrival time is earlier than |
|
21364 +the "first failed" time for the error, the earlier time is used when scanning |
|
21365 +the retry rules to decide when to try next and when to time out the address. |
|
21366 + |
|
21367 +The exceptional second action applies in all cases. If a message has been on |
|
21368 +the queue for longer than the cutoff time of any applicable retry rule for a |
|
21369 +given address, a delivery is attempted for that address, even if it is not yet |
|
21370 +time, and if this delivery fails, the address is timed out. A new retry time is |
|
21371 +not computed in this case, so that other messages for the same address are |
|
21372 +considered immediately. |
|
21373 + |
|
21374 +33. SMTP authentication |
|
21375 + |
|
21376 +The "authenticators" section of Exim's run time configuration is concerned with |
|
21377 +SMTP authentication. This facility is an extension to the SMTP protocol, |
|
21378 +described in RFC 2554, which allows a client SMTP host to authenticate itself |
|
21379 +to a server. This is a common way for a server to recognize clients that are |
|
21380 +permitted to use it as a relay. SMTP authentication is not of relevance to the |
|
21381 +transfer of mail between servers that have no managerial connection with each |
|
21382 +other. |
|
21383 + |
|
21384 +Very briefly, the way SMTP authentication works is as follows: |
|
21385 + |
|
21386 + * The server advertises a number of authentication mechanisms in response to |
|
21387 + the client's EHLO command. |
|
21388 + |
|
21389 + * The client issues an AUTH command, naming a specific mechanism. The command |
|
21390 + may, optionally, contain some authentication data. |
|
21391 + |
|
21392 + * The server may issue one or more challenges, to which the client must send |
|
21393 + appropriate responses. In simple authentication mechanisms, the challenges |
|
21394 + are just prompts for user names and passwords. The server does not have to |
|
21395 + issue any challenges - in some mechanisms the relevant data may all be |
|
21396 + transmitted with the AUTH command. |
|
21397 + |
|
21398 + * The server either accepts or denies authentication. |
|
21399 + |
|
21400 + * If authentication succeeds, the client may optionally make use of the AUTH |
|
21401 + option on the MAIL command to pass an authenticated sender in subsequent |
|
21402 + mail transactions. Authentication lasts for the remainder of the SMTP |
|
21403 + connection. |
|
21404 + |
|
21405 + * If authentication fails, the client may give up, or it may try a different |
|
21406 + authentication mechanism, or it may try transferring mail over the |
|
21407 + unauthenticated connection. |
|
21408 + |
|
21409 +If you are setting up a client, and want to know which authentication |
|
21410 +mechanisms the server supports, you can use Telnet to connect to port 25 (the |
|
21411 +SMTP port) on the server, and issue an EHLO command. The response to this |
|
21412 +includes the list of supported mechanisms. For example: |
|
21413 + |
|
21414 +$ telnet server.example 25 |
|
21415 +Trying 192.168.34.25... |
|
21416 +Connected to server.example. |
|
21417 +Escape character is '^]'. |
|
21418 +220 server.example ESMTP Exim 4.20 ... |
|
21419 +ehlo client.example |
|
21420 +250-server.example Hello client.example [10.8.4.5] |
|
21421 +250-SIZEÂ 52428800 |
|
21422 +250-PIPELINING |
|
21423 +250-AUTHÂ PLAIN |
|
21424 +250Â HELP |
|
21425 + |
|
21426 +The second-last line of this example output shows that the server supports |
|
21427 +authentication using the PLAIN mechanism. In Exim, the different authentication |
|
21428 +mechanisms are configured by specifying authenticator drivers. Like the routers |
|
21429 +and transports, which authenticators are included in the binary is controlled |
|
21430 +by build-time definitions. The following are currently available, included by |
|
21431 +setting |
|
21432 + |
|
21433 +AUTH_CRAM_MD5=yes |
|
21434 +AUTH_CYRUS_SASL=yes |
|
21435 +AUTH_PLAINTEXT=yes |
|
21436 +AUTH_SPA=yes |
|
21437 + |
|
21438 +in Local/Makefile, respectively. The first of these supports the CRAM-MD5 |
|
21439 +authentication mechanism (RFC 2195), and the second provides an interface to |
|
21440 +the Cyrus SASL authentication library. The third can be configured to support |
|
21441 +the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is |
|
21442 +not formally documented, but used by several MUAs. The fourth authenticator |
|
21443 +supports Microsoft's Secure Password Authentication mechanism. |
|
21444 + |
|
21445 +The authenticators are configured using the same syntax as other drivers (see |
|
21446 +section 6.22). If no authenticators are required, no authentication section |
|
21447 +need be present in the configuration file. Each authenticator can in principle |
|
21448 +have both server and client functions. When Exim is receiving SMTP mail, it is |
|
21449 +acting as a server; when it is sending out messages over SMTP, it is acting as |
|
21450 +a client. Authenticator configuration options are provided for use in both |
|
21451 +these circumstances. |
|
21452 + |
|
21453 +To make it clear which options apply to which situation, the prefixes server_ |
|
21454 +and client_ are used on option names that are specific to either the server or |
|
21455 +the client function, respectively. Server and client functions are disabled if |
|
21456 +none of their options are set. If an authenticator is to be used for both |
|
21457 +server and client functions, a single definition, using both sets of options, |
|
21458 +is required. For example: |
|
21459 + |
|
21460 +cram: |
|
21461 + driver = cram_md5 |
|
21462 + public_name = CRAM-MD5 |
|
21463 + server_secret = ${if eq{$auth1}{ph10}{secret1}fail} |
|
21464 + client_name = ph10 |
|
21465 + client_secret = secret2 |
|
21466 + |
|
21467 +The server_ option is used when Exim is acting as a server, and the client_ |
|
21468 +options when it is acting as a client. |
|
21469 + |
|
21470 +Descriptions of the individual authenticators are given in subsequent chapters. |
|
21471 +The remainder of this chapter covers the generic options for the |
|
21472 +authenticators, followed by general discussion of the way authentication works |
|
21473 +in Exim. |
|
21474 + |
|
21475 +33.1Â Generic options for authenticators |
|
21476 + |
|
21477 ++-----------------------------------------------------------------+ |
|
21478 +|client_condition|Use: authenticators|Type: string*|Default: unset| |
|
21479 ++-----------------------------------------------------------------+ |
|
21480 + |
|
21481 +When Exim is authenticating as a client, it skips any authenticator whose |
|
21482 +client_condition expansion yields "0", "no", or "false". This can be used, for |
|
21483 +example, to skip plain text authenticators when the connection is not encrypted |
|
21484 +by a setting such as: |
|
21485 + |
|
21486 +client_condition = ${if !eq{$tls_cipher}{}} |
|
21487 + |
|
21488 +(Older documentation incorrectly states that $tls_cipher contains the cipher |
|
21489 +used for incoming messages. In fact, during SMTP delivery, it contains the |
|
21490 +cipher used for the delivery.) |
|
21491 + |
|
21492 ++------------------------------------------------------+ |
|
21493 +|driver|Use: authenticators|Type: string|Default: unset| |
|
21494 ++------------------------------------------------------+ |
|
21495 + |
|
21496 +This option must always be set. It specifies which of the available |
|
21497 +authenticators is to be used. |
|
21498 + |
|
21499 ++-----------------------------------------------------------+ |
|
21500 +|public_name|Use: authenticators|Type: string|Default: unset| |
|
21501 ++-----------------------------------------------------------+ |
|
21502 + |
|
21503 +This option specifies the name of the authentication mechanism that the driver |
|
21504 +implements, and by which it is known to the outside world. These names should |
|
21505 +contain only upper case letters, digits, underscores, and hyphens (RFC 2222), |
|
21506 +but Exim in fact matches them caselessly. If public_name is not set, it |
|
21507 +defaults to the driver's instance name. |
|
21508 + |
|
21509 ++---------------------------------------------------------------------------+ |
|
21510 +|server_advertise_condition|Use: authenticators|Type: string*|Default: unset| |
|
21511 ++---------------------------------------------------------------------------+ |
|
21512 + |
|
21513 +When a server is about to advertise an authentication mechanism, the condition |
|
21514 +is expanded. If it yields the empty string, "0", "no", or "false", the |
|
21515 +mechanism is not advertised. If the expansion fails, the mechanism is not |
|
21516 +advertised. If the failure was not forced, and was not caused by a lookup |
|
21517 +defer, the incident is logged. See section 33.3 below for further discussion. |
|
21518 + |
|
21519 ++-----------------------------------------------------------------+ |
|
21520 +|server_condition|Use: authenticators|Type: string*|Default: unset| |
|
21521 ++-----------------------------------------------------------------+ |
|
21522 + |
|
21523 +This option must be set for a plaintext server authenticator, where it is used |
|
21524 +directly to control authentication. See section 34.2 for details. |
|
21525 + |
|
21526 +For the other authenticators, server_condition can be used as an additional |
|
21527 +authentication or authorization mechanism that is applied after the other |
|
21528 +authenticator conditions succeed. If it is set, it is expanded when the |
|
21529 +authenticator would otherwise return a success code. If the expansion is forced |
|
21530 +to fail, authentication fails. Any other expansion failure causes a temporary |
|
21531 +error code to be returned. If the result of a successful expansion is an empty |
|
21532 +string, "0", "no", or "false", authentication fails. If the result of the |
|
21533 +expansion is "1", "yes", or "true", authentication succeeds. For any other |
|
21534 +result, a temporary error code is returned, with the expanded string as the |
|
21535 +error text. |
|
21536 + |
|
21537 ++-------------------------------------------------------------------+ |
|
21538 +|server_debug_print|Use: authenticators|Type: string*|Default: unset| |
|
21539 ++-------------------------------------------------------------------+ |
|
21540 + |
|
21541 +If this option is set and authentication debugging is enabled (see the -d |
|
21542 +command line option), the string is expanded and included in the debugging |
|
21543 +output when the authenticator is run as a server. This can help with checking |
|
21544 +out the values of variables. If expansion of the string fails, the error |
|
21545 +message is written to the debugging output, and Exim carries on processing. |
|
21546 + |
|
21547 ++--------------------------------------------------------------+ |
|
21548 +|server_set_id|Use: authenticators|Type: string*|Default: unset| |
|
21549 ++--------------------------------------------------------------+ |
|
21550 + |
|
21551 +When an Exim server successfully authenticates a client, this string is |
|
21552 +expanded using data from the authentication, and preserved for any incoming |
|
21553 +messages in the variable $authenticated_id. It is also included in the log |
|
21554 +lines for incoming messages. For example, a user/password authenticator |
|
21555 +configuration might preserve the user name that was used to authenticate, and |
|
21556 +refer to it subsequently during delivery of the message. If expansion fails, |
|
21557 +the option is ignored. |
|
21558 + |
|
21559 ++---------------------------------------------------------------------------+ |
|
21560 +|server_mail_auth_condition|Use: authenticators|Type: string*|Default: unset| |
|
21561 ++---------------------------------------------------------------------------+ |
|
21562 + |
|
21563 +This option allows a server to discard authenticated sender addresses supplied |
|
21564 +as part of MAIL commands in SMTP connections that are authenticated by the |
|
21565 +driver on which server_mail_auth_condition is set. The option is not used as |
|
21566 +part of the authentication process; instead its (unexpanded) value is |
|
21567 +remembered for later use. How it is used is described in the following section. |
|
21568 + |
|
21569 +33.2Â The AUTH parameter on MAIL commands |
|
21570 + |
|
21571 +When a client supplied an AUTH= item on a MAIL command, Exim applies the |
|
21572 +following checks before accepting it as the authenticated sender of the |
|
21573 +message: |
|
21574 + |
|
21575 + * If the connection is not using extended SMTP (that is, HELO was used rather |
|
21576 + than EHLO), the use of AUTH= is a syntax error. |
|
21577 + |
|
21578 + * If the value of the AUTH= parameter is "<>", it is ignored. |
|
21579 + |
|
21580 + * If acl_smtp_mailauth is defined, the ACL it specifies is run. While it is |
|
21581 + running, the value of $authenticated_sender is set to the value obtained |
|
21582 + from the AUTH= parameter. If the ACL does not yield "accept", the value of |
|
21583 + $authenticated_sender is deleted. The acl_smtp_mailauth ACL may not return |
|
21584 + "drop" or "discard". If it defers, a temporary error code (451) is given |
|
21585 + for the MAIL command. |
|
21586 + |
|
21587 + * If acl_smtp_mailauth is not defined, the value of the AUTH= parameter is |
|
21588 + accepted and placed in $authenticated_sender only if the client has |
|
21589 + authenticated. |
|
21590 + |
|
21591 + * If the AUTH= value was accepted by either of the two previous rules, and |
|
21592 + the client has authenticated, and the authenticator has a setting for the |
|
21593 + server_mail_auth_condition, the condition is checked at this point. The |
|
21594 + valued that was saved from the authenticator is expanded. If the expansion |
|
21595 + fails, or yields an empty string, "0", "no", or "false", the value of |
|
21596 + $authenticated_sender is deleted. If the expansion yields any other value, |
|
21597 + the value of $authenticated_sender is retained and passed on with the |
|
21598 + message. |
|
21599 + |
|
21600 +When $authenticated_sender is set for a message, it is passed on to other hosts |
|
21601 +to which Exim authenticates as a client. Do not confuse this value with |
|
21602 +$authenticated_id, which is a string obtained from the authentication process, |
|
21603 +and which is not usually a complete email address. |
|
21604 + |
|
21605 +Whenever an AUTH= value is ignored, the incident is logged. The ACL for MAIL, |
|
21606 +if defined, is run after AUTH= is accepted or ignored. It can therefore make |
|
21607 +use of $authenticated_sender. The converse is not true: the value of |
|
21608 +$sender_address is not yet set up when the acl_smtp_mailauth ACL is run. |
|
21609 + |
|
21610 +33.3Â Authentication on an Exim server |
|
21611 + |
|
21612 +When Exim receives an EHLO command, it advertises the public names of those |
|
21613 +authenticators that are configured as servers, subject to the following |
|
21614 +conditions: |
|
21615 + |
|
21616 + * The client host must match auth_advertise_hosts (default *). |
|
21617 + |
|
21618 + * It the server_advertise_condition option is set, its expansion must not |
|
21619 + yield the empty string, "0", "no", or "false". |
|
21620 + |
|
21621 +The order in which the authenticators are defined controls the order in which |
|
21622 +the mechanisms are advertised. |
|
21623 + |
|
21624 +Some mail clients (for example, some versions of Netscape) require the user to |
|
21625 +provide a name and password for authentication whenever AUTH is advertised, |
|
21626 +even though authentication may not in fact be needed (for example, Exim may be |
|
21627 +set up to allow unconditional relaying from the client by an IP address check). |
|
21628 +You can make such clients more friendly by not advertising AUTH to them. For |
|
21629 +example, if clients on the 10.9.8.0/24 network are permitted (by the ACL that |
|
21630 +runs for RCPT) to relay without authentication, you should set |
|
21631 + |
|
21632 +auth_advertise_hosts = ! 10.9.8.0/24 |
|
21633 + |
|
21634 +so that no authentication mechanisms are advertised to them. |
|
21635 + |
|
21636 +The server_advertise_condition controls the advertisement of individual |
|
21637 +authentication mechanisms. For example, it can be used to restrict the |
|
21638 +advertisement of a particular mechanism to encrypted connections, by a setting |
|
21639 +such as: |
|
21640 + |
|
21641 +server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}} |
|
21642 + |
|
21643 +If the session is encrypted, $tls_cipher is not empty, and so the expansion |
|
21644 +yields "yes", which allows the advertisement to happen. |
|
21645 + |
|
21646 +When an Exim server receives an AUTH command from a client, it rejects it |
|
21647 +immediately if AUTH was not advertised in response to an earlier EHLO command. |
|
21648 +This is the case if |
|
21649 + |
|
21650 + * The client host does not match auth_advertise_hosts; or |
|
21651 + |
|
21652 + * No authenticators are configured with server options; or |
|
21653 + |
|
21654 + * Expansion of server_advertise_condition blocked the advertising of all the |
|
21655 + server authenticators. |
|
21656 + |
|
21657 +Otherwise, Exim runs the ACL specified by acl_smtp_auth in order to decide |
|
21658 +whether to accept the command. If acl_smtp_auth is not set, AUTH is accepted |
|
21659 +from any client host. |
|
21660 + |
|
21661 +If AUTH is not rejected by the ACL, Exim searches its configuration for a |
|
21662 +server authentication mechanism that was advertised in response to EHLO and |
|
21663 +that matches the one named in the AUTH command. If it finds one, it runs the |
|
21664 +appropriate authentication protocol, and authentication either succeeds or |
|
21665 +fails. If there is no matching advertised mechanism, the AUTH command is |
|
21666 +rejected with a 504 error. |
|
21667 + |
|
21668 +When a message is received from an authenticated host, the value of |
|
21669 +$received_protocol is set to "esmtpa" or "esmtpsa" instead of "esmtp" or |
|
21670 +"esmtps", and $sender_host_authenticated contains the name (not the public |
|
21671 +name) of the authenticator driver that successfully authenticated the client |
|
21672 +from which the message was received. This variable is empty if there was no |
|
21673 +successful authentication. |
|
21674 + |
|
21675 +33.4Â Testing server authentication |
|
21676 + |
|
21677 +Exim's -bh option can be useful for testing server authentication |
|
21678 +configurations. The data for the AUTH command has to be sent using base64 |
|
21679 +encoding. A quick way to produce such data for testing is the following Perl |
|
21680 +script: |
|
21681 + |
|
21682 +use MIME::Base64; |
|
21683 +printf ("%s", encode_base64(eval "\"$ARGV[0]\"")); |
|
21684 + |
|
21685 +This interprets its argument as a Perl string, and then encodes it. The |
|
21686 +interpretation as a Perl string allows binary zeros, which are required for |
|
21687 +some kinds of authentication, to be included in the data. For example, a |
|
21688 +command line to run this script on such data might be |
|
21689 + |
|
21690 +encode '\0user\0password' |
|
21691 + |
|
21692 +Note the use of single quotes to prevent the shell interpreting the |
|
21693 +backslashes, so that they can be interpreted by Perl to specify characters |
|
21694 +whose code value is zero. |
|
21695 + |
|
21696 +Warning 1: If either of the user or password strings starts with an octal |
|
21697 +digit, you must use three zeros instead of one after the leading backslash. If |
|
21698 +you do not, the octal digit that starts your string will be incorrectly |
|
21699 +interpreted as part of the code for the first character. |
|
21700 + |
|
21701 +Warning 2: If there are characters in the strings that Perl interprets |
|
21702 +specially, you must use a Perl escape to prevent them being misinterpreted. For |
|
21703 +example, a command such as |
|
21704 + |
|
21705 +encode '\0user@domain.com\0pas$$word' |
|
21706 + |
|
21707 +gives an incorrect answer because of the unescaped "@" and "$" characters. |
|
21708 + |
|
21709 +If you have the mimencode command installed, another way to do produce |
|
21710 +base64-encoded strings is to run the command |
|
21711 + |
|
21712 +echo -e -n `\0user\0password' | mimencode |
|
21713 + |
|
21714 +The -e option of echo enables the interpretation of backslash escapes in the |
|
21715 +argument, and the -n option specifies no newline at the end of its output. |
|
21716 +However, not all versions of echo recognize these options, so you should check |
|
21717 +your version before relying on this suggestion. |
|
21718 + |
|
21719 +33.5Â Authentication by an Exim client |
|
21720 + |
|
21721 +The smtp transport has two options called hosts_require_auth and hosts_try_auth |
|
21722 +. When the smtp transport connects to a server that announces support for |
|
21723 +authentication, and the host matches an entry in either of these options, Exim |
|
21724 +(as a client) tries to authenticate as follows: |
|
21725 + |
|
21726 + * For each authenticator that is configured as a client, in the order in |
|
21727 + which they are defined in the configuration, it searches the authentication |
|
21728 + mechanisms announced by the server for one whose name matches the public |
|
21729 + name of the authenticator. |
|
21730 + |
|
21731 + * When it finds one that matches, it runs the authenticator's client code. |
|
21732 + The variables $host and $host_address are available for any string |
|
21733 + expansions that the client might do. They are set to the server's name and |
|
21734 + IP address. If any expansion is forced to fail, the authentication attempt |
|
21735 + is abandoned, and Exim moves on to the next authenticator. Otherwise an |
|
21736 + expansion failure causes delivery to be deferred. |
|
21737 + |
|
21738 + * If the result of the authentication attempt is a temporary error or a |
|
21739 + timeout, Exim abandons trying to send the message to the host for the |
|
21740 + moment. It will try again later. If there are any backup hosts available, |
|
21741 + they are tried in the usual way. |
|
21742 + |
|
21743 + * If the response to authentication is a permanent error (5xx code), Exim |
|
21744 + carries on searching the list of authenticators and tries another one if |
|
21745 + possible. If all authentication attempts give permanent errors, or if there |
|
21746 + are no attempts because no mechanisms match (or option expansions force |
|
21747 + failure), what happens depends on whether the host matches |
|
21748 + hosts_require_auth or hosts_try_auth. In the first case, a temporary error |
|
21749 + is generated, and delivery is deferred. The error can be detected in the |
|
21750 + retry rules, and thereby turned into a permanent error if you wish. In the |
|
21751 + second case, Exim tries to deliver the message unauthenticated. |
|
21752 + |
|
21753 +When Exim has authenticated itself to a remote server, it adds the AUTH |
|
21754 +parameter to the MAIL commands it sends, if it has an authenticated sender for |
|
21755 +the message. If the message came from a remote host, the authenticated sender |
|
21756 +is the one that was receiving on an incoming MAIL command, provided that the |
|
21757 +incoming connection was authenticated and the server_mail_auth condition |
|
21758 +allowed the authenticated sender to be retained. If a local process calls Exim |
|
21759 +to send a message, the sender address that is built from the login name and |
|
21760 +qualify_domain is treated as authenticated. However, if the |
|
21761 +authenticated_sender option is set on the smtp transport, it overrides the |
|
21762 +authenticated sender that was received with the message. |
|
21763 + |
|
21764 +34. The plaintext authenticator |
|
21765 + |
|
21766 +The plaintext authenticator can be configured to support the PLAIN and LOGIN |
|
21767 +authentication mechanisms, both of which transfer authentication data as plain |
|
21768 +(unencrypted) text (though base64 encoded). The use of plain text is a security |
|
21769 +risk; you are strongly advised to insist on the use of SMTP encryption (see |
|
21770 +chapter 39) if you use the PLAIN or LOGIN mechanisms. If you do use unencrypted |
|
21771 +plain text, you should not use the same passwords for SMTP connections as you |
|
21772 +do for login accounts. |
|
21773 + |
|
21774 +34.1Â Plaintext options |
|
21775 + |
|
21776 +When configured as a server, plaintext uses the following options: |
|
21777 + |
|
21778 ++-----------------------------------------------------------------+ |
|
21779 +|server_condition|Use: authenticators|Type: string*|Default: unset| |
|
21780 ++-----------------------------------------------------------------+ |
|
21781 + |
|
21782 +This is actually a global authentication option, but it must be set in order to |
|
21783 +configure the plaintext driver as a server. Its use is described below. |
|
21784 + |
|
21785 ++----------------------------------------------------------+ |
|
21786 +|server_prompts|Use: plaintext|Type: string*|Default: unset| |
|
21787 ++----------------------------------------------------------+ |
|
21788 + |
|
21789 +The contents of this option, after expansion, must be a colon-separated list of |
|
21790 +prompt strings. If expansion fails, a temporary authentication rejection is |
|
21791 +given. |
|
21792 + |
|
21793 +34.2Â Using plaintext in a server |
|
21794 + |
|
21795 +When running as a server, plaintext performs the authentication test by |
|
21796 +expanding a string. The data sent by the client with the AUTH command, or in |
|
21797 +response to subsequent prompts, is base64 encoded, and so may contain any byte |
|
21798 +values when decoded. If any data is supplied with the command, it is treated as |
|
21799 +a list of strings, separated by NULs (binary zeros), the first three of which |
|
21800 +are placed in the expansion variables $auth1, $auth2, and $auth3 (neither LOGIN |
|
21801 +nor PLAIN uses more than three strings). |
|
21802 + |
|
21803 +For compatibility with previous releases of Exim, the values are also placed in |
|
21804 +the expansion variables $1, $2, and $3. However, the use of these variables for |
|
21805 +this purpose is now deprecated, as it can lead to confusion in string |
|
21806 +expansions that also use them for other things. |
|
21807 + |
|
21808 +If there are more strings in server_prompts than the number of strings supplied |
|
21809 +with the AUTH command, the remaining prompts are used to obtain more data. Each |
|
21810 +response from the client may be a list of NUL-separated strings. |
|
21811 + |
|
21812 +Once a sufficient number of data strings have been received, server_condition |
|
21813 +is expanded. If the expansion is forced to fail, authentication fails. Any |
|
21814 +other expansion failure causes a temporary error code to be returned. If the |
|
21815 +result of a successful expansion is an empty string, "0", "no", or "false", |
|
21816 +authentication fails. If the result of the expansion is "1", "yes", or "true", |
|
21817 +authentication succeeds and the generic server_set_id option is expanded and |
|
21818 +saved in $authenticated_id. For any other result, a temporary error code is |
|
21819 +returned, with the expanded string as the error text. |
|
21820 + |
|
21821 +Warning: If you use a lookup in the expansion to find the user's password, be |
|
21822 +sure to make the authentication fail if the user is unknown. There are good and |
|
21823 +bad examples at the end of the next section. |
|
21824 + |
|
21825 +34.3Â The PLAIN authentication mechanism |
|
21826 + |
|
21827 +The PLAIN authentication mechanism (RFC 2595) specifies that three strings be |
|
21828 +sent as one item of data (that is, one combined string containing two NUL |
|
21829 +separators). The data is sent either as part of the AUTH command, or |
|
21830 +subsequently in response to an empty prompt from the server. |
|
21831 + |
|
21832 +The second and third strings are a user name and a corresponding password. |
|
21833 +Using a single fixed user name and password as an example, this could be |
|
21834 +configured as follows: |
|
21835 + |
|
21836 +fixed_plain: |
|
21837 + driver = plaintext |
|
21838 + public_name = PLAIN |
|
21839 + server_prompts = : |
|
21840 + server_condition = \ |
|
21841 + ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}} |
|
21842 + server_set_id = $auth2 |
|
21843 + |
|
21844 +Note that the default result strings from if ("true" or an empty string) are |
|
21845 +exactly what we want here, so they need not be specified. Obviously, if the |
|
21846 +password contains expansion-significant characters such as dollar, backslash, |
|
21847 +or closing brace, they have to be escaped. |
|
21848 + |
|
21849 +The server_prompts setting specifies a single, empty prompt (empty items at the |
|
21850 +end of a string list are ignored). If all the data comes as part of the AUTH |
|
21851 +command, as is commonly the case, the prompt is not used. This authenticator is |
|
21852 +advertised in the response to EHLO as |
|
21853 + |
|
21854 +250-AUTH PLAIN |
|
21855 + |
|
21856 +and a client host can authenticate itself by sending the command |
|
21857 + |
|
21858 +AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0 |
|
21859 + |
|
21860 +As this contains three strings (more than the number of prompts), no further |
|
21861 +data is required from the client. Alternatively, the client may just send |
|
21862 + |
|
21863 +AUTH PLAIN |
|
21864 + |
|
21865 +to initiate authentication, in which case the server replies with an empty |
|
21866 +prompt. The client must respond with the combined data string. |
|
21867 + |
|
21868 +The data string is base64 encoded, as required by the RFC. This example, when |
|
21869 +decoded, is <NUL>"username"<NUL>"mysecret", where <NUL> represents a zero byte. |
|
21870 +This is split up into three strings, the first of which is empty. The |
|
21871 +server_condition option in the authenticator checks that the second two are |
|
21872 +"username" and "mysecret" respectively. |
|
21873 + |
|
21874 +Having just one fixed user name and password, as in this example, is not very |
|
21875 +realistic, though for a small organization with only a handful of |
|
21876 +authenticating clients it could make sense. |
|
21877 + |
|
21878 +A more sophisticated instance of this authenticator could use the user name in |
|
21879 +$auth2 to look up a password in a file or database, and maybe do an encrypted |
|
21880 +comparison (see crypteq in chapter 11). Here is a example of this approach, |
|
21881 +where the passwords are looked up in a DBM file. Warning: This is an incorrect |
|
21882 +example: |
|
21883 + |
|
21884 +server_condition = \ |
|
21885 + ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}} |
|
21886 + |
|
21887 +The expansion uses the user name ($auth2) as the key to look up a password, |
|
21888 +which it then compares to the supplied password ($auth3). Why is this example |
|
21889 +incorrect? It works fine for existing users, but consider what happens if a |
|
21890 +non-existent user name is given. The lookup fails, but as no success/failure |
|
21891 +strings are given for the lookup, it yields an empty string. Thus, to defeat |
|
21892 +the authentication, all a client has to do is to supply a non-existent user |
|
21893 +name and an empty password. The correct way of writing this test is: |
|
21894 + |
|
21895 +server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\ |
|
21896 + {${if eq{$value}{$auth3}}} {false}} |
|
21897 + |
|
21898 +In this case, if the lookup succeeds, the result is checked; if the lookup |
|
21899 +fails, "false" is returned and authentication fails. If crypteq is being used |
|
21900 +instead of eq, the first example is in fact safe, because crypteq always fails |
|
21901 +if its second argument is empty. However, the second way of writing the test |
|
21902 +makes the logic clearer. |
|
21903 + |
|
21904 +34.4Â The LOGIN authentication mechanism |
|
21905 + |
|
21906 +The LOGIN authentication mechanism is not documented in any RFC, but is in use |
|
21907 +in a number of programs. No data is sent with the AUTH command. Instead, a user |
|
21908 +name and password are supplied separately, in response to prompts. The |
|
21909 +plaintext authenticator can be configured to support this as in this example: |
|
21910 + |
|
21911 +fixed_login: |
|
21912 + driver = plaintext |
|
21913 + public_name = LOGIN |
|
21914 + server_prompts = User Name : Password |
|
21915 + server_condition = \ |
|
21916 + ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}} |
|
21917 + server_set_id = $auth1 |
|
21918 + |
|
21919 +Because of the way plaintext operates, this authenticator accepts data supplied |
|
21920 +with the AUTH command (in contravention of the specification of LOGIN), but if |
|
21921 +the client does not supply it (as is the case for LOGIN clients), the prompt |
|
21922 +strings are used to obtain two data items. |
|
21923 + |
|
21924 +Some clients are very particular about the precise text of the prompts. For |
|
21925 +example, Outlook Express is reported to recognize only "Username:" and |
|
21926 +"Password:". Here is an example of a LOGIN authenticator that uses those |
|
21927 +strings. It uses the ldapauth expansion condition to check the user name and |
|
21928 +password by binding to an LDAP server: |
|
21929 + |
|
21930 +login: |
|
21931 + driver = plaintext |
|
21932 + public_name = LOGIN |
|
21933 + server_prompts = Username:: : Password:: |
|
21934 + server_condition = ${if and{{ \ |
|
21935 + !eq{}{$auth1} }{ \ |
|
21936 + ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \ |
|
21937 + pass=${quote:$auth2} \ |
|
21938 + ldap://ldap.example.org/} }} } |
|
21939 + server_set_id = uid=$auth1,ou=people,o=example.org |
|
21940 + |
|
21941 +We have to check that the username is not empty before using it, because LDAP |
|
21942 +does not permit empty DN components. We must also use the quote_ldap_dn |
|
21943 +operator to correctly quote the DN for authentication. However, the basic quote |
|
21944 +operator, rather than any of the LDAP quoting operators, is the correct one to |
|
21945 +use for the password, because quoting is needed only to make the password |
|
21946 +conform to the Exim syntax. At the LDAP level, the password is an uninterpreted |
|
21947 +string. |
|
21948 + |
|
21949 +34.5Â Support for different kinds of authentication |
|
21950 + |
|
21951 +A number of string expansion features are provided for the purpose of |
|
21952 +interfacing to different ways of user authentication. These include checking |
|
21953 +traditionally encrypted passwords from /etc/passwd (or equivalent), PAM, |
|
21954 +Radius, ldapauth, pwcheck, and saslauthd. For details see section 11.7. |
|
21955 + |
|
21956 +34.6Â Using plaintext in a client |
|
21957 + |
|
21958 +The plaintext authenticator has two client options: |
|
21959 + |
|
21960 ++------------------------------------------------------------------------+ |
|
21961 +|client_ignore_invalid_base64|Use: plaintext|Type: boolean|Default: false| |
|
21962 ++------------------------------------------------------------------------+ |
|
21963 + |
|
21964 +If the client receives a server prompt that is not a valid base64 string, |
|
21965 +authentication is abandoned by default. However, if this option is set true, |
|
21966 +the error in the challenge is ignored and the client sends the response as |
|
21967 +usual. |
|
21968 + |
|
21969 ++-------------------------------------------------------+ |
|
21970 +|client_send|Use: plaintext|Type: string*|Default: unset| |
|
21971 ++-------------------------------------------------------+ |
|
21972 + |
|
21973 +The string is a colon-separated list of authentication data strings. Each |
|
21974 +string is independently expanded before being sent to the server. The first |
|
21975 +string is sent with the AUTH command; any more strings are sent in response to |
|
21976 +prompts from the server. Before each string is expanded, the value of the most |
|
21977 +recent prompt is placed in the next $auth<n> variable, starting with $auth1 for |
|
21978 +the first prompt. Up to three prompts are stored in this way. Thus, the prompt |
|
21979 +that is received in response to sending the first string (with the AUTH |
|
21980 +command) can be used in the expansion of the second string, and so on. If an |
|
21981 +invalid base64 string is received when client_ignore_invalid_base64 is set, an |
|
21982 +empty string is put in the $auth<n> variable. |
|
21983 + |
|
21984 +Note: You cannot use expansion to create multiple strings, because splitting |
|
21985 +takes priority and happens first. |
|
21986 + |
|
21987 +Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in |
|
21988 +the data, further processing is applied to each string before it is sent. If |
|
21989 +there are any single circumflex characters in the string, they are converted to |
|
21990 +NULs. Should an actual circumflex be required as data, it must be doubled in |
|
21991 +the string. |
|
21992 + |
|
21993 +This is an example of a client configuration that implements the PLAIN |
|
21994 +authentication mechanism with a fixed user name and password: |
|
21995 + |
|
21996 +fixed_plain: |
|
21997 + driver = plaintext |
|
21998 + public_name = PLAIN |
|
21999 + client_send = ^username^mysecret |
|
22000 + |
|
22001 +The lack of colons means that the entire text is sent with the AUTH command, |
|
22002 +with the circumflex characters converted to NULs. A similar example that uses |
|
22003 +the LOGIN mechanism is: |
|
22004 + |
|
22005 +fixed_login: |
|
22006 + driver = plaintext |
|
22007 + public_name = LOGIN |
|
22008 + client_send = : username : mysecret |
|
22009 + |
|
22010 +The initial colon means that the first string is empty, so no data is sent with |
|
22011 +the AUTH command itself. The remaining strings are sent in response to prompts. |
|
22012 + |
|
22013 +35. The cram_md5 authenticator |
|
22014 + |
|
22015 +The CRAM-MD5 authentication mechanism is described in RFC 2195. The server |
|
22016 +sends a challenge string to the client, and the response consists of a user |
|
22017 +name and the CRAM-MD5 digest of the challenge string combined with a secret |
|
22018 +string (password) which is known to both server and client. Thus, the secret is |
|
22019 +not sent over the network as plain text, which makes this authenticator more |
|
22020 +secure than plaintext. However, the downside is that the secret has to be |
|
22021 +available in plain text at either end. |
|
22022 + |
|
22023 +35.1Â Using cram_md5 as a server |
|
22024 + |
|
22025 +This authenticator has one server option, which must be set to configure the |
|
22026 +authenticator as a server: |
|
22027 + |
|
22028 ++--------------------------------------------------------+ |
|
22029 +|server_secret|Use: cram_md5|Type: string*|Default: unset| |
|
22030 ++--------------------------------------------------------+ |
|
22031 + |
|
22032 +When the server receives the client's response, the user name is placed in the |
|
22033 +expansion variable $auth1, and server_secret is expanded to obtain the password |
|
22034 +for that user. The server then computes the CRAM-MD5 digest that the client |
|
22035 +should have sent, and checks that it received the correct string. If the |
|
22036 +expansion of server_secret is forced to fail, authentication fails. If the |
|
22037 +expansion fails for some other reason, a temporary error code is returned to |
|
22038 +the client. |
|
22039 + |
|
22040 +For compatibility with previous releases of Exim, the user name is also placed |
|
22041 +in $1. However, the use of this variables for this purpose is now deprecated, |
|
22042 +as it can lead to confusion in string expansions that also use numeric |
|
22043 +variables for other things. |
|
22044 + |
|
22045 +For example, the following authenticator checks that the user name given by the |
|
22046 +client is "ph10", and if so, uses "secret" as the password. For any other user |
|
22047 +name, authentication fails. |
|
22048 + |
|
22049 +fixed_cram: |
|
22050 + driver = cram_md5 |
|
22051 + public_name = CRAM-MD5 |
|
22052 + server_secret = ${if eq{$auth1}{ph10}{secret}fail} |
|
22053 + server_set_id = $auth1 |
|
22054 + |
|
22055 +If authentication succeeds, the setting of server_set_id preserves the user |
|
22056 +name in $authenticated_id. A more typical configuration might look up the |
|
22057 +secret string in a file, using the user name as the key. For example: |
|
22058 + |
|
22059 +lookup_cram: |
|
22060 + driver = cram_md5 |
|
22061 + public_name = CRAM-MD5 |
|
22062 + server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\ |
|
22063 + {$value}fail} |
|
22064 + server_set_id = $auth1 |
|
22065 + |
|
22066 +Note that this expansion explicitly forces failure if the lookup fails because |
|
22067 +$auth1 contains an unknown user name. |
|
22068 + |
|
22069 +35.2Â Using cram_md5 as a client |
|
22070 + |
|
22071 +When used as a client, the cram_md5 authenticator has two options: |
|
22072 + |
|
22073 ++----------------------------------------------------------------------+ |
|
22074 +|client_name|Use: cram_md5|Type: string*|Default: the primary host name| |
|
22075 ++----------------------------------------------------------------------+ |
|
22076 + |
|
22077 +This string is expanded, and the result used as the user name data when |
|
22078 +computing the response to the server's challenge. |
|
22079 + |
|
22080 ++--------------------------------------------------------+ |
|
22081 +|client_secret|Use: cram_md5|Type: string*|Default: unset| |
|
22082 ++--------------------------------------------------------+ |
|
22083 + |
|
22084 +This option must be set for the authenticator to work as a client. Its value is |
|
22085 +expanded and the result used as the secret string when computing the response. |
|
22086 + |
|
22087 +Different user names and secrets can be used for different servers by referring |
|
22088 +to $host or $host_address in the options. Forced failure of either expansion |
|
22089 +string is treated as an indication that this authenticator is not prepared to |
|
22090 +handle this case. Exim moves on to the next configured client authenticator. |
|
22091 +Any other expansion failure causes Exim to give up trying to send the message |
|
22092 +to the current server. |
|
22093 + |
|
22094 +A simple example configuration of a cram_md5 authenticator, using fixed |
|
22095 +strings, is: |
|
22096 + |
|
22097 +fixed_cram: |
|
22098 + driver = cram_md5 |
|
22099 + public_name = CRAM-MD5 |
|
22100 + client_name = ph10 |
|
22101 + client_secret = secret |
|
22102 + |
|
22103 +36. The cyrus_sasl authenticator |
|
22104 + |
|
22105 +The code for this authenticator was provided by Matthew Byng-Maddick of A L |
|
22106 +Digital Ltd (http://www.aldigital.co.uk). |
|
22107 + |
|
22108 +The cyrus_sasl authenticator provides server support for the Cyrus SASL library |
|
22109 +implementation of the RFC 2222 ("Simple Authentication and Security Layer"). |
|
22110 +This library supports a number of authentication mechanisms, including PLAIN |
|
22111 +and LOGIN, but also several others that Exim does not support directly. In |
|
22112 +particular, there is support for Kerberos authentication. |
|
22113 + |
|
22114 +The cyrus_sasl authenticator provides a gatewaying mechanism directly to the |
|
22115 +Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5, then |
|
22116 +so can the cyrus_sasl authenticator. By default it uses the public name of the |
|
22117 +driver to determine which mechanism to support. |
|
22118 + |
|
22119 +Where access to some kind of secret file is required, for example in GSSAPI or |
|
22120 +CRAM-MD5, it is worth noting that the authenticator runs as the Exim user, and |
|
22121 +that the Cyrus SASL library has no way of escalating privileges by default. You |
|
22122 +may also find you need to set environment variables, depending on the driver |
|
22123 +you are using. |
|
22124 + |
|
22125 +The application name provided by Exim is "exim", so various SASL options may be |
|
22126 +set in exim.conf in your SASL directory. If you are using GSSAPI for Kerberos, |
|
22127 +note that because of limitations in the GSSAPI interface, changing the server |
|
22128 +keytab might need to be communicated down to the Kerberos layer independently. |
|
22129 +The mechanism for doing so is dependent upon the Kerberos implementation. For |
|
22130 +example, for Heimdal, the environment variable KRB5_KTNAME may be set to point |
|
22131 +to an alternative keytab file. Exim will pass this variable through from its |
|
22132 +own inherited environment when started as root or the Exim user. The keytab |
|
22133 +file needs to be readable by the Exim user. |
|
22134 + |
|
22135 +36.1Â Using cyrus_sasl as a server |
|
22136 + |
|
22137 +The cyrus_sasl authenticator has four private options. It puts the username (on |
|
22138 +a successful authentication) into $auth1. For compatibility with previous |
|
22139 +releases of Exim, the username is also placed in $1. However, the use of this |
|
22140 +variable for this purpose is now deprecated, as it can lead to confusion in |
|
22141 +string expansions that also use numeric variables for other things. |
|
22142 + |
|
22143 ++----------------------------------------------------------------+ |
|
22144 +|server_hostname|Use: cyrus_sasl|Type: string*|Default: see below| |
|
22145 ++----------------------------------------------------------------+ |
|
22146 + |
|
22147 +This option selects the hostname that is used when communicating with the |
|
22148 +library. The default value is "$primary_hostname". It is up to the underlying |
|
22149 +SASL plug-in what it does with this data. |
|
22150 + |
|
22151 ++-----------------------------------------------------------+ |
|
22152 +|server_mech|Use: cyrus_sasl|Type: string|Default: see below| |
|
22153 ++-----------------------------------------------------------+ |
|
22154 + |
|
22155 +This option selects the authentication mechanism this driver should use. The |
|
22156 +default is the value of the generic public_name option. This option allows you |
|
22157 +to use a different underlying mechanism from the advertised name. For example: |
|
22158 + |
|
22159 +sasl: |
|
22160 + driver = cyrus_sasl |
|
22161 + public_name = X-ANYTHING |
|
22162 + server_mech = CRAM-MD5 |
|
22163 + server_set_id = $auth1 |
|
22164 + |
|
22165 ++--------------------------------------------------------+ |
|
22166 +|server_realm|Use: cyrus_sasl|Type: string|Default: unset| |
|
22167 ++--------------------------------------------------------+ |
|
22168 + |
|
22169 +This specifies the SASL realm that the server claims to be in. |
|
22170 + |
|
22171 ++-----------------------------------------------------------+ |
|
22172 +|server_service|Use: cyrus_sasl|Type: string|Default: "smtp"| |
|
22173 ++-----------------------------------------------------------+ |
|
22174 + |
|
22175 +This is the SASL service that the server claims to implement. |
|
22176 + |
|
22177 +For straightforward cases, you do not need to set any of the authenticator's |
|
22178 +private options. All you need to do is to specify an appropriate mechanism as |
|
22179 +the public name. Thus, if you have a SASL library that supports CRAM-MD5 and |
|
22180 +PLAIN, you could have two authenticators as follows: |
|
22181 + |
|
22182 +sasl_cram_md5: |
|
22183 + driver = cyrus_sasl |
|
22184 + public_name = CRAM-MD5 |
|
22185 + server_set_id = $auth1 |
|
22186 + |
|
22187 +sasl_plain: |
|
22188 + driver = cyrus_sasl |
|
22189 + public_name = PLAIN |
|
22190 + server_set_id = $auth2 |
|
22191 + |
|
22192 +Cyrus SASL does implement the LOGIN authentication method, even though it is |
|
22193 +not a standard method. It is disabled by default in the source distribution, |
|
22194 +but it is present in many binary distributions. |
|
22195 + |
|
22196 +37. The dovecot authenticator |
|
22197 + |
|
22198 +This authenticator is an interface to the authentication facility of the |
|
22199 +Dovecot POP/IMAP server, which can support a number of authentication methods. |
|
22200 +If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful |
|
22201 +to use the same mechanisms for SMTP authentication. This is a server |
|
22202 +authenticator only. There is only one option: |
|
22203 + |
|
22204 ++------------------------------------------------------+ |
|
22205 +|server_socket|Use: dovecot|Type: string|Default: unset| |
|
22206 ++------------------------------------------------------+ |
|
22207 + |
|
22208 +This option must specify the socket that is the interface to Dovecot |
|
22209 +authentication. The public_name option must specify an authentication mechanism |
|
22210 +that Dovecot is configured to support. You can have several authenticators for |
|
22211 +different mechanisms. For example: |
|
22212 + |
|
22213 +dovecot_plain: |
|
22214 + driver = dovecot |
|
22215 + public_name = PLAIN |
|
22216 + server_socket = /var/run/dovecot/auth-client |
|
22217 + server_set_id = $auth2 |
|
22218 + |
|
22219 +dovecot_ntlm: |
|
22220 + driver = dovecot |
|
22221 + public_name = NTLM |
|
22222 + server_socket = /var/run/dovecot/auth-client |
|
22223 + server_set_id = $auth1 |
|
22224 + |
|
22225 +If the SMTP connection is encrypted, or if $sender_host_address is equal to |
|
22226 +$received_ip_address (that is, the connection is local), the "secured" option |
|
22227 +is passed in the Dovecot authentication command. If, for a TLS connection, a |
|
22228 +client certificate has been verified, the "valid-client-cert" option is passed. |
|
22229 +When authentication succeeds, the identity of the user who authenticated is |
|
22230 +placed in $auth1. |
|
22231 + |
|
22232 +38. The spa authenticator |
|
22233 + |
|
22234 +The spa authenticator provides client support for Microsoft's Secure Password |
|
22235 +Authentication mechanism, which is also sometimes known as NTLM (NT LanMan). |
|
22236 +The code for client side of this authenticator was contributed by Marc |
|
22237 +Prud'hommeaux, and much of it is taken from the Samba project (http:// |
|
22238 +www.samba.org). The code for the server side was subsequently contributed by |
|
22239 +Tom Kistner. The mechanism works as follows: |
|
22240 + |
|
22241 + * After the AUTH command has been accepted, the client sends an SPA |
|
22242 + authentication request based on the user name and optional domain. |
|
22243 + |
|
22244 + * The server sends back a challenge. |
|
22245 + |
|
22246 + * The client builds a challenge response which makes use of the user's |
|
22247 + password and sends it to the server, which then accepts or rejects it. |
|
22248 + |
|
22249 +Encryption is used to protect the password in transit. |
|
22250 + |
|
22251 +38.1Â Using spa as a server |
|
22252 + |
|
22253 +The spa authenticator has just one server option: |
|
22254 + |
|
22255 ++-----------------------------------------------------+ |
|
22256 +|server_password|Use: spa|Type: string*|Default: unset| |
|
22257 ++-----------------------------------------------------+ |
|
22258 + |
|
22259 +This option is expanded, and the result must be the cleartext password for the |
|
22260 +authenticating user, whose name is at this point in $auth1. For compatibility |
|
22261 +with previous releases of Exim, the user name is also placed in $1. However, |
|
22262 +the use of this variable for this purpose is now deprecated, as it can lead to |
|
22263 +confusion in string expansions that also use numeric variables for other |
|
22264 +things. For example: |
|
22265 + |
|
22266 +spa: |
|
22267 + driver = spa |
|
22268 + public_name = NTLM |
|
22269 + server_password = \ |
|
22270 + ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail} |
|
22271 + |
|
22272 +If the expansion is forced to fail, authentication fails. Any other expansion |
|
22273 +failure causes a temporary error code to be returned. |
|
22274 + |
|
22275 +38.2Â Using spa as a client |
|
22276 + |
|
22277 +The spa authenticator has the following client options: |
|
22278 + |
|
22279 ++---------------------------------------------------+ |
|
22280 +|client_domain|Use: spa|Type: string*|Default: unset| |
|
22281 ++---------------------------------------------------+ |
|
22282 + |
|
22283 +This option specifies an optional domain for the authentication. |
|
22284 + |
|
22285 ++-----------------------------------------------------+ |
|
22286 +|client_password|Use: spa|Type: string*|Default: unset| |
|
22287 ++-----------------------------------------------------+ |
|
22288 + |
|
22289 +This option specifies the user's password, and must be set. |
|
22290 + |
|
22291 ++-----------------------------------------------------+ |
|
22292 +|client_username|Use: spa|Type: string*|Default: unset| |
|
22293 ++-----------------------------------------------------+ |
|
22294 + |
|
22295 +This option specifies the user name, and must be set. Here is an example of a |
|
22296 +configuration of this authenticator for use with the mail servers at msn.com: |
|
22297 + |
|
22298 +msn: |
|
22299 + driver = spa |
|
22300 + public_name = MSN |
|
22301 + client_username = msn/msn_username |
|
22302 + client_password = msn_plaintext_password |
|
22303 + client_domain = DOMAIN_OR_UNSET |
|
22304 + |
|
22305 +39. Encrypted SMTP connections using TLS/SSL |
|
22306 + |
|
22307 +Support for TLS (Transport Layer Security), formerly known as SSL (Secure |
|
22308 +Sockets Layer), is implemented by making use of the OpenSSL library or the |
|
22309 +GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no |
|
22310 +cryptographic code in the Exim distribution itself for implementing TLS. In |
|
22311 +order to use this feature you must install OpenSSL or GnuTLS, and then build a |
|
22312 +version of Exim that includes TLS support (see section 4.7). You also need to |
|
22313 +understand the basic concepts of encryption at a managerial level, and in |
|
22314 +particular, the way that public keys, private keys, and certificates are used. |
|
22315 + |
|
22316 +RFC 3207 defines how SMTP connections can make use of encryption. Once a |
|
22317 +connection is established, the client issues a STARTTLS command. If the server |
|
22318 +accepts this, the client and the server negotiate an encryption mechanism. If |
|
22319 +the negotiation succeeds, the data that subsequently passes between them is |
|
22320 +encrypted. |
|
22321 + |
|
22322 +Exim's ACLs can detect whether the current SMTP session is encrypted or not, |
|
22323 +and if so, what cipher suite is in use, whether the client supplied a |
|
22324 +certificate, and whether or not that certificate was verified. This makes it |
|
22325 +possible for an Exim server to deny or accept certain commands based on the |
|
22326 +encryption state. |
|
22327 + |
|
22328 +Warning: Certain types of firewall and certain anti-virus products can disrupt |
|
22329 +TLS connections. You need to turn off SMTP scanning for these products in order |
|
22330 +to get TLS to work. |
|
22331 + |
|
22332 +39.1Â Support for the legacy "ssmtp" (aka "smtps") protocol |
|
22333 + |
|
22334 +Early implementations of encrypted SMTP used a different TCP port from normal |
|
22335 +SMTP, and expected an encryption negotiation to start immediately, instead of |
|
22336 +waiting for a STARTTLS command from the client using the standard SMTP port. |
|
22337 +The protocol was called "ssmtp" or "smtps", and port 465 was allocated for this |
|
22338 +purpose. |
|
22339 + |
|
22340 +This approach was abandoned when encrypted SMTP was standardized, but there are |
|
22341 +still some legacy clients that use it. Exim supports these clients by means of |
|
22342 +the tls_on_connect_ports global option. Its value must be a list of port |
|
22343 +numbers; the most common use is expected to be: |
|
22344 + |
|
22345 +tls_on_connect_ports = 465 |
|
22346 + |
|
22347 +The port numbers specified by this option apply to all SMTP connections, both |
|
22348 +via the daemon and via inetd. You still need to specify all the ports that the |
|
22349 +daemon uses (by setting daemon_smtp_ports or local_interfaces or the -oX |
|
22350 +command line option) because tls_on_connect_ports does not add an extra port - |
|
22351 +rather, it specifies different behaviour on a port that is defined elsewhere. |
|
22352 + |
|
22353 +There is also a -tls-on-connect command line option. This overrides |
|
22354 +tls_on_connect_ports; it forces the legacy behaviour for all ports. |
|
22355 + |
|
22356 +39.2Â OpenSSL vs GnuTLS |
|
22357 + |
|
22358 +The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS |
|
22359 +followed later, when the first versions of GnuTLS were released. To build Exim |
|
22360 +to use GnuTLS, you need to set |
|
22361 + |
|
22362 +USE_GNUTLS=yes |
|
22363 + |
|
22364 +in Local/Makefile, in addition to |
|
22365 + |
|
22366 +SUPPORT_TLS=yes |
|
22367 + |
|
22368 +You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the include |
|
22369 +files and libraries for GnuTLS can be found. |
|
22370 + |
|
22371 +There are some differences in usage when using GnuTLS instead of OpenSSL: |
|
22372 + |
|
22373 + * The tls_verify_certificates option must contain the name of a file, not the |
|
22374 + name of a directory (for OpenSSL it can be either). |
|
22375 + |
|
22376 + * The tls_dhparam option is ignored, because early versions of GnuTLS had no |
|
22377 + facility for varying its Diffie-Hellman parameters. I understand that this |
|
22378 + has changed, but Exim has not been updated to provide this facility. |
|
22379 + |
|
22380 + * Distinguished Name (DN) strings reported by the OpenSSL library use a slash |
|
22381 + for separating fields; GnuTLS uses commas, in accordance with RFC 2253. |
|
22382 + This affects the value of the $tls_peerdn variable. |
|
22383 + |
|
22384 + * OpenSSL identifies cipher suites using hyphens as separators, for example: |
|
22385 + DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What |
|
22386 + is more, OpenSSL complains if underscores are present in a cipher list. To |
|
22387 + make life simpler, Exim changes underscores to hyphens for OpenSSL and |
|
22388 + hyphens to underscores for GnuTLS when processing lists of cipher suites in |
|
22389 + the tls_require_ciphers options (the global option and the smtp transport |
|
22390 + option). |
|
22391 + |
|
22392 + * The tls_require_ciphers options operate differently, as described in the |
|
22393 + sections 39.4 and 39.5. |
|
22394 + |
|
22395 +39.3Â GnuTLS parameter computation |
|
22396 + |
|
22397 +GnuTLS uses D-H parameters that may take a substantial amount of time to |
|
22398 +compute. It is unreasonable to re-compute them for every TLS session. |
|
22399 +Therefore, Exim keeps this data in a file in its spool directory, called |
|
22400 +gnutls-params. The file is owned by the Exim user and is readable only by its |
|
22401 +owner. Every Exim process that start up GnuTLS reads the D-H parameters from |
|
22402 +this file. If the file does not exist, the first Exim process that needs it |
|
22403 +computes the data and writes it to a temporary file which is renamed once it is |
|
22404 +complete. It does not matter if several Exim processes do this simultaneously |
|
22405 +(apart from wasting a few resources). Once a file is in place, new Exim |
|
22406 +processes immediately start using it. |
|
22407 + |
|
22408 +For maximum security, the parameters that are stored in this file should be |
|
22409 +recalculated periodically, the frequency depending on your paranoia level. |
|
22410 +Arranging this is easy in principle; just delete the file when you want new |
|
22411 +values to be computed. However, there may be a problem. The calculation of new |
|
22412 +parameters needs random numbers, and these are obtained from /dev/random. If |
|
22413 +the system is not very active, /dev/random may delay returning data until |
|
22414 +enough randomness (entropy) is available. This may cause Exim to hang for a |
|
22415 +substantial amount of time, causing timeouts on incoming connections. |
|
22416 + |
|
22417 +The solution is to generate the parameters externally to Exim. They are stored |
|
22418 +in gnutls-params in PEM format, which means that they can be generated |
|
22419 +externally using the certtool command that is part of GnuTLS. |
|
22420 + |
|
22421 +To replace the parameters with new ones, instead of deleting the file and |
|
22422 +letting Exim re-create it, you can generate new parameters using certtool and, |
|
22423 +when this has been done, replace Exim's cache file by renaming. The relevant |
|
22424 +commands are something like this: |
|
22425 + |
|
22426 +# rm -f new-params |
|
22427 +# touch new-params |
|
22428 +# chown exim:exim new-params |
|
22429 +# chmod 0400 new-params |
|
22430 +# certtool --generate-privkey --bits 512 >new-params |
|
22431 +# echo "" >>new-params |
|
22432 +# certtool --generate-dh-params --bits 1024 >> new-params |
|
22433 +# mv new-params gnutls-params |
|
22434 + |
|
22435 +If Exim never has to generate the parameters itself, the possibility of |
|
22436 +stalling is removed. |
|
22437 + |
|
22438 +39.4Â Requiring specific ciphers in OpenSSL |
|
22439 + |
|
22440 +There is a function in the OpenSSL library that can be passed a list of cipher |
|
22441 +suites before the cipher negotiation takes place. This specifies which ciphers |
|
22442 +are acceptable. The list is colon separated and may contain names like |
|
22443 +DES-CBC3-SHA. Exim passes the expanded value of tls_require_ciphers directly to |
|
22444 +this function call. The following quotation from the OpenSSL documentation |
|
22445 +specifies what forms of item are allowed in the cipher string: |
|
22446 + |
|
22447 + * It can consist of a single cipher suite such as RC4-SHA. |
|
22448 + |
|
22449 + * It can represent a list of cipher suites containing a certain algorithm, or |
|
22450 + cipher suites of a certain type. For example SHA1 represents all ciphers |
|
22451 + suites using the digest algorithm SHA1 and SSLv3 represents all SSL v3 |
|
22452 + algorithms. |
|
22453 + |
|
22454 + * Lists of cipher suites can be combined in a single cipher string using the |
|
22455 + + character. This is used as a logical and operation. For example SHA1+DES |
|
22456 + represents all cipher suites containing the SHA1 and the DES algorithms. |
|
22457 + |
|
22458 +Each cipher string can be optionally preceded by one of the characters "!", "-" |
|
22459 +or "+". |
|
22460 + |
|
22461 + * If "!" is used, the ciphers are permanently deleted from the list. The |
|
22462 + ciphers deleted can never reappear in the list even if they are explicitly |
|
22463 + stated. |
|
22464 + |
|
22465 + * If "-" is used, the ciphers are deleted from the list, but some or all of |
|
22466 + the ciphers can be added again by later options. |
|
22467 + |
|
22468 + * If "+" is used, the ciphers are moved to the end of the list. This option |
|
22469 + does not add any new ciphers; it just moves matching existing ones. |
|
22470 + |
|
22471 +If none of these characters is present, the string is interpreted as a list of |
|
22472 +ciphers to be appended to the current preference list. If the list includes any |
|
22473 +ciphers already present they will be ignored: that is, they will not be moved |
|
22474 +to the end of the list. |
|
22475 + |
|
22476 +39.5Â Requiring specific ciphers or other parameters in GnuTLS |
|
22477 + |
|
22478 +The GnuTLS library allows the caller to specify separate lists of permitted key |
|
22479 +exchange methods, main cipher algorithms, MAC algorithms, and protocols. |
|
22480 +Unfortunately, these lists are numerical, and the library does not have a |
|
22481 +function for turning names into numbers. Consequently, lists of recognized |
|
22482 +names have to be built into the application. The permitted key exchange |
|
22483 +methods, ciphers, and MAC algorithms may be used in any combination to form a |
|
22484 +cipher suite. This is unlike OpenSSL, where complete cipher suite names are |
|
22485 +passed to its control function. |
|
22486 + |
|
22487 +For compatibility with OpenSSL, the tls_require_ciphers option can be set to |
|
22488 +complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this option |
|
22489 +controls only the cipher algorithms. Exim searches each item in the list for |
|
22490 +the name of an available algorithm. For example, if the list contains |
|
22491 +RSA_AES_SHA, then AES is recognized, and the behaviour is exactly the same as |
|
22492 +if just AES were given. |
|
22493 + |
|
22494 +There are additional options called gnutls_require_kx, gnutls_require_mac, and |
|
22495 +gnutls_require_protocols that can be used to restrict the key exchange methods, |
|
22496 +MAC algorithms, and protocols, respectively. These options are ignored if |
|
22497 +OpenSSL is in use. |
|
22498 + |
|
22499 +All four options are available as global options, controlling how Exim behaves |
|
22500 +as a server, and also as options of the smtp transport, controlling how Exim |
|
22501 +behaves as a client. All the values are string expanded. After expansion, the |
|
22502 +values must be colon-separated lists, though the separator can be changed in |
|
22503 +the usual way. |
|
22504 + |
|
22505 +Each of the four lists starts out with a default set of algorithms. If the |
|
22506 +first item in a list does not start with an exclamation mark, all the default |
|
22507 +items are deleted. In this case, only those that are explicitly specified can |
|
22508 +be used. If the first item in a list does start with an exclamation mark, the |
|
22509 +defaults are left on the list. |
|
22510 + |
|
22511 +Then, any item that starts with an exclamation mark causes the relevant entry |
|
22512 +to be removed from the list, and any item that does not start with an |
|
22513 +exclamation mark causes a new entry to be added to the list. Unrecognized items |
|
22514 +in the list are ignored. Thus: |
|
22515 + |
|
22516 +tls_require_ciphers = !ARCFOUR |
|
22517 + |
|
22518 +allows all the defaults except ARCFOUR, whereas |
|
22519 + |
|
22520 +tls_require_ciphers = AES : 3DES |
|
22521 + |
|
22522 +allows only cipher suites that use AES or 3DES. |
|
22523 + |
|
22524 +For tls_require_ciphers the recognized names are AES_256, AES_128, AES (both of |
|
22525 +the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of the |
|
22526 +preceding). The default list does not contain all of these; it just has |
|
22527 +AES_256, AES_128, 3DES, and ARCFOUR_128. |
|
22528 + |
|
22529 +For gnutls_require_kx, the recognized names are DHE_RSA, RSA (which includes |
|
22530 +DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and DHE_DSS). The |
|
22531 +default list contains RSA, DHE_DSS, DHE_RSA. |
|
22532 + |
|
22533 +For gnutls_require_mac, the recognized names are SHA (synonym SHA1), and MD5. |
|
22534 +The default list contains SHA, MD5. |
|
22535 + |
|
22536 +For gnutls_require_protocols, the recognized names are TLS1 and SSL3. The |
|
22537 +default list contains TLS1, SSL3. |
|
22538 + |
|
22539 +In a server, the order of items in these lists is unimportant. The server |
|
22540 +advertises the availability of all the relevant cipher suites. However, in a |
|
22541 +client, the order in the tls_require_ciphers list specifies a preference order |
|
22542 +for the cipher algorithms. The first one in the client's list that is also |
|
22543 +advertised by the server is tried first. The default order is as listed above. |
|
22544 + |
|
22545 +39.6Â Configuring an Exim server to use TLS |
|
22546 + |
|
22547 +When Exim has been built with TLS support, it advertises the availability of |
|
22548 +the STARTTLS command to client hosts that match tls_advertise_hosts, but not to |
|
22549 +any others. The default value of this option is unset, which means that |
|
22550 +STARTTLS is not advertised at all. This default is chosen because you need to |
|
22551 +set some other options in order to make TLS available, and also it is sensible |
|
22552 +for systems that want to use TLS only as a client. |
|
22553 + |
|
22554 +If a client issues a STARTTLS command and there is some configuration problem |
|
22555 +in the server, the command is rejected with a 454 error. If the client persists |
|
22556 +in trying to issue SMTP commands, all except QUIT are rejected with the error |
|
22557 + |
|
22558 +554 Security failure |
|
22559 + |
|
22560 +If a STARTTLS command is issued within an existing TLS session, it is rejected |
|
22561 +with a 554 error code. |
|
22562 + |
|
22563 +To enable TLS operations on a server, you must set tls_advertise_hosts to match |
|
22564 +some hosts. You can, of course, set it to * to match all hosts. However, this |
|
22565 +is not all you need to do. TLS sessions to a server won't work without some |
|
22566 +further configuration at the server end. |
|
22567 + |
|
22568 +It is rumoured that all existing clients that support TLS/SSL use RSA |
|
22569 +encryption. To make this work you need to set, in the server, |
|
22570 + |
|
22571 +tls_certificate = /some/file/name |
|
22572 +tls_privatekey = /some/file/name |
|
22573 + |
|
22574 +These options are, in fact, expanded strings, so you can make them depend on |
|
22575 +the identity of the client that is connected if you wish. The first file |
|
22576 +contains the server's X509 certificate, and the second contains the private key |
|
22577 +that goes with it. These files need to be readable by the Exim user, and must |
|
22578 +always be given as full path names. They can be the same file if both the |
|
22579 +certificate and the key are contained within it. If tls_privatekey is not set, |
|
22580 +or if its expansion is forced to fail or results in an empty string, this is |
|
22581 +assumed to be the case. The certificate file may also contain intermediate |
|
22582 +certificates that need to be sent to the client to enable it to authenticate |
|
22583 +the server's certificate. |
|
22584 + |
|
22585 +If you do not understand about certificates and keys, please try to find a |
|
22586 +source of this background information, which is not Exim-specific. (There are a |
|
22587 +few comments below in section 39.11.) |
|
22588 + |
|
22589 +Note: These options do not apply when Exim is operating as a client - they |
|
22590 +apply only in the case of a server. If you need to use a certificate in an Exim |
|
22591 +client, you must set the options of the same names in an smtp transport. |
|
22592 + |
|
22593 +With just these options, an Exim server will be able to use TLS. It does not |
|
22594 +require the client to have a certificate (but see below for how to insist on |
|
22595 +this). There is one other option that may be needed in other situations. If |
|
22596 + |
|
22597 +tls_dhparam = /some/file/name |
|
22598 + |
|
22599 +is set, the SSL library is initialized for the use of Diffie-Hellman ciphers |
|
22600 +with the parameters contained in the file. This increases the set of cipher |
|
22601 +suites that the server supports. See the command |
|
22602 + |
|
22603 +openssl dhparam |
|
22604 + |
|
22605 +for a way of generating this data. At present, tls_dhparam is used only when |
|
22606 +Exim is linked with OpenSSL. It is ignored if GnuTLS is being used. |
|
22607 + |
|
22608 +The strings supplied for these three options are expanded every time a client |
|
22609 +host connects. It is therefore possible to use different certificates and keys |
|
22610 +for different hosts, if you so wish, by making use of the client's IP address |
|
22611 +in $sender_host_address to control the expansion. If a string expansion is |
|
22612 +forced to fail, Exim behaves as if the option is not set. |
|
22613 + |
|
22614 +The variable $tls_cipher is set to the cipher suite that was negotiated for an |
|
22615 +incoming TLS connection. It is included in the Received: header of an incoming |
|
22616 +message (by default - you can, of course, change this), and it is also included |
|
22617 +in the log line that records a message's arrival, keyed by "X=", unless the |
|
22618 +tls_cipher log selector is turned off. The encrypted condition can be used to |
|
22619 +test for specific cipher suites in ACLs. (For outgoing SMTP deliveries, |
|
22620 +$tls_cipher is reset - see section 39.9.) |
|
22621 + |
|
22622 +Once TLS has been established, the ACLs that run for subsequent SMTP commands |
|
22623 +can check the name of the cipher suite and vary their actions accordingly. The |
|
22624 +cipher suite names vary, depending on which TLS library is being used. For |
|
22625 +example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other |
|
22626 +contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS |
|
22627 +documentation for more details. |
|
22628 + |
|
22629 +39.7Â Requesting and verifying client certificates |
|
22630 + |
|
22631 +If you want an Exim server to request a certificate when negotiating a TLS |
|
22632 +session with a client, you must set either tls_verify_hosts or |
|
22633 +tls_try_verify_hosts. You can, of course, set either of them to * to apply to |
|
22634 +all TLS connections. For any host that matches one of these options, Exim |
|
22635 +requests a certificate as part of the setup of the TLS session. The contents of |
|
22636 +the certificate are verified by comparing it with a list of expected |
|
22637 +certificates. These must be available in a file or, for OpenSSL only (not |
|
22638 +GnuTLS), a directory, identified by tls_verify_certificates. |
|
22639 + |
|
22640 +A file can contain multiple certificates, concatenated end to end. If a |
|
22641 +directory is used (OpenSSL only), each certificate must be in a separate file, |
|
22642 +with a name (or a symbolic link) of the form <hash>.0, where <hash> is a hash |
|
22643 +value constructed from the certificate. You can compute the relevant hash by |
|
22644 +running the command |
|
22645 + |
|
22646 +openssl x509 -hash -noout -in /cert/file |
|
22647 + |
|
22648 +where /cert/file contains a single certificate. |
|
22649 + |
|
22650 +The difference between tls_verify_hosts and tls_try_verify_hosts is what |
|
22651 +happens if the client does not supply a certificate, or if the certificate does |
|
22652 +not match any of the certificates in the collection named by |
|
22653 +tls_verify_certificates. If the client matches tls_verify_hosts, the attempt to |
|
22654 +set up a TLS session is aborted, and the incoming connection is dropped. If the |
|
22655 +client matches tls_try_verify_hosts, the (encrypted) SMTP session continues. |
|
22656 +ACLs that run for subsequent SMTP commands can detect the fact that no |
|
22657 +certificate was verified, and vary their actions accordingly. For example, you |
|
22658 +can insist on a certificate before accepting a message for relaying, but not |
|
22659 +when the message is destined for local delivery. |
|
22660 + |
|
22661 +When a client supplies a certificate (whether it verifies or not), the value of |
|
22662 +the Distinguished Name of the certificate is made available in the variable |
|
22663 +$tls_peerdn during subsequent processing of the message. |
|
22664 + |
|
22665 +Because it is often a long text string, it is not included in the log line or |
|
22666 +Received: header by default. You can arrange for it to be logged, keyed by "DN= |
|
22667 +", by setting the tls_peerdn log selector, and you can use received_header_text |
|
22668 +to change the Received: header. When no certificate is supplied, $tls_peerdn is |
|
22669 +empty. |
|
22670 + |
|
22671 +39.8Â Revoked certificates |
|
22672 + |
|
22673 +Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when |
|
22674 +certificates are revoked. If you have such a list, you can pass it to an Exim |
|
22675 +server using the global option called tls_crl and to an Exim client using an |
|
22676 +identically named option for the smtp transport. In each case, the value of the |
|
22677 +option is expanded and must then be the name of a file that contains a CRL in |
|
22678 +PEM format. |
|
22679 + |
|
22680 +39.9Â Configuring an Exim client to use TLS |
|
22681 + |
|
22682 +The tls_cipher and tls_peerdn log selectors apply to outgoing SMTP deliveries |
|
22683 +as well as to incoming, the latter one causing logging of the server |
|
22684 +certificate's DN. The remaining client configuration for TLS is all within the |
|
22685 +smtp transport. |
|
22686 + |
|
22687 +It is not necessary to set any options to have TLS work in the smtp transport. |
|
22688 +If Exim is built with TLS support, and TLS is advertised by a server, the smtp |
|
22689 +transport always tries to start a TLS session. However, this can be prevented |
|
22690 +by setting hosts_avoid_tls (an option of the transport) to a list of server |
|
22691 +hosts for which TLS should not be used. |
|
22692 + |
|
22693 +If you do not want Exim to attempt to send messages unencrypted when an attempt |
|
22694 +to set up an encrypted connection fails in any way, you can set |
|
22695 +hosts_require_tls to a list of hosts for which encryption is mandatory. For |
|
22696 +those hosts, delivery is always deferred if an encrypted connection cannot be |
|
22697 +set up. If there are any other hosts for the address, they are tried in the |
|
22698 +usual way. |
|
22699 + |
|
22700 +When the server host is not in hosts_require_tls, Exim may try to deliver the |
|
22701 +message unencrypted. It always does this if the response to STARTTLS is a 5xx |
|
22702 +code. For a temporary error code, or for a failure to negotiate a TLS session |
|
22703 +after a success response code, what happens is controlled by the |
|
22704 +tls_tempfail_tryclear option of the smtp transport. If it is false, delivery to |
|
22705 +this host is deferred, and other hosts (if available) are tried. If it is true, |
|
22706 +Exim attempts to deliver unencrypted after a 4xx response to STARTTLS, and if |
|
22707 +STARTTLS is accepted, but the subsequent TLS negotiation fails, Exim closes the |
|
22708 +current connection (because it is in an unknown state), opens a new one to the |
|
22709 +same host, and then tries the delivery unencrypted. |
|
22710 + |
|
22711 +The tls_certificate and tls_privatekey options of the smtp transport provide |
|
22712 +the client with a certificate, which is passed to the server if it requests it. |
|
22713 +If the server is Exim, it will request a certificate only if tls_verify_hosts |
|
22714 +or tls_try_verify_hosts matches the client. |
|
22715 + |
|
22716 +If the tls_verify_certificates option is set on the smtp transport, it must |
|
22717 +name a file or, for OpenSSL only (not GnuTLS), a directory, that contains a |
|
22718 +collection of expected server certificates. The client verifies the server's |
|
22719 +certificate against this collection, taking into account any revoked |
|
22720 +certificates that are in the list defined by tls_crl. |
|
22721 + |
|
22722 +If tls_require_ciphers is set on the smtp transport, it must contain a list of |
|
22723 +permitted cipher suites. If either of these checks fails, delivery to the |
|
22724 +current host is abandoned, and the smtp transport tries to deliver to |
|
22725 +alternative hosts, if any. |
|
22726 + |
|
22727 +Note: These options must be set in the smtp transport for Exim to use TLS when |
|
22728 +it is operating as a client. Exim does not assume that a server certificate |
|
22729 +(set by the global options of the same name) should also be used when operating |
|
22730 +as a client. |
|
22731 + |
|
22732 +All the TLS options in the smtp transport are expanded before use, with $host |
|
22733 +and $host_address containing the name and address of the server to which the |
|
22734 +client is connected. Forced failure of an expansion causes Exim to behave as if |
|
22735 +the relevant option were unset. |
|
22736 + |
|
22737 +Before an SMTP connection is established, the $tls_cipher and $tls_peerdn |
|
22738 +variables are emptied. (Until the first connection, they contain the values |
|
22739 +that were set when the message was received.) If STARTTLS is subsequently |
|
22740 +successfully obeyed, these variables are set to the relevant values for the |
|
22741 +outgoing connection. |
|
22742 + |
|
22743 +39.10Â Multiple messages on the same encrypted TCP/IP connection |
|
22744 + |
|
22745 +Exim sends multiple messages down the same TCP/IP connection by starting up an |
|
22746 +entirely new delivery process for each message, passing the socket from one |
|
22747 +process to the next. This implementation does not fit well with the use of TLS, |
|
22748 +because there is quite a lot of state information associated with a TLS |
|
22749 +connection, not just a socket identification. Passing all the state information |
|
22750 +to a new process is not feasible. Consequently, Exim shuts down an existing TLS |
|
22751 +session before passing the socket to a new process. The new process may then |
|
22752 +try to start a new TLS session, and if successful, may try to re-authenticate |
|
22753 +if AUTH is in use, before sending the next message. |
|
22754 + |
|
22755 +The RFC is not clear as to whether or not an SMTP session continues in clear |
|
22756 +after TLS has been shut down, or whether TLS may be restarted again later, as |
|
22757 +just described. However, if the server is Exim, this shutdown and |
|
22758 +reinitialization works. It is not known which (if any) other servers operate |
|
22759 +successfully if the client closes a TLS session and continues with unencrypted |
|
22760 +SMTP, but there are certainly some that do not work. For such servers, Exim |
|
22761 +should not pass the socket to another process, because the failure of the |
|
22762 +subsequent attempt to use it would cause Exim to record a temporary host error, |
|
22763 +and delay other deliveries to that host. |
|
22764 + |
|
22765 +To test for this case, Exim sends an EHLO command to the server after closing |
|
22766 +down the TLS session. If this fails in any way, the connection is closed |
|
22767 +instead of being passed to a new delivery process, but no retry information is |
|
22768 +recorded. |
|
22769 + |
|
22770 +There is also a manual override; you can set hosts_nopass_tls on the smtp |
|
22771 +transport to match those hosts for which Exim should not pass connections to |
|
22772 +new processes if TLS has been used. |
|
22773 + |
|
22774 +39.11Â Certificates and all that |
|
22775 + |
|
22776 +In order to understand fully how TLS works, you need to know about |
|
22777 +certificates, certificate signing, and certificate authorities. This is not the |
|
22778 +place to give a tutorial, especially as I do not know very much about it |
|
22779 +myself. Some helpful introduction can be found in the FAQ for the SSL addition |
|
22780 +to Apache, currently at |
|
22781 + |
|
22782 +http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24 |
|
22783 + |
|
22784 +Other parts of the modssl documentation are also helpful, and have links to |
|
22785 +further files. Eric Rescorla's book, SSL and TLS, published by Addison-Wesley |
|
22786 +(ISBN 0-201-61598-3), contains both introductory and more in-depth |
|
22787 +descriptions. Some sample programs taken from the book are available from |
|
22788 + |
|
22789 +http://www.rtfm.com/openssl-examples/ |
|
22790 + |
|
22791 +39.12Â Certificate chains |
|
22792 + |
|
22793 +The file named by tls_certificate may contain more than one certificate. This |
|
22794 +is useful in the case where the certificate that is being sent is validated by |
|
22795 +an intermediate certificate which the other end does not have. Multiple |
|
22796 +certificates must be in the correct order in the file. First the host's |
|
22797 +certificate itself, then the first intermediate certificate to validate the |
|
22798 +issuer of the host certificate, then the next intermediate certificate to |
|
22799 +validate the issuer of the first intermediate certificate, and so on, until |
|
22800 +finally (optionally) the root certificate. The root certificate must already be |
|
22801 +trusted by the recipient for validation to succeed, of course, but if it's not |
|
22802 +preinstalled, sending the root certificate along with the rest makes it |
|
22803 +available for the user to install if the receiving end is a client MUA that can |
|
22804 +interact with a user. |
|
22805 + |
|
22806 +39.13Â Self-signed certificates |
|
22807 + |
|
22808 +You can create a self-signed certificate using the req command provided with |
|
22809 +OpenSSL, like this: |
|
22810 + |
|
22811 +openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \ |
|
22812 + -days 9999 -nodes |
|
22813 + |
|
22814 +file1 and file2 can be the same file; the key and the certificate are delimited |
|
22815 +and so can be identified independently. The -days option specifies a period for |
|
22816 +which the certificate is valid. The -nodes option is important: if you do not |
|
22817 +set it, the key is encrypted with a passphrase that you are prompted for, and |
|
22818 +any use that is made of the key causes more prompting for the passphrase. This |
|
22819 +is not helpful if you are going to use this certificate and key in an MTA, |
|
22820 +where prompting is not possible. |
|
22821 + |
|
22822 +A self-signed certificate made in this way is sufficient for testing, and may |
|
22823 +be adequate for all your requirements if you are mainly interested in |
|
22824 +encrypting transfers, and not in secure identification. |
|
22825 + |
|
22826 +However, many clients require that the certificate presented by the server be a |
|
22827 +user (also called "leaf" or "site") certificate, and not a self-signed |
|
22828 +certificate. In this situation, the self-signed certificate described above |
|
22829 +must be installed on the client host as a trusted root certification authority |
|
22830 +(CA), and the certificate used by Exim must be a user certificate signed with |
|
22831 +that self-signed certificate. |
|
22832 + |
|
22833 +For information on creating self-signed CA certificates and using them to sign |
|
22834 +user certificates, see the General implementation overview chapter of the |
|
22835 +Open-source PKI book, available online at http://ospkibook.sourceforge.net/. |
|
22836 + |
|
22837 +40. Access control lists |
|
22838 + |
|
22839 +Access Control Lists (ACLs) are defined in a separate section of the run time |
|
22840 +configuration file, headed by "begin acl". Each ACL definition starts with a |
|
22841 +name, terminated by a colon. Here is a complete ACL section that contains just |
|
22842 +one very small ACL: |
|
22843 + |
|
22844 +begin acl |
|
22845 +small_acl: |
|
22846 + accept hosts = one.host.only |
|
22847 + |
|
22848 +You can have as many lists as you like in the ACL section, and the order in |
|
22849 +which they appear does not matter. The lists are self-terminating. |
|
22850 + |
|
22851 +The majority of ACLs are used to control Exim's behaviour when it receives |
|
22852 +certain SMTP commands. This applies both to incoming TCP/IP connections, and |
|
22853 +when a local process submits a message using SMTP by specifying the -bs option. |
|
22854 +The most common use is for controlling which recipients are accepted in |
|
22855 +incoming messages. In addition, you can define an ACL that is used to check |
|
22856 +local non-SMTP messages. The default configuration file contains an example of |
|
22857 +a realistic ACL for checking RCPT commands. This is discussed in chapter 7. |
|
22858 + |
|
22859 +40.1Â Testing ACLs |
|
22860 + |
|
22861 +The -bh command line option provides a way of testing your ACL configuration |
|
22862 +locally by running a fake SMTP session with which you interact. The host |
|
22863 +relay-test.mail-abuse.org provides a service for checking your relaying |
|
22864 +configuration (see section 40.50 for more details). |
|
22865 + |
|
22866 +40.2Â Specifying when ACLs are used |
|
22867 + |
|
22868 +In order to cause an ACL to be used, you have to name it in one of the relevant |
|
22869 +options in the main part of the configuration. These options are: |
|
22870 + |
|
22871 +Â Â Â Â acl_not_smtp ACL for non-SMTP messages |
|
22872 +Â Â Â Â acl_not_smtp_mime ACL for non-SMTP MIME parts |
|
22873 +Â Â Â Â acl_not_smtp_start ACL at start of non-SMTP message |
|
22874 +Â Â Â Â acl_smtp_auth ACL for AUTH |
|
22875 +Â Â Â Â acl_smtp_connect ACL for start of SMTP connection |
|
22876 +Â Â Â Â acl_smtp_data ACL after DATA is complete |
|
22877 +Â Â Â Â acl_smtp_etrn ACL for ETRN |
|
22878 +Â Â Â Â acl_smtp_expn ACL for EXPN |
|
22879 +Â Â Â Â acl_smtp_helo ACL for HELO or EHLO |
|
22880 +Â Â Â Â acl_smtp_mail ACL for MAIL |
|
22881 +Â Â Â Â acl_smtp_mailauth ACL for the AUTH parameter of MAIL |
|
22882 +Â Â Â Â acl_smtp_mime ACL for content-scanning MIME parts |
|
22883 +Â Â Â Â acl_smtp_notquit ACL for non-QUIT terminations |
|
22884 +Â Â Â Â acl_smtp_predata ACL at start of DATA command |
|
22885 +Â Â Â Â acl_smtp_quit ACL for QUIT |
|
22886 +Â Â Â Â acl_smtp_rcpt ACL for RCPT |
|
22887 +Â Â Â Â acl_smtp_starttls ACL for STARTTLS |
|
22888 +Â Â Â Â acl_smtp_vrfy ACL for VRFY |
|
22889 + |
|
22890 +For example, if you set |
|
22891 + |
|
22892 +acl_smtp_rcpt = small_acl |
|
22893 + |
|
22894 +the little ACL defined above is used whenever Exim receives a RCPT command in |
|
22895 +an SMTP dialogue. The majority of policy tests on incoming messages can be done |
|
22896 +when RCPT commands arrive. A rejection of RCPT should cause the sending MTA to |
|
22897 +give up on the recipient address contained in the RCPT command, whereas |
|
22898 +rejection at other times may cause the client MTA to keep on trying to deliver |
|
22899 +the message. It is therefore recommended that you do as much testing as |
|
22900 +possible at RCPT time. |
|
22901 + |
|
22902 +40.3Â The non-SMTP ACLs |
|
22903 + |
|
22904 +The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they |
|
22905 +apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not |
|
22906 +really SMTP.) Many of the ACL conditions (for example, host tests, and tests on |
|
22907 +the state of the SMTP connection such as encryption and authentication) are not |
|
22908 +relevant and are forbidden in these ACLs. However, the sender and recipients |
|
22909 +are known, so the senders and sender_domains conditions and the $sender_address |
|
22910 +and $recipients variables can be used. Variables such as $authenticated_sender |
|
22911 +are also available. You can specify added header lines in any of these ACLs. |
|
22912 + |
|
22913 +The acl_not_smtp_start ACL is run right at the start of receiving a non-SMTP |
|
22914 +message, before any of the message has been read. (This is the analogue of the |
|
22915 +acl_smtp_predata ACL for SMTP input.) In the case of batched SMTP input, it |
|
22916 +runs after the DATA command has been reached. The result of this ACL is |
|
22917 +ignored; it cannot be used to reject a message. If you really need to, you |
|
22918 +could set a value in an ACL variable here and reject based on that in the |
|
22919 +acl_not_smtp ACL. However, this ACL can be used to set controls, and in |
|
22920 +particular, it can be used to set |
|
22921 + |
|
22922 +control = suppress_local_fixups |
|
22923 + |
|
22924 +This cannot be used in the other non-SMTP ACLs because by the time they are |
|
22925 +run, it is too late. |
|
22926 + |
|
22927 +The acl_not_smtp_mime ACL is available only when Exim is compiled with the |
|
22928 +content-scanning extension. For details, see chapter 41. |
|
22929 + |
|
22930 +The acl_not_smtp ACL is run just before the local_scan() function. Any kind of |
|
22931 +rejection is treated as permanent, because there is no way of sending a |
|
22932 +temporary error for these kinds of message. |
|
22933 + |
|
22934 +40.4Â The SMTP connect ACL |
|
22935 + |
|
22936 +The ACL test specified by acl_smtp_connect happens at the start of an SMTP |
|
22937 +session, after the test specified by host_reject_connection (which is now an |
|
22938 +anomaly) and any TCP Wrappers testing (if configured). If the connection is |
|
22939 +accepted by an accept verb that has a message modifier, the contents of the |
|
22940 +message override the banner message that is otherwise specified by the |
|
22941 +smtp_banner option. |
|
22942 + |
|
22943 +40.5Â The EHLO/HELO ACL |
|
22944 + |
|
22945 +The ACL test specified by acl_smtp_helo happens when the client issues an EHLO |
|
22946 +or HELO command, after the tests specified by helo_accept_junk_hosts, |
|
22947 +helo_allow_chars, helo_verify_hosts, and helo_try_verify_hosts. Note that a |
|
22948 +client may issue more than one EHLO or HELO command in an SMTP session, and |
|
22949 +indeed is required to issue a new EHLO or HELO after successfully setting up |
|
22950 +encryption following a STARTTLS command. |
|
22951 + |
|
22952 +If the command is accepted by an accept verb that has a message modifier, the |
|
22953 +message may not contain more than one line (it will be truncated at the first |
|
22954 +newline and a panic logged if it does). Such a message cannot affect the EHLO |
|
22955 +options that are listed on the second and subsequent lines of an EHLO response. |
|
22956 + |
|
22957 +40.6Â The DATA ACLs |
|
22958 + |
|
22959 +Two ACLs are associated with the DATA command, because it is two-stage command, |
|
22960 +with two responses being sent to the client. When the DATA command is received, |
|
22961 +the ACL defined by acl_smtp_predata is obeyed. This gives you control after all |
|
22962 +the RCPT commands, but before the message itself is received. It offers the |
|
22963 +opportunity to give a negative response to the DATA command before the data is |
|
22964 +transmitted. Header lines added by MAIL or RCPT ACLs are not visible at this |
|
22965 +time, but any that are defined here are visible when the acl_smtp_data ACL is |
|
22966 +run. |
|
22967 + |
|
22968 +You cannot test the contents of the message, for example, to verify addresses |
|
22969 +in the headers, at RCPT time or when the DATA command is received. Such tests |
|
22970 +have to appear in the ACL that is run after the message itself has been |
|
22971 +received, before the final response to the DATA command is sent. This is the |
|
22972 +ACL specified by acl_smtp_data, which is the second ACL that is associated with |
|
22973 +the DATA command. |
|
22974 + |
|
22975 +For both of these ACLs, it is not possible to reject individual recipients. An |
|
22976 +error response rejects the entire message. Unfortunately, it is known that some |
|
22977 +MTAs do not treat hard (5xx) responses to the DATA command (either before or |
|
22978 +after the data) correctly - they keep the message on their queues and try again |
|
22979 +later, but that is their problem, though it does waste some of your resources. |
|
22980 + |
|
22981 +40.7Â The SMTP DKIM ACL |
|
22982 + |
|
22983 +The acl_smtp_dkim ACL is available only when Exim is compiled with DKIM support |
|
22984 +enabled (which is the default). |
|
22985 + |
|
22986 +The ACL test specified by acl_smtp_dkim happens after a message has been |
|
22987 +received, and is executed for each DKIM signature found in a message. If not |
|
22988 +otherwise specified, the default action is to accept. |
|
22989 + |
|
22990 +For details on the operation of DKIM, see chapter 54. |
|
22991 + |
|
22992 +40.8Â The SMTP MIME ACL |
|
22993 + |
|
22994 +The acl_smtp_mime option is available only when Exim is compiled with the |
|
22995 +content-scanning extension. For details, see chapter 41. |
|
22996 + |
|
22997 +40.9Â The QUIT ACL |
|
22998 + |
|
22999 +The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL |
|
23000 +does not affect the response code to QUIT, which is always 221. Thus, the ACL |
|
23001 +does not in fact control any access. For this reason, the only verbs that are |
|
23002 +permitted are accept and warn. |
|
23003 + |
|
23004 +This ACL can be used for tasks such as custom logging at the end of an SMTP |
|
23005 +session. For example, you can use ACL variables in other ACLs to count |
|
23006 +messages, recipients, etc., and log the totals at QUIT time using one or more |
|
23007 +logwrite modifiers on a warn verb. |
|
23008 + |
|
23009 +Warning: Only the $acl_cx variables can be used for this, because the $acl_mx |
|
23010 +variables are reset at the end of each incoming message. |
|
23011 + |
|
23012 +You do not need to have a final accept, but if you do, you can use a message |
|
23013 +modifier to specify custom text that is sent as part of the 221 response to |
|
23014 +QUIT. |
|
23015 + |
|
23016 +This ACL is run only for a "normal" QUIT. For certain kinds of disastrous |
|
23017 +failure (for example, failure to open a log file, or when Exim is bombing out |
|
23018 +because it has detected an unrecoverable error), all SMTP commands from the |
|
23019 +client are given temporary error responses until QUIT is received or the |
|
23020 +connection is closed. In these special cases, the QUIT ACL does not run. |
|
23021 + |
|
23022 +40.10Â The not-QUIT ACL |
|
23023 + |
|
23024 +The not-QUIT ACL, specified by acl_smtp_notquit, is run in most cases when an |
|
23025 +SMTP session ends without sending QUIT. However, when Exim itself is is bad |
|
23026 +trouble, such as being unable to write to its log files, this ACL is not run, |
|
23027 +because it might try to do things (such as write to log files) that make the |
|
23028 +situation even worse. |
|
23029 + |
|
23030 +Like the QUIT ACL, this ACL is provided to make it possible to do customized |
|
23031 +logging or to gather statistics, and its outcome is ignored. The delay modifier |
|
23032 +is forbidden in this ACL, and the only permitted verbs are accept and warn. |
|
23033 + |
|
23034 +When the not-QUIT ACL is running, the variable $smtp_notquit_reason is set to a |
|
23035 +string that indicates the reason for the termination of the SMTP connection. |
|
23036 +The possible values are: |
|
23037 + |
|
23038 +Â Â Â Â "acl-drop" Another ACL issued a drop command |
|
23039 +Â Â Â Â "bad-commands" Too many unknown or non-mail commands |
|
23040 +Â Â Â Â "command-timeout" Timeout while reading SMTP commands |
|
23041 +Â Â Â Â "connection-lost" The SMTP connection has been lost |
|
23042 +Â Â Â Â "data-timeout" Timeout while reading message data |
|
23043 +Â Â Â Â "local-scan-error" The local_scan() function crashed |
|
23044 +Â Â Â Â "local-scan-timeout" The local_scan() function timed out |
|
23045 +Â Â Â Â "signal-exit" SIGTERM or SIGINT |
|
23046 +Â Â Â Â "synchronization-error" SMTP synchronization error |
|
23047 +Â Â Â Â "tls-failed" TLS failed to start |
|
23048 + |
|
23049 +In most cases when an SMTP connection is closed without having received QUIT, |
|
23050 +Exim sends an SMTP response message before actually closing the connection. |
|
23051 +With the exception of the "acl-drop" case, the default message can be |
|
23052 +overridden by the message modifier in the not-QUIT ACL. In the case of a drop |
|
23053 +verb in another ACL, it is the message from the other ACL that is used. |
|
23054 + |
|
23055 +40.11Â Finding an ACL to use |
|
23056 + |
|
23057 +The value of an acl_smtp_xxx option is expanded before use, so you can use |
|
23058 +different ACLs in different circumstances. For example, |
|
23059 + |
|
23060 +acl_smtp_rcpt = ${if ={25}{$interface_port} \ |
|
23061 + {acl_check_rcpt} {acl_check_rcpt_submit} } |
|
23062 + |
|
23063 +In the default configuration file there are some example settings for providing |
|
23064 +an RFC 4409 message submission service on port 587 and a non-standard "smtps" |
|
23065 +service on port 465. You can use a string expansion like this to choose an ACL |
|
23066 +for MUAs on these ports which is more appropriate for this purpose than the |
|
23067 +default ACL on port 25. |
|
23068 + |
|
23069 +The expanded string does not have to be the name of an ACL in the configuration |
|
23070 +file; there are other possibilities. Having expanded the string, Exim searches |
|
23071 +for an ACL as follows: |
|
23072 + |
|
23073 + * If the string begins with a slash, Exim uses it as a file name, and reads |
|
23074 + its contents as an ACL. The lines are processed in the same way as lines in |
|
23075 + the Exim configuration file. In particular, continuation lines are |
|
23076 + supported, blank lines are ignored, as are lines whose first non-whitespace |
|
23077 + character is "#". If the file does not exist or cannot be read, an error |
|
23078 + occurs (typically causing a temporary failure of whatever caused the ACL to |
|
23079 + be run). For example: |
|
23080 + |
|
23081 + acl_smtp_data = /etc/acls/\ |
|
23082 + ${lookup{$sender_host_address}lsearch\ |
|
23083 + {/etc/acllist}{$value}{default}} |
|
23084 + |
|
23085 + This looks up an ACL file to use on the basis of the host's IP address, |
|
23086 + falling back to a default if the lookup fails. If an ACL is successfully |
|
23087 + read from a file, it is retained in memory for the duration of the Exim |
|
23088 + process, so that it can be re-used without having to re-read the file. |
|
23089 + |
|
23090 + * If the string does not start with a slash, and does not contain any spaces, |
|
23091 + Exim searches the ACL section of the configuration for an ACL whose name |
|
23092 + matches the string. |
|
23093 + |
|
23094 + * If no named ACL is found, or if the string contains spaces, Exim parses the |
|
23095 + string as an inline ACL. This can save typing in cases where you just want |
|
23096 + to have something like |
|
23097 + |
|
23098 + acl_smtp_vrfy = accept |
|
23099 + |
|
23100 + in order to allow free use of the VRFY command. Such a string may contain |
|
23101 + newlines; it is processed in the same way as an ACL that is read from a |
|
23102 + file. |
|
23103 + |
|
23104 +40.12Â ACL return codes |
|
23105 + |
|
23106 +Except for the QUIT ACL, which does not affect the SMTP return code (see |
|
23107 +section 40.9 above), the result of running an ACL is either "accept" or "deny", |
|
23108 +or, if some test cannot be completed (for example, if a database is down), |
|
23109 +"defer". These results cause 2xx, 5xx, and 4xx return codes, respectively, to |
|
23110 +be used in the SMTP dialogue. A fourth return, "error", occurs when there is an |
|
23111 +error such as invalid syntax in the ACL. This also causes a 4xx return code. |
|
23112 + |
|
23113 +For the non-SMTP ACL, "defer" and "error" are treated in the same way as |
|
23114 +"deny", because there is no mechanism for passing temporary errors to the |
|
23115 +submitters of non-SMTP messages. |
|
23116 + |
|
23117 +ACLs that are relevant to message reception may also return "discard". This has |
|
23118 +the effect of "accept", but causes either the entire message or an individual |
|
23119 +recipient address to be discarded. In other words, it is a blackholing |
|
23120 +facility. Use it with care. |
|
23121 + |
|
23122 +If the ACL for MAIL returns "discard", all recipients are discarded, and no ACL |
|
23123 +is run for subsequent RCPT commands. The effect of "discard" in a RCPT ACL is |
|
23124 +to discard just the one recipient address. If there are no recipients left when |
|
23125 +the message's data is received, the DATA ACL is not run. A "discard" return |
|
23126 +from the DATA or the non-SMTP ACL discards all the remaining recipients. The |
|
23127 +"discard" return is not permitted for the acl_smtp_predata ACL. |
|
23128 + |
|
23129 +The local_scan() function is always run, even if there are no remaining |
|
23130 +recipients; it may create new recipients. |
|
23131 + |
|
23132 +40.13Â Unset ACL options |
|
23133 + |
|
23134 +The default actions when any of the acl_xxx options are unset are not all the |
|
23135 +same. Note: These defaults apply only when the relevant ACL is not defined at |
|
23136 +all. For any defined ACL, the default action when control reaches the end of |
|
23137 +the ACL statements is "deny". |
|
23138 + |
|
23139 +For acl_smtp_quit and acl_not_smtp_start there is no default because these two |
|
23140 +are ACLs that are used only for their side effects. They cannot be used to |
|
23141 +accept or reject anything. |
|
23142 + |
|
23143 +For acl_not_smtp, acl_smtp_auth, acl_smtp_connect, acl_smtp_data, acl_smtp_helo |
|
23144 +, acl_smtp_mail, acl_smtp_mailauth, acl_smtp_mime, acl_smtp_predata, and |
|
23145 +acl_smtp_starttls, the action when the ACL is not defined is "accept". |
|
23146 + |
|
23147 +For the others (acl_smtp_etrn, acl_smtp_expn, acl_smtp_rcpt, and acl_smtp_vrfy |
|
23148 +), the action when the ACL is not defined is "deny". This means that |
|
23149 +acl_smtp_rcpt must be defined in order to receive any messages over an SMTP |
|
23150 +connection. For an example, see the ACL in the default configuration file. |
|
23151 + |
|
23152 +40.14Â Data for message ACLs |
|
23153 + |
|
23154 +When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables |
|
23155 +that contain information about the host and the message's sender (for example, |
|
23156 +$sender_host_address and $sender_address) are set, and can be used in ACL |
|
23157 +statements. In the case of RCPT (but not MAIL or DATA), $domain and $local_part |
|
23158 +are set from the argument address. The entire SMTP command is available in |
|
23159 +$smtp_command. |
|
23160 + |
|
23161 +When an ACL for the AUTH parameter of MAIL is running, the variables that |
|
23162 +contain information about the host are set, but $sender_address is not yet set. |
|
23163 +Section 33.2 contains a discussion of this parameter and how it is used. |
|
23164 + |
|
23165 +The $message_size variable is set to the value of the SIZE parameter on the |
|
23166 +MAIL command at MAIL, RCPT and pre-data time, or to -1 if that parameter is not |
|
23167 +given. The value is updated to the true message size by the time the final DATA |
|
23168 +ACL is run (after the message data has been received). |
|
23169 + |
|
23170 +The $rcpt_count variable increases by one for each RCPT command received. The |
|
23171 +$recipients_count variable increases by one each time a RCPT command is |
|
23172 +accepted, so while an ACL for RCPT is being processed, it contains the number |
|
23173 +of previously accepted recipients. At DATA time (for both the DATA ACLs), |
|
23174 +$rcpt_count contains the total number of RCPT commands, and $recipients_count |
|
23175 +contains the total number of accepted recipients. |
|
23176 + |
|
23177 +40.15Â Data for non-message ACLs |
|
23178 + |
|
23179 +When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY, |
|
23180 +the remainder of the SMTP command line is placed in $smtp_command_argument, and |
|
23181 +the entire SMTP command is available in $smtp_command. These variables can be |
|
23182 +tested using a condition condition. For example, here is an ACL for use with |
|
23183 +AUTH, which insists that either the session is encrypted, or the CRAM-MD5 |
|
23184 +authentication method is used. In other words, it does not permit |
|
23185 +authentication methods that use cleartext passwords on unencrypted connections. |
|
23186 + |
|
23187 +acl_check_auth: |
|
23188 + accept encrypted = * |
|
23189 + accept condition = ${if eq{${uc:$smtp_command_argument}}\ |
|
23190 + {CRAM-MD5}} |
|
23191 + deny message = TLS encryption or CRAM-MD5 required |
|
23192 + |
|
23193 +(Another way of applying this restriction is to arrange for the authenticators |
|
23194 +that use cleartext passwords not to be advertised when the connection is not |
|
23195 +encrypted. You can use the generic server_advertise_condition authenticator |
|
23196 +option to do this.) |
|
23197 + |
|
23198 +40.16Â Format of an ACL |
|
23199 + |
|
23200 +An individual ACL consists of a number of statements. Each statement starts |
|
23201 +with a verb, optionally followed by a number of conditions and "modifiers". |
|
23202 +Modifiers can change the way the verb operates, define error and log messages, |
|
23203 +set variables, insert delays, and vary the processing of accepted messages. |
|
23204 + |
|
23205 +If all the conditions are met, the verb is obeyed. The same condition may be |
|
23206 +used (with different arguments) more than once in the same statement. This |
|
23207 +provides a means of specifying an "and" conjunction between conditions. For |
|
23208 +example: |
|
23209 + |
|
23210 +deny dnslists = list1.example |
|
23211 +dnslists = list2.example |
|
23212 + |
|
23213 +If there are no conditions, the verb is always obeyed. Exim stops evaluating |
|
23214 +the conditions and modifiers when it reaches a condition that fails. What |
|
23215 +happens then depends on the verb (and in one case, on a special modifier). Not |
|
23216 +all the conditions make sense at every testing point. For example, you cannot |
|
23217 +test a sender address in the ACL that is run for a VRFY command. |
|
23218 + |
|
23219 +40.17Â ACL verbs |
|
23220 + |
|
23221 +The ACL verbs are as follows: |
|
23222 + |
|
23223 + * accept: If all the conditions are met, the ACL returns "accept". If any of |
|
23224 + the conditions are not met, what happens depends on whether endpass appears |
|
23225 + among the conditions (for syntax see below). If the failing condition is |
|
23226 + before endpass, control is passed to the next ACL statement; if it is after |
|
23227 + endpass, the ACL returns "deny". Consider this statement, used to check a |
|
23228 + RCPT command: |
|
23229 + |
|
23230 + accept domains = +local_domains |
|
23231 + endpass |
|
23232 + verify = recipient |
|
23233 + |
|
23234 + If the recipient domain does not match the domains condition, control |
|
23235 + passes to the next statement. If it does match, the recipient is verified, |
|
23236 + and the command is accepted if verification succeeds. However, if |
|
23237 + verification fails, the ACL yields "deny", because the failing condition is |
|
23238 + after endpass. |
|
23239 + |
|
23240 + The endpass feature has turned out to be confusing to many people, so its |
|
23241 + use is not recommended nowadays. It is always possible to rewrite an ACL so |
|
23242 + that endpass is not needed, and it is no longer used in the default |
|
23243 + configuration. |
|
23244 + |
|
23245 + If a message modifier appears on an accept statement, its action depends on |
|
23246 + whether or not endpass is present. In the absence of endpass (when an |
|
23247 + accept verb either accepts or passes control to the next statement), |
|
23248 + message can be used to vary the message that is sent when an SMTP command |
|
23249 + is accepted. For example, in a RCPT ACL you could have: |
|
23250 + |
|
23251 + accept  <some conditions> |
|
23252 +         message = OK, I will allow you through today |
|
23253 + |
|
23254 + You can specify an SMTP response code, optionally followed by an "extended |
|
23255 + response code" at the start of the message, but the first digit must be the |
|
23256 + same as would be sent by default, which is 2 for an accept verb. |
|
23257 + |
|
23258 + If endpass is present in an accept statement, message specifies an error |
|
23259 + message that is used when access is denied. This behaviour is retained for |
|
23260 + backward compatibility, but current "best practice" is to avoid the use of |
|
23261 + endpass. |
|
23262 + |
|
23263 + * defer: If all the conditions are true, the ACL returns "defer" which, in an |
|
23264 + SMTP session, causes a 4xx response to be given. For a non-SMTP ACL, defer |
|
23265 + is the same as deny, because there is no way of sending a temporary error. |
|
23266 + For a RCPT command, defer is much the same as using a redirect router and |
|
23267 + ":defer:" while verifying, but the defer verb can be used in any ACL, and |
|
23268 + even for a recipient it might be a simpler approach. |
|
23269 + |
|
23270 + * deny: If all the conditions are met, the ACL returns "deny". If any of the |
|
23271 + conditions are not met, control is passed to the next ACL statement. For |
|
23272 + example, |
|
23273 + |
|
23274 + deny dnslists = blackholes.mail-abuse.org |
|
23275 + |
|
23276 + rejects commands from hosts that are on a DNS black list. |
|
23277 + |
|
23278 + * discard: This verb behaves like accept, except that it returns "discard" |
|
23279 + from the ACL instead of "accept". It is permitted only on ACLs that are |
|
23280 + concerned with receiving messages. When all the conditions are true, the |
|
23281 + sending entity receives a "success" response. However, discard causes |
|
23282 + recipients to be discarded. If it is used in an ACL for RCPT, just the one |
|
23283 + recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all |
|
23284 + the message's recipients are discarded. Recipients that are discarded |
|
23285 + before DATA do not appear in the log line when the received_recipients log |
|
23286 + selector is set. |
|
23287 + |
|
23288 + If the log_message modifier is set when discard operates, its contents are |
|
23289 + added to the line that is automatically written to the log. The message |
|
23290 + modifier operates exactly as it does for accept. |
|
23291 + |
|
23292 + * drop: This verb behaves like deny, except that an SMTP connection is |
|
23293 + forcibly closed after the 5xx error message has been sent. For example: |
|
23294 + |
|
23295 + drop message = I don't take more than 20 RCPTs |
|
23296 + condition = ${if > {$rcpt_count}{20}} |
|
23297 + |
|
23298 + There is no difference between deny and drop for the connect-time ACL. The |
|
23299 + connection is always dropped after sending a 550 response. |
|
23300 + |
|
23301 + * require: If all the conditions are met, control is passed to the next ACL |
|
23302 + statement. If any of the conditions are not met, the ACL returns "deny". |
|
23303 + For example, when checking a RCPT command, |
|
23304 + |
|
23305 + require message = Sender did not verify |
|
23306 + verify = sender |
|
23307 + |
|
23308 + passes control to subsequent statements only if the message's sender can be |
|
23309 + verified. Otherwise, it rejects the command. Note the positioning of the |
|
23310 + message modifier, before the verify condition. The reason for this is |
|
23311 + discussed in section 40.19. |
|
23312 + |
|
23313 + * warn: If all the conditions are true, a line specified by the log_message |
|
23314 + modifier is written to Exim's main log. Control always passes to the next |
|
23315 + ACL statement. If any condition is false, the log line is not written. If |
|
23316 + an identical log line is requested several times in the same message, only |
|
23317 + one copy is actually written to the log. If you want to force duplicates to |
|
23318 + be written, use the logwrite modifier instead. |
|
23319 + |
|
23320 + If log_message is not present, a warn verb just checks its conditions and |
|
23321 + obeys any "immediate" modifiers (such as control, set, logwrite, and |
|
23322 + add_header) that appear before the first failing condition. There is more |
|
23323 + about adding header lines in section 40.23. |
|
23324 + |
|
23325 + If any condition on a warn statement cannot be completed (that is, there is |
|
23326 + some sort of defer), the log line specified by log_message is not written. |
|
23327 + This does not include the case of a forced failure from a lookup, which is |
|
23328 + considered to be a successful completion. After a defer, no further |
|
23329 + conditions or modifiers in the warn statement are processed. The incident |
|
23330 + is logged, and the ACL continues to be processed, from the next statement |
|
23331 + onwards. |
|
23332 + |
|
23333 + When one of the warn conditions is an address verification that fails, the |
|
23334 + text of the verification failure message is in $acl_verify_message. If you |
|
23335 + want this logged, you must set it up explicitly. For example: |
|
23336 + |
|
23337 + warn !verify = sender |
|
23338 + log_message = sender verify failed: $acl_verify_message |
|
23339 + |
|
23340 +At the end of each ACL there is an implicit unconditional deny. |
|
23341 + |
|
23342 +As you can see from the examples above, the conditions and modifiers are |
|
23343 +written one to a line, with the first one on the same line as the verb, and |
|
23344 +subsequent ones on following lines. If you have a very long condition, you can |
|
23345 +continue it onto several physical lines by the usual backslash continuation |
|
23346 +mechanism. It is conventional to align the conditions vertically. |
|
23347 + |
|
23348 +40.18Â ACL variables |
|
23349 + |
|
23350 +There are some special variables that can be set during ACL processing. They |
|
23351 +can be used to pass information between different ACLs, different invocations |
|
23352 +of the same ACL in the same SMTP connection, and between ACLs and the routers, |
|
23353 +transports, and filters that are used to deliver a message. The names of these |
|
23354 +variables must begin with $acl_c or $acl_m, followed either by a digit or an |
|
23355 +underscore, but the remainder of the name can be any sequence of alphanumeric |
|
23356 +characters and underscores that you choose. There is no limit on the number of |
|
23357 +ACL variables. The two sets act as follows: |
|
23358 + |
|
23359 + * The values of those variables whose names begin with $acl_c persist |
|
23360 + throughout an SMTP connection. They are never reset. Thus, a value that is |
|
23361 + set while receiving one message is still available when receiving the next |
|
23362 + message on the same SMTP connection. |
|
23363 + |
|
23364 + * The values of those variables whose names begin with $acl_m persist only |
|
23365 + while a message is being received. They are reset afterwards. They are also |
|
23366 + reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session. |
|
23367 + |
|
23368 +When a message is accepted, the current values of all the ACL variables are |
|
23369 +preserved with the message and are subsequently made available at delivery |
|
23370 +time. The ACL variables are set by a modifier called set. For example: |
|
23371 + |
|
23372 +accept hosts = whatever |
|
23373 + set acl_m4 = some value |
|
23374 +accept authenticated = * |
|
23375 + set acl_c_auth = yes |
|
23376 + |
|
23377 +Note: A leading dollar sign is not used when naming a variable that is to be |
|
23378 +set. If you want to set a variable without taking any action, you can use a |
|
23379 +warn verb without any other modifiers or conditions. |
|
23380 + |
|
23381 +What happens if a syntactically valid but undefined ACL variable is referenced |
|
23382 +depends on the setting of the strict_acl_vars option. If it is false (the |
|
23383 +default), an empty string is substituted; if it is true, an error is generated. |
|
23384 + |
|
23385 +Versions of Exim before 4.64 have a limited set of numbered variables, but |
|
23386 +their names are compatible, so there is no problem with upgrading. |
|
23387 + |
|
23388 +40.19Â Condition and modifier processing |
|
23389 + |
|
23390 +An exclamation mark preceding a condition negates its result. For example: |
|
23391 + |
|
23392 +deny domains = *.dom.example |
|
23393 + !verify = recipient |
|
23394 + |
|
23395 +causes the ACL to return "deny" if the recipient domain ends in dom.example and |
|
23396 +the recipient address cannot be verified. Sometimes negation can be used on the |
|
23397 +right-hand side of a condition. For example, these two statements are |
|
23398 +equivalent: |
|
23399 + |
|
23400 +deny hosts = !192.168.3.4 |
|
23401 +deny !hosts = 192.168.3.4 |
|
23402 + |
|
23403 +However, for many conditions (verify being a good example), only left-hand side |
|
23404 +negation of the whole condition is possible. |
|
23405 + |
|
23406 +The arguments of conditions and modifiers are expanded. A forced failure of an |
|
23407 +expansion causes a condition to be ignored, that is, it behaves as if the |
|
23408 +condition is true. Consider these two statements: |
|
23409 + |
|
23410 +accept senders = ${lookup{$host_name}lsearch\ |
|
23411 + {/some/file}{$value}fail} |
|
23412 +accept senders = ${lookup{$host_name}lsearch\ |
|
23413 + {/some/file}{$value}{}} |
|
23414 + |
|
23415 +Each attempts to look up a list of acceptable senders. If the lookup succeeds, |
|
23416 +the returned list is searched, but if the lookup fails the behaviour is |
|
23417 +different in the two cases. The fail in the first statement causes the |
|
23418 +condition to be ignored, leaving no further conditions. The accept verb |
|
23419 +therefore succeeds. The second statement, however, generates an empty list when |
|
23420 +the lookup fails. No sender can match an empty list, so the condition fails, |
|
23421 +and therefore the accept also fails. |
|
23422 + |
|
23423 +ACL modifiers appear mixed in with conditions in ACL statements. Some of them |
|
23424 +specify actions that are taken as the conditions for a statement are checked; |
|
23425 +others specify text for messages that are used when access is denied or a |
|
23426 +warning is generated. The control modifier affects the way an incoming message |
|
23427 +is handled. |
|
23428 + |
|
23429 +The positioning of the modifiers in an ACL statement important, because the |
|
23430 +processing of a verb ceases as soon as its outcome is known. Only those |
|
23431 +modifiers that have already been encountered will take effect. For example, |
|
23432 +consider this use of the message modifier: |
|
23433 + |
|
23434 +require message = Can't verify sender |
|
23435 + verify = sender |
|
23436 + message = Can't verify recipient |
|
23437 + verify = recipient |
|
23438 + message = This message cannot be used |
|
23439 + |
|
23440 +If sender verification fails, Exim knows that the result of the statement is |
|
23441 +"deny", so it goes no further. The first message modifier has been seen, so its |
|
23442 +text is used as the error message. If sender verification succeeds, but |
|
23443 +recipient verification fails, the second message is used. If recipient |
|
23444 +verification succeeds, the third message becomes "current", but is never used |
|
23445 +because there are no more conditions to cause failure. |
|
23446 + |
|
23447 +For the deny verb, on the other hand, it is always the last message modifier |
|
23448 +that is used, because all the conditions must be true for rejection to happen. |
|
23449 +Specifying more than one message modifier does not make sense, and the message |
|
23450 +can even be specified after all the conditions. For example: |
|
23451 + |
|
23452 +deny hosts = ... |
|
23453 + !senders = *@my.domain.example |
|
23454 + message = Invalid sender from client host |
|
23455 + |
|
23456 +The "deny" result does not happen until the end of the statement is reached, by |
|
23457 +which time Exim has set up the message. |
|
23458 + |
|
23459 +40.20Â ACL modifiers |
|
23460 + |
|
23461 +The ACL modifiers are as follows: |
|
23462 + |
|
23463 +add_header = <text> |
|
23464 + |
|
23465 + This modifier specifies one or more header lines that are to be added to an |
|
23466 + incoming message, assuming, of course, that the message is ultimately |
|
23467 + accepted. For details, see section 40.23. |
|
23468 + |
|
23469 +continue = <text> |
|
23470 + |
|
23471 + This modifier does nothing of itself, and processing of the ACL always |
|
23472 + continues with the next condition or modifier. The value of continue is in |
|
23473 + the side effects of expanding its argument. Typically this could be used to |
|
23474 + update a database. It is really just a syntactic tidiness, to avoid having |
|
23475 + to write rather ugly lines like this: |
|
23476 + |
|
23477 + condition = ${if eq{0}{<some expansion>}{true}{true}} |
|
23478 + |
|
23479 + Instead, all you need is |
|
23480 + |
|
23481 + continue = <some expansion> |
|
23482 + |
|
23483 +control = <text> |
|
23484 + |
|
23485 + This modifier affects the subsequent processing of the SMTP connection or |
|
23486 + of an incoming message that is accepted. The effect of the first type of |
|
23487 + control lasts for the duration of the connection, whereas the effect of the |
|
23488 + second type lasts only until the current message has been received. The |
|
23489 + message-specific controls always apply to the whole message, not to |
|
23490 + individual recipients, even if the control modifier appears in a RCPT ACL. |
|
23491 + |
|
23492 + As there are now quite a few controls that can be applied, they are |
|
23493 + described separately in section 40.21. The control modifier can be used in |
|
23494 + several different ways. For example: |
|
23495 + |
|
23496 + * It can be at the end of an accept statement: |
|
23497 + |
|
23498 + accept ...some conditions |
|
23499 + control = queue_only |
|
23500 + |
|
23501 + In this case, the control is applied when this statement yields |
|
23502 + "accept", in other words, when the conditions are all true. |
|
23503 + |
|
23504 + * It can be in the middle of an accept statement: |
|
23505 + |
|
23506 + accept ...some conditions... |
|
23507 + control = queue_only |
|
23508 + ...some more conditions... |
|
23509 + |
|
23510 + If the first set of conditions are true, the control is applied, even |
|
23511 + if the statement does not accept because one of the second set of |
|
23512 + conditions is false. In this case, some subsequent statement must yield |
|
23513 + "accept" for the control to be relevant. |
|
23514 + |
|
23515 + * It can be used with warn to apply the control, leaving the decision |
|
23516 + about accepting or denying to a subsequent verb. For example: |
|
23517 + |
|
23518 + warn ...some conditions... |
|
23519 + control = freeze |
|
23520 + accept ... |
|
23521 + |
|
23522 + This example of warn does not contain message, log_message, or logwrite |
|
23523 + , so it does not add anything to the message and does not write a log |
|
23524 + entry. |
|
23525 + |
|
23526 + * If you want to apply a control unconditionally, you can use it with a |
|
23527 + require verb. For example: |
|
23528 + |
|
23529 + require control = no_multiline_responses |
|
23530 + |
|
23531 +delay = <time> |
|
23532 + |
|
23533 + This modifier may appear in any ACL. It causes Exim to wait for the time |
|
23534 + interval before proceeding. However, when testing Exim using the -bh |
|
23535 + option, the delay is not actually imposed (an appropriate message is output |
|
23536 + instead). The time is given in the usual Exim notation, and the delay |
|
23537 + happens as soon as the modifier is processed. In an SMTP session, pending |
|
23538 + output is flushed before the delay is imposed. |
|
23539 + |
|
23540 + Like control, delay can be used with accept or deny, for example: |
|
23541 + |
|
23542 + deny ...some conditions... |
|
23543 + delay = 30s |
|
23544 + |
|
23545 + The delay happens if all the conditions are true, before the statement |
|
23546 + returns "deny". Compare this with: |
|
23547 + |
|
23548 + deny delay = 30s |
|
23549 + ...some conditions... |
|
23550 + |
|
23551 + which waits for 30s before processing the conditions. The delay modifier |
|
23552 + can also be used with warn and together with control: |
|
23553 + |
|
23554 + warn ...some conditions... |
|
23555 + delay = 2m |
|
23556 + control = freeze |
|
23557 + accept ... |
|
23558 + |
|
23559 + If delay is encountered when the SMTP PIPELINING extension is in use, |
|
23560 + responses to several commands are no longer buffered and sent in one packet |
|
23561 + (as they would normally be) because all output is flushed before imposing |
|
23562 + the delay. This optimization is disabled so that a number of small delays |
|
23563 + do not appear to the client as one large aggregated delay that might |
|
23564 + provoke an unwanted timeout. You can, however, disable output flushing for |
|
23565 + delay by using a control modifier to set no_delay_flush. |
|
23566 + |
|
23567 +endpass |
|
23568 + |
|
23569 + This modifier, which has no argument, is recognized only in accept and |
|
23570 + discard statements. It marks the boundary between the conditions whose |
|
23571 + failure causes control to pass to the next statement, and the conditions |
|
23572 + whose failure causes the ACL to return "deny". This concept has proved to |
|
23573 + be confusing to some people, so the use of endpass is no longer recommended |
|
23574 + as "best practice". See the description of accept above for more details. |
|
23575 + |
|
23576 +log_message = <text> |
|
23577 + |
|
23578 + This modifier sets up a message that is used as part of the log message if |
|
23579 + the ACL denies access or a warn statement's conditions are true. For |
|
23580 + example: |
|
23581 + |
|
23582 + require log_message = wrong cipher suite $tls_cipher |
|
23583 + encrypted = DES-CBC3-SHA |
|
23584 + |
|
23585 + log_message is also used when recipients are discarded by discard. For |
|
23586 + example: |
|
23587 + |
|
23588 + discard <some conditions> |
|
23589 +         log_message = Discarded $local_part@$domain because... |
|
23590 + |
|
23591 + When access is denied, log_message adds to any underlying error message |
|
23592 + that may exist because of a condition failure. For example, while verifying |
|
23593 + a recipient address, a :fail: redirection might have already set up a |
|
23594 + message. |
|
23595 + |
|
23596 + The message may be defined before the conditions to which it applies, |
|
23597 + because the string expansion does not happen until Exim decides that access |
|
23598 + is to be denied. This means that any variables that are set by the |
|
23599 + condition are available for inclusion in the message. For example, the |
|
23600 + $dnslist_<xxx> variables are set after a DNS black list lookup succeeds. If |
|
23601 + the expansion of log_message fails, or if the result is an empty string, |
|
23602 + the modifier is ignored. |
|
23603 + |
|
23604 + If you want to use a warn statement to log the result of an address |
|
23605 + verification, you can use $acl_verify_message to include the verification |
|
23606 + error message. |
|
23607 + |
|
23608 + If log_message is used with a warn statement, "Warning:" is added to the |
|
23609 + start of the logged message. If the same warning log message is requested |
|
23610 + more than once while receiving a single email message, only one copy is |
|
23611 + actually logged. If you want to log multiple copies, use logwrite instead |
|
23612 + of log_message. In the absence of log_message and logwrite, nothing is |
|
23613 + logged for a successful warn statement. |
|
23614 + |
|
23615 + If log_message is not present and there is no underlying error message (for |
|
23616 + example, from the failure of address verification), but message is present, |
|
23617 + the message text is used for logging rejections. However, if any text for |
|
23618 + logging contains newlines, only the first line is logged. In the absence of |
|
23619 + both log_message and message, a default built-in message is used for |
|
23620 + logging rejections. |
|
23621 + |
|
23622 +log_reject_target = <log name list> |
|
23623 + |
|
23624 + This modifier makes it possible to specify which logs are used for messages |
|
23625 + about ACL rejections. Its argument is a colon-separated list of words that |
|
23626 + can be "main", "reject", or "panic". The default is "main:reject". The list |
|
23627 + may be empty, in which case a rejection is not logged at all. For example, |
|
23628 + this ACL fragment writes no logging information when access is denied: |
|
23629 + |
|
23630 + deny <some conditions> |
|
23631 +      log_reject_target = |
|
23632 + |
|
23633 + This modifier can be used in SMTP and non-SMTP ACLs. It applies to both |
|
23634 + permanent and temporary rejections. Its effect lasts for the rest of the |
|
23635 + current ACL. |
|
23636 + |
|
23637 +logwrite = <text> |
|
23638 + |
|
23639 + This modifier writes a message to a log file as soon as it is encountered |
|
23640 + when processing an ACL. (Compare log_message, which, except in the case of |
|
23641 + warn and discard, is used only if the ACL statement denies access.) The |
|
23642 + logwrite modifier can be used to log special incidents in ACLs. For |
|
23643 + example: |
|
23644 + |
|
23645 + accept <some special conditions> |
|
23646 +        control  = freeze |
|
23647 +        logwrite = froze message because ... |
|
23648 + |
|
23649 + By default, the message is written to the main log. However, it may begin |
|
23650 + with a colon, followed by a comma-separated list of log names, and then |
|
23651 + another colon, to specify exactly which logs are to be written. For |
|
23652 + example: |
|
23653 + |
|
23654 + logwrite = :main,reject: text for main and reject logs |
|
23655 + logwrite = :panic: text for panic log only |
|
23656 + |
|
23657 +message = <text> |
|
23658 + |
|
23659 + This modifier sets up a text string that is expanded and used as a response |
|
23660 + message when an ACL statement terminates the ACL with an "accept", "deny", |
|
23661 + or "defer" response. (In the case of the accept and discard verbs, there is |
|
23662 + some complication if endpass is involved; see the description of accept for |
|
23663 + details.) |
|
23664 + |
|
23665 + The expansion of the message happens at the time Exim decides that the ACL |
|
23666 + is to end, not at the time it processes message. If the expansion fails, or |
|
23667 + generates an empty string, the modifier is ignored. Here is an example |
|
23668 + where message must be specified first, because the ACL ends with a |
|
23669 + rejection if the hosts condition fails: |
|
23670 + |
|
23671 + require message = Host not recognized |
|
23672 + hosts = 10.0.0.0/8 |
|
23673 + |
|
23674 + (Once a condition has failed, no further conditions or modifiers are |
|
23675 + processed.) |
|
23676 + |
|
23677 + For ACLs that are triggered by SMTP commands, the message is returned as |
|
23678 + part of the SMTP response. The use of message with accept (or discard) is |
|
23679 + meaningful only for SMTP, as no message is returned when a non-SMTP message |
|
23680 + is accepted. In the case of the connect ACL, accepting with a message |
|
23681 + modifier overrides the value of smtp_banner. For the EHLO/HELO ACL, a |
|
23682 + customized accept message may not contain more than one line (otherwise it |
|
23683 + will be truncated at the first newline and a panic logged), and it cannot |
|
23684 + affect the EHLO options. |
|
23685 + |
|
23686 + When SMTP is involved, the message may begin with an overriding response |
|
23687 + code, consisting of three digits optionally followed by an "extended |
|
23688 + response code" of the form n.n.n, each code being followed by a space. For |
|
23689 + example: |
|
23690 + |
|
23691 + deny message = 599 1.2.3 Host not welcome |
|
23692 + hosts = 192.168.34.0/24 |
|
23693 + |
|
23694 + The first digit of the supplied response code must be the same as would be |
|
23695 + sent by default. A panic occurs if it is not. Exim uses a 550 code when it |
|
23696 + denies access, but for the predata ACL, note that the default success code |
|
23697 + is 354, not 2xx. |
|
23698 + |
|
23699 + Notwithstanding the previous paragraph, for the QUIT ACL, unlike the |
|
23700 + others, the message modifier cannot override the 221 response code. |
|
23701 + |
|
23702 + The text in a message modifier is literal; any quotes are taken as |
|
23703 + literals, but because the string is expanded, backslash escapes are |
|
23704 + processed anyway. If the message contains newlines, this gives rise to a |
|
23705 + multi-line SMTP response. |
|
23706 + |
|
23707 + If message is used on a statement that verifies an address, the message |
|
23708 + specified overrides any message that is generated by the verification |
|
23709 + process. However, the original message is available in the variable |
|
23710 + $acl_verify_message, so you can incorporate it into your message if you |
|
23711 + wish. In particular, if you want the text from :fail: items in redirect |
|
23712 + routers to be passed back as part of the SMTP response, you should either |
|
23713 + not use a message modifier, or make use of $acl_verify_message. |
|
23714 + |
|
23715 + For compatibility with previous releases of Exim, a message modifier that |
|
23716 + is used with a warn verb behaves in a similar way to the add_header |
|
23717 + modifier, but this usage is now deprecated. However, message acts only when |
|
23718 + all the conditions are true, wherever it appears in an ACL command, whereas |
|
23719 + add_header acts as soon as it is encountered. If message is used with warn |
|
23720 + in an ACL that is not concerned with receiving a message, it has no effect. |
|
23721 + |
|
23722 +set <acl_name> = <value> |
|
23723 + |
|
23724 + This modifier puts a value into one of the ACL variables (see section 40.18 |
|
23725 + ). |
|
23726 + |
|
23727 +40.21Â Use of the control modifier |
|
23728 + |
|
23729 +The control modifier supports the following settings: |
|
23730 + |
|
23731 +control = allow_auth_unadvertised |
|
23732 + |
|
23733 + This modifier allows a client host to use the SMTP AUTH command even when |
|
23734 + it has not been advertised in response to EHLO. Furthermore, because there |
|
23735 + are apparently some really broken clients that do this, Exim will accept |
|
23736 + AUTH after HELO (rather than EHLO) when this control is set. It should be |
|
23737 + used only if you really need it, and you should limit its use to those |
|
23738 + broken clients that do not work without it. For example: |
|
23739 + |
|
23740 + warn hosts = 192.168.34.25 |
|
23741 + control = allow_auth_unadvertised |
|
23742 + |
|
23743 + Normally, when an Exim server receives an AUTH command, it checks the name |
|
23744 + of the authentication mechanism that is given in the command to ensure that |
|
23745 + it matches an advertised mechanism. When this control is set, the check |
|
23746 + that a mechanism has been advertised is bypassed. Any configured mechanism |
|
23747 + can be used by the client. This control is permitted only in the connection |
|
23748 + and HELO ACLs. |
|
23749 + |
|
23750 +control = caseful_local_part, control = caselower_local_part |
|
23751 + |
|
23752 + These two controls are permitted only in the ACL specified by acl_smtp_rcpt |
|
23753 + (that is, during RCPT processing). By default, the contents of $local_part |
|
23754 + are lower cased before ACL processing. If "caseful_local_part" is |
|
23755 + specified, any uppercase letters in the original local part are restored in |
|
23756 + $local_part for the rest of the ACL, or until a control that sets |
|
23757 + "caselower_local_part" is encountered. |
|
23758 + |
|
23759 + These controls affect only the current recipient. Moreover, they apply only |
|
23760 + to local part handling that takes place directly in the ACL (for example, |
|
23761 + as a key in lookups). If a test to verify the recipient is obeyed, the |
|
23762 + case-related handling of the local part during the verification is |
|
23763 + controlled by the router configuration (see the caseful_local_part generic |
|
23764 + router option). |
|
23765 + |
|
23766 + This facility could be used, for example, to add a spam score to local |
|
23767 + parts containing upper case letters. For example, using $acl_m4 to |
|
23768 + accumulate the spam score: |
|
23769 + |
|
23770 + warn control = caseful_local_part |
|
23771 + set acl_m4 = ${eval:\ |
|
23772 + $acl_m4 + \ |
|
23773 + ${if match{$local_part}{[A-Z]}{1}{0}}\ |
|
23774 + } |
|
23775 + control = caselower_local_part |
|
23776 + |
|
23777 + Notice that we put back the lower cased version afterwards, assuming that |
|
23778 + is what is wanted for subsequent tests. |
|
23779 + |
|
23780 +control = debug/<options> |
|
23781 + |
|
23782 + This control turns on debug logging, almost as though Exim had been invoked |
|
23783 + with "-d", with the output going to a new logfile, by default called |
|
23784 + debuglog. The filename can be adjusted with the tag option, which may |
|
23785 + access any variables already defined. The logging may be adjusted with the |
|
23786 + opts option, which takes the same values as the "-d" command-line option. |
|
23787 + Some examples (which depend on variables that don't exist in all contexts): |
|
23788 + |
|
23789 + control = debug |
|
23790 + control = debug/tag=.$sender_host_address |
|
23791 + control = debug/opts=+expand+acl |
|
23792 + control = debug/tag=.$message_exim_id/opts=+expand |
|
23793 + |
|
23794 +control = enforce_sync, control = no_enforce_sync |
|
23795 + |
|
23796 + These controls make it possible to be selective about when SMTP |
|
23797 + synchronization is enforced. The global option smtp_enforce_sync specifies |
|
23798 + the initial state of the switch (it is true by default). See the |
|
23799 + description of this option in chapter 14 for details of SMTP |
|
23800 + synchronization checking. |
|
23801 + |
|
23802 + The effect of these two controls lasts for the remainder of the SMTP |
|
23803 + connection. They can appear in any ACL except the one for the non-SMTP |
|
23804 + messages. The most straightforward place to put them is in the ACL defined |
|
23805 + by acl_smtp_connect, which is run at the start of an incoming SMTP |
|
23806 + connection, before the first synchronization check. The expected use is to |
|
23807 + turn off the synchronization checks for badly-behaved hosts that you |
|
23808 + nevertheless need to work with. |
|
23809 + |
|
23810 +control = fakedefer/<message> |
|
23811 + |
|
23812 + This control works in exactly the same way as fakereject (described below) |
|
23813 + except that it causes an SMTP 450 response after the message data instead |
|
23814 + of a 550 response. You must take care when using fakedefer because it |
|
23815 + causes the messages to be duplicated when the sender retries. Therefore, |
|
23816 + you should not use fakedefer if the message is to be delivered normally. |
|
23817 + |
|
23818 +control = fakereject/<message> |
|
23819 + |
|
23820 + This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other |
|
23821 + words, only when an SMTP message is being received. If Exim accepts the |
|
23822 + message, instead the final 250 response, a 550 rejection message is sent. |
|
23823 + However, Exim proceeds to deliver the message as normal. The control |
|
23824 + applies only to the current message, not to any subsequent ones that may be |
|
23825 + received in the same SMTP connection. |
|
23826 + |
|
23827 + The text for the 550 response is taken from the control modifier. If no |
|
23828 + message is supplied, the following is used: |
|
23829 + |
|
23830 + 550-Your message has been rejected but is being |
|
23831 + 550-kept for evaluation. |
|
23832 + 550-If it was a legitimate message, it may still be |
|
23833 + 550 delivered to the target recipient(s). |
|
23834 + |
|
23835 + This facility should be used with extreme caution. |
|
23836 + |
|
23837 +control = freeze |
|
23838 + |
|
23839 + This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, |
|
23840 + in other words, only when a message is being received. If the message is |
|
23841 + accepted, it is placed on Exim's queue and frozen. The control applies only |
|
23842 + to the current message, not to any subsequent ones that may be received in |
|
23843 + the same SMTP connection. |
|
23844 + |
|
23845 + This modifier can optionally be followed by "/no_tell". If the global |
|
23846 + option freeze_tell is set, it is ignored for the current message (that is, |
|
23847 + nobody is told about the freezing), provided all the control=freeze |
|
23848 + modifiers that are obeyed for the current message have the "/no_tell" |
|
23849 + option. |
|
23850 + |
|
23851 +control = no_delay_flush |
|
23852 + |
|
23853 + Exim normally flushes SMTP output before implementing a delay in an ACL, to |
|
23854 + avoid unexpected timeouts in clients when the SMTP PIPELINING extension is |
|
23855 + in use. This control, as long as it is encountered before the delay |
|
23856 + modifier, disables such output flushing. |
|
23857 + |
|
23858 +control = no_callout_flush |
|
23859 + |
|
23860 + Exim normally flushes SMTP output before performing a callout in an ACL, to |
|
23861 + avoid unexpected timeouts in clients when the SMTP PIPELINING extension is |
|
23862 + in use. This control, as long as it is encountered before the verify |
|
23863 + condition that causes the callout, disables such output flushing. |
|
23864 + |
|
23865 +control = no_mbox_unspool |
|
23866 + |
|
23867 + This control is available when Exim is compiled with the content scanning |
|
23868 + extension. Content scanning may require a copy of the current message, or |
|
23869 + parts of it, to be written in "mbox format" to a spool file, for passing to |
|
23870 + a virus or spam scanner. Normally, such copies are deleted when they are no |
|
23871 + longer needed. If this control is set, the copies are not deleted. The |
|
23872 + control applies only to the current message, not to any subsequent ones |
|
23873 + that may be received in the same SMTP connection. It is provided for |
|
23874 + debugging purposes and is unlikely to be useful in production. |
|
23875 + |
|
23876 +control = no_multiline_responses |
|
23877 + |
|
23878 + This control is permitted for any ACL except the one for non-SMTP messages. |
|
23879 + It seems that there are broken clients in use that cannot handle multiline |
|
23880 + SMTP responses, despite the fact that RFC 821 defined them over 20 years |
|
23881 + ago. |
|
23882 + |
|
23883 + If this control is set, multiline SMTP responses from ACL rejections are |
|
23884 + suppressed. One way of doing this would have been to put out these |
|
23885 + responses as one long line. However, RFC 2821 specifies a maximum of 512 |
|
23886 + bytes per response ("use multiline responses for more" it says - ha!), and |
|
23887 + some of the responses might get close to that. So this facility, which is |
|
23888 + after all only a sop to broken clients, is implemented by doing two very |
|
23889 + easy things: |
|
23890 + |
|
23891 + * Extra information that is normally output as part of a rejection caused |
|
23892 + by sender verification failure is omitted. Only the final line |
|
23893 + (typically "sender verification failed") is sent. |
|
23894 + |
|
23895 + * If a message modifier supplies a multiline response, only the first |
|
23896 + line is output. |
|
23897 + |
|
23898 + The setting of the switch can, of course, be made conditional on the |
|
23899 + calling host. Its effect lasts until the end of the SMTP connection. |
|
23900 + |
|
23901 +control = no_pipelining |
|
23902 + |
|
23903 + This control turns off the advertising of the PIPELINING extension to SMTP |
|
23904 + in the current session. To be useful, it must be obeyed before Exim sends |
|
23905 + its response to an EHLO command. Therefore, it should normally appear in an |
|
23906 + ACL controlled by acl_smtp_connect or acl_smtp_helo. See also |
|
23907 + pipelining_advertise_hosts. |
|
23908 + |
|
23909 +control = queue_only |
|
23910 + |
|
23911 + This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, |
|
23912 + in other words, only when a message is being received. If the message is |
|
23913 + accepted, it is placed on Exim's queue and left there for delivery by a |
|
23914 + subsequent queue runner. No immediate delivery process is started. In other |
|
23915 + words, it has the effect as the queue_only global option. However, the |
|
23916 + control applies only to the current message, not to any subsequent ones |
|
23917 + that may be received in the same SMTP connection. |
|
23918 + |
|
23919 +control = submission/<options> |
|
23920 + |
|
23921 + This control is permitted only for the MAIL, RCPT, and start of data ACLs |
|
23922 + (the latter is the one defined by acl_smtp_predata). Setting it tells Exim |
|
23923 + that the current message is a submission from a local MUA. In this case, |
|
23924 + Exim operates in "submission mode", and applies certain fixups to the |
|
23925 + message if necessary. For example, it adds a Date: header line if one is |
|
23926 + not present. This control is not permitted in the acl_smtp_data ACL, |
|
23927 + because that is too late (the message has already been created). |
|
23928 + |
|
23929 + Chapter 44 describes the processing that Exim applies to messages. Section |
|
23930 + 44.1 covers the processing that happens in submission mode; the available |
|
23931 + options for this control are described there. The control applies only to |
|
23932 + the current message, not to any subsequent ones that may be received in the |
|
23933 + same SMTP connection. |
|
23934 + |
|
23935 +control = suppress_local_fixups |
|
23936 + |
|
23937 + This control applies to locally submitted (non TCP/IP) messages, and is the |
|
23938 + complement of "control = submission". It disables the fixups that are |
|
23939 + normally applied to locally-submitted messages. Specifically: |
|
23940 + |
|
23941 + * Any Sender: header line is left alone (in this respect, it is a dynamic |
|
23942 + version of local_sender_retain). |
|
23943 + |
|
23944 + * No Message-ID:, From:, or Date: header lines are added. |
|
23945 + |
|
23946 + * There is no check that From: corresponds to the actual sender. |
|
23947 + |
|
23948 + This control may be useful when a remotely-originated message is accepted, |
|
23949 + passed to some scanning program, and then re-submitted for delivery. It can |
|
23950 + be used only in the acl_smtp_mail, acl_smtp_rcpt, acl_smtp_predata, and |
|
23951 + acl_not_smtp_start ACLs, because it has to be set before the message's data |
|
23952 + is read. |
|
23953 + |
|
23954 + Note: This control applies only to the current message, not to any others |
|
23955 + that are being submitted at the same time using -bs or -bS. |
|
23956 + |
|
23957 +40.22Â Summary of message fixup control |
|
23958 + |
|
23959 +All four possibilities for message fixups can be specified: |
|
23960 + |
|
23961 + * Locally submitted, fixups applied: the default. |
|
23962 + |
|
23963 + * Locally submitted, no fixups applied: use "control = |
|
23964 + suppress_local_fixups". |
|
23965 + |
|
23966 + * Remotely submitted, no fixups applied: the default. |
|
23967 + |
|
23968 + * Remotely submitted, fixups applied: use "control = submission". |
|
23969 + |
|
23970 +40.23Â Adding header lines in ACLs |
|
23971 + |
|
23972 +The add_header modifier can be used to add one or more extra header lines to an |
|
23973 +incoming message, as in this example: |
|
23974 + |
|
23975 +warn dnslists = sbl.spamhaus.org : \ |
|
23976 + dialup.mail-abuse.org |
|
23977 + add_header = X-blacklisted-at: $dnslist_domain |
|
23978 + |
|
23979 +The add_header modifier is permitted in the MAIL, RCPT, PREDATA, DATA, MIME, |
|
23980 +and non-SMTP ACLs (in other words, those that are concerned with receiving a |
|
23981 +message). The message must ultimately be accepted for add_header to have any |
|
23982 +significant effect. You can use add_header with any ACL verb, including deny |
|
23983 +(though this is potentially useful only in a RCPT ACL). |
|
23984 + |
|
23985 +If the data for the add_header modifier contains one or more newlines that are |
|
23986 +not followed by a space or a tab, it is assumed to contain multiple header |
|
23987 +lines. Each one is checked for valid syntax; "X-ACL-Warn:" is added to the |
|
23988 +front of any line that is not a valid header line. |
|
23989 + |
|
23990 +Added header lines are accumulated during the MAIL, RCPT, and predata ACLs. |
|
23991 +They are added to the message before processing the DATA and MIME ACLs. |
|
23992 +However, if an identical header line is requested more than once, only one copy |
|
23993 +is actually added to the message. Further header lines may be accumulated |
|
23994 +during the DATA and MIME ACLs, after which they are added to the message, again |
|
23995 +with duplicates suppressed. Thus, it is possible to add two identical header |
|
23996 +lines to an SMTP message, but only if one is added before DATA and one after. |
|
23997 +In the case of non-SMTP messages, new headers are accumulated during the |
|
23998 +non-SMTP ACLs, and are added to the message after all the ACLs have run. If a |
|
23999 +message is rejected after DATA or by the non-SMTP ACL, all added header lines |
|
24000 +are included in the entry that is written to the reject log. |
|
24001 + |
|
24002 +Header lines are not visible in string expansions until they are added to the |
|
24003 +message. It follows that header lines defined in the MAIL, RCPT, and predata |
|
24004 +ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly, |
|
24005 +header lines that are added by the DATA or MIME ACLs are not visible in those |
|
24006 +ACLs. Because of this restriction, you cannot use header lines as a way of |
|
24007 +passing data between (for example) the MAIL and RCPT ACLs. If you want to do |
|
24008 +this, you can use ACL variables, as described in section 40.18. |
|
24009 + |
|
24010 +The add_header modifier acts immediately it is encountered during the |
|
24011 +processing of an ACL. Notice the difference between these two cases: |
|
24012 + |
|
24013 +accept add_header = ADDED: some text |
|
24014 +       <some condition> |
|
24015 + |
|
24016 +accept <some condition> |
|
24017 +       add_header = ADDED: some text |
|
24018 + |
|
24019 +In the first case, the header line is always added, whether or not the |
|
24020 +condition is true. In the second case, the header line is added only if the |
|
24021 +condition is true. Multiple occurrences of add_header may occur in the same ACL |
|
24022 +statement. All those that are encountered before a condition fails are |
|
24023 +honoured. |
|
24024 + |
|
24025 +For compatibility with previous versions of Exim, a message modifier for a warn |
|
24026 +verb acts in the same way as add_header, except that it takes effect only if |
|
24027 +all the conditions are true, even if it appears before some of them. |
|
24028 +Furthermore, only the last occurrence of message is honoured. This usage of |
|
24029 +message is now deprecated. If both add_header and message are present on a warn |
|
24030 +verb, both are processed according to their specifications. |
|
24031 + |
|
24032 +By default, new header lines are added to a message at the end of the existing |
|
24033 +header lines. However, you can specify that any particular header line should |
|
24034 +be added right at the start (before all the Received: lines), immediately after |
|
24035 +the first block of Received: lines, or immediately before any line that is not |
|
24036 +a Received: or Resent-something: header. |
|
24037 + |
|
24038 +This is done by specifying ":at_start:", ":after_received:", or |
|
24039 +":at_start_rfc:" (or, for completeness, ":at_end:") before the text of the |
|
24040 +header line, respectively. (Header text cannot start with a colon, as there has |
|
24041 +to be a header name first.) For example: |
|
24042 + |
|
24043 +warn add_header = \ |
|
24044 + :after_received:X-My-Header: something or other... |
|
24045 + |
|
24046 +If more than one header line is supplied in a single add_header modifier, each |
|
24047 +one is treated independently and can therefore be placed differently. If you |
|
24048 +add more than one line at the start, or after the Received: block, they end up |
|
24049 +in reverse order. |
|
24050 + |
|
24051 +Warning: This facility currently applies only to header lines that are added in |
|
24052 +an ACL. It does NOT work for header lines that are added in a system filter or |
|
24053 +in a router or transport. |
|
24054 + |
|
24055 +40.24Â ACL conditions |
|
24056 + |
|
24057 +Some of conditions listed in this section are available only when Exim is |
|
24058 +compiled with the content-scanning extension. They are included here briefly |
|
24059 +for completeness. More detailed descriptions can be found in the discussion on |
|
24060 +content scanning in chapter 41. |
|
24061 + |
|
24062 +Not all conditions are relevant in all circumstances. For example, testing |
|
24063 +senders and recipients does not make sense in an ACL that is being run as the |
|
24064 +result of the arrival of an ETRN command, and checks on message headers can be |
|
24065 +done only in the ACLs specified by acl_smtp_data and acl_not_smtp. You can use |
|
24066 +the same condition (with different parameters) more than once in the same ACL |
|
24067 +statement. This provides a way of specifying an "and" conjunction. The |
|
24068 +conditions are as follows: |
|
24069 + |
|
24070 +acl = <name of acl or ACL string or file name > |
|
24071 + |
|
24072 + The possible values of the argument are the same as for the acl_smtp_xxx |
|
24073 + options. The named or inline ACL is run. If it returns "accept" the |
|
24074 + condition is true; if it returns "deny" the condition is false. If it |
|
24075 + returns "defer", the current ACL returns "defer" unless the condition is on |
|
24076 + a warn verb. In that case, a "defer" return makes the condition false. This |
|
24077 + means that further processing of the warn verb ceases, but processing of |
|
24078 + the ACL continues. |
|
24079 + |
|
24080 + If the nested acl returns "drop" and the outer condition denies access, the |
|
24081 + connection is dropped. If it returns "discard", the verb must be accept or |
|
24082 + discard, and the action is taken immediately - no further conditions are |
|
24083 + tested. |
|
24084 + |
|
24085 + ACLs may be nested up to 20 deep; the limit exists purely to catch runaway |
|
24086 + loops. This condition allows you to use different ACLs in different |
|
24087 + circumstances. For example, different ACLs can be used to handle RCPT |
|
24088 + commands for different local users or different local domains. |
|
24089 + |
|
24090 +authenticated = <string list> |
|
24091 + |
|
24092 + If the SMTP connection is not authenticated, the condition is false. |
|
24093 + Otherwise, the name of the authenticator is tested against the list. To |
|
24094 + test for authentication by any authenticator, you can set |
|
24095 + |
|
24096 + authenticated = * |
|
24097 + |
|
24098 +condition = <string> |
|
24099 + |
|
24100 + This feature allows you to make up custom conditions. If the result of |
|
24101 + expanding the string is an empty string, the number zero, or one of the |
|
24102 + strings "no" or "false", the condition is false. If the result is any |
|
24103 + non-zero number, or one of the strings "yes" or "true", the condition is |
|
24104 + true. For any other value, some error is assumed to have occurred, and the |
|
24105 + ACL returns "defer". However, if the expansion is forced to fail, the |
|
24106 + condition is ignored. The effect is to treat it as true, whether it is |
|
24107 + positive or negative. |
|
24108 + |
|
24109 +decode = <location> |
|
24110 + |
|
24111 + This condition is available only when Exim is compiled with the |
|
24112 + content-scanning extension, and it is allowed only in the ACL defined by |
|
24113 + acl_smtp_mime. It causes the current MIME part to be decoded into a file. |
|
24114 + If all goes well, the condition is true. It is false only if there are |
|
24115 + problems such as a syntax error or a memory shortage. For more details, see |
|
24116 + chapter 41. |
|
24117 + |
|
24118 +demime = <extension list> |
|
24119 + |
|
24120 + This condition is available only when Exim is compiled with the |
|
24121 + content-scanning extension. Its use is described in section 41.6. |
|
24122 + |
|
24123 +dnslists = <list of domain names and other data> |
|
24124 + |
|
24125 + This condition checks for entries in DNS black lists. These are also known |
|
24126 + as "RBL lists", after the original Realtime Blackhole List, but note that |
|
24127 + the use of the lists at mail-abuse.org now carries a charge. There are too |
|
24128 + many different variants of this condition to describe briefly here. See |
|
24129 + sections 40.25-40.35 for details. |
|
24130 + |
|
24131 +domains = <domain list> |
|
24132 + |
|
24133 + This condition is relevant only after a RCPT command. It checks that the |
|
24134 + domain of the recipient address is in the domain list. If percent-hack |
|
24135 + processing is enabled, it is done before this test is done. If the check |
|
24136 + succeeds with a lookup, the result of the lookup is placed in $domain_data |
|
24137 + until the next domains test. |
|
24138 + |
|
24139 + Note carefully (because many people seem to fall foul of this): you cannot |
|
24140 + use domains in a DATA ACL. |
|
24141 + |
|
24142 +encrypted = <string list> |
|
24143 + |
|
24144 + If the SMTP connection is not encrypted, the condition is false. Otherwise, |
|
24145 + the name of the cipher suite in use is tested against the list. To test for |
|
24146 + encryption without testing for any specific cipher suite(s), set |
|
24147 + |
|
24148 + encrypted = * |
|
24149 + |
|
24150 +hosts = < host list> |
|
24151 + |
|
24152 + This condition tests that the calling host matches the host list. If you |
|
24153 + have name lookups or wildcarded host names and IP addresses in the same |
|
24154 + host list, you should normally put the IP addresses first. For example, you |
|
24155 + could have: |
|
24156 + |
|
24157 + accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts |
|
24158 + |
|
24159 + The lookup in this example uses the host name for its key. This is implied |
|
24160 + by the lookup type "dbm". (For a host address lookup you would use |
|
24161 + "net-dbm" and it wouldn't matter which way round you had these two items.) |
|
24162 + |
|
24163 + The reason for the problem with host names lies in the left-to-right way |
|
24164 + that Exim processes lists. It can test IP addresses without doing any DNS |
|
24165 + lookups, but when it reaches an item that requires a host name, it fails if |
|
24166 + it cannot find a host name to compare with the pattern. If the above list |
|
24167 + is given in the opposite order, the accept statement fails for a host whose |
|
24168 + name cannot be found, even if its IP address is 10.9.8.7. |
|
24169 + |
|
24170 + If you really do want to do the name check first, and still recognize the |
|
24171 + IP address even if the name lookup fails, you can rewrite the ACL like |
|
24172 + this: |
|
24173 + |
|
24174 + accept hosts = dbm;/etc/friendly/hosts |
|
24175 + accept hosts = 10.9.8.7 |
|
24176 + |
|
24177 + The default action on failing to find the host name is to assume that the |
|
24178 + host is not in the list, so the first accept statement fails. The second |
|
24179 + statement can then check the IP address. |
|
24180 + |
|
24181 + If a hosts condition is satisfied by means of a lookup, the result of the |
|
24182 + lookup is made available in the $host_data variable. This allows you, for |
|
24183 + example, to set up a statement like this: |
|
24184 + |
|
24185 + deny hosts = net-lsearch;/some/file |
|
24186 + message = $host_data |
|
24187 + |
|
24188 + which gives a custom error message for each denied host. |
|
24189 + |
|
24190 +local_parts = <local part list> |
|
24191 + |
|
24192 + This condition is relevant only after a RCPT command. It checks that the |
|
24193 + local part of the recipient address is in the list. If percent-hack |
|
24194 + processing is enabled, it is done before this test. If the check succeeds |
|
24195 + with a lookup, the result of the lookup is placed in $local_part_data, |
|
24196 + which remains set until the next local_parts test. |
|
24197 + |
|
24198 +malware = <option> |
|
24199 + |
|
24200 + This condition is available only when Exim is compiled with the |
|
24201 + content-scanning extension. It causes the incoming message to be scanned |
|
24202 + for viruses. For details, see chapter 41. |
|
24203 + |
|
24204 +mime_regex = <list of regular expressions> |
|
24205 + |
|
24206 + This condition is available only when Exim is compiled with the |
|
24207 + content-scanning extension, and it is allowed only in the ACL defined by |
|
24208 + acl_smtp_mime. It causes the current MIME part to be scanned for a match |
|
24209 + with any of the regular expressions. For details, see chapter 41. |
|
24210 + |
|
24211 +ratelimit = <parameters> |
|
24212 + |
|
24213 + This condition can be used to limit the rate at which a user or host |
|
24214 + submits messages. Details are given in section 40.36. |
|
24215 + |
|
24216 +recipients = <address list> |
|
24217 + |
|
24218 + This condition is relevant only after a RCPT command. It checks the entire |
|
24219 + recipient address against a list of recipients. |
|
24220 + |
|
24221 +regex = <list of regular expressions> |
|
24222 + |
|
24223 + This condition is available only when Exim is compiled with the |
|
24224 + content-scanning extension, and is available only in the DATA, MIME, and |
|
24225 + non-SMTP ACLs. It causes the incoming message to be scanned for a match |
|
24226 + with any of the regular expressions. For details, see chapter 41. |
|
24227 + |
|
24228 +sender_domains = <domain list> |
|
24229 + |
|
24230 + This condition tests the domain of the sender of the message against the |
|
24231 + given domain list. Note: The domain of the sender address is in |
|
24232 + $sender_address_domain. It is not put in $domain during the testing of this |
|
24233 + condition. This is an exception to the general rule for testing domain |
|
24234 + lists. It is done this way so that, if this condition is used in an ACL for |
|
24235 + a RCPT command, the recipient's domain (which is in $domain) can be used to |
|
24236 + influence the sender checking. |
|
24237 + |
|
24238 + Warning: It is a bad idea to use this condition on its own as a control on |
|
24239 + relaying, because sender addresses are easily, and commonly, forged. |
|
24240 + |
|
24241 +senders = <address list> |
|
24242 + |
|
24243 + This condition tests the sender of the message against the given list. To |
|
24244 + test for a bounce message, which has an empty sender, set |
|
24245 + |
|
24246 + senders = : |
|
24247 + |
|
24248 + Warning: It is a bad idea to use this condition on its own as a control on |
|
24249 + relaying, because sender addresses are easily, and commonly, forged. |
|
24250 + |
|
24251 +spam = <username> |
|
24252 + |
|
24253 + This condition is available only when Exim is compiled with the |
|
24254 + content-scanning extension. It causes the incoming message to be scanned by |
|
24255 + SpamAssassin. For details, see chapter 41. |
|
24256 + |
|
24257 +verify = certificate |
|
24258 + |
|
24259 + This condition is true in an SMTP session if the session is encrypted, and |
|
24260 + a certificate was received from the client, and the certificate was |
|
24261 + verified. The server requests a certificate only if the client matches |
|
24262 + tls_verify_hosts or tls_try_verify_hosts (see chapter 39). |
|
24263 + |
|
24264 +verify = csa |
|
24265 + |
|
24266 + This condition checks whether the sending host (the client) is authorized |
|
24267 + to send email. Details of how this works are given in section 40.47. |
|
24268 + |
|
24269 +verify = header_sender/<options> |
|
24270 + |
|
24271 + This condition is relevant only in an ACL that is run after a message has |
|
24272 + been received, that is, in an ACL specified by acl_smtp_data or |
|
24273 + acl_not_smtp. It checks that there is a verifiable address in at least one |
|
24274 + of the Sender:, Reply-To:, or From: header lines. Such an address is |
|
24275 + loosely thought of as a "sender" address (hence the name of the test). |
|
24276 + However, an address that appears in one of these headers need not be an |
|
24277 + address that accepts bounce messages; only sender addresses in envelopes |
|
24278 + are required to accept bounces. Therefore, if you use the callout option on |
|
24279 + this check, you might want to arrange for a non-empty address in the MAIL |
|
24280 + command. |
|
24281 + |
|
24282 + Details of address verification and the options are given later, starting |
|
24283 + at section 40.41 (callouts are described in section 40.42). You can combine |
|
24284 + this condition with the senders condition to restrict it to bounce messages |
|
24285 + only: |
|
24286 + |
|
24287 + deny senders = : |
|
24288 + message = A valid sender header is required for bounces |
|
24289 + !verify = header_sender |
|
24290 + |
|
24291 +verify = header_syntax |
|
24292 + |
|
24293 + This condition is relevant only in an ACL that is run after a message has |
|
24294 + been received, that is, in an ACL specified by acl_smtp_data or |
|
24295 + acl_not_smtp. It checks the syntax of all header lines that can contain |
|
24296 + lists of addresses (Sender:, From:, Reply-To:, To:, Cc:, and Bcc:). |
|
24297 + Unqualified addresses (local parts without domains) are permitted only in |
|
24298 + locally generated messages and from hosts that match |
|
24299 + sender_unqualified_hosts or recipient_unqualified_hosts, as appropriate. |
|
24300 + |
|
24301 + Note that this condition is a syntax check only. However, a common spamming |
|
24302 + ploy used to be to send syntactically invalid headers such as |
|
24303 + |
|
24304 + To: @ |
|
24305 + |
|
24306 + and this condition can be used to reject such messages, though they are not |
|
24307 + as common as they used to be. |
|
24308 + |
|
24309 +verify = helo |
|
24310 + |
|
24311 + This condition is true if a HELO or EHLO command has been received from the |
|
24312 + client host, and its contents have been verified. If there has been no |
|
24313 + previous attempt to verify the HELO/EHLO contents, it is carried out when |
|
24314 + this condition is encountered. See the description of the helo_verify_hosts |
|
24315 + and helo_try_verify_hosts options for details of how to request |
|
24316 + verification independently of this condition. |
|
24317 + |
|
24318 + For SMTP input that does not come over TCP/IP (the -bs command line |
|
24319 + option), this condition is always true. |
|
24320 + |
|
24321 +verify = not_blind |
|
24322 + |
|
24323 + This condition checks that there are no blind (bcc) recipients in the |
|
24324 + message. Every envelope recipient must appear either in a To: header line |
|
24325 + or in a Cc: header line for this condition to be true. Local parts are |
|
24326 + checked case-sensitively; domains are checked case-insensitively. If |
|
24327 + Resent-To: or Resent-Cc: header lines exist, they are also checked. This |
|
24328 + condition can be used only in a DATA or non-SMTP ACL. |
|
24329 + |
|
24330 + There are, of course, many legitimate messages that make use of blind (bcc) |
|
24331 + recipients. This check should not be used on its own for blocking messages. |
|
24332 + |
|
24333 +verify = recipient/<options> |
|
24334 + |
|
24335 + This condition is relevant only after a RCPT command. It verifies the |
|
24336 + current recipient. Details of address verification are given later, |
|
24337 + starting at section 40.41. After a recipient has been verified, the value |
|
24338 + of $address_data is the last value that was set while routing the address. |
|
24339 + This applies even if the verification fails. When an address that is being |
|
24340 + verified is redirected to a single address, verification continues with the |
|
24341 + new address, and in that case, the subsequent value of $address_data is the |
|
24342 + value for the child address. |
|
24343 + |
|
24344 +verify = reverse_host_lookup |
|
24345 + |
|
24346 + This condition ensures that a verified host name has been looked up from |
|
24347 + the IP address of the client host. (This may have happened already if the |
|
24348 + host name was needed for checking a host list, or if the host matched |
|
24349 + host_lookup.) Verification ensures that the host name obtained from a |
|
24350 + reverse DNS lookup, or one of its aliases, does, when it is itself looked |
|
24351 + up in the DNS, yield the original IP address. |
|
24352 + |
|
24353 + If this condition is used for a locally generated message (that is, when |
|
24354 + there is no client host involved), it always succeeds. |
|
24355 + |
|
24356 +verify = sender/<options> |
|
24357 + |
|
24358 + This condition is relevant only after a MAIL or RCPT command, or after a |
|
24359 + message has been received (the acl_smtp_data or acl_not_smtp ACLs). If the |
|
24360 + message's sender is empty (that is, this is a bounce message), the |
|
24361 + condition is true. Otherwise, the sender address is verified. |
|
24362 + |
|
24363 + If there is data in the $address_data variable at the end of routing, its |
|
24364 + value is placed in $sender_address_data at the end of verification. This |
|
24365 + value can be used in subsequent conditions and modifiers in the same ACL |
|
24366 + statement. It does not persist after the end of the current statement. If |
|
24367 + you want to preserve the value for longer, you can save it in an ACL |
|
24368 + variable. |
|
24369 + |
|
24370 + Details of verification are given later, starting at section 40.41. Exim |
|
24371 + caches the result of sender verification, to avoid doing it more than once |
|
24372 + per message. |
|
24373 + |
|
24374 +verify = sender=<address>/<options> |
|
24375 + |
|
24376 + This is a variation of the previous option, in which a modified address is |
|
24377 + verified as a sender. |
|
24378 + |
|
24379 +40.25Â Using DNS lists |
|
24380 + |
|
24381 +In its simplest form, the dnslists condition tests whether the calling host is |
|
24382 +on at least one of a number of DNS lists by looking up the inverted IP address |
|
24383 +in one or more DNS domains. (Note that DNS list domains are not mail domains, |
|
24384 +so the "+" syntax for named lists doesn't work - it is used for special options |
|
24385 +instead.) For example, if the calling host's IP address is 192.168.62.43, and |
|
24386 +the ACL statement is |
|
24387 + |
|
24388 +deny dnslists = blackholes.mail-abuse.org : \ |
|
24389 + dialups.mail-abuse.org |
|
24390 + |
|
24391 +the following records are looked up: |
|
24392 + |
|
24393 +43.62.168.192.blackholes.mail-abuse.org |
|
24394 +43.62.168.192.dialups.mail-abuse.org |
|
24395 + |
|
24396 +As soon as Exim finds an existing DNS record, processing of the list stops. |
|
24397 +Thus, multiple entries on the list provide an "or" conjunction. If you want to |
|
24398 +test that a host is on more than one list (an "and" conjunction), you can use |
|
24399 +two separate conditions: |
|
24400 + |
|
24401 +deny dnslists = blackholes.mail-abuse.org |
|
24402 + dnslists = dialups.mail-abuse.org |
|
24403 + |
|
24404 +If a DNS lookup times out or otherwise fails to give a decisive answer, Exim |
|
24405 +behaves as if the host does not match the list item, that is, as if the DNS |
|
24406 +record does not exist. If there are further items in the DNS list, they are |
|
24407 +processed. |
|
24408 + |
|
24409 +This is usually the required action when dnslists is used with deny (which is |
|
24410 +the most common usage), because it prevents a DNS failure from blocking mail. |
|
24411 +However, you can change this behaviour by putting one of the following special |
|
24412 +items in the list: |
|
24413 + |
|
24414 ++include_unknown    behave as if the item is on the list |
|
24415 ++exclude_unknown    behave as if the item is not on the list |
|
24416 +(default) |
|
24417 ++defer_unknown      give a temporary error |
|
24418 + |
|
24419 +Each of these applies to any subsequent items on the list. For example: |
|
24420 + |
|
24421 +deny dnslists = +defer_unknown : foo.bar.example |
|
24422 + |
|
24423 +Testing the list of domains stops as soon as a match is found. If you want to |
|
24424 +warn for one list and block for another, you can use two different statements: |
|
24425 + |
|
24426 +deny dnslists = blackholes.mail-abuse.org |
|
24427 +warn message = X-Warn: sending host is on dialups list |
|
24428 + dnslists = dialups.mail-abuse.org |
|
24429 + |
|
24430 +DNS list lookups are cached by Exim for the duration of the SMTP session, so a |
|
24431 +lookup based on the IP address is done at most once for any incoming |
|
24432 +connection. Exim does not share information between multiple incoming |
|
24433 +connections (but your local name server cache should be active). |
|
24434 + |
|
24435 +40.26Â Specifying the IP address for a DNS list lookup |
|
24436 + |
|
24437 +By default, the IP address that is used in a DNS list lookup is the IP address |
|
24438 +of the calling host. However, you can specify another IP address by listing it |
|
24439 +after the domain name, introduced by a slash. For example: |
|
24440 + |
|
24441 +deny dnslists = black.list.tld/192.168.1.2 |
|
24442 + |
|
24443 +This feature is not very helpful with explicit IP addresses; it is intended for |
|
24444 +use with IP addresses that are looked up, for example, the IP addresses of the |
|
24445 +MX hosts or nameservers of an email sender address. For an example, see section |
|
24446 +40.28 below. |
|
24447 + |
|
24448 +40.27Â DNS lists keyed on domain names |
|
24449 + |
|
24450 +There are some lists that are keyed on domain names rather than inverted IP |
|
24451 +addresses (see for example the domain based zones link at http:// |
|
24452 +www.rfc-ignorant.org/). No reversing of components is used with these lists. |
|
24453 +You can change the name that is looked up in a DNS list by listing it after the |
|
24454 +domain name, introduced by a slash. For example, |
|
24455 + |
|
24456 +deny message = Sender's domain is listed at $dnslist_domain |
|
24457 + dnslists = dsn.rfc-ignorant.org/$sender_address_domain |
|
24458 + |
|
24459 +This particular example is useful only in ACLs that are obeyed after the RCPT |
|
24460 +or DATA commands, when a sender address is available. If (for example) the |
|
24461 +message's sender is user@tld.example the name that is looked up by this example |
|
24462 +is |
|
24463 + |
|
24464 +tld.example.dsn.rfc-ignorant.org |
|
24465 + |
|
24466 +A single dnslists condition can contain entries for both names and IP |
|
24467 +addresses. For example: |
|
24468 + |
|
24469 +deny dnslists = sbl.spamhaus.org : \ |
|
24470 + dsn.rfc-ignorant.org/$sender_address_domain |
|
24471 + |
|
24472 +The first item checks the sending host's IP address; the second checks a domain |
|
24473 +name. The whole condition is true if either of the DNS lookups succeeds. |
|
24474 + |
|
24475 +40.28Â Multiple explicit keys for a DNS list |
|
24476 + |
|
24477 +The syntax described above for looking up explicitly-defined values (either |
|
24478 +names or IP addresses) in a DNS blacklist is a simplification. After the domain |
|
24479 +name for the DNS list, what follows the slash can in fact be a list of items. |
|
24480 +As with all lists in Exim, the default separator is a colon. However, because |
|
24481 +this is a sublist within the list of DNS blacklist domains, it is necessary |
|
24482 +either to double the separators like this: |
|
24483 + |
|
24484 +dnslists = black.list.tld/name.1::name.2 |
|
24485 + |
|
24486 +or to change the separator character, like this: |
|
24487 + |
|
24488 +dnslists = black.list.tld/<;name.1;name.2 |
|
24489 + |
|
24490 +If an item in the list is an IP address, it is inverted before the DNS |
|
24491 +blacklist domain is appended. If it is not an IP address, no inversion occurs. |
|
24492 +Consider this condition: |
|
24493 + |
|
24494 +dnslists = black.list.tld/<;192.168.1.2;a.domain |
|
24495 + |
|
24496 +The DNS lookups that occur are: |
|
24497 + |
|
24498 +2.1.168.192.black.list.tld |
|
24499 +a.domain.black.list.tld |
|
24500 + |
|
24501 +Once a DNS record has been found (that matches a specific IP return address, if |
|
24502 +specified - see section 40.31), no further lookups are done. If there is a |
|
24503 +temporary DNS error, the rest of the sublist of domains or IP addresses is |
|
24504 +tried. A temporary error for the whole dnslists item occurs only if no other |
|
24505 +DNS lookup in this sublist succeeds. In other words, a successful lookup for |
|
24506 +any of the items in the sublist overrides a temporary error for a previous |
|
24507 +item. |
|
24508 + |
|
24509 +The ability to supply a list of items after the slash is in some sense just a |
|
24510 +syntactic convenience. These two examples have the same effect: |
|
24511 + |
|
24512 +dnslists = black.list.tld/a.domain : black.list.tld/b.domain |
|
24513 +dnslists = black.list.tld/a.domain::b.domain |
|
24514 + |
|
24515 +However, when the data for the list is obtained from a lookup, the second form |
|
24516 +is usually much more convenient. Consider this example: |
|
24517 + |
|
24518 +deny message = The mail servers for the domain \ |
|
24519 + $sender_address_domain \ |
|
24520 + are listed at $dnslist_domain ($dnslist_value); \ |
|
24521 + see $dnslist_text. |
|
24522 + dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\ |
|
24523 + ${lookup dnsdb {>|mxh=\ |
|
24524 + $sender_address_domain} }} } |
|
24525 + |
|
24526 +Note the use of ">|" in the dnsdb lookup to specify the separator for multiple |
|
24527 +DNS records. The inner dnsdb lookup produces a list of MX hosts and the outer |
|
24528 +dnsdb lookup finds the IP addresses for these hosts. The result of expanding |
|
24529 +the condition might be something like this: |
|
24530 + |
|
24531 +dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|... |
|
24532 + |
|
24533 +Thus, this example checks whether or not the IP addresses of the sender |
|
24534 +domain's mail servers are on the Spamhaus black list. |
|
24535 + |
|
24536 +The key that was used for a successful DNS list lookup is put into the variable |
|
24537 +$dnslist_matched (see section 40.30). |
|
24538 + |
|
24539 +40.29Â Data returned by DNS lists |
|
24540 + |
|
24541 +DNS lists are constructed using address records in the DNS. The original RBL |
|
24542 +just used the address 127.0.0.1 on the right hand side of each record, but the |
|
24543 +RBL+ list and some other lists use a number of values with different meanings. |
|
24544 +The values used on the RBL+ list are: |
|
24545 + |
|
24546 +127.1.0.1Â Â RBL |
|
24547 +127.1.0.2Â Â DUL |
|
24548 +127.1.0.3  DUL and RBL |
|
24549 +127.1.0.4Â Â RSS |
|
24550 +127.1.0.5  RSS and RBL |
|
24551 +127.1.0.6  RSS and DUL |
|
24552 +127.1.0.7  RSS and DUL and RBL |
|
24553 + |
|
24554 +Section 40.31 below describes how you can distinguish between different values. |
|
24555 +Some DNS lists may return more than one address record; see section 40.33 for |
|
24556 +details of how they are checked. |
|
24557 + |
|
24558 +40.30Â Variables set from DNS lists |
|
24559 + |
|
24560 +When an entry is found in a DNS list, the variable $dnslist_domain contains the |
|
24561 +name of the overall domain that matched (for example, "spamhaus.example"), |
|
24562 +$dnslist_matched contains the key within that domain (for example, |
|
24563 +"192.168.5.3"), and $dnslist_value contains the data from the DNS record. When |
|
24564 +the key is an IP address, it is not reversed in $dnslist_matched (though it is, |
|
24565 +of course, in the actual lookup). In simple cases, for example: |
|
24566 + |
|
24567 +deny dnslists = spamhaus.example |
|
24568 + |
|
24569 +the key is also available in another variable (in this case, |
|
24570 +$sender_host_address). In more complicated cases, however, this is not true. |
|
24571 +For example, using a data lookup (as described in section 40.28) might generate |
|
24572 +a dnslists lookup like this: |
|
24573 + |
|
24574 +deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|... |
|
24575 + |
|
24576 +If this condition succeeds, the value in $dnslist_matched might be |
|
24577 +"192.168.6.7" (for example). |
|
24578 + |
|
24579 +If more than one address record is returned by the DNS lookup, all the IP |
|
24580 +addresses are included in $dnslist_value, separated by commas and spaces. The |
|
24581 +variable $dnslist_text contains the contents of any associated TXT record. For |
|
24582 +lists such as RBL+ the TXT record for a merged entry is often not very |
|
24583 +meaningful. See section 40.34 for a way of obtaining more information. |
|
24584 + |
|
24585 +You can use the DNS list variables in message or log_message modifiers - |
|
24586 +although these appear before the condition in the ACL, they are not expanded |
|
24587 +until after it has failed. For example: |
|
24588 + |
|
24589 +deny hosts = !+local_networks |
|
24590 + message = $sender_host_address is listed \ |
|
24591 + at $dnslist_domain |
|
24592 + dnslists = rbl-plus.mail-abuse.example |
|
24593 + |
|
24594 +40.31Â Additional matching conditions for DNS lists |
|
24595 + |
|
24596 +You can add an equals sign and an IP address after a dnslists domain name in |
|
24597 +order to restrict its action to DNS records with a matching right hand side. |
|
24598 +For example, |
|
24599 + |
|
24600 +deny dnslists = rblplus.mail-abuse.org=127.0.0.2 |
|
24601 + |
|
24602 +rejects only those hosts that yield 127.0.0.2. Without this additional data, |
|
24603 +any address record is considered to be a match. For the moment, we assume that |
|
24604 +the DNS lookup returns just one record. Section 40.33 describes how multiple |
|
24605 +records are handled. |
|
24606 + |
|
24607 +More than one IP address may be given for checking, using a comma as a |
|
24608 +separator. These are alternatives - if any one of them matches, the dnslists |
|
24609 +condition is true. For example: |
|
24610 + |
|
24611 +deny dnslists = a.b.c=127.0.0.2,127.0.0.3 |
|
24612 + |
|
24613 +If you want to specify a constraining address list and also specify names or IP |
|
24614 +addresses to be looked up, the constraining address list must be specified |
|
24615 +first. For example: |
|
24616 + |
|
24617 +deny dnslists = dsn.rfc-ignorant.org\ |
|
24618 + =127.0.0.2/$sender_address_domain |
|
24619 + |
|
24620 +If the character "&" is used instead of "=", the comparison for each listed IP |
|
24621 +address is done by a bitwise "and" instead of by an equality test. In other |
|
24622 +words, the listed addresses are used as bit masks. The comparison is true if |
|
24623 +all the bits in the mask are present in the address that is being tested. For |
|
24624 +example: |
|
24625 + |
|
24626 +dnslists = a.b.c&0.0.0.3 |
|
24627 + |
|
24628 +matches if the address is x.x.x.3, x.x.x.7, x.x.x.11, etc. If you want to test |
|
24629 +whether one bit or another bit is present (as opposed to both being present), |
|
24630 +you must use multiple values. For example: |
|
24631 + |
|
24632 +dnslists = a.b.c&0.0.0.1,0.0.0.2 |
|
24633 + |
|
24634 +matches if the final component of the address is an odd number or two times an |
|
24635 +odd number. |
|
24636 + |
|
24637 +40.32Â Negated DNS matching conditions |
|
24638 + |
|
24639 +You can supply a negative list of IP addresses as part of a dnslists condition. |
|
24640 +Whereas |
|
24641 + |
|
24642 +deny dnslists = a.b.c=127.0.0.2,127.0.0.3 |
|
24643 + |
|
24644 +means "deny if the host is in the black list at the domain a.b.c and the IP |
|
24645 +address yielded by the list is either 127.0.0.2 or 127.0.0.3", |
|
24646 + |
|
24647 +deny dnslists = a.b.c!=127.0.0.2,127.0.0.3 |
|
24648 + |
|
24649 +means "deny if the host is in the black list at the domain a.b.c and the IP |
|
24650 +address yielded by the list is not 127.0.0.2 and not 127.0.0.3". In other |
|
24651 +words, the result of the test is inverted if an exclamation mark appears before |
|
24652 +the "=" (or the "&") sign. |
|
24653 + |
|
24654 +Note: This kind of negation is not the same as negation in a domain, host, or |
|
24655 +address list (which is why the syntax is different). |
|
24656 + |
|
24657 +If you are using just one list, the negation syntax does not gain you much. The |
|
24658 +previous example is precisely equivalent to |
|
24659 + |
|
24660 +deny dnslists = a.b.c |
|
24661 + !dnslists = a.b.c=127.0.0.2,127.0.0.3 |
|
24662 + |
|
24663 +However, if you are using multiple lists, the negation syntax is clearer. |
|
24664 +Consider this example: |
|
24665 + |
|
24666 +deny dnslists = sbl.spamhaus.org : \ |
|
24667 + list.dsbl.org : \ |
|
24668 + dnsbl.njabl.org!=127.0.0.3 : \ |
|
24669 + relays.ordb.org |
|
24670 + |
|
24671 +Using only positive lists, this would have to be: |
|
24672 + |
|
24673 +deny dnslists = sbl.spamhaus.org : \ |
|
24674 + list.dsbl.org |
|
24675 +deny dnslists = dnsbl.njabl.org |
|
24676 + !dnslists = dnsbl.njabl.org=127.0.0.3 |
|
24677 +deny dnslists = relays.ordb.org |
|
24678 + |
|
24679 +which is less clear, and harder to maintain. |
|
24680 + |
|
24681 +40.33Â Handling multiple DNS records from a DNS list |
|
24682 + |
|
24683 +A DNS lookup for a dnslists condition may return more than one DNS record, |
|
24684 +thereby providing more than one IP address. When an item in a dnslists list is |
|
24685 +followed by "=" or "&" and a list of IP addresses, in order to restrict the |
|
24686 +match to specific results from the DNS lookup, there are two ways in which the |
|
24687 +checking can be handled. For example, consider the condition: |
|
24688 + |
|
24689 +dnslists = a.b.c=127.0.0.1 |
|
24690 + |
|
24691 +What happens if the DNS lookup for the incoming IP address yields both |
|
24692 +127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the condition |
|
24693 +true because at least one given value was found, or is it false because at |
|
24694 +least one of the found values was not listed? And how does this affect negated |
|
24695 +conditions? Both possibilities are provided for with the help of additional |
|
24696 +separators "==" and "=&". |
|
24697 + |
|
24698 + * If "=" or "&" is used, the condition is true if any one of the looked up IP |
|
24699 + addresses matches one of the listed addresses. For the example above, the |
|
24700 + condition is true because 127.0.0.1 matches. |
|
24701 + |
|
24702 + * If "==" or "=&" is used, the condition is true only if every one of the |
|
24703 + looked up IP addresses matches one of the listed addresses. If the |
|
24704 + condition is changed to: |
|
24705 + |
|
24706 + dnslists = a.b.c==127.0.0.1 |
|
24707 + |
|
24708 + and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is |
|
24709 + false because 127.0.0.2 is not listed. You would need to have: |
|
24710 + |
|
24711 + dnslists = a.b.c==127.0.0.1,127.0.0.2 |
|
24712 + |
|
24713 + for the condition to be true. |
|
24714 + |
|
24715 +When "!" is used to negate IP address matching, it inverts the result, giving |
|
24716 +the precise opposite of the behaviour above. Thus: |
|
24717 + |
|
24718 + * If "!=" or "!&" is used, the condition is true if none of the looked up IP |
|
24719 + addresses matches one of the listed addresses. Consider: |
|
24720 + |
|
24721 + dnslists = a.b.c!&0.0.0.1 |
|
24722 + |
|
24723 + If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is |
|
24724 + false because 127.0.0.1 matches. |
|
24725 + |
|
24726 + * If "!==" or "!=&" is used, the condition is true there is at least one |
|
24727 + looked up IP address that does not match. Consider: |
|
24728 + |
|
24729 + dnslists = a.b.c!=&0.0.0.1 |
|
24730 + |
|
24731 + If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is |
|
24732 + true, because 127.0.0.2 does not match. You would need to have: |
|
24733 + |
|
24734 + dnslists = a.b.c!=&0.0.0.1,0.0.0.2 |
|
24735 + |
|
24736 + for the condition to be false. |
|
24737 + |
|
24738 +When the DNS lookup yields only a single IP address, there is no difference |
|
24739 +between "=" and "==" and between "&" and "=&". |
|
24740 + |
|
24741 +40.34Â Detailed information from merged DNS lists |
|
24742 + |
|
24743 +When the facility for restricting the matching IP values in a DNS list is used, |
|
24744 +the text from the TXT record that is set in $dnslist_text may not reflect the |
|
24745 +true reason for rejection. This happens when lists are merged and the IP |
|
24746 +address in the A record is used to distinguish them; unfortunately there is |
|
24747 +only one TXT record. One way round this is not to use merged lists, but that |
|
24748 +can be inefficient because it requires multiple DNS lookups where one would do |
|
24749 +in the vast majority of cases when the host of interest is not on any of the |
|
24750 +lists. |
|
24751 + |
|
24752 +A less inefficient way of solving this problem is available. If two domain |
|
24753 +names, comma-separated, are given, the second is used first to do an initial |
|
24754 +check, making use of any IP value restrictions that are set. If there is a |
|
24755 +match, the first domain is used, without any IP value restrictions, to get the |
|
24756 +TXT record. As a byproduct of this, there is also a check that the IP being |
|
24757 +tested is indeed on the first list. The first domain is the one that is put in |
|
24758 +$dnslist_domain. For example: |
|
24759 + |
|
24760 +reject message = \ |
|
24761 + rejected because $sender_host_address is blacklisted \ |
|
24762 + at $dnslist_domain\n$dnslist_text |
|
24763 + dnslists = \ |
|
24764 + sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \ |
|
24765 + dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10 |
|
24766 + |
|
24767 +For the first blacklist item, this starts by doing a lookup in |
|
24768 +sbl-xbl.spamhaus.org and testing for a 127.0.0.2 return. If there is a match, |
|
24769 +it then looks in sbl.spamhaus.org, without checking the return value, and as |
|
24770 +long as something is found, it looks for the corresponding TXT record. If there |
|
24771 +is no match in sbl-xbl.spamhaus.org, nothing more is done. The second blacklist |
|
24772 +item is processed similarly. |
|
24773 + |
|
24774 +If you are interested in more than one merged list, the same list must be given |
|
24775 +several times, but because the results of the DNS lookups are cached, the DNS |
|
24776 +calls themselves are not repeated. For example: |
|
24777 + |
|
24778 +reject dnslists = \ |
|
24779 + http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \ |
|
24780 + socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \ |
|
24781 + misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \ |
|
24782 + dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10 |
|
24783 + |
|
24784 +In this case there is one lookup in dnsbl.sorbs.net, and if none of the IP |
|
24785 +values matches (or if no record is found), this is the only lookup that is |
|
24786 +done. Only if there is a match is one of the more specific lists consulted. |
|
24787 + |
|
24788 +40.35Â DNS lists and IPv6 |
|
24789 + |
|
24790 +If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it |
|
24791 +nibble by nibble. For example, if the calling host's IP address is |
|
24792 +3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up |
|
24793 + |
|
24794 +1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8. |
|
24795 + f.f.f.f.e.f.f.3.blackholes.mail-abuse.org |
|
24796 + |
|
24797 +(split over two lines here to fit on the page). Unfortunately, some of the DNS |
|
24798 +lists contain wildcard records, intended for IPv4, that interact badly with |
|
24799 +IPv6. For example, the DNS entry |
|
24800 + |
|
24801 +*.3.some.list.example. A 127.0.0.1 |
|
24802 + |
|
24803 +is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list. |
|
24804 +Unfortunately, it also matches the entire 3::/4 IPv6 network. |
|
24805 + |
|
24806 +You can exclude IPv6 addresses from DNS lookups by making use of a suitable |
|
24807 +condition condition, as in this example: |
|
24808 + |
|
24809 +deny condition = ${if isip4{$sender_host_address}} |
|
24810 + dnslists = some.list.example |
|
24811 + |
|
24812 +40.36Â Rate limiting incoming messages |
|
24813 + |
|
24814 +The ratelimit ACL condition can be used to measure and control the rate at |
|
24815 +which clients can send email. This is more powerful than the smtp_ratelimit_* |
|
24816 +options, because those options control the rate of commands in a single SMTP |
|
24817 +session only, whereas the ratelimit condition works across all connections |
|
24818 +(concurrent and sequential) from the same client host. The syntax of the |
|
24819 +ratelimit condition is: |
|
24820 + |
|
24821 +ratelimit = <m> / <p> / <options> / <key> |
|
24822 + |
|
24823 +If the average client sending rate is less than m messages per time period p |
|
24824 +then the condition is false; otherwise it is true. |
|
24825 + |
|
24826 +As a side-effect, the ratelimit condition sets the expansion variable |
|
24827 +$sender_rate to the client's computed rate, $sender_rate_limit to the |
|
24828 +configured value of m, and $sender_rate_period to the configured value of p. |
|
24829 + |
|
24830 +The parameter p is the smoothing time constant, in the form of an Exim time |
|
24831 +interval, for example, "8h" for eight hours. A larger time constant means that |
|
24832 +it takes Exim longer to forget a client's past behaviour. The parameter m is |
|
24833 +the maximum number of messages that a client is permitted to send in each time |
|
24834 +interval. It also specifies the number of messages permitted in a fast burst. |
|
24835 +By increasing both m and p but keeping m/p constant, you can allow a client to |
|
24836 +send more messages in a burst without changing its long-term sending rate |
|
24837 +limit. Conversely, if m and p are both small, messages must be sent at an even |
|
24838 +rate. |
|
24839 + |
|
24840 +There is a script in util/ratelimit.pl which extracts sending rates from log |
|
24841 +files, to assist with choosing appropriate settings for m and p when deploying |
|
24842 +the ratelimit ACL condition. The script prints usage instructions when it is |
|
24843 +run with no arguments. |
|
24844 + |
|
24845 +The key is used to look up the data for calculating the client's average |
|
24846 +sending rate. This data is stored in Exim's spool directory, alongside the |
|
24847 +retry and other hints databases. The default key is $sender_host_address, which |
|
24848 +means Exim computes the sending rate of each client host IP address. By |
|
24849 +changing the key you can change how Exim identifies clients for the purpose of |
|
24850 +ratelimiting. For example, to limit the sending rate of each authenticated |
|
24851 +user, independent of the computer they are sending from, set the key to |
|
24852 +$authenticated_id. You must ensure that the lookup key is meaningful; for |
|
24853 +example, $authenticated_id is only meaningful if the client has authenticated |
|
24854 +(which you can check with the authenticated ACL condition). |
|
24855 + |
|
24856 +The lookup key does not have to identify clients: If you want to limit the rate |
|
24857 +at which a recipient receives messages, you can use the key |
|
24858 +"$local_part@$domain" with the per_rcpt option (see below) in a RCPT ACL. |
|
24859 + |
|
24860 +Internally, Exim appends the smoothing constant p and the options onto the |
|
24861 +lookup key because they alter the meaning of the stored data. This is not true |
|
24862 +for the limit m, so you can alter the configured maximum rate and Exim will |
|
24863 +still remember clients' past behaviour, but if you alter the other ratelimit |
|
24864 +parameters Exim forgets past behaviour. |
|
24865 + |
|
24866 +Each ratelimit condition can have up to three options. One option specifies |
|
24867 +what Exim measures the rate of, and the second specifies how Exim handles |
|
24868 +excessively fast clients. The third option can be "noupdate", to disable |
|
24869 +updating of the ratelimiting database (see section 40.40). The options are |
|
24870 +separated by a slash, like the other parameters. They may appear in any order. |
|
24871 + |
|
24872 +40.37Â Ratelimit options for what is being measured |
|
24873 + |
|
24874 +The per_conn option limits the client's connection rate. |
|
24875 + |
|
24876 +The per_mail option limits the client's rate of sending messages. This is the |
|
24877 +default if none of the per_* options is specified. |
|
24878 + |
|
24879 +The per_byte option limits the sender's email bandwidth. Note that it is best |
|
24880 +to use this option in the DATA ACL; if it is used in an earlier ACL it relies |
|
24881 +on the SIZE parameter specified by the client in its MAIL command, which may be |
|
24882 +inaccurate or completely missing. You can follow the limit m in the |
|
24883 +configuration with K, M, or G to specify limits in kilobytes, megabytes, or |
|
24884 +gigabytes, respectively. |
|
24885 + |
|
24886 +The per_rcpt option causes Exim to limit the rate at which recipients are |
|
24887 +accepted. To be effective, it would need to be used in either the acl_smtp_rcpt |
|
24888 +or the acl_not_smtp ACL. In the acl_smtp_rcpt ACL, the number of recipients is |
|
24889 +incremented by one. In the case of a locally submitted message in the |
|
24890 +acl_not_smtp ACL, the number of recipients is incremented by the |
|
24891 +$recipients_count for the entire message. Note that in either case the rate |
|
24892 +limiting engine will see a message with many recipients as a large high-speed |
|
24893 +burst. |
|
24894 + |
|
24895 +The per_cmd option causes Exim to recompute the rate every time the condition |
|
24896 +is processed. This can be used to limit the SMTP command rate. This command is |
|
24897 +essentially an alias of per_rcpt to make it clear that the effect is to limit |
|
24898 +the rate at which individual commands, rather than recipients, are accepted. |
|
24899 + |
|
24900 +40.38Â Ratelimit options for handling fast clients |
|
24901 + |
|
24902 +If a client's average rate is greater than the maximum, the rate limiting |
|
24903 +engine can react in two possible ways, depending on the presence of the strict |
|
24904 +or leaky options. This is independent of the other counter-measures (such as |
|
24905 +rejecting the message) that may be specified by the rest of the ACL. The |
|
24906 +default mode is leaky, which avoids a sender's over-aggressive retry rate |
|
24907 +preventing it from getting any email through. |
|
24908 + |
|
24909 +The strict option means that the client's recorded rate is always updated. The |
|
24910 +effect of this is that Exim measures the client's average rate of attempts to |
|
24911 +send email, which can be much higher than the maximum it is actually allowed. |
|
24912 +If the client is over the limit it may be subjected to counter-measures by the |
|
24913 +ACL until it slows down below the maximum rate. If the client stops attempting |
|
24914 +to send email for the time specified in the p parameter then its computed rate |
|
24915 +will decay exponentially to 37% of its peak value. You can work out the time |
|
24916 +(the number of smoothing periods) that a client is subjected to |
|
24917 +counter-measures after an over-limit burst with this formula: |
|
24918 + |
|
24919 + ln(peakrate/maxrate) |
|
24920 + |
|
24921 +The leaky (default) option means that the client's recorded rate is not updated |
|
24922 +if it is above the limit. The effect of this is that Exim measures the client's |
|
24923 +average rate of successfully sent email, which cannot be greater than the |
|
24924 +maximum allowed. If the client is over the limit it may suffer some |
|
24925 +counter-measures (as specified in the ACL), but it will still be able to send |
|
24926 +email at the configured maximum rate, whatever the rate of its attempts. This |
|
24927 +is generally the better choice if you have clients that retry automatically. |
|
24928 + |
|
24929 +40.39Â Using rate limiting |
|
24930 + |
|
24931 +Exim's other ACL facilities are used to define what counter-measures are taken |
|
24932 +when the rate limit is exceeded. This might be anything from logging a warning |
|
24933 +(for example, while measuring existing sending rates in order to define |
|
24934 +policy), through time delays to slow down fast senders, up to rejecting the |
|
24935 +message. For example: |
|
24936 + |
|
24937 +# Log all senders' rates |
|
24938 +warn ratelimit = 0 / 1h / strict |
|
24939 + log_message = Sender rate $sender_rate / $sender_rate_period |
|
24940 + |
|
24941 +# Slow down fast senders; note the need to truncate $sender_rate |
|
24942 +# at the decimal point. |
|
24943 +warn ratelimit = 100 / 1h / per_rcpt / strict |
|
24944 + delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \ |
|
24945 + $sender_rate_limit }s |
|
24946 + |
|
24947 +# Keep authenticated users under control |
|
24948 +deny authenticated = * |
|
24949 + ratelimit = 100 / 1d / strict / $authenticated_id |
|
24950 + |
|
24951 +# System-wide rate limit |
|
24952 +defer message = Sorry, too busy. Try again later. |
|
24953 + ratelimit = 10 / 1s / $primary_hostname |
|
24954 + |
|
24955 +# Restrict incoming rate from each host, with a default |
|
24956 +# set using a macro and special cases looked up in a table. |
|
24957 +defer message = Sender rate exceeds $sender_rate_limit \ |
|
24958 + messages per $sender_rate_period |
|
24959 + ratelimit = ${lookup {$sender_host_address} \ |
|
24960 + cdb {DB/ratelimits.cdb} \ |
|
24961 + {$value} {RATELIMIT} } |
|
24962 + |
|
24963 +Warning: If you have a busy server with a lot of ratelimit tests, especially |
|
24964 +with the per_rcpt option, you may suffer from a performance bottleneck caused |
|
24965 +by locking on the ratelimit hints database. Apart from making your ACLs less |
|
24966 +complicated, you can reduce the problem by using a RAM disk for Exim's hints |
|
24967 +directory (usually /var/spool/exim/db/). However this means that Exim will lose |
|
24968 +its hints data after a reboot (including retry hints, the callout cache, and |
|
24969 +ratelimit data). |
|
24970 + |
|
24971 +40.40Â Reading ratelimit data without updating |
|
24972 + |
|
24973 +If the noupdate option is present on a ratelimit ACL condition, Exim computes |
|
24974 +the rate and checks the limit as normal, but it does not update the saved data. |
|
24975 +This means that, in relevant ACLs, it is possible to lookup the existence of a |
|
24976 +specified (or auto-generated) ratelimit key without incrementing the ratelimit |
|
24977 +counter for that key. In order for this to be useful, another ACL entry must |
|
24978 +set the rate for the same key (otherwise it will always be zero). For example: |
|
24979 + |
|
24980 +acl_check_connect: |
|
24981 + deny ratelimit = 100 / 5m / strict / per_cmd / noupdate |
|
24982 + log_message = RATE: $sender_rate/$sender_rate_period \ |
|
24983 + (max $sender_rate_limit) |
|
24984 + |
|
24985 +... some other logic and tests... |
|
24986 + |
|
24987 +acl_check_mail: |
|
24988 + warn ratelimit = 100 / 5m / strict / per_cmd |
|
24989 + condition = ${if le{$sender_rate}{$sender_rate_limit}} |
|
24990 + logwrite = RATE UPDATE: $sender_rate/$sender_rate_period \ |
|
24991 + (max $sender_rate_limit) |
|
24992 + |
|
24993 +In this example, the rate is tested and used to deny access (when it is too |
|
24994 +high) in the connect ACL, but the actual computation of the remembered rate |
|
24995 +happens later, on a per-command basis, in another ACL. |
|
24996 + |
|
24997 +40.41Â Address verification |
|
24998 + |
|
24999 +Several of the verify conditions described in section 40.24 cause addresses to |
|
25000 +be verified. Section 40.45 discusses the reporting of sender verification |
|
25001 +failures. The verification conditions can be followed by options that modify |
|
25002 +the verification process. The options are separated from the keyword and from |
|
25003 +each other by slashes, and some of them contain parameters. For example: |
|
25004 + |
|
25005 +verify = sender/callout |
|
25006 +verify = recipient/defer_ok/callout=10s,defer_ok |
|
25007 + |
|
25008 +The first stage of address verification, which always happens, is to run the |
|
25009 +address through the routers, in "verify mode". Routers can detect the |
|
25010 +difference between verification and routing for delivery, and their actions can |
|
25011 +be varied by a number of generic options such as verify and verify_only (see |
|
25012 +chapter 15). If routing fails, verification fails. The available options are as |
|
25013 +follows: |
|
25014 + |
|
25015 + * If the callout option is specified, successful routing to one or more |
|
25016 + remote hosts is followed by a "callout" to those hosts as an additional |
|
25017 + check. Callouts and their sub-options are discussed in the next section. |
|
25018 + |
|
25019 + * If there is a defer error while doing verification routing, the ACL |
|
25020 + normally returns "defer". However, if you include defer_ok in the options, |
|
25021 + the condition is forced to be true instead. Note that this is a main |
|
25022 + verification option as well as a suboption for callouts. |
|
25023 + |
|
25024 + * The no_details option is covered in section 40.45, which discusses the |
|
25025 + reporting of sender address verification failures. |
|
25026 + |
|
25027 + * The success_on_redirect option causes verification always to succeed |
|
25028 + immediately after a successful redirection. By default, if a redirection |
|
25029 + generates just one address, that address is also verified. See further |
|
25030 + discussion in section 40.46. |
|
25031 + |
|
25032 +After an address verification failure, $acl_verify_message contains the error |
|
25033 +message that is associated with the failure. It can be preserved by coding like |
|
25034 +this: |
|
25035 + |
|
25036 +warn !verify = sender |
|
25037 + set acl_m0 = $acl_verify_message |
|
25038 + |
|
25039 +If you are writing your own custom rejection message or log message when |
|
25040 +denying access, you can use this variable to include information about the |
|
25041 +verification failure. |
|
25042 + |
|
25043 +In addition, $sender_verify_failure or $recipient_verify_failure (as |
|
25044 +appropriate) contains one of the following words: |
|
25045 + |
|
25046 + * qualify: The address was unqualified (no domain), and the message was |
|
25047 + neither local nor came from an exempted host. |
|
25048 + |
|
25049 + * route: Routing failed. |
|
25050 + |
|
25051 + * mail: Routing succeeded, and a callout was attempted; rejection occurred at |
|
25052 + or before the MAIL command (that is, on initial connection, HELO, or MAIL). |
|
25053 + |
|
25054 + * recipient: The RCPT command in a callout was rejected. |
|
25055 + |
|
25056 + * postmaster: The postmaster check in a callout was rejected. |
|
25057 + |
|
25058 +The main use of these variables is expected to be to distinguish between |
|
25059 +rejections of MAIL and rejections of RCPT in callouts. |
|
25060 + |
|
25061 +40.42Â Callout verification |
|
25062 + |
|
25063 +For non-local addresses, routing verifies the domain, but is unable to do any |
|
25064 +checking of the local part. There are situations where some means of verifying |
|
25065 +the local part is desirable. One way this can be done is to make an SMTP |
|
25066 +callback to a delivery host for the sender address or a callforward to a |
|
25067 +subsequent host for a recipient address, to see if the host accepts the |
|
25068 +address. We use the term callout to cover both cases. Note that for a sender |
|
25069 +address, the callback is not to the client host that is trying to deliver the |
|
25070 +message, but to one of the hosts that accepts incoming mail for the sender's |
|
25071 +domain. |
|
25072 + |
|
25073 +Exim does not do callouts by default. If you want them to happen, you must |
|
25074 +request them by setting appropriate options on the verify condition, as |
|
25075 +described below. This facility should be used with care, because it can add a |
|
25076 +lot of resource usage to the cost of verifying an address. However, Exim does |
|
25077 +cache the results of callouts, which helps to reduce the cost. Details of |
|
25078 +caching are in section 40.44. |
|
25079 + |
|
25080 +Recipient callouts are usually used only between hosts that are controlled by |
|
25081 +the same administration. For example, a corporate gateway host could use |
|
25082 +callouts to check for valid recipients on an internal mailserver. A successful |
|
25083 +callout does not guarantee that a real delivery to the address would succeed; |
|
25084 +on the other hand, a failing callout does guarantee that a delivery would fail. |
|
25085 + |
|
25086 +If the callout option is present on a condition that verifies an address, a |
|
25087 +second stage of verification occurs if the address is successfully routed to |
|
25088 +one or more remote hosts. The usual case is routing by a dnslookup or a |
|
25089 +manualroute router, where the router specifies the hosts. However, if a router |
|
25090 +that does not set up hosts routes to an smtp transport with a hosts setting, |
|
25091 +the transport's hosts are used. If an smtp transport has hosts_override set, |
|
25092 +its hosts are always used, whether or not the router supplies a host list. |
|
25093 + |
|
25094 +The port that is used is taken from the transport, if it is specified and is a |
|
25095 +remote transport. (For routers that do verification only, no transport need be |
|
25096 +specified.) Otherwise, the default SMTP port is used. If a remote transport |
|
25097 +specifies an outgoing interface, this is used; otherwise the interface is not |
|
25098 +specified. Likewise, the text that is used for the HELO command is taken from |
|
25099 +the transport's helo_data option; if there is no transport, the value of |
|
25100 +$smtp_active_hostname is used. |
|
25101 + |
|
25102 +For a sender callout check, Exim makes SMTP connections to the remote hosts, to |
|
25103 +test whether a bounce message could be delivered to the sender address. The |
|
25104 +following SMTP commands are sent: |
|
25105 + |
|
25106 +HELO <local host name> |
|
25107 +MAILÂ FROM:<> |
|
25108 +RCPT TO:<the address to be tested> |
|
25109 +QUIT |
|
25110 + |
|
25111 +LHLO is used instead of HELO if the transport's protocol option is set to |
|
25112 +"lmtp". |
|
25113 + |
|
25114 +A recipient callout check is similar. By default, it also uses an empty address |
|
25115 +for the sender. This default is chosen because most hosts do not make use of |
|
25116 +the sender address when verifying a recipient. Using the same address means |
|
25117 +that a single cache entry can be used for each recipient. Some sites, however, |
|
25118 +do make use of the sender address when verifying. These are catered for by the |
|
25119 +use_sender and use_postmaster options, described in the next section. |
|
25120 + |
|
25121 +If the response to the RCPT command is a 2xx code, the verification succeeds. |
|
25122 +If it is 5xx, the verification fails. For any other condition, Exim tries the |
|
25123 +next host, if any. If there is a problem with all the remote hosts, the ACL |
|
25124 +yields "defer", unless the defer_ok parameter of the callout option is given, |
|
25125 +in which case the condition is forced to succeed. |
|
25126 + |
|
25127 +A callout may take a little time. For this reason, Exim normally flushes SMTP |
|
25128 +output before performing a callout in an ACL, to avoid unexpected timeouts in |
|
25129 +clients when the SMTP PIPELINING extension is in use. The flushing can be |
|
25130 +disabled by using a control modifier to set no_callout_flush. |
|
25131 + |
|
25132 +40.43Â Additional parameters for callouts |
|
25133 + |
|
25134 +The callout option can be followed by an equals sign and a number of optional |
|
25135 +parameters, separated by commas. For example: |
|
25136 + |
|
25137 +verify = recipient/callout=10s,defer_ok |
|
25138 + |
|
25139 +The old syntax, which had callout_defer_ok and check_postmaster as separate |
|
25140 +verify options, is retained for backwards compatibility, but is now deprecated. |
|
25141 +The additional parameters for callout are as follows: |
|
25142 + |
|
25143 +<a time interval> |
|
25144 + |
|
25145 + This specifies the timeout that applies for the callout attempt to each |
|
25146 + host. For example: |
|
25147 + |
|
25148 + verify = sender/callout=5s |
|
25149 + |
|
25150 + The default is 30 seconds. The timeout is used for each response from the |
|
25151 + remote host. It is also used for the initial connection, unless overridden |
|
25152 + by the connect parameter. |
|
25153 + |
|
25154 +connect = <time interval> |
|
25155 + |
|
25156 + This parameter makes it possible to set a different (usually smaller) |
|
25157 + timeout for making the SMTP connection. For example: |
|
25158 + |
|
25159 + verify = sender/callout=5s,connect=1s |
|
25160 + |
|
25161 + If not specified, this timeout defaults to the general timeout value. |
|
25162 + |
|
25163 +defer_ok |
|
25164 + |
|
25165 + When this parameter is present, failure to contact any host, or any other |
|
25166 + kind of temporary error, is treated as success by the ACL. However, the |
|
25167 + cache is not updated in this circumstance. |
|
25168 + |
|
25169 +fullpostmaster |
|
25170 + |
|
25171 + This operates like the postmaster option (see below), but if the check for |
|
25172 + postmaster@domain fails, it tries just postmaster, without a domain, in |
|
25173 + accordance with the specification in RFC 2821. The RFC states that the |
|
25174 + unqualified address postmaster should be accepted. |
|
25175 + |
|
25176 +mailfrom = <email address> |
|
25177 + |
|
25178 + When verifying addresses in header lines using the header_sender |
|
25179 + verification option, Exim behaves by default as if the addresses are |
|
25180 + envelope sender addresses from a message. Callout verification therefore |
|
25181 + tests to see whether a bounce message could be delivered, by using an empty |
|
25182 + address in the MAIL command. However, it is arguable that these addresses |
|
25183 + might never be used as envelope senders, and could therefore justifiably |
|
25184 + reject bounce messages (empty senders). The mailfrom callout parameter |
|
25185 + allows you to specify what address to use in the MAIL command. For example: |
|
25186 + |
|
25187 + require verify = header_sender/callout=mailfrom=abcd@x.y.z |
|
25188 + |
|
25189 + This parameter is available only for the header_sender verification option. |
|
25190 + |
|
25191 +maxwait = <time interval> |
|
25192 + |
|
25193 + This parameter sets an overall timeout for performing a callout |
|
25194 + verification. For example: |
|
25195 + |
|
25196 + verify = sender/callout=5s,maxwait=30s |
|
25197 + |
|
25198 + This timeout defaults to four times the callout timeout for individual SMTP |
|
25199 + commands. The overall timeout applies when there is more than one host that |
|
25200 + can be tried. The timeout is checked before trying the next host. This |
|
25201 + prevents very long delays if there are a large number of hosts and all are |
|
25202 + timing out (for example, when network connections are timing out). |
|
25203 + |
|
25204 +no_cache |
|
25205 + |
|
25206 + When this parameter is given, the callout cache is neither read nor |
|
25207 + updated. |
|
25208 + |
|
25209 +postmaster |
|
25210 + |
|
25211 + When this parameter is set, a successful callout check is followed by a |
|
25212 + similar check for the local part postmaster at the same domain. If this |
|
25213 + address is rejected, the callout fails (but see fullpostmaster above). The |
|
25214 + result of the postmaster check is recorded in a cache record; if it is a |
|
25215 + failure, this is used to fail subsequent callouts for the domain without a |
|
25216 + connection being made, until the cache record expires. |
|
25217 + |
|
25218 +postmaster_mailfrom = <email address> |
|
25219 + |
|
25220 + The postmaster check uses an empty sender in the MAIL command by default. |
|
25221 + You can use this parameter to do a postmaster check using a different |
|
25222 + address. For example: |
|
25223 + |
|
25224 + require verify = sender/callout=postmaster_mailfrom=abc@x.y.z |
|
25225 + |
|
25226 + If both postmaster and postmaster_mailfrom are present, the rightmost one |
|
25227 + overrides. The postmaster parameter is equivalent to this example: |
|
25228 + |
|
25229 + require verify = sender/callout=postmaster_mailfrom= |
|
25230 + |
|
25231 + Warning: The caching arrangements for postmaster checking do not take |
|
25232 + account of the sender address. It is assumed that either the empty address |
|
25233 + or a fixed non-empty address will be used. All that Exim remembers is that |
|
25234 + the postmaster check for the domain succeeded or failed. |
|
25235 + |
|
25236 +random |
|
25237 + |
|
25238 + When this parameter is set, before doing the normal callout check, Exim |
|
25239 + does a check for a "random" local part at the same domain. The local part |
|
25240 + is not really random - it is defined by the expansion of the option |
|
25241 + callout_random_local_part, which defaults to |
|
25242 + |
|
25243 + $primary_host_name-$tod_epoch-testing |
|
25244 + |
|
25245 + The idea here is to try to determine whether the remote host accepts all |
|
25246 + local parts without checking. If it does, there is no point in doing |
|
25247 + callouts for specific local parts. If the "random" check succeeds, the |
|
25248 + result is saved in a cache record, and used to force the current and |
|
25249 + subsequent callout checks to succeed without a connection being made, until |
|
25250 + the cache record expires. |
|
25251 + |
|
25252 +use_postmaster |
|
25253 + |
|
25254 + This parameter applies to recipient callouts only. For example: |
|
25255 + |
|
25256 + deny !verify = recipient/callout=use_postmaster |
|
25257 + |
|
25258 + It causes a non-empty postmaster address to be used in the MAIL command |
|
25259 + when performing the callout for the recipient, and also for a "random" |
|
25260 + check if that is configured. The local part of the address is "postmaster" |
|
25261 + and the domain is the contents of $qualify_domain. |
|
25262 + |
|
25263 +use_sender |
|
25264 + |
|
25265 + This option applies to recipient callouts only. For example: |
|
25266 + |
|
25267 + require verify = recipient/callout=use_sender |
|
25268 + |
|
25269 + It causes the message's actual sender address to be used in the MAIL |
|
25270 + command when performing the callout, instead of an empty address. There is |
|
25271 + no need to use this option unless you know that the called hosts make use |
|
25272 + of the sender when checking recipients. If used indiscriminately, it |
|
25273 + reduces the usefulness of callout caching. |
|
25274 + |
|
25275 +If you use any of the parameters that set a non-empty sender for the MAIL |
|
25276 +command (mailfrom, postmaster_mailfrom, use_postmaster, or use_sender), you |
|
25277 +should think about possible loops. Recipient checking is usually done between |
|
25278 +two hosts that are under the same management, and the host that receives the |
|
25279 +callouts is not normally configured to do callouts itself. Therefore, it is |
|
25280 +normally safe to use use_postmaster or use_sender in these circumstances. |
|
25281 + |
|
25282 +However, if you use a non-empty sender address for a callout to an arbitrary |
|
25283 +host, there is the likelihood that the remote host will itself initiate a |
|
25284 +callout check back to your host. As it is checking what appears to be a message |
|
25285 +sender, it is likely to use an empty address in MAIL, thus avoiding a callout |
|
25286 +loop. However, to be on the safe side it would be best to set up your own ACLs |
|
25287 +so that they do not do sender verification checks when the recipient is the |
|
25288 +address you use for header sender or postmaster callout checking. |
|
25289 + |
|
25290 +Another issue to think about when using non-empty senders for callouts is |
|
25291 +caching. When you set mailfrom or use_sender, the cache record is keyed by the |
|
25292 +sender/recipient combination; thus, for any given recipient, many more actual |
|
25293 +callouts are performed than when an empty sender or postmaster is used. |
|
25294 + |
|
25295 +40.44Â Callout caching |
|
25296 + |
|
25297 +Exim caches the results of callouts in order to reduce the amount of resources |
|
25298 +used, unless you specify the no_cache parameter with the callout option. A |
|
25299 +hints database called "callout" is used for the cache. Two different record |
|
25300 +types are used: one records the result of a callout check for a specific |
|
25301 +address, and the other records information that applies to the entire domain |
|
25302 +(for example, that it accepts the local part postmaster). |
|
25303 + |
|
25304 +When an original callout fails, a detailed SMTP error message is given about |
|
25305 +the failure. However, for subsequent failures use the cache data, this message |
|
25306 +is not available. |
|
25307 + |
|
25308 +The expiry times for negative and positive address cache records are |
|
25309 +independent, and can be set by the global options callout_negative_expire |
|
25310 +(default 2h) and callout_positive_expire (default 24h), respectively. |
|
25311 + |
|
25312 +If a host gives a negative response to an SMTP connection, or rejects any |
|
25313 +commands up to and including |
|
25314 + |
|
25315 +MAIL FROM:<> |
|
25316 + |
|
25317 +(but not including the MAIL command with a non-empty address), any callout |
|
25318 +attempt is bound to fail. Exim remembers such failures in a domain cache |
|
25319 +record, which it uses to fail callouts for the domain without making new |
|
25320 +connections, until the domain record times out. There are two separate expiry |
|
25321 +times for domain cache records: callout_domain_negative_expire (default 3h) and |
|
25322 +callout_domain_positive_expire (default 7d). |
|
25323 + |
|
25324 +Domain records expire when the negative expiry time is reached if callouts |
|
25325 +cannot be made for the domain, or if the postmaster check failed. Otherwise, |
|
25326 +they expire when the positive expiry time is reached. This ensures that, for |
|
25327 +example, a host that stops accepting "random" local parts will eventually be |
|
25328 +noticed. |
|
25329 + |
|
25330 +The callout caching mechanism is based on the domain of the address that is |
|
25331 +being tested. If the domain routes to several hosts, it is assumed that their |
|
25332 +behaviour will be the same. |
|
25333 + |
|
25334 +40.45Â Sender address verification reporting |
|
25335 + |
|
25336 +See section 40.41 for a general discussion of verification. When sender |
|
25337 +verification fails in an ACL, the details of the failure are given as |
|
25338 +additional output lines before the 550 response to the relevant SMTP command |
|
25339 +(RCPT or DATA). For example, if sender callout is in use, you might see: |
|
25340 + |
|
25341 +MAIL FROM:<xyz@abc.example> |
|
25342 +250 OK |
|
25343 +RCPT TO:<pqr@def.example> |
|
25344 +550-Verification failed for <xyz@abc.example> |
|
25345 +550-Called: 192.168.34.43 |
|
25346 +550-Sent: RCPT TO:<xyz@abc.example> |
|
25347 +550-Response: 550 Unknown local part xyz in <xyz@abc.example> |
|
25348 +550 Sender verification failed |
|
25349 + |
|
25350 +If more than one RCPT command fails in the same way, the details are given only |
|
25351 +for the first of them. However, some administrators do not want to send out |
|
25352 +this much information. You can suppress the details by adding "/no_details" to |
|
25353 +the ACL statement that requests sender verification. For example: |
|
25354 + |
|
25355 +verify = sender/no_details |
|
25356 + |
|
25357 +40.46Â Redirection while verifying |
|
25358 + |
|
25359 +A dilemma arises when a local address is redirected by aliasing or forwarding |
|
25360 +during verification: should the generated addresses themselves be verified, or |
|
25361 +should the successful expansion of the original address be enough to verify it? |
|
25362 +By default, Exim takes the following pragmatic approach: |
|
25363 + |
|
25364 + * When an incoming address is redirected to just one child address, |
|
25365 + verification continues with the child address, and if that fails to verify, |
|
25366 + the original verification also fails. |
|
25367 + |
|
25368 + * When an incoming address is redirected to more than one child address, |
|
25369 + verification does not continue. A success result is returned. |
|
25370 + |
|
25371 +This seems the most reasonable behaviour for the common use of aliasing as a |
|
25372 +way of redirecting different local parts to the same mailbox. It means, for |
|
25373 +example, that a pair of alias entries of the form |
|
25374 + |
|
25375 +A.Wol: aw123 |
|
25376 +aw123: :fail: Gone away, no forwarding address |
|
25377 + |
|
25378 +work as expected, with both local parts causing verification failure. When a |
|
25379 +redirection generates more than one address, the behaviour is more like a |
|
25380 +mailing list, where the existence of the alias itself is sufficient for |
|
25381 +verification to succeed. |
|
25382 + |
|
25383 +It is possible, however, to change the default behaviour so that all successful |
|
25384 +redirections count as successful verifications, however many new addresses are |
|
25385 +generated. This is specified by the success_on_redirect verification option. |
|
25386 +For example: |
|
25387 + |
|
25388 +require verify = recipient/success_on_redirect/callout=10s |
|
25389 + |
|
25390 +In this example, verification succeeds if a router generates a new address, and |
|
25391 +the callout does not occur, because no address was routed to a remote host. |
|
25392 + |
|
25393 +When verification is being tested via the -bv option, the treatment of |
|
25394 +redirections is as just described, unless the -v or any debugging option is |
|
25395 +also specified. In that case, full verification is done for every generated |
|
25396 +address and a report is output for each of them. |
|
25397 + |
|
25398 +40.47Â Client SMTP authorization (CSA) |
|
25399 + |
|
25400 +Client SMTP Authorization is a system that allows a site to advertise which |
|
25401 +machines are and are not permitted to send email. This is done by placing |
|
25402 +special SRV records in the DNS; these are looked up using the client's HELO |
|
25403 +domain. At the time of writing, CSA is still an Internet Draft. Client SMTP |
|
25404 +Authorization checks in Exim are performed by the ACL condition: |
|
25405 + |
|
25406 +verify = csa |
|
25407 + |
|
25408 +This fails if the client is not authorized. If there is a DNS problem, or if no |
|
25409 +valid CSA SRV record is found, or if the client is authorized, the condition |
|
25410 +succeeds. These three cases can be distinguished using the expansion variable |
|
25411 +$csa_status, which can take one of the values "fail", "defer", "unknown", or |
|
25412 +"ok". The condition does not itself defer because that would be likely to cause |
|
25413 +problems for legitimate email. |
|
25414 + |
|
25415 +The error messages produced by the CSA code include slightly more detail. If |
|
25416 +$csa_status is "defer", this may be because of problems looking up the CSA SRV |
|
25417 +record, or problems looking up the CSA target address record. There are four |
|
25418 +reasons for $csa_status being "fail": |
|
25419 + |
|
25420 + * The client's host name is explicitly not authorized. |
|
25421 + |
|
25422 + * The client's IP address does not match any of the CSA target IP addresses. |
|
25423 + |
|
25424 + * The client's host name is authorized but it has no valid target IP |
|
25425 + addresses (for example, the target's addresses are IPv6 and the client is |
|
25426 + using IPv4). |
|
25427 + |
|
25428 + * The client's host name has no CSA SRV record but a parent domain has |
|
25429 + asserted that all subdomains must be explicitly authorized. |
|
25430 + |
|
25431 +The csa verification condition can take an argument which is the domain to use |
|
25432 +for the DNS query. The default is: |
|
25433 + |
|
25434 +verify = csa/$sender_helo_name |
|
25435 + |
|
25436 +This implementation includes an extension to CSA. If the query domain is an |
|
25437 +address literal such as [192.0.2.95], or if it is a bare IP address, Exim |
|
25438 +searches for CSA SRV records in the reverse DNS as if the HELO domain was (for |
|
25439 +example) 95.2.0.192.in-addr.arpa. Therefore it is meaningful to say: |
|
25440 + |
|
25441 +verify = csa/$sender_host_address |
|
25442 + |
|
25443 +In fact, this is the check that Exim performs if the client does not say HELO. |
|
25444 +This extension can be turned off by setting the main configuration option |
|
25445 +dns_csa_use_reverse to be false. |
|
25446 + |
|
25447 +If a CSA SRV record is not found for the domain itself, a search is performed |
|
25448 +through its parent domains for a record which might be making assertions about |
|
25449 +subdomains. The maximum depth of this search is limited using the main |
|
25450 +configuration option dns_csa_search_limit, which is 5 by default. Exim does not |
|
25451 +look for CSA SRV records in a top level domain, so the default settings handle |
|
25452 +HELO domains as long as seven (hostname.five.four.three.two.one.com). This |
|
25453 +encompasses the vast majority of legitimate HELO domains. |
|
25454 + |
|
25455 +The dnsdb lookup also has support for CSA. Although dnsdb also supports direct |
|
25456 +SRV lookups, this is not sufficient because of the extra parent domain search |
|
25457 +behaviour of CSA, and (as with PTR lookups) dnsdb also turns IP addresses into |
|
25458 +lookups in the reverse DNS space. The result of a successful lookup such as: |
|
25459 + |
|
25460 +${lookup dnsdb {csa=$sender_helo_name}} |
|
25461 + |
|
25462 +has two space-separated fields: an authorization code and a target host name. |
|
25463 +The authorization code can be "Y" for yes, "N" for no, "X" for explicit |
|
25464 +authorization required but absent, or "?" for unknown. |
|
25465 + |
|
25466 +40.48Â Bounce address tag validation |
|
25467 + |
|
25468 +Bounce address tag validation (BATV) is a scheme whereby the envelope senders |
|
25469 +of outgoing messages have a cryptographic, timestamped "tag" added to them. |
|
25470 +Genuine incoming bounce messages should therefore always be addressed to |
|
25471 +recipients that have a valid tag. This scheme is a way of detecting unwanted |
|
25472 +bounce messages caused by sender address forgeries (often called "collateral |
|
25473 +spam"), because the recipients of such messages do not include valid tags. |
|
25474 + |
|
25475 +There are two expansion items to help with the implementation of the BATV |
|
25476 +"prvs" (private signature) scheme in an Exim configuration. This scheme signs |
|
25477 +the original envelope sender address by using a simple key to add a hash of the |
|
25478 +address and some time-based randomizing information. The prvs expansion item |
|
25479 +creates a signed address, and the prvscheck expansion item checks one. The |
|
25480 +syntax of these expansion items is described in section 11.5. |
|
25481 + |
|
25482 +As an example, suppose the secret per-address keys are stored in an MySQL |
|
25483 +database. A query to look up the key for an address could be defined as a macro |
|
25484 +like this: |
|
25485 + |
|
25486 +PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \ |
|
25487 + WHERE sender='${quote_mysql:$prvscheck_address}'\ |
|
25488 + }{$value}} |
|
25489 + |
|
25490 +Suppose also that the senders who make use of BATV are defined by an address |
|
25491 +list called batv_senders. Then, in the ACL for RCPT commands, you could use |
|
25492 +this: |
|
25493 + |
|
25494 +# Bounces: drop unsigned addresses for BATV senders |
|
25495 +deny message = This address does not send an unsigned reverse path |
|
25496 + senders = : |
|
25497 + recipients = +batv_senders |
|
25498 + |
|
25499 +# Bounces: In case of prvs-signed address, check signature. |
|
25500 +deny message = Invalid reverse path signature. |
|
25501 + senders = : |
|
25502 + condition = ${prvscheck {$local_part@$domain}\ |
|
25503 + {PRVSCHECK_SQL}{1}} |
|
25504 + !condition = $prvscheck_result |
|
25505 + |
|
25506 +The first statement rejects recipients for bounce messages that are addressed |
|
25507 +to plain BATV sender addresses, because it is known that BATV senders do not |
|
25508 +send out messages with plain sender addresses. The second statement rejects |
|
25509 +recipients that are prvs-signed, but with invalid signatures (either because |
|
25510 +the key is wrong, or the signature has timed out). |
|
25511 + |
|
25512 +A non-prvs-signed address is not rejected by the second statement, because the |
|
25513 +prvscheck expansion yields an empty string if its first argument is not a |
|
25514 +prvs-signed address, thus causing the condition condition to be false. If the |
|
25515 +first argument is a syntactically valid prvs-signed address, the yield is the |
|
25516 +third string (in this case "1"), whether or not the cryptographic and timeout |
|
25517 +checks succeed. The $prvscheck_result variable contains the result of the |
|
25518 +checks (empty for failure, "1" for success). |
|
25519 + |
|
25520 +There is one more issue you must consider when implementing prvs-signing: you |
|
25521 +have to ensure that the routers accept prvs-signed addresses and deliver them |
|
25522 +correctly. The easiest way to handle this is to use a redirect router to remove |
|
25523 +the signature with a configuration along these lines: |
|
25524 + |
|
25525 +batv_redirect: |
|
25526 + driver = redirect |
|
25527 + data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}} |
|
25528 + |
|
25529 +This works because, if the third argument of prvscheck is empty, the result of |
|
25530 +the expansion of a prvs-signed address is the decoded value of the original |
|
25531 +address. This router should probably be the first of your routers that handles |
|
25532 +local addresses. |
|
25533 + |
|
25534 +To create BATV-signed addresses in the first place, a transport of this form |
|
25535 +can be used: |
|
25536 + |
|
25537 +external_smtp_batv: |
|
25538 + driver = smtp |
|
25539 + return_path = ${prvs {$return_path} \ |
|
25540 + {${lookup mysql{SELECT \ |
|
25541 + secret FROM batv_prvs WHERE \ |
|
25542 + sender='${quote_mysql:$sender_address}'} \ |
|
25543 + {$value}fail}}} |
|
25544 + |
|
25545 +If no key can be found for the existing return path, no signing takes place. |
|
25546 + |
|
25547 +40.49Â Using an ACL to control relaying |
|
25548 + |
|
25549 +An MTA is said to relay a message if it receives it from some host and delivers |
|
25550 +it directly to another host as a result of a remote address contained within |
|
25551 +it. Redirecting a local address via an alias or forward file and then passing |
|
25552 +the message on to another host is not relaying, but a redirection as a result |
|
25553 +of the "percent hack" is. |
|
25554 + |
|
25555 +Two kinds of relaying exist, which are termed "incoming" and "outgoing". A host |
|
25556 +which is acting as a gateway or an MX backup is concerned with incoming |
|
25557 +relaying from arbitrary hosts to a specific set of domains. On the other hand, |
|
25558 +a host which is acting as a smart host for a number of clients is concerned |
|
25559 +with outgoing relaying from those clients to the Internet at large. Often the |
|
25560 +same host is fulfilling both functions, but in principle these two kinds of |
|
25561 +relaying are entirely independent. What is not wanted is the transmission of |
|
25562 +mail from arbitrary remote hosts through your system to arbitrary domains. |
|
25563 + |
|
25564 +You can implement relay control by means of suitable statements in the ACL that |
|
25565 +runs for each RCPT command. For convenience, it is often easiest to use Exim's |
|
25566 +named list facility to define the domains and hosts involved. For example, |
|
25567 +suppose you want to do the following: |
|
25568 + |
|
25569 + * Deliver a number of domains to mailboxes on the local host (or process them |
|
25570 + locally in some other way). Let's say these are my.dom1.example and |
|
25571 + my.dom2.example. |
|
25572 + |
|
25573 + * Relay mail for a number of other domains for which you are the secondary |
|
25574 + MX. These might be friend1.example and friend2.example. |
|
25575 + |
|
25576 + * Relay mail from the hosts on your local LAN, to whatever domains are |
|
25577 + involved. Suppose your LAN is 192.168.45.0/24. |
|
25578 + |
|
25579 +In the main part of the configuration, you put the following definitions: |
|
25580 + |
|
25581 +domainlist local_domains = my.dom1.example : my.dom2.example |
|
25582 +domainlist relay_domains = friend1.example : friend2.example |
|
25583 +hostlist relay_hosts = 192.168.45.0/24 |
|
25584 + |
|
25585 +Now you can use these definitions in the ACL that is run for every RCPT |
|
25586 +command: |
|
25587 + |
|
25588 +acl_check_rcpt: |
|
25589 + accept domains = +local_domains : +relay_domains |
|
25590 + accept hosts = +relay_hosts |
|
25591 + |
|
25592 +The first statement accepts any RCPT command that contains an address in the |
|
25593 +local or relay domains. For any other domain, control passes to the second |
|
25594 +statement, which accepts the command only if it comes from one of the relay |
|
25595 +hosts. In practice, you will probably want to make your ACL more sophisticated |
|
25596 +than this, for example, by including sender and recipient verification. The |
|
25597 +default configuration includes a more comprehensive example, which is described |
|
25598 +in chapter 7. |
|
25599 + |
|
25600 +40.50Â Checking a relay configuration |
|
25601 + |
|
25602 +You can check the relay characteristics of your configuration in the same way |
|
25603 +that you can test any ACL behaviour for an incoming SMTP connection, by using |
|
25604 +the -bh option to run a fake SMTP session with which you interact. |
|
25605 + |
|
25606 +For specifically testing for unwanted relaying, the host |
|
25607 +relay-test.mail-abuse.org provides a useful service. If you telnet to this host |
|
25608 +from the host on which Exim is running, using the normal telnet port, you will |
|
25609 +see a normal telnet connection message and then quite a long delay. Be patient. |
|
25610 +The remote host is making an SMTP connection back to your host, and trying a |
|
25611 +number of common probes to test for open relay vulnerability. The results of |
|
25612 +the tests will eventually appear on your terminal. |
|
25613 + |
|
25614 +41. Content scanning at ACL time |
|
25615 + |
|
25616 +The extension of Exim to include content scanning at ACL time, formerly known |
|
25617 +as "exiscan", was originally implemented as a patch by Tom Kistner. The code |
|
25618 +was integrated into the main source for Exim release 4.50, and Tom continues to |
|
25619 +maintain it. Most of the wording of this chapter is taken from Tom's |
|
25620 +specification. |
|
25621 + |
|
25622 +It is also possible to scan the content of messages at other times. The |
|
25623 +local_scan() function (see chapter 42) allows for content scanning after all |
|
25624 +the ACLs have run. A transport filter can be used to scan messages at delivery |
|
25625 +time (see the transport_filter option, described in chapter 24). |
|
25626 + |
|
25627 +If you want to include the ACL-time content-scanning features when you compile |
|
25628 +Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your Local/ |
|
25629 +Makefile. When you do that, the Exim binary is built with: |
|
25630 + |
|
25631 + * Two additional ACLs (acl_smtp_mime and acl_not_smtp_mime) that are run for |
|
25632 + all MIME parts for SMTP and non-SMTP messages, respectively. |
|
25633 + |
|
25634 + * Additional ACL conditions and modifiers: decode, malware, mime_regex, regex |
|
25635 + , and spam. These can be used in the ACL that is run at the end of message |
|
25636 + reception (the acl_smtp_data ACL). |
|
25637 + |
|
25638 + * An additional control feature ("no_mbox_unspool") that saves spooled copies |
|
25639 + of messages, or parts of messages, for debugging purposes. |
|
25640 + |
|
25641 + * Additional expansion variables that are set in the new ACL and by the new |
|
25642 + conditions. |
|
25643 + |
|
25644 + * Two new main configuration options: av_scanner and spamd_address. |
|
25645 + |
|
25646 +There is another content-scanning configuration option for Local/Makefile, |
|
25647 +called WITH_OLD_DEMIME. If this is set, the old, deprecated demime ACL |
|
25648 +condition is compiled, in addition to all the other content-scanning features. |
|
25649 + |
|
25650 +Content-scanning is continually evolving, and new features are still being |
|
25651 +added. While such features are still unstable and liable to incompatible |
|
25652 +changes, they are made available in Exim by setting options whose names begin |
|
25653 +EXPERIMENTAL_ in Local/Makefile. Such features are not documented in this |
|
25654 +manual. You can find out about them by reading the file called doc/ |
|
25655 +experimental.txt. |
|
25656 + |
|
25657 +All the content-scanning facilities work on a MBOX copy of the message that is |
|
25658 +temporarily created in a file called: |
|
25659 + |
|
25660 +<spool_directory>/scan/<message_id>/<message_id>.eml |
|
25661 + |
|
25662 +The .eml extension is a friendly hint to virus scanners that they can expect an |
|
25663 +MBOX-like structure inside that file. The file is created when the first |
|
25664 +content scanning facility is called. Subsequent calls to content scanning |
|
25665 +conditions open the same file again. The directory is recursively removed when |
|
25666 +the acl_smtp_data ACL has finished running, unless |
|
25667 + |
|
25668 +control = no_mbox_unspool |
|
25669 + |
|
25670 +has been encountered. When the MIME ACL decodes files, they are put into the |
|
25671 +same directory by default. |
|
25672 + |
|
25673 +41.1Â Scanning for viruses |
|
25674 + |
|
25675 +The malware ACL condition lets you connect virus scanner software to Exim. It |
|
25676 +supports a "generic" interface to scanners called via the shell, and |
|
25677 +specialized interfaces for "daemon" type virus scanners, which are resident in |
|
25678 +memory and thus are much faster. |
|
25679 + |
|
25680 +You can set the av_scanner option in first part of the Exim configuration file |
|
25681 +to specify which scanner to use, together with any additional options that are |
|
25682 +needed. The basic syntax is as follows: |
|
25683 + |
|
25684 +av_scanner = <scanner-type>:<option1>:<option2>:[...] |
|
25685 + |
|
25686 +If you do not set av_scanner, it defaults to |
|
25687 + |
|
25688 +av_scanner = sophie:/var/run/sophie |
|
25689 + |
|
25690 +If the value of av_scanner starts with a dollar character, it is expanded |
|
25691 +before use. The following scanner types are supported in this release: |
|
25692 + |
|
25693 +aveserver |
|
25694 + |
|
25695 + This is the scanner daemon of Kaspersky Version 5. You can get a trial |
|
25696 + version at http://www.kaspersky.com. This scanner type takes one option, |
|
25697 + which is the path to the daemon's UNIX socket. The default is shown in this |
|
25698 + example: |
|
25699 + |
|
25700 + av_scanner = aveserver:/var/run/aveserver |
|
25701 + |
|
25702 +clamd |
|
25703 + |
|
25704 + This daemon-type scanner is GPL and free. You can get it at http:// |
|
25705 + www.clamav.net/. Some older versions of clamd do not seem to unpack MIME |
|
25706 + containers, so it used to be recommended to unpack MIME attachments in the |
|
25707 + MIME ACL. This no longer believed to be necessary. One option is required: |
|
25708 + either the path and name of a UNIX socket file, or a hostname or IP number, |
|
25709 + and a port, separated by space, as in the second of these examples: |
|
25710 + |
|
25711 + av_scanner = clamd:/opt/clamd/socket |
|
25712 + av_scanner = clamd:192.0.2.3 1234 |
|
25713 + av_scanner = clamd:192.0.2.3 1234:local |
|
25714 + |
|
25715 + If the value of av_scanner points to a UNIX socket file or contains the |
|
25716 + local keyword, then the ClamAV interface will pass a filename containing |
|
25717 + the data to be scanned, which will should normally result in less I/O |
|
25718 + happening and be more efficient. Normally in the TCP case, the data is |
|
25719 + streamed to ClamAV as Exim does not assume that there is a common |
|
25720 + filesystem with the remote host. There is an option WITH_OLD_CLAMAV_STREAM |
|
25721 + in src/EDITME available, should you be running a version of ClamAV prior to |
|
25722 + 0.95. If the option is unset, the default is /tmp/clamd. Thanks to David |
|
25723 + Saez for contributing the code for this scanner. |
|
25724 + |
|
25725 +cmdline |
|
25726 + |
|
25727 + This is the keyword for the generic command line scanner interface. It can |
|
25728 + be used to attach virus scanners that are invoked from the shell. This |
|
25729 + scanner type takes 3 mandatory options: |
|
25730 + |
|
25731 + 1. The full path and name of the scanner binary, with all command line |
|
25732 + options, and a placeholder ("%s") for the directory to scan. |
|
25733 + |
|
25734 + 2. A regular expression to match against the STDOUT and STDERR output of |
|
25735 + the virus scanner. If the expression matches, a virus was found. You |
|
25736 + must make absolutely sure that this expression matches on "virus |
|
25737 + found". This is called the "trigger" expression. |
|
25738 + |
|
25739 + 3. Another regular expression, containing exactly one pair of parentheses, |
|
25740 + to match the name of the virus found in the scanners output. This is |
|
25741 + called the "name" expression. |
|
25742 + |
|
25743 + For example, Sophos Sweep reports a virus on a line like this: |
|
25744 + |
|
25745 + Virus 'W32/Magistr-B' found in file ./those.bat |
|
25746 + |
|
25747 + For the trigger expression, we can match the phrase "found in file". For |
|
25748 + the name expression, we want to extract the W32/Magistr-B string, so we can |
|
25749 + match for the single quotes left and right of it. Altogether, this makes |
|
25750 + the configuration setting: |
|
25751 + |
|
25752 + av_scanner = cmdline:\ |
|
25753 + /path/to/sweep -ss -all -rec -archive %s:\ |
|
25754 + found in file:'(.+)' |
|
25755 + |
|
25756 +drweb |
|
25757 + |
|
25758 + The DrWeb daemon scanner (http://www.sald.com/) interface takes one |
|
25759 + argument, either a full path to a UNIX socket, or an IP address and port |
|
25760 + separated by white space, as in these examples: |
|
25761 + |
|
25762 + av_scanner = drweb:/var/run/drwebd.sock |
|
25763 + av_scanner = drweb:192.168.2.20 31337 |
|
25764 + |
|
25765 + If you omit the argument, the default path /usr/local/drweb/run/drwebd.sock |
|
25766 + is used. Thanks to Alex Miller for contributing the code for this scanner. |
|
25767 + |
|
25768 +fsecure |
|
25769 + |
|
25770 + The F-Secure daemon scanner (http://www.f-secure.com) takes one argument |
|
25771 + which is the path to a UNIX socket. For example: |
|
25772 + |
|
25773 + av_scanner = fsecure:/path/to/.fsav |
|
25774 + |
|
25775 + If no argument is given, the default is /var/run/.fsav. Thanks to Johan |
|
25776 + Thelmen for contributing the code for this scanner. |
|
25777 + |
|
25778 +kavdaemon |
|
25779 + |
|
25780 + This is the scanner daemon of Kaspersky Version 4. This version of the |
|
25781 + Kaspersky scanner is outdated. Please upgrade (see aveserver above). This |
|
25782 + scanner type takes one option, which is the path to the daemon's UNIX |
|
25783 + socket. For example: |
|
25784 + |
|
25785 + av_scanner = kavdaemon:/opt/AVP/AvpCtl |
|
25786 + |
|
25787 + The default path is /var/run/AvpCtl. |
|
25788 + |
|
25789 +mksd |
|
25790 + |
|
25791 + This is a daemon type scanner that is aimed mainly at Polish users, though |
|
25792 + some parts of documentation are now available in English. You can get it at |
|
25793 + http://linux.mks.com.pl/. The only option for this scanner type is the |
|
25794 + maximum number of processes used simultaneously to scan the attachments, |
|
25795 + provided that the demime facility is employed and also provided that mksd |
|
25796 + has been run with at least the same number of child processes. For example: |
|
25797 + |
|
25798 + av_scanner = mksd:2 |
|
25799 + |
|
25800 + You can safely omit this option (the default value is 1). |
|
25801 + |
|
25802 +sophie |
|
25803 + |
|
25804 + Sophie is a daemon that uses Sophos' libsavi library to scan for viruses. |
|
25805 + You can get Sophie at http://www.clanfield.info/sophie/. The only option |
|
25806 + for this scanner type is the path to the UNIX socket that Sophie uses for |
|
25807 + client communication. For example: |
|
25808 + |
|
25809 + av_scanner = sophie:/tmp/sophie |
|
25810 + |
|
25811 + The default path is /var/run/sophie, so if you are using this, you can omit |
|
25812 + the option. |
|
25813 + |
|
25814 +When av_scanner is correctly set, you can use the malware condition in the DATA |
|
25815 +ACL. Note: You cannot use the malware condition in the MIME ACL. |
|
25816 + |
|
25817 +The av_scanner option is expanded each time malware is called. This makes it |
|
25818 +possible to use different scanners. See further below for an example. The |
|
25819 +malware condition caches its results, so when you use it multiple times for the |
|
25820 +same message, the actual scanning process is only carried out once. However, |
|
25821 +using expandable items in av_scanner disables this caching, in which case each |
|
25822 +use of the malware condition causes a new scan of the message. |
|
25823 + |
|
25824 +The malware condition takes a right-hand argument that is expanded before use. |
|
25825 +It can then be one of |
|
25826 + |
|
25827 + * "true", "*", or "1", in which case the message is scanned for viruses. The |
|
25828 + condition succeeds if a virus was found, and fail otherwise. This is the |
|
25829 + recommended usage. |
|
25830 + |
|
25831 + * "false" or "0" or an empty string, in which case no scanning is done and |
|
25832 + the condition fails immediately. |
|
25833 + |
|
25834 + * A regular expression, in which case the message is scanned for viruses. The |
|
25835 + condition succeeds if a virus is found and its name matches the regular |
|
25836 + expression. This allows you to take special actions on certain types of |
|
25837 + virus. |
|
25838 + |
|
25839 +You can append "/defer_ok" to the malware condition to accept messages even if |
|
25840 +there is a problem with the virus scanner. Otherwise, such a problem causes the |
|
25841 +ACL to defer. |
|
25842 + |
|
25843 +When a virus is found, the condition sets up an expansion variable called |
|
25844 +$malware_name that contains the name of the virus. You can use it in a message |
|
25845 +modifier that specifies the error returned to the sender, and/or in logging |
|
25846 +data. |
|
25847 + |
|
25848 +If your virus scanner cannot unpack MIME and TNEF containers itself, you should |
|
25849 +use the demime condition (see section 41.6) before the malware condition. |
|
25850 + |
|
25851 +Beware the interaction of Exim's message_size_limit with any size limits |
|
25852 +imposed by your anti-virus scanner. |
|
25853 + |
|
25854 +Here is a very simple scanning example: |
|
25855 + |
|
25856 +deny message = This message contains malware ($malware_name) |
|
25857 + demime = * |
|
25858 + malware = * |
|
25859 + |
|
25860 +The next example accepts messages when there is a problem with the scanner: |
|
25861 + |
|
25862 +deny message = This message contains malware ($malware_name) |
|
25863 + demime = * |
|
25864 + malware = */defer_ok |
|
25865 + |
|
25866 +The next example shows how to use an ACL variable to scan with both sophie and |
|
25867 +aveserver. It assumes you have set: |
|
25868 + |
|
25869 +av_scanner = $acl_m0 |
|
25870 + |
|
25871 +in the main Exim configuration. |
|
25872 + |
|
25873 +deny message = This message contains malware ($malware_name) |
|
25874 + set acl_m0 = sophie |
|
25875 + malware = * |
|
25876 + |
|
25877 +deny message = This message contains malware ($malware_name) |
|
25878 + set acl_m0 = aveserver |
|
25879 + malware = * |
|
25880 + |
|
25881 +41.2Â Scanning with SpamAssassin |
|
25882 + |
|
25883 +The spam ACL condition calls SpamAssassin's spamd daemon to get a spam score |
|
25884 +and a report for the message. You can get SpamAssassin at http:// |
|
25885 +www.spamassassin.org, or, if you have a working Perl installation, you can use |
|
25886 +CPAN by running: |
|
25887 + |
|
25888 +perl -MCPAN -e 'install Mail::SpamAssassin' |
|
25889 + |
|
25890 +SpamAssassin has its own set of configuration files. Please review its |
|
25891 +documentation to see how you can tweak it. The default installation should work |
|
25892 +nicely, however. |
|
25893 + |
|
25894 +After having installed and configured SpamAssassin, start the spamd daemon. By |
|
25895 +default, it listens on 127.0.0.1, TCP port 783. If you use another host or port |
|
25896 +for spamd, you must set the spamd_address option in the global part of the Exim |
|
25897 +configuration as follows (example): |
|
25898 + |
|
25899 +spamd_address = 192.168.99.45 387 |
|
25900 + |
|
25901 +You do not need to set this option if you use the default. As of version 2.60, |
|
25902 +spamd also supports communication over UNIX sockets. If you want to use these, |
|
25903 +supply spamd_address with an absolute file name instead of a address/port pair: |
|
25904 + |
|
25905 +spamd_address = /var/run/spamd_socket |
|
25906 + |
|
25907 +You can have multiple spamd servers to improve scalability. These can reside on |
|
25908 +other hardware reachable over the network. To specify multiple spamd servers, |
|
25909 +put multiple address/port pairs in the spamd_address option, separated with |
|
25910 +colons: |
|
25911 + |
|
25912 +spamd_address = 192.168.2.10 783 : \ |
|
25913 + 192.168.2.11 783 : \ |
|
25914 + 192.168.2.12 783 |
|
25915 + |
|
25916 +Up to 32 spamd servers are supported. The servers are queried in a random |
|
25917 +fashion. When a server fails to respond to the connection attempt, all other |
|
25918 +servers are tried until one succeeds. If no server responds, the spam condition |
|
25919 +defers. |
|
25920 + |
|
25921 +Warning: It is not possible to use the UNIX socket connection method with |
|
25922 +multiple spamd servers. |
|
25923 + |
|
25924 +The spamd_address variable is expanded before use if it starts with a dollar |
|
25925 +sign. In this case, the expansion may return a string that is used as the list |
|
25926 +so that multiple spamd servers can be the result of an expansion. |
|
25927 + |
|
25928 +41.3Â Calling SpamAssassin from an Exim ACL |
|
25929 + |
|
25930 +Here is a simple example of the use of the spam condition in a DATA ACL: |
|
25931 + |
|
25932 +deny message = This message was classified as SPAM |
|
25933 + spam = joe |
|
25934 + |
|
25935 +The right-hand side of the spam condition specifies a name. This is relevant if |
|
25936 +you have set up multiple SpamAssassin profiles. If you do not want to scan |
|
25937 +using a specific profile, but rather use the SpamAssassin system-wide default |
|
25938 +profile, you can scan for an unknown name, or simply use "nobody". However, you |
|
25939 +must put something on the right-hand side. |
|
25940 + |
|
25941 +The name allows you to use per-domain or per-user antispam profiles in |
|
25942 +principle, but this is not straightforward in practice, because a message may |
|
25943 +have multiple recipients, not necessarily all in the same domain. Because the |
|
25944 +spam condition has to be called from a DATA ACL in order to be able to read the |
|
25945 +contents of the message, the variables $local_part and $domain are not set. |
|
25946 + |
|
25947 +The right-hand side of the spam condition is expanded before being used, so you |
|
25948 +can put lookups or conditions there. When the right-hand side evaluates to "0" |
|
25949 +or "false", no scanning is done and the condition fails immediately. |
|
25950 + |
|
25951 +Scanning with SpamAssassin uses a lot of resources. If you scan every message, |
|
25952 +large ones may cause significant performance degradation. As most spam messages |
|
25953 +are quite small, it is recommended that you do not scan the big ones. For |
|
25954 +example: |
|
25955 + |
|
25956 +deny message = This message was classified as SPAM |
|
25957 + condition = ${if < {$message_size}{10K}} |
|
25958 + spam = nobody |
|
25959 + |
|
25960 +The spam condition returns true if the threshold specified in the user's |
|
25961 +SpamAssassin profile has been matched or exceeded. If you want to use the spam |
|
25962 +condition for its side effects (see the variables below), you can make it |
|
25963 +always return "true" by appending ":true" to the username. |
|
25964 + |
|
25965 +When the spam condition is run, it sets up a number of expansion variables. |
|
25966 +These variables are saved with the received message, thus they are available |
|
25967 +for use at delivery time. |
|
25968 + |
|
25969 +$spam_score |
|
25970 + |
|
25971 + The spam score of the message, for example "3.4" or "30.5". This is useful |
|
25972 + for inclusion in log or reject messages. |
|
25973 + |
|
25974 +$spam_score_int |
|
25975 + |
|
25976 + The spam score of the message, multiplied by ten, as an integer value. For |
|
25977 + example "34" or "305". It may appear to disagree with $spam_score because |
|
25978 + $spam_score is rounded and $spam_score_int is truncated. The integer value |
|
25979 + is useful for numeric comparisons in conditions. |
|
25980 + |
|
25981 +$spam_bar |
|
25982 + |
|
25983 + A string consisting of a number of "+" or "-" characters, representing the |
|
25984 + integer part of the spam score value. A spam score of 4.4 would have a |
|
25985 + $spam_bar value of "++++". This is useful for inclusion in warning headers, |
|
25986 + since MUAs can match on such strings. |
|
25987 + |
|
25988 +$spam_report |
|
25989 + |
|
25990 + A multiline text table, containing the full SpamAssassin report for the |
|
25991 + message. Useful for inclusion in headers or reject messages. |
|
25992 + |
|
25993 +The spam condition caches its results unless expansion in spamd_address was |
|
25994 +used. If you call it again with the same user name, it does not scan again, but |
|
25995 +rather returns the same values as before. |
|
25996 + |
|
25997 +The spam condition returns DEFER if there is any error while running the |
|
25998 +message through SpamAssassin or if the expansion of spamd_address failed. If |
|
25999 +you want to treat DEFER as FAIL (to pass on to the next ACL statement block), |
|
26000 +append "/defer_ok" to the right-hand side of the spam condition, like this: |
|
26001 + |
|
26002 +deny message = This message was classified as SPAM |
|
26003 + spam = joe/defer_ok |
|
26004 + |
|
26005 +This causes messages to be accepted even if there is a problem with spamd. |
|
26006 + |
|
26007 +Here is a longer, commented example of the use of the spam condition: |
|
26008 + |
|
26009 +# put headers in all messages (no matter if spam or not) |
|
26010 +warn spam = nobody:true |
|
26011 + add_header = X-Spam-Score: $spam_score ($spam_bar) |
|
26012 + add_header = X-Spam-Report: $spam_report |
|
26013 + |
|
26014 +# add second subject line with *SPAM* marker when message |
|
26015 +# is over threshold |
|
26016 +warn spam = nobody |
|
26017 + add_header = Subject: *SPAM* $h_Subject: |
|
26018 + |
|
26019 +# reject spam at high scores (> 12) |
|
26020 +deny message = This message scored $spam_score spam points. |
|
26021 + spam = nobody:true |
|
26022 + condition = ${if >{$spam_score_int}{120}{1}{0}} |
|
26023 + |
|
26024 +41.4Â Scanning MIME parts |
|
26025 + |
|
26026 +The acl_smtp_mime global option specifies an ACL that is called once for each |
|
26027 +MIME part of an SMTP message, including multipart types, in the sequence of |
|
26028 +their position in the message. Similarly, the acl_not_smtp_mime option |
|
26029 +specifies an ACL that is used for the MIME parts of non-SMTP messages. These |
|
26030 +options may both refer to the same ACL if you want the same processing in both |
|
26031 +cases. |
|
26032 + |
|
26033 +These ACLs are called (possibly many times) just before the acl_smtp_data ACL |
|
26034 +in the case of an SMTP message, or just before the acl_not_smtp ACL in the case |
|
26035 +of a non-SMTP message. However, a MIME ACL is called only if the message |
|
26036 +contains a Content-Type: header line. When a call to a MIME ACL does not yield |
|
26037 +"accept", ACL processing is aborted and the appropriate result code is sent to |
|
26038 +the client. In the case of an SMTP message, the acl_smtp_data ACL is not called |
|
26039 +when this happens. |
|
26040 + |
|
26041 +You cannot use the malware or spam conditions in a MIME ACL; these can only be |
|
26042 +used in the DATA or non-SMTP ACLs. However, you can use the regex condition to |
|
26043 +match against the raw MIME part. You can also use the mime_regex condition to |
|
26044 +match against the decoded MIME part (see section 41.5). |
|
26045 + |
|
26046 +At the start of a MIME ACL, a number of variables are set from the header |
|
26047 +information for the relevant MIME part. These are described below. The contents |
|
26048 +of the MIME part are not by default decoded into a disk file except for MIME |
|
26049 +parts whose content-type is "message/rfc822". If you want to decode a MIME part |
|
26050 +into a disk file, you can use the decode condition. The general syntax is: |
|
26051 + |
|
26052 +decode = [/<path>/]<filename> |
|
26053 + |
|
26054 +The right hand side is expanded before use. After expansion, the value can be: |
|
26055 + |
|
26056 + 1. "0" or "false", in which case no decoding is done. |
|
26057 + |
|
26058 + 2. The string "default". In that case, the file is put in the temporary |
|
26059 + "default" directory <spool_directory>/scan/<message_id>/ with a sequential |
|
26060 + file name consisting of the message id and a sequence number. The full path |
|
26061 + and name is available in $mime_decoded_filename after decoding. |
|
26062 + |
|
26063 + 3. A full path name starting with a slash. If the full name is an existing |
|
26064 + directory, it is used as a replacement for the default directory. The |
|
26065 + filename is then sequentially assigned. If the path does not exist, it is |
|
26066 + used as the full path and file name. |
|
26067 + |
|
26068 + 4. If the string does not start with a slash, it is used as the filename, and |
|
26069 + the default path is then used. |
|
26070 + |
|
26071 +The decode condition normally succeeds. It is only false for syntax errors or |
|
26072 +unusual circumstances such as memory shortages. You can easily decode a file |
|
26073 +with its original, proposed filename using |
|
26074 + |
|
26075 +decode = $mime_filename |
|
26076 + |
|
26077 +However, you should keep in mind that $mime_filename might contain anything. If |
|
26078 +you place files outside of the default path, they are not automatically |
|
26079 +unlinked. |
|
26080 + |
|
26081 +For RFC822 attachments (these are messages attached to messages, with a |
|
26082 +content-type of "message/rfc822"), the ACL is called again in the same manner |
|
26083 +as for the primary message, only that the $mime_is_rfc822 expansion variable is |
|
26084 +set (see below). Attached messages are always decoded to disk before being |
|
26085 +checked, and the files are unlinked once the check is done. |
|
26086 + |
|
26087 +The MIME ACL supports the regex and mime_regex conditions. These can be used to |
|
26088 +match regular expressions against raw and decoded MIME parts, respectively. |
|
26089 +They are described in section 41.5. |
|
26090 + |
|
26091 +The following list describes all expansion variables that are available in the |
|
26092 +MIME ACL: |
|
26093 + |
|
26094 +$mime_boundary |
|
26095 + |
|
26096 + If the current part is a multipart (see $mime_is_multipart) below, it |
|
26097 + should have a boundary string, which is stored in this variable. If the |
|
26098 + current part has no boundary parameter in the Content-Type: header, this |
|
26099 + variable contains the empty string. |
|
26100 + |
|
26101 +$mime_charset |
|
26102 + |
|
26103 + This variable contains the character set identifier, if one was found in |
|
26104 + the Content-Type: header. Examples for charset identifiers are: |
|
26105 + |
|
26106 + us-ascii |
|
26107 + gb2312 (Chinese) |
|
26108 + iso-8859-1 |
|
26109 + |
|
26110 + Please note that this value is not normalized, so you should do matches |
|
26111 + case-insensitively. |
|
26112 + |
|
26113 +$mime_content_description |
|
26114 + |
|
26115 + This variable contains the normalized content of the Content-Description: |
|
26116 + header. It can contain a human-readable description of the parts content. |
|
26117 + Some implementations repeat the filename for attachments here, but they are |
|
26118 + usually only used for display purposes. |
|
26119 + |
|
26120 +$mime_content_disposition |
|
26121 + |
|
26122 + This variable contains the normalized content of the Content-Disposition: |
|
26123 + header. You can expect strings like "attachment" or "inline" here. |
|
26124 + |
|
26125 +$mime_content_id |
|
26126 + |
|
26127 + This variable contains the normalized content of the Content-ID: header. |
|
26128 + This is a unique ID that can be used to reference a part from another part. |
|
26129 + |
|
26130 +$mime_content_size |
|
26131 + |
|
26132 + This variable is set only after the decode modifier (see above) has been |
|
26133 + successfully run. It contains the size of the decoded part in kilobytes. |
|
26134 + The size is always rounded up to full kilobytes, so only a completely empty |
|
26135 + part has a $mime_content_size of zero. |
|
26136 + |
|
26137 +$mime_content_transfer_encoding |
|
26138 + |
|
26139 + This variable contains the normalized content of the |
|
26140 + Content-transfer-encoding: header. This is a symbolic name for an encoding |
|
26141 + type. Typical values are "base64" and "quoted-printable". |
|
26142 + |
|
26143 +$mime_content_type |
|
26144 + |
|
26145 + If the MIME part has a Content-Type: header, this variable contains its |
|
26146 + value, lowercased, and without any options (like "name" or "charset"). Here |
|
26147 + are some examples of popular MIME types, as they may appear in this |
|
26148 + variable: |
|
26149 + |
|
26150 + text/plain |
|
26151 + text/html |
|
26152 + application/octet-stream |
|
26153 + image/jpeg |
|
26154 + audio/midi |
|
26155 + |
|
26156 + If the MIME part has no Content-Type: header, this variable contains the |
|
26157 + empty string. |
|
26158 + |
|
26159 +$mime_decoded_filename |
|
26160 + |
|
26161 + This variable is set only after the decode modifier (see above) has been |
|
26162 + successfully run. It contains the full path and file name of the file |
|
26163 + containing the decoded data. |
|
26164 + |
|
26165 +$mime_filename |
|
26166 + |
|
26167 + This is perhaps the most important of the MIME variables. It contains a |
|
26168 + proposed filename for an attachment, if one was found in either the |
|
26169 + Content-Type: or Content-Disposition: headers. The filename will be RFC2047 |
|
26170 + decoded, but no additional sanity checks are done. If no filename was |
|
26171 + found, this variable contains the empty string. |
|
26172 + |
|
26173 +$mime_is_coverletter |
|
26174 + |
|
26175 + This variable attempts to differentiate the "cover letter" of an e-mail |
|
26176 + from attached data. It can be used to clamp down on flashy or unnecessarily |
|
26177 + encoded content in the cover letter, while not restricting attachments at |
|
26178 + all. |
|
26179 + |
|
26180 + The variable contains 1 (true) for a MIME part believed to be part of the |
|
26181 + cover letter, and 0 (false) for an attachment. At present, the algorithm is |
|
26182 + as follows: |
|
26183 + |
|
26184 + 1. The outermost MIME part of a message is always a cover letter. |
|
26185 + |
|
26186 + 2. If a multipart/alternative or multipart/related MIME part is a cover |
|
26187 + letter, so are all MIME subparts within that multipart. |
|
26188 + |
|
26189 + 3. If any other multipart is a cover letter, the first subpart is a cover |
|
26190 + letter, and the rest are attachments. |
|
26191 + |
|
26192 + 4. All parts contained within an attachment multipart are attachments. |
|
26193 + |
|
26194 + As an example, the following will ban "HTML mail" (including that sent with |
|
26195 + alternative plain text), while allowing HTML files to be attached. HTML |
|
26196 + coverletter mail attached to non-HMTL coverletter mail will also be |
|
26197 + allowed: |
|
26198 + |
|
26199 + deny message = HTML mail is not accepted here |
|
26200 + !condition = $mime_is_rfc822 |
|
26201 + condition = $mime_is_coverletter |
|
26202 + condition = ${if eq{$mime_content_type}{text/html}{1}{0}} |
|
26203 + |
|
26204 +$mime_is_multipart |
|
26205 + |
|
26206 + This variable has the value 1 (true) when the current part has the main |
|
26207 + type "multipart", for example "multipart/alternative" or "multipart/mixed". |
|
26208 + Since multipart entities only serve as containers for other parts, you may |
|
26209 + not want to carry out specific actions on them. |
|
26210 + |
|
26211 +$mime_is_rfc822 |
|
26212 + |
|
26213 + This variable has the value 1 (true) if the current part is not a part of |
|
26214 + the checked message itself, but part of an attached message. Attached |
|
26215 + message decoding is fully recursive. |
|
26216 + |
|
26217 +$mime_part_count |
|
26218 + |
|
26219 + This variable is a counter that is raised for each processed MIME part. It |
|
26220 + starts at zero for the very first part (which is usually a multipart). The |
|
26221 + counter is per-message, so it is reset when processing RFC822 attachments |
|
26222 + (see $mime_is_rfc822). The counter stays set after acl_smtp_mime is |
|
26223 + complete, so you can use it in the DATA ACL to determine the number of MIME |
|
26224 + parts of a message. For non-MIME messages, this variable contains the value |
|
26225 + -1. |
|
26226 + |
|
26227 +41.5Â Scanning with regular expressions |
|
26228 + |
|
26229 +You can specify your own custom regular expression matches on the full body of |
|
26230 +the message, or on individual MIME parts. |
|
26231 + |
|
26232 +The regex condition takes one or more regular expressions as arguments and |
|
26233 +matches them against the full message (when called in the DATA ACL) or a raw |
|
26234 +MIME part (when called in the MIME ACL). The regex condition matches linewise, |
|
26235 +with a maximum line length of 32K characters. That means you cannot have |
|
26236 +multiline matches with the regex condition. |
|
26237 + |
|
26238 +The mime_regex condition can be called only in the MIME ACL. It matches up to |
|
26239 +32K of decoded content (the whole content at once, not linewise). If the part |
|
26240 +has not been decoded with the decode modifier earlier in the ACL, it is decoded |
|
26241 +automatically when mime_regex is executed (using default path and filename |
|
26242 +values). If the decoded data is larger than 32K, only the first 32K characters |
|
26243 +are checked. |
|
26244 + |
|
26245 +The regular expressions are passed as a colon-separated list. To include a |
|
26246 +literal colon, you must double it. Since the whole right-hand side string is |
|
26247 +expanded before being used, you must also escape dollar signs and backslashes |
|
26248 +with more backslashes, or use the "\N" facility to disable expansion. Here is a |
|
26249 +simple example that contains two regular expressions: |
|
26250 + |
|
26251 +deny message = contains blacklisted regex ($regex_match_string) |
|
26252 + regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL |
|
26253 + |
|
26254 +The conditions returns true if any one of the regular expressions matches. The |
|
26255 +$regex_match_string expansion variable is then set up and contains the matching |
|
26256 +regular expression. |
|
26257 + |
|
26258 +Warning: With large messages, these conditions can be fairly CPU-intensive. |
|
26259 + |
|
26260 +41.6Â The demime condition |
|
26261 + |
|
26262 +The demime ACL condition provides MIME unpacking, sanity checking and file |
|
26263 +extension blocking. It is usable only in the DATA and non-SMTP ACLs. The demime |
|
26264 +condition uses a simpler interface to MIME decoding than the MIME ACL |
|
26265 +functionality, but provides no additional facilities. Please note that this |
|
26266 +condition is deprecated and kept only for backward compatibility. You must set |
|
26267 +the WITH_OLD_DEMIME option in Local/Makefile at build time to be able to use |
|
26268 +the demime condition. |
|
26269 + |
|
26270 +The demime condition unpacks MIME containers in the message. It detects errors |
|
26271 +in MIME containers and can match file extensions found in the message against a |
|
26272 +list. Using this facility produces files containing the unpacked MIME parts of |
|
26273 +the message in the temporary scan directory. If you do antivirus scanning, it |
|
26274 +is recommended that you use the demime condition before the antivirus (malware) |
|
26275 +condition. |
|
26276 + |
|
26277 +On the right-hand side of the demime condition you can pass a colon-separated |
|
26278 +list of file extensions that it should match against. For example: |
|
26279 + |
|
26280 +deny message = Found blacklisted file attachment |
|
26281 + demime = vbs:com:bat:pif:prf:lnk |
|
26282 + |
|
26283 +If one of the file extensions is found, the condition is true, otherwise it is |
|
26284 +false. If there is a temporary error while demimeing (for example, "disk |
|
26285 +full"), the condition defers, and the message is temporarily rejected (unless |
|
26286 +the condition is on a warn verb). |
|
26287 + |
|
26288 +The right-hand side is expanded before being treated as a list, so you can have |
|
26289 +conditions and lookups there. If it expands to an empty string, "false", or |
|
26290 +zero ("0"), no demimeing is done and the condition is false. |
|
26291 + |
|
26292 +The demime condition set the following variables: |
|
26293 + |
|
26294 +$demime_errorlevel |
|
26295 + |
|
26296 + When an error is detected in a MIME container, this variable contains the |
|
26297 + severity of the error, as an integer number. The higher the value, the more |
|
26298 + severe the error (the current maximum value is 3). If this variable is |
|
26299 + unset or zero, no error occurred. |
|
26300 + |
|
26301 +$demime_reason |
|
26302 + |
|
26303 + When $demime_errorlevel is greater than zero, this variable contains a |
|
26304 + human-readable text string describing the MIME error that occurred. |
|
26305 + |
|
26306 +$found_extension |
|
26307 + |
|
26308 + When the demime condition is true, this variable contains the file |
|
26309 + extension it found. |
|
26310 + |
|
26311 +Both $demime_errorlevel and $demime_reason are set by the first call of the |
|
26312 +demime condition, and are not changed on subsequent calls. |
|
26313 + |
|
26314 +If you do not want to check for file extensions, but rather use the demime |
|
26315 +condition for unpacking or error checking purposes, pass "*" as the right-hand |
|
26316 +side value. Here is a more elaborate example of how to use this facility: |
|
26317 + |
|
26318 +# Reject messages with serious MIME container errors |
|
26319 +deny message = Found MIME error ($demime_reason). |
|
26320 + demime = * |
|
26321 + condition = ${if >{$demime_errorlevel}{2}{1}{0}} |
|
26322 + |
|
26323 +# Reject known virus spreading file extensions. |
|
26324 +# Accepting these is pretty much braindead. |
|
26325 +deny message = contains $found_extension file (blacklisted). |
|
26326 + demime = com:vbs:bat:pif:scr |
|
26327 + |
|
26328 +# Freeze .exe and .doc files. Postmaster can |
|
26329 +# examine them and eventually thaw them. |
|
26330 +deny log_message = Another $found_extension file. |
|
26331 + demime = exe:doc |
|
26332 + control = freeze |
|
26333 + |
|
26334 +42. Adding a local scan function to Exim |
|
26335 + |
|
26336 +In these days of email worms, viruses, and ever-increasing spam, some sites |
|
26337 +want to apply a lot of checking to messages before accepting them. |
|
26338 + |
|
26339 +The content scanning extension (chapter 41) has facilities for passing messages |
|
26340 +to external virus and spam scanning software. You can also do a certain amount |
|
26341 +in Exim itself through string expansions and the condition condition in the ACL |
|
26342 +that runs after the SMTP DATA command or the ACL for non-SMTP messages (see |
|
26343 +chapter 40), but this has its limitations. |
|
26344 + |
|
26345 +To allow for further customization to a site's own requirements, there is the |
|
26346 +possibility of linking Exim with a private message scanning function, written |
|
26347 +in C. If you want to run code that is written in something other than C, you |
|
26348 +can of course use a little C stub to call it. |
|
26349 + |
|
26350 +The local scan function is run once for every incoming message, at the point |
|
26351 +when Exim is just about to accept the message. It can therefore be used to |
|
26352 +control non-SMTP messages from local processes as well as messages arriving via |
|
26353 +SMTP. |
|
26354 + |
|
26355 +Exim applies a timeout to calls of the local scan function, and there is an |
|
26356 +option called local_scan_timeout for setting it. The default is 5 minutes. Zero |
|
26357 +means "no timeout". Exim also sets up signal handlers for SIGSEGV, SIGILL, |
|
26358 +SIGFPE, and SIGBUS before calling the local scan function, so that the most |
|
26359 +common types of crash are caught. If the timeout is exceeded or one of those |
|
26360 +signals is caught, the incoming message is rejected with a temporary error if |
|
26361 +it is an SMTP message. For a non-SMTP message, the message is dropped and Exim |
|
26362 +ends with a non-zero code. The incident is logged on the main and reject logs. |
|
26363 + |
|
26364 +42.1Â Building Exim to use a local scan function |
|
26365 + |
|
26366 +To make use of the local scan function feature, you must tell Exim where your |
|
26367 +function is before building Exim, by setting LOCAL_SCAN_SOURCE in your Local/ |
|
26368 +Makefile. A recommended place to put it is in the Local directory, so you might |
|
26369 +set |
|
26370 + |
|
26371 +LOCAL_SCAN_SOURCE=Local/local_scan.c |
|
26372 + |
|
26373 +for example. The function must be called local_scan(). It is called by Exim |
|
26374 +after it has received a message, when the success return code is about to be |
|
26375 +sent. This is after all the ACLs have been run. The return code from your |
|
26376 +function controls whether the message is actually accepted or not. There is a |
|
26377 +commented template function (that just accepts the message) in the file _src/ |
|
26378 +local_scan.c_. |
|
26379 + |
|
26380 +If you want to make use of Exim's run time configuration file to set options |
|
26381 +for your local_scan() function, you must also set |
|
26382 + |
|
26383 +LOCAL_SCAN_HAS_OPTIONS=yes |
|
26384 + |
|
26385 +in Local/Makefile (see section 42.3 below). |
|
26386 + |
|
26387 +42.2Â API for local_scan() |
|
26388 + |
|
26389 +You must include this line near the start of your code: |
|
26390 + |
|
26391 +#include "local_scan.h" |
|
26392 + |
|
26393 +This header file defines a number of variables and other values, and the |
|
26394 +prototype for the function itself. Exim is coded to use unsigned char values |
|
26395 +almost exclusively, and one of the things this header defines is a shorthand |
|
26396 +for "unsigned char" called "uschar". It also contains the following macro |
|
26397 +definitions, to simplify casting character strings and pointers to character |
|
26398 +strings: |
|
26399 + |
|
26400 +#define CS (char *) |
|
26401 +#define CCS (const char *) |
|
26402 +#define CSS (char **) |
|
26403 +#define US (unsigned char *) |
|
26404 +#define CUS (const unsigned char *) |
|
26405 +#define USS (unsigned char **) |
|
26406 + |
|
26407 +The function prototype for local_scan() is: |
|
26408 + |
|
26409 +extern int local_scan(int fd, uschar **return_text); |
|
26410 + |
|
26411 +The arguments are as follows: |
|
26412 + |
|
26413 + * fd is a file descriptor for the file that contains the body of the message |
|
26414 + (the -D file). The file is open for reading and writing, but updating it is |
|
26415 + not recommended. Warning: You must not close this file descriptor. |
|
26416 + |
|
26417 + The descriptor is positioned at character 19 of the file, which is the |
|
26418 + first character of the body itself, because the first 19 characters are the |
|
26419 + message id followed by "-D" and a newline. If you rewind the file, you |
|
26420 + should use the macro SPOOL_DATA_START_OFFSET to reset to the start of the |
|
26421 + data, just in case this changes in some future version. |
|
26422 + |
|
26423 + * return_text is an address which you can use to return a pointer to a text |
|
26424 + string at the end of the function. The value it points to on entry is NULL. |
|
26425 + |
|
26426 +The function must return an int value which is one of the following macros: |
|
26427 + |
|
26428 +"LOCAL_SCAN_ACCEPT" |
|
26429 + |
|
26430 + The message is accepted. If you pass back a string of text, it is saved |
|
26431 + with the message, and made available in the variable $local_scan_data. No |
|
26432 + newlines are permitted (if there are any, they are turned into spaces) and |
|
26433 + the maximum length of text is 1000 characters. |
|
26434 + |
|
26435 +"LOCAL_SCAN_ACCEPT_FREEZE" |
|
26436 + |
|
26437 + This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is |
|
26438 + queued without immediate delivery, and is frozen. |
|
26439 + |
|
26440 +"LOCAL_SCAN_ACCEPT_QUEUE" |
|
26441 + |
|
26442 + This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is |
|
26443 + queued without immediate delivery. |
|
26444 + |
|
26445 +"LOCAL_SCAN_REJECT" |
|
26446 + |
|
26447 + The message is rejected; the returned text is used as an error message |
|
26448 + which is passed back to the sender and which is also logged. Newlines are |
|
26449 + permitted - they cause a multiline response for SMTP rejections, but are |
|
26450 + converted to "\n" in log lines. If no message is given, "Administrative |
|
26451 + prohibition" is used. |
|
26452 + |
|
26453 +"LOCAL_SCAN_TEMPREJECT" |
|
26454 + |
|
26455 + The message is temporarily rejected; the returned text is used as an error |
|
26456 + message as for LOCAL_SCAN_REJECT. If no message is given, "Temporary local |
|
26457 + problem" is used. |
|
26458 + |
|
26459 +"LOCAL_SCAN_REJECT_NOLOGHDR" |
|
26460 + |
|
26461 + This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected |
|
26462 + message is not written to the reject log. It has the effect of unsetting |
|
26463 + the rejected_header log selector for just this rejection. If |
|
26464 + rejected_header is already unset (see the discussion of the log_selection |
|
26465 + option in section 49.15), this code is the same as LOCAL_SCAN_REJECT. |
|
26466 + |
|
26467 +"LOCAL_SCAN_TEMPREJECT_NOLOGHDR" |
|
26468 + |
|
26469 + This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that |
|
26470 + LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT. |
|
26471 + |
|
26472 +If the message is not being received by interactive SMTP, rejections are |
|
26473 +reported by writing to stderr or by sending an email, as configured by the -oe |
|
26474 +command line options. |
|
26475 + |
|
26476 +42.3Â Configuration options for local_scan() |
|
26477 + |
|
26478 +It is possible to have option settings in the main configuration file that set |
|
26479 +values in static variables in the local_scan() module. If you want to do this, |
|
26480 +you must have the line |
|
26481 + |
|
26482 +LOCAL_SCAN_HAS_OPTIONS=yes |
|
26483 + |
|
26484 +in your Local/Makefile when you build Exim. (This line is in OS/ |
|
26485 +Makefile-Default, commented out). Then, in the local_scan() source file, you |
|
26486 +must define static variables to hold the option values, and a table to define |
|
26487 +them. |
|
26488 + |
|
26489 +The table must be a vector called local_scan_options, of type "optionlist". |
|
26490 +Each entry is a triplet, consisting of a name, an option type, and a pointer to |
|
26491 +the variable that holds the value. The entries must appear in alphabetical |
|
26492 +order. Following local_scan_options you must also define a variable called |
|
26493 +local_scan_options_count that contains the number of entries in the table. Here |
|
26494 +is a short example, showing two kinds of option: |
|
26495 + |
|
26496 +static int my_integer_option = 42; |
|
26497 +static uschar *my_string_option = US"a default string"; |
|
26498 + |
|
26499 +optionlist local_scan_options[] = { |
|
26500 + { "my_integer", opt_int, &my_integer_option }, |
|
26501 + { "my_string", opt_stringptr, &my_string_option } |
|
26502 +}; |
|
26503 + |
|
26504 +int local_scan_options_count = |
|
26505 + sizeof(local_scan_options)/sizeof(optionlist); |
|
26506 + |
|
26507 +The values of the variables can now be changed from Exim's runtime |
|
26508 +configuration file by including a local scan section as in this example: |
|
26509 + |
|
26510 +begin local_scan |
|
26511 +my_integer = 99 |
|
26512 +my_string = some string of text... |
|
26513 + |
|
26514 +The available types of option data are as follows: |
|
26515 + |
|
26516 +opt_bool |
|
26517 + |
|
26518 + This specifies a boolean (true/false) option. The address should point to a |
|
26519 + variable of type "BOOL", which will be set to TRUE or FALSE, which are |
|
26520 + macros that are defined as "1" and "0", respectively. If you want to detect |
|
26521 + whether such a variable has been set at all, you can initialize it to |
|
26522 + TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than |
|
26523 + two values.) |
|
26524 + |
|
26525 +opt_fixed |
|
26526 + |
|
26527 + This specifies a fixed point number, such as is used for load averages. The |
|
26528 + address should point to a variable of type "int". The value is stored |
|
26529 + multiplied by 1000, so, for example, 1.4142 is truncated and stored as |
|
26530 + 1414. |
|
26531 + |
|
26532 +opt_int |
|
26533 + |
|
26534 + This specifies an integer; the address should point to a variable of type |
|
26535 + "int". The value may be specified in any of the integer formats accepted by |
|
26536 + Exim. |
|
26537 + |
|
26538 +opt_mkint |
|
26539 + |
|
26540 + This is the same as opt_int, except that when such a value is output in a |
|
26541 + -bP listing, if it is an exact number of kilobytes or megabytes, it is |
|
26542 + printed with the suffix K or M. |
|
26543 + |
|
26544 +opt_octint |
|
26545 + |
|
26546 + This also specifies an integer, but the value is always interpreted as an |
|
26547 + octal integer, whether or not it starts with the digit zero, and it is |
|
26548 + always output in octal. |
|
26549 + |
|
26550 +opt_stringptr |
|
26551 + |
|
26552 + This specifies a string value; the address must be a pointer to a variable |
|
26553 + that points to a string (for example, of type "uschar *"). |
|
26554 + |
|
26555 +opt_time |
|
26556 + |
|
26557 + This specifies a time interval value. The address must point to a variable |
|
26558 + of type "int". The value that is placed there is a number of seconds. |
|
26559 + |
|
26560 +If the -bP command line option is followed by "local_scan", Exim prints out the |
|
26561 +values of all the local_scan() options. |
|
26562 + |
|
26563 +42.4Â Available Exim variables |
|
26564 + |
|
26565 +The header local_scan.h gives you access to a number of C variables. These are |
|
26566 +the only ones that are guaranteed to be maintained from release to release. |
|
26567 +Note, however, that you can obtain the value of any Exim expansion variable, |
|
26568 +including $recipients, by calling expand_string(). The exported C variables are |
|
26569 +as follows: |
|
26570 + |
|
26571 +int body_linecount |
|
26572 + |
|
26573 + This variable contains the number of lines in the message's body. |
|
26574 + |
|
26575 +int body_zerocount |
|
26576 + |
|
26577 + This variable contains the number of binary zero bytes in the message's |
|
26578 + body. |
|
26579 + |
|
26580 +unsigned int debug_selector |
|
26581 + |
|
26582 + This variable is set to zero when no debugging is taking place. Otherwise, |
|
26583 + it is a bitmap of debugging selectors. Two bits are identified for use in |
|
26584 + local_scan(); they are defined as macros: |
|
26585 + |
|
26586 + * The "D_v" bit is set when -v was present on the command line. This is a |
|
26587 + testing option that is not privileged - any caller may set it. All the |
|
26588 + other selector bits can be set only by admin users. |
|
26589 + |
|
26590 + * The "D_local_scan" bit is provided for use by local_scan(); it is set |
|
26591 + by the "+local_scan" debug selector. It is not included in the default |
|
26592 + set of debugging bits. |
|
26593 + |
|
26594 + Thus, to write to the debugging output only when "+local_scan" has been |
|
26595 + selected, you should use code like this: |
|
26596 + |
|
26597 + if ((debug_selector & D_local_scan) != 0) |
|
26598 + debug_printf("xxx", ...); |
|
26599 + |
|
26600 +uschar *expand_string_message |
|
26601 + |
|
26602 + After a failing call to expand_string() (returned value NULL), the variable |
|
26603 + expand_string_message contains the error message, zero-terminated. |
|
26604 + |
|
26605 +header_line *header_list |
|
26606 + |
|
26607 + A pointer to a chain of header lines. The header_line structure is |
|
26608 + discussed below. |
|
26609 + |
|
26610 +header_line *header_last |
|
26611 + |
|
26612 + A pointer to the last of the header lines. |
|
26613 + |
|
26614 +uschar *headers_charset |
|
26615 + |
|
26616 + The value of the headers_charset configuration option. |
|
26617 + |
|
26618 +BOOLÂ host_checking |
|
26619 + |
|
26620 + This variable is TRUE during a host checking session that is initiated by |
|
26621 + the -bh command line option. |
|
26622 + |
|
26623 +uschar *interface_address |
|
26624 + |
|
26625 + The IP address of the interface that received the message, as a string. |
|
26626 + This is NULL for locally submitted messages. |
|
26627 + |
|
26628 +int interface_port |
|
26629 + |
|
26630 + The port on which this message was received. When testing with the -bh |
|
26631 + command line option, the value of this variable is -1 unless a port has |
|
26632 + been specified via the -oMi option. |
|
26633 + |
|
26634 +uschar *message_id |
|
26635 + |
|
26636 + This variable contains Exim's message id for the incoming message (the |
|
26637 + value of $message_exim_id) as a zero-terminated string. |
|
26638 + |
|
26639 +uschar *received_protocol |
|
26640 + |
|
26641 + The name of the protocol by which the message was received. |
|
26642 + |
|
26643 +int recipients_count |
|
26644 + |
|
26645 + The number of accepted recipients. |
|
26646 + |
|
26647 +recipient_item *recipients_list |
|
26648 + |
|
26649 + The list of accepted recipients, held in a vector of length |
|
26650 + recipients_count. The recipient_item structure is discussed below. You can |
|
26651 + add additional recipients by calling receive_add_recipient() (see below). |
|
26652 + You can delete recipients by removing them from the vector and adjusting |
|
26653 + the value in recipients_count. In particular, by setting recipients_count |
|
26654 + to zero you remove all recipients. If you then return the value |
|
26655 + "LOCAL_SCAN_ACCEPT", the message is accepted, but immediately blackholed. |
|
26656 + To replace the recipients, you can set recipients_count to zero and then |
|
26657 + call receive_add_recipient() as often as needed. |
|
26658 + |
|
26659 +uschar *sender_address |
|
26660 + |
|
26661 + The envelope sender address. For bounce messages this is the empty string. |
|
26662 + |
|
26663 +uschar *sender_host_address |
|
26664 + |
|
26665 + The IP address of the sending host, as a string. This is NULL for |
|
26666 + locally-submitted messages. |
|
26667 + |
|
26668 +uschar *sender_host_authenticated |
|
26669 + |
|
26670 + The name of the authentication mechanism that was used, or NULL if the |
|
26671 + message was not received over an authenticated SMTP connection. |
|
26672 + |
|
26673 +uschar *sender_host_name |
|
26674 + |
|
26675 + The name of the sending host, if known. |
|
26676 + |
|
26677 +int sender_host_port |
|
26678 + |
|
26679 + The port on the sending host. |
|
26680 + |
|
26681 +BOOLÂ smtp_input |
|
26682 + |
|
26683 + This variable is TRUE for all SMTP input, including BSMTP. |
|
26684 + |
|
26685 +BOOLÂ smtp_batched_input |
|
26686 + |
|
26687 + This variable is TRUE for BSMTP input. |
|
26688 + |
|
26689 +int store_pool |
|
26690 + |
|
26691 + The contents of this variable control which pool of memory is used for new |
|
26692 + requests. See section 42.8 for details. |
|
26693 + |
|
26694 +42.5Â Structure of header lines |
|
26695 + |
|
26696 +The header_line structure contains the members listed below. You can add |
|
26697 +additional header lines by calling the header_add() function (see below). You |
|
26698 +can cause header lines to be ignored (deleted) by setting their type to *. |
|
26699 + |
|
26700 +struct header_line *next |
|
26701 + |
|
26702 + A pointer to the next header line, or NULL for the last line. |
|
26703 + |
|
26704 +int type |
|
26705 + |
|
26706 + A code identifying certain headers that Exim recognizes. The codes are |
|
26707 + printing characters, and are documented in chapter 53 of this manual. |
|
26708 + Notice in particular that any header line whose type is * is not |
|
26709 + transmitted with the message. This flagging is used for header lines that |
|
26710 + have been rewritten, or are to be removed (for example, Envelope-sender: |
|
26711 + header lines.) Effectively, * means "deleted". |
|
26712 + |
|
26713 +int slen |
|
26714 + |
|
26715 + The number of characters in the header line, including the terminating and |
|
26716 + any internal newlines. |
|
26717 + |
|
26718 +uschar *text |
|
26719 + |
|
26720 + A pointer to the text of the header. It always ends with a newline, |
|
26721 + followed by a zero byte. Internal newlines are preserved. |
|
26722 + |
|
26723 +42.6Â Structure of recipient items |
|
26724 + |
|
26725 +The recipient_item structure contains these members: |
|
26726 + |
|
26727 +uschar *address |
|
26728 + |
|
26729 + This is a pointer to the recipient address as it was received. |
|
26730 + |
|
26731 +int pno |
|
26732 + |
|
26733 + This is used in later Exim processing when top level addresses are created |
|
26734 + by the one_time option. It is not relevant at the time local_scan() is run |
|
26735 + and must always contain -1 at this stage. |
|
26736 + |
|
26737 +uschar *errors_to |
|
26738 + |
|
26739 + If this value is not NULL, bounce messages caused by failing to deliver to |
|
26740 + the recipient are sent to the address it contains. In other words, it |
|
26741 + overrides the envelope sender for this one recipient. (Compare the |
|
26742 + errors_to generic router option.) If a local_scan() function sets an |
|
26743 + errors_to field to an unqualified address, Exim qualifies it using the |
|
26744 + domain from qualify_recipient. When local_scan() is called, the errors_to |
|
26745 + field is NULL for all recipients. |
|
26746 + |
|
26747 +42.7Â Available Exim functions |
|
26748 + |
|
26749 +The header local_scan.h gives you access to a number of Exim functions. These |
|
26750 +are the only ones that are guaranteed to be maintained from release to release: |
|
26751 + |
|
26752 +pid_t child_open |
|
26753 + (uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, |
|
26754 + Â Â BOOLÂ make_leader) |
|
26755 + |
|
26756 + This function creates a child process that runs the command specified by |
|
26757 + argv. The environment for the process is specified by envp, which can be |
|
26758 + NULL if no environment variables are to be passed. A new umask is supplied |
|
26759 + for the process in newumask. |
|
26760 + |
|
26761 + Pipes to the standard input and output of the new process are set up and |
|
26762 + returned to the caller via the infdptr and outfdptr arguments. The standard |
|
26763 + error is cloned to the standard output. If there are any file descriptors |
|
26764 + "in the way" in the new process, they are closed. If the final argument is |
|
26765 + TRUE, the new process is made into a process group leader. |
|
26766 + |
|
26767 + The function returns the pid of the new process, or -1 if things go wrong. |
|
26768 + |
|
26769 +int child_close(pid_t pid, int timeout) |
|
26770 + |
|
26771 + This function waits for a child process to terminate, or for a timeout (in |
|
26772 + seconds) to expire. A timeout value of zero means wait as long as it takes. |
|
26773 + The return value is as follows: |
|
26774 + |
|
26775 + * >= 0 |
|
26776 + |
|
26777 + The process terminated by a normal exit and the value is the process |
|
26778 + ending status. |
|
26779 + |
|
26780 + * < 0 and > -256 |
|
26781 + |
|
26782 + The process was terminated by a signal and the value is the negation of |
|
26783 + the signal number. |
|
26784 + |
|
26785 + * -256 |
|
26786 + |
|
26787 + The process timed out. |
|
26788 + |
|
26789 + * -257 |
|
26790 + |
|
26791 + The was some other error in wait(); errno is still set. |
|
26792 + |
|
26793 +pid_t child_open_exim(int *fd) |
|
26794 + |
|
26795 + This function provide you with a means of submitting a new message to Exim. |
|
26796 + (Of course, you can also call /usr/sbin/sendmail yourself if you want, but |
|
26797 + this packages it all up for you.) The function creates a pipe, forks a |
|
26798 + subprocess that is running |
|
26799 + |
|
26800 + exim -t -oem -oi -f <> |
|
26801 + |
|
26802 + and returns to you (via the "int *" argument) a file descriptor for the |
|
26803 + pipe that is connected to the standard input. The yield of the function is |
|
26804 + the PID of the subprocess. You can then write a message to the file |
|
26805 + descriptor, with recipients in To:, Cc:, and/or Bcc: header lines. |
|
26806 + |
|
26807 + When you have finished, call child_close() to wait for the process to |
|
26808 + finish and to collect its ending status. A timeout value of zero is usually |
|
26809 + fine in this circumstance. Unless you have made a mistake with the |
|
26810 + recipient addresses, you should get a return code of zero. |
|
26811 + |
|
26812 +pid_t child_open_exim2 |
|
26813 + (int *fd, uschar *sender, uschar *sender_authentication) |
|
26814 + |
|
26815 + This function is a more sophisticated version of child_open(). The command |
|
26816 + that it runs is: |
|
26817 + |
|
26818 + exim -t -oem -oi -f sender -oMas sender_authentication |
|
26819 + |
|
26820 + The third argument may be NULL, in which case the -oMas option is omitted. |
|
26821 + |
|
26822 +void debug_printf(char *, ...) |
|
26823 + |
|
26824 + This is Exim's debugging function, with arguments as for (printf(). The |
|
26825 + output is written to the standard error stream. If no debugging is |
|
26826 + selected, calls to debug_printf() have no effect. Normally, you should make |
|
26827 + calls conditional on the "local_scan" debug selector by coding like this: |
|
26828 + |
|
26829 + if ((debug_selector & D_local_scan) != 0) |
|
26830 + debug_printf("xxx", ...); |
|
26831 + |
|
26832 +uschar *expand_string(uschar *string) |
|
26833 + |
|
26834 + This is an interface to Exim's string expansion code. The return value is |
|
26835 + the expanded string, or NULL if there was an expansion failure. The C |
|
26836 + variable expand_string_message contains an error message after an expansion |
|
26837 + failure. If expansion does not change the string, the return value is the |
|
26838 + pointer to the input string. Otherwise, the return value points to a new |
|
26839 + block of memory that was obtained by a call to store_get(). See section |
|
26840 + 42.8 below for a discussion of memory handling. |
|
26841 + |
|
26842 +void header_add(int type, char *format, ...) |
|
26843 + |
|
26844 + This function allows you to an add additional header line at the end of the |
|
26845 + existing ones. The first argument is the type, and should normally be a |
|
26846 + space character. The second argument is a format string and any number of |
|
26847 + substitution arguments as for sprintf(). You may include internal newlines |
|
26848 + if you want, and you must ensure that the string ends with a newline. |
|
26849 + |
|
26850 +void header_add_at_position |
|
26851 + (BOOL after, uschar *name, BOOL topnot, int type, char *format, |
|
26852 + Â Â ...) |
|
26853 + |
|
26854 + This function adds a new header line at a specified point in the header |
|
26855 + chain. The header itself is specified as for header_add(). |
|
26856 + |
|
26857 + If name is NULL, the new header is added at the end of the chain if after |
|
26858 + is true, or at the start if after is false. If name is not NULL, the header |
|
26859 + lines are searched for the first non-deleted header that matches the name. |
|
26860 + If one is found, the new header is added before it if after is false. If |
|
26861 + after is true, the new header is added after the found header and any |
|
26862 + adjacent subsequent ones with the same name (even if marked "deleted"). If |
|
26863 + no matching non-deleted header is found, the topnot option controls where |
|
26864 + the header is added. If it is true, addition is at the top; otherwise at |
|
26865 + the bottom. Thus, to add a header after all the Received: headers, or at |
|
26866 + the top if there are no Received: headers, you could use |
|
26867 + |
|
26868 + header_add_at_position(TRUE, US"Received", TRUE, |
|
26869 + ' ', "X-xxx: ..."); |
|
26870 + |
|
26871 + Normally, there is always at least one non-deleted Received: header, but |
|
26872 + there may not be if received_header_text expands to an empty string. |
|
26873 + |
|
26874 +void header_remove(int occurrence, uschar *name) |
|
26875 + |
|
26876 + This function removes header lines. If occurrence is zero or negative, all |
|
26877 + occurrences of the header are removed. If occurrence is greater than zero, |
|
26878 + that particular instance of the header is removed. If no header(s) can be |
|
26879 + found that match the specification, the function does nothing. |
|
26880 + |
|
26881 +BOOLÂ header_testname |
|
26882 + (header_line *hdr, uschar *name, int length, BOOL notdel) |
|
26883 + |
|
26884 + This function tests whether the given header has the given name. It is not |
|
26885 + just a string comparison, because white space is permitted between the name |
|
26886 + and the colon. If the notdel argument is true, a false return is forced for |
|
26887 + all "deleted" headers; otherwise they are not treated specially. For |
|
26888 + example: |
|
26889 + |
|
26890 + if (header_testname(h, US"X-Spam", 6, TRUE)) ... |
|
26891 + |
|
26892 +uschar *lss_b64encode(uschar *cleartext, int length) |
|
26893 + |
|
26894 + This function base64-encodes a string, which is passed by address and |
|
26895 + length. The text may contain bytes of any value, including zero. The result |
|
26896 + is passed back in dynamic memory that is obtained by calling store_get(). |
|
26897 + It is zero-terminated. |
|
26898 + |
|
26899 +int lss_b64decode(uschar *codetext, uschar **cleartext) |
|
26900 + |
|
26901 + This function decodes a base64-encoded string. Its arguments are a |
|
26902 + zero-terminated base64-encoded string and the address of a variable that is |
|
26903 + set to point to the result, which is in dynamic memory. The length of the |
|
26904 + decoded string is the yield of the function. If the input is invalid base64 |
|
26905 + data, the yield is -1. A zero byte is added to the end of the output string |
|
26906 + to make it easy to interpret as a C string (assuming it contains no zeros |
|
26907 + of its own). The added zero byte is not included in the returned count. |
|
26908 + |
|
26909 +int lss_match_domain(uschar *domain, uschar *list) |
|
26910 + |
|
26911 + This function checks for a match in a domain list. Domains are always |
|
26912 + matched caselessly. The return value is one of the following: |
|
26913 + |
|
26914 + OK      match succeeded |
|
26915 + FAIL    match failed |
|
26916 + DEFER   match deferred |
|
26917 + |
|
26918 + DEFER is usually caused by some kind of lookup defer, such as the inability |
|
26919 + to contact a database. |
|
26920 + |
|
26921 +int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless) |
|
26922 + |
|
26923 + This function checks for a match in a local part list. The third argument |
|
26924 + controls case-sensitivity. The return values are as for lss_match_domain(). |
|
26925 + |
|
26926 +int lss_match_address(uschar *address, uschar *list, BOOL caseless) |
|
26927 + |
|
26928 + This function checks for a match in an address list. The third argument |
|
26929 + controls the case-sensitivity of the local part match. The domain is always |
|
26930 + matched caselessly. The return values are as for lss_match_domain(). |
|
26931 + |
|
26932 +int lss_match_host(uschar *host_name, uschar *host_address, uschar *list) |
|
26933 + |
|
26934 + This function checks for a match in a host list. The most common usage is |
|
26935 + expected to be |
|
26936 + |
|
26937 + lss_match_host(sender_host_name, sender_host_address, ...) |
|
26938 + |
|
26939 + An empty address field matches an empty item in the host list. If the host |
|
26940 + name is NULL, the name corresponding to $sender_host_address is |
|
26941 + automatically looked up if a host name is required to match an item in the |
|
26942 + list. The return values are as for lss_match_domain(), but in addition, |
|
26943 + lss_match_host() returns ERROR in the case when it had to look up a host |
|
26944 + name, but the lookup failed. |
|
26945 + |
|
26946 +void log_write(unsigned int selector, int which, char *format, ...) |
|
26947 + |
|
26948 + This function writes to Exim's log files. The first argument should be zero |
|
26949 + (it is concerned with log_selector). The second argument can be "LOG_MAIN" |
|
26950 + or "LOG_REJECT" or "LOG_PANIC" or the inclusive "or" of any combination of |
|
26951 + them. It specifies to which log or logs the message is written. The |
|
26952 + remaining arguments are a format and relevant insertion arguments. The |
|
26953 + string should not contain any newlines, not even at the end. |
|
26954 + |
|
26955 +void receive_add_recipient(uschar *address, int pno) |
|
26956 + |
|
26957 + This function adds an additional recipient to the message. The first |
|
26958 + argument is the recipient address. If it is unqualified (has no domain), it |
|
26959 + is qualified with the qualify_recipient domain. The second argument must |
|
26960 + always be -1. |
|
26961 + |
|
26962 + This function does not allow you to specify a private errors_to address (as |
|
26963 + described with the structure of recipient_item above), because it pre-dates |
|
26964 + the addition of that field to the structure. However, it is easy to add |
|
26965 + such a value afterwards. For example: |
|
26966 + |
|
26967 + receive_add_recipient(US"monitor@mydom.example", -1); |
|
26968 + recipients_list[recipients_count-1].errors_to = |
|
26969 + US"postmaster@mydom.example"; |
|
26970 + |
|
26971 +BOOL receive_remove_recipient(uschar *recipient) |
|
26972 + |
|
26973 + This is a convenience function to remove a named recipient from the list of |
|
26974 + recipients. It returns true if a recipient was removed, and false if no |
|
26975 + matching recipient could be found. The argument must be a complete email |
|
26976 + address. |
|
26977 + |
|
26978 +uschar rfc2047_decode |
|
26979 + (uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, |
|
26980 +   uschar **error) |
|
26981 + |
|
26982 + This function decodes strings that are encoded according to RFC 2047. |
|
26983 + Typically these are the contents of header lines. First, each "encoded |
|
26984 + word" is decoded from the Q or B encoding into a byte-string. Then, if |
|
26985 + provided with the name of a charset encoding, and if the iconv() function |
|
26986 + is available, an attempt is made to translate the result to the named |
|
26987 + character set. If this fails, the binary string is returned with an error |
|
26988 + message. |
|
26989 + |
|
26990 + The first argument is the string to be decoded. If lencheck is TRUE, the |
|
26991 + maximum MIME word length is enforced. The third argument is the target |
|
26992 + encoding, or NULL if no translation is wanted. |
|
26993 + |
|
26994 + If a binary zero is encountered in the decoded string, it is replaced by |
|
26995 + the contents of the zeroval argument. For use with Exim headers, the value |
|
26996 + must not be 0 because header lines are handled as zero-terminated strings. |
|
26997 + |
|
26998 + The function returns the result of processing the string, zero-terminated; |
|
26999 + if lenptr is not NULL, the length of the result is set in the variable to |
|
27000 + which it points. When zeroval is 0, lenptr should not be NULL. |
|
27001 + |
|
27002 + If an error is encountered, the function returns NULL and uses the error |
|
27003 + argument to return an error message. The variable pointed to by error is |
|
27004 + set to NULL if there is no error; it may be set non-NULL even when the |
|
27005 + function returns a non-NULL value if decoding was successful, but there was |
|
27006 + a problem with translation. |
|
27007 + |
|
27008 +int smtp_fflush(void) |
|
27009 + |
|
27010 + This function is used in conjunction with smtp_printf(), as described |
|
27011 + below. |
|
27012 + |
|
27013 +void smtp_printf(char *, ...) |
|
27014 + |
|
27015 + The arguments of this function are like printf(); it writes to the SMTP |
|
27016 + output stream. You should use this function only when there is an SMTP |
|
27017 + output stream, that is, when the incoming message is being received via |
|
27018 + interactive SMTP. This is the case when smtp_input is TRUE and |
|
27019 + smtp_batched_input is FALSE. If you want to test for an incoming message |
|
27020 + from another host (as opposed to a local process that used the -bs command |
|
27021 + line option), you can test the value of sender_host_address, which is |
|
27022 + non-NULL when a remote host is involved. |
|
27023 + |
|
27024 + If an SMTP TLS connection is established, smtp_printf() uses the TLS output |
|
27025 + function, so it can be used for all forms of SMTP connection. |
|
27026 + |
|
27027 + Strings that are written by smtp_printf() from within local_scan() must |
|
27028 + start with an appropriate response code: 550 if you are going to return |
|
27029 + LOCAL_SCAN_REJECT, 451 if you are going to return LOCAL_SCAN_TEMPREJECT, |
|
27030 + and 250 otherwise. Because you are writing the initial lines of a |
|
27031 + multi-line response, the code must be followed by a hyphen to indicate that |
|
27032 + the line is not the final response line. You must also ensure that the |
|
27033 + lines you write terminate with CRLF. For example: |
|
27034 + |
|
27035 + smtp_printf("550-this is some extra info\r\n"); |
|
27036 + return LOCAL_SCAN_REJECT; |
|
27037 + |
|
27038 + Note that you can also create multi-line responses by including newlines in |
|
27039 + the data returned via the return_text argument. The added value of using |
|
27040 + smtp_printf() is that, for instance, you could introduce delays between |
|
27041 + multiple output lines. |
|
27042 + |
|
27043 + The smtp_printf() function does not return any error indication, because it |
|
27044 + does not automatically flush pending output, and therefore does not test |
|
27045 + the state of the stream. (In the main code of Exim, flushing and error |
|
27046 + detection is done when Exim is ready for the next SMTP input command.) If |
|
27047 + you want to flush the output and check for an error (for example, the |
|
27048 + dropping of a TCP/IP connection), you can call smtp_fflush(), which has no |
|
27049 + arguments. It flushes the output stream, and returns a non-zero value if |
|
27050 + there is an error. |
|
27051 + |
|
27052 +void *store_get(int) |
|
27053 + |
|
27054 + This function accesses Exim's internal store (memory) manager. It gets a |
|
27055 + new chunk of memory whose size is given by the argument. Exim bombs out if |
|
27056 + it ever runs out of memory. See the next section for a discussion of memory |
|
27057 + handling. |
|
27058 + |
|
27059 +void *store_get_perm(int) |
|
27060 + |
|
27061 + This function is like store_get(), but it always gets memory from the |
|
27062 + permanent pool. See the next section for a discussion of memory handling. |
|
27063 + |
|
27064 +uschar *string_copy(uschar *string) |
|
27065 + |
|
27066 + See below. |
|
27067 + |
|
27068 +uschar *string_copyn(uschar *string, int length) |
|
27069 + |
|
27070 + See below. |
|
27071 + |
|
27072 +uschar *string_sprintf(char *format, ...) |
|
27073 + |
|
27074 + These three functions create strings using Exim's dynamic memory |
|
27075 + facilities. The first makes a copy of an entire string. The second copies |
|
27076 + up to a maximum number of characters, indicated by the second argument. The |
|
27077 + third uses a format and insertion arguments to create a new string. In each |
|
27078 + case, the result is a pointer to a new string in the current memory pool. |
|
27079 + See the next section for more discussion. |
|
27080 + |
|
27081 +42.8Â More about Exim's memory handling |
|
27082 + |
|
27083 +No function is provided for freeing memory, because that is never needed. The |
|
27084 +dynamic memory that Exim uses when receiving a message is automatically |
|
27085 +recycled if another message is received by the same process (this applies only |
|
27086 +to incoming SMTP connections - other input methods can supply only one message |
|
27087 +at a time). After receiving the last message, a reception process terminates. |
|
27088 + |
|
27089 +Because it is recycled, the normal dynamic memory cannot be used for holding |
|
27090 +data that must be preserved over a number of incoming messages on the same SMTP |
|
27091 +connection. However, Exim in fact uses two pools of dynamic memory; the second |
|
27092 +one is not recycled, and can be used for this purpose. |
|
27093 + |
|
27094 +If you want to allocate memory that remains available for subsequent messages |
|
27095 +in the same SMTP connection, you should set |
|
27096 + |
|
27097 +store_pool = POOL_PERM |
|
27098 + |
|
27099 +before calling the function that does the allocation. There is no need to |
|
27100 +restore the value if you do not need to; however, if you do want to revert to |
|
27101 +the normal pool, you can either restore the previous value of store_pool or set |
|
27102 +it explicitly to POOL_MAIN. |
|
27103 + |
|
27104 +The pool setting applies to all functions that get dynamic memory, including |
|
27105 +expand_string(), store_get(), and the string_xxx() functions. There is also a |
|
27106 +convenience function called store_get_perm() that gets a block of memory from |
|
27107 +the permanent pool while preserving the value of store_pool. |
|
27108 + |
|
27109 +43. System-wide message filtering |
|
27110 + |
|
27111 +The previous chapters (on ACLs and the local scan function) describe checks |
|
27112 +that can be applied to messages before they are accepted by a host. There is |
|
27113 +also a mechanism for checking messages once they have been received, but before |
|
27114 +they are delivered. This is called the system filter. |
|
27115 + |
|
27116 +The system filter operates in a similar manner to users' filter files, but it |
|
27117 +is run just once per message (however many recipients the message has). It |
|
27118 +should not normally be used as a substitute for routing, because deliver |
|
27119 +commands in a system router provide new envelope recipient addresses. The |
|
27120 +system filter must be an Exim filter. It cannot be a Sieve filter. |
|
27121 + |
|
27122 +The system filter is run at the start of a delivery attempt, before any routing |
|
27123 +is done. If a message fails to be completely delivered at the first attempt, |
|
27124 +the system filter is run again at the start of every retry. If you want your |
|
27125 +filter to do something only once per message, you can make use of the |
|
27126 +first_delivery condition in an if command in the filter to prevent it happening |
|
27127 +on retries. |
|
27128 + |
|
27129 +Warning: Because the system filter runs just once, variables that are specific |
|
27130 +to individual recipient addresses, such as $local_part and $domain, are not |
|
27131 +set, and the "personal" condition is not meaningful. If you want to run a |
|
27132 +centrally-specified filter for each recipient address independently, you can do |
|
27133 +so by setting up a suitable redirect router, as described in section 43.8 |
|
27134 +below. |
|
27135 + |
|
27136 +43.1Â Specifying a system filter |
|
27137 + |
|
27138 +The name of the file that contains the system filter must be specified by |
|
27139 +setting system_filter. If you want the filter to run under a uid and gid other |
|
27140 +than root, you must also set system_filter_user and system_filter_group as |
|
27141 +appropriate. For example: |
|
27142 + |
|
27143 +system_filter = /etc/mail/exim.filter |
|
27144 +system_filter_user = exim |
|
27145 + |
|
27146 +If a system filter generates any deliveries directly to files or pipes (via the |
|
27147 +save or pipe commands), transports to handle these deliveries must be specified |
|
27148 +by setting system_filter_file_transport and system_filter_pipe_transport, |
|
27149 +respectively. Similarly, system_filter_reply_transport must be set to handle |
|
27150 +any messages generated by the reply command. |
|
27151 + |
|
27152 +43.2Â Testing a system filter |
|
27153 + |
|
27154 +You can run simple tests of a system filter in the same way as for a user |
|
27155 +filter, but you should use -bF rather than -bf, so that features that are |
|
27156 +permitted only in system filters are recognized. |
|
27157 + |
|
27158 +If you want to test the combined effect of a system filter and a user filter, |
|
27159 +you can use both -bF and -bf on the same command line. |
|
27160 + |
|
27161 +43.3Â Contents of a system filter |
|
27162 + |
|
27163 +The language used to specify system filters is the same as for users' filter |
|
27164 +files. It is described in the separate end-user document Exim's interface to |
|
27165 +mail filtering. However, there are some additional features that are available |
|
27166 +only in system filters; these are described in subsequent sections. If they are |
|
27167 +encountered in a user's filter file or when testing with -bf, they cause |
|
27168 +errors. |
|
27169 + |
|
27170 +There are two special conditions which, though available in users' filter |
|
27171 +files, are designed for use in system filters. The condition first_delivery is |
|
27172 +true only for the first attempt at delivering a message, and manually_thawed is |
|
27173 +true only if the message has been frozen, and subsequently thawed by an admin |
|
27174 +user. An explicit forced delivery counts as a manual thaw, but thawing as a |
|
27175 +result of the auto_thaw setting does not. |
|
27176 + |
|
27177 +Warning: If a system filter uses the first_delivery condition to specify an |
|
27178 +"unseen" (non-significant) delivery, and that delivery does not succeed, it |
|
27179 +will not be tried again. If you want Exim to retry an unseen delivery until it |
|
27180 +succeeds, you should arrange to set it up every time the filter runs. |
|
27181 + |
|
27182 +When a system filter finishes running, the values of the variables $n0 - $n9 |
|
27183 +are copied into $sn0 - $sn9 and are thereby made available to users' filter |
|
27184 +files. Thus a system filter can, for example, set up "scores" to which users' |
|
27185 +filter files can refer. |
|
27186 + |
|
27187 +43.4Â Additional variable for system filters |
|
27188 + |
|
27189 +The expansion variable $recipients, containing a list of all the recipients of |
|
27190 +the message (separated by commas and white space), is available in system |
|
27191 +filters. It is not available in users' filters for privacy reasons. |
|
27192 + |
|
27193 +43.5Â Defer, freeze, and fail commands for system filters |
|
27194 + |
|
27195 +There are three extra commands (defer, freeze and fail) which are always |
|
27196 +available in system filters, but are not normally enabled in users' filters. |
|
27197 +(See the allow_defer, allow_freeze and allow_fail options for the redirect |
|
27198 +router.) These commands can optionally be followed by the word text and a |
|
27199 +string containing an error message, for example: |
|
27200 + |
|
27201 +fail text "this message looks like spam to me" |
|
27202 + |
|
27203 +The keyword text is optional if the next character is a double quote. |
|
27204 + |
|
27205 +The defer command defers delivery of the original recipients of the message. |
|
27206 +The fail command causes all the original recipients to be failed, and a bounce |
|
27207 +message to be created. The freeze command suspends all delivery attempts for |
|
27208 +the original recipients. In all cases, any new deliveries that are specified by |
|
27209 +the filter are attempted as normal after the filter has run. |
|
27210 + |
|
27211 +The freeze command is ignored if the message has been manually unfrozen and not |
|
27212 +manually frozen since. This means that automatic freezing by a system filter |
|
27213 +can be used as a way of checking out suspicious messages. If a message is found |
|
27214 +to be all right, manually unfreezing it allows it to be delivered. |
|
27215 + |
|
27216 +The text given with a fail command is used as part of the bounce message as |
|
27217 +well as being written to the log. If the message is quite long, this can fill |
|
27218 +up a lot of log space when such failures are common. To reduce the size of the |
|
27219 +log message, Exim interprets the text in a special way if it starts with the |
|
27220 +two characters "<<" and contains ">>" later. The text between these two strings |
|
27221 +is written to the log, and the rest of the text is used in the bounce message. |
|
27222 +For example: |
|
27223 + |
|
27224 +fail "<<filter test 1>>Your message is rejected \ |
|
27225 + because it contains attachments that we are \ |
|
27226 + not prepared to receive." |
|
27227 + |
|
27228 +Take great care with the fail command when basing the decision to fail on the |
|
27229 +contents of the message, because the bounce message will of course include the |
|
27230 +contents of the original message and will therefore trigger the fail command |
|
27231 +again (causing a mail loop) unless steps are taken to prevent this. Testing the |
|
27232 +error_message condition is one way to prevent this. You could use, for example |
|
27233 + |
|
27234 +if $message_body contains "this is spam" and not error_message |
|
27235 +then fail text "spam is not wanted here" endif |
|
27236 + |
|
27237 +though of course that might let through unwanted bounce messages. The |
|
27238 +alternative is clever checking of the body and/or headers to detect bounces |
|
27239 +generated by the filter. |
|
27240 + |
|
27241 +The interpretation of a system filter file ceases after a defer, freeze, or |
|
27242 +fail command is obeyed. However, any deliveries that were set up earlier in the |
|
27243 +filter file are honoured, so you can use a sequence such as |
|
27244 + |
|
27245 +mail ... |
|
27246 +freeze |
|
27247 + |
|
27248 +to send a specified message when the system filter is freezing (or deferring or |
|
27249 +failing) a message. The normal deliveries for the message do not, of course, |
|
27250 +take place. |
|
27251 + |
|
27252 +43.6Â Adding and removing headers in a system filter |
|
27253 + |
|
27254 +Two filter commands that are available only in system filters are: |
|
27255 + |
|
27256 +headers add <string> |
|
27257 +headers remove <string> |
|
27258 + |
|
27259 +The argument for the headers add is a string that is expanded and then added to |
|
27260 +the end of the message's headers. It is the responsibility of the filter |
|
27261 +maintainer to make sure it conforms to RFC 2822 syntax. Leading white space is |
|
27262 +ignored, and if the string is otherwise empty, or if the expansion is forced to |
|
27263 +fail, the command has no effect. |
|
27264 + |
|
27265 +You can use "\n" within the string, followed by white space, to specify |
|
27266 +continued header lines. More than one header may be added in one command by |
|
27267 +including "\n" within the string without any following white space. For |
|
27268 +example: |
|
27269 + |
|
27270 +headers add "X-header-1: ....\n \ |
|
27271 + continuation of X-header-1 ...\n\ |
|
27272 + X-header-2: ...." |
|
27273 + |
|
27274 +Note that the header line continuation white space after the first newline must |
|
27275 +be placed before the backslash that continues the input string, because white |
|
27276 +space after input continuations is ignored. |
|
27277 + |
|
27278 +The argument for headers remove is a colon-separated list of header names. This |
|
27279 +command applies only to those headers that are stored with the message; those |
|
27280 +that are added at delivery time (such as Envelope-To: and Return-Path:) cannot |
|
27281 +be removed by this means. If there is more than one header with the same name, |
|
27282 +they are all removed. |
|
27283 + |
|
27284 +The headers command in a system filter makes an immediate change to the set of |
|
27285 +header lines that was received with the message (with possible additions from |
|
27286 +ACL processing). Subsequent commands in the system filter operate on the |
|
27287 +modified set, which also forms the basis for subsequent message delivery. |
|
27288 +Unless further modified during routing or transporting, this set of headers is |
|
27289 +used for all recipients of the message. |
|
27290 + |
|
27291 +During routing and transporting, the variables that refer to the contents of |
|
27292 +header lines refer only to those lines that are in this set. Thus, header lines |
|
27293 +that are added by a system filter are visible to users' filter files and to all |
|
27294 +routers and transports. This contrasts with the manipulation of header lines by |
|
27295 +routers and transports, which is not immediate, but which instead is saved up |
|
27296 +until the message is actually being written (see section 44.17). |
|
27297 + |
|
27298 +If the message is not delivered at the first attempt, header lines that were |
|
27299 +added by the system filter are stored with the message, and so are still |
|
27300 +present at the next delivery attempt. Header lines that were removed are still |
|
27301 +present, but marked "deleted" so that they are not transported with the |
|
27302 +message. For this reason, it is usual to make the headers command conditional |
|
27303 +on first_delivery so that the set of header lines is not modified more than |
|
27304 +once. |
|
27305 + |
|
27306 +Because header modification in a system filter acts immediately, you have to |
|
27307 +use an indirect approach if you want to modify the contents of a header line. |
|
27308 +For example: |
|
27309 + |
|
27310 +headers add "Old-Subject: $h_subject:" |
|
27311 +headers remove "Subject" |
|
27312 +headers add "Subject: new subject (was: $h_old-subject:)" |
|
27313 +headers remove "Old-Subject" |
|
27314 + |
|
27315 +43.7Â Setting an errors address in a system filter |
|
27316 + |
|
27317 +In a system filter, if a deliver command is followed by |
|
27318 + |
|
27319 +errors_to <some address> |
|
27320 + |
|
27321 +in order to change the envelope sender (and hence the error reporting) for that |
|
27322 +delivery, any address may be specified. (In a user filter, only the current |
|
27323 +user's address can be set.) For example, if some mail is being monitored, you |
|
27324 +might use |
|
27325 + |
|
27326 +unseen deliver monitor@spying.example errors_to root@local.example |
|
27327 + |
|
27328 +to take a copy which would not be sent back to the normal error reporting |
|
27329 +address if its delivery failed. |
|
27330 + |
|
27331 +43.8Â Per-address filtering |
|
27332 + |
|
27333 +In contrast to the system filter, which is run just once per message for each |
|
27334 +delivery attempt, it is also possible to set up a system-wide filtering |
|
27335 +operation that runs once for each recipient address. In this case, variables |
|
27336 +such as $local_part and $domain can be used, and indeed, the choice of filter |
|
27337 +file could be made dependent on them. This is an example of a router which |
|
27338 +implements such a filter: |
|
27339 + |
|
27340 +central_filter: |
|
27341 + check_local_user |
|
27342 + driver = redirect |
|
27343 + domains = +local_domains |
|
27344 + file = /central/filters/$local_part |
|
27345 + no_verify |
|
27346 + allow_filter |
|
27347 + allow_freeze |
|
27348 + |
|
27349 +The filter is run in a separate process under its own uid. Therefore, either |
|
27350 +check_local_user must be set (as above), in which case the filter is run as the |
|
27351 +local user, or the user option must be used to specify which user to use. If |
|
27352 +both are set, user overrides. |
|
27353 + |
|
27354 +Care should be taken to ensure that none of the commands in the filter file |
|
27355 +specify a significant delivery if the message is to go on to be delivered to |
|
27356 +its intended recipient. The router will not then claim to have dealt with the |
|
27357 +address, so it will be passed on to subsequent routers to be delivered in the |
|
27358 +normal way. |
|
27359 + |
|
27360 +44. Message processing |
|
27361 + |
|
27362 +Exim performs various transformations on the sender and recipient addresses of |
|
27363 +all messages that it handles, and also on the messages' header lines. Some of |
|
27364 +these are optional and configurable, while others always take place. All of |
|
27365 +this processing, except rewriting as a result of routing, and the addition or |
|
27366 +removal of header lines while delivering, happens when a message is received, |
|
27367 +before it is placed on Exim's queue. |
|
27368 + |
|
27369 +Some of the automatic processing takes place by default only for |
|
27370 +"locally-originated" messages. This adjective is used to describe messages that |
|
27371 +are not received over TCP/IP, but instead are passed to an Exim process on its |
|
27372 +standard input. This includes the interactive "local SMTP" case that is set up |
|
27373 +by the -bs command line option. |
|
27374 + |
|
27375 +Note: Messages received over TCP/IP on the loopback interface (127.0.0.1 or |
|
27376 +::1) are not considered to be locally-originated. Exim does not treat the |
|
27377 +loopback interface specially in any way. |
|
27378 + |
|
27379 +If you want the loopback interface to be treated specially, you must ensure |
|
27380 +that there are appropriate entries in your ACLs. |
|
27381 + |
|
27382 +44.1Â Submission mode for non-local messages |
|
27383 + |
|
27384 +Processing that happens automatically for locally-originated messages (unless |
|
27385 +suppress_local_fixups is set) can also be requested for messages that are |
|
27386 +received over TCP/IP. The term "submission mode" is used to describe this |
|
27387 +state. Submission mode is set by the modifier |
|
27388 + |
|
27389 +control = submission |
|
27390 + |
|
27391 +in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections 40.20 |
|
27392 +and 40.21). This makes Exim treat the message as a local submission, and is |
|
27393 +normally used when the source of the message is known to be an MUA running on a |
|
27394 +client host (as opposed to an MTA). For example, to set submission mode for |
|
27395 +messages originating on the IPv4 loopback interface, you could include the |
|
27396 +following in the MAIL ACL: |
|
27397 + |
|
27398 +warn hosts = 127.0.0.1 |
|
27399 + control = submission |
|
27400 + |
|
27401 +There are some options that can be used when setting submission mode. A slash |
|
27402 +is used to separate options. For example: |
|
27403 + |
|
27404 +control = submission/sender_retain |
|
27405 + |
|
27406 +Specifying sender_retain has the effect of setting local_sender_retain true and |
|
27407 +local_from_check false for the current incoming message. The first of these |
|
27408 +allows an existing Sender: header in the message to remain, and the second |
|
27409 +suppresses the check to ensure that From: matches the authenticated sender. |
|
27410 +With this setting, Exim still fixes up messages by adding Date: and Message-ID: |
|
27411 +header lines if they are missing, but makes no attempt to check sender |
|
27412 +authenticity in header lines. |
|
27413 + |
|
27414 +When sender_retain is not set, a submission mode setting may specify a domain |
|
27415 +to be used when generating a From: or Sender: header line. For example: |
|
27416 + |
|
27417 +control = submission/domain=some.domain |
|
27418 + |
|
27419 +The domain may be empty. How this value is used is described in sections 44.11 |
|
27420 +and 44.16. There is also a name option that allows you to specify the user's |
|
27421 +full name for inclusion in a created Sender: or From: header line. For example: |
|
27422 + |
|
27423 +accept authenticated = * |
|
27424 + control = submission/domain=wonderland.example/\ |
|
27425 + name=${lookup {$authenticated_id} \ |
|
27426 + lsearch {/etc/exim/namelist}} |
|
27427 + |
|
27428 +Because the name may contain any characters, including slashes, the name option |
|
27429 +must be given last. The remainder of the string is used as the name. For the |
|
27430 +example above, if /etc/exim/namelist contains: |
|
27431 + |
|
27432 +bigegg: Humpty Dumpty |
|
27433 + |
|
27434 +then when the sender has authenticated as bigegg, the generated Sender: line |
|
27435 +would be: |
|
27436 + |
|
27437 +Sender: Humpty Dumpty <bigegg@wonderland.example> |
|
27438 + |
|
27439 +By default, submission mode forces the return path to the same address as is |
|
27440 +used to create the Sender: header. However, if sender_retain is specified, the |
|
27441 +return path is also left unchanged. |
|
27442 + |
|
27443 +Note: The changes caused by submission mode take effect after the predata ACL. |
|
27444 +This means that any sender checks performed before the fix-ups use the |
|
27445 +untrusted sender address specified by the user, not the trusted sender address |
|
27446 +specified by submission mode. Although this might be slightly unexpected, it |
|
27447 +does mean that you can configure ACL checks to spot that a user is trying to |
|
27448 +spoof another's address. |
|
27449 + |
|
27450 +44.2Â Line endings |
|
27451 + |
|
27452 +RFC 2821 specifies that CRLF (two characters: carriage-return, followed by |
|
27453 +linefeed) is the line ending for messages transmitted over the Internet using |
|
27454 +SMTP over TCP/IP. However, within individual operating systems, different |
|
27455 +conventions are used. For example, Unix-like systems use just LF, but others |
|
27456 +use CRLF or just CR. |
|
27457 + |
|
27458 +Exim was designed for Unix-like systems, and internally, it stores messages |
|
27459 +using the system's convention of a single LF as a line terminator. When |
|
27460 +receiving a message, all line endings are translated to this standard format. |
|
27461 +Originally, it was thought that programs that passed messages directly to an |
|
27462 +MTA within an operating system would use that system's convention. Experience |
|
27463 +has shown that this is not the case; for example, there are Unix applications |
|
27464 +that use CRLF in this circumstance. For this reason, and for compatibility with |
|
27465 +other MTAs, the way Exim handles line endings for all messages is now as |
|
27466 +follows: |
|
27467 + |
|
27468 + * LF not preceded by CR is treated as a line ending. |
|
27469 + |
|
27470 + * CR is treated as a line ending; if it is immediately followed by LF, the LF |
|
27471 + is ignored. |
|
27472 + |
|
27473 + * The sequence "CR, dot, CR" does not terminate an incoming SMTP message, nor |
|
27474 + a local message in the state where a line containing only a dot is a |
|
27475 + terminator. |
|
27476 + |
|
27477 + * If a bare CR is encountered within a header line, an extra space is added |
|
27478 + after the line terminator so as not to end the header line. The reasoning |
|
27479 + behind this is that bare CRs in header lines are most likely either to be |
|
27480 + mistakes, or people trying to play silly games. |
|
27481 + |
|
27482 + * If the first header line received in a message ends with CRLF, a subsequent |
|
27483 + bare LF in a header line is treated in the same way as a bare CR in a |
|
27484 + header line. |
|
27485 + |
|
27486 +44.3Â Unqualified addresses |
|
27487 + |
|
27488 +By default, Exim expects every envelope address it receives from an external |
|
27489 +host to be fully qualified. Unqualified addresses cause negative responses to |
|
27490 +SMTP commands. However, because SMTP is used as a means of transporting |
|
27491 +messages from MUAs running on personal workstations, there is sometimes a |
|
27492 +requirement to accept unqualified addresses from specific hosts or IP networks. |
|
27493 + |
|
27494 +Exim has two options that separately control which hosts may send unqualified |
|
27495 +sender or recipient addresses in SMTP commands, namely sender_unqualified_hosts |
|
27496 +and recipient_unqualified_hosts. In both cases, if an unqualified address is |
|
27497 +accepted, it is qualified by adding the value of qualify_domain or |
|
27498 +qualify_recipient, as appropriate. |
|
27499 + |
|
27500 +Unqualified addresses in header lines are automatically qualified for messages |
|
27501 +that are locally originated, unless the -bnq option is given on the command |
|
27502 +line. For messages received over SMTP, unqualified addresses in header lines |
|
27503 +are qualified only if unqualified addresses are permitted in SMTP commands. In |
|
27504 +other words, such qualification is also controlled by sender_unqualified_hosts |
|
27505 +and recipient_unqualified_hosts, |
|
27506 + |
|
27507 +44.4Â The UUCP From line |
|
27508 + |
|
27509 +Messages that have come from UUCP (and some other applications) often begin |
|
27510 +with a line containing the envelope sender and a timestamp, following the word |
|
27511 +"From". Examples of two common formats are: |
|
27512 + |
|
27513 +From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996 |
|
27514 +From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT |
|
27515 + |
|
27516 +This line precedes the RFC 2822 header lines. For compatibility with Sendmail, |
|
27517 +Exim recognizes such lines at the start of messages that are submitted to it |
|
27518 +via the command line (that is, on the standard input). It does not recognize |
|
27519 +such lines in incoming SMTP messages, unless the sending host matches |
|
27520 +ignore_fromline_hosts or the -bs option was used for a local message and |
|
27521 +ignore_fromline_local is set. The recognition is controlled by a regular |
|
27522 +expression that is defined by the uucp_from_pattern option, whose default value |
|
27523 +matches the two common cases shown above and puts the address that follows |
|
27524 +"From" into $1. |
|
27525 + |
|
27526 +When the caller of Exim for a non-SMTP message that contains a "From" line is a |
|
27527 +trusted user, the message's sender address is constructed by expanding the |
|
27528 +contents of uucp_sender_address, whose default value is "$1". This is then |
|
27529 +parsed as an RFC 2822 address. If there is no domain, the local part is |
|
27530 +qualified with qualify_domain unless it is the empty string. However, if the |
|
27531 +command line -f option is used, it overrides the "From" line. |
|
27532 + |
|
27533 +If the caller of Exim is not trusted, the "From" line is recognized, but the |
|
27534 +sender address is not changed. This is also the case for incoming SMTP messages |
|
27535 +that are permitted to contain "From" lines. |
|
27536 + |
|
27537 +Only one "From" line is recognized. If there is more than one, the second is |
|
27538 +treated as a data line that starts the body of the message, as it is not valid |
|
27539 +as a header line. This also happens if a "From" line is present in an incoming |
|
27540 +SMTP message from a source that is not permitted to send them. |
|
27541 + |
|
27542 +44.5Â Resent- header lines |
|
27543 + |
|
27544 +RFC 2822 makes provision for sets of header lines starting with the string |
|
27545 +"Resent-" to be added to a message when it is resent by the original recipient |
|
27546 +to somebody else. These headers are Resent-Date:, Resent-From:, Resent-Sender:, |
|
27547 +Resent-To:, Resent-Cc:, Resent-Bcc: and Resent-Message-ID:. The RFC says: |
|
27548 + |
|
27549 + Resent fields are strictly informational. They MUST NOT be used in the |
|
27550 + normal processing of replies or other such automatic actions on messages. |
|
27551 + |
|
27552 +This leaves things a bit vague as far as other processing actions such as |
|
27553 +address rewriting are concerned. Exim treats Resent- header lines as follows: |
|
27554 + |
|
27555 + * A Resent-From: line that just contains the login id of the submitting user |
|
27556 + is automatically rewritten in the same way as From: (see below). |
|
27557 + |
|
27558 + * If there's a rewriting rule for a particular header line, it is also |
|
27559 + applied to Resent- header lines of the same type. For example, a rule that |
|
27560 + rewrites From: also rewrites Resent-From:. |
|
27561 + |
|
27562 + * For local messages, if Sender: is removed on input, Resent-Sender: is also |
|
27563 + removed. |
|
27564 + |
|
27565 + * For a locally-submitted message, if there are any Resent- header lines but |
|
27566 + no Resent-Date:, Resent-From:, or Resent-Message-Id:, they are added as |
|
27567 + necessary. It is the contents of Resent-Message-Id: (rather than |
|
27568 + Message-Id:) which are included in log lines in this case. |
|
27569 + |
|
27570 + * The logic for adding Sender: is duplicated for Resent-Sender: when any |
|
27571 + Resent- header lines are present. |
|
27572 + |
|
27573 +44.6Â The Auto-Submitted: header line |
|
27574 + |
|
27575 +Whenever Exim generates an autoreply, a bounce, or a delay warning message, it |
|
27576 +includes the header line: |
|
27577 + |
|
27578 +Auto-Submitted: auto-replied |
|
27579 + |
|
27580 +44.7Â The Bcc: header line |
|
27581 + |
|
27582 +If Exim is called with the -t option, to take recipient addresses from a |
|
27583 +message's header, it removes any Bcc: header line that may exist (after |
|
27584 +extracting its addresses). If -t is not present on the command line, any |
|
27585 +existing Bcc: is not removed. |
|
27586 + |
|
27587 +44.8Â The Date: header line |
|
27588 + |
|
27589 +If a locally-generated or submission-mode message has no Date: header line, |
|
27590 +Exim adds one, using the current date and time, unless the |
|
27591 +suppress_local_fixups control has been specified. |
|
27592 + |
|
27593 +44.9Â The Delivery-date: header line |
|
27594 + |
|
27595 +Delivery-date: header lines are not part of the standard RFC 2822 header set. |
|
27596 +Exim can be configured to add them to the final delivery of messages. (See the |
|
27597 +generic delivery_date_add transport option.) They should not be present in |
|
27598 +messages in transit. If the delivery_date_remove configuration option is set |
|
27599 +(the default), Exim removes Delivery-date: header lines from incoming messages. |
|
27600 + |
|
27601 +44.10Â The Envelope-to: header line |
|
27602 + |
|
27603 +Envelope-to: header lines are not part of the standard RFC 2822 header set. |
|
27604 +Exim can be configured to add them to the final delivery of messages. (See the |
|
27605 +generic envelope_to_add transport option.) They should not be present in |
|
27606 +messages in transit. If the envelope_to_remove configuration option is set (the |
|
27607 +default), Exim removes Envelope-to: header lines from incoming messages. |
|
27608 + |
|
27609 +44.11Â The From: header line |
|
27610 + |
|
27611 +If a submission-mode message does not contain a From: header line, Exim adds |
|
27612 +one if either of the following conditions is true: |
|
27613 + |
|
27614 + * The envelope sender address is not empty (that is, this is not a bounce |
|
27615 + message). The added header line copies the envelope sender address. |
|
27616 + |
|
27617 + * The SMTP session is authenticated and $authenticated_id is not empty. |
|
27618 + |
|
27619 + 1. If no domain is specified by the submission control, the local part is |
|
27620 + $authenticated_id and the domain is $qualify_domain. |
|
27621 + |
|
27622 + 2. If a non-empty domain is specified by the submission control, the local |
|
27623 + part is $authenticated_id, and the domain is the specified domain. |
|
27624 + |
|
27625 + 3. If an empty domain is specified by the submission control, |
|
27626 + $authenticated_id is assumed to be the complete address. |
|
27627 + |
|
27628 +A non-empty envelope sender takes precedence. |
|
27629 + |
|
27630 +If a locally-generated incoming message does not contain a From: header line, |
|
27631 +and the suppress_local_fixups control is not set, Exim adds one containing the |
|
27632 +sender's address. The calling user's login name and full name are used to |
|
27633 +construct the address, as described in section 44.18. They are obtained from |
|
27634 +the password data by calling getpwuid() (but see the unknown_login |
|
27635 +configuration option). The address is qualified with qualify_domain. |
|
27636 + |
|
27637 +For compatibility with Sendmail, if an incoming, non-SMTP message has a From: |
|
27638 +header line containing just the unqualified login name of the calling user, |
|
27639 +this is replaced by an address containing the user's login name and full name |
|
27640 +as described in section 44.18. |
|
27641 + |
|
27642 +44.12Â The Message-ID: header line |
|
27643 + |
|
27644 +If a locally-generated or submission-mode incoming message does not contain a |
|
27645 +Message-ID: or Resent-Message-ID: header line, and the suppress_local_fixups |
|
27646 +control is not set, Exim adds a suitable header line to the message. If there |
|
27647 +are any Resent-: headers in the message, it creates Resent-Message-ID:. The id |
|
27648 +is constructed from Exim's internal message id, preceded by the letter E to |
|
27649 +ensure it starts with a letter, and followed by @ and the primary host name. |
|
27650 +Additional information can be included in this header line by setting the |
|
27651 +message_id_header_text and/or message_id_header_domain options. |
|
27652 + |
|
27653 +44.13Â The Received: header line |
|
27654 + |
|
27655 +A Received: header line is added at the start of every message. The contents |
|
27656 +are defined by the received_header_text configuration option, and Exim |
|
27657 +automatically adds a semicolon and a timestamp to the configured string. |
|
27658 + |
|
27659 +The Received: header is generated as soon as the message's header lines have |
|
27660 +been received. At this stage, the timestamp in the Received: header line is the |
|
27661 +time that the message started to be received. This is the value that is seen by |
|
27662 +the DATA ACL and by the local_scan() function. |
|
27663 + |
|
27664 +Once a message is accepted, the timestamp in the Received: header line is |
|
27665 +changed to the time of acceptance, which is (apart from a small delay while the |
|
27666 +-H spool file is written) the earliest time at which delivery could start. |
|
27667 + |
|
27668 +44.14Â The References: header line |
|
27669 + |
|
27670 +Messages created by the autoreply transport include a References: header line. |
|
27671 +This is constructed according to the rules that are described in section 3.64 |
|
27672 +of RFC 2822 (which states that replies should contain such a header line), and |
|
27673 +section 3.14 of RFC 3834 (which states that automatic responses are not |
|
27674 +different in this respect). However, because some mail processing software does |
|
27675 +not cope well with very long header lines, no more than 12 message IDs are |
|
27676 +copied from the References: header line in the incoming message. If there are |
|
27677 +more than 12, the first one and then the final 11 are copied, before adding the |
|
27678 +message ID of the incoming message. |
|
27679 + |
|
27680 +44.15Â The Return-path: header line |
|
27681 + |
|
27682 +Return-path: header lines are defined as something an MTA may insert when it |
|
27683 +does the final delivery of messages. (See the generic return_path_add transport |
|
27684 +option.) Therefore, they should not be present in messages in transit. If the |
|
27685 +return_path_remove configuration option is set (the default), Exim removes |
|
27686 +Return-path: header lines from incoming messages. |
|
27687 + |
|
27688 +44.16Â The Sender: header line |
|
27689 + |
|
27690 +For a locally-originated message from an untrusted user, Exim may remove an |
|
27691 +existing Sender: header line, and it may add a new one. You can modify these |
|
27692 +actions by setting the local_sender_retain option true, the local_from_check |
|
27693 +option false, or by using the suppress_local_fixups control setting. |
|
27694 + |
|
27695 +When a local message is received from an untrusted user and local_from_check is |
|
27696 +true (the default), and the suppress_local_fixups control has not been set, a |
|
27697 +check is made to see if the address given in the From: header line is the |
|
27698 +correct (local) sender of the message. The address that is expected has the |
|
27699 +login name as the local part and the value of qualify_domain as the domain. |
|
27700 +Prefixes and suffixes for the local part can be permitted by setting |
|
27701 +local_from_prefix and local_from_suffix appropriately. If From: does not |
|
27702 +contain the correct sender, a Sender: line is added to the message. |
|
27703 + |
|
27704 +If you set local_from_check false, this checking does not occur. However, the |
|
27705 +removal of an existing Sender: line still happens, unless you also set |
|
27706 +local_sender_retain to be true. It is not possible to set both of these options |
|
27707 +true at the same time. |
|
27708 + |
|
27709 +By default, no processing of Sender: header lines is done for messages received |
|
27710 +over TCP/IP or for messages submitted by trusted users. However, when a message |
|
27711 +is received over TCP/IP in submission mode, and sender_retain is not specified |
|
27712 +on the submission control, the following processing takes place: |
|
27713 + |
|
27714 +First, any existing Sender: lines are removed. Then, if the SMTP session is |
|
27715 +authenticated, and $authenticated_id is not empty, a sender address is created |
|
27716 +as follows: |
|
27717 + |
|
27718 + * If no domain is specified by the submission control, the local part is |
|
27719 + $authenticated_id and the domain is $qualify_domain. |
|
27720 + |
|
27721 + * If a non-empty domain is specified by the submission control, the local |
|
27722 + part is $authenticated_id, and the domain is the specified domain. |
|
27723 + |
|
27724 + * If an empty domain is specified by the submission control, |
|
27725 + $authenticated_id is assumed to be the complete address. |
|
27726 + |
|
27727 +This address is compared with the address in the From: header line. If they are |
|
27728 +different, a Sender: header line containing the created address is added. |
|
27729 +Prefixes and suffixes for the local part in From: can be permitted by setting |
|
27730 +local_from_prefix and local_from_suffix appropriately. |
|
27731 + |
|
27732 +Note: Whenever a Sender: header line is created, the return path for the |
|
27733 +message (the envelope sender address) is changed to be the same address, except |
|
27734 +in the case of submission mode when sender_retain is specified. |
|
27735 + |
|
27736 +44.17Â Adding and removing header lines in routers and transports |
|
27737 + |
|
27738 +When a message is delivered, the addition and removal of header lines can be |
|
27739 +specified in a system filter, or on any of the routers and transports that |
|
27740 +process the message. Section 43.6 contains details about modifying headers in a |
|
27741 +system filter. Header lines can also be added in an ACL as a message is |
|
27742 +received (see section 40.23). |
|
27743 + |
|
27744 +In contrast to what happens in a system filter, header modifications that are |
|
27745 +specified on routers and transports apply only to the particular recipient |
|
27746 +addresses that are being processed by those routers and transports. These |
|
27747 +changes do not actually take place until a copy of the message is being |
|
27748 +transported. Therefore, they do not affect the basic set of header lines, and |
|
27749 +they do not affect the values of the variables that refer to header lines. |
|
27750 + |
|
27751 +Note: In particular, this means that any expansions in the configuration of the |
|
27752 +transport cannot refer to the modified header lines, because such expansions |
|
27753 +all occur before the message is actually transported. |
|
27754 + |
|
27755 +For both routers and transports, the result of expanding a headers_add option |
|
27756 +must be in the form of one or more RFC 2822 header lines, separated by newlines |
|
27757 +(coded as "\n"). For example: |
|
27758 + |
|
27759 +headers_add = X-added-header: added by $primary_hostname\n\ |
|
27760 + X-added-second: another added header line |
|
27761 + |
|
27762 +Exim does not check the syntax of these added header lines. |
|
27763 + |
|
27764 +The result of expanding headers_remove must consist of a colon-separated list |
|
27765 +of header names. This is confusing, because header names themselves are often |
|
27766 +terminated by colons. In this case, the colons are the list separators, not |
|
27767 +part of the names. For example: |
|
27768 + |
|
27769 +headers_remove = return-receipt-to:acknowledge-to |
|
27770 + |
|
27771 +When headers_add or headers_remove is specified on a router, its value is |
|
27772 +expanded at routing time, and then associated with all addresses that are |
|
27773 +accepted by that router, and also with any new addresses that it generates. If |
|
27774 +an address passes through several routers as a result of aliasing or |
|
27775 +forwarding, the changes are cumulative. |
|
27776 + |
|
27777 +However, this does not apply to multiple routers that result from the use of |
|
27778 +the unseen option. Any header modifications that were specified by the "unseen" |
|
27779 +router or its predecessors apply only to the "unseen" delivery. |
|
27780 + |
|
27781 +Addresses that end up with different headers_add or headers_remove settings |
|
27782 +cannot be delivered together in a batch, so a transport is always dealing with |
|
27783 +a set of addresses that have the same header-processing requirements. |
|
27784 + |
|
27785 +The transport starts by writing the original set of header lines that arrived |
|
27786 +with the message, possibly modified by the system filter. As it writes out |
|
27787 +these lines, it consults the list of header names that were attached to the |
|
27788 +recipient address(es) by headers_remove options in routers, and it also |
|
27789 +consults the transport's own headers_remove option. Header lines whose names |
|
27790 +are on either of these lists are not written out. If there are multiple |
|
27791 +instances of any listed header, they are all skipped. |
|
27792 + |
|
27793 +After the remaining original header lines have been written, new header lines |
|
27794 +that were specified by routers' headers_add options are written, in the order |
|
27795 +in which they were attached to the address. These are followed by any header |
|
27796 +lines specified by the transport's headers_add option. |
|
27797 + |
|
27798 +This way of handling header line modifications in routers and transports has |
|
27799 +the following consequences: |
|
27800 + |
|
27801 + * The original set of header lines, possibly modified by the system filter, |
|
27802 + remains "visible", in the sense that the $header_xxx variables refer to it, |
|
27803 + at all times. |
|
27804 + |
|
27805 + * Header lines that are added by a router's headers_add option are not |
|
27806 + accessible by means of the $header_xxx expansion syntax in subsequent |
|
27807 + routers or the transport. |
|
27808 + |
|
27809 + * Conversely, header lines that are specified for removal by headers_remove |
|
27810 + in a router remain visible to subsequent routers and the transport. |
|
27811 + |
|
27812 + * Headers added to an address by headers_add in a router cannot be removed by |
|
27813 + a later router or by a transport. |
|
27814 + |
|
27815 + * An added header can refer to the contents of an original header that is to |
|
27816 + be removed, even it has the same name as the added header. For example: |
|
27817 + |
|
27818 + headers_remove = subject |
|
27819 + headers_add = Subject: new subject (was: $h_subject:) |
|
27820 + |
|
27821 +Warning: The headers_add and headers_remove options cannot be used for a |
|
27822 +redirect router that has the one_time option set. |
|
27823 + |
|
27824 +44.18Â Constructed addresses |
|
27825 + |
|
27826 +When Exim constructs a sender address for a locally-generated message, it uses |
|
27827 +the form |
|
27828 + |
|
27829 +<user name>  <login@qualify_domain> |
|
27830 + |
|
27831 +For example: |
|
27832 + |
|
27833 +Zaphod Beeblebrox <zaphod@end.univ.example> |
|
27834 + |
|
27835 +The user name is obtained from the -F command line option if set, or otherwise |
|
27836 +by looking up the calling user by getpwuid() and extracting the "gecos" field |
|
27837 +from the password entry. If the "gecos" field contains an ampersand character, |
|
27838 +this is replaced by the login name with the first letter upper cased, as is |
|
27839 +conventional in a number of operating systems. See the gecos_name option for a |
|
27840 +way to tailor the handling of the "gecos" field. The unknown_username option |
|
27841 +can be used to specify user names in cases when there is no password file |
|
27842 +entry. |
|
27843 + |
|
27844 +In all cases, the user name is made to conform to RFC 2822 by quoting all or |
|
27845 +parts of it if necessary. In addition, if it contains any non-printing |
|
27846 +characters, it is encoded as described in RFC 2047, which defines a way of |
|
27847 +including non-ASCII characters in header lines. The value of the |
|
27848 +headers_charset option specifies the name of the encoding that is used (the |
|
27849 +characters are assumed to be in this encoding). The setting of |
|
27850 +print_topbitchars controls whether characters with the top bit set (that is, |
|
27851 +with codes greater than 127) count as printing characters or not. |
|
27852 + |
|
27853 +44.19Â Case of local parts |
|
27854 + |
|
27855 +RFC 2822 states that the case of letters in the local parts of addresses cannot |
|
27856 +be assumed to be non-significant. Exim preserves the case of local parts of |
|
27857 +addresses, but by default it uses a lower-cased form when it is routing, |
|
27858 +because on most Unix systems, usernames are in lower case and case-insensitive |
|
27859 +routing is required. However, any particular router can be made to use the |
|
27860 +original case for local parts by setting the caseful_local_part generic router |
|
27861 +option. |
|
27862 + |
|
27863 +If you must have mixed-case user names on your system, the best way to proceed, |
|
27864 +assuming you want case-independent handling of incoming email, is to set up |
|
27865 +your first router to convert incoming local parts in your domains to the |
|
27866 +correct case by means of a file lookup. For example: |
|
27867 + |
|
27868 +correct_case: |
|
27869 + driver = redirect |
|
27870 + domains = +local_domains |
|
27871 + data = ${lookup{$local_part}cdb\ |
|
27872 + {/etc/usercased.cdb}{$value}fail}\ |
|
27873 + @$domain |
|
27874 + |
|
27875 +For this router, the local part is forced to lower case by the default action ( |
|
27876 +caseful_local_part is not set). The lower-cased local part is used to look up a |
|
27877 +new local part in the correct case. If you then set caseful_local_part on any |
|
27878 +subsequent routers which process your domains, they will operate on local parts |
|
27879 +with the correct case in a case-sensitive manner. |
|
27880 + |
|
27881 +44.20Â Dots in local parts |
|
27882 + |
|
27883 +RFC 2822 forbids empty components in local parts. That is, an unquoted local |
|
27884 +part may not begin or end with a dot, nor have two consecutive dots in the |
|
27885 +middle. However, it seems that many MTAs do not enforce this, so Exim permits |
|
27886 +empty components for compatibility. |
|
27887 + |
|
27888 +44.21Â Rewriting addresses |
|
27889 + |
|
27890 +Rewriting of sender and recipient addresses, and addresses in headers, can |
|
27891 +happen automatically, or as the result of configuration options, as described |
|
27892 +in chapter 31. The headers that may be affected by this are Bcc:, Cc:, From:, |
|
27893 +Reply-To:, Sender:, and To:. |
|
27894 + |
|
27895 +Automatic rewriting includes qualification, as mentioned above. The other case |
|
27896 +in which it can happen is when an incomplete non-local domain is given. The |
|
27897 +routing process may cause this to be expanded into the full domain name. For |
|
27898 +example, a header such as |
|
27899 + |
|
27900 +To: hare@teaparty |
|
27901 + |
|
27902 +might get rewritten as |
|
27903 + |
|
27904 +To: hare@teaparty.wonderland.fict.example |
|
27905 + |
|
27906 +Rewriting as a result of routing is the one kind of message processing that |
|
27907 +does not happen at input time, as it cannot be done until the address has been |
|
27908 +routed. |
|
27909 + |
|
27910 +Strictly, one should not do any deliveries of a message until all its addresses |
|
27911 +have been routed, in case any of the headers get changed as a result of |
|
27912 +routing. However, doing this in practice would hold up many deliveries for |
|
27913 +unreasonable amounts of time, just because one address could not immediately be |
|
27914 +routed. Exim therefore does not delay other deliveries when routing of one or |
|
27915 +more addresses is deferred. |
|
27916 + |
|
27917 +45. SMTP processing |
|
27918 + |
|
27919 +Exim supports a number of different ways of using the SMTP protocol, and its |
|
27920 +LMTP variant, which is an interactive protocol for transferring messages into a |
|
27921 +closed mail store application. This chapter contains details of how SMTP is |
|
27922 +processed. For incoming mail, the following are available: |
|
27923 + |
|
27924 + * SMTP over TCP/IP (Exim daemon or inetd); |
|
27925 + |
|
27926 + * SMTP over the standard input and output (the -bs option); |
|
27927 + |
|
27928 + * Batched SMTP on the standard input (the -bS option). |
|
27929 + |
|
27930 +For mail delivery, the following are available: |
|
27931 + |
|
27932 + * SMTP over TCP/IP (the smtp transport); |
|
27933 + |
|
27934 + * LMTP over TCP/IP (the smtp transport with the protocol option set to |
|
27935 + "lmtp"); |
|
27936 + |
|
27937 + * LMTP over a pipe to a process running in the local host (the lmtp |
|
27938 + transport); |
|
27939 + |
|
27940 + * Batched SMTP to a file or pipe (the appendfile and pipe transports with the |
|
27941 + use_bsmtp option set). |
|
27942 + |
|
27943 +Batched SMTP is the name for a process in which batches of messages are stored |
|
27944 +in or read from files (or pipes), in a format in which SMTP commands are used |
|
27945 +to contain the envelope information. |
|
27946 + |
|
27947 +45.1Â Outgoing SMTP and LMTP over TCP/IP |
|
27948 + |
|
27949 +Outgoing SMTP and LMTP over TCP/IP is implemented by the smtp transport. The |
|
27950 +protocol option selects which protocol is to be used, but the actual processing |
|
27951 +is the same in both cases. |
|
27952 + |
|
27953 +If, in response to its EHLO command, Exim is told that the SIZE parameter is |
|
27954 +supported, it adds SIZE=<n> to each subsequent MAIL command. The value of <n> |
|
27955 +is the message size plus the value of the size_addition option (default 1024) |
|
27956 +to allow for additions to the message such as per-transport header lines, or |
|
27957 +changes made in a transport filter. If size_addition is set negative, the use |
|
27958 +of SIZE is suppressed. |
|
27959 + |
|
27960 +If the remote server advertises support for PIPELINING, Exim uses the |
|
27961 +pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets |
|
27962 +required for the transaction. |
|
27963 + |
|
27964 +If the remote server advertises support for the STARTTLS command, and Exim was |
|
27965 +built to support TLS encryption, it tries to start a TLS session unless the |
|
27966 +server matches hosts_avoid_tls. See chapter 39 for more details. |
|
27967 + |
|
27968 +If the remote server advertises support for the AUTH command, Exim scans the |
|
27969 +authenticators configuration for any suitable client settings, as described in |
|
27970 +chapter 33. |
|
27971 + |
|
27972 +Responses from the remote host are supposed to be terminated by CR followed by |
|
27973 +LF. However, there are known to be hosts that do not send CR characters, so in |
|
27974 +order to be able to interwork with such hosts, Exim treats LF on its own as a |
|
27975 +line terminator. |
|
27976 + |
|
27977 +If a message contains a number of different addresses, all those with the same |
|
27978 +characteristics (for example, the same envelope sender) that resolve to the |
|
27979 +same set of hosts, in the same order, are sent in a single SMTP transaction, |
|
27980 +even if they are for different domains, unless there are more than the setting |
|
27981 +of the max_rcpts option in the smtp transport allows, in which case they are |
|
27982 +split into groups containing no more than max_rcpts addresses each. If |
|
27983 +remote_max_parallel is greater than one, such groups may be sent in parallel |
|
27984 +sessions. The order of hosts with identical MX values is not significant when |
|
27985 +checking whether addresses can be batched in this way. |
|
27986 + |
|
27987 +When the smtp transport suffers a temporary failure that is not |
|
27988 +message-related, Exim updates its transport-specific database, which contains |
|
27989 +records indexed by host name that remember which messages are waiting for each |
|
27990 +particular host. It also updates the retry database with new retry times. |
|
27991 + |
|
27992 +Exim's retry hints are based on host name plus IP address, so if one address of |
|
27993 +a multi-homed host is broken, it will soon be skipped most of the time. See the |
|
27994 +next section for more detail about error handling. |
|
27995 + |
|
27996 +When a message is successfully delivered over a TCP/IP SMTP connection, Exim |
|
27997 +looks in the hints database for the transport to see if there are any queued |
|
27998 +messages waiting for the host to which it is connected. If it finds one, it |
|
27999 +creates a new Exim process using the -MC option (which can only be used by a |
|
28000 +process running as root or the Exim user) and passes the TCP/IP socket to it so |
|
28001 +that it can deliver another message using the same socket. The new process does |
|
28002 +only those deliveries that are routed to the connected host, and may in turn |
|
28003 +pass the socket on to a third process, and so on. |
|
28004 + |
|
28005 +The connection_max_messages option of the smtp transport can be used to limit |
|
28006 +the number of messages sent down a single TCP/IP connection. |
|
28007 + |
|
28008 +The second and subsequent messages delivered down an existing connection are |
|
28009 +identified in the main log by the addition of an asterisk after the closing |
|
28010 +square bracket of the IP address. |
|
28011 + |
|
28012 +45.2Â Errors in outgoing SMTP |
|
28013 + |
|
28014 +Three different kinds of error are recognized for outgoing SMTP: host errors, |
|
28015 +message errors, and recipient errors. |
|
28016 + |
|
28017 +Host errors |
|
28018 + |
|
28019 + A host error is not associated with a particular message or with a |
|
28020 + particular recipient of a message. The host errors are: |
|
28021 + |
|
28022 + * Connection refused or timed out, |
|
28023 + |
|
28024 + * Any error response code on connection, |
|
28025 + |
|
28026 + * Any error response code to EHLO or HELO, |
|
28027 + |
|
28028 + * Loss of connection at any time, except after ".", |
|
28029 + |
|
28030 + * I/O errors at any time, |
|
28031 + |
|
28032 + * Timeouts during the session, other than in response to MAIL, RCPT or |
|
28033 + the "." at the end of the data. |
|
28034 + |
|
28035 + For a host error, a permanent error response on connection, or in response |
|
28036 + to EHLO, causes all addresses routed to the host to be failed. Any other |
|
28037 + host error causes all addresses to be deferred, and retry data to be |
|
28038 + created for the host. It is not tried again, for any message, until its |
|
28039 + retry time arrives. If the current set of addresses are not all delivered |
|
28040 + in this run (to some alternative host), the message is added to the list of |
|
28041 + those waiting for this host, so if it is still undelivered when a |
|
28042 + subsequent successful delivery is made to the host, it will be sent down |
|
28043 + the same SMTP connection. |
|
28044 + |
|
28045 +Message errors |
|
28046 + |
|
28047 + A message error is associated with a particular message when sent to a |
|
28048 + particular host, but not with a particular recipient of the message. The |
|
28049 + message errors are: |
|
28050 + |
|
28051 + * Any error response code to MAIL, DATA, or the "." that terminates the |
|
28052 + data, |
|
28053 + |
|
28054 + * Timeout after MAIL, |
|
28055 + |
|
28056 + * Timeout or loss of connection after the "." that terminates the data. A |
|
28057 + timeout after the DATA command itself is treated as a host error, as is |
|
28058 + loss of connection at any other time. |
|
28059 + |
|
28060 + For a message error, a permanent error response (5xx) causes all addresses |
|
28061 + to be failed, and a delivery error report to be returned to the sender. A |
|
28062 + temporary error response (4xx), or one of the timeouts, causes all |
|
28063 + addresses to be deferred. Retry data is not created for the host, but |
|
28064 + instead, a retry record for the combination of host plus message id is |
|
28065 + created. The message is not added to the list of those waiting for this |
|
28066 + host. This ensures that the failing message will not be sent to this host |
|
28067 + again until the retry time arrives. However, other messages that are routed |
|
28068 + to the host are not affected, so if it is some property of the message that |
|
28069 + is causing the error, it will not stop the delivery of other mail. |
|
28070 + |
|
28071 + If the remote host specified support for the SIZE parameter in its response |
|
28072 + to EHLO, Exim adds SIZE=nnn to the MAIL command, so an over-large message |
|
28073 + will cause a message error because the error arrives as a response to MAIL. |
|
28074 + |
|
28075 +Recipient errors |
|
28076 + |
|
28077 + A recipient error is associated with a particular recipient of a message. |
|
28078 + The recipient errors are: |
|
28079 + |
|
28080 + * Any error response to RCPT, |
|
28081 + |
|
28082 + * Timeout after RCPT. |
|
28083 + |
|
28084 + For a recipient error, a permanent error response (5xx) causes the |
|
28085 + recipient address to be failed, and a bounce message to be returned to the |
|
28086 + sender. A temporary error response (4xx) or a timeout causes the failing |
|
28087 + address to be deferred, and routing retry data to be created for it. This |
|
28088 + is used to delay processing of the address in subsequent queue runs, until |
|
28089 + its routing retry time arrives. This applies to all messages, but because |
|
28090 + it operates only in queue runs, one attempt will be made to deliver a new |
|
28091 + message to the failing address before the delay starts to operate. This |
|
28092 + ensures that, if the failure is really related to the message rather than |
|
28093 + the recipient ("message too big for this recipient" is a possible example), |
|
28094 + other messages have a chance of getting delivered. If a delivery to the |
|
28095 + address does succeed, the retry information gets cleared, so all stuck |
|
28096 + messages get tried again, and the retry clock is reset. |
|
28097 + |
|
28098 + The message is not added to the list of those waiting for this host. Use of |
|
28099 + the host for other messages is unaffected, and except in the case of a |
|
28100 + timeout, other recipients are processed independently, and may be |
|
28101 + successfully delivered in the current SMTP session. After a timeout it is |
|
28102 + of course impossible to proceed with the session, so all addresses get |
|
28103 + deferred. However, those other than the one that failed do not suffer any |
|
28104 + subsequent retry delays. Therefore, if one recipient is causing trouble, |
|
28105 + the others have a chance of getting through when a subsequent delivery |
|
28106 + attempt occurs before the failing recipient's retry time. |
|
28107 + |
|
28108 +In all cases, if there are other hosts (or IP addresses) available for the |
|
28109 +current set of addresses (for example, from multiple MX records), they are |
|
28110 +tried in this run for any undelivered addresses, subject of course to their own |
|
28111 +retry data. In other words, recipient error retry data does not take effect |
|
28112 +until the next delivery attempt. |
|
28113 + |
|
28114 +Some hosts have been observed to give temporary error responses to every MAIL |
|
28115 +command at certain times ("insufficient space" has been seen). It would be nice |
|
28116 +if such circumstances could be recognized, and defer data for the host itself |
|
28117 +created, but this is not possible within the current Exim design. What actually |
|
28118 +happens is that retry data for every (host, message) combination is created. |
|
28119 + |
|
28120 +The reason that timeouts after MAIL and RCPT are treated specially is that |
|
28121 +these can sometimes arise as a result of the remote host's verification |
|
28122 +procedures. Exim makes this assumption, and treats them as if a temporary error |
|
28123 +response had been received. A timeout after "." is treated specially because it |
|
28124 +is known that some broken implementations fail to recognize the end of the |
|
28125 +message if the last character of the last line is a binary zero. Thus, it is |
|
28126 +helpful to treat this case as a message error. |
|
28127 + |
|
28128 +Timeouts at other times are treated as host errors, assuming a problem with the |
|
28129 +host, or the connection to it. If a timeout after MAIL, RCPT, or "." is really |
|
28130 +a connection problem, the assumption is that at the next try the timeout is |
|
28131 +likely to occur at some other point in the dialogue, causing it then to be |
|
28132 +treated as a host error. |
|
28133 + |
|
28134 +There is experimental evidence that some MTAs drop the connection after the |
|
28135 +terminating "." if they do not like the contents of the message for some |
|
28136 +reason, in contravention of the RFC, which indicates that a 5xx response should |
|
28137 +be given. That is why Exim treats this case as a message rather than a host |
|
28138 +error, in order not to delay other messages to the same host. |
|
28139 + |
|
28140 +45.3Â Incoming SMTP messages over TCP/IP |
|
28141 + |
|
28142 +Incoming SMTP messages can be accepted in one of two ways: by running a |
|
28143 +listening daemon, or by using inetd. In the latter case, the entry in /etc/ |
|
28144 +inetd.conf should be like this: |
|
28145 + |
|
28146 +smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs |
|
28147 + |
|
28148 +Exim distinguishes between this case and the case of a locally running user |
|
28149 +agent using the -bs option by checking whether or not the standard input is a |
|
28150 +socket. When it is, either the port must be privileged (less than 1024), or the |
|
28151 +caller must be root or the Exim user. If any other user passes a socket with an |
|
28152 +unprivileged port number, Exim prints a message on the standard error stream |
|
28153 +and exits with an error code. |
|
28154 + |
|
28155 +By default, Exim does not make a log entry when a remote host connects or |
|
28156 +disconnects (either via the daemon or inetd), unless the disconnection is |
|
28157 +unexpected. It can be made to write such log entries by setting the |
|
28158 +smtp_connection log selector. |
|
28159 + |
|
28160 +Commands from the remote host are supposed to be terminated by CR followed by |
|
28161 +LF. However, there are known to be hosts that do not send CR characters. In |
|
28162 +order to be able to interwork with such hosts, Exim treats LF on its own as a |
|
28163 +line terminator. Furthermore, because common code is used for receiving |
|
28164 +messages from all sources, a CR on its own is also interpreted as a line |
|
28165 +terminator. However, the sequence "CR, dot, CR" does not terminate incoming |
|
28166 +SMTP data. |
|
28167 + |
|
28168 +One area that sometimes gives rise to problems concerns the EHLO or HELO |
|
28169 +commands. Some clients send syntactically invalid versions of these commands, |
|
28170 +which Exim rejects by default. (This is nothing to do with verifying the data |
|
28171 +that is sent, so helo_verify_hosts is not relevant.) You can tell Exim not to |
|
28172 +apply a syntax check by setting helo_accept_junk_hosts to match the broken |
|
28173 +hosts that send invalid commands. |
|
28174 + |
|
28175 +The amount of disk space available is checked whenever SIZE is received on a |
|
28176 +MAIL command, independently of whether message_size_limit or check_spool_space |
|
28177 +is configured, unless smtp_check_spool_space is set false. A temporary error is |
|
28178 +given if there is not enough space. If check_spool_space is set, the check is |
|
28179 +for that amount of space plus the value given with SIZE, that is, it checks |
|
28180 +that the addition of the incoming message will not reduce the space below the |
|
28181 +threshold. |
|
28182 + |
|
28183 +When a message is successfully received, Exim includes the local message id in |
|
28184 +its response to the final "." that terminates the data. If the remote host logs |
|
28185 +this text it can help with tracing what has happened to a message. |
|
28186 + |
|
28187 +The Exim daemon can limit the number of simultaneous incoming connections it is |
|
28188 +prepared to handle (see the smtp_accept_max option). It can also limit the |
|
28189 +number of simultaneous incoming connections from a single remote host (see the |
|
28190 +smtp_accept_max_per_host option). Additional connection attempts are rejected |
|
28191 +using the SMTP temporary error code 421. |
|
28192 + |
|
28193 +The Exim daemon does not rely on the SIGCHLD signal to detect when a subprocess |
|
28194 +has finished, as this can get lost at busy times. Instead, it looks for |
|
28195 +completed subprocesses every time it wakes up. Provided there are other things |
|
28196 +happening (new incoming calls, starts of queue runs), completed processes will |
|
28197 +be noticed and tidied away. On very quiet systems you may sometimes see a |
|
28198 +"defunct" Exim process hanging about. This is not a problem; it will be noticed |
|
28199 +when the daemon next wakes up. |
|
28200 + |
|
28201 +When running as a daemon, Exim can reserve some SMTP slots for specific hosts, |
|
28202 +and can also be set up to reject SMTP calls from non-reserved hosts at times of |
|
28203 +high system load - for details see the smtp_accept_reserve, smtp_load_reserve, |
|
28204 +and smtp_reserve_hosts options. The load check applies in both the daemon and |
|
28205 +inetd cases. |
|
28206 + |
|
28207 +Exim normally starts a delivery process for each message received, though this |
|
28208 +can be varied by means of the -odq command line option and the queue_only, |
|
28209 +queue_only_file, and queue_only_load options. The number of simultaneously |
|
28210 +running delivery processes started in this way from SMTP input can be limited |
|
28211 +by the smtp_accept_queue and smtp_accept_queue_per_connection options. When |
|
28212 +either limit is reached, subsequently received messages are just put on the |
|
28213 +input queue without starting a delivery process. |
|
28214 + |
|
28215 +The controls that involve counts of incoming SMTP calls (smtp_accept_max, |
|
28216 +smtp_accept_queue, smtp_accept_reserve) are not available when Exim is started |
|
28217 +up from the inetd daemon, because in that case each connection is handled by an |
|
28218 +entirely independent Exim process. Control by load average is, however, |
|
28219 +available with inetd. |
|
28220 + |
|
28221 +Exim can be configured to verify addresses in incoming SMTP commands as they |
|
28222 +are received. See chapter 40 for details. It can also be configured to rewrite |
|
28223 +addresses at this time - before any syntax checking is done. See section 31.9. |
|
28224 + |
|
28225 +Exim can also be configured to limit the rate at which a client host submits |
|
28226 +MAIL and RCPT commands in a single SMTP session. See the smtp_ratelimit_hosts |
|
28227 +option. |
|
28228 + |
|
28229 +45.4Â Unrecognized SMTP commands |
|
28230 + |
|
28231 +If Exim receives more than smtp_max_unknown_commands unrecognized SMTP commands |
|
28232 +during a single SMTP connection, it drops the connection after sending the |
|
28233 +error response to the last command. The default value for |
|
28234 +smtp_max_unknown_commands is 3. This is a defence against some kinds of abuse |
|
28235 +that subvert web servers into making connections to SMTP ports; in these |
|
28236 +circumstances, a number of non-SMTP lines are sent first. |
|
28237 + |
|
28238 +45.5Â Syntax and protocol errors in SMTP commands |
|
28239 + |
|
28240 +A syntax error is detected if an SMTP command is recognized, but there is |
|
28241 +something syntactically wrong with its data, for example, a malformed email |
|
28242 +address in a RCPT command. Protocol errors include invalid command sequencing |
|
28243 +such as RCPT before MAIL. If Exim receives more than smtp_max_synprot_errors |
|
28244 +such commands during a single SMTP connection, it drops the connection after |
|
28245 +sending the error response to the last command. The default value for |
|
28246 +smtp_max_synprot_errors is 3. This is a defence against broken clients that |
|
28247 +loop sending bad commands (yes, it has been seen). |
|
28248 + |
|
28249 +45.6Â Use of non-mail SMTP commands |
|
28250 + |
|
28251 +The "non-mail" SMTP commands are those other than MAIL, RCPT, and DATA. Exim |
|
28252 +counts such commands, and drops the connection if there are too many of them in |
|
28253 +a single SMTP session. This action catches some denial-of-service attempts and |
|
28254 +things like repeated failing AUTHs, or a mad client looping sending EHLO. The |
|
28255 +global option smtp_accept_max_nonmail defines what "too many" means. Its |
|
28256 +default value is 10. |
|
28257 + |
|
28258 +When a new message is expected, one occurrence of RSET is not counted. This |
|
28259 +allows a client to send one RSET between messages (this is not necessary, but |
|
28260 +some clients do it). Exim also allows one uncounted occurrence of HELO or EHLO, |
|
28261 +and one occurrence of STARTTLS between messages. After starting up a TLS |
|
28262 +session, another EHLO is expected, and so it too is not counted. |
|
28263 + |
|
28264 +The first occurrence of AUTH in a connection, or immediately following STARTTLS |
|
28265 +is also not counted. Otherwise, all commands other than MAIL, RCPT, DATA, and |
|
28266 +QUIT are counted. |
|
28267 + |
|
28268 +You can control which hosts are subject to the limit set by |
|
28269 +smtp_accept_max_nonmail by setting smtp_accept_max_nonmail_hosts. The default |
|
28270 +value is "*", which makes the limit apply to all hosts. This option means that |
|
28271 +you can exclude any specific badly-behaved hosts that you have to live with. |
|
28272 + |
|
28273 +45.7Â The VRFY and EXPN commands |
|
28274 + |
|
28275 +When Exim receives a VRFY or EXPN command on a TCP/IP connection, it runs the |
|
28276 +ACL specified by acl_smtp_vrfy or acl_smtp_expn (as appropriate) in order to |
|
28277 +decide whether the command should be accepted or not. If no ACL is defined, the |
|
28278 +command is rejected. |
|
28279 + |
|
28280 +When VRFY is accepted, it runs exactly the same code as when Exim is called |
|
28281 +with the -bv option. |
|
28282 + |
|
28283 +When EXPN is accepted, a single-level expansion of the address is done. EXPN is |
|
28284 +treated as an "address test" (similar to the -bt option) rather than a |
|
28285 +verification (the -bv option). If an unqualified local part is given as the |
|
28286 +argument to EXPN, it is qualified with qualify_domain. Rejections of VRFY and |
|
28287 +EXPN commands are logged on the main and reject logs, and VRFY verification |
|
28288 +failures are logged on the main log for consistency with RCPT failures. |
|
28289 + |
|
28290 +45.8Â The ETRN command |
|
28291 + |
|
28292 +RFC 1985 describes an SMTP command called ETRN that is designed to overcome the |
|
28293 +security problems of the TURN command (which has fallen into disuse). When Exim |
|
28294 +receives an ETRN command on a TCP/IP connection, it runs the ACL specified by |
|
28295 +acl_smtp_etrn in order to decide whether the command should be accepted or not. |
|
28296 +If no ACL is defined, the command is rejected. |
|
28297 + |
|
28298 +The ETRN command is concerned with "releasing" messages that are awaiting |
|
28299 +delivery to certain hosts. As Exim does not organize its message queue by host, |
|
28300 +the only form of ETRN that is supported by default is the one where the text |
|
28301 +starts with the "#" prefix, in which case the remainder of the text is specific |
|
28302 +to the SMTP server. A valid ETRN command causes a run of Exim with the -R |
|
28303 +option to happen, with the remainder of the ETRN text as its argument. For |
|
28304 +example, |
|
28305 + |
|
28306 +ETRN #brigadoon |
|
28307 + |
|
28308 +runs the command |
|
28309 + |
|
28310 +exim -R brigadoon |
|
28311 + |
|
28312 +which causes a delivery attempt on all messages with undelivered addresses |
|
28313 +containing the text "brigadoon". When smtp_etrn_serialize is set (the default), |
|
28314 +Exim prevents the simultaneous execution of more than one queue run for the |
|
28315 +same argument string as a result of an ETRN command. This stops a misbehaving |
|
28316 +client from starting more than one queue runner at once. |
|
28317 + |
|
28318 +Exim implements the serialization by means of a hints database in which a |
|
28319 +record is written whenever a process is started by ETRN, and deleted when the |
|
28320 +process completes. However, Exim does not keep the SMTP session waiting for the |
|
28321 +ETRN process to complete. Once ETRN is accepted, the client is sent a "success" |
|
28322 +return code. Obviously there is scope for hints records to get left lying |
|
28323 +around if there is a system or program crash. To guard against this, Exim |
|
28324 +ignores any records that are more than six hours old. |
|
28325 + |
|
28326 +For more control over what ETRN does, the smtp_etrn_command option can used. |
|
28327 +This specifies a command that is run whenever ETRN is received, whatever the |
|
28328 +form of its argument. For example: |
|
28329 + |
|
28330 +smtp_etrn_command = /etc/etrn_command $domain \ |
|
28331 + $sender_host_address |
|
28332 + |
|
28333 +The string is split up into arguments which are independently expanded. The |
|
28334 +expansion variable $domain is set to the argument of the ETRN command, and no |
|
28335 +syntax checking is done on the contents of this argument. Exim does not wait |
|
28336 +for the command to complete, so its status code is not checked. Exim runs under |
|
28337 +its own uid and gid when receiving incoming SMTP, so it is not possible for it |
|
28338 +to change them before running the command. |
|
28339 + |
|
28340 +45.9Â Incoming local SMTP |
|
28341 + |
|
28342 +Some user agents use SMTP to pass messages to their local MTA using the |
|
28343 +standard input and output, as opposed to passing the envelope on the command |
|
28344 +line and writing the message to the standard input. This is supported by the |
|
28345 +-bs option. This form of SMTP is handled in the same way as incoming messages |
|
28346 +over TCP/IP (including the use of ACLs), except that the envelope sender given |
|
28347 +in a MAIL command is ignored unless the caller is trusted. In an ACL you can |
|
28348 +detect this form of SMTP input by testing for an empty host identification. It |
|
28349 +is common to have this as the first line in the ACL that runs for RCPT |
|
28350 +commands: |
|
28351 + |
|
28352 +accept hosts = : |
|
28353 + |
|
28354 +This accepts SMTP messages from local processes without doing any other tests. |
|
28355 + |
|
28356 +45.10Â Outgoing batched SMTP |
|
28357 + |
|
28358 +Both the appendfile and pipe transports can be used for handling batched SMTP. |
|
28359 +Each has an option called use_bsmtp which causes messages to be output in BSMTP |
|
28360 +format. No SMTP responses are possible for this form of delivery. All it is |
|
28361 +doing is using SMTP commands as a way of transmitting the envelope along with |
|
28362 +the message. |
|
28363 + |
|
28364 +The message is written to the file or pipe preceded by the SMTP commands MAIL |
|
28365 +and RCPT, and followed by a line containing a single dot. Lines in the message |
|
28366 +that start with a dot have an extra dot added. The SMTP command HELO is not |
|
28367 +normally used. If it is required, the message_prefix option can be used to |
|
28368 +specify it. |
|
28369 + |
|
28370 +Because appendfile and pipe are both local transports, they accept only one |
|
28371 +recipient address at a time by default. However, you can arrange for them to |
|
28372 +handle several addresses at once by setting the batch_max option. When this is |
|
28373 +done for BSMTP, messages may contain multiple RCPT commands. See chapter 25 for |
|
28374 +more details. |
|
28375 + |
|
28376 +When one or more addresses are routed to a BSMTP transport by a router that |
|
28377 +sets up a host list, the name of the first host on the list is available to the |
|
28378 +transport in the variable $host. Here is an example of such a transport and |
|
28379 +router: |
|
28380 + |
|
28381 +begin routers |
|
28382 +route_append: |
|
28383 + driver = manualroute |
|
28384 + transport = smtp_appendfile |
|
28385 + route_list = domain.example batch.host.example |
|
28386 + |
|
28387 +begin transports |
|
28388 +smtp_appendfile: |
|
28389 + driver = appendfile |
|
28390 + directory = /var/bsmtp/$host |
|
28391 + batch_max = 1000 |
|
28392 + use_bsmtp |
|
28393 + user = exim |
|
28394 + |
|
28395 +This causes messages addressed to domain.example to be written in BSMTP format |
|
28396 +to /var/bsmtp/batch.host.example, with only a single copy of each message |
|
28397 +(unless there are more than 1000 recipients). |
|
28398 + |
|
28399 +45.11Â Incoming batched SMTP |
|
28400 + |
|
28401 +The -bS command line option causes Exim to accept one or more messages by |
|
28402 +reading SMTP on the standard input, but to generate no responses. If the caller |
|
28403 +is trusted, the senders in the MAIL commands are believed; otherwise the sender |
|
28404 +is always the caller of Exim. Unqualified senders and receivers are not |
|
28405 +rejected (there seems little point) but instead just get qualified. HELO and |
|
28406 +EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act as NOOP; QUIT quits. |
|
28407 + |
|
28408 +Minimal policy checking is done for BSMTP input. Only the non-SMTP ACL is run |
|
28409 +in the same way as for non-SMTP local input. |
|
28410 + |
|
28411 +If an error is detected while reading a message, including a missing "." at the |
|
28412 +end, Exim gives up immediately. It writes details of the error to the standard |
|
28413 +output in a stylized way that the calling program should be able to make some |
|
28414 +use of automatically, for example: |
|
28415 + |
|
28416 +554 Unexpected end of file |
|
28417 +Transaction started in line 10 |
|
28418 +Error detected in line 14 |
|
28419 + |
|
28420 +It writes a more verbose version, for human consumption, to the standard error |
|
28421 +file, for example: |
|
28422 + |
|
28423 +An error was detected while processing a file of BSMTP input. |
|
28424 +The error message was: |
|
28425 + |
|
28426 +501 '>' missing at end of address |
|
28427 + |
|
28428 +The SMTP transaction started in line 10. |
|
28429 +The error was detected in line 12. |
|
28430 +The SMTP command at fault was: |
|
28431 + |
|
28432 +rcpt to:<malformed@in.com.plete |
|
28433 + |
|
28434 +1 previous message was successfully processed. |
|
28435 +The rest of the batch was abandoned. |
|
28436 + |
|
28437 +The return code from Exim is zero only if there were no errors. It is 1 if some |
|
28438 +messages were accepted before an error was detected, and 2 if no messages were |
|
28439 +accepted. |
|
28440 + |
|
28441 +46. Customizing bounce and warning messages |
|
28442 + |
|
28443 +When a message fails to be delivered, or remains on the queue for more than a |
|
28444 +configured amount of time, Exim sends a message to the original sender, or to |
|
28445 +an alternative configured address. The text of these messages is built into the |
|
28446 +code of Exim, but it is possible to change it, either by adding a single |
|
28447 +string, or by replacing each of the paragraphs by text supplied in a file. |
|
28448 + |
|
28449 +The From: and To: header lines are automatically generated; you can cause a |
|
28450 +Reply-To: line to be added by setting the errors_reply_to option. Exim also |
|
28451 +adds the line |
|
28452 + |
|
28453 +Auto-Submitted: auto-generated |
|
28454 + |
|
28455 +to all warning and bounce messages, |
|
28456 + |
|
28457 +46.1Â Customizing bounce messages |
|
28458 + |
|
28459 +If bounce_message_text is set, its contents are included in the default message |
|
28460 +immediately after "This message was created automatically by mail delivery |
|
28461 +software." The string is not expanded. It is not used if bounce_message_file is |
|
28462 +set. |
|
28463 + |
|
28464 +When bounce_message_file is set, it must point to a template file for |
|
28465 +constructing error messages. The file consists of a series of text items, |
|
28466 +separated by lines consisting of exactly four asterisks. If the file cannot be |
|
28467 +opened, default text is used and a message is written to the main and panic |
|
28468 +logs. If any text item in the file is empty, default text is used for that |
|
28469 +item. |
|
28470 + |
|
28471 +Each item of text that is read from the file is expanded, and there are two |
|
28472 +expansion variables which can be of use here: $bounce_recipient is set to the |
|
28473 +recipient of an error message while it is being created, and |
|
28474 +$bounce_return_size_limit contains the value of the return_size_limit option, |
|
28475 +rounded to a whole number. |
|
28476 + |
|
28477 +The items must appear in the file in the following order: |
|
28478 + |
|
28479 + * The first item is included in the headers, and should include at least a |
|
28480 + Subject: header. Exim does not check the syntax of these headers. |
|
28481 + |
|
28482 + * The second item forms the start of the error message. After it, Exim lists |
|
28483 + the failing addresses with their error messages. |
|
28484 + |
|
28485 + * The third item is used to introduce any text from pipe transports that is |
|
28486 + to be returned to the sender. It is omitted if there is no such text. |
|
28487 + |
|
28488 + * The fourth item is used to introduce the copy of the message that is |
|
28489 + returned as part of the error report. |
|
28490 + |
|
28491 + * The fifth item is added after the fourth one if the returned message is |
|
28492 + truncated because it is bigger than return_size_limit. |
|
28493 + |
|
28494 + * The sixth item is added after the copy of the original message. |
|
28495 + |
|
28496 +The default state (bounce_message_file unset) is equivalent to the following |
|
28497 +file, in which the sixth item is empty. The Subject: and some other lines have |
|
28498 +been split in order to fit them on the page: |
|
28499 + |
|
28500 +Subject: Mail delivery failed |
|
28501 + ${if eq{$sender_address}{$bounce_recipient} |
|
28502 + {: returning message to sender}} |
|
28503 +**** |
|
28504 +This message was created automatically by mail delivery software. |
|
28505 + |
|
28506 +A message ${if eq{$sender_address}{$bounce_recipient} |
|
28507 + {that you sent }{sent by |
|
28508 + |
|
28509 +<$sender_address> |
|
28510 + |
|
28511 +}}could not be delivered to all of its recipients. |
|
28512 +This is a permanent error. The following address(es) failed: |
|
28513 +**** |
|
28514 +The following text was generated during the delivery attempt(s): |
|
28515 +**** |
|
28516 +------ This is a copy of the message, including all the headers. |
|
28517 + ------ |
|
28518 +**** |
|
28519 +------ The body of the message is $message_size characters long; |
|
28520 + only the first |
|
28521 +------ $bounce_return_size_limit or so are included here. |
|
28522 +**** |
|
28523 + |
|
28524 +46.2Â Customizing warning messages |
|
28525 + |
|
28526 +The option warn_message_file can be pointed at a template file for use when |
|
28527 +warnings about message delays are created. In this case there are only three |
|
28528 +text sections: |
|
28529 + |
|
28530 + * The first item is included in the headers, and should include at least a |
|
28531 + Subject: header. Exim does not check the syntax of these headers. |
|
28532 + |
|
28533 + * The second item forms the start of the warning message. After it, Exim |
|
28534 + lists the delayed addresses. |
|
28535 + |
|
28536 + * The third item then ends the message. |
|
28537 + |
|
28538 +The default state is equivalent to the following file, except that some lines |
|
28539 +have been split here, in order to fit them on the page: |
|
28540 + |
|
28541 +Subject: Warning: message $message_exim_id delayed |
|
28542 + $warn_message_delay |
|
28543 +**** |
|
28544 +This message was created automatically by mail delivery software. |
|
28545 + |
|
28546 +A message ${if eq{$sender_address}{$warn_message_recipients} |
|
28547 +{that you sent }{sent by |
|
28548 + |
|
28549 +<$sender_address> |
|
28550 + |
|
28551 +}}has not been delivered to all of its recipients after |
|
28552 +more than $warn_message_delay on the queue on $primary_hostname. |
|
28553 + |
|
28554 +The message identifier is: $message_exim_id |
|
28555 +The subject of the message is: $h_subject |
|
28556 +The date of the message is: $h_date |
|
28557 + |
|
28558 +The following address(es) have not yet been delivered: |
|
28559 +**** |
|
28560 +No action is required on your part. Delivery attempts will |
|
28561 +continue for some time, and this warning may be repeated at |
|
28562 +intervals if the message remains undelivered. Eventually the |
|
28563 +mail delivery software will give up, and when that happens, |
|
28564 +the message will be returned to you. |
|
28565 + |
|
28566 +However, in the default state the subject and date lines are omitted if no |
|
28567 +appropriate headers exist. During the expansion of this file, |
|
28568 +$warn_message_delay is set to the delay time in one of the forms "<n> minutes" |
|
28569 +or "<n> hours", and $warn_message_recipients contains a list of recipients for |
|
28570 +the warning message. There may be more than one if there are multiple addresses |
|
28571 +with different errors_to settings on the routers that handled them. |
|
28572 + |
|
28573 +47. Some common configuration settings |
|
28574 + |
|
28575 +This chapter discusses some configuration settings that seem to be fairly |
|
28576 +common. More examples and discussion can be found in the Exim book. |
|
28577 + |
|
28578 +47.1Â Sending mail to a smart host |
|
28579 + |
|
28580 +If you want to send all mail for non-local domains to a "smart host", you |
|
28581 +should replace the default dnslookup router with a router which does the |
|
28582 +routing explicitly: |
|
28583 + |
|
28584 +send_to_smart_host: |
|
28585 + driver = manualroute |
|
28586 + route_list = !+local_domains smart.host.name |
|
28587 + transport = remote_smtp |
|
28588 + |
|
28589 +You can use the smart host's IP address instead of the name if you wish. If you |
|
28590 +are using Exim only to submit messages to a smart host, and not for receiving |
|
28591 +incoming messages, you can arrange for it to do the submission synchronously by |
|
28592 +setting the mua_wrapper option (see chapter 48). |
|
28593 + |
|
28594 +47.2Â Using Exim to handle mailing lists |
|
28595 + |
|
28596 +Exim can be used to run simple mailing lists, but for large and/or complicated |
|
28597 +requirements, the use of additional specialized mailing list software such as |
|
28598 +Majordomo or Mailman is recommended. |
|
28599 + |
|
28600 +The redirect router can be used to handle mailing lists where each list is |
|
28601 +maintained in a separate file, which can therefore be managed by an independent |
|
28602 +manager. The domains router option can be used to run these lists in a separate |
|
28603 +domain from normal mail. For example: |
|
28604 + |
|
28605 +lists: |
|
28606 + driver = redirect |
|
28607 + domains = lists.example |
|
28608 + file = /usr/lists/$local_part |
|
28609 + forbid_pipe |
|
28610 + forbid_file |
|
28611 + errors_to = $local_part-request@lists.example |
|
28612 + no_more |
|
28613 + |
|
28614 +This router is skipped for domains other than lists.example. For addresses in |
|
28615 +that domain, it looks for a file that matches the local part. If there is no |
|
28616 +such file, the router declines, but because no_more is set, no subsequent |
|
28617 +routers are tried, and so the whole delivery fails. |
|
28618 + |
|
28619 +The forbid_pipe and forbid_file options prevent a local part from being |
|
28620 +expanded into a file name or a pipe delivery, which is usually inappropriate in |
|
28621 +a mailing list. |
|
28622 + |
|
28623 +The errors_to option specifies that any delivery errors caused by addresses |
|
28624 +taken from a mailing list are to be sent to the given address rather than the |
|
28625 +original sender of the message. However, before acting on this, Exim verifies |
|
28626 +the error address, and ignores it if verification fails. |
|
28627 + |
|
28628 +For example, using the configuration above, mail sent to dicts@lists.example is |
|
28629 +passed on to those addresses contained in /usr/lists/dicts, with error reports |
|
28630 +directed to dicts-request@lists.example, provided that this address can be |
|
28631 +verified. There could be a file called /usr/lists/dicts-request containing the |
|
28632 +address(es) of this particular list's manager(s), but other approaches, such as |
|
28633 +setting up an earlier router (possibly using the local_part_prefix or |
|
28634 +local_part_suffix options) to handle addresses of the form owner-xxx or xxx- |
|
28635 +request, are also possible. |
|
28636 + |
|
28637 +47.3Â Syntax errors in mailing lists |
|
28638 + |
|
28639 +If an entry in redirection data contains a syntax error, Exim normally defers |
|
28640 +delivery of the original address. That means that a syntax error in a mailing |
|
28641 +list holds up all deliveries to the list. This may not be appropriate when a |
|
28642 +list is being maintained automatically from data supplied by users, and the |
|
28643 +addresses are not rigorously checked. |
|
28644 + |
|
28645 +If the skip_syntax_errors option is set, the redirect router just skips entries |
|
28646 +that fail to parse, noting the incident in the log. If in addition |
|
28647 +syntax_errors_to is set to a verifiable address, a message is sent to it |
|
28648 +whenever a broken address is skipped. It is usually appropriate to set |
|
28649 +syntax_errors_to to the same address as errors_to. |
|
28650 + |
|
28651 +47.4Â Re-expansion of mailing lists |
|
28652 + |
|
28653 +Exim remembers every individual address to which a message has been delivered, |
|
28654 +in order to avoid duplication, but it normally stores only the original |
|
28655 +recipient addresses with a message. If all the deliveries to a mailing list |
|
28656 +cannot be done at the first attempt, the mailing list is re-expanded when the |
|
28657 +delivery is next tried. This means that alterations to the list are taken into |
|
28658 +account at each delivery attempt, so addresses that have been added to the list |
|
28659 +since the message arrived will therefore receive a copy of the message, even |
|
28660 +though it pre-dates their subscription. |
|
28661 + |
|
28662 +If this behaviour is felt to be undesirable, the one_time option can be set on |
|
28663 +the redirect router. If this is done, any addresses generated by the router |
|
28664 +that fail to deliver at the first attempt are added to the message as "top |
|
28665 +level" addresses, and the parent address that generated them is marked |
|
28666 +"delivered". Thus, expansion of the mailing list does not happen again at the |
|
28667 +subsequent delivery attempts. The disadvantage of this is that if any of the |
|
28668 +failing addresses are incorrect, correcting them in the file has no effect on |
|
28669 +pre-existing messages. |
|
28670 + |
|
28671 +The original top-level address is remembered with each of the generated |
|
28672 +addresses, and is output in any log messages. However, any intermediate parent |
|
28673 +addresses are not recorded. This makes a difference to the log only if the |
|
28674 +all_parents selector is set, but for mailing lists there is normally only one |
|
28675 +level of expansion anyway. |
|
28676 + |
|
28677 +47.5Â Closed mailing lists |
|
28678 + |
|
28679 +The examples so far have assumed open mailing lists, to which anybody may send |
|
28680 +mail. It is also possible to set up closed lists, where mail is accepted from |
|
28681 +specified senders only. This is done by making use of the generic senders |
|
28682 +option to restrict the router that handles the list. |
|
28683 + |
|
28684 +The following example uses the same file as a list of recipients and as a list |
|
28685 +of permitted senders. It requires three routers: |
|
28686 + |
|
28687 +lists_request: |
|
28688 + driver = redirect |
|
28689 + domains = lists.example |
|
28690 + local_part_suffix = -request |
|
28691 + file = /usr/lists/$local_part$local_part_suffix |
|
28692 + no_more |
|
28693 + |
|
28694 +lists_post: |
|
28695 + driver = redirect |
|
28696 + domains = lists.example |
|
28697 + senders = ${if exists {/usr/lists/$local_part}\ |
|
28698 + {lsearch;/usr/lists/$local_part}{*}} |
|
28699 + file = /usr/lists/$local_part |
|
28700 + forbid_pipe |
|
28701 + forbid_file |
|
28702 + errors_to = $local_part-request@lists.example |
|
28703 + no_more |
|
28704 + |
|
28705 +lists_closed: |
|
28706 + driver = redirect |
|
28707 + domains = lists.example |
|
28708 + allow_fail |
|
28709 + data = :fail: $local_part@lists.example is a closed mailing list |
|
28710 + |
|
28711 +All three routers have the same domains setting, so for any other domains, they |
|
28712 +are all skipped. The first router runs only if the local part ends in -request. |
|
28713 +It handles messages to the list manager(s) by means of an open mailing list. |
|
28714 + |
|
28715 +The second router runs only if the senders precondition is satisfied. It checks |
|
28716 +for the existence of a list that corresponds to the local part, and then checks |
|
28717 +that the sender is on the list by means of a linear search. It is necessary to |
|
28718 +check for the existence of the file before trying to search it, because |
|
28719 +otherwise Exim thinks there is a configuration error. If the file does not |
|
28720 +exist, the expansion of senders is *, which matches all senders. This means |
|
28721 +that the router runs, but because there is no list, declines, and no_more |
|
28722 +ensures that no further routers are run. The address fails with an "unrouteable |
|
28723 +address" error. |
|
28724 + |
|
28725 +The third router runs only if the second router is skipped, which happens when |
|
28726 +a mailing list exists, but the sender is not on it. This router forcibly fails |
|
28727 +the address, giving a suitable error message. |
|
28728 + |
|
28729 +47.6Â Variable Envelope Return Paths (VERP) |
|
28730 + |
|
28731 +Variable Envelope Return Paths - see http://cr.yp.to/proto/verp.txt - are a way |
|
28732 +of helping mailing list administrators discover which subscription address is |
|
28733 +the cause of a particular delivery failure. The idea is to encode the original |
|
28734 +recipient address in the outgoing envelope sender address, so that if the |
|
28735 +message is forwarded by another host and then subsequently bounces, the |
|
28736 +original recipient can be extracted from the recipient address of the bounce. |
|
28737 + |
|
28738 +Envelope sender addresses can be modified by Exim using two different |
|
28739 +facilities: the errors_to option on a router (as shown in previous mailing list |
|
28740 +examples), or the return_path option on a transport. The second of these is |
|
28741 +effective only if the message is successfully delivered to another host; it is |
|
28742 +not used for errors detected on the local host (see the description of |
|
28743 +return_path in chapter 24). Here is an example of the use of return_path to |
|
28744 +implement VERP on an smtp transport: |
|
28745 + |
|
28746 +verp_smtp: |
|
28747 + driver = smtp |
|
28748 + max_rcpt = 1 |
|
28749 + return_path = \ |
|
28750 + ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\ |
|
28751 + {$1-request+$local_part=$domain@your.dom.example}fail} |
|
28752 + |
|
28753 +This has the effect of rewriting the return path (envelope sender) on outgoing |
|
28754 +SMTP messages, if the local part of the original return path ends in |
|
28755 +"-request", and the domain is your.dom.example. The rewriting inserts the local |
|
28756 +part and domain of the recipient into the return path. Suppose, for example, |
|
28757 +that a message whose return path has been set to |
|
28758 +somelist-request@your.dom.example is sent to subscriber@other.dom.example. In |
|
28759 +the transport, the return path is rewritten as |
|
28760 + |
|
28761 +somelist-request+subscriber=other.dom.example@your.dom.example |
|
28762 + |
|
28763 +For this to work, you must tell Exim to send multiple copies of messages that |
|
28764 +have more than one recipient, so that each copy has just one recipient. This is |
|
28765 +achieved by setting max_rcpt to 1. Without this, a single copy of a message |
|
28766 +might be sent to several different recipients in the same domain, in which case |
|
28767 +$local_part is not available in the transport, because it is not unique. |
|
28768 + |
|
28769 +Unless your host is doing nothing but mailing list deliveries, you should |
|
28770 +probably use a separate transport for the VERP deliveries, so as not to use |
|
28771 +extra resources in making one-per-recipient copies for other deliveries. This |
|
28772 +can easily be done by expanding the transport option in the router: |
|
28773 + |
|
28774 +dnslookup: |
|
28775 + driver = dnslookup |
|
28776 + domains = ! +local_domains |
|
28777 + transport = \ |
|
28778 + ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\ |
|
28779 + {verp_smtp}{remote_smtp}} |
|
28780 + no_more |
|
28781 + |
|
28782 +If you want to change the return path using errors_to in a router instead of |
|
28783 +using return_path in the transport, you need to set errors_to on all routers |
|
28784 +that handle mailing list addresses. This will ensure that all delivery errors, |
|
28785 +including those detected on the local host, are sent to the VERP address. |
|
28786 + |
|
28787 +On a host that does no local deliveries and has no manual routing, only the |
|
28788 +dnslookup router needs to be changed. A special transport is not needed for |
|
28789 +SMTP deliveries. Every mailing list recipient has its own return path value, |
|
28790 +and so Exim must hand them to the transport one at a time. Here is an example |
|
28791 +of a dnslookup router that implements VERP: |
|
28792 + |
|
28793 +verp_dnslookup: |
|
28794 + driver = dnslookup |
|
28795 + domains = ! +local_domains |
|
28796 + transport = remote_smtp |
|
28797 + errors_to = \ |
|
28798 + ${if match {$return_path}{^(.+?)-request@your.dom.example\$}} |
|
28799 + {$1-request+$local_part=$domain@your.dom.example}fail} |
|
28800 + no_more |
|
28801 + |
|
28802 +Before you start sending out messages with VERPed return paths, you must also |
|
28803 +configure Exim to accept the bounce messages that come back to those paths. |
|
28804 +Typically this is done by setting a local_part_suffix option for a router, and |
|
28805 +using this to route the messages to wherever you want to handle them. |
|
28806 + |
|
28807 +The overhead incurred in using VERP depends very much on the size of the |
|
28808 +message, the number of recipient addresses that resolve to the same remote |
|
28809 +host, and the speed of the connection over which the message is being sent. If |
|
28810 +a lot of addresses resolve to the same host and the connection is slow, sending |
|
28811 +a separate copy of the message for each address may take substantially longer |
|
28812 +than sending a single copy with many recipients (for which VERP cannot be |
|
28813 +used). |
|
28814 + |
|
28815 +47.7Â Virtual domains |
|
28816 + |
|
28817 +The phrase virtual domain is unfortunately used with two rather different |
|
28818 +meanings: |
|
28819 + |
|
28820 + * A domain for which there are no real mailboxes; all valid local parts are |
|
28821 + aliases for other email addresses. Common examples are organizational |
|
28822 + top-level domains and "vanity" domains. |
|
28823 + |
|
28824 + * One of a number of independent domains that are all handled by the same |
|
28825 + host, with mailboxes on that host, but where the mailbox owners do not |
|
28826 + necessarily have login accounts on that host. |
|
28827 + |
|
28828 +The first usage is probably more common, and does seem more "virtual" than the |
|
28829 +second. This kind of domain can be handled in Exim with a straightforward |
|
28830 +aliasing router. One approach is to create a separate alias file for each |
|
28831 +virtual domain. Exim can test for the existence of the alias file to determine |
|
28832 +whether the domain exists. The dsearch lookup type is useful here, leading to a |
|
28833 +router of this form: |
|
28834 + |
|
28835 +virtual: |
|
28836 + driver = redirect |
|
28837 + domains = dsearch;/etc/mail/virtual |
|
28838 + data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}} |
|
28839 + no_more |
|
28840 + |
|
28841 +The domains option specifies that the router is to be skipped, unless there is |
|
28842 +a file in the /etc/mail/virtual directory whose name is the same as the domain |
|
28843 +that is being processed. When the router runs, it looks up the local part in |
|
28844 +the file to find a new address (or list of addresses). The no_more setting |
|
28845 +ensures that if the lookup fails (leading to data being an empty string), Exim |
|
28846 +gives up on the address without trying any subsequent routers. |
|
28847 + |
|
28848 +This one router can handle all the virtual domains because the alias file names |
|
28849 +follow a fixed pattern. Permissions can be arranged so that appropriate people |
|
28850 +can edit the different alias files. A successful aliasing operation results in |
|
28851 +a new envelope recipient address, which is then routed from scratch. |
|
28852 + |
|
28853 +The other kind of "virtual" domain can also be handled in a straightforward |
|
28854 +way. One approach is to create a file for each domain containing a list of |
|
28855 +valid local parts, and use it in a router like this: |
|
28856 + |
|
28857 +my_domains: |
|
28858 + driver = accept |
|
28859 + domains = dsearch;/etc/mail/domains |
|
28860 + local_parts = lsearch;/etc/mail/domains/$domain |
|
28861 + transport = my_mailboxes |
|
28862 + |
|
28863 +The address is accepted if there is a file for the domain, and the local part |
|
28864 +can be found in the file. The domains option is used to check for the file's |
|
28865 +existence because domains is tested before the local_parts option (see section |
|
28866 +3.12). You cannot use require_files, because that option is tested after |
|
28867 +local_parts. The transport is as follows: |
|
28868 + |
|
28869 +my_mailboxes: |
|
28870 + driver = appendfile |
|
28871 + file = /var/mail/$domain/$local_part |
|
28872 + user = mail |
|
28873 + |
|
28874 +This uses a directory of mailboxes for each domain. The user setting is |
|
28875 +required, to specify which uid is to be used for writing to the mailboxes. |
|
28876 + |
|
28877 +The configuration shown here is just one example of how you might support this |
|
28878 +requirement. There are many other ways this kind of configuration can be set |
|
28879 +up, for example, by using a database instead of separate files to hold all the |
|
28880 +information about the domains. |
|
28881 + |
|
28882 +47.8Â Multiple user mailboxes |
|
28883 + |
|
28884 +Heavy email users often want to operate with multiple mailboxes, into which |
|
28885 +incoming mail is automatically sorted. A popular way of handling this is to |
|
28886 +allow users to use multiple sender addresses, so that replies can easily be |
|
28887 +identified. Users are permitted to add prefixes or suffixes to their local |
|
28888 +parts for this purpose. The wildcard facility of the generic router options |
|
28889 +local_part_prefix and local_part_suffix can be used for this. For example, |
|
28890 +consider this router: |
|
28891 + |
|
28892 +userforward: |
|
28893 + driver = redirect |
|
28894 + check_local_user |
|
28895 + file = $home/.forward |
|
28896 + local_part_suffix = -* |
|
28897 + local_part_suffix_optional |
|
28898 + allow_filter |
|
28899 + |
|
28900 +It runs a user's .forward file for all local parts of the form username-*. |
|
28901 +Within the filter file the user can distinguish different cases by testing the |
|
28902 +variable $local_part_suffix. For example: |
|
28903 + |
|
28904 +if $local_part_suffix contains -special then |
|
28905 +save /home/$local_part/Mail/special |
|
28906 +endif |
|
28907 + |
|
28908 +If the filter file does not exist, or does not deal with such addresses, they |
|
28909 +fall through to subsequent routers, and, assuming no subsequent use of the |
|
28910 +local_part_suffix option is made, they presumably fail. Thus, users have |
|
28911 +control over which suffixes are valid. |
|
28912 + |
|
28913 +Alternatively, a suffix can be used to trigger the use of a different .forward |
|
28914 +file - which is the way a similar facility is implemented in another MTA: |
|
28915 + |
|
28916 +userforward: |
|
28917 + driver = redirect |
|
28918 + check_local_user |
|
28919 + file = $home/.forward$local_part_suffix |
|
28920 + local_part_suffix = -* |
|
28921 + local_part_suffix_optional |
|
28922 + allow_filter |
|
28923 + |
|
28924 +If there is no suffix, .forward is used; if the suffix is -special, for |
|
28925 +example, .forward-special is used. Once again, if the appropriate file does not |
|
28926 +exist, or does not deal with the address, it is passed on to subsequent |
|
28927 +routers, which could, if required, look for an unqualified .forward file to use |
|
28928 +as a default. |
|
28929 + |
|
28930 +47.9Â Simplified vacation processing |
|
28931 + |
|
28932 +The traditional way of running the vacation program is for a user to set up a |
|
28933 +pipe command in a .forward file (see section 22.6 for syntax details). This is |
|
28934 +prone to error by inexperienced users. There are two features of Exim that can |
|
28935 +be used to make this process simpler for users: |
|
28936 + |
|
28937 + * A local part prefix such as "vacation-" can be specified on a router which |
|
28938 + can cause the message to be delivered directly to the vacation program, or |
|
28939 + alternatively can use Exim's autoreply transport. The contents of a user's |
|
28940 + .forward file are then much simpler. For example: |
|
28941 + |
|
28942 + spqr, vacation-spqr |
|
28943 + |
|
28944 + * The require_files generic router option can be used to trigger a vacation |
|
28945 + delivery by checking for the existence of a certain file in the user's home |
|
28946 + directory. The unseen generic option should also be used, to ensure that |
|
28947 + the original delivery also proceeds. In this case, all the user has to do |
|
28948 + is to create a file called, say, .vacation, containing a vacation message. |
|
28949 + |
|
28950 +Another advantage of both these methods is that they both work even when the |
|
28951 +use of arbitrary pipes by users is locked out. |
|
28952 + |
|
28953 +47.10Â Taking copies of mail |
|
28954 + |
|
28955 +Some installations have policies that require archive copies of all messages to |
|
28956 +be made. A single copy of each message can easily be taken by an appropriate |
|
28957 +command in a system filter, which could, for example, use a different file for |
|
28958 +each day's messages. |
|
28959 + |
|
28960 +There is also a shadow transport mechanism that can be used to take copies of |
|
28961 +messages that are successfully delivered by local transports, one copy per |
|
28962 +delivery. This could be used, inter alia, to implement automatic notification |
|
28963 +of delivery by sites that insist on doing such things. |
|
28964 + |
|
28965 +47.11Â Intermittently connected hosts |
|
28966 + |
|
28967 +It has become quite common (because it is cheaper) for hosts to connect to the |
|
28968 +Internet periodically rather than remain connected all the time. The normal |
|
28969 +arrangement is that mail for such hosts accumulates on a system that is |
|
28970 +permanently connected. |
|
28971 + |
|
28972 +Exim was designed for use on permanently connected hosts, and so it is not |
|
28973 +particularly well-suited to use in an intermittently connected environment. |
|
28974 +Nevertheless there are some features that can be used. |
|
28975 + |
|
28976 +47.12Â Exim on the upstream server host |
|
28977 + |
|
28978 +It is tempting to arrange for incoming mail for the intermittently connected |
|
28979 +host to remain on Exim's queue until the client connects. However, this |
|
28980 +approach does not scale very well. Two different kinds of waiting message are |
|
28981 +being mixed up in the same queue - those that cannot be delivered because of |
|
28982 +some temporary problem, and those that are waiting for their destination host |
|
28983 +to connect. This makes it hard to manage the queue, as well as wasting |
|
28984 +resources, because each queue runner scans the entire queue. |
|
28985 + |
|
28986 +A better approach is to separate off those messages that are waiting for an |
|
28987 +intermittently connected host. This can be done by delivering these messages |
|
28988 +into local files in batch SMTP, "mailstore", or other envelope-preserving |
|
28989 +format, from where they are transmitted by other software when their |
|
28990 +destination connects. This makes it easy to collect all the mail for one host |
|
28991 +in a single directory, and to apply local timeout rules on a per-message basis |
|
28992 +if required. |
|
28993 + |
|
28994 +On a very small scale, leaving the mail on Exim's queue can be made to work. If |
|
28995 +you are doing this, you should configure Exim with a long retry period for the |
|
28996 +intermittent host. For example: |
|
28997 + |
|
28998 +cheshire.wonderland.fict.example * F,5d,24h |
|
28999 + |
|
29000 +This stops a lot of failed delivery attempts from occurring, but Exim remembers |
|
29001 +which messages it has queued up for that host. Once the intermittent host comes |
|
29002 +online, forcing delivery of one message (either by using the -M or -R options, |
|
29003 +or by using the ETRN SMTP command (see section 45.8) causes all the queued up |
|
29004 +messages to be delivered, often down a single SMTP connection. While the host |
|
29005 +remains connected, any new messages get delivered immediately. |
|
29006 + |
|
29007 +If the connecting hosts do not have fixed IP addresses, that is, if a host is |
|
29008 +issued with a different IP address each time it connects, Exim's retry |
|
29009 +mechanisms on the holding host get confused, because the IP address is normally |
|
29010 +used as part of the key string for holding retry information. This can be |
|
29011 +avoided by unsetting retry_include_ip_address on the smtp transport. Since this |
|
29012 +has disadvantages for permanently connected hosts, it is best to arrange a |
|
29013 +separate transport for the intermittently connected ones. |
|
29014 + |
|
29015 +47.13Â Exim on the intermittently connected client host |
|
29016 + |
|
29017 +The value of smtp_accept_queue_per_connection should probably be increased, or |
|
29018 +even set to zero (that is, disabled) on the intermittently connected host, so |
|
29019 +that all incoming messages down a single connection get delivered immediately. |
|
29020 + |
|
29021 +Mail waiting to be sent from an intermittently connected host will probably not |
|
29022 +have been routed, because without a connection DNS lookups are not possible. |
|
29023 +This means that if a normal queue run is done at connection time, each message |
|
29024 +is likely to be sent in a separate SMTP session. This can be avoided by |
|
29025 +starting the queue run with a command line option beginning with -qq instead of |
|
29026 +-q. In this case, the queue is scanned twice. In the first pass, routing is |
|
29027 +done but no deliveries take place. The second pass is a normal queue run; since |
|
29028 +all the messages have been previously routed, those destined for the same host |
|
29029 +are likely to get sent as multiple deliveries in a single SMTP connection. |
|
29030 + |
|
29031 +48. Using Exim as a non-queueing client |
|
29032 + |
|
29033 +On a personal computer, it is a common requirement for all email to be sent to |
|
29034 +a "smart host". There are plenty of MUAs that can be configured to operate that |
|
29035 +way, for all the popular operating systems. However, there are some MUAs for |
|
29036 +Unix-like systems that cannot be so configured: they submit messages using the |
|
29037 +command line interface of /usr/sbin/sendmail. Furthermore, utility programs |
|
29038 +such as cron submit messages this way. |
|
29039 + |
|
29040 +If the personal computer runs continuously, there is no problem, because it can |
|
29041 +run a conventional MTA that handles delivery to the smart host, and deal with |
|
29042 +any delays via its queueing mechanism. However, if the computer does not run |
|
29043 +continuously or runs different operating systems at different times, queueing |
|
29044 +email is not desirable. |
|
29045 + |
|
29046 +There is therefore a requirement for something that can provide the /usr/sbin/ |
|
29047 +sendmail interface but deliver messages to a smart host without any queueing or |
|
29048 +retrying facilities. Furthermore, the delivery to the smart host should be |
|
29049 +synchronous, so that if it fails, the sending MUA is immediately informed. In |
|
29050 +other words, we want something that extends an MUA that submits to a local MTA |
|
29051 +via the command line so that it behaves like one that submits to a remote smart |
|
29052 +host using TCP/SMTP. |
|
29053 + |
|
29054 +There are a number of applications (for example, there is one called ssmtp) |
|
29055 +that do this job. However, people have found them to be lacking in various |
|
29056 +ways. For instance, you might want to allow aliasing and forwarding to be done |
|
29057 +before sending a message to the smart host. |
|
29058 + |
|
29059 +Exim already had the necessary infrastructure for doing this job. Just a few |
|
29060 +tweaks were needed to make it behave as required, though it is somewhat of an |
|
29061 +overkill to use a fully-featured MTA for this purpose. |
|
29062 + |
|
29063 +There is a Boolean global option called mua_wrapper, defaulting false. Setting |
|
29064 +mua_wrapper true causes Exim to run in a special mode where it assumes that it |
|
29065 +is being used to "wrap" a command-line MUA in the manner just described. As |
|
29066 +well as setting mua_wrapper, you also need to provide a compatible router and |
|
29067 +transport configuration. Typically there will be just one router and one |
|
29068 +transport, sending everything to a smart host. |
|
29069 + |
|
29070 +When run in MUA wrapping mode, the behaviour of Exim changes in the following |
|
29071 +ways: |
|
29072 + |
|
29073 + * A daemon cannot be run, nor will Exim accept incoming messages from inetd. |
|
29074 + In other words, the only way to submit messages is via the command line. |
|
29075 + |
|
29076 + * Each message is synchronously delivered as soon as it is received (-odi is |
|
29077 + assumed). All queueing options (queue_only, queue_smtp_domains, control in |
|
29078 + an ACL, etc.) are quietly ignored. The Exim reception process does not |
|
29079 + finish until the delivery attempt is complete. If the delivery is |
|
29080 + successful, a zero return code is given. |
|
29081 + |
|
29082 + * Address redirection is permitted, but the final routing for all addresses |
|
29083 + must be to the same remote transport, and to the same list of hosts. |
|
29084 + Furthermore, the return address (envelope sender) must be the same for all |
|
29085 + recipients, as must any added or deleted header lines. In other words, it |
|
29086 + must be possible to deliver the message in a single SMTP transaction, |
|
29087 + however many recipients there are. |
|
29088 + |
|
29089 + * If these conditions are not met, or if routing any address results in a |
|
29090 + failure or defer status, or if Exim is unable to deliver all the recipients |
|
29091 + successfully to one of the smart hosts, delivery of the entire message |
|
29092 + fails. |
|
29093 + |
|
29094 + * Because no queueing is allowed, all failures are treated as permanent; |
|
29095 + there is no distinction between 4xx and 5xx SMTP response codes from the |
|
29096 + smart host. Furthermore, because only a single yes/no response can be given |
|
29097 + to the caller, it is not possible to deliver to some recipients and not |
|
29098 + others. If there is an error (temporary or permanent) for any recipient, |
|
29099 + all are failed. |
|
29100 + |
|
29101 + * If more than one smart host is listed, Exim will try another host after a |
|
29102 + connection failure or a timeout, in the normal way. However, if this kind |
|
29103 + of failure happens for all the hosts, the delivery fails. |
|
29104 + |
|
29105 + * When delivery fails, an error message is written to the standard error |
|
29106 + stream (as well as to Exim's log), and Exim exits to the caller with a |
|
29107 + return code value 1. The message is expunged from Exim's spool files. No |
|
29108 + bounce messages are ever generated. |
|
29109 + |
|
29110 + * No retry data is maintained, and any retry rules are ignored. |
|
29111 + |
|
29112 + * A number of Exim options are overridden: deliver_drop_privilege is forced |
|
29113 + true, max_rcpt in the smtp transport is forced to "unlimited", |
|
29114 + remote_max_parallel is forced to one, and fallback hosts are ignored. |
|
29115 + |
|
29116 +The overall effect is that Exim makes a single synchronous attempt to deliver |
|
29117 +the message, failing if there is any kind of problem. Because no local |
|
29118 +deliveries are done and no daemon can be run, Exim does not need root |
|
29119 +privilege. It should be possible to run it setuid to exim instead of setuid to |
|
29120 +root. See section 52.3 for a general discussion about the advantages and |
|
29121 +disadvantages of running without root privilege. |
|
29122 + |
|
29123 +49. Log files |
|
29124 + |
|
29125 +Exim writes three different logs, referred to as the main log, the reject log, |
|
29126 +and the panic log: |
|
29127 + |
|
29128 + * The main log records the arrival of each message and each delivery in a |
|
29129 + single line in each case. The format is as compact as possible, in an |
|
29130 + attempt to keep down the size of log files. Two-character flag sequences |
|
29131 + make it easy to pick out these lines. A number of other events are recorded |
|
29132 + in the main log. Some of them are optional, in which case the log_selector |
|
29133 + option controls whether they are included or not. A Perl script called |
|
29134 + eximstats, which does simple analysis of main log files, is provided in the |
|
29135 + Exim distribution (see section 50.7). |
|
29136 + |
|
29137 + * The reject log records information from messages that are rejected as a |
|
29138 + result of a configuration option (that is, for policy reasons). The first |
|
29139 + line of each rejection is a copy of the line that is also written to the |
|
29140 + main log. Then, if the message's header has been read at the time the log |
|
29141 + is written, its contents are written to this log. Only the original header |
|
29142 + lines are available; header lines added by ACLs are not logged. You can use |
|
29143 + the reject log to check that your policy controls are working correctly; on |
|
29144 + a busy host this may be easier than scanning the main log for rejection |
|
29145 + messages. You can suppress the writing of the reject log by setting |
|
29146 + write_rejectlog false. |
|
29147 + |
|
29148 + * When certain serious errors occur, Exim writes entries to its panic log. If |
|
29149 + the error is sufficiently disastrous, Exim bombs out afterwards. Panic log |
|
29150 + entries are usually written to the main log as well, but can get lost amid |
|
29151 + the mass of other entries. The panic log should be empty under normal |
|
29152 + circumstances. It is therefore a good idea to check it (or to have a cron |
|
29153 + script check it) regularly, in order to become aware of any problems. When |
|
29154 + Exim cannot open its panic log, it tries as a last resort to write to the |
|
29155 + system log (syslog). This is opened with LOG_PID+LOG_CONS and the facility |
|
29156 + code of LOG_MAIL. The message itself is written at priority LOG_CRIT. |
|
29157 + |
|
29158 +Every log line starts with a timestamp, in the format shown in the following |
|
29159 +example. Note that many of the examples shown in this chapter are line-wrapped. |
|
29160 +In the log file, this would be all on one line: |
|
29161 + |
|
29162 +2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed |
|
29163 + by QUIT |
|
29164 + |
|
29165 +By default, the timestamps are in the local timezone. There are two ways of |
|
29166 +changing this: |
|
29167 + |
|
29168 + * You can set the timezone option to a different time zone; in particular, if |
|
29169 + you set |
|
29170 + |
|
29171 + timezone = UTC |
|
29172 + |
|
29173 + the timestamps will be in UTC (aka GMT). |
|
29174 + |
|
29175 + * If you set log_timezone true, the time zone is added to the timestamp, for |
|
29176 + example: |
|
29177 + |
|
29178 + 2003-04-25 11:17:07 +0100 Start queue run: pid=12762 |
|
29179 + |
|
29180 +Exim does not include its process id in log lines by default, but you can |
|
29181 +request that it does so by specifying the "pid" log selector (see section 49.15 |
|
29182 +). When this is set, the process id is output, in square brackets, immediately |
|
29183 +after the time and date. |
|
29184 + |
|
29185 +49.1Â Where the logs are written |
|
29186 + |
|
29187 +The logs may be written to local files, or to syslog, or both. However, it |
|
29188 +should be noted that many syslog implementations use UDP as a transport, and |
|
29189 +are therefore unreliable in the sense that messages are not guaranteed to |
|
29190 +arrive at the loghost, nor is the ordering of messages necessarily maintained. |
|
29191 +It has also been reported that on large log files (tens of megabytes) you may |
|
29192 +need to tweak syslog to prevent it syncing the file with each write - on Linux |
|
29193 +this has been seen to make syslog take 90% plus of CPU time. |
|
29194 + |
|
29195 +The destination for Exim's logs is configured by setting LOG_FILE_PATH in Local |
|
29196 +/Makefile or by setting log_file_path in the run time configuration. This |
|
29197 +latter string is expanded, so it can contain, for example, references to the |
|
29198 +host name: |
|
29199 + |
|
29200 +log_file_path = /var/log/$primary_hostname/exim_%slog |
|
29201 + |
|
29202 +It is generally advisable, however, to set the string in Local/Makefile rather |
|
29203 +than at run time, because then the setting is available right from the start of |
|
29204 +Exim's execution. Otherwise, if there's something it wants to log before it has |
|
29205 +read the configuration file (for example, an error in the configuration file) |
|
29206 +it will not use the path you want, and may not be able to log at all. |
|
29207 + |
|
29208 +The value of LOG_FILE_PATH or log_file_path is a colon-separated list, |
|
29209 +currently limited to at most two items. This is one option where the facility |
|
29210 +for changing a list separator may not be used. The list must always be |
|
29211 +colon-separated. If an item in the list is "syslog" then syslog is used; |
|
29212 +otherwise the item must either be an absolute path, containing "%s" at the |
|
29213 +point where "main", "reject", or "panic" is to be inserted, or be empty, |
|
29214 +implying the use of a default path. |
|
29215 + |
|
29216 +When Exim encounters an empty item in the list, it searches the list defined by |
|
29217 +LOG_FILE_PATH, and uses the first item it finds that is neither empty nor |
|
29218 +"syslog". This means that an empty item in log_file_path can be used to mean |
|
29219 +"use the path specified at build time". It no such item exists, log files are |
|
29220 +written in the log subdirectory of the spool directory. This is equivalent to |
|
29221 +the setting: |
|
29222 + |
|
29223 +log_file_path = $spool_directory/log/%slog |
|
29224 + |
|
29225 +If you do not specify anything at build time or run time, that is where the |
|
29226 +logs are written. |
|
29227 + |
|
29228 +A log file path may also contain "%D" if datestamped log file names are in use |
|
29229 +- see section 49.3 below. |
|
29230 + |
|
29231 +Here are some examples of possible settings: |
|
29232 + |
|
29233 +LOG_FILE_PATH=syslog                     syslog only |
|
29234 +LOG_FILE_PATH |
|
29235 +=:syslog                    syslog and default path |
|
29236 +LOG_FILE_PATH=syslog : /usr/log/exim_%s  syslog and specified path |
|
29237 +LOG_FILE_PATH=/usr/log/exim_%s           specified path only |
|
29238 + |
|
29239 +If there are more than two paths in the list, the first is used and a panic |
|
29240 +error is logged. |
|
29241 + |
|
29242 +49.2Â Logging to local files that are periodically "cycled" |
|
29243 + |
|
29244 +Some operating systems provide centralized and standardized methods for cycling |
|
29245 +log files. For those that do not, a utility script called exicyclog is provided |
|
29246 +(see section 50.6). This renames and compresses the main and reject logs each |
|
29247 +time it is called. The maximum number of old logs to keep can be set. It is |
|
29248 +suggested this script is run as a daily cron job. |
|
29249 + |
|
29250 +An Exim delivery process opens the main log when it first needs to write to it, |
|
29251 +and it keeps the file open in case subsequent entries are required - for |
|
29252 +example, if a number of different deliveries are being done for the same |
|
29253 +message. However, remote SMTP deliveries can take a long time, and this means |
|
29254 +that the file may be kept open long after it is renamed if exicyclog or |
|
29255 +something similar is being used to rename log files on a regular basis. To |
|
29256 +ensure that a switch of log files is noticed as soon as possible, Exim calls |
|
29257 +stat() on the main log's name before reusing an open file, and if the file does |
|
29258 +not exist, or its inode has changed, the old file is closed and Exim tries to |
|
29259 +open the main log from scratch. Thus, an old log file may remain open for quite |
|
29260 +some time, but no Exim processes should write to it once it has been renamed. |
|
29261 + |
|
29262 +49.3Â Datestamped log files |
|
29263 + |
|
29264 +Instead of cycling the main and reject log files by renaming them periodically, |
|
29265 +some sites like to use files whose names contain a datestamp, for example, |
|
29266 +mainlog-20031225. The datestamp is in the form yyyymmdd. Exim has support for |
|
29267 +this way of working. It is enabled by setting the log_file_path option to a |
|
29268 +path that includes "%D" at the point where the datestamp is required. For |
|
29269 +example: |
|
29270 + |
|
29271 +log_file_path = /var/spool/exim/log/%slog-%D |
|
29272 +log_file_path = /var/log/exim-%s-%D.log |
|
29273 +log_file_path = /var/spool/exim/log/%D-%slog |
|
29274 + |
|
29275 +As before, "%s" is replaced by "main" or "reject"; the following are examples |
|
29276 +of names generated by the above examples: |
|
29277 + |
|
29278 +/var/spool/exim/log/mainlog-20021225 |
|
29279 +/var/log/exim-reject-20021225.log |
|
29280 +/var/spool/exim/log/20021225-mainlog |
|
29281 + |
|
29282 +When this form of log file is specified, Exim automatically switches to new |
|
29283 +files at midnight. It does not make any attempt to compress old logs; you will |
|
29284 +need to write your own script if you require this. You should not run exicyclog |
|
29285 +with this form of logging. |
|
29286 + |
|
29287 +The location of the panic log is also determined by log_file_path, but it is |
|
29288 +not datestamped, because rotation of the panic log does not make sense. When |
|
29289 +generating the name of the panic log, "%D" is removed from the string. In |
|
29290 +addition, if it immediately follows a slash, a following non-alphanumeric |
|
29291 +character is removed; otherwise a preceding non-alphanumeric character is |
|
29292 +removed. Thus, the three examples above would give these panic log names: |
|
29293 + |
|
29294 +/var/spool/exim/log/paniclog |
|
29295 +/var/log/exim-panic.log |
|
29296 +/var/spool/exim/log/paniclog |
|
29297 + |
|
29298 +49.4Â Logging to syslog |
|
29299 + |
|
29300 +The use of syslog does not change what Exim logs or the format of its messages, |
|
29301 +except in one respect. If syslog_timestamp is set false, the timestamps on |
|
29302 +Exim's log lines are omitted when these lines are sent to syslog. Apart from |
|
29303 +that, the same strings are written to syslog as to log files. The syslog |
|
29304 +"facility" is set to LOG_MAIL, and the program name to "exim" by default, but |
|
29305 +you can change these by setting the syslog_facility and syslog_processname |
|
29306 +options, respectively. If Exim was compiled with SYSLOG_LOG_PID set in Local/ |
|
29307 +Makefile (this is the default in src/EDITME), then, on systems that permit it |
|
29308 +(all except ULTRIX), the LOG_PID flag is set so that the syslog() call adds the |
|
29309 +pid as well as the time and host name to each line. The three log streams are |
|
29310 +mapped onto syslog priorities as follows: |
|
29311 + |
|
29312 + * mainlog is mapped to LOG_INFO |
|
29313 + |
|
29314 + * rejectlog is mapped to LOG_NOTICE |
|
29315 + |
|
29316 + * paniclog is mapped to LOG_ALERT |
|
29317 + |
|
29318 +Many log lines are written to both mainlog and rejectlog, and some are written |
|
29319 +to both mainlog and paniclog, so there will be duplicates if these are routed |
|
29320 +by syslog to the same place. You can suppress this duplication by setting |
|
29321 +syslog_duplication false. |
|
29322 + |
|
29323 +Exim's log lines can sometimes be very long, and some of its rejectlog entries |
|
29324 +contain multiple lines when headers are included. To cope with both these |
|
29325 +cases, entries written to syslog are split into separate syslog() calls at each |
|
29326 +internal newline, and also after a maximum of 870 data characters. (This allows |
|
29327 +for a total syslog line length of 1024, when additions such as timestamps are |
|
29328 +added.) If you are running a syslog replacement that can handle lines longer |
|
29329 +than the 1024 characters allowed by RFC 3164, you should set |
|
29330 + |
|
29331 +SYSLOG_LONG_LINES=yes |
|
29332 + |
|
29333 +in Local/Makefile before building Exim. That stops Exim from splitting long |
|
29334 +lines, but it still splits at internal newlines in reject log entries. |
|
29335 + |
|
29336 +To make it easy to re-assemble split lines later, each component of a split |
|
29337 +entry starts with a string of the form [<n>/<m>] or [<n>\<m>] where <n> is the |
|
29338 +component number and <m> is the total number of components in the entry. The / |
|
29339 +delimiter is used when the line was split because it was too long; if it was |
|
29340 +split because of an internal newline, the \ delimiter is used. For example, |
|
29341 +supposing the length limit to be 50 instead of 870, the following would be the |
|
29342 +result of a typical rejection message to mainlog (LOG_INFO), each line in |
|
29343 +addition being preceded by the time, host name, and pid as added by syslog: |
|
29344 + |
|
29345 +[1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from |
|
29346 +[2/5] [127.0.0.1] (ph10): syntax error in 'From' header |
|
29347 +[3/5] when scanning for sender: missing or malformed lo |
|
29348 +[4/5] cal part in "<>" (envelope sender is <ph10@cam.exa |
|
29349 +[5/5] mple>) |
|
29350 + |
|
29351 +The same error might cause the following lines to be written to "rejectlog" |
|
29352 +(LOG_NOTICE): |
|
29353 + |
|
29354 +[1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro |
|
29355 +[2/18] m [127.0.0.1] (ph10): syntax error in 'From' head |
|
29356 +[3/18] er when scanning for sender: missing or malformed |
|
29357 +[4/18] local part in "<>" (envelope sender is <ph10@cam |
|
29358 +[5\18] .example>) |
|
29359 +[6\18] Recipients: ph10@some.domain.cam.example |
|
29360 +[7\18] P Received: from [127.0.0.1] (ident=ph10) |
|
29361 +[8\18] by xxxxx.cam.example with smtp (Exim 4.00) |
|
29362 +[9\18] id 16RdAL-0006pc-00 |
|
29363 +[10/18] for ph10@cam.example; Mon, 16 Sep 2002 16: |
|
29364 +[11\18] 09:43 +0100 |
|
29365 +[12\18] F From: <> |
|
29366 +[13\18] Subject: this is a test header |
|
29367 +[18\18] X-something: this is another header |
|
29368 +[15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp |
|
29369 +[16\18] le> |
|
29370 +[17\18] B Bcc: |
|
29371 +[18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100 |
|
29372 + |
|
29373 +Log lines that are neither too long nor contain newlines are written to syslog |
|
29374 +without modification. |
|
29375 + |
|
29376 +If only syslog is being used, the Exim monitor is unable to provide a log tail |
|
29377 +display, unless syslog is routing mainlog to a file on the local host and the |
|
29378 +environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor where it |
|
29379 +is. |
|
29380 + |
|
29381 +49.5Â Log line flags |
|
29382 + |
|
29383 +One line is written to the main log for each message received, and for each |
|
29384 +successful, unsuccessful, and delayed delivery. These lines can readily be |
|
29385 +picked out by the distinctive two-character flags that immediately follow the |
|
29386 +timestamp. The flags are: |
|
29387 + |
|
29388 +<=     message arrival |
|
29389 +=>     normal message delivery |
|
29390 +->     additional address in same delivery |
|
29391 +*>     delivery suppressed by -N |
|
29392 +**     delivery failed; address bounced |
|
29393 +==     delivery deferred; temporary problem |
|
29394 + |
|
29395 +49.6Â Logging message reception |
|
29396 + |
|
29397 +The format of the single-line entry in the main log that is written for every |
|
29398 +message received is shown in the basic example below, which is split over |
|
29399 +several lines in order to fit it on the page: |
|
29400 + |
|
29401 +2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example |
|
29402 + H=mailer.fict.example [192.168.123.123] U=exim |
|
29403 + P=smtp S=5678 id=<incoming message id> |
|
29404 + |
|
29405 +The address immediately following "<=" is the envelope sender address. A bounce |
|
29406 +message is shown with the sender address "<>", and if it is locally generated, |
|
29407 +this is followed by an item of the form |
|
29408 + |
|
29409 +R=<message id> |
|
29410 + |
|
29411 +which is a reference to the message that caused the bounce to be sent. |
|
29412 + |
|
29413 +For messages from other hosts, the H and U fields identify the remote host and |
|
29414 +record the RFC 1413 identity of the user that sent the message, if one was |
|
29415 +received. The number given in square brackets is the IP address of the sending |
|
29416 +host. If there is a single, unparenthesized host name in the H field, as above, |
|
29417 +it has been verified to correspond to the IP address (see the host_lookup |
|
29418 +option). If the name is in parentheses, it was the name quoted by the remote |
|
29419 +host in the SMTP HELO or EHLO command, and has not been verified. If |
|
29420 +verification yields a different name to that given for HELO or EHLO, the |
|
29421 +verified name appears first, followed by the HELO or EHLO name in parentheses. |
|
29422 + |
|
29423 +Misconfigured hosts (and mail forgers) sometimes put an IP address, with or |
|
29424 +without brackets, in the HELO or EHLO command, leading to entries in the log |
|
29425 +containing text like these examples: |
|
29426 + |
|
29427 +H=(10.21.32.43) [192.168.8.34] |
|
29428 +H=([10.21.32.43]) [192.168.8.34] |
|
29429 + |
|
29430 +This can be confusing. Only the final address in square brackets can be relied |
|
29431 +on. |
|
29432 + |
|
29433 +For locally generated messages (that is, messages not received over TCP/IP), |
|
29434 +the H field is omitted, and the U field contains the login name of the caller |
|
29435 +of Exim. |
|
29436 + |
|
29437 +For all messages, the P field specifies the protocol used to receive the |
|
29438 +message. This is the value that is stored in $received_protocol. In the case of |
|
29439 +incoming SMTP messages, the value indicates whether or not any SMTP extensions |
|
29440 +(ESMTP), encryption, or authentication were used. If the SMTP session was |
|
29441 +encrypted, there is an additional X field that records the cipher suite that |
|
29442 +was used. |
|
29443 + |
|
29444 +The protocol is set to "esmtpsa" or "esmtpa" for messages received from hosts |
|
29445 +that have authenticated themselves using the SMTP AUTH command. The first value |
|
29446 +is used when the SMTP connection was encrypted ("secure"). In this case there |
|
29447 +is an additional item A= followed by the name of the authenticator that was |
|
29448 +used. If an authenticated identification was set up by the authenticator's |
|
29449 +server_set_id option, this is logged too, separated by a colon from the |
|
29450 +authenticator name. |
|
29451 + |
|
29452 +The id field records the existing message id, if present. The size of the |
|
29453 +received message is given by the S field. When the message is delivered, |
|
29454 +headers may be removed or added, so that the size of delivered copies of the |
|
29455 +message may not correspond with this value (and indeed may be different to each |
|
29456 +other). |
|
29457 + |
|
29458 +The log_selector option can be used to request the logging of additional data |
|
29459 +when a message is received. See section 49.15 below. |
|
29460 + |
|
29461 +49.7Â Logging deliveries |
|
29462 + |
|
29463 +The format of the single-line entry in the main log that is written for every |
|
29464 +delivery is shown in one of the examples below, for local and remote |
|
29465 +deliveries, respectively. Each example has been split into two lines in order |
|
29466 +to fit it on the page: |
|
29467 + |
|
29468 +2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv |
|
29469 + <marv@hitch.fict.example> R=localuser T=local_delivery |
|
29470 +2002-10-31 09:00:10 16ZCW1-0005MB-00 => |
|
29471 + monk@holistic.fict.example R=dnslookup T=remote_smtp |
|
29472 + H=holistic.fict.example [192.168.234.234] |
|
29473 + |
|
29474 +For ordinary local deliveries, the original address is given in angle brackets |
|
29475 +after the final delivery address, which might be a pipe or a file. If |
|
29476 +intermediate address(es) exist between the original and the final address, the |
|
29477 +last of these is given in parentheses after the final address. The R and T |
|
29478 +fields record the router and transport that were used to process the address. |
|
29479 + |
|
29480 +If a shadow transport was run after a successful local delivery, the log line |
|
29481 +for the successful delivery has an item added on the end, of the form |
|
29482 + |
|
29483 +ST=<shadow transport name> |
|
29484 + |
|
29485 +If the shadow transport did not succeed, the error message is put in |
|
29486 +parentheses afterwards. |
|
29487 + |
|
29488 +When more than one address is included in a single delivery (for example, two |
|
29489 +SMTP RCPT commands in one transaction) the second and subsequent addresses are |
|
29490 +flagged with "->" instead of "=>". When two or more messages are delivered down |
|
29491 +a single SMTP connection, an asterisk follows the IP address in the log lines |
|
29492 +for the second and subsequent messages. |
|
29493 + |
|
29494 +The generation of a reply message by a filter file gets logged as a "delivery" |
|
29495 +to the addressee, preceded by ">". |
|
29496 + |
|
29497 +The log_selector option can be used to request the logging of additional data |
|
29498 +when a message is delivered. See section 49.15 below. |
|
29499 + |
|
29500 +49.8Â Discarded deliveries |
|
29501 + |
|
29502 +When a message is discarded as a result of the command "seen finish" being |
|
29503 +obeyed in a filter file which generates no deliveries, a log entry of the form |
|
29504 + |
|
29505 +2002-12-10 00:50:49 16auJc-0001UB-00 => discarded |
|
29506 + <low.club@bridge.example> R=userforward |
|
29507 + |
|
29508 +is written, to record why no deliveries are logged. When a message is discarded |
|
29509 +because it is aliased to ":blackhole:" the log line is like this: |
|
29510 + |
|
29511 +1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole: |
|
29512 + <hole@nowhere.example> R=blackhole_router |
|
29513 + |
|
29514 +49.9Â Deferred deliveries |
|
29515 + |
|
29516 +When a delivery is deferred, a line of the following form is logged: |
|
29517 + |
|
29518 +2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example |
|
29519 + R=dnslookup T=smtp defer (146): Connection refused |
|
29520 + |
|
29521 +In the case of remote deliveries, the error is the one that was given for the |
|
29522 +last IP address that was tried. Details of individual SMTP failures are also |
|
29523 +written to the log, so the above line would be preceded by something like |
|
29524 + |
|
29525 +2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to |
|
29526 + mail1.endrest.example [192.168.239.239]: Connection refused |
|
29527 + |
|
29528 +When a deferred address is skipped because its retry time has not been reached, |
|
29529 +a message is written to the log, but this can be suppressed by setting an |
|
29530 +appropriate value in log_selector. |
|
29531 + |
|
29532 +49.10Â Delivery failures |
|
29533 + |
|
29534 +If a delivery fails because an address cannot be routed, a line of the |
|
29535 +following form is logged: |
|
29536 + |
|
29537 +1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example |
|
29538 + <jim@trek99.example>: unknown mail domain |
|
29539 + |
|
29540 +If a delivery fails at transport time, the router and transport are shown, and |
|
29541 +the response from the remote host is included, as in this example: |
|
29542 + |
|
29543 +2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example |
|
29544 + R=dnslookup T=remote_smtp: SMTP error from remote mailer |
|
29545 + after pipelined RCPT TO:<ace400@pb.example>: host |
|
29546 + pbmail3.py.example [192.168.63.111]: 553 5.3.0 |
|
29547 + <ace400@pb.example>...Addressee unknown |
|
29548 + |
|
29549 +The word "pipelined" indicates that the SMTP PIPELINING extension was being |
|
29550 +used. See hosts_avoid_esmtp in the smtp transport for a way of disabling |
|
29551 +PIPELINING. The log lines for all forms of delivery failure are flagged with |
|
29552 +"**". |
|
29553 + |
|
29554 +49.11Â Fake deliveries |
|
29555 + |
|
29556 +If a delivery does not actually take place because the -N option has been used |
|
29557 +to suppress it, a normal delivery line is written to the log, except that "=>" |
|
29558 +is replaced by "*>". |
|
29559 + |
|
29560 +49.12Â Completion |
|
29561 + |
|
29562 +A line of the form |
|
29563 + |
|
29564 +2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed |
|
29565 + |
|
29566 +is written to the main log when a message is about to be removed from the spool |
|
29567 +at the end of its processing. |
|
29568 + |
|
29569 +49.13Â Summary of Fields in Log Lines |
|
29570 + |
|
29571 +A summary of the field identifiers that are used in log lines is shown in the |
|
29572 +following table: |
|
29573 + |
|
29574 +A           authenticator name (and optional id) |
|
29575 +C           SMTP confirmation on delivery |
|
29576 +            command list for "no mail in SMTP session" |
|
29577 +CV          certificate verification status |
|
29578 +D           duration of "no mail in SMTP session" |
|
29579 +DN          distinguished name from peer certificate |
|
29580 +DT          on => lines: time taken for a delivery |
|
29581 +F           sender address (on delivery lines) |
|
29582 +H           host name and IP address |
|
29583 +I           local interface used |
|
29584 +id          message id for incoming message |
|
29585 +P           on <= lines: protocol used |
|
29586 +            on => and ** lines: return path |
|
29587 +QT          on => lines: time spent on queue so far |
|
29588 +            on "Completed" lines: time spent on queue |
|
29589 +R           on <= lines: reference for local bounce |
|
29590 +            on =>  ** and == lines: router name |
|
29591 +S           size of message |
|
29592 +ST          shadow transport name |
|
29593 +T           on <= lines: message subject (topic) |
|
29594 +            on => ** and == lines: transport name |
|
29595 +U           local user or RFC 1413 identity |
|
29596 +X           TLS cipher suite |
|
29597 + |
|
29598 +49.14Â Other log entries |
|
29599 + |
|
29600 +Various other types of log entry are written from time to time. Most should be |
|
29601 +self-explanatory. Among the more common are: |
|
29602 + |
|
29603 + * retry time not reached  An address previously suffered a temporary error |
|
29604 + during routing or local delivery, and the time to retry has not yet |
|
29605 + arrived. This message is not written to an individual message log file |
|
29606 + unless it happens during the first delivery attempt. |
|
29607 + |
|
29608 + * retry time not reached for any host  An address previously suffered |
|
29609 + temporary errors during remote delivery, and the retry time has not yet |
|
29610 + arrived for any of the hosts to which it is routed. |
|
29611 + |
|
29612 + * spool file locked  An attempt to deliver a message cannot proceed because |
|
29613 + some other Exim process is already working on the message. This can be |
|
29614 + quite common if queue running processes are started at frequent intervals. |
|
29615 + The exiwhat utility script can be used to find out what Exim processes are |
|
29616 + doing. |
|
29617 + |
|
29618 + * error ignored  There are several circumstances that give rise to this |
|
29619 + message: |
|
29620 + |
|
29621 + 1. Exim failed to deliver a bounce message whose age was greater than |
|
29622 + ignore_bounce_errors_after. The bounce was discarded. |
|
29623 + |
|
29624 + 2. A filter file set up a delivery using the "noerror" option, and the |
|
29625 + delivery failed. The delivery was discarded. |
|
29626 + |
|
29627 + 3. A delivery set up by a router configured with |
|
29628 + |
|
29629 + errors_to = <> |
|
29630 + |
|
29631 + failed. The delivery was discarded. |
|
29632 + |
|
29633 +49.15Â Reducing or increasing what is logged |
|
29634 + |
|
29635 +By setting the log_selector global option, you can disable some of Exim's |
|
29636 +default logging, or you can request additional logging. The value of |
|
29637 +log_selector is made up of names preceded by plus or minus characters. For |
|
29638 +example: |
|
29639 + |
|
29640 +log_selector = +arguments -retry_defer |
|
29641 + |
|
29642 +The list of optional log items is in the following table, with the default |
|
29643 +selection marked by asterisks: |
|
29644 + |
|
29645 +*acl_warn_skipped             skipped warn statement in ACL |
|
29646 + address_rewrite              address rewriting |
|
29647 + all_parents                  all parents in => lines |
|
29648 + arguments                    command line arguments |
|
29649 +*connection_reject            connection rejections |
|
29650 +*delay_delivery               immediate delivery delayed |
|
29651 + deliver_time                 time taken to perform delivery |
|
29652 + delivery_size                add S=nnn to => lines |
|
29653 +*dnslist_defer                defers of DNS list (aka RBL) |
|
29654 +Â lookups |
|
29655 +*etrn                         ETRN commands |
|
29656 +*host_lookup_failed           as it says |
|
29657 + ident_timeout                timeout for ident connection |
|
29658 + incoming_interface           incoming interface on <= lines |
|
29659 + incoming_port                incoming port on <= lines |
|
29660 +*lost_incoming_connection     as it says (includes timeouts) |
|
29661 + outgoing_port                add remote port to => lines |
|
29662 +*queue_run                    start and end queue runs |
|
29663 + queue_time                   time on queue for one recipient |
|
29664 + queue_time_overall           time on queue for whole message |
|
29665 + pid                          Exim process id |
|
29666 + received_recipients          recipients on <= lines |
|
29667 + received_sender              sender on <= lines |
|
29668 +*rejected_header              header contents on reject log |
|
29669 +*retry_defer                  "retry time not reached" |
|
29670 + return_path_on_delivery      put return path on => and ** lines |
|
29671 + sender_on_delivery           add sender to => lines |
|
29672 +*sender_verify_fail           sender verification failures |
|
29673 +*size_reject                  rejection because too big |
|
29674 +*skip_delivery                delivery skipped in a queue run |
|
29675 + smtp_confirmation            SMTP confirmation on => lines |
|
29676 + smtp_connection              SMTP connections |
|
29677 + smtp_incomplete_transaction  incomplete SMTP transactions |
|
29678 + smtp_no_mail                 session with no MAIL commands |
|
29679 + smtp_protocol_error          SMTP protocol errors |
|
29680 + smtp_syntax_error            SMTP syntax errors |
|
29681 + subject                      contents of Subject: |
|
29682 + on <= lines |
|
29683 + tls_certificate_verified     certificate verification status |
|
29684 +*tls_cipher                   TLS cipher suite on <= |
|
29685 + and => lines |
|
29686 + tls_peerdn                   TLS peer DN on <= and |
|
29687 +=>Â lines |
|
29688 + unknown_in_list              DNS lookup failed in list match |
|
29689 + |
|
29690 + all                          all of the above |
|
29691 + |
|
29692 +More details on each of these items follows: |
|
29693 + |
|
29694 + * acl_warn_skipped: When an ACL warn statement is skipped because one of its |
|
29695 + conditions cannot be evaluated, a log line to this effect is written if |
|
29696 + this log selector is set. |
|
29697 + |
|
29698 + * address_rewrite: This applies both to global rewrites and per-transport |
|
29699 + rewrites, but not to rewrites in filters run as an unprivileged user |
|
29700 + (because such users cannot access the log). |
|
29701 + |
|
29702 + * all_parents: Normally only the original and final addresses are logged on |
|
29703 + delivery lines; with this selector, intermediate parents are given in |
|
29704 + parentheses between them. |
|
29705 + |
|
29706 + * arguments: This causes Exim to write the arguments with which it was called |
|
29707 + to the main log, preceded by the current working directory. This is a |
|
29708 + debugging feature, added to make it easier to find out how certain MUAs |
|
29709 + call /usr/sbin/sendmail. The logging does not happen if Exim has given up |
|
29710 + root privilege because it was called with the -C or -D options. Arguments |
|
29711 + that are empty or that contain white space are quoted. Non-printing |
|
29712 + characters are shown as escape sequences. This facility cannot log |
|
29713 + unrecognized arguments, because the arguments are checked before the |
|
29714 + configuration file is read. The only way to log such cases is to interpose |
|
29715 + a script such as util/logargs.sh between the caller and Exim. |
|
29716 + |
|
29717 + * connection_reject: A log entry is written whenever an incoming SMTP |
|
29718 + connection is rejected, for whatever reason. |
|
29719 + |
|
29720 + * delay_delivery: A log entry is written whenever a delivery process is not |
|
29721 + started for an incoming message because the load is too high or too many |
|
29722 + messages were received on one connection. Logging does not occur if no |
|
29723 + delivery process is started because queue_only is set or -odq was used. |
|
29724 + |
|
29725 + * deliver_time: For each delivery, the amount of real time it has taken to |
|
29726 + perform the actual delivery is logged as DT=<time>, for example, "DT=1s". |
|
29727 + |
|
29728 + * delivery_size: For each delivery, the size of message delivered is added to |
|
29729 + the "=>" line, tagged with S=. |
|
29730 + |
|
29731 + * dnslist_defer: A log entry is written if an attempt to look up a host in a |
|
29732 + DNS black list suffers a temporary error. |
|
29733 + |
|
29734 + * etrn: Every valid ETRN command that is received is logged, before the ACL |
|
29735 + is run to determine whether or not it is actually accepted. An invalid ETRN |
|
29736 + command, or one received within a message transaction is not logged by this |
|
29737 + selector (see smtp_syntax_error and smtp_protocol_error). |
|
29738 + |
|
29739 + * host_lookup_failed: When a lookup of a host's IP addresses fails to find |
|
29740 + any addresses, or when a lookup of an IP address fails to find a host name, |
|
29741 + a log line is written. This logging does not apply to direct DNS lookups |
|
29742 + when routing email addresses, but it does apply to "byname" lookups. |
|
29743 + |
|
29744 + * ident_timeout: A log line is written whenever an attempt to connect to a |
|
29745 + client's ident port times out. |
|
29746 + |
|
29747 + * incoming_interface: The interface on which a message was received is added |
|
29748 + to the "<=" line as an IP address in square brackets, tagged by I= and |
|
29749 + followed by a colon and the port number. The local interface and port are |
|
29750 + also added to other SMTP log lines, for example "SMTP connection from", and |
|
29751 + to rejection lines. |
|
29752 + |
|
29753 + * incoming_port: The remote port number from which a message was received is |
|
29754 + added to log entries and Received: header lines, following the IP address |
|
29755 + in square brackets, and separated from it by a colon. This is implemented |
|
29756 + by changing the value that is put in the $sender_fullhost and |
|
29757 + $sender_rcvhost variables. Recording the remote port number has become more |
|
29758 + important with the widening use of NAT (see RFC 2505). |
|
29759 + |
|
29760 + * lost_incoming_connection: A log line is written when an incoming SMTP |
|
29761 + connection is unexpectedly dropped. |
|
29762 + |
|
29763 + * outgoing_port: The remote port number is added to delivery log lines (those |
|
29764 + containing => tags) following the IP address. This option is not included |
|
29765 + in the default setting, because for most ordinary configurations, the |
|
29766 + remote port number is always 25 (the SMTP port). |
|
29767 + |
|
29768 + * pid: The current process id is added to every log line, in square brackets, |
|
29769 + immediately after the time and date. |
|
29770 + |
|
29771 + * queue_run: The start and end of every queue run are logged. |
|
29772 + |
|
29773 + * queue_time: The amount of time the message has been in the queue on the |
|
29774 + local host is logged as QT=<time> on delivery ("=>") lines, for example, |
|
29775 + "QT=3m45s". The clock starts when Exim starts to receive the message, so it |
|
29776 + includes reception time as well as the delivery time for the current |
|
29777 + address. This means that it may be longer than the difference between the |
|
29778 + arrival and delivery log line times, because the arrival log line is not |
|
29779 + written until the message has been successfully received. |
|
29780 + |
|
29781 + * queue_time_overall: The amount of time the message has been in the queue on |
|
29782 + the local host is logged as QT=<time> on "Completed" lines, for example, |
|
29783 + "QT=3m45s". The clock starts when Exim starts to receive the message, so it |
|
29784 + includes reception time as well as the total delivery time. |
|
29785 + |
|
29786 + * received_recipients: The recipients of a message are listed in the main log |
|
29787 + as soon as the message is received. The list appears at the end of the log |
|
29788 + line that is written when a message is received, preceded by the word |
|
29789 + "for". The addresses are listed after they have been qualified, but before |
|
29790 + any rewriting has taken place. Recipients that were discarded by an ACL for |
|
29791 + MAIL or RCPT do not appear in the list. |
|
29792 + |
|
29793 + * received_sender: The unrewritten original sender of a message is added to |
|
29794 + the end of the log line that records the message's arrival, after the word |
|
29795 + "from" (before the recipients if received_recipients is also set). |
|
29796 + |
|
29797 + * rejected_header: If a message's header has been received at the time a |
|
29798 + rejection is written to the reject log, the complete header is added to the |
|
29799 + log. Header logging can be turned off individually for messages that are |
|
29800 + rejected by the local_scan() function (see section 42.2). |
|
29801 + |
|
29802 + * retry_defer: A log line is written if a delivery is deferred because a |
|
29803 + retry time has not yet been reached. However, this "retry time not reached" |
|
29804 + message is always omitted from individual message logs after the first |
|
29805 + delivery attempt. |
|
29806 + |
|
29807 + * return_path_on_delivery: The return path that is being transmitted with the |
|
29808 + message is included in delivery and bounce lines, using the tag P=. This is |
|
29809 + omitted if no delivery actually happens, for example, if routing fails, or |
|
29810 + if delivery is to /dev/null or to ":blackhole:". |
|
29811 + |
|
29812 + * sender_on_delivery: The message's sender address is added to every delivery |
|
29813 + and bounce line, tagged by F= (for "from"). This is the original sender |
|
29814 + that was received with the message; it is not necessarily the same as the |
|
29815 + outgoing return path. |
|
29816 + |
|
29817 + * sender_verify_fail: If this selector is unset, the separate log line that |
|
29818 + gives details of a sender verification failure is not written. Log lines |
|
29819 + for the rejection of SMTP commands contain just "sender verify failed", so |
|
29820 + some detail is lost. |
|
29821 + |
|
29822 + * size_reject: A log line is written whenever a message is rejected because |
|
29823 + it is too big. |
|
29824 + |
|
29825 + * skip_delivery: A log line is written whenever a message is skipped during a |
|
29826 + queue run because it is frozen or because another process is already |
|
29827 + delivering it. The message that is written is "spool file is locked". |
|
29828 + |
|
29829 + * smtp_confirmation: The response to the final "." in the SMTP dialogue for |
|
29830 + outgoing messages is added to delivery log lines in the form "C="<text>. A |
|
29831 + number of MTAs (including Exim) return an identifying string in this |
|
29832 + response. |
|
29833 + |
|
29834 + * smtp_connection: A log line is written whenever an SMTP connection is |
|
29835 + established or closed, unless the connection is from a host that matches |
|
29836 + hosts_connection_nolog. (In contrast, lost_incoming_connection applies only |
|
29837 + when the closure is unexpected.) This applies to connections from local |
|
29838 + processes that use -bs as well as to TCP/IP connections. If a connection is |
|
29839 + dropped in the middle of a message, a log line is always written, whether |
|
29840 + or not this selector is set, but otherwise nothing is written at the start |
|
29841 + and end of connections unless this selector is enabled. |
|
29842 + |
|
29843 + For TCP/IP connections to an Exim daemon, the current number of connections |
|
29844 + is included in the log message for each new connection, but note that the |
|
29845 + count is reset if the daemon is restarted. Also, because connections are |
|
29846 + closed (and the closure is logged) in subprocesses, the count may not |
|
29847 + include connections that have been closed but whose termination the daemon |
|
29848 + has not yet noticed. Thus, while it is possible to match up the opening and |
|
29849 + closing of connections in the log, the value of the logged counts may not |
|
29850 + be entirely accurate. |
|
29851 + |
|
29852 + * smtp_incomplete_transaction: When a mail transaction is aborted by RSET, |
|
29853 + QUIT, loss of connection, or otherwise, the incident is logged, and the |
|
29854 + message sender plus any accepted recipients are included in the log line. |
|
29855 + This can provide evidence of dictionary attacks. |
|
29856 + |
|
29857 + * smtp_no_mail: A line is written to the main log whenever an accepted SMTP |
|
29858 + connection terminates without having issued a MAIL command. This includes |
|
29859 + both the case when the connection is dropped, and the case when QUIT is |
|
29860 + used. It does not include cases where the connection is rejected right at |
|
29861 + the start (by an ACL, or because there are too many connections, or |
|
29862 + whatever). These cases already have their own log lines. |
|
29863 + |
|
29864 + The log line that is written contains the identity of the client in the |
|
29865 + usual way, followed by D= and a time, which records the duration of the |
|
29866 + connection. If the connection was authenticated, this fact is logged |
|
29867 + exactly as it is for an incoming message, with an A= item. If the |
|
29868 + connection was encrypted, CV=, DN=, and X= items may appear as they do for |
|
29869 + an incoming message, controlled by the same logging options. |
|
29870 + |
|
29871 + Finally, if any SMTP commands were issued during the connection, a C= item |
|
29872 + is added to the line, listing the commands that were used. For example, |
|
29873 + |
|
29874 + C=EHLO,QUIT |
|
29875 + |
|
29876 + shows that the client issued QUIT straight after EHLO. If there were fewer |
|
29877 + than 20 commands, they are all listed. If there were more than 20 commands, |
|
29878 + the last 20 are listed, preceded by "...". However, with the default |
|
29879 + setting of 10 for smtp_accep_max_nonmail, the connection will in any case |
|
29880 + have been aborted before 20 non-mail commands are processed. |
|
29881 + |
|
29882 + * smtp_protocol_error: A log line is written for every SMTP protocol error |
|
29883 + encountered. Exim does not have perfect detection of all protocol errors |
|
29884 + because of transmission delays and the use of pipelining. If PIPELINING has |
|
29885 + been advertised to a client, an Exim server assumes that the client will |
|
29886 + use it, and therefore it does not count "expected" errors (for example, |
|
29887 + RCPT received after rejecting MAIL) as protocol errors. |
|
29888 + |
|
29889 + * smtp_syntax_error: A log line is written for every SMTP syntax error |
|
29890 + encountered. An unrecognized command is treated as a syntax error. For an |
|
29891 + external connection, the host identity is given; for an internal connection |
|
29892 + using -bs the sender identification (normally the calling user) is given. |
|
29893 + |
|
29894 + * subject: The subject of the message is added to the arrival log line, |
|
29895 + preceded by "T=" (T for "topic", since S is already used for "size"). Any |
|
29896 + MIME "words" in the subject are decoded. The print_topbitchars option |
|
29897 + specifies whether characters with values greater than 127 should be logged |
|
29898 + unchanged, or whether they should be rendered as escape sequences. |
|
29899 + |
|
29900 + * tls_certificate_verified: An extra item is added to <= and => log lines |
|
29901 + when TLS is in use. The item is "CV=yes" if the peer's certificate was |
|
29902 + verified, and "CV=no" if not. |
|
29903 + |
|
29904 + * tls_cipher: When a message is sent or received over an encrypted |
|
29905 + connection, the cipher suite used is added to the log line, preceded by X=. |
|
29906 + |
|
29907 + * tls_peerdn: When a message is sent or received over an encrypted |
|
29908 + connection, and a certificate is supplied by the remote host, the peer DN |
|
29909 + is added to the log line, preceded by DN=. |
|
29910 + |
|
29911 + * unknown_in_list: This setting causes a log entry to be written when the |
|
29912 + result of a list match is failure because a DNS lookup failed. |
|
29913 + |
|
29914 +49.16Â Message log |
|
29915 + |
|
29916 +In addition to the general log files, Exim writes a log file for each message |
|
29917 +that it handles. The names of these per-message logs are the message ids, and |
|
29918 +they are kept in the msglog sub-directory of the spool directory. Each message |
|
29919 +log contains copies of the log lines that apply to the message. This makes it |
|
29920 +easier to inspect the status of an individual message without having to search |
|
29921 +the main log. A message log is deleted when processing of the message is |
|
29922 +complete, unless preserve_message_logs is set, but this should be used only |
|
29923 +with great care because they can fill up your disk very quickly. |
|
29924 + |
|
29925 +On a heavily loaded system, it may be desirable to disable the use of |
|
29926 +per-message logs, in order to reduce disk I/O. This can be done by setting the |
|
29927 +message_logs option false. |
|
29928 + |
|
29929 +50. Exim utilities |
|
29930 + |
|
29931 +A number of utility scripts and programs are supplied with Exim and are |
|
29932 +described in this chapter. There is also the Exim Monitor, which is covered in |
|
29933 +the next chapter. The utilities described here are: |
|
29934 + |
|
29935 +Â Â Â Â 50.1 exiwhat list what Exim processes are doing |
|
29936 +Â Â Â Â 50.2 exiqgrep grep the queue |
|
29937 +Â Â Â Â 50.3 exiqsumm summarize the queue |
|
29938 +Â Â Â Â 50.4 exigrep search the main log |
|
29939 +Â Â Â Â 50.5 exipick select messages on various criteria |
|
29940 +Â Â Â Â 50.6 exicyclog cycle (rotate) log files |
|
29941 +Â Â Â Â 50.7 eximstats extract statistics from the log |
|
29942 +Â Â Â Â 50.8 exim_checkaccess check address acceptance from given IP |
|
29943 +Â Â Â Â 50.9 exim_dbmbuild build a DBM file |
|
29944 +Â Â Â Â 50.10 exinext extract retry information |
|
29945 +Â Â Â Â 50.11 exim_dumpdb dump a hints database |
|
29946 +Â Â Â Â 50.11 exim_tidydb clean up a hints database |
|
29947 +Â Â Â Â 50.11 exim_fixdb patch a hints database |
|
29948 +Â Â Â Â 50.15 exim_lock lock a mailbox file |
|
29949 + |
|
29950 +Another utility that might be of use to sites with many MTAs is Tom Kistner's |
|
29951 +exilog. It provides log visualizations across multiple Exim servers. See http:/ |
|
29952 +/duncanthrax.net/exilog/ for details. |
|
29953 + |
|
29954 +50.1Â Finding out what Exim processes are doing (exiwhat) |
|
29955 + |
|
29956 +On operating systems that can restart a system call after receiving a signal |
|
29957 +(most modern OS), an Exim process responds to the SIGUSR1 signal by writing a |
|
29958 +line describing what it is doing to the file exim-process.info in the Exim |
|
29959 +spool directory. The exiwhat script sends the signal to all Exim processes it |
|
29960 +can find, having first emptied the file. It then waits for one second to allow |
|
29961 +the Exim processes to react before displaying the results. In order to run |
|
29962 +exiwhat successfully you have to have sufficient privilege to send the signal |
|
29963 +to the Exim processes, so it is normally run as root. |
|
29964 + |
|
29965 +Warning: This is not an efficient process. It is intended for occasional use by |
|
29966 +system administrators. It is not sensible, for example, to set up a script that |
|
29967 +sends SIGUSR1 signals to Exim processes at short intervals. |
|
29968 + |
|
29969 +Unfortunately, the ps command that exiwhat uses to find Exim processes varies |
|
29970 +in different operating systems. Not only are different options used, but the |
|
29971 +format of the output is different. For this reason, there are some system |
|
29972 +configuration options that configure exactly how exiwhat works. If it doesn't |
|
29973 +seem to be working for you, check the following compile-time options: |
|
29974 + |
|
29975 +EXIWHAT_PS_CMD     the command for running ps |
|
29976 +EXIWHAT_PS_ARG     the argument for ps |
|
29977 +EXIWHAT_EGREP_ARG  the argument for egrep to select from ps output |
|
29978 +EXIWHAT_KILL_ARG   the argument for the kill command |
|
29979 + |
|
29980 +An example of typical output from exiwhat is |
|
29981 + |
|
29982 +164 daemon: -q1h, listening on port 25 |
|
29983 +10483 running queue: waiting for 0tAycK-0002ij-00 (10492) |
|
29984 +10492 delivering 0tAycK-0002ij-00 to mail.ref.example |
|
29985 + [10.19.42.42] (editor@ref.example) |
|
29986 +10592 handling incoming call from [192.168.243.242] |
|
29987 +10628 accepting a local non-SMTP message |
|
29988 + |
|
29989 +The first number in the output line is the process number. The third line has |
|
29990 +been split here, in order to fit it on the page. |
|
29991 + |
|
29992 +50.2Â Selective queue listing (exiqgrep) |
|
29993 + |
|
29994 +This utility is a Perl script contributed by Matt Hubbard. It runs |
|
29995 + |
|
29996 +exim -bpu |
|
29997 + |
|
29998 +to obtain a queue listing with undelivered recipients only, and then greps the |
|
29999 +output to select messages that match given criteria. The following selection |
|
30000 +options are available: |
|
30001 + |
|
30002 +-f <regex> |
|
30003 + |
|
30004 + Match the sender address. The field that is tested is enclosed in angle |
|
30005 + brackets, so you can test for bounce messages with |
|
30006 + |
|
30007 + exiqgrep -f '^<>$' |
|
30008 + |
|
30009 +-r <regex> |
|
30010 + |
|
30011 + Match a recipient address. The field that is tested is not enclosed in |
|
30012 + angle brackets. |
|
30013 + |
|
30014 +-s <regex> |
|
30015 + |
|
30016 + Match against the size field. |
|
30017 + |
|
30018 +-y <seconds> |
|
30019 + |
|
30020 + Match messages that are younger than the given time. |
|
30021 + |
|
30022 +-o <seconds> |
|
30023 + |
|
30024 + Match messages that are older than the given time. |
|
30025 + |
|
30026 +-z |
|
30027 + |
|
30028 + Match only frozen messages. |
|
30029 + |
|
30030 +-x |
|
30031 + |
|
30032 + Match only non-frozen messages. |
|
30033 + |
|
30034 +The following options control the format of the output: |
|
30035 + |
|
30036 +-c |
|
30037 + |
|
30038 + Display only the count of matching messages. |
|
30039 + |
|
30040 +-l |
|
30041 + |
|
30042 + Long format - display the full message information as output by Exim. This |
|
30043 + is the default. |
|
30044 + |
|
30045 +-i |
|
30046 + |
|
30047 + Display message ids only. |
|
30048 + |
|
30049 +-b |
|
30050 + |
|
30051 + Brief format - one line per message. |
|
30052 + |
|
30053 +-R |
|
30054 + |
|
30055 + Display messages in reverse order. |
|
30056 + |
|
30057 +There is one more option, -h, which outputs a list of options. |
|
30058 + |
|
30059 +50.3Â Summarizing the queue (exiqsumm) |
|
30060 + |
|
30061 +The exiqsumm utility is a Perl script which reads the output of "exim -bp" and |
|
30062 +produces a summary of the messages on the queue. Thus, you use it by running a |
|
30063 +command such as |
|
30064 + |
|
30065 +exim -bp | exiqsumm |
|
30066 + |
|
30067 +The output consists of one line for each domain that has messages waiting for |
|
30068 +it, as in the following example: |
|
30069 + |
|
30070 +3 2322 74m 66m msn.com.example |
|
30071 + |
|
30072 +Each line lists the number of pending deliveries for a domain, their total |
|
30073 +volume, and the length of time that the oldest and the newest messages have |
|
30074 +been waiting. Note that the number of pending deliveries is greater than the |
|
30075 +number of messages when messages have more than one recipient. |
|
30076 + |
|
30077 +A summary line is output at the end. By default the output is sorted on the |
|
30078 +domain name, but exiqsumm has the options -a and -c, which cause the output to |
|
30079 +be sorted by oldest message and by count of messages, respectively. There are |
|
30080 +also three options that split the messages for each domain into two or more |
|
30081 +subcounts: -b separates bounce messages, -f separates frozen messages, and -s |
|
30082 +separates messages according to their sender. |
|
30083 + |
|
30084 +The output of exim -bp contains the original addresses in the message, so this |
|
30085 +also applies to the output from exiqsumm. No domains from addresses generated |
|
30086 +by aliasing or forwarding are included (unless the one_time option of the |
|
30087 +redirect router has been used to convert them into "top level" addresses). |
|
30088 + |
|
30089 +50.4Â Extracting specific information from the log (exigrep) |
|
30090 + |
|
30091 +The exigrep utility is a Perl script that searches one or more main log files |
|
30092 +for entries that match a given pattern. When it finds a match, it extracts all |
|
30093 +the log entries for the relevant message, not just those that match the |
|
30094 +pattern. Thus, exigrep can extract complete log entries for a given message, or |
|
30095 +all mail for a given user, or for a given host, for example. The input files |
|
30096 +can be in Exim log format or syslog format. If a matching log line is not |
|
30097 +associated with a specific message, it is included in exigrep's output without |
|
30098 +any additional lines. The usage is: |
|
30099 + |
|
30100 +exigrep [-t<n>] [-I] [-l] [-v] <pattern> [<log file>] ... |
|
30101 + |
|
30102 +If no log file names are given on the command line, the standard input is read. |
|
30103 + |
|
30104 +The -t argument specifies a number of seconds. It adds an additional condition |
|
30105 +for message selection. Messages that are complete are shown only if they spent |
|
30106 +more than <n> seconds on the queue. |
|
30107 + |
|
30108 +By default, exigrep does case-insensitive matching. The -I option makes it |
|
30109 +case-sensitive. This may give a performance improvement when searching large |
|
30110 +log files. Without -I, the Perl pattern matches use Perl's "/i" option; with -I |
|
30111 +they do not. In both cases it is possible to change the case sensitivity within |
|
30112 +the pattern by using "(?i)" or "(?-i)". |
|
30113 + |
|
30114 +The -l option means "literal", that is, treat all characters in the pattern as |
|
30115 +standing for themselves. Otherwise the pattern must be a Perl regular |
|
30116 +expression. |
|
30117 + |
|
30118 +The -v option inverts the matching condition. That is, a line is selected if it |
|
30119 +does not match the pattern. |
|
30120 + |
|
30121 +If the location of a zcat command is known from the definition of ZCAT_COMMAND |
|
30122 +in Local/Makefile, exigrep automatically passes any file whose name ends in |
|
30123 +COMPRESS_SUFFIX through zcat as it searches it. |
|
30124 + |
|
30125 +50.5Â Selecting messages by various criteria (exipick) |
|
30126 + |
|
30127 +John Jetmore's exipick utility is included in the Exim distribution. It lists |
|
30128 +messages from the queue according to a variety of criteria. For details of |
|
30129 +exipick's facilities, visit the web page at http://www.exim.org/eximwiki/ |
|
30130 +ToolExipickManPage or run exipick with the --help option. |
|
30131 + |
|
30132 +50.6Â Cycling log files (exicyclog) |
|
30133 + |
|
30134 +The exicyclog script can be used to cycle (rotate) mainlog and rejectlog files. |
|
30135 +This is not necessary if only syslog is being used, or if you are using log |
|
30136 +files with datestamps in their names (see section 49.3). Some operating systems |
|
30137 +have their own standard mechanisms for log cycling, and these can be used |
|
30138 +instead of exicyclog if preferred. There are two command line options for |
|
30139 +exicyclog: |
|
30140 + |
|
30141 + * -k <count> specifies the number of log files to keep, overriding the |
|
30142 + default that is set when Exim is built. The default default is 10. |
|
30143 + |
|
30144 + * -l <path> specifies the log file path, in the same format as Exim's |
|
30145 + log_file_path option (for example, "/var/log/exim_%slog"), again overriding |
|
30146 + the script's default, which is to find the setting from Exim's |
|
30147 + configuration. |
|
30148 + |
|
30149 +Each time exicyclog is run the file names get "shuffled down" by one. If the |
|
30150 +main log file name is mainlog (the default) then when exicyclog is run mainlog |
|
30151 +becomes mainlog.01, the previous mainlog.01 becomes mainlog.02 and so on, up to |
|
30152 +the limit that is set in the script or by the -k option. Log files whose |
|
30153 +numbers exceed the limit are discarded. Reject logs are handled similarly. |
|
30154 + |
|
30155 +If the limit is greater than 99, the script uses 3-digit numbers such as |
|
30156 +mainlog.001, mainlog.002, etc. If you change from a number less than 99 to one |
|
30157 +that is greater, or vice versa, you will have to fix the names of any existing |
|
30158 +log files. |
|
30159 + |
|
30160 +If no mainlog file exists, the script does nothing. Files that "drop off" the |
|
30161 +end are deleted. All files with numbers greater than 01 are compressed, using a |
|
30162 +compression command which is configured by the COMPRESS_COMMAND setting in |
|
30163 +Local/Makefile. It is usual to run exicyclog daily from a root crontab entry of |
|
30164 +the form |
|
30165 + |
|
30166 +1 0 * * * su exim -c /usr/exim/bin/exicyclog |
|
30167 + |
|
30168 +assuming you have used the name "exim" for the Exim user. You can run exicyclog |
|
30169 +as root if you wish, but there is no need. |
|
30170 + |
|
30171 +50.7Â Mail statistics (eximstats) |
|
30172 + |
|
30173 +A Perl script called eximstats is provided for extracting statistical |
|
30174 +information from log files. The output is either plain text, or HTML. Exim log |
|
30175 +files are also supported by the Lire system produced by the LogReport |
|
30176 +Foundation http://www.logreport.org. |
|
30177 + |
|
30178 +The eximstats script has been hacked about quite a bit over time. The latest |
|
30179 +version is the result of some extensive revision by Steve Campbell. A lot of |
|
30180 +information is given by default, but there are options for suppressing various |
|
30181 +parts of it. Following any options, the arguments to the script are a list of |
|
30182 +files, which should be main log files. For example: |
|
30183 + |
|
30184 +eximstats -nr /var/spool/exim/log/mainlog.01 |
|
30185 + |
|
30186 +By default, eximstats extracts information about the number and volume of |
|
30187 +messages received from or delivered to various hosts. The information is sorted |
|
30188 +both by message count and by volume, and the top fifty hosts in each category |
|
30189 +are listed on the standard output. Similar information, based on email |
|
30190 +addresses or domains instead of hosts can be requested by means of various |
|
30191 +options. For messages delivered and received locally, similar statistics are |
|
30192 +also produced per user. |
|
30193 + |
|
30194 +The output also includes total counts and statistics about delivery errors, and |
|
30195 +histograms showing the number of messages received and deliveries made in each |
|
30196 +hour of the day. A delivery with more than one address in its envelope (for |
|
30197 +example, an SMTP transaction with more than one RCPT command) is counted as a |
|
30198 +single delivery by eximstats. |
|
30199 + |
|
30200 +Though normally more deliveries than receipts are reported (as messages may |
|
30201 +have multiple recipients), it is possible for eximstats to report more messages |
|
30202 +received than delivered, even though the queue is empty at the start and end of |
|
30203 +the period in question. If an incoming message contains no valid recipients, no |
|
30204 +deliveries are recorded for it. A bounce message is handled as an entirely |
|
30205 +separate message. |
|
30206 + |
|
30207 +eximstats always outputs a grand total summary giving the volume and number of |
|
30208 +messages received and deliveries made, and the number of hosts involved in each |
|
30209 +case. It also outputs the number of messages that were delayed (that is, not |
|
30210 +completely delivered at the first attempt), and the number that had at least |
|
30211 +one address that failed. |
|
30212 + |
|
30213 +The remainder of the output is in sections that can be independently disabled |
|
30214 +or modified by various options. It consists of a summary of deliveries by |
|
30215 +transport, histograms of messages received and delivered per time interval |
|
30216 +(default per hour), information about the time messages spent on the queue, a |
|
30217 +list of relayed messages, lists of the top fifty sending hosts, local senders, |
|
30218 +destination hosts, and destination local users by count and by volume, and a |
|
30219 +list of delivery errors that occurred. |
|
30220 + |
|
30221 +The relay information lists messages that were actually relayed, that is, they |
|
30222 +came from a remote host and were directly delivered to some other remote host, |
|
30223 +without being processed (for example, for aliasing or forwarding) locally. |
|
30224 + |
|
30225 +There are quite a few options for eximstats to control exactly what it outputs. |
|
30226 +These are documented in the Perl script itself, and can be extracted by running |
|
30227 +the command perldoc on the script. For example: |
|
30228 + |
|
30229 +perldoc /usr/exim/bin/eximstats |
|
30230 + |
|
30231 +50.8Â Checking access policy (exim_checkaccess) |
|
30232 + |
|
30233 +The -bh command line argument allows you to run a fake SMTP session with |
|
30234 +debugging output, in order to check what Exim is doing when it is applying |
|
30235 +policy controls to incoming SMTP mail. However, not everybody is sufficiently |
|
30236 +familiar with the SMTP protocol to be able to make full use of -bh, and |
|
30237 +sometimes you just want to answer the question "Does this address have access?" |
|
30238 +without bothering with any further details. |
|
30239 + |
|
30240 +The exim_checkaccess utility is a "packaged" version of -bh. It takes two |
|
30241 +arguments, an IP address and an email address: |
|
30242 + |
|
30243 +exim_checkaccess 10.9.8.7 A.User@a.domain.example |
|
30244 + |
|
30245 +The utility runs a call to Exim with the -bh option, to test whether the given |
|
30246 +email address would be accepted in a RCPT command in a TCP/IP connection from |
|
30247 +the host with the given IP address. The output of the utility is either the |
|
30248 +word "accepted", or the SMTP error response, for example: |
|
30249 + |
|
30250 +Rejected: |
|
30251 +550 Relay not permitted |
|
30252 + |
|
30253 +When running this test, the utility uses "<>" as the envelope sender address |
|
30254 +for the MAIL command, but you can change this by providing additional options. |
|
30255 +These are passed directly to the Exim command. For example, to specify that the |
|
30256 +test is to be run with the sender address himself@there.example you can use: |
|
30257 + |
|
30258 +exim_checkaccess 10.9.8.7 A.User@a.domain.example \ |
|
30259 + -f himself@there.example |
|
30260 + |
|
30261 +Note that these additional Exim command line items must be given after the two |
|
30262 +mandatory arguments. |
|
30263 + |
|
30264 +Because the exim_checkaccess uses -bh, it does not perform callouts while |
|
30265 +running its checks. You can run checks that include callouts by using -bhc, but |
|
30266 +this is not yet available in a "packaged" form. |
|
30267 + |
|
30268 +50.9Â Making DBM files (exim_dbmbuild) |
|
30269 + |
|
30270 +The exim_dbmbuild program reads an input file containing keys and data in the |
|
30271 +format used by the lsearch lookup (see section 9.3). It writes a DBM file using |
|
30272 +the lower-cased alias names as keys and the remainder of the information as |
|
30273 +data. The lower-casing can be prevented by calling the program with the -nolc |
|
30274 +option. |
|
30275 + |
|
30276 +A terminating zero is included as part of the key string. This is expected by |
|
30277 +the dbm lookup type. However, if the option -nozero is given, exim_dbmbuild |
|
30278 +creates files without terminating zeroes in either the key strings or the data |
|
30279 +strings. The dbmnz lookup type can be used with such files. |
|
30280 + |
|
30281 +The program requires two arguments: the name of the input file (which can be a |
|
30282 +single hyphen to indicate the standard input), and the name of the output file. |
|
30283 +It creates the output under a temporary name, and then renames it if all went |
|
30284 +well. |
|
30285 + |
|
30286 +If the native DB interface is in use (USE_DB is set in a compile-time |
|
30287 +configuration file - this is common in free versions of Unix) the two file |
|
30288 +names must be different, because in this mode the Berkeley DB functions create |
|
30289 +a single output file using exactly the name given. For example, |
|
30290 + |
|
30291 +exim_dbmbuild /etc/aliases /etc/aliases.db |
|
30292 + |
|
30293 +reads the system alias file and creates a DBM version of it in /etc/aliases.db. |
|
30294 + |
|
30295 +In systems that use the ndbm routines (mostly proprietary versions of Unix), |
|
30296 +two files are used, with the suffixes .dir and .pag. In this environment, the |
|
30297 +suffixes are added to the second argument of exim_dbmbuild, so it can be the |
|
30298 +same as the first. This is also the case when the Berkeley functions are used |
|
30299 +in compatibility mode (though this is not recommended), because in that case it |
|
30300 +adds a .db suffix to the file name. |
|
30301 + |
|
30302 +If a duplicate key is encountered, the program outputs a warning, and when it |
|
30303 +finishes, its return code is 1 rather than zero, unless the -noduperr option is |
|
30304 +used. By default, only the first of a set of duplicates is used - this makes it |
|
30305 +compatible with lsearch lookups. There is an option -lastdup which causes it to |
|
30306 +use the data for the last duplicate instead. There is also an option -nowarn, |
|
30307 +which stops it listing duplicate keys to stderr. For other errors, where it |
|
30308 +doesn't actually make a new file, the return code is 2. |
|
30309 + |
|
30310 +50.10Â Finding individual retry times (exinext) |
|
30311 + |
|
30312 +A utility called exinext (mostly a Perl script) provides the ability to fish |
|
30313 +specific information out of the retry database. Given a mail domain (or a |
|
30314 +complete address), it looks up the hosts for that domain, and outputs any retry |
|
30315 +information for the hosts or for the domain. At present, the retry information |
|
30316 +is obtained by running exim_dumpdb (see below) and post-processing the output. |
|
30317 +For example: |
|
30318 + |
|
30319 +$ exinext piglet@milne.fict.example |
|
30320 +kanga.milne.example:192.168.8.1 error 146: Connection refused |
|
30321 + first failed: 21-Feb-1996 14:57:34 |
|
30322 + last tried: 21-Feb-1996 14:57:34 |
|
30323 + next try at: 21-Feb-1996 15:02:34 |
|
30324 +roo.milne.example:192.168.8.3 error 146: Connection refused |
|
30325 + first failed: 20-Jan-1996 13:12:08 |
|
30326 + last tried: 21-Feb-1996 11:42:03 |
|
30327 + next try at: 21-Feb-1996 19:42:03 |
|
30328 + past final cutoff time |
|
30329 + |
|
30330 +You can also give exinext a local part, without a domain, and it will give any |
|
30331 +retry information for that local part in your default domain. A message id can |
|
30332 +be used to obtain retry information pertaining to a specific message. This |
|
30333 +exists only when an attempt to deliver a message to a remote host suffers a |
|
30334 +message-specific error (see section 45.2). exinext is not particularly |
|
30335 +efficient, but then it is not expected to be run very often. |
|
30336 + |
|
30337 +The exinext utility calls Exim to find out information such as the location of |
|
30338 +the spool directory. The utility has -C and -D options, which are passed on to |
|
30339 +the exim commands. The first specifies an alternate Exim configuration file, |
|
30340 +and the second sets macros for use within the configuration file. These |
|
30341 +features are mainly to help in testing, but might also be useful in |
|
30342 +environments where more than one configuration file is in use. |
|
30343 + |
|
30344 +50.11Â Hints database maintenance |
|
30345 + |
|
30346 +Three utility programs are provided for maintaining the DBM files that Exim |
|
30347 +uses to contain its delivery hint information. Each program requires two |
|
30348 +arguments. The first specifies the name of Exim's spool directory, and the |
|
30349 +second is the name of the database it is to operate on. These are as follows: |
|
30350 + |
|
30351 + * retry: the database of retry information |
|
30352 + |
|
30353 + * wait-<transport name>: databases of information about messages waiting for |
|
30354 + remote hosts |
|
30355 + |
|
30356 + * callout: the callout cache |
|
30357 + |
|
30358 + * ratelimit: the data for implementing the ratelimit ACL condition |
|
30359 + |
|
30360 + * misc: other hints data |
|
30361 + |
|
30362 +The misc database is used for |
|
30363 + |
|
30364 + * Serializing ETRN runs (when smtp_etrn_serialize is set) |
|
30365 + |
|
30366 + * Serializing delivery to a specific host (when serialize_hosts is set in an |
|
30367 + smtp transport) |
|
30368 + |
|
30369 +50.12Â exim_dumpdb |
|
30370 + |
|
30371 +The entire contents of a database are written to the standard output by the |
|
30372 +exim_dumpdb program, which has no options or arguments other than the spool and |
|
30373 +database names. For example, to dump the retry database: |
|
30374 + |
|
30375 +exim_dumpdb /var/spool/exim retry |
|
30376 + |
|
30377 +Two lines of output are produced for each entry: |
|
30378 + |
|
30379 +T:mail.ref.example:192.168.242.242 146 77 Connection refused |
|
30380 +31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 * |
|
30381 + |
|
30382 +The first item on the first line is the key of the record. It starts with one |
|
30383 +of the letters R, or T, depending on whether it refers to a routing or |
|
30384 +transport retry. For a local delivery, the next part is the local address; for |
|
30385 +a remote delivery it is the name of the remote host, followed by its failing IP |
|
30386 +address (unless retry_include_ip_address is set false on the smtp transport). |
|
30387 +If the remote port is not the standard one (port 25), it is added to the IP |
|
30388 +address. Then there follows an error code, an additional error code, and a |
|
30389 +textual description of the error. |
|
30390 + |
|
30391 +The three times on the second line are the time of first failure, the time of |
|
30392 +the last delivery attempt, and the computed time for the next attempt. The line |
|
30393 +ends with an asterisk if the cutoff time for the last retry rule has been |
|
30394 +exceeded. |
|
30395 + |
|
30396 +Each output line from exim_dumpdb for the wait-xxx databases consists of a host |
|
30397 +name followed by a list of ids for messages that are or were waiting to be |
|
30398 +delivered to that host. If there are a very large number for any one host, |
|
30399 +continuation records, with a sequence number added to the host name, may be |
|
30400 +seen. The data in these records is often out of date, because a message may be |
|
30401 +routed to several alternative hosts, and Exim makes no effort to keep |
|
30402 +cross-references. |
|
30403 + |
|
30404 +50.13Â exim_tidydb |
|
30405 + |
|
30406 +The exim_tidydb utility program is used to tidy up the contents of a hints |
|
30407 +database. If run with no options, it removes all records that are more than 30 |
|
30408 +days old. The age is calculated from the date and time that the record was last |
|
30409 +updated. Note that, in the case of the retry database, it is not the time since |
|
30410 +the first delivery failure. Information about a host that has been down for |
|
30411 +more than 30 days will remain in the database, provided that the record is |
|
30412 +updated sufficiently often. |
|
30413 + |
|
30414 +The cutoff date can be altered by means of the -t option, which must be |
|
30415 +followed by a time. For example, to remove all records older than a week from |
|
30416 +the retry database: |
|
30417 + |
|
30418 +exim_tidydb -t 7d /var/spool/exim retry |
|
30419 + |
|
30420 +Both the wait-xxx and retry databases contain items that involve message ids. |
|
30421 +In the former these appear as data in records keyed by host - they were |
|
30422 +messages that were waiting for that host - and in the latter they are the keys |
|
30423 +for retry information for messages that have suffered certain types of error. |
|
30424 +When exim_tidydb is run, a check is made to ensure that message ids in database |
|
30425 +records are those of messages that are still on the queue. Message ids for |
|
30426 +messages that no longer exist are removed from wait-xxx records, and if this |
|
30427 +leaves any records empty, they are deleted. For the retry database, records |
|
30428 +whose keys are non-existent message ids are removed. The exim_tidydb utility |
|
30429 +outputs comments on the standard output whenever it removes information from |
|
30430 +the database. |
|
30431 + |
|
30432 +Certain records are automatically removed by Exim when they are no longer |
|
30433 +needed, but others are not. For example, if all the MX hosts for a domain are |
|
30434 +down, a retry record is created for each one. If the primary MX host comes back |
|
30435 +first, its record is removed when Exim successfully delivers to it, but the |
|
30436 +records for the others remain because Exim has not tried to use those hosts. |
|
30437 + |
|
30438 +It is important, therefore, to run exim_tidydb periodically on all the hints |
|
30439 +databases. You should do this at a quiet time of day, because it requires a |
|
30440 +database to be locked (and therefore inaccessible to Exim) while it does its |
|
30441 +work. Removing records from a DBM file does not normally make the file smaller, |
|
30442 +but all the common DBM libraries are able to re-use the space that is released. |
|
30443 +After an initial phase of increasing in size, the databases normally reach a |
|
30444 +point at which they no longer get any bigger, as long as they are regularly |
|
30445 +tidied. |
|
30446 + |
|
30447 +Warning: If you never run exim_tidydb, the space used by the hints databases is |
|
30448 +likely to keep on increasing. |
|
30449 + |
|
30450 +50.14Â exim_fixdb |
|
30451 + |
|
30452 +The exim_fixdb program is a utility for interactively modifying databases. Its |
|
30453 +main use is for testing Exim, but it might also be occasionally useful for |
|
30454 +getting round problems in a live system. It has no options, and its interface |
|
30455 +is somewhat crude. On entry, it prompts for input with a right angle-bracket. A |
|
30456 +key of a database record can then be entered, and the data for that record is |
|
30457 +displayed. |
|
30458 + |
|
30459 +If "d" is typed at the next prompt, the entire record is deleted. For all |
|
30460 +except the retry database, that is the only operation that can be carried out. |
|
30461 +For the retry database, each field is output preceded by a number, and data for |
|
30462 +individual fields can be changed by typing the field number followed by new |
|
30463 +data, for example: |
|
30464 + |
|
30465 +> 4 951102:1000 |
|
30466 + |
|
30467 +resets the time of the next delivery attempt. Time values are given as a |
|
30468 +sequence of digit pairs for year, month, day, hour, and minute. Colons can be |
|
30469 +used as optional separators. |
|
30470 + |
|
30471 +50.15Â Mailbox maintenance (exim_lock) |
|
30472 + |
|
30473 +The exim_lock utility locks a mailbox file using the same algorithm as Exim. |
|
30474 +For a discussion of locking issues, see section 26.3. Exim_lock can be used to |
|
30475 +prevent any modification of a mailbox by Exim or a user agent while |
|
30476 +investigating a problem. The utility requires the name of the file as its first |
|
30477 +argument. If the locking is successful, the second argument is run as a command |
|
30478 +(using C's system() function); if there is no second argument, the value of the |
|
30479 +SHELL environment variable is used; if this is unset or empty, /bin/sh is run. |
|
30480 +When the command finishes, the mailbox is unlocked and the utility ends. The |
|
30481 +following options are available: |
|
30482 + |
|
30483 +-fcntl |
|
30484 + |
|
30485 + Use fcntl() locking on the open mailbox. |
|
30486 + |
|
30487 +-flock |
|
30488 + |
|
30489 + Use flock() locking on the open mailbox, provided the operating system |
|
30490 + supports it. |
|
30491 + |
|
30492 +-interval |
|
30493 + |
|
30494 + This must be followed by a number, which is a number of seconds; it sets |
|
30495 + the interval to sleep between retries (default 3). |
|
30496 + |
|
30497 +-lockfile |
|
30498 + |
|
30499 + Create a lock file before opening the mailbox. |
|
30500 + |
|
30501 +-mbx |
|
30502 + |
|
30503 + Lock the mailbox using MBX rules. |
|
30504 + |
|
30505 +-q |
|
30506 + |
|
30507 + Suppress verification output. |
|
30508 + |
|
30509 +-retries |
|
30510 + |
|
30511 + This must be followed by a number; it sets the number of times to try to |
|
30512 + get the lock (default 10). |
|
30513 + |
|
30514 +-restore_time |
|
30515 + |
|
30516 + This option causes exim_lock to restore the modified and read times to the |
|
30517 + locked file before exiting. This allows you to access a locked mailbox (for |
|
30518 + example, to take a backup copy) without disturbing the times that the user |
|
30519 + subsequently sees. |
|
30520 + |
|
30521 +-timeout |
|
30522 + |
|
30523 + This must be followed by a number, which is a number of seconds; it sets a |
|
30524 + timeout to be used with a blocking fcntl() lock. If it is not set (the |
|
30525 + default), a non-blocking call is used. |
|
30526 + |
|
30527 +-v |
|
30528 + |
|
30529 + Generate verbose output. |
|
30530 + |
|
30531 +If none of -fcntl, -flock, -lockfile or -mbx are given, the default is to |
|
30532 +create a lock file and also to use fcntl() locking on the mailbox, which is the |
|
30533 +same as Exim's default. The use of -flock or -fcntl requires that the file be |
|
30534 +writeable; the use of -lockfile requires that the directory containing the file |
|
30535 +be writeable. Locking by lock file does not last for ever; Exim assumes that a |
|
30536 +lock file is expired if it is more than 30 minutes old. |
|
30537 + |
|
30538 +The -mbx option can be used with either or both of -fcntl or -flock. It assumes |
|
30539 +-fcntl by default. MBX locking causes a shared lock to be taken out on the open |
|
30540 +mailbox, and an exclusive lock on the file /tmp/.n.m where n and m are the |
|
30541 +device number and inode number of the mailbox file. When the locking is |
|
30542 +released, if an exclusive lock can be obtained for the mailbox, the file in / |
|
30543 +tmp is deleted. |
|
30544 + |
|
30545 +The default output contains verification of the locking that takes place. The |
|
30546 +-v option causes some additional information to be given. The -q option |
|
30547 +suppresses all output except error messages. |
|
30548 + |
|
30549 +A command such as |
|
30550 + |
|
30551 +exim_lock /var/spool/mail/spqr |
|
30552 + |
|
30553 +runs an interactive shell while the file is locked, whereas |
|
30554 + |
|
30555 +exim_lock -q /var/spool/mail/spqr <<End |
|
30556 +<some commands> |
|
30557 +End |
|
30558 + |
|
30559 +runs a specific non-interactive sequence of commands while the file is locked, |
|
30560 +suppressing all verification output. A single command can be run by a command |
|
30561 +such as |
|
30562 + |
|
30563 +exim_lock -q /var/spool/mail/spqr \ |
|
30564 + "cp /var/spool/mail/spqr /some/where" |
|
30565 + |
|
30566 +Note that if a command is supplied, it must be entirely contained within the |
|
30567 +second argument - hence the quotes. |
|
30568 + |
|
30569 +51. The Exim monitor |
|
30570 + |
|
30571 +The Exim monitor is an application which displays in an X window information |
|
30572 +about the state of Exim's queue and what Exim is doing. An admin user can |
|
30573 +perform certain operations on messages from this GUI interface; however all |
|
30574 +such facilities are also available from the command line, and indeed, the |
|
30575 +monitor itself makes use of the command line to perform any actions requested. |
|
30576 + |
|
30577 +51.1Â Running the monitor |
|
30578 + |
|
30579 +The monitor is started by running the script called eximon. This is a shell |
|
30580 +script that sets up a number of environment variables, and then runs the binary |
|
30581 +called eximon.bin. The default appearance of the monitor window can be changed |
|
30582 +by editing the Local/eximon.conf file created by editing exim_monitor/EDITME. |
|
30583 +Comments in that file describe what the various parameters are for. |
|
30584 + |
|
30585 +The parameters that get built into the eximon script can be overridden for a |
|
30586 +particular invocation by setting up environment variables of the same names, |
|
30587 +preceded by "EXIMON_". For example, a shell command such as |
|
30588 + |
|
30589 +EXIMON_LOG_DEPTH=400 eximon |
|
30590 + |
|
30591 +(in a Bourne-compatible shell) runs eximon with an overriding setting of the |
|
30592 +LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it |
|
30593 +overrides the Exim log file configuration. This makes it possible to have |
|
30594 +eximon tailing log data that is written to syslog, provided that MAIL.INFO |
|
30595 +syslog messages are routed to a file on the local host. |
|
30596 + |
|
30597 +X resources can be used to change the appearance of the window in the normal |
|
30598 +way. For example, a resource setting of the form |
|
30599 + |
|
30600 +Eximon*background: gray94 |
|
30601 + |
|
30602 +changes the colour of the background to light grey rather than white. The |
|
30603 +stripcharts are drawn with both the data lines and the reference lines in |
|
30604 +black. This means that the reference lines are not visible when on top of the |
|
30605 +data. However, their colour can be changed by setting a resource called |
|
30606 +"highlight" (an odd name, but that's what the Athena stripchart widget uses). |
|
30607 +For example, if your X server is running Unix, you could set up lighter |
|
30608 +reference lines in the stripcharts by obeying |
|
30609 + |
|
30610 +xrdb -merge <<End |
|
30611 +Eximon*highlight: gray |
|
30612 +End |
|
30613 + |
|
30614 +In order to see the contents of messages on the queue, and to operate on them, |
|
30615 +eximon must either be run as root or by an admin user. |
|
30616 + |
|
30617 +The monitor's window is divided into three parts. The first contains one or |
|
30618 +more stripcharts and two action buttons, the second contains a "tail" of the |
|
30619 +main log file, and the third is a display of the queue of messages awaiting |
|
30620 +delivery, with two more action buttons. The following sections describe these |
|
30621 +different parts of the display. |
|
30622 + |
|
30623 +51.2Â The stripcharts |
|
30624 + |
|
30625 +The first stripchart is always a count of messages on the queue. Its name can |
|
30626 +be configured by setting QUEUE_STRIPCHART_NAME in the Local/eximon.conf file. |
|
30627 +The remaining stripcharts are defined in the configuration script by regular |
|
30628 +expression matches on log file entries, making it possible to display, for |
|
30629 +example, counts of messages delivered to certain hosts or using certain |
|
30630 +transports. The supplied defaults display counts of received and delivered |
|
30631 +messages, and of local and SMTP deliveries. The default period between |
|
30632 +stripchart updates is one minute; this can be adjusted by a parameter in the |
|
30633 +Local/eximon.conf file. |
|
30634 + |
|
30635 +The stripchart displays rescale themselves automatically as the value they are |
|
30636 +displaying changes. There are always 10 horizontal lines in each chart; the |
|
30637 +title string indicates the value of each division when it is greater than one. |
|
30638 +For example, "x2" means that each division represents a value of 2. |
|
30639 + |
|
30640 +It is also possible to have a stripchart which shows the percentage fullness of |
|
30641 +a particular disk partition, which is useful when local deliveries are confined |
|
30642 +to a single partition. |
|
30643 + |
|
30644 +This relies on the availability of the statvfs() function or equivalent in the |
|
30645 +operating system. Most, but not all versions of Unix that support Exim have |
|
30646 +this. For this particular stripchart, the top of the chart always represents |
|
30647 +100%, and the scale is given as "x10%". This chart is configured by setting |
|
30648 +SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the Local/eximon.conf |
|
30649 +file. |
|
30650 + |
|
30651 +51.3Â Main action buttons |
|
30652 + |
|
30653 +Below the stripcharts there is an action button for quitting the monitor. Next |
|
30654 +to this is another button marked "Size". They are placed here so that shrinking |
|
30655 +the window to its default minimum size leaves just the queue count stripchart |
|
30656 +and these two buttons visible. Pressing the "Size" button causes the window to |
|
30657 +expand to its maximum size, unless it is already at the maximum, in which case |
|
30658 +it is reduced to its minimum. |
|
30659 + |
|
30660 +When expanding to the maximum, if the window cannot be fully seen where it |
|
30661 +currently is, it is moved back to where it was the last time it was at full |
|
30662 +size. When it is expanding from its minimum size, the old position is |
|
30663 +remembered, and next time it is reduced to the minimum it is moved back there. |
|
30664 + |
|
30665 +The idea is that you can keep a reduced window just showing one or two |
|
30666 +stripcharts at a convenient place on your screen, easily expand it to show the |
|
30667 +full window when required, and just as easily put it back to what it was. The |
|
30668 +idea is copied from what the twm window manager does for its f.fullzoom action. |
|
30669 +The minimum size of the window can be changed by setting the MIN_HEIGHT and |
|
30670 +MIN_WIDTH values in Local/eximon.conf. |
|
30671 + |
|
30672 +Normally, the monitor starts up with the window at its full size, but it can be |
|
30673 +built so that it starts up with the window at its smallest size, by setting |
|
30674 +START_SMALL=yes in Local/eximon.conf. |
|
30675 + |
|
30676 +51.4Â The log display |
|
30677 + |
|
30678 +The second section of the window is an area in which a display of the tail of |
|
30679 +the main log is maintained. To save space on the screen, the timestamp on each |
|
30680 +log line is shortened by removing the date and, if log_timezone is set, the |
|
30681 +timezone. The log tail is not available when the only destination for logging |
|
30682 +data is syslog, unless the syslog lines are routed to a local file whose name |
|
30683 +is passed to eximon via the EXIMON_LOG_FILE_PATH environment variable. |
|
30684 + |
|
30685 +The log sub-window has a scroll bar at its lefthand side which can be used to |
|
30686 +move back to look at earlier text, and the up and down arrow keys also have a |
|
30687 +scrolling effect. The amount of log that is kept depends on the setting of |
|
30688 +LOG_BUFFER in Local/eximon.conf, which specifies the amount of memory to use. |
|
30689 +When this is full, the earlier 50% of data is discarded - this is much more |
|
30690 +efficient than throwing it away line by line. The sub-window also has a |
|
30691 +horizontal scroll bar for accessing the ends of long log lines. This is the |
|
30692 +only means of horizontal scrolling; the right and left arrow keys are not |
|
30693 +available. Text can be cut from this part of the window using the mouse in the |
|
30694 +normal way. The size of this subwindow is controlled by parameters in the |
|
30695 +configuration file Local/eximon.conf. |
|
30696 + |
|
30697 +Searches of the text in the log window can be carried out by means of the ^R |
|
30698 +and ^S keystrokes, which default to a reverse and a forward search, |
|
30699 +respectively. The search covers only the text that is displayed in the window. |
|
30700 +It cannot go further back up the log. |
|
30701 + |
|
30702 +The point from which the search starts is indicated by a caret marker. This is |
|
30703 +normally at the end of the text in the window, but can be positioned explicitly |
|
30704 +by pointing and clicking with the left mouse button, and is moved automatically |
|
30705 +by a successful search. If new text arrives in the window when it is scrolled |
|
30706 +back, the caret remains where it is, but if the window is not scrolled back, |
|
30707 +the caret is moved to the end of the new text. |
|
30708 + |
|
30709 +Pressing ^R or ^S pops up a window into which the search text can be typed. |
|
30710 +There are buttons for selecting forward or reverse searching, for carrying out |
|
30711 +the search, and for cancelling. If the "Search" button is pressed, the search |
|
30712 +happens and the window remains so that further searches can be done. If the |
|
30713 +"Return" key is pressed, a single search is done and the window is closed. If ^ |
|
30714 +C is typed the search is cancelled. |
|
30715 + |
|
30716 +The searching facility is implemented using the facilities of the Athena text |
|
30717 +widget. By default this pops up a window containing both "search" and "replace" |
|
30718 +options. In order to suppress the unwanted "replace" portion for eximon, a |
|
30719 +modified version of the TextPop widget is distributed with Exim. However, the |
|
30720 +linkers in BSDI and HP-UX seem unable to handle an externally provided version |
|
30721 +of TextPop when the remaining parts of the text widget come from the standard |
|
30722 +libraries. The compile-time option EXIMON_TEXTPOP can be unset to cut out the |
|
30723 +modified TextPop, making it possible to build Eximon on these systems, at the |
|
30724 +expense of having unwanted items in the search popup window. |
|
30725 + |
|
30726 +51.5Â The queue display |
|
30727 + |
|
30728 +The bottom section of the monitor window contains a list of all messages that |
|
30729 +are on the queue, which includes those currently being received or delivered, |
|
30730 +as well as those awaiting delivery. The size of this subwindow is controlled by |
|
30731 +parameters in the configuration file Local/eximon.conf, and the frequency at |
|
30732 +which it is updated is controlled by another parameter in the same file - the |
|
30733 +default is 5 minutes, since queue scans can be quite expensive. However, there |
|
30734 +is an "Update" action button just above the display which can be used to force |
|
30735 +an update of the queue display at any time. |
|
30736 + |
|
30737 +When a host is down for some time, a lot of pending mail can build up for it, |
|
30738 +and this can make it hard to deal with other messages on the queue. To help |
|
30739 +with this situation there is a button next to "Update" called "Hide". If |
|
30740 +pressed, a dialogue box called "Hide addresses ending with" is put up. If you |
|
30741 +type anything in here and press "Return", the text is added to a chain of such |
|
30742 +texts, and if every undelivered address in a message matches at least one of |
|
30743 +the texts, the message is not displayed. |
|
30744 + |
|
30745 +If there is an address that does not match any of the texts, all the addresses |
|
30746 +are displayed as normal. The matching happens on the ends of addresses so, for |
|
30747 +example, cam.ac.uk specifies all addresses in Cambridge, while |
|
30748 +xxx@foo.com.example specifies just one specific address. When any hiding has |
|
30749 +been set up, a button called "Unhide" is displayed. If pressed, it cancels all |
|
30750 +hiding. Also, to ensure that hidden messages do not get forgotten, a hide |
|
30751 +request is automatically cancelled after one hour. |
|
30752 + |
|
30753 +While the dialogue box is displayed, you can't press any buttons or do anything |
|
30754 +else to the monitor window. For this reason, if you want to cut text from the |
|
30755 +queue display to use in the dialogue box, you have to do the cutting before |
|
30756 +pressing the "Hide" button. |
|
30757 + |
|
30758 +The queue display contains, for each unhidden queued message, the length of |
|
30759 +time it has been on the queue, the size of the message, the message id, the |
|
30760 +message sender, and the first undelivered recipient, all on one line. If it is |
|
30761 +a bounce message, the sender is shown as "<>". If there is more than one |
|
30762 +recipient to which the message has not yet been delivered, subsequent ones are |
|
30763 +listed on additional lines, up to a maximum configured number, following which |
|
30764 +an ellipsis is displayed. Recipients that have already received the message are |
|
30765 +not shown. |
|
30766 + |
|
30767 +If a message is frozen, an asterisk is displayed at the left-hand side. |
|
30768 + |
|
30769 +The queue display has a vertical scroll bar, and can also be scrolled by means |
|
30770 +of the arrow keys. Text can be cut from it using the mouse in the normal way. |
|
30771 +The text searching facilities, as described above for the log window, are also |
|
30772 +available, but the caret is always moved to the end of the text when the queue |
|
30773 +display is updated. |
|
30774 + |
|
30775 +51.6Â The queue menu |
|
30776 + |
|
30777 +If the shift key is held down and the left button is clicked when the mouse |
|
30778 +pointer is over the text for any message, an action menu pops up, and the first |
|
30779 +line of the queue display for the message is highlighted. This does not affect |
|
30780 +any selected text. |
|
30781 + |
|
30782 +If you want to use some other event for popping up the menu, you can set the |
|
30783 +MENU_EVENT parameter in Local/eximon.conf to change the default, or set |
|
30784 +EXIMON_MENU_EVENT in the environment before starting the monitor. The value set |
|
30785 +in this parameter is a standard X event description. For example, to run eximon |
|
30786 +using ctrl rather than shift you could use |
|
30787 + |
|
30788 +EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon |
|
30789 + |
|
30790 +The title of the menu is the message id, and it contains entries which act as |
|
30791 +follows: |
|
30792 + |
|
30793 + * message log: The contents of the message log for the message are displayed |
|
30794 + in a new text window. |
|
30795 + |
|
30796 + * headers: Information from the spool file that contains the envelope |
|
30797 + information and headers is displayed in a new text window. See chapter 53 |
|
30798 + for a description of the format of spool files. |
|
30799 + |
|
30800 + * body: The contents of the spool file containing the body of the message are |
|
30801 + displayed in a new text window. There is a default limit of 20,000 bytes to |
|
30802 + the amount of data displayed. This can be changed by setting the BODY_MAX |
|
30803 + option at compile time, or the EXIMON_BODY_MAX option at run time. |
|
30804 + |
|
30805 + * deliver message: A call to Exim is made using the -M option to request |
|
30806 + delivery of the message. This causes an automatic thaw if the message is |
|
30807 + frozen. The -v option is also set, and the output from Exim is displayed in |
|
30808 + a new text window. The delivery is run in a separate process, to avoid |
|
30809 + holding up the monitor while the delivery proceeds. |
|
30810 + |
|
30811 + * freeze message: A call to Exim is made using the -Mf option to request that |
|
30812 + the message be frozen. |
|
30813 + |
|
30814 + * thaw message: A call to Exim is made using the -Mt option to request that |
|
30815 + the message be thawed. |
|
30816 + |
|
30817 + * give up on msg: A call to Exim is made using the -Mg option to request that |
|
30818 + Exim gives up trying to deliver the message. A bounce message is generated |
|
30819 + for any remaining undelivered addresses. |
|
30820 + |
|
30821 + * remove message: A call to Exim is made using the -Mrm option to request |
|
30822 + that the message be deleted from the system without generating a bounce |
|
30823 + message. |
|
30824 + |
|
30825 + * add recipient: A dialog box is displayed into which a recipient address can |
|
30826 + be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter |
|
30827 + is set in Local/eximon.conf, the address is qualified with that domain. |
|
30828 + Otherwise it must be entered as a fully qualified address. Pressing RETURN |
|
30829 + causes a call to Exim to be made using the -Mar option to request that an |
|
30830 + additional recipient be added to the message, unless the entry box is |
|
30831 + empty, in which case no action is taken. |
|
30832 + |
|
30833 + * mark delivered: A dialog box is displayed into which a recipient address |
|
30834 + can be typed. If the address is not qualified and the QUALIFY_DOMAIN |
|
30835 + parameter is set in Local/eximon.conf, the address is qualified with that |
|
30836 + domain. Otherwise it must be entered as a fully qualified address. Pressing |
|
30837 + RETURN causes a call to Exim to be made using the -Mmd option to mark the |
|
30838 + given recipient address as already delivered, unless the entry box is |
|
30839 + empty, in which case no action is taken. |
|
30840 + |
|
30841 + * mark all delivered: A call to Exim is made using the -Mmad option to mark |
|
30842 + all recipient addresses as already delivered. |
|
30843 + |
|
30844 + * edit sender: A dialog box is displayed initialized with the current |
|
30845 + sender's address. Pressing RETURN causes a call to Exim to be made using |
|
30846 + the -Mes option to replace the sender address, unless the entry box is |
|
30847 + empty, in which case no action is taken. If you want to set an empty sender |
|
30848 + (as in bounce messages), you must specify it as "<>". Otherwise, if the |
|
30849 + address is not qualified and the QUALIFY_DOMAIN parameter is set in Local/ |
|
30850 + eximon.conf, the address is qualified with that domain. |
|
30851 + |
|
30852 +When a delivery is forced, a window showing the -v output is displayed. In |
|
30853 +other cases when a call to Exim is made, if there is any output from Exim (in |
|
30854 +particular, if the command fails) a window containing the command and the |
|
30855 +output is displayed. Otherwise, the results of the action are normally apparent |
|
30856 +from the log and queue displays. However, if you set ACTION_OUTPUT=yes in Local |
|
30857 +/eximon.conf, a window showing the Exim command is always opened, even if no |
|
30858 +output is generated. |
|
30859 + |
|
30860 +The queue display is automatically updated for actions such as freezing and |
|
30861 +thawing, unless ACTION_QUEUE_UPDATE=no has been set in Local/eximon.conf. In |
|
30862 +this case the "Update" button has to be used to force an update of the display |
|
30863 +after one of these actions. |
|
30864 + |
|
30865 +In any text window that is displayed as result of a menu action, the normal |
|
30866 +cut-and-paste facility is available, and searching can be carried out using ^R |
|
30867 +and ^S, as described above for the log tail window. |
|
30868 + |
|
30869 +52. Security considerations |
|
30870 + |
|
30871 +This chapter discusses a number of issues concerned with security, some of |
|
30872 +which are also covered in other parts of this manual. |
|
30873 + |
|
30874 +For reasons that this author does not understand, some people have promoted |
|
30875 +Exim as a "particularly secure" mailer. Perhaps it is because of the existence |
|
30876 +of this chapter in the documentation. However, the intent of the chapter is |
|
30877 +simply to describe the way Exim works in relation to certain security concerns, |
|
30878 +not to make any specific claims about the effectiveness of its security as |
|
30879 +compared with other MTAs. |
|
30880 + |
|
30881 +What follows is a description of the way Exim is supposed to be. Best efforts |
|
30882 +have been made to try to ensure that the code agrees with the theory, but an |
|
30883 +absence of bugs can never be guaranteed. Any that are reported will get fixed |
|
30884 +as soon as possible. |
|
30885 + |
|
30886 +52.1Â Building a more "hardened" Exim |
|
30887 + |
|
30888 +There are a number of build-time options that can be set in Local/Makefile to |
|
30889 +create Exim binaries that are "harder" to attack, in particular by a rogue Exim |
|
30890 +administrator who does not have the root password, or by someone who has |
|
30891 +penetrated the Exim (but not the root) account. These options are as follows: |
|
30892 + |
|
30893 + * ALT_CONFIG_PREFIX can be set to a string that is required to match the |
|
30894 + start of any file names used with the -C option. When it is set, these file |
|
30895 + names are also not allowed to contain the sequence "/../". (However, if the |
|
30896 + value of the -C option is identical to the value of CONFIGURE_FILE in Local |
|
30897 + /Makefile, Exim ignores -C and proceeds as usual.) There is no default |
|
30898 + setting for ALT_CONFIG_PREFIX. |
|
30899 + |
|
30900 + If the permitted configuration files are confined to a directory to which |
|
30901 + only root has access, this guards against someone who has broken into the |
|
30902 + Exim account from running a privileged Exim with an arbitrary configuration |
|
30903 + file, and using it to break into other accounts. |
|
30904 + |
|
30905 + * If a non-trusted configuration file (i.e. not the default configuration |
|
30906 + file or one which is trusted by virtue of being listed in the |
|
30907 + TRUSTED_CONFIG_LIST file) is specified with -C, or if macros are given with |
|
30908 + -D (but see the next item), then root privilege is retained only if the |
|
30909 + caller of Exim is root. This locks out the possibility of testing a |
|
30910 + configuration using -C right through message reception and delivery, even |
|
30911 + if the caller is root. The reception works, but by that time, Exim is |
|
30912 + running as the Exim user, so when it re-execs to regain privilege for the |
|
30913 + delivery, the use of -C causes privilege to be lost. However, root can test |
|
30914 + reception and delivery using two separate commands. |
|
30915 + |
|
30916 + * The WHITELIST_D_MACROS build option declares some macros to be safe to |
|
30917 + override with -D if the real uid is one of root, the Exim run-time user or |
|
30918 + the CONFIGURE_OWNER, if defined. The potential impact of this option is |
|
30919 + limited by requiring the run-time value supplied to -D to match a regex |
|
30920 + that errs on the restrictive side. Requiring build-time selection of safe |
|
30921 + macros is onerous but this option is intended solely as a transition |
|
30922 + mechanism to permit previously-working configurations to continue to work |
|
30923 + after release 4.73. |
|
30924 + |
|
30925 + * If DISABLE_D_OPTION is defined, the use of the -D command line option is |
|
30926 + disabled. |
|
30927 + |
|
30928 + * FIXED_NEVER_USERS can be set to a colon-separated list of users that are |
|
30929 + never to be used for any deliveries. This is like the never_users runtime |
|
30930 + option, but it cannot be overridden; the runtime option adds additional |
|
30931 + users to the list. The default setting is "root"; this prevents a non-root |
|
30932 + user who is permitted to modify the runtime file from using Exim as a way |
|
30933 + to get root. |
|
30934 + |
|
30935 +52.2Â Root privilege |
|
30936 + |
|
30937 +The Exim binary is normally setuid to root, which means that it gains root |
|
30938 +privilege (runs as root) when it starts execution. In some special cases (for |
|
30939 +example, when the daemon is not in use and there are no local deliveries), it |
|
30940 +may be possible to run Exim setuid to some user other than root. This is |
|
30941 +discussed in the next section. However, in most installations, root privilege |
|
30942 +is required for two things: |
|
30943 + |
|
30944 + * To set up a socket connected to the standard SMTP port (25) when |
|
30945 + initialising the listening daemon. If Exim is run from inetd, this |
|
30946 + privileged action is not required. |
|
30947 + |
|
30948 + * To be able to change uid and gid in order to read users' .forward files and |
|
30949 + perform local deliveries as the receiving user or as specified in the |
|
30950 + configuration. |
|
30951 + |
|
30952 +It is not necessary to be root to do any of the other things Exim does, such as |
|
30953 +receiving messages and delivering them externally over SMTP, and it is |
|
30954 +obviously more secure if Exim does not run as root except when necessary. For |
|
30955 +this reason, a user and group for Exim to use must be defined in Local/Makefile |
|
30956 +. These are known as "the Exim user" and "the Exim group". Their values can be |
|
30957 +changed by the run time configuration, though this is not recommended. Often a |
|
30958 +user called exim is used, but some sites use mail or another user name |
|
30959 +altogether. |
|
30960 + |
|
30961 +Exim uses setuid() whenever it gives up root privilege. This is a permanent |
|
30962 +abdication; the process cannot regain root afterwards. Prior to release 4.00, |
|
30963 +seteuid() was used in some circumstances, but this is no longer the case. |
|
30964 + |
|
30965 +After a new Exim process has interpreted its command line options, it changes |
|
30966 +uid and gid in the following cases: |
|
30967 + |
|
30968 + * If the -C option is used to specify an alternate configuration file, or if |
|
30969 + the -D option is used to define macro values for the configuration, and the |
|
30970 + calling process is not running as root, the uid and gid are changed to |
|
30971 + those of the calling process. However, if DISABLE_D_OPTION is defined in |
|
30972 + Local/Makefile, the -D option may not be used at all. If WHITELIST_D_MACROS |
|
30973 + is defined in Local/Makefile, then some macro values can be supplied if the |
|
30974 + calling process is running as root, the Exim run-time user or |
|
30975 + CONFIGURE_OWNER, if defined. |
|
30976 + |
|
30977 + * If the expansion test option (-be) or one of the filter testing options ( |
|
30978 + -bf or -bF) are used, the uid and gid are changed to those of the calling |
|
30979 + process. |
|
30980 + |
|
30981 + * If the process is not a daemon process or a queue runner process or a |
|
30982 + delivery process or a process for testing address routing (started with -bt |
|
30983 + ), the uid and gid are changed to the Exim user and group. This means that |
|
30984 + Exim always runs under its own uid and gid when receiving messages. This |
|
30985 + also applies when testing address verification (the -bv option) and testing |
|
30986 + incoming message policy controls (the -bh option). |
|
30987 + |
|
30988 + * For a daemon, queue runner, delivery, or address testing process, the uid |
|
30989 + remains as root at this stage, but the gid is changed to the Exim group. |
|
30990 + |
|
30991 +The processes that initially retain root privilege behave as follows: |
|
30992 + |
|
30993 + * A daemon process changes the gid to the Exim group and the uid to the Exim |
|
30994 + user after setting up one or more listening sockets. The initgroups() |
|
30995 + function is called, so that if the Exim user is in any additional groups, |
|
30996 + they will be used during message reception. |
|
30997 + |
|
30998 + * A queue runner process retains root privilege throughout its execution. Its |
|
30999 + job is to fork a controlled sequence of delivery processes. |
|
31000 + |
|
31001 + * A delivery process retains root privilege throughout most of its execution, |
|
31002 + but any actual deliveries (that is, the transports themselves) are run in |
|
31003 + subprocesses which always change to a non-root uid and gid. For local |
|
31004 + deliveries this is typically the uid and gid of the owner of the mailbox; |
|
31005 + for remote deliveries, the Exim uid and gid are used. Once all the delivery |
|
31006 + subprocesses have been run, a delivery process changes to the Exim uid and |
|
31007 + gid while doing post-delivery tidying up such as updating the retry |
|
31008 + database and generating bounce and warning messages. |
|
31009 + |
|
31010 + While the recipient addresses in a message are being routed, the delivery |
|
31011 + process runs as root. However, if a user's filter file has to be processed, |
|
31012 + this is done in a subprocess that runs under the individual user's uid and |
|
31013 + gid. A system filter is run as root unless system_filter_user is set. |
|
31014 + |
|
31015 + * A process that is testing addresses (the -bt option) runs as root so that |
|
31016 + the routing is done in the same environment as a message delivery. |
|
31017 + |
|
31018 +52.3Â Running Exim without privilege |
|
31019 + |
|
31020 +Some installations like to run Exim in an unprivileged state for more of its |
|
31021 +operation, for added security. Support for this mode of operation is provided |
|
31022 +by the global option deliver_drop_privilege. When this is set, the uid and gid |
|
31023 +are changed to the Exim user and group at the start of a delivery process (and |
|
31024 +also queue runner and address testing processes). This means that address |
|
31025 +routing is no longer run as root, and the deliveries themselves cannot change |
|
31026 +to any other uid. |
|
31027 + |
|
31028 +Leaving the binary setuid to root, but setting deliver_drop_privilege means |
|
31029 +that the daemon can still be started in the usual way, and it can respond |
|
31030 +correctly to SIGHUP because the re-invocation regains root privilege. |
|
31031 + |
|
31032 +An alternative approach is to make Exim setuid to the Exim user and also setgid |
|
31033 +to the Exim group. If you do this, the daemon must be started from a root |
|
31034 +process. (Calling Exim from a root process makes it behave in the way it does |
|
31035 +when it is setuid root.) However, the daemon cannot restart itself after a |
|
31036 +SIGHUP signal because it cannot regain privilege. |
|
31037 + |
|
31038 +It is still useful to set deliver_drop_privilege in this case, because it stops |
|
31039 +Exim from trying to re-invoke itself to do a delivery after a message has been |
|
31040 +received. Such a re-invocation is a waste of resources because it has no |
|
31041 +effect. |
|
31042 + |
|
31043 +If restarting the daemon is not an issue (for example, if mua_wrapper is set, |
|
31044 +or inetd is being used instead of a daemon), having the binary setuid to the |
|
31045 +Exim user seems a clean approach, but there is one complication: |
|
31046 + |
|
31047 +In this style of operation, Exim is running with the real uid and gid set to |
|
31048 +those of the calling process, and the effective uid/gid set to Exim's values. |
|
31049 +Ideally, any association with the calling process' uid/gid should be dropped, |
|
31050 +that is, the real uid/gid should be reset to the effective values so as to |
|
31051 +discard any privileges that the caller may have. While some operating systems |
|
31052 +have a function that permits this action for a non-root effective uid, quite a |
|
31053 +number of them do not. Because of this lack of standardization, Exim does not |
|
31054 +address this problem at this time. |
|
31055 + |
|
31056 +For this reason, the recommended approach for "mostly unprivileged" running is |
|
31057 +to keep the Exim binary setuid to root, and to set deliver_drop_privilege. This |
|
31058 +also has the advantage of allowing a daemon to be used in the most |
|
31059 +straightforward way. |
|
31060 + |
|
31061 +If you configure Exim not to run delivery processes as root, there are a number |
|
31062 +of restrictions on what you can do: |
|
31063 + |
|
31064 + * You can deliver only as the Exim user/group. You should explicitly use the |
|
31065 + user and group options to override routers or local transports that |
|
31066 + normally deliver as the recipient. This makes sure that configurations that |
|
31067 + work in this mode function the same way in normal mode. Any implicit or |
|
31068 + explicit specification of another user causes an error. |
|
31069 + |
|
31070 + * Use of .forward files is severely restricted, such that it is usually not |
|
31071 + worthwhile to include them in the configuration. |
|
31072 + |
|
31073 + * Users who wish to use .forward would have to make their home directory and |
|
31074 + the file itself accessible to the Exim user. Pipe and append-to-file |
|
31075 + entries, and their equivalents in Exim filters, cannot be used. While they |
|
31076 + could be enabled in the Exim user's name, that would be insecure and not |
|
31077 + very useful. |
|
31078 + |
|
31079 + * Unless the local user mailboxes are all owned by the Exim user (possible in |
|
31080 + some POP3 or IMAP-only environments): |
|
31081 + |
|
31082 + 1. They must be owned by the Exim group and be writeable by that group. |
|
31083 + This implies you must set mode in the appendfile configuration, as well |
|
31084 + as the mode of the mailbox files themselves. |
|
31085 + |
|
31086 + 2. You must set no_check_owner, since most or all of the files will not be |
|
31087 + owned by the Exim user. |
|
31088 + |
|
31089 + 3. You must set file_must_exist, because Exim cannot set the owner |
|
31090 + correctly on a newly created mailbox when unprivileged. This also |
|
31091 + implies that new mailboxes need to be created manually. |
|
31092 + |
|
31093 +These restrictions severely restrict what can be done in local deliveries. |
|
31094 +However, there are no restrictions on remote deliveries. If you are running a |
|
31095 +gateway host that does no local deliveries, setting deliver_drop_privilege |
|
31096 +gives more security at essentially no cost. |
|
31097 + |
|
31098 +If you are using the mua_wrapper facility (see chapter 48), |
|
31099 +deliver_drop_privilege is forced to be true. |
|
31100 + |
|
31101 +52.4Â Delivering to local files |
|
31102 + |
|
31103 +Full details of the checks applied by appendfile before it writes to a file are |
|
31104 +given in chapter 26. |
|
31105 + |
|
31106 +52.5Â IPv4 source routing |
|
31107 + |
|
31108 +Many operating systems suppress IP source-routed packets in the kernel, but |
|
31109 +some cannot be made to do this, so Exim does its own check. It logs incoming |
|
31110 +IPv4 source-routed TCP calls, and then drops them. Things are all different in |
|
31111 +IPv6. No special checking is currently done. |
|
31112 + |
|
31113 +52.6Â The VRFY, EXPN, and ETRN commands in SMTP |
|
31114 + |
|
31115 +Support for these SMTP commands is disabled by default. If required, they can |
|
31116 +be enabled by defining suitable ACLs. |
|
31117 + |
|
31118 +52.7Â Privileged users |
|
31119 + |
|
31120 +Exim recognizes two sets of users with special privileges. Trusted users are |
|
31121 +able to submit new messages to Exim locally, but supply their own sender |
|
31122 +addresses and information about a sending host. For other users submitting |
|
31123 +local messages, Exim sets up the sender address from the uid, and doesn't |
|
31124 +permit a remote host to be specified. |
|
31125 + |
|
31126 +However, an untrusted user is permitted to use the -f command line option in |
|
31127 +the special form -f <> to indicate that a delivery failure for the message |
|
31128 +should not cause an error report. This affects the message's envelope, but it |
|
31129 +does not affect the Sender: header. Untrusted users may also be permitted to |
|
31130 +use specific forms of address with the -f option by setting the |
|
31131 +untrusted_set_sender option. |
|
31132 + |
|
31133 +Trusted users are used to run processes that receive mail messages from some |
|
31134 +other mail domain and pass them on to Exim for delivery either locally, or over |
|
31135 +the Internet. Exim trusts a caller that is running as root, as the Exim user, |
|
31136 +as any user listed in the trusted_users configuration option, or under any |
|
31137 +group listed in the trusted_groups option. |
|
31138 + |
|
31139 +Admin users are permitted to do things to the messages on Exim's queue. They |
|
31140 +can freeze or thaw messages, cause them to be returned to their senders, remove |
|
31141 +them entirely, or modify them in various ways. In addition, admin users can run |
|
31142 +the Exim monitor and see all the information it is capable of providing, which |
|
31143 +includes the contents of files on the spool. |
|
31144 + |
|
31145 +By default, the use of the -M and -q options to cause Exim to attempt delivery |
|
31146 +of messages on its queue is restricted to admin users. This restriction can be |
|
31147 +relaxed by setting the no_prod_requires_admin option. Similarly, the use of -bp |
|
31148 +(and its variants) to list the contents of the queue is also restricted to |
|
31149 +admin users. This restriction can be relaxed by setting |
|
31150 +no_queue_list_requires_admin. |
|
31151 + |
|
31152 +Exim recognizes an admin user if the calling process is running as root or as |
|
31153 +the Exim user or if any of the groups associated with the calling process is |
|
31154 +the Exim group. It is not necessary actually to be running under the Exim |
|
31155 +group. However, if admin users who are not root or the Exim user are to access |
|
31156 +the contents of files on the spool via the Exim monitor (which runs |
|
31157 +unprivileged), Exim must be built to allow group read access to its spool |
|
31158 +files. |
|
31159 + |
|
31160 +52.8Â Spool files |
|
31161 + |
|
31162 +Exim's spool directory and everything it contains is owned by the Exim user and |
|
31163 +set to the Exim group. The mode for spool files is defined in the Local/ |
|
31164 +Makefile configuration file, and defaults to 0640. This means that any user who |
|
31165 +is a member of the Exim group can access these files. |
|
31166 + |
|
31167 +52.9Â Use of argv[0] |
|
31168 + |
|
31169 +Exim examines the last component of argv[0], and if it matches one of a set of |
|
31170 +specific strings, Exim assumes certain options. For example, calling Exim with |
|
31171 +the last component of argv[0] set to "rsmtp" is exactly equivalent to calling |
|
31172 +it with the option -bS. There are no security implications in this. |
|
31173 + |
|
31174 +52.10Â Use of %f formatting |
|
31175 + |
|
31176 +The only use made of "%f" by Exim is in formatting load average values. These |
|
31177 +are actually stored in integer variables as 1000 times the load average. |
|
31178 +Consequently, their range is limited and so therefore is the length of the |
|
31179 +converted output. |
|
31180 + |
|
31181 +52.11Â Embedded Exim path |
|
31182 + |
|
31183 +Exim uses its own path name, which is embedded in the code, only when it needs |
|
31184 +to re-exec in order to regain root privilege. Therefore, it is not root when it |
|
31185 +does so. If some bug allowed the path to get overwritten, it would lead to an |
|
31186 +arbitrary program's being run as exim, not as root. |
|
31187 + |
|
31188 +52.12Â Dynamic module directory |
|
31189 + |
|
31190 +Any dynamically loadable modules must be installed into the directory defined |
|
31191 +in "LOOKUP_MODULE_DIR" in Local/Makefile for Exim to permit loading it. |
|
31192 + |
|
31193 +52.13Â Use of sprintf() |
|
31194 + |
|
31195 +A large number of occurrences of "sprintf" in the code are actually calls to |
|
31196 +string_sprintf(), a function that returns the result in malloc'd store. The |
|
31197 +intermediate formatting is done into a large fixed buffer by a function that |
|
31198 +runs through the format string itself, and checks the length of each conversion |
|
31199 +before performing it, thus preventing buffer overruns. |
|
31200 + |
|
31201 +The remaining uses of sprintf() happen in controlled circumstances where the |
|
31202 +output buffer is known to be sufficiently long to contain the converted string. |
|
31203 + |
|
31204 +52.14Â Use of debug_printf() and log_write() |
|
31205 + |
|
31206 +Arbitrary strings are passed to both these functions, but they do their |
|
31207 +formatting by calling the function string_vformat(), which runs through the |
|
31208 +format string itself, and checks the length of each conversion. |
|
31209 + |
|
31210 +52.15Â Use of strcat() and strcpy() |
|
31211 + |
|
31212 +These are used only in cases where the output buffer is known to be large |
|
31213 +enough to hold the result. |
|
31214 + |
|
31215 +53. Format of spool files |
|
31216 + |
|
31217 +A message on Exim's queue consists of two files, whose names are the message id |
|
31218 +followed by -D and -H, respectively. The data portion of the message is kept in |
|
31219 +the -D file on its own. The message's envelope, status, and headers are all |
|
31220 +kept in the -H file, whose format is described in this chapter. Each of these |
|
31221 +two files contains the final component of its own name as its first line. This |
|
31222 +is insurance against disk crashes where the directory is lost but the files |
|
31223 +themselves are recoverable. |
|
31224 + |
|
31225 +Some people are tempted into editing -D files in order to modify messages. You |
|
31226 +need to be extremely careful if you do this; it is not recommended and you are |
|
31227 +on your own if you do it. Here are some of the pitfalls: |
|
31228 + |
|
31229 + * You must ensure that Exim does not try to deliver the message while you are |
|
31230 + fiddling with it. The safest way is to take out a write lock on the -D |
|
31231 + file, which is what Exim itself does, using fcntl(). If you update the file |
|
31232 + in place, the lock will be retained. If you write a new file and rename it, |
|
31233 + the lock will be lost at the instant of rename. |
|
31234 + |
|
31235 + * If you change the number of lines in the file, the value of $body_linecount |
|
31236 + , which is stored in the -H file, will be incorrect. At present, this value |
|
31237 + is not used by Exim, but there is no guarantee that this will always be the |
|
31238 + case. |
|
31239 + |
|
31240 + * If the message is in MIME format, you must take care not to break it. |
|
31241 + |
|
31242 + * If the message is cryptographically signed, any change will invalidate the |
|
31243 + signature. |
|
31244 + |
|
31245 +All in all, modifying -D files is fraught with danger. |
|
31246 + |
|
31247 +Files whose names end with -J may also be seen in the input directory (or its |
|
31248 +subdirectories when split_spool_directory is set). These are journal files, |
|
31249 +used to record addresses to which the message has been delivered during the |
|
31250 +course of a delivery attempt. If there are still undelivered recipients at the |
|
31251 +end, the -H file is updated, and the -J file is deleted. If, however, there is |
|
31252 +some kind of crash (for example, a power outage) before this happens, the -J |
|
31253 +file remains in existence. When Exim next processes the message, it notices the |
|
31254 +-J file and uses it to update the -H file before starting the next delivery |
|
31255 +attempt. |
|
31256 + |
|
31257 +53.1Â Format of the -H file |
|
31258 + |
|
31259 +The second line of the -H file contains the login name for the uid of the |
|
31260 +process that called Exim to read the message, followed by the numerical uid and |
|
31261 +gid. For a locally generated message, this is normally the user who sent the |
|
31262 +message. For a message received over TCP/IP via the daemon, it is normally the |
|
31263 +Exim user. |
|
31264 + |
|
31265 +The third line of the file contains the address of the message's sender as |
|
31266 +transmitted in the envelope, contained in angle brackets. The sender address is |
|
31267 +empty for bounce messages. For incoming SMTP mail, the sender address is given |
|
31268 +in the MAIL command. For locally generated mail, the sender address is created |
|
31269 +by Exim from the login name of the current user and the configured |
|
31270 +qualify_domain. However, this can be overridden by the -f option or a leading |
|
31271 +"From " line if the caller is trusted, or if the supplied address is "<>" or |
|
31272 +an address that matches untrusted_set_senders. |
|
31273 + |
|
31274 +The fourth line contains two numbers. The first is the time that the message |
|
31275 +was received, in the conventional Unix form - the number of seconds since the |
|
31276 +start of the epoch. The second number is a count of the number of messages |
|
31277 +warning of delayed delivery that have been sent to the sender. |
|
31278 + |
|
31279 +There follow a number of lines starting with a hyphen. These can appear in any |
|
31280 +order, and are omitted when not relevant: |
|
31281 + |
|
31282 +-acl <number> <length> |
|
31283 + |
|
31284 + This item is obsolete, and is not generated from Exim release 4.61 onwards; |
|
31285 + -aclc and -aclm are used instead. However, -acl is still recognized, to |
|
31286 + provide backward compatibility. In the old format, a line of this form is |
|
31287 + present for every ACL variable that is not empty. The number identifies the |
|
31288 + variable; the acl_cx variables are numbered 0-9 and the acl_mx variables |
|
31289 + are numbered 10-19. The length is the length of the data string for the |
|
31290 + variable. The string itself starts at the beginning of the next line, and |
|
31291 + is followed by a newline character. It may contain internal newlines. |
|
31292 + |
|
31293 +-aclc <rest-of-name> <length> |
|
31294 + |
|
31295 + A line of this form is present for every ACL connection variable that is |
|
31296 + defined. Note that there is a space between -aclc and the rest of the name. |
|
31297 + The length is the length of the data string for the variable. The string |
|
31298 + itself starts at the beginning of the next line, and is followed by a |
|
31299 + newline character. It may contain internal newlines. |
|
31300 + |
|
31301 +-aclm <rest-of-name> <length> |
|
31302 + |
|
31303 + A line of this form is present for every ACL message variable that is |
|
31304 + defined. Note that there is a space between -aclm and the rest of the name. |
|
31305 + The length is the length of the data string for the variable. The string |
|
31306 + itself starts at the beginning of the next line, and is followed by a |
|
31307 + newline character. It may contain internal newlines. |
|
31308 + |
|
31309 +-active_hostname <hostname> |
|
31310 + |
|
31311 + This is present if, when the message was received over SMTP, the value of |
|
31312 + $smtp_active_hostname was different to the value of $primary_hostname. |
|
31313 + |
|
31314 +-allow_unqualified_recipient |
|
31315 + |
|
31316 + This is present if unqualified recipient addresses are permitted in header |
|
31317 + lines (to stop such addresses from being qualified if rewriting occurs at |
|
31318 + transport time). Local messages that were input using -bnq and remote |
|
31319 + messages from hosts that match recipient_unqualified_hosts set this flag. |
|
31320 + |
|
31321 +-allow_unqualified_sender |
|
31322 + |
|
31323 + This is present if unqualified sender addresses are permitted in header |
|
31324 + lines (to stop such addresses from being qualified if rewriting occurs at |
|
31325 + transport time). Local messages that were input using -bnq and remote |
|
31326 + messages from hosts that match sender_unqualified_hosts set this flag. |
|
31327 + |
|
31328 +-auth_id <text> |
|
31329 + |
|
31330 + The id information for a message received on an authenticated SMTP |
|
31331 + connection - the value of the $authenticated_id variable. |
|
31332 + |
|
31333 +-auth_sender <address> |
|
31334 + |
|
31335 + The address of an authenticated sender - the value of the |
|
31336 + $authenticated_sender variable. |
|
31337 + |
|
31338 +-body_linecount <number> |
|
31339 + |
|
31340 + This records the number of lines in the body of the message, and is always |
|
31341 + present. |
|
31342 + |
|
31343 +-body_zerocount <number> |
|
31344 + |
|
31345 + This records the number of binary zero bytes in the body of the message, |
|
31346 + and is present if the number is greater than zero. |
|
31347 + |
|
31348 +-deliver_firsttime |
|
31349 + |
|
31350 + This is written when a new message is first added to the spool. When the |
|
31351 + spool file is updated after a deferral, it is omitted. |
|
31352 + |
|
31353 +-frozen <time> |
|
31354 + |
|
31355 + The message is frozen, and the freezing happened at <time>. |
|
31356 + |
|
31357 +-helo_name <text> |
|
31358 + |
|
31359 + This records the host name as specified by a remote host in a HELO or EHLO |
|
31360 + command. |
|
31361 + |
|
31362 +-host_address <address>.<port> |
|
31363 + |
|
31364 + This records the IP address of the host from which the message was received |
|
31365 + and the remote port number that was used. It is omitted for locally |
|
31366 + generated messages. |
|
31367 + |
|
31368 +-host_auth <text> |
|
31369 + |
|
31370 + If the message was received on an authenticated SMTP connection, this |
|
31371 + records the name of the authenticator - the value of the |
|
31372 + $sender_host_authenticated variable. |
|
31373 + |
|
31374 +-host_lookup_failed |
|
31375 + |
|
31376 + This is present if an attempt to look up the sending host's name from its |
|
31377 + IP address failed. It corresponds to the $host_lookup_failed variable. |
|
31378 + |
|
31379 +-host_name <text> |
|
31380 + |
|
31381 + This records the name of the remote host from which the message was |
|
31382 + received, if the host name was looked up from the IP address when the |
|
31383 + message was being received. It is not present if no reverse lookup was |
|
31384 + done. |
|
31385 + |
|
31386 +-ident <text> |
|
31387 + |
|
31388 + For locally submitted messages, this records the login of the originating |
|
31389 + user, unless it was a trusted user and the -oMt option was used to specify |
|
31390 + an ident value. For messages received over TCP/IP, this records the ident |
|
31391 + string supplied by the remote host, if any. |
|
31392 + |
|
31393 +-interface_address <address>.<port> |
|
31394 + |
|
31395 + This records the IP address of the local interface and the port number |
|
31396 + through which a message was received from a remote host. It is omitted for |
|
31397 + locally generated messages. |
|
31398 + |
|
31399 +-local |
|
31400 + |
|
31401 + The message is from a local sender. |
|
31402 + |
|
31403 +-localerror |
|
31404 + |
|
31405 + The message is a locally-generated bounce message. |
|
31406 + |
|
31407 +-local_scan <string> |
|
31408 + |
|
31409 + This records the data string that was returned by the local_scan() function |
|
31410 + when the message was received - the value of the $local_scan_data variable. |
|
31411 + It is omitted if no data was returned. |
|
31412 + |
|
31413 +-manual_thaw |
|
31414 + |
|
31415 + The message was frozen but has been thawed manually, that is, by an |
|
31416 + explicit Exim command rather than via the auto-thaw process. |
|
31417 + |
|
31418 +-N |
|
31419 + |
|
31420 + A testing delivery process was started using the -N option to suppress any |
|
31421 + actual deliveries, but delivery was deferred. At any further delivery |
|
31422 + attempts, -N is assumed. |
|
31423 + |
|
31424 +-received_protocol |
|
31425 + |
|
31426 + This records the value of the $received_protocol variable, which contains |
|
31427 + the name of the protocol by which the message was received. |
|
31428 + |
|
31429 +-sender_set_untrusted |
|
31430 + |
|
31431 + The envelope sender of this message was set by an untrusted local caller |
|
31432 + (used to ensure that the caller is displayed in queue listings). |
|
31433 + |
|
31434 +-spam_score_int <number> |
|
31435 + |
|
31436 + If a message was scanned by SpamAssassin, this is present. It records the |
|
31437 + value of $spam_score_int. |
|
31438 + |
|
31439 +-tls_certificate_verified |
|
31440 + |
|
31441 + A TLS certificate was received from the client that sent this message, and |
|
31442 + the certificate was verified by the server. |
|
31443 + |
|
31444 +-tls_cipher <cipher name> |
|
31445 + |
|
31446 + When the message was received over an encrypted connection, this records |
|
31447 + the name of the cipher suite that was used. |
|
31448 + |
|
31449 +-tls_peerdn <peer DN> |
|
31450 + |
|
31451 + When the message was received over an encrypted connection, and a |
|
31452 + certificate was received from the client, this records the Distinguished |
|
31453 + Name from that certificate. |
|
31454 + |
|
31455 +Following the options there is a list of those addresses to which the message |
|
31456 +is not to be delivered. This set of addresses is initialized from the command |
|
31457 +line when the -t option is used and extract_addresses_remove_arguments is set; |
|
31458 +otherwise it starts out empty. Whenever a successful delivery is made, the |
|
31459 +address is added to this set. The addresses are kept internally as a balanced |
|
31460 +binary tree, and it is a representation of that tree which is written to the |
|
31461 +spool file. If an address is expanded via an alias or forward file, the |
|
31462 +original address is added to the tree when deliveries to all its child |
|
31463 +addresses are complete. |
|
31464 + |
|
31465 +If the tree is empty, there is a single line in the spool file containing just |
|
31466 +the text "XX". Otherwise, each line consists of two letters, which are either Y |
|
31467 +or N, followed by an address. The address is the value for the node of the |
|
31468 +tree, and the letters indicate whether the node has a left branch and/or a |
|
31469 +right branch attached to it, respectively. If branches exist, they immediately |
|
31470 +follow. Here is an example of a three-node tree: |
|
31471 + |
|
31472 +YY darcy@austen.fict.example |
|
31473 +NN alice@wonderland.fict.example |
|
31474 +NN editor@thesaurus.ref.example |
|
31475 + |
|
31476 +After the non-recipients tree, there is a list of the message's recipients. |
|
31477 +This is a simple list, preceded by a count. It includes all the original |
|
31478 +recipients of the message, including those to whom the message has already been |
|
31479 +delivered. In the simplest case, the list contains one address per line. For |
|
31480 +example: |
|
31481 + |
|
31482 +4 |
|
31483 +editor@thesaurus.ref.example |
|
31484 +darcy@austen.fict.example |
|
31485 +rdo@foundation |
|
31486 +alice@wonderland.fict.example |
|
31487 + |
|
31488 +However, when a child address has been added to the top-level addresses as a |
|
31489 +result of the use of the one_time option on a redirect router, each line is of |
|
31490 +the following form: |
|
31491 + |
|
31492 +<top-level address> <errors_to address> <length>,<parent number>#< |
|
31493 +flag bits> |
|
31494 + |
|
31495 +The 01 flag bit indicates the presence of the three other fields that follow |
|
31496 +the top-level address. Other bits may be used in future to support additional |
|
31497 +fields. The <parent number> is the offset in the recipients list of the |
|
31498 +original parent of the "one time" address. The first two fields are the |
|
31499 +envelope sender that is associated with this address and its length. If the |
|
31500 +length is zero, there is no special envelope sender (there are then two space |
|
31501 +characters in the line). A non-empty field can arise from a redirect router |
|
31502 +that has an errors_to setting. |
|
31503 + |
|
31504 +A blank line separates the envelope and status information from the headers |
|
31505 +which follow. A header may occupy several lines of the file, and to save effort |
|
31506 +when reading it in, each header is preceded by a number and an identifying |
|
31507 +character. The number is the number of characters in the header, including any |
|
31508 +embedded newlines and the terminating newline. The character is one of the |
|
31509 +following: |
|
31510 + |
|
31511 +<blank> header in which Exim has no special interest |
|
31512 +"B" Bcc: header |
|
31513 +"C" Cc: header |
|
31514 +"F" From: header |
|
31515 +"I" Message-id: header |
|
31516 +"P" Received: header - P for "postmark" |
|
31517 +"R" Reply-To: header |
|
31518 +"S" Sender: header |
|
31519 +"T" To: header |
|
31520 +"*" replaced or deleted header |
|
31521 + |
|
31522 +Deleted or replaced (rewritten) headers remain in the spool file for debugging |
|
31523 +purposes. They are not transmitted when the message is delivered. Here is a |
|
31524 +typical set of headers: |
|
31525 + |
|
31526 +111P Received: by hobbit.fict.example with local (Exim 4.00) |
|
31527 +id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100 |
|
31528 +049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example> |
|
31529 +038* X-rewrote-sender: bb@hobbit.fict.example |
|
31530 +042* From: Bilbo Baggins <bb@hobbit.fict.example> |
|
31531 +049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example> |
|
31532 +099* To: alice@wonderland.fict.example, rdo@foundation, |
|
31533 +darcy@austen.fict.example, editor@thesaurus.ref.example |
|
31534 +104T To: alice@wonderland.fict.example, rdo@foundation.example, |
|
31535 +darcy@austen.fict.example, editor@thesaurus.ref.example |
|
31536 +038 Date: Fri, 11 May 2001 10:28:59 +0100 |
|
31537 + |
|
31538 +The asterisked headers indicate that the envelope sender, From: header, and To: |
|
31539 +header have been rewritten, the last one because routing expanded the |
|
31540 +unqualified domain foundation. |
|
31541 + |
|
31542 +54. Support for DKIM (DomainKeys Identified Mail) - RFC4871 |
|
31543 + |
|
31544 +Since version 4.70, DKIM support is compiled into Exim by default. It can be |
|
31545 +disabled by setting DISABLE_DKIM=yes in Local/Makefile. |
|
31546 + |
|
31547 +Exim's DKIM implementation allows to |
|
31548 + |
|
31549 + 1. Sign outgoing messages: This function is implemented in the SMTP transport. |
|
31550 + It can co-exist with all other Exim features, including transport filters. |
|
31551 + |
|
31552 + 2. Verify signatures in incoming messages: This is implemented by an |
|
31553 + additional ACL (acl_smtp_dkim), which can be called several times per |
|
31554 + message, with different signature contexts. |
|
31555 + |
|
31556 +In typical Exim style, the verification implementation does not include any |
|
31557 +default "policy". Instead it enables you to build your own policy using Exim's |
|
31558 +standard controls. |
|
31559 + |
|
31560 +Please note that verification of DKIM signatures in incoming mail is turned on |
|
31561 +by default for logging purposes. For each signature in incoming email, exim |
|
31562 +will log a line displaying the most important signature details, and the |
|
31563 +signature status. Here is an example: |
|
31564 + |
|
31565 +2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM: d=facebookmail.com s=q1-2009b c=relaxed/relaxed a=rsa-sha1 i=@facebookmail.com t=1252484542 [verification succeeded] |
|
31566 + |
|
31567 +You might want to turn off DKIM verification processing entirely for internal |
|
31568 +or relay mail sources. To do that, set the dkim_disable_verify ACL control |
|
31569 +modifier. This should typically be done in the RCPT ACL, at points where you |
|
31570 +accept mail from relay sources (internal hosts or authenticated senders). |
|
31571 + |
|
31572 +54.1Â Signing outgoing messages |
|
31573 + |
|
31574 +Signing is implemented by setting private options on the SMTP transport. These |
|
31575 +options take (expandable) strings as arguments. |
|
31576 + |
|
31577 ++--------------------------------------------------+ |
|
31578 +|dkim_domain|Use: smtp|Type: string*|Default: unset| |
|
31579 ++--------------------------------------------------+ |
|
31580 + |
|
31581 +MANDATORY: The domain you want to sign with. The result of this expanded option |
|
31582 +is put into the $dkim_domain expansion variable. |
|
31583 + |
|
31584 ++----------------------------------------------------+ |
|
31585 +|dkim_selector|Use: smtp|Type: string*|Default: unset| |
|
31586 ++----------------------------------------------------+ |
|
31587 + |
|
31588 +MANDATORY: This sets the key selector string. You can use the $dkim_domain |
|
31589 +expansion variable to look up a matching selector. The result is put in the |
|
31590 +expansion variable $dkim_selector which should be used in the dkim_private_key |
|
31591 +option along with $dkim_domain. |
|
31592 + |
|
31593 ++-------------------------------------------------------+ |
|
31594 +|dkim_private_key|Use: smtp|Type: string*|Default: unset| |
|
31595 ++-------------------------------------------------------+ |
|
31596 + |
|
31597 +MANDATORY: This sets the private key to use. You can use the $dkim_domain and |
|
31598 +$dkim_selector expansion variables to determine the private key to use. The |
|
31599 +result can either |
|
31600 + |
|
31601 + * be a valid RSA private key in ASCII armor, including line breaks. |
|
31602 + |
|
31603 + * start with a slash, in which case it is treated as a file that contains the |
|
31604 + private key. |
|
31605 + |
|
31606 + * be "0", "false" or the empty string, in which case the message will not be |
|
31607 + signed. This case will not result in an error, even if dkim_strict is set. |
|
31608 + |
|
31609 ++-------------------------------------------------+ |
|
31610 +|dkim_canon|Use: smtp|Type: string*|Default: unset| |
|
31611 ++-------------------------------------------------+ |
|
31612 + |
|
31613 +OPTIONAL: This option sets the canonicalization method used when signing a |
|
31614 +message. The DKIM RFC currently supports two methods: "simple" and "relaxed". |
|
31615 +The option defaults to "relaxed" when unset. Note: the current implementation |
|
31616 +only supports using the same canonicalization method for both headers and body. |
|
31617 + |
|
31618 ++--------------------------------------------------+ |
|
31619 +|dkim_strict|Use: smtp|Type: string*|Default: unset| |
|
31620 ++--------------------------------------------------+ |
|
31621 + |
|
31622 +OPTIONAL: This option defines how Exim behaves when signing a message that |
|
31623 +should be signed fails for some reason. When the expansion evaluates to either |
|
31624 +"1" or "true", Exim will defer. Otherwise Exim will send the message unsigned. |
|
31625 +You can use the $dkim_domain and $dkim_selector expansion variables here. |
|
31626 + |
|
31627 ++--------------------------------------------------------+ |
|
31628 +|dkim_sign_headers|Use: smtp|Type: string*|Default: unset| |
|
31629 ++--------------------------------------------------------+ |
|
31630 + |
|
31631 +OPTIONAL: When set, this option must expand to (or be specified as) a |
|
31632 +colon-separated list of header names. Headers with these names will be included |
|
31633 +in the message signature. When unspecified, the header names recommended in |
|
31634 +RFC4871 will be used. |
|
31635 + |
|
31636 +54.2Â Verifying DKIM signatures in incoming mail |
|
31637 + |
|
31638 +Verification of DKIM signatures in incoming email is implemented via the |
|
31639 +acl_smtp_dkim ACL. By default, this ACL is called once for each syntactically |
|
31640 +(!) correct signature in the incoming message. |
|
31641 + |
|
31642 +To evaluate the signature in the ACL a large number of expansion variables |
|
31643 +containing the signature status and its details are set up during the runtime |
|
31644 +of the ACL. |
|
31645 + |
|
31646 +Calling the ACL only for existing signatures is not sufficient to build more |
|
31647 +advanced policies. For that reason, the global option dkim_verify_signers, and |
|
31648 +a global expansion variable $dkim_signers exist. |
|
31649 + |
|
31650 +The global option dkim_verify_signers can be set to a colon-separated list of |
|
31651 +DKIM domains or identities for which the ACL acl_smtp_dkim is called. It is |
|
31652 +expanded when the message has been received. At this point, the expansion |
|
31653 +variable $dkim_signers already contains a colon-separated list of signer |
|
31654 +domains and identities for the message. When dkim_verify_signers is not |
|
31655 +specified in the main configuration, it defaults as: |
|
31656 + |
|
31657 +dkim_verify_signers = $dkim_signers |
|
31658 + |
|
31659 +This leads to the default behaviour of calling acl_smtp_dkim for each DKIM |
|
31660 +signature in the message. Current DKIM verifiers may want to explicitly call |
|
31661 +the ACL for known domains or identities. This would be achieved as follows: |
|
31662 + |
|
31663 +dkim_verify_signers = paypal.com:ebay.com:$dkim_signers |
|
31664 + |
|
31665 +This would result in acl_smtp_dkim always being called for "paypal.com" and |
|
31666 +"ebay.com", plus all domains and identities that have signatures in the |
|
31667 +message. You can also be more creative in constructing your policy. For |
|
31668 +example: |
|
31669 + |
|
31670 +dkim_verify_signers = $sender_address_domain:$dkim_signers |
|
31671 + |
|
31672 +If a domain or identity is listed several times in the (expanded) value of |
|
31673 +dkim_verify_signers, the ACL is only called once for that domain or identity. |
|
31674 + |
|
31675 +Inside the acl_smtp_dkim, the following expansion variables are available (from |
|
31676 +most to least important): |
|
31677 + |
|
31678 +$dkim_cur_signer |
|
31679 + |
|
31680 + The signer that is being evaluated in this ACL run. This can be a domain or |
|
31681 + an identity. This is one of the list items from the expanded main option |
|
31682 + dkim_verify_signers (see above). |
|
31683 + |
|
31684 +$dkim_verify_status |
|
31685 + |
|
31686 + A string describing the general status of the signature. One of |
|
31687 + |
|
31688 + * none: There is no signature in the message for the current domain or |
|
31689 + identity (as reflected by $dkim_cur_signer). |
|
31690 + |
|
31691 + * invalid: The signature could not be verified due to a processing error. |
|
31692 + More detail is available in $dkim_verify_reason. |
|
31693 + |
|
31694 + * fail: Verification of the signature failed. More detail is available in |
|
31695 + $dkim_verify_reason. |
|
31696 + |
|
31697 + * pass: The signature passed verification. It is valid. |
|
31698 + |
|
31699 +$dkim_verify_reason |
|
31700 + |
|
31701 + A string giving a litte bit more detail when $dkim_verify_status is either |
|
31702 + "fail" or "invalid". One of |
|
31703 + |
|
31704 + * pubkey_unavailable (when $dkim_verify_status="invalid"): The public key |
|
31705 + for the domain could not be retrieved. This may be a temporary problem. |
|
31706 + |
|
31707 + * pubkey_syntax (when $dkim_verify_status="invalid"): The public key |
|
31708 + record for the domain is syntactically invalid. |
|
31709 + |
|
31710 + * bodyhash_mismatch (when $dkim_verify_status="fail"): The calculated |
|
31711 + body hash does not match the one specified in the signature header. |
|
31712 + This means that the message body was modified in transit. |
|
31713 + |
|
31714 + * signature_incorrect (when $dkim_verify_status="fail"): The signature |
|
31715 + could not be verified. This may mean that headers were modified, |
|
31716 + re-written or otherwise changed in a way which is incompatible with |
|
31717 + DKIM verification. It may of course also mean that the signature is |
|
31718 + forged. |
|
31719 + |
|
31720 +$dkim_domain |
|
31721 + |
|
31722 + The signing domain. IMPORTANT: This variable is only populated if there is |
|
31723 + an actual signature in the message for the current domain or identity (as |
|
31724 + reflected by $dkim_cur_signer). |
|
31725 + |
|
31726 +$dkim_identity |
|
31727 + |
|
31728 + The signing identity, if present. IMPORTANT: This variable is only |
|
31729 + populated if there is an actual signature in the message for the current |
|
31730 + domain or identity (as reflected by $dkim_cur_signer). |
|
31731 + |
|
31732 +$dkim_selector |
|
31733 + |
|
31734 + The key record selector string. |
|
31735 + |
|
31736 +$dkim_algo |
|
31737 + |
|
31738 + The algorithm used. One of 'rsa-sha1' or 'rsa-sha256'. |
|
31739 + |
|
31740 +$dkim_canon_body |
|
31741 + |
|
31742 + The body canonicalization method. One of 'relaxed' or 'simple'. |
|
31743 + |
|
31744 +dkim_canon_headers |
|
31745 + |
|
31746 + The header canonicalization method. One of 'relaxed' or 'simple'. |
|
31747 + |
|
31748 +$dkim_copiedheaders |
|
31749 + |
|
31750 + A transcript of headers and their values which are included in the |
|
31751 + signature (copied from the 'z=' tag of the signature). |
|
31752 + |
|
31753 +$dkim_bodylength |
|
31754 + |
|
31755 + The number of signed body bytes. If zero ("0"), the body is unsigned. If no |
|
31756 + limit was set by the signer, "9999999999999" is returned. This makes sure |
|
31757 + that this variable always expands to an integer value. |
|
31758 + |
|
31759 +$dkim_created |
|
31760 + |
|
31761 + UNIX timestamp reflecting the date and time when the signature was created. |
|
31762 + When this was not specified by the signer, "0" is returned. |
|
31763 + |
|
31764 +$dkim_expires |
|
31765 + |
|
31766 + UNIX timestamp reflecting the date and time when the signer wants the |
|
31767 + signature to be treated as "expired". When this was not specified by the |
|
31768 + signer, "9999999999999" is returned. This makes it possible to do useful |
|
31769 + integer size comparisons against this value. |
|
31770 + |
|
31771 +$dkim_headernames |
|
31772 + |
|
31773 + A colon-separated list of names of headers included in the signature. |
|
31774 + |
|
31775 +$dkim_key_testing |
|
31776 + |
|
31777 + "1" if the key record has the "testing" flag set, "0" if not. |
|
31778 + |
|
31779 +$dkim_key_nosubdomaining |
|
31780 + |
|
31781 + "1" if the key record forbids subdomaining, "0" otherwise. |
|
31782 + |
|
31783 +$dkim_key_srvtype |
|
31784 + |
|
31785 + Service type (tag s=) from the key record. Defaults to "*" if not specified |
|
31786 + in the key record. |
|
31787 + |
|
31788 +$dkim_key_granularity |
|
31789 + |
|
31790 + Key granularity (tag g=) from the key record. Defaults to "*" if not |
|
31791 + specified in the key record. |
|
31792 + |
|
31793 +$dkim_key_notes |
|
31794 + |
|
31795 + Notes from the key record (tag n=). |
|
31796 + |
|
31797 +In addition, two ACL conditions are provided: |
|
31798 + |
|
31799 +dkim_signers |
|
31800 + |
|
31801 + ACL condition that checks a colon-separated list of domains or identities |
|
31802 + for a match against the domain or identity that the ACL is currently |
|
31803 + verifying (reflected by $dkim_cur_signer). This is typically used to |
|
31804 + restrict an ACL verb to a group of domains or identities. For example: |
|
31805 + |
|
31806 + # Warn when message apparently from GMail has no signature at all |
|
31807 + warn log_message = GMail sender without DKIM signature |
|
31808 + sender_domains = gmail.com |
|
31809 + dkim_signers = gmail.com |
|
31810 + dkim_status = none |
|
31811 + |
|
31812 +dkim_status |
|
31813 + |
|
31814 + ACL condition that checks a colon-separated list of possible DKIM |
|
31815 + verification results agains the actual result of verification. This is |
|
31816 + typically used to restrict an ACL verb to a list of verification outcomes, |
|
31817 + like: |
|
31818 + |
|
31819 + deny message = Message from Paypal with invalid or missing signature |
|
31820 + sender_domains = paypal.com:paypal.de |
|
31821 + dkim_signers = paypal.com:paypal.de |
|
31822 + dkim_status = none:invalid:fail |
|
31823 + |
|
31824 + The possible status keywords are: 'none','invalid','fail' and 'pass'. |
|
31825 + Please see the documentation of the $dkim_verify_status expansion variable |
|
31826 + above for more information of what they mean. |
|
31827 + |
|
31828 +55. Adding new drivers or lookup types |
|
31829 + |
|
31830 +The following actions have to be taken in order to add a new router, transport, |
|
31831 +authenticator, or lookup type to Exim: |
|
31832 + |
|
31833 + 1. Choose a name for the driver or lookup type that does not conflict with any |
|
31834 + existing name; I will use "newdriver" in what follows. |
|
31835 + |
|
31836 + 2. Add to src/EDITME the line: |
|
31837 + |
|
31838 + <type>_NEWDRIVER=yes |
|
31839 + |
|
31840 + where <type> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the code is not to |
|
31841 + be included in the binary by default, comment this line out. You should |
|
31842 + also add any relevant comments about the driver or lookup type. |
|
31843 + |
|
31844 + 3. Add to src/config.h.defaults the line: |
|
31845 + |
|
31846 + #define <type>_NEWDRIVER |
|
31847 + |
|
31848 + 4. Edit src/drtables.c, adding conditional code to pull in the private header |
|
31849 + and create a table entry as is done for all the other drivers and lookup |
|
31850 + types. |
|
31851 + |
|
31852 + 5. Edit Makefile in the appropriate sub-directory (src/routers, src/transports |
|
31853 + , src/auths, or src/lookups); add a line for the new driver or lookup type |
|
31854 + and add it to the definition of OBJ. |
|
31855 + |
|
31856 + 6. Create newdriver.h and newdriver.c in the appropriate sub-directory of src. |
|
31857 + |
|
31858 + 7. Edit scripts/MakeLinks and add commands to link the .h and .c files as for |
|
31859 + other drivers and lookups. |
|
31860 + |
|
31861 +Then all you need to do is write the code! A good way to start is to make a |
|
31862 +proforma by copying an existing module of the same type, globally changing all |
|
31863 +occurrences of the name, and cutting out most of the code. Note that any |
|
31864 +options you create must be listed in alphabetical order, because the tables are |
|
31865 +searched using a binary chop procedure. |
|
31866 + |
|
31867 +There is a README file in each of the sub-directories of src describing the |
|
31868 +interface that is expected. |
|
31869 + |