Add acl snippet as a mitigation method
[exim-website.git] / docbook / 4.89 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 07 Mar 2017
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.89</revnumber>
22 <date>07 Mar 2017</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2017
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of the program,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para>
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.89 of Exim.
206 Substantive changes from the 4.88 edition are marked in some
207 renditions of the document; this paragraph is so marked if the rendition is
208 capable of showing a change indicator.
209 </para>
210 <para>
211 This document is very much a reference manual; it is not a tutorial. The reader
212 is expected to have some familiarity with the SMTP mail transfer protocol and
213 with general Unix system administration. Although there are some discussions
214 and examples in places, the information is mostly organized in a way that makes
215 it easy to look up, rather than in a natural order for sequential reading.
216 Furthermore, the manual aims to cover every aspect of Exim in detail, including
217 a number of rarely-used, special-purpose features that are unlikely to be of
218 very wide interest.
219 </para>
220 <para>
221 <indexterm role="concept">
222 <primary>books about Exim</primary>
223 </indexterm>
224 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
225 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
226 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
227 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 This book also contains a chapter that gives a general introduction to SMTP and
231 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
232 with the latest release of Exim. (Note that the earlier book about Exim,
233 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
234 </para>
235 <para>
236 <indexterm role="concept">
237 <primary>Debian</primary>
238 <secondary>information sources</secondary>
239 </indexterm>
240 If you are using a Debian distribution of Exim, you will find information about
241 Debian-specific features in the file
242 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
243 The command <command>man update-exim.conf</command> is another source of Debian-specific
244 information.
245 </para>
246 <para>
247 <indexterm role="concept">
248 <primary><filename>doc/NewStuff</filename></primary>
249 </indexterm>
250 <indexterm role="concept">
251 <primary><filename>doc/ChangeLog</filename></primary>
252 </indexterm>
253 <indexterm role="concept">
254 <primary>change log</primary>
255 </indexterm>
256 As the program develops, there may be features in newer versions that have not
257 yet made it into this document, which is updated only when the most significant
258 digit of the fractional part of the version number changes. Specifications of
259 new features that are not yet in this manual are placed in the file
260 <filename>doc/NewStuff</filename> in the Exim distribution.
261 </para>
262 <para>
263 Some features may be classified as <quote>experimental</quote>. These may change
264 incompatibly while they are developing, or even be withdrawn. For this reason,
265 they are not documented in this manual. Information about experimental features
266 can be found in the file <filename>doc/experimental.txt</filename>.
267 </para>
268 <para>
269 All changes to the program (whether new features, bug fixes, or other kinds of
270 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 </para>
272 <para>
273 <indexterm role="concept">
274 <primary><filename>doc/spec.txt</filename></primary>
275 </indexterm>
276 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
277 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 directory are:
279 </para>
280 <informaltable frame="none">
281 <tgroup cols="2" colsep="0" rowsep="0">
282 <colspec colwidth="100pt" align="left"/>
283 <colspec colwidth="254pt" align="left"/>
284 <tbody>
285 <row>
286 <entry><filename>OptionLists.txt</filename></entry>
287 <entry>list of all options in alphabetical order</entry>
288 </row>
289 <row>
290 <entry><filename>dbm.discuss.txt</filename></entry>
291 <entry>discussion about DBM libraries</entry>
292 </row>
293 <row>
294 <entry><filename>exim.8</filename></entry>
295 <entry>a man page of Exim&#x2019;s command line options</entry>
296 </row>
297 <row>
298 <entry><filename>experimental.txt</filename></entry>
299 <entry>documentation of experimental features</entry>
300 </row>
301 <row>
302 <entry><filename>filter.txt</filename></entry>
303 <entry>specification of the filter language</entry>
304 </row>
305 <row>
306 <entry><filename>Exim3.upgrade</filename></entry>
307 <entry>upgrade notes from release 2 to release 3</entry>
308 </row>
309 <row>
310 <entry><filename>Exim4.upgrade</filename></entry>
311 <entry>upgrade notes from release 3 to release 4</entry>
312 </row>
313 <row>
314 <entry><filename>openssl.txt</filename></entry>
315 <entry>installing a current OpenSSL release</entry>
316 </row>
317 </tbody>
318 </tgroup>
319 </informaltable>
320 <para>
321 The main specification and the specification of the filtering language are also
322 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
323 <xref linkend="SECTavail"/> below tells you how to get hold of these.
324 </para>
325 </section>
326 <section id="SECID2">
327 <title>FTP and web sites</title>
328 <para>
329 <indexterm role="concept">
330 <primary>web site</primary>
331 </indexterm>
332 <indexterm role="concept">
333 <primary>FTP site</primary>
334 </indexterm>
335 The primary site for Exim source distributions is currently the University of
336 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
337 distribution</emphasis> below. In addition, there is a web site and an FTP site at
338 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
339 <option>exim.org</option> site was previously hosted for a number of years by Energis
340 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
341 </para>
342 <para>
343 <indexterm role="concept">
344 <primary>wiki</primary>
345 </indexterm>
346 <indexterm role="concept">
347 <primary>FAQ</primary>
348 </indexterm>
349 As well as Exim distribution tar files, the Exim web site contains a number of
350 differently formatted versions of the documentation. A recent addition to the
351 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
352 which contains what used to be a separate FAQ, as well as various other
353 examples, tips, and know-how that have been contributed by Exim users.
354 </para>
355 <para>
356 <indexterm role="concept">
357 <primary>Bugzilla</primary>
358 </indexterm>
359 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
360 this to report bugs, and also to add items to the wish list. Please search
361 first to check that you are not duplicating a previous entry.
362 </para>
363 </section>
364 <section id="SECID3">
365 <title>Mailing lists</title>
366 <para>
367 <indexterm role="concept">
368 <primary>mailing lists</primary>
369 <secondary>for Exim users</secondary>
370 </indexterm>
371 The following Exim mailing lists exist:
372 </para>
373 <informaltable frame="none">
374 <tgroup cols="2" colsep="0" rowsep="0">
375 <colspec colwidth="140pt" align="left"/>
376 <colspec colwidth="254pt" align="left"/>
377 <tbody>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-users@exim.org</emphasis></entry>
384 <entry>General discussion list</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
388 <entry>Discussion of bugs, enhancements, etc.</entry>
389 </row>
390 <row>
391 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
392 <entry>Automated commit messages from the VCS</entry>
393 </row>
394 </tbody>
395 </tgroup>
396 </informaltable>
397 <para>
398 You can subscribe to these lists, change your existing subscriptions, and view
399 or search the archives via the mailing lists link on the Exim home page.
400 <indexterm role="concept">
401 <primary>Debian</primary>
402 <secondary>mailing list for</secondary>
403 </indexterm>
404 If you are using a Debian distribution of Exim, you may wish to subscribe to
405 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
406 via this web page:
407 </para>
408 <literallayout>
409 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
410 </literallayout>
411 <para>
412 Please ask Debian-specific questions on this list and not on the general Exim
413 lists.
414 </para>
415 </section>
416 <section id="SECID4">
417 <title>Exim training</title>
418 <para>
419 <indexterm role="concept">
420 <primary>training courses</primary>
421 </indexterm>
422 Training courses in Cambridge (UK) used to be run annually by the author of
423 Exim, before he retired. At the time of writing, there are no plans to run
424 further Exim courses in Cambridge. However, if that changes, relevant
425 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
426 </para>
427 </section>
428 <section id="SECID5">
429 <title>Bug reports</title>
430 <para>
431 <indexterm role="concept">
432 <primary>bug reports</primary>
433 </indexterm>
434 <indexterm role="concept">
435 <primary>reporting bugs</primary>
436 </indexterm>
437 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
438 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
439 whether some behaviour is a bug or not, the best thing to do is to post a
440 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
441 </para>
442 </section>
443 <section id="SECTavail">
444 <title>Where to find the Exim distribution</title>
445 <para>
446 <indexterm role="concept">
447 <primary>FTP site</primary>
448 </indexterm>
449 <indexterm role="concept">
450 <primary>distribution</primary>
451 <secondary>ftp site</secondary>
452 </indexterm>
453 The master ftp site for the Exim distribution is
454 </para>
455 <literallayout>
456 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
457 </literallayout>
458 <para>
459 This is mirrored by
460 </para>
461 <literallayout>
462 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
463 </literallayout>
464 <para>
465 The file references that follow are relative to the <filename>exim</filename> directories at
466 these sites. There are now quite a number of independent mirror sites around
467 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
468 </para>
469 <para>
470 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
471 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
472 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
473 subdirectory, the current release can always be found in files called
474 </para>
475 <literallayout>
476 <filename>exim-n.nn.tar.gz</filename>
477 <filename>exim-n.nn.tar.bz2</filename>
478 </literallayout>
479 <para>
480 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
481 files contain identical data; the only difference is the type of compression.
482 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
483 </para>
484 <para>
485 <indexterm role="concept">
486 <primary>distribution</primary>
487 <secondary>signing details</secondary>
488 </indexterm>
489 <indexterm role="concept">
490 <primary>distribution</primary>
491 <secondary>public key</secondary>
492 </indexterm>
493 <indexterm role="concept">
494 <primary>public key for signed distribution</primary>
495 </indexterm>
496 The distributions will be PGP signed by an individual key of the Release
497 Coordinator.  This key will have a uid containing an email address in the
498 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
499 other Exim maintainers.  We expect that the key will be in the "strong set" of
500 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
501 PGP key, a version of which can be found in the release directory in the file
502 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
503 such as <emphasis>pool.sks-keyservers.net</emphasis>.
504 </para>
505 <para>
506 At time of last update, releases were being made by Phil Pennock and signed with
507 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
508 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
509 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
510 </para>
511 <para>
512 Releases have also been authorized to be performed by Todd Lyons who signs with
513 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
514 Pennock and Todd Lyons through a common associate.
515 </para>
516 <para>
517 The signatures for the tar bundles are in:
518 </para>
519 <literallayout>
520 <filename>exim-n.nn.tar.gz.asc</filename>
521 <filename>exim-n.nn.tar.bz2.asc</filename>
522 </literallayout>
523 <para>
524 For each released version, the log of changes is made separately available in a
525 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
526 find out what has changed without having to download the entire distribution.
527 </para>
528 <para>
529 <indexterm role="concept">
530 <primary>documentation</primary>
531 <secondary>available formats</secondary>
532 </indexterm>
533 The main distribution contains ASCII versions of this specification and other
534 documentation; other formats of the documents are available in separate files
535 inside the <filename>exim4</filename> directory of the FTP site:
536 </para>
537 <literallayout>
538 <filename>exim-html-n.nn.tar.gz</filename>
539 <filename>exim-pdf-n.nn.tar.gz</filename>
540 <filename>exim-postscript-n.nn.tar.gz</filename>
541 <filename>exim-texinfo-n.nn.tar.gz</filename>
542 </literallayout>
543 <para>
544 These tar files contain only the <filename>doc</filename> directory, not the complete
545 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
546 </para>
547 </section>
548 <section id="SECID6">
549 <title>Limitations</title>
550 <itemizedlist>
551 <listitem>
552 <para>
553 <indexterm role="concept">
554 <primary>limitations of Exim</primary>
555 </indexterm>
556 <indexterm role="concept">
557 <primary>bang paths</primary>
558 <secondary>not handled by Exim</secondary>
559 </indexterm>
560 Exim is designed for use as an Internet MTA, and therefore handles addresses in
561 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
562 simple two-component bang paths can be converted by a straightforward rewriting
563 configuration. This restriction does not prevent Exim from being interfaced to
564 UUCP as a transport mechanism, provided that domain addresses are used.
565 </para>
566 </listitem>
567 <listitem>
568 <para>
569 <indexterm role="concept">
570 <primary>domainless addresses</primary>
571 </indexterm>
572 <indexterm role="concept">
573 <primary>address</primary>
574 <secondary>without domain</secondary>
575 </indexterm>
576 Exim insists that every address it handles has a domain attached. For incoming
577 local messages, domainless addresses are automatically qualified with a
578 configured domain value. Configuration options specify from which remote
579 systems unqualified addresses are acceptable. These are then qualified on
580 arrival.
581 </para>
582 </listitem>
583 <listitem>
584 <para>
585 <indexterm role="concept">
586 <primary>transport</primary>
587 <secondary>external</secondary>
588 </indexterm>
589 <indexterm role="concept">
590 <primary>external transports</primary>
591 </indexterm>
592 The only external transport mechanisms that are currently implemented are SMTP
593 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
594 transport is available, and there are facilities for writing messages to files
595 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
596 to send messages to other transport mechanisms such as UUCP, provided they can
597 handle domain-style addresses. Batched SMTP input is also catered for.
598 </para>
599 </listitem>
600 <listitem>
601 <para>
602 Exim is not designed for storing mail for dial-in hosts. When the volumes of
603 such mail are large, it is better to get the messages <quote>delivered</quote> into files
604 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
605 other means.
606 </para>
607 </listitem>
608 <listitem>
609 <para>
610 Although Exim does have basic facilities for scanning incoming messages, these
611 are not comprehensive enough to do full virus or spam scanning. Such operations
612 are best carried out using additional specialized software packages. If you
613 compile Exim with the content-scanning extension, straightforward interfaces to
614 a number of common scanners are provided.
615 </para>
616 </listitem>
617 </itemizedlist>
618 </section>
619 <section id="SECID7">
620 <title>Run time configuration</title>
621 <para>
622 Exim&#x2019;s run time configuration is held in a single text file that is divided
623 into a number of sections. The entries in this file consist of keywords and
624 values, in the style of Smail 3 configuration files. A default configuration
625 file which is suitable for simple online installations is provided in the
626 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
627 </para>
628 </section>
629 <section id="SECID8">
630 <title>Calling interface</title>
631 <para>
632 <indexterm role="concept">
633 <primary>Sendmail compatibility</primary>
634 <secondary>command line interface</secondary>
635 </indexterm>
636 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
637 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
638 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
639 about Sendmail in order to run Exim. For actions other than sending messages,
640 Sendmail-compatible options also exist, but those that produce output (for
641 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
642 format. There are also some additional options that are compatible with Smail
643 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
644 documents all Exim&#x2019;s command line options. This information is automatically
645 made into the man page that forms part of the Exim distribution.
646 </para>
647 <para>
648 Control of messages on the queue can be done via certain privileged command
649 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
650 which displays current information in an X window, and which contains a menu
651 interface to Exim&#x2019;s command line administration options.
652 </para>
653 </section>
654 <section id="SECID9">
655 <title>Terminology</title>
656 <para>
657 <indexterm role="concept">
658 <primary>terminology definitions</primary>
659 </indexterm>
660 <indexterm role="concept">
661 <primary>body of message</primary>
662 <secondary>definition of</secondary>
663 </indexterm>
664 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
665 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
666 below) by a blank line.
667 </para>
668 <para>
669 <indexterm role="concept">
670 <primary>bounce message</primary>
671 <secondary>definition of</secondary>
672 </indexterm>
673 When a message cannot be delivered, it is normally returned to the sender in a
674 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
675 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
676 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
677 failure error report</quote>. Such messages have an empty sender address in the
678 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
679 rise to further bounce messages.
680 </para>
681 <para>
682 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
683 value which is used in the absence of any setting in the configuration. It may
684 also qualify an action which is taken unless a configuration setting specifies
685 otherwise.
686 </para>
687 <para>
688 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
689 destination cannot immediately take place for some reason (a remote host may be
690 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
691 until a later time.
692 </para>
693 <para>
694 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
695 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
696 the part of an email address following the @ sign.
697 </para>
698 <para>
699 <indexterm role="concept">
700 <primary>envelope, definition of</primary>
701 </indexterm>
702 <indexterm role="concept">
703 <primary>sender</primary>
704 <secondary>definition of</secondary>
705 </indexterm>
706 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
707 body. The envelope contains a sender address (to which bounce messages should
708 be delivered), and any number of recipient addresses. References to the
709 sender or the recipients of a message usually mean the addresses in the
710 envelope. An MTA uses these addresses for delivery, and for returning bounce
711 messages, not the addresses that appear in the header lines.
712 </para>
713 <para>
714 <indexterm role="concept">
715 <primary>message</primary>
716 <secondary>header, definition of</secondary>
717 </indexterm>
718 <indexterm role="concept">
719 <primary>header section</primary>
720 <secondary>definition of</secondary>
721 </indexterm>
722 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
723 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
724 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
725 indenting the continuations. The header is separated from the body by a blank
726 line.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>local part</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <indexterm role="concept">
734 <primary>domain</primary>
735 <secondary>definition of</secondary>
736 </indexterm>
737 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
738 part of an email address that precedes the @ sign. The part that follows the
739 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
740 </para>
741 <para>
742 <indexterm role="concept">
743 <primary>local delivery</primary>
744 <secondary>definition of</secondary>
745 </indexterm>
746 <indexterm role="concept">
747 <primary>remote delivery, definition of</primary>
748 </indexterm>
749 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
750 delivery to a file or a pipe on the local host from delivery by SMTP over
751 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
752 host it is running on are <emphasis>remote</emphasis>.
753 </para>
754 <para>
755 <indexterm role="concept">
756 <primary>return path</primary>
757 <secondary>definition of</secondary>
758 </indexterm>
759 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
760 message&#x2019;s envelope.
761 </para>
762 <para>
763 <indexterm role="concept">
764 <primary>queue</primary>
765 <secondary>definition of</secondary>
766 </indexterm>
767 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
768 because this term is in widespread use in the context of MTAs. However, in
769 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
770 normally no ordering of waiting messages.
771 </para>
772 <para>
773 <indexterm role="concept">
774 <primary>queue runner</primary>
775 <secondary>definition of</secondary>
776 </indexterm>
777 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
778 and attempts to deliver those messages whose retry times have come. This term
779 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
780 the waiting messages are normally processed in an unpredictable order.
781 </para>
782 <para>
783 <indexterm role="concept">
784 <primary>spool directory</primary>
785 <secondary>definition of</secondary>
786 </indexterm>
787 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
788 messages on its queue &ndash; that is, those that it is in the process of
789 delivering. This should not be confused with the directory in which local
790 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
791 the Exim documentation, <quote>spool</quote> is always used in the first sense.
792 </para>
793 </section>
794 </chapter>
795
796 <chapter id="CHID2">
797 <title>Incorporated code</title>
798 <para>
799 <indexterm role="concept">
800 <primary>incorporated code</primary>
801 </indexterm>
802 <indexterm role="concept">
803 <primary>regular expressions</primary>
804 <secondary>library</secondary>
805 </indexterm>
806 <indexterm role="concept">
807 <primary>PCRE</primary>
808 </indexterm>
809 <indexterm role="concept">
810 <primary>OpenDMARC</primary>
811 </indexterm>
812 A number of pieces of external code are included in the Exim distribution.
813 </para>
814 <itemizedlist>
815 <listitem>
816 <para>
817 Regular expressions are supported in the main Exim program and in the
818 Exim monitor using the freely-distributable PCRE library, copyright
819 &copy; University of Cambridge. The source to PCRE is no longer shipped with
820 Exim, so you will need to use the version of PCRE shipped with your system,
821 or obtain and install the full version of the library from
822 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
823 </para>
824 </listitem>
825 <listitem>
826 <para>
827 <indexterm role="concept">
828 <primary>cdb</primary>
829 <secondary>acknowledgment</secondary>
830 </indexterm>
831 Support for the cdb (Constant DataBase) lookup method is provided by code
832 contributed by Nigel Metheringham of (at the time he contributed it) Planet
833 Online Ltd. The implementation is completely contained within the code of Exim.
834 It does not link against an external cdb library. The code contains the
835 following statements:
836 </para>
837 <blockquote>
838 <para>
839 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
840 </para>
841 <para>
842 This program is free software; you can redistribute it and/or modify it under
843 the terms of the GNU General Public License as published by the Free Software
844 Foundation; either version 2 of the License, or (at your option) any later
845 version.
846 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
847 the spec and sample code for cdb can be obtained from
848 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
849 some code from Dan Bernstein&#x2019;s implementation (which has no license
850 restrictions applied to it).
851 </para>
852 </blockquote>
853 </listitem>
854 <listitem>
855 <para>
856 <indexterm role="concept">
857 <primary>SPA authentication</primary>
858 </indexterm>
859 <indexterm role="concept">
860 <primary>Samba project</primary>
861 </indexterm>
862 <indexterm role="concept">
863 <primary>Microsoft Secure Password Authentication</primary>
864 </indexterm>
865 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
866 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
867 Tom Kistner. This includes code taken from the Samba project, which is released
868 under the Gnu GPL.
869 </para>
870 </listitem>
871 <listitem>
872 <para>
873 <indexterm role="concept">
874 <primary>Cyrus</primary>
875 </indexterm>
876 <indexterm role="concept">
877 <primary><emphasis>pwcheck</emphasis> daemon</primary>
878 </indexterm>
879 <indexterm role="concept">
880 <primary><emphasis>pwauthd</emphasis> daemon</primary>
881 </indexterm>
882 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
883 by code taken from the Cyrus-SASL library and adapted by Alexander S.
884 Sabourenkov. The permission notice appears below, in accordance with the
885 conditions expressed therein.
886 </para>
887 <blockquote>
888 <para>
889 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
890 </para>
891 <para>
892 Redistribution and use in source and binary forms, with or without
893 modification, are permitted provided that the following conditions
894 are met:
895 </para>
896 <orderedlist numeration="arabic">
897 <listitem>
898 <para>
899 Redistributions of source code must retain the above copyright
900 notice, this list of conditions and the following disclaimer.
901 </para>
902 </listitem>
903 <listitem>
904 <para>
905 Redistributions in binary form must reproduce the above copyright
906 notice, this list of conditions and the following disclaimer in
907 the documentation and/or other materials provided with the
908 distribution.
909 </para>
910 </listitem>
911 <listitem>
912 <para>
913 The name <quote>Carnegie Mellon University</quote> must not be used to
914 endorse or promote products derived from this software without
915 prior written permission. For permission or any other legal
916 details, please contact
917 </para>
918 <literallayout>
919               Office of Technology Transfer
920               Carnegie Mellon University
921               5000 Forbes Avenue
922               Pittsburgh, PA  15213-3890
923               (412) 268-4387, fax: (412) 268-7395
924               tech-transfer@andrew.cmu.edu
925 </literallayout>
926 </listitem>
927 <listitem>
928 <para>
929 Redistributions of any form whatsoever must retain the following
930 acknowledgment:
931 </para>
932 <para>
933 <quote>This product includes software developed by Computing Services
934 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
935 </para>
936 <para>
937 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
938 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
939 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
940 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
941 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
942 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
943 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
944 </para>
945 </listitem>
946 </orderedlist>
947 </blockquote>
948 </listitem>
949 <listitem>
950 <para>
951 <indexterm role="concept">
952 <primary>Exim monitor</primary>
953 <secondary>acknowledgment</secondary>
954 </indexterm>
955 <indexterm role="concept">
956 <primary>X-windows</primary>
957 </indexterm>
958 <indexterm role="concept">
959 <primary>Athena</primary>
960 </indexterm>
961 The Exim Monitor program, which is an X-Window application, includes
962 modified versions of the Athena StripChart and TextPop widgets.
963 This code is copyright by DEC and MIT, and their permission notice appears
964 below, in accordance with the conditions expressed therein.
965 </para>
966 <blockquote>
967 <para>
968 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
969 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
970 </para>
971 <para>
972 All Rights Reserved
973 </para>
974 <para>
975 Permission to use, copy, modify, and distribute this software and its
976 documentation for any purpose and without fee is hereby granted,
977 provided that the above copyright notice appear in all copies and that
978 both that copyright notice and this permission notice appear in
979 supporting documentation, and that the names of Digital or MIT not be
980 used in advertising or publicity pertaining to distribution of the
981 software without specific, written prior permission.
982 </para>
983 <para>
984 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
985 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
986 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
987 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
988 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
989 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
990 SOFTWARE.
991 </para>
992 </blockquote>
993 </listitem>
994 <listitem>
995 <para>
996 <indexterm role="concept">
997 <primary>opendmarc</primary>
998 <secondary>acknowledgment</secondary>
999 </indexterm>
1000 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1001 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1002 derived code are indicated in the respective source files. The full OpenDMARC
1003 license is provided in the LICENSE.opendmarc file contained in the distributed
1004 source code.
1005 </para>
1006 </listitem>
1007 <listitem>
1008 <para>
1009 Many people have contributed code fragments, some large, some small, that were
1010 not covered by any specific licence requirements. It is assumed that the
1011 contributors are happy to see their code incorporated into Exim under the GPL.
1012 </para>
1013 </listitem>
1014 </itemizedlist>
1015 </chapter>
1016
1017 <chapter id="CHID11">
1018 <title>How Exim receives and delivers mail</title>
1019 <titleabbrev>Receiving and delivering mail</titleabbrev>
1020 <section id="SECID10">
1021 <title>Overall philosophy</title>
1022 <para>
1023 <indexterm role="concept">
1024 <primary>design philosophy</primary>
1025 </indexterm>
1026 Exim is designed to work efficiently on systems that are permanently connected
1027 to the Internet and are handling a general mix of mail. In such circumstances,
1028 most messages can be delivered immediately. Consequently, Exim does not
1029 maintain independent queues of messages for specific domains or hosts, though
1030 it does try to send several messages in a single SMTP connection after a host
1031 has been down, and it also maintains per-host retry information.
1032 </para>
1033 </section>
1034 <section id="SECID11">
1035 <title>Policy control</title>
1036 <para>
1037 <indexterm role="concept">
1038 <primary>policy control</primary>
1039 <secondary>overview</secondary>
1040 </indexterm>
1041 Policy controls are now an important feature of MTAs that are connected to the
1042 Internet. Perhaps their most important job is to stop MTAs being abused as
1043 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1044 unsolicited junk, and want to disguise its source. Exim provides flexible
1045 facilities for specifying policy controls on incoming mail:
1046 </para>
1047 <itemizedlist>
1048 <listitem>
1049 <para>
1050 <indexterm role="concept">
1051 <primary>access control lists (ACLs)</primary>
1052 <secondary>introduction</secondary>
1053 </indexterm>
1054 Exim 4 (unlike previous versions of Exim) implements policy controls on
1055 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1056 series of statements that may either grant or deny access. ACLs can be used at
1057 several places in the SMTP dialogue while receiving a message from a remote
1058 host. However, the most common places are after each RCPT command, and at the
1059 very end of the message. The sysadmin can specify conditions for accepting or
1060 rejecting individual recipients or the entire message, respectively, at these
1061 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1062 error code.
1063 </para>
1064 </listitem>
1065 <listitem>
1066 <para>
1067 An ACL is also available for locally generated, non-SMTP messages. In this
1068 case, the only available actions are to accept or deny the entire message.
1069 </para>
1070 </listitem>
1071 <listitem>
1072 <para>
1073 When Exim is compiled with the content-scanning extension, facilities are
1074 provided in the ACL mechanism for passing the message to external virus and/or
1075 spam scanning software. The result of such a scan is passed back to the ACL,
1076 which can then use it to decide what to do with the message.
1077 </para>
1078 </listitem>
1079 <listitem>
1080 <para>
1081 When a message has been received, either from a remote host or from the local
1082 host, but before the final acknowledgment has been sent, a locally supplied C
1083 function called <function>local_scan()</function> can be run to inspect the message and decide
1084 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1085 is accepted, the list of recipients can be modified by the function.
1086 </para>
1087 </listitem>
1088 <listitem>
1089 <para>
1090 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1091 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1092 Exim to be compiled with the content-scanning extension.
1093 </para>
1094 </listitem>
1095 <listitem>
1096 <para>
1097 After a message has been accepted, a further checking mechanism is available in
1098 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1099 runs at the start of every delivery process.
1100 </para>
1101 </listitem>
1102 </itemizedlist>
1103 </section>
1104 <section id="SECID12">
1105 <title>User filters</title>
1106 <para>
1107 <indexterm role="concept">
1108 <primary>filter</primary>
1109 <secondary>introduction</secondary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>Sieve filter</primary>
1113 </indexterm>
1114 In a conventional Exim configuration, users are able to run private filters by
1115 setting up appropriate <filename>.forward</filename> files in their home directories. See
1116 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1117 configuration needed to support this, and the separate document entitled
1118 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1119 of filtering are available:
1120 </para>
1121 <itemizedlist>
1122 <listitem>
1123 <para>
1124 Sieve filters are written in the standard filtering language that is defined
1125 by RFC 3028.
1126 </para>
1127 </listitem>
1128 <listitem>
1129 <para>
1130 Exim filters are written in a syntax that is unique to Exim, but which is more
1131 powerful than Sieve, which it pre-dates.
1132 </para>
1133 </listitem>
1134 </itemizedlist>
1135 <para>
1136 User filters are run as part of the routing process, described below.
1137 </para>
1138 </section>
1139 <section id="SECTmessiden">
1140 <title>Message identification</title>
1141 <para>
1142 <indexterm role="concept">
1143 <primary>message ids</primary>
1144 <secondary>details of format</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>format</primary>
1148 <secondary>of message id</secondary>
1149 </indexterm>
1150 <indexterm role="concept">
1151 <primary>id of message</primary>
1152 </indexterm>
1153 <indexterm role="concept">
1154 <primary>base62</primary>
1155 </indexterm>
1156 <indexterm role="concept">
1157 <primary>base36</primary>
1158 </indexterm>
1159 <indexterm role="concept">
1160 <primary>Darwin</primary>
1161 </indexterm>
1162 <indexterm role="concept">
1163 <primary>Cygwin</primary>
1164 </indexterm>
1165 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1166 characters long. It is divided into three parts, separated by hyphens, for
1167 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1168 normally encoding numbers in base 62. However, in the Darwin operating
1169 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1170 (avoiding the use of lower case letters) is used instead, because the message
1171 id is used to construct file names, and the names of files in those systems are
1172 not always case-sensitive.
1173 </para>
1174 <para>
1175 <indexterm role="concept">
1176 <primary>pid (process id)</primary>
1177 <secondary>re-use of</secondary>
1178 </indexterm>
1179 The detail of the contents of the message id have changed as Exim has evolved.
1180 Earlier versions relied on the operating system not re-using a process id (pid)
1181 within one second. On modern operating systems, this assumption can no longer
1182 be made, so the algorithm had to be changed. To retain backward compatibility,
1183 the format of the message id was retained, which is why the following rules are
1184 somewhat eccentric:
1185 </para>
1186 <itemizedlist>
1187 <listitem>
1188 <para>
1189 The first six characters of the message id are the time at which the message
1190 started to be received, to a granularity of one second. That is, this field
1191 contains the number of seconds since the start of the epoch (the normal Unix
1192 way of representing the date and time of day).
1193 </para>
1194 </listitem>
1195 <listitem>
1196 <para>
1197 After the first hyphen, the next six characters are the id of the process that
1198 received the message.
1199 </para>
1200 </listitem>
1201 <listitem>
1202 <para>
1203 There are two different possibilities for the final two characters:
1204 </para>
1205 <orderedlist numeration="arabic">
1206 <listitem>
1207 <para>
1208 <indexterm role="option">
1209 <primary><option>localhost_number</option></primary>
1210 </indexterm>
1211 If <option>localhost_number</option> is not set, this value is the fractional part of the
1212 time of reception, normally in units of 1/2000 of a second, but for systems
1213 that must use base 36 instead of base 62 (because of case-insensitive file
1214 systems), the units are 1/1000 of a second.
1215 </para>
1216 </listitem>
1217 <listitem>
1218 <para>
1219 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1220 the fractional part of the time, which in this case is in units of 1/200
1221 (1/100) of a second.
1222 </para>
1223 </listitem>
1224 </orderedlist>
1225 </listitem>
1226 </itemizedlist>
1227 <para>
1228 After a message has been received, Exim waits for the clock to tick at the
1229 appropriate resolution before proceeding, so that if another message is
1230 received by the same process, or by another process with the same (re-used)
1231 pid, it is guaranteed that the time will be different. In most cases, the clock
1232 will already have ticked while the message was being received.
1233 </para>
1234 </section>
1235 <section id="SECID13">
1236 <title>Receiving mail</title>
1237 <para>
1238 <indexterm role="concept">
1239 <primary>receiving mail</primary>
1240 </indexterm>
1241 <indexterm role="concept">
1242 <primary>message</primary>
1243 <secondary>reception</secondary>
1244 </indexterm>
1245 The only way Exim can receive mail from another host is using SMTP over
1246 TCP/IP, in which case the sender and recipient addresses are transferred using
1247 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1248 there are several possibilities:
1249 </para>
1250 <itemizedlist>
1251 <listitem>
1252 <para>
1253 If the process runs Exim with the <option>-bm</option> option, the message is read
1254 non-interactively (usually via a pipe), with the recipients taken from the
1255 command line, or from the body of the message if <option>-t</option> is also used.
1256 </para>
1257 </listitem>
1258 <listitem>
1259 <para>
1260 If the process runs Exim with the <option>-bS</option> option, the message is also read
1261 non-interactively, but in this case the recipients are listed at the start of
1262 the message in a series of SMTP RCPT commands, terminated by a DATA
1263 command. This is so-called <quote>batch SMTP</quote> format,
1264 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1265 envelope addresses in a non-interactive submission.
1266 </para>
1267 </listitem>
1268 <listitem>
1269 <para>
1270 If the process runs Exim with the <option>-bs</option> option, the message is read
1271 interactively, using the SMTP protocol. A two-way pipe is normally used for
1272 passing data between the local process and the Exim process.
1273 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1274 example, the ACLs for SMTP commands are used for this form of submission.
1275 </para>
1276 </listitem>
1277 <listitem>
1278 <para>
1279 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1280 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1281 does not treat the loopback address specially. It treats all such connections
1282 in the same way as connections from other hosts.
1283 </para>
1284 </listitem>
1285 </itemizedlist>
1286 <para>
1287 <indexterm role="concept">
1288 <primary>message sender, constructed by Exim</primary>
1289 </indexterm>
1290 <indexterm role="concept">
1291 <primary>sender</primary>
1292 <secondary>constructed by Exim</secondary>
1293 </indexterm>
1294 In the three cases that do not involve TCP/IP, the sender address is
1295 constructed from the login name of the user that called Exim and a default
1296 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1297 option). For local or batch SMTP, a sender address that is passed using the
1298 SMTP MAIL command is ignored. However, the system administrator may allow
1299 certain users (<quote>trusted users</quote>) to specify a different sender address
1300 unconditionally, or all users to specify certain forms of different sender
1301 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1302 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1303 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1304 users to change sender addresses.
1305 </para>
1306 <para>
1307 Messages received by either of the non-interactive mechanisms are subject to
1308 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1309 (either over TCP/IP, or interacting with a local process) can be checked by a
1310 number of ACLs that operate at different times during the SMTP session. Either
1311 individual recipients, or the entire message, can be rejected if local policy
1312 requirements are not met. The <function>local_scan()</function> function (see chapter
1313 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1314 </para>
1315 <para>
1316 Exim can be configured not to start a delivery process when a message is
1317 received; this can be unconditional, or depend on the number of incoming SMTP
1318 connections or the system load. In these situations, new messages wait on the
1319 queue until a queue runner process picks them up. However, in standard
1320 configurations under normal conditions, delivery is started as soon as a
1321 message is received.
1322 </para>
1323 </section>
1324 <section id="SECID14">
1325 <title>Handling an incoming message</title>
1326 <para>
1327 <indexterm role="concept">
1328 <primary>spool directory</primary>
1329 <secondary>files that hold a message</secondary>
1330 </indexterm>
1331 <indexterm role="concept">
1332 <primary>file</primary>
1333 <secondary>how a message is held</secondary>
1334 </indexterm>
1335 When Exim accepts a message, it writes two files in its spool directory. The
1336 first contains the envelope information, the current status of the message, and
1337 the header lines, and the second contains the body of the message. The names of
1338 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1339 file containing the envelope and header, and <literal>-D</literal> for the data file.
1340 </para>
1341 <para>
1342 <indexterm role="concept">
1343 <primary>spool directory</primary>
1344 <secondary><filename>input</filename> sub-directory</secondary>
1345 </indexterm>
1346 By default all these message files are held in a single directory called
1347 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1348 not perform very well if the number of files in a directory gets large; to
1349 improve performance in such cases, the <option>split_spool_directory</option> option can be
1350 used. This causes Exim to split up the input files into 62 sub-directories
1351 whose names are single letters or digits. When this is done, the queue is
1352 processed one sub-directory at a time instead of all at once, which can improve
1353 overall performance even when there are not enough files in each directory to
1354 affect file system performance.
1355 </para>
1356 <para>
1357 The envelope information consists of the address of the message&#x2019;s sender and
1358 the addresses of the recipients. This information is entirely separate from
1359 any addresses contained in the header lines. The status of the message includes
1360 a list of recipients who have already received the message. The format of the
1361 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1362 </para>
1363 <para>
1364 <indexterm role="concept">
1365 <primary>rewriting</primary>
1366 <secondary>addresses</secondary>
1367 </indexterm>
1368 Address rewriting that is specified in the rewrite section of the configuration
1369 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1370 both in the header lines and the envelope, at the time the message is accepted.
1371 If during the course of delivery additional addresses are generated (for
1372 example, via aliasing), these new addresses are rewritten as soon as they are
1373 generated. At the time a message is actually delivered (transported) further
1374 rewriting can take place; because this is a transport option, it can be
1375 different for different forms of delivery. It is also possible to specify the
1376 addition or removal of certain header lines at the time the message is
1377 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1378 <xref linkend="CHAPtransportgeneric"/>).
1379 </para>
1380 </section>
1381 <section id="SECID15">
1382 <title>Life of a message</title>
1383 <para>
1384 <indexterm role="concept">
1385 <primary>message</primary>
1386 <secondary>life of</secondary>
1387 </indexterm>
1388 <indexterm role="concept">
1389 <primary>message</primary>
1390 <secondary>frozen</secondary>
1391 </indexterm>
1392 A message remains in the spool directory until it is completely delivered to
1393 its recipients or to an error address, or until it is deleted by an
1394 administrator or by the user who originally created it. In cases when delivery
1395 cannot proceed &ndash; for example, when a message can neither be delivered to its
1396 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1397 spool, and no more deliveries are attempted.
1398 </para>
1399 <para>
1400 <indexterm role="concept">
1401 <primary>frozen messages</primary>
1402 <secondary>thawing</secondary>
1403 </indexterm>
1404 <indexterm role="concept">
1405 <primary>message</primary>
1406 <secondary>thawing frozen</secondary>
1407 </indexterm>
1408 An administrator can <quote>thaw</quote> such messages when the problem has been
1409 corrected, and can also freeze individual messages by hand if necessary. In
1410 addition, an administrator can force a delivery error, causing a bounce message
1411 to be sent.
1412 </para>
1413 <para>
1414 <indexterm role="option">
1415 <primary><option>timeout_frozen_after</option></primary>
1416 </indexterm>
1417 <indexterm role="option">
1418 <primary><option>ignore_bounce_errors_after</option></primary>
1419 </indexterm>
1420 There are options called <option>ignore_bounce_errors_after</option> and
1421 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1422 The first applies only to frozen bounces, the second to any frozen messages.
1423 </para>
1424 <para>
1425 <indexterm role="concept">
1426 <primary>message</primary>
1427 <secondary>log file for</secondary>
1428 </indexterm>
1429 <indexterm role="concept">
1430 <primary>log</primary>
1431 <secondary>file for each message</secondary>
1432 </indexterm>
1433 While Exim is working on a message, it writes information about each delivery
1434 attempt to its main log file. This includes successful, unsuccessful, and
1435 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1436 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1437 These logs are solely for the benefit of the administrator, and are normally
1438 deleted along with the spool files when processing of a message is complete.
1439 The use of individual message logs can be disabled by setting
1440 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1441 systems.
1442 </para>
1443 <para>
1444 <indexterm role="concept">
1445 <primary>journal file</primary>
1446 </indexterm>
1447 <indexterm role="concept">
1448 <primary>file</primary>
1449 <secondary>journal</secondary>
1450 </indexterm>
1451 All the information Exim itself needs to set up a delivery is kept in the first
1452 spool file, along with the header lines. When a successful delivery occurs, the
1453 address is immediately written at the end of a journal file, whose name is the
1454 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1455 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1456 is updated to indicate which these are, and the journal file is then deleted.
1457 Updating the spool file is done by writing a new file and renaming it, to
1458 minimize the possibility of data loss.
1459 </para>
1460 <para>
1461 Should the system or the program crash after a successful delivery but before
1462 the spool file has been updated, the journal is left lying around. The next
1463 time Exim attempts to deliver the message, it reads the journal file and
1464 updates the spool file before proceeding. This minimizes the chances of double
1465 deliveries caused by crashes.
1466 </para>
1467 </section>
1468 <section id="SECTprocaddress">
1469 <title>Processing an address for delivery</title>
1470 <para>
1471 <indexterm role="concept">
1472 <primary>drivers</primary>
1473 <secondary>definition of</secondary>
1474 </indexterm>
1475 <indexterm role="concept">
1476 <primary>router</primary>
1477 <secondary>definition of</secondary>
1478 </indexterm>
1479 <indexterm role="concept">
1480 <primary>transport</primary>
1481 <secondary>definition of</secondary>
1482 </indexterm>
1483 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1484 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1485 number of them is provided in the source distribution, and compile-time options
1486 specify which ones are included in the binary. Run time options specify which
1487 ones are actually used for delivering messages.
1488 </para>
1489 <para>
1490 <indexterm role="concept">
1491 <primary>drivers</primary>
1492 <secondary>instance definition</secondary>
1493 </indexterm>
1494 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1495 of that particular driver type. Multiple instances are allowed; for example,
1496 you can set up several different <command>smtp</command> transports, each with different
1497 option values that might specify different ports or different timeouts. Each
1498 instance has its own identifying name. In what follows we will normally use the
1499 instance name when discussing one particular instance (that is, one specific
1500 configuration of the driver), and the generic driver name when discussing
1501 the driver&#x2019;s features in general.
1502 </para>
1503 <para>
1504 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1505 its delivery should happen, by assigning it to a specific transport, or
1506 converting the address into one or more new addresses (for example, via an
1507 alias file). A router may also explicitly choose to fail an address, causing it
1508 to be bounced.
1509 </para>
1510 <para>
1511 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1512 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1513 transport, the destination is a file or a pipe on the local host, whereas for a
1514 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1515 to a specific transport as a result of successful routing. If a message has
1516 several recipients, it may be passed to a number of different transports.
1517 </para>
1518 <para>
1519 <indexterm role="concept">
1520 <primary>preconditions</primary>
1521 <secondary>definition of</secondary>
1522 </indexterm>
1523 An address is processed by passing it to each configured router instance in
1524 turn, subject to certain preconditions, until a router accepts the address or
1525 specifies that it should be bounced. We will describe this process in more
1526 detail shortly. First, as a simple example, we consider how each recipient
1527 address in a message is processed in a small configuration of three routers.
1528 </para>
1529 <para>
1530 To make this a more concrete example, it is described in terms of some actual
1531 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1532 routers in many different ways, and there may be any number of routers in a
1533 configuration.
1534 </para>
1535 <para>
1536 The first router that is specified in a configuration is often one that handles
1537 addresses in domains that are not recognized specially by the local host. These
1538 are typically addresses for arbitrary domains on the Internet. A precondition
1539 is set up which looks for the special domains known to the host (for example,
1540 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1541 match. Typically, this is a router that looks up domains in the DNS in order to
1542 find the hosts to which this address routes. If it succeeds, the address is
1543 assigned to a suitable SMTP transport; if it does not succeed, the router is
1544 configured to fail the address.
1545 </para>
1546 <para>
1547 The second router is reached only when the domain is recognized as one that
1548 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1549 aliasing and forwarding. When it generates one or more new addresses from the
1550 original, each of them is routed independently from the start. Otherwise, the
1551 router may cause an address to fail, or it may simply decline to handle the
1552 address, in which case the address is passed to the next router.
1553 </para>
1554 <para>
1555 The final router in many configurations is one that checks to see if the
1556 address belongs to a local mailbox. The precondition may involve a check to
1557 see if the local part is the name of a login account, or it may look up the
1558 local part in a file or a database. If its preconditions are not met, or if
1559 the router declines, we have reached the end of the routers. When this happens,
1560 the address is bounced.
1561 </para>
1562 </section>
1563 <section id="SECID16">
1564 <title>Processing an address for verification</title>
1565 <para>
1566 <indexterm role="concept">
1567 <primary>router</primary>
1568 <secondary>for verification</secondary>
1569 </indexterm>
1570 <indexterm role="concept">
1571 <primary>verifying address</primary>
1572 <secondary>overview</secondary>
1573 </indexterm>
1574 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1575 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1576 one of the checks to be performed in an ACL for incoming messages, on both
1577 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1578 <option>-bvs</option> command line options.
1579 </para>
1580 <para>
1581 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1582 does not affect the way the routers work, but it is a state that can be
1583 detected. By this means, a router can be skipped or made to behave differently
1584 when verifying. A common example is a configuration in which the first router
1585 sends all messages to a message-scanning program, unless they have been
1586 previously scanned. Thus, the first router accepts all addresses without any
1587 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1588 would be set for such a router, causing it to be skipped in verify mode.
1589 </para>
1590 </section>
1591 <section id="SECTrunindrou">
1592 <title>Running an individual router</title>
1593 <para>
1594 <indexterm role="concept">
1595 <primary>router</primary>
1596 <secondary>running details</secondary>
1597 </indexterm>
1598 <indexterm role="concept">
1599 <primary>preconditions</primary>
1600 <secondary>checking</secondary>
1601 </indexterm>
1602 <indexterm role="concept">
1603 <primary>router</primary>
1604 <secondary>result of running</secondary>
1605 </indexterm>
1606 As explained in the example above, a number of preconditions are checked before
1607 running a router. If any are not met, the router is skipped, and the address is
1608 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1609 the router is run. What happens next depends on the outcome, which is one of
1610 the following:
1611 </para>
1612 <itemizedlist>
1613 <listitem>
1614 <para>
1615 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1616 transport, or generates one or more <quote>child</quote> addresses. Processing the
1617 original address ceases,
1618 <indexterm role="option">
1619 <primary><option>unseen</option></primary>
1620 </indexterm>
1621 unless the <option>unseen</option> option is set on the router. This option
1622 can be used to set up multiple deliveries with different routing (for example,
1623 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1624 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1625 end of routing.
1626 </para>
1627 <para>
1628 Any child addresses generated by the router are processed independently,
1629 starting with the first router by default. It is possible to change this by
1630 setting the <option>redirect_router</option> option to specify which router to start at for
1631 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1632 <option>redirect_router</option> may be anywhere in the router configuration.
1633 </para>
1634 </listitem>
1635 <listitem>
1636 <para>
1637 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1638 requests that the address be passed to another router. By default the address
1639 is passed to the next router, but this can be changed by setting the
1640 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1641 must be below the current router (to avoid loops).
1642 </para>
1643 </listitem>
1644 <listitem>
1645 <para>
1646 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1647 recognize it at all. By default, the address is passed to the next router, but
1648 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1649 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1650 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1651 </para>
1652 </listitem>
1653 <listitem>
1654 <para>
1655 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1656 the generation of a bounce message. There is no further processing of the
1657 original address unless <option>unseen</option> is set on the router.
1658 </para>
1659 </listitem>
1660 <listitem>
1661 <para>
1662 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1663 database may be offline, or a DNS lookup may have timed out.) No further
1664 processing of the address happens in this delivery attempt. It is tried again
1665 next time the message is considered for delivery.
1666 </para>
1667 </listitem>
1668 <listitem>
1669 <para>
1670 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1671 its configuration). The action is as for defer.
1672 </para>
1673 </listitem>
1674 </itemizedlist>
1675 <para>
1676 If an address reaches the end of the routers without having been accepted by
1677 any of them, it is bounced as unrouteable. The default error message in this
1678 situation is <quote>unrouteable address</quote>, but you can set your own message by
1679 making use of the <option>cannot_route_message</option> option. This can be set for any
1680 router; the value from the last router that <quote>saw</quote> the address is used.
1681 </para>
1682 <para>
1683 Sometimes while routing you want to fail a delivery when some conditions are
1684 met but others are not, instead of passing the address on for further routing.
1685 You can do this by having a second router that explicitly fails the delivery
1686 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1687 facility for this purpose.
1688 </para>
1689 </section>
1690 <section id="SECID17">
1691 <title>Duplicate addresses</title>
1692 <para>
1693 <indexterm role="concept">
1694 <primary>case of local parts</primary>
1695 </indexterm>
1696 <indexterm role="concept">
1697 <primary>address duplicate, discarding</primary>
1698 </indexterm>
1699 <indexterm role="concept">
1700 <primary>duplicate addresses</primary>
1701 </indexterm>
1702 Once routing is complete, Exim scans the addresses that are assigned to local
1703 and remote transports, and discards any duplicates that it finds. During this
1704 check, local parts are treated as case-sensitive. This happens only when
1705 actually delivering a message; when testing routers with <option>-bt</option>, all the
1706 routed addresses are shown.
1707 </para>
1708 </section>
1709 <section id="SECTrouprecon">
1710 <title>Router preconditions</title>
1711 <para>
1712 <indexterm role="concept">
1713 <primary>router</primary>
1714 <secondary>preconditions, order of processing</secondary>
1715 </indexterm>
1716 <indexterm role="concept">
1717 <primary>preconditions</primary>
1718 <secondary>order of processing</secondary>
1719 </indexterm>
1720 The preconditions that are tested for each router are listed below, in the
1721 order in which they are tested. The individual configuration options are
1722 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1723 </para>
1724 <itemizedlist>
1725 <listitem>
1726 <para>
1727 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1728 the local parts handled by the router may or must have certain prefixes and/or
1729 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1730 skipped. These conditions are tested first. When an affix is present, it is
1731 removed from the local part before further processing, including the evaluation
1732 of any other conditions.
1733 </para>
1734 </listitem>
1735 <listitem>
1736 <para>
1737 Routers can be designated for use only when not verifying an address, that is,
1738 only when routing it for delivery (or testing its delivery routing). If the
1739 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1740 address.
1741 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1742 <option>verify_recipient</option>, which independently control the use of the router for
1743 sender and recipient verification. You can set these options directly if
1744 you want a router to be used for only one type of verification.
1745 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1746 </para>
1747 </listitem>
1748 <listitem>
1749 <para>
1750 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1751 run with the <option>-bt</option> option to test an address routing. This can be helpful
1752 when the first router sends all new messages to a scanner of some sort; it
1753 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1754 having to simulate the effect of the scanner.
1755 </para>
1756 </listitem>
1757 <listitem>
1758 <para>
1759 Routers can be designated for use only when verifying an address, as
1760 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1761 Again, cutthrough delivery counts as a verification.
1762 </para>
1763 </listitem>
1764 <listitem>
1765 <para>
1766 Individual routers can be explicitly skipped when running the routers to
1767 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>domains</option> option is set, the domain of the address must be in the set
1773 of domains that it defines.
1774 </para>
1775 </listitem>
1776 <listitem>
1777 <para>
1778 <indexterm role="variable">
1779 <primary><varname>$local_part_prefix</varname></primary>
1780 </indexterm>
1781 <indexterm role="variable">
1782 <primary><varname>$local_part</varname></primary>
1783 </indexterm>
1784 <indexterm role="variable">
1785 <primary><varname>$local_part_suffix</varname></primary>
1786 </indexterm>
1787 If the <option>local_parts</option> option is set, the local part of the address must be in
1788 the set of local parts that it defines. If <option>local_part_prefix</option> or
1789 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1790 part before this check. If you want to do precondition tests on local parts
1791 that include affixes, you can do so by using a <option>condition</option> option (see below)
1792 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1793 <varname>$local_part_suffix</varname> as necessary.
1794 </para>
1795 </listitem>
1796 <listitem>
1797 <para>
1798 <indexterm role="variable">
1799 <primary><varname>$local_user_uid</varname></primary>
1800 </indexterm>
1801 <indexterm role="variable">
1802 <primary><varname>$local_user_gid</varname></primary>
1803 </indexterm>
1804 <indexterm role="variable">
1805 <primary><varname>$home</varname></primary>
1806 </indexterm>
1807 If the <option>check_local_user</option> option is set, the local part must be the name of
1808 an account on the local host. If this check succeeds, the uid and gid of the
1809 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1810 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1811 remaining preconditions.
1812 </para>
1813 </listitem>
1814 <listitem>
1815 <para>
1816 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1817 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1818 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1819 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1820 could lead to confusion.
1821 </para>
1822 </listitem>
1823 <listitem>
1824 <para>
1825 If the <option>senders</option> option is set, the envelope sender address must be in the
1826 set of addresses that it defines.
1827 </para>
1828 </listitem>
1829 <listitem>
1830 <para>
1831 If the <option>require_files</option> option is set, the existence or non-existence of
1832 specified files is tested.
1833 </para>
1834 </listitem>
1835 <listitem>
1836 <para>
1837 <indexterm role="concept">
1838 <primary>customizing</primary>
1839 <secondary>precondition</secondary>
1840 </indexterm>
1841 If the <option>condition</option> option is set, it is evaluated and tested. This option
1842 uses an expanded string to allow you to set up your own custom preconditions.
1843 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1844 </para>
1845 </listitem>
1846 </itemizedlist>
1847 <para>
1848 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1849 it to check for the existence of a file in which to lookup up a domain, local
1850 part, or sender. However, as these options are all expanded, you can use the
1851 <option>exists</option> expansion condition to make such tests within each condition. The
1852 <option>require_files</option> option is intended for checking files that the router may be
1853 going to use internally, or which are needed by a specific transport (for
1854 example, <filename>.procmailrc</filename>).
1855 </para>
1856 </section>
1857 <section id="SECID18">
1858 <title>Delivery in detail</title>
1859 <para>
1860 <indexterm role="concept">
1861 <primary>delivery</primary>
1862 <secondary>in detail</secondary>
1863 </indexterm>
1864 When a message is to be delivered, the sequence of events is as follows:
1865 </para>
1866 <itemizedlist>
1867 <listitem>
1868 <para>
1869 If a system-wide filter file is specified, the message is passed to it. The
1870 filter may add recipients to the message, replace the recipients, discard the
1871 message, cause a new message to be generated, or cause the message delivery to
1872 fail. The format of the system filter file is the same as for Exim user filter
1873 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1874 filtering</emphasis>.
1875 <indexterm role="concept">
1876 <primary>Sieve filter</primary>
1877 <secondary>not available for system filter</secondary>
1878 </indexterm>
1879 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1880 </para>
1881 <para>
1882 Some additional features are available in system filters &ndash; see chapter
1883 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1884 filter only once per delivery attempt, however many recipients it has. However,
1885 if there are several delivery attempts because one or more addresses could not
1886 be immediately delivered, the system filter is run each time. The filter
1887 condition <option>first_delivery</option> can be used to detect the first run of the system
1888 filter.
1889 </para>
1890 </listitem>
1891 <listitem>
1892 <para>
1893 Each recipient address is offered to each configured router in turn, subject to
1894 its preconditions, until one is able to handle it. If no router can handle the
1895 address, that is, if they all decline, the address is failed. Because routers
1896 can be targeted at particular domains, several locally handled domains can be
1897 processed entirely independently of each other.
1898 </para>
1899 </listitem>
1900 <listitem>
1901 <para>
1902 <indexterm role="concept">
1903 <primary>routing</primary>
1904 <secondary>loops in</secondary>
1905 </indexterm>
1906 <indexterm role="concept">
1907 <primary>loop</primary>
1908 <secondary>while routing</secondary>
1909 </indexterm>
1910 A router that accepts an address may assign it to a local or a remote
1911 transport. However, the transport is not run at this time. Instead, the address
1912 is placed on a list for the particular transport, which will be run later.
1913 Alternatively, the router may generate one or more new addresses (typically
1914 from alias, forward, or filter files). New addresses are fed back into this
1915 process from the top, but in order to avoid loops, a router ignores any address
1916 which has an identically-named ancestor that was processed by itself.
1917 </para>
1918 </listitem>
1919 <listitem>
1920 <para>
1921 When all the routing has been done, addresses that have been successfully
1922 handled are passed to their assigned transports. When local transports are
1923 doing real local deliveries, they handle only one address at a time, but if a
1924 local transport is being used as a pseudo-remote transport (for example, to
1925 collect batched SMTP messages for transmission by some other means) multiple
1926 addresses can be handled. Remote transports can always handle more than one
1927 address at a time, but can be configured not to do so, or to restrict multiple
1928 addresses to the same domain.
1929 </para>
1930 </listitem>
1931 <listitem>
1932 <para>
1933 Each local delivery to a file or a pipe runs in a separate process under a
1934 non-privileged uid, and these deliveries are run one at a time. Remote
1935 deliveries also run in separate processes, normally under a uid that is private
1936 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1937 run in parallel. The maximum number of simultaneous remote deliveries for any
1938 one message is set by the <option>remote_max_parallel</option> option.
1939 The order in which deliveries are done is not defined, except that all local
1940 deliveries happen before any remote deliveries.
1941 </para>
1942 </listitem>
1943 <listitem>
1944 <para>
1945 <indexterm role="concept">
1946 <primary>queue runner</primary>
1947 </indexterm>
1948 When it encounters a local delivery during a queue run, Exim checks its retry
1949 database to see if there has been a previous temporary delivery failure for the
1950 address before running the local transport. If there was a previous failure,
1951 Exim does not attempt a new delivery until the retry time for the address is
1952 reached. However, this happens only for delivery attempts that are part of a
1953 queue run. Local deliveries are always attempted when delivery immediately
1954 follows message reception, even if retry times are set for them. This makes for
1955 better behaviour if one particular message is causing problems (for example,
1956 causing quota overflow, or provoking an error in a filter file).
1957 </para>
1958 </listitem>
1959 <listitem>
1960 <para>
1961 <indexterm role="concept">
1962 <primary>delivery</primary>
1963 <secondary>retry in remote transports</secondary>
1964 </indexterm>
1965 Remote transports do their own retry handling, since an address may be
1966 deliverable to one of a number of hosts, each of which may have a different
1967 retry time. If there have been previous temporary failures and no host has
1968 reached its retry time, no delivery is attempted, whether in a queue run or
1969 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1970 </para>
1971 </listitem>
1972 <listitem>
1973 <para>
1974 If there were any permanent errors, a bounce message is returned to an
1975 appropriate address (the sender in the common case), with details of the error
1976 for each failing address. Exim can be configured to send copies of bounce
1977 messages to other addresses.
1978 </para>
1979 </listitem>
1980 <listitem>
1981 <para>
1982 <indexterm role="concept">
1983 <primary>delivery</primary>
1984 <secondary>deferral</secondary>
1985 </indexterm>
1986 If one or more addresses suffered a temporary failure, the message is left on
1987 the queue, to be tried again later. Delivery of these addresses is said to be
1988 <emphasis>deferred</emphasis>.
1989 </para>
1990 </listitem>
1991 <listitem>
1992 <para>
1993 When all the recipient addresses have either been delivered or bounced,
1994 handling of the message is complete. The spool files and message log are
1995 deleted, though the message log can optionally be preserved if required.
1996 </para>
1997 </listitem>
1998 </itemizedlist>
1999 </section>
2000 <section id="SECID19">
2001 <title>Retry mechanism</title>
2002 <para>
2003 <indexterm role="concept">
2004 <primary>delivery</primary>
2005 <secondary>retry mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>retry</primary>
2009 <secondary>description of mechanism</secondary>
2010 </indexterm>
2011 <indexterm role="concept">
2012 <primary>queue runner</primary>
2013 </indexterm>
2014 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2015 attempt is the queue runner process. You must either run an Exim daemon that
2016 uses the <option>-q</option> option with a time interval to start queue runners at regular
2017 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2018 not arrange for queue runners to be run, messages that fail temporarily at the
2019 first attempt will remain on your queue for ever. A queue runner process works
2020 its way through the queue, one message at a time, trying each delivery that has
2021 passed its retry time.
2022 You can run several queue runners at once.
2023 </para>
2024 <para>
2025 Exim uses a set of configured rules to determine when next to retry the failing
2026 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2027 should give up trying to deliver to the address, at which point it generates a
2028 bounce message. If no retry rules are set for a particular host, address, and
2029 error combination, no retries are attempted, and temporary errors are treated
2030 as permanent.
2031 </para>
2032 </section>
2033 <section id="SECID20">
2034 <title>Temporary delivery failure</title>
2035 <para>
2036 <indexterm role="concept">
2037 <primary>delivery</primary>
2038 <secondary>temporary failure</secondary>
2039 </indexterm>
2040 There are many reasons why a message may not be immediately deliverable to a
2041 particular address. Failure to connect to a remote machine (because it, or the
2042 connection to it, is down) is one of the most common. Temporary failures may be
2043 detected during routing as well as during the transport stage of delivery.
2044 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2045 is on a file system where the user is over quota. Exim can be configured to
2046 impose its own quotas on local mailboxes; where system quotas are set they will
2047 also apply.
2048 </para>
2049 <para>
2050 If a host is unreachable for a period of time, a number of messages may be
2051 waiting for it by the time it recovers, and sending them in a single SMTP
2052 connection is clearly beneficial. Whenever a delivery to a remote host is
2053 deferred,
2054 <indexterm role="concept">
2055 <primary>hints database</primary>
2056 <secondary>deferred deliveries</secondary>
2057 </indexterm>
2058 Exim makes a note in its hints database, and whenever a successful
2059 SMTP delivery has happened, it looks to see if any other messages are waiting
2060 for the same host. If any are found, they are sent over the same SMTP
2061 connection, subject to a configuration limit as to the maximum number in any
2062 one connection.
2063 </para>
2064 </section>
2065 <section id="SECID21">
2066 <title>Permanent delivery failure</title>
2067 <para>
2068 <indexterm role="concept">
2069 <primary>delivery</primary>
2070 <secondary>permanent failure</secondary>
2071 </indexterm>
2072 <indexterm role="concept">
2073 <primary>bounce message</primary>
2074 <secondary>when generated</secondary>
2075 </indexterm>
2076 When a message cannot be delivered to some or all of its intended recipients, a
2077 bounce message is generated. Temporary delivery failures turn into permanent
2078 errors when their timeout expires. All the addresses that fail in a given
2079 delivery attempt are listed in a single message. If the original message has
2080 many recipients, it is possible for some addresses to fail in one delivery
2081 attempt and others to fail subsequently, giving rise to more than one bounce
2082 message. The wording of bounce messages can be customized by the administrator.
2083 See chapter <xref linkend="CHAPemsgcust"/> for details.
2084 </para>
2085 <para>
2086 <indexterm role="concept">
2087 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2088 </indexterm>
2089 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2090 failed addresses, for the benefit of programs that try to analyse such messages
2091 automatically.
2092 </para>
2093 <para>
2094 <indexterm role="concept">
2095 <primary>bounce message</primary>
2096 <secondary>recipient of</secondary>
2097 </indexterm>
2098 A bounce message is normally sent to the sender of the original message, as
2099 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2100 address given in the MAIL command. However, when an address is expanded via a
2101 forward or alias file, an alternative address can be specified for delivery
2102 failures of the generated addresses. For a mailing list expansion (see section
2103 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2104 of the list.
2105 </para>
2106 </section>
2107 <section id="SECID22">
2108 <title>Failures to deliver bounce messages</title>
2109 <para>
2110 <indexterm role="concept">
2111 <primary>bounce message</primary>
2112 <secondary>failure to deliver</secondary>
2113 </indexterm>
2114 If a bounce message (either locally generated or received from a remote host)
2115 itself suffers a permanent delivery failure, the message is left on the queue,
2116 but it is frozen, awaiting the attention of an administrator. There are options
2117 that can be used to make Exim discard such failed messages, or to keep them
2118 for only a short time (see <option>timeout_frozen_after</option> and
2119 <option>ignore_bounce_errors_after</option>).
2120 </para>
2121 </section>
2122 </chapter>
2123
2124 <chapter id="CHID3">
2125 <title>Building and installing Exim</title>
2126 <para>
2127 <indexterm role="concept" id="IIDbuex" class="startofrange">
2128 <primary>building Exim</primary>
2129 </indexterm>
2130 </para>
2131 <section id="SECID23">
2132 <title>Unpacking</title>
2133 <para>
2134 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2135 creates a directory with the name of the current release (for example,
2136 <filename>exim-4.89</filename>) into which the following files are placed:
2137 </para>
2138 <informaltable frame="none">
2139 <tgroup cols="2" colsep="0" rowsep="0">
2140 <colspec colwidth="140pt" align="left"/>
2141 <colspec colwidth="254pt" align="left"/>
2142 <tbody>
2143 <row>
2144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2145 <entry>contains some acknowledgments</entry>
2146 </row>
2147 <row>
2148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2149 <entry>contains a reference to where changes are documented</entry>
2150 </row>
2151 <row>
2152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2153 <entry>the GNU General Public Licence</entry>
2154 </row>
2155 <row>
2156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2157 <entry>top-level make file</entry>
2158 </row>
2159 <row>
2160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2161 <entry>conditions for the use of Exim</entry>
2162 </row>
2163 <row>
2164 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2165 <entry>list of files, directories and simple build instructions</entry>
2166 </row>
2167 </tbody>
2168 </tgroup>
2169 </informaltable>
2170 <para>
2171 Other files whose names begin with <filename>README</filename> may also be present. The
2172 following subdirectories are created:
2173 </para>
2174 <informaltable frame="none">
2175 <tgroup cols="2" colsep="0" rowsep="0">
2176 <colspec colwidth="140pt" align="left"/>
2177 <colspec colwidth="254pt" align="left"/>
2178 <tbody>
2179 <row>
2180 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2181 <entry>an empty directory for local configuration files</entry>
2182 </row>
2183 <row>
2184 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2185 <entry>OS-specific files</entry>
2186 </row>
2187 <row>
2188 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2189 <entry>documentation files</entry>
2190 </row>
2191 <row>
2192 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2193 <entry>source files for the Exim monitor</entry>
2194 </row>
2195 <row>
2196 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2197 <entry>scripts used in the build process</entry>
2198 </row>
2199 <row>
2200 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2201 <entry>remaining source files</entry>
2202 </row>
2203 <row>
2204 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2205 <entry>independent utilities</entry>
2206 </row>
2207 </tbody>
2208 </tgroup>
2209 </informaltable>
2210 <para>
2211 The main utility programs are contained in the <filename>src</filename> directory, and are built
2212 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2213 that may be useful to some sites.
2214 </para>
2215 </section>
2216 <section id="SECID24">
2217 <title>Multiple machine architectures and operating systems</title>
2218 <para>
2219 <indexterm role="concept">
2220 <primary>building Exim</primary>
2221 <secondary>multiple OS/architectures</secondary>
2222 </indexterm>
2223 The building process for Exim is arranged to make it easy to build binaries for
2224 a number of different architectures and operating systems from the same set of
2225 source files. Compilation does not take place in the <filename>src</filename> directory.
2226 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2227 system.
2228 <indexterm role="concept">
2229 <primary>symbolic link</primary>
2230 <secondary>to build directory</secondary>
2231 </indexterm>
2232 Symbolic links to the sources are installed in this directory, which is where
2233 the actual building takes place. In most cases, Exim can discover the machine
2234 architecture and operating system for itself, but the defaults can be
2235 overridden if necessary.
2236 </para>
2237 </section>
2238 <section id="SECTpcre">
2239 <title>PCRE library</title>
2240 <para>
2241 <indexterm role="concept">
2242 <primary>PCRE library</primary>
2243 </indexterm>
2244 Exim no longer has an embedded PCRE library as the vast majority of
2245 modern systems include PCRE as a system library, although you may need
2246 to install the PCRE or PCRE development package for your operating
2247 system. If your system has a normal PCRE installation the Exim build
2248 process will need no further configuration. If the library or the
2249 headers are in an unusual location you will need to either set the PCRE_LIBS
2250 and INCLUDE directives appropriately,
2251 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2252 If your operating system has no
2253 PCRE support then you will need to obtain and build the current PCRE
2254 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2255 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2256 </para>
2257 </section>
2258 <section id="SECTdb">
2259 <title>DBM libraries</title>
2260 <para>
2261 <indexterm role="concept">
2262 <primary>DBM libraries</primary>
2263 <secondary>discussion of</secondary>
2264 </indexterm>
2265 <indexterm role="concept">
2266 <primary>hints database</primary>
2267 <secondary>DBM files used for</secondary>
2268 </indexterm>
2269 Even if you do not use any DBM files in your configuration, Exim still needs a
2270 DBM library in order to operate, because it uses indexed files for its hints
2271 databases. Unfortunately, there are a number of DBM libraries in existence, and
2272 different operating systems often have different ones installed.
2273 </para>
2274 <para>
2275 <indexterm role="concept">
2276 <primary>Solaris</primary>
2277 <secondary>DBM library for</secondary>
2278 </indexterm>
2279 <indexterm role="concept">
2280 <primary>IRIX, DBM library for</primary>
2281 </indexterm>
2282 <indexterm role="concept">
2283 <primary>BSD, DBM library for</primary>
2284 </indexterm>
2285 <indexterm role="concept">
2286 <primary>Linux, DBM library for</primary>
2287 </indexterm>
2288 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2289 Linux distribution, the DBM configuration should happen automatically, and you
2290 may be able to ignore this section. Otherwise, you may have to learn more than
2291 you would like about DBM libraries from what follows.
2292 </para>
2293 <para>
2294 <indexterm role="concept">
2295 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2296 </indexterm>
2297 Licensed versions of Unix normally contain a library of DBM functions operating
2298 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2299 versions of Unix seem to vary in what they contain as standard. In particular,
2300 some early versions of Linux have no default DBM library, and different
2301 distributors have chosen to bundle different libraries with their packaged
2302 versions. However, the more recent releases seem to have standardized on the
2303 Berkeley DB library.
2304 </para>
2305 <para>
2306 Different DBM libraries have different conventions for naming the files they
2307 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2308 possibilities:
2309 </para>
2310 <orderedlist numeration="arabic">
2311 <listitem>
2312 <para>
2313 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2314 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2315 </para>
2316 </listitem>
2317 <listitem>
2318 <para>
2319 <indexterm role="concept">
2320 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2321 </indexterm>
2322 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2323 compatibility interface it makes two different hard links to it with names
2324 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2325 file name is used unmodified.
2326 </para>
2327 </listitem>
2328 <listitem>
2329 <para>
2330 <indexterm role="concept">
2331 <primary>Berkeley DB library</primary>
2332 </indexterm>
2333 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2334 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2335 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2336 </para>
2337 </listitem>
2338 <listitem>
2339 <para>
2340 If the Berkeley package is used in its native mode, it operates on a single
2341 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2342 the traditional <emphasis>ndbm</emphasis> interface.
2343 </para>
2344 </listitem>
2345 <listitem>
2346 <para>
2347 To complicate things further, there are several very different versions of the
2348 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2349 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2350 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2351 versions of Berkeley DB can be obtained from
2352 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2353 </para>
2354 </listitem>
2355 <listitem>
2356 <para>
2357 <indexterm role="concept">
2358 <primary><emphasis>tdb</emphasis> DBM library</primary>
2359 </indexterm>
2360 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2361 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2362 operates on a single file.
2363 </para>
2364 </listitem>
2365 </orderedlist>
2366 <para>
2367 <indexterm role="concept">
2368 <primary>USE_DB</primary>
2369 </indexterm>
2370 <indexterm role="concept">
2371 <primary>DBM libraries</primary>
2372 <secondary>configuration for building</secondary>
2373 </indexterm>
2374 Exim and its utilities can be compiled to use any of these interfaces. In order
2375 to use any version of the Berkeley DB package in native mode, you must set
2376 USE_DB in an appropriate configuration file (typically
2377 <filename>Local/Makefile</filename>). For example:
2378 </para>
2379 <literallayout class="monospaced">
2380 USE_DB=yes
2381 </literallayout>
2382 <para>
2383 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2384 error is diagnosed if you set more than one of these.
2385 </para>
2386 <para>
2387 At the lowest level, the build-time configuration sets none of these options,
2388 thereby assuming an interface of type (1). However, some operating system
2389 configuration files (for example, those for the BSD operating systems and
2390 Linux) assume type (4) by setting USE_DB as their default, and the
2391 configuration files for Cygwin set USE_GDBM. Anything you set in
2392 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2393 </para>
2394 <para>
2395 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2396 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2397 in one of these lines:
2398 </para>
2399 <literallayout class="monospaced">
2400 DBMLIB = -ldb
2401 DBMLIB = -ltdb
2402 </literallayout>
2403 <para>
2404 Settings like that will work if the DBM library is installed in the standard
2405 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2406 the default path. You may need to set INCLUDE to specify where the header
2407 file is, and to specify the path to the library more fully in DBMLIB, as in
2408 this example:
2409 </para>
2410 <literallayout class="monospaced">
2411 INCLUDE=-I/usr/local/include/db-4.1
2412 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2413 </literallayout>
2414 <para>
2415 There is further detailed discussion about the various DBM libraries in the
2416 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2417 </para>
2418 </section>
2419 <section id="SECID25">
2420 <title>Pre-building configuration</title>
2421 <para>
2422 <indexterm role="concept">
2423 <primary>building Exim</primary>
2424 <secondary>pre-building configuration</secondary>
2425 </indexterm>
2426 <indexterm role="concept">
2427 <primary>configuration for building Exim</primary>
2428 </indexterm>
2429 <indexterm role="concept">
2430 <primary><filename>Local/Makefile</filename></primary>
2431 </indexterm>
2432 <indexterm role="concept">
2433 <primary><filename>src/EDITME</filename></primary>
2434 </indexterm>
2435 Before building Exim, a local configuration file that specifies options
2436 independent of any operating system has to be created with the name
2437 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2438 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2439 therein. These descriptions are therefore not repeated here. If you are
2440 building Exim for the first time, the simplest thing to do is to copy
2441 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2442 </para>
2443 <para>
2444 There are three settings that you must supply, because Exim will not build
2445 without them. They are the location of the run time configuration file
2446 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2447 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2448 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2449 a colon-separated list of file names; Exim uses the first of them that exists.
2450 </para>
2451 <para>
2452 There are a few other parameters that can be specified either at build time or
2453 at run time, to enable the same binary to be used on a number of different
2454 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2455 directory (if not within the spool directory) are fixed, it is recommended that
2456 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2457 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2458 be logged.
2459 </para>
2460 <para>
2461 <indexterm role="concept">
2462 <primary>content scanning</primary>
2463 <secondary>specifying at build time</secondary>
2464 </indexterm>
2465 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2466 access control lists are not compiled by default. If you want to include these
2467 facilities, you need to set
2468 </para>
2469 <literallayout class="monospaced">
2470 WITH_CONTENT_SCAN=yes
2471 </literallayout>
2472 <para>
2473 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2474 chapter <xref linkend="CHAPexiscan"/>.
2475 </para>
2476 <para>
2477 <indexterm role="concept">
2478 <primary><filename>Local/eximon.conf</filename></primary>
2479 </indexterm>
2480 <indexterm role="concept">
2481 <primary><filename>exim_monitor/EDITME</filename></primary>
2482 </indexterm>
2483 If you are going to build the Exim monitor, a similar configuration process is
2484 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2485 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2486 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2487 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2488 </para>
2489 <para>
2490 This is all the configuration that is needed in straightforward cases for known
2491 operating systems. However, the building process is set up so that it is easy
2492 to override options that are set by default or by operating-system-specific
2493 configuration files, for example to change the name of the C compiler, which
2494 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2495 do this.
2496 </para>
2497 </section>
2498 <section id="SECID26">
2499 <title>Support for iconv()</title>
2500 <para>
2501 <indexterm role="concept">
2502 <primary><function>iconv()</function> support</primary>
2503 </indexterm>
2504 <indexterm role="concept">
2505 <primary>RFC 2047</primary>
2506 </indexterm>
2507 The contents of header lines in messages may be encoded according to the rules
2508 described RFC 2047. This makes it possible to transmit characters that are not
2509 in the ASCII character set, and to label them as being in a particular
2510 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2511 mechanism, it decodes them, and translates them into a specified character set
2512 (default is set at build time). The translation is possible only if the operating system
2513 supports the <function>iconv()</function> function.
2514 </para>
2515 <para>
2516 However, some of the operating systems that supply <function>iconv()</function> do not support
2517 very many conversions. The GNU <option>libiconv</option> library (available from
2518 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2519 systems to remedy this deficiency, as well as on systems that do not supply
2520 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2521 </para>
2522 <literallayout class="monospaced">
2523 HAVE_ICONV=yes
2524 </literallayout>
2525 <para>
2526 to your <filename>Local/Makefile</filename> and rebuild Exim.
2527 </para>
2528 </section>
2529 <section id="SECTinctlsssl">
2530 <title>Including TLS/SSL encryption support</title>
2531 <para>
2532 <indexterm role="concept">
2533 <primary>TLS</primary>
2534 <secondary>including support for TLS</secondary>
2535 </indexterm>
2536 <indexterm role="concept">
2537 <primary>encryption</primary>
2538 <secondary>including support for</secondary>
2539 </indexterm>
2540 <indexterm role="concept">
2541 <primary>SUPPORT_TLS</primary>
2542 </indexterm>
2543 <indexterm role="concept">
2544 <primary>OpenSSL</primary>
2545 <secondary>building Exim with</secondary>
2546 </indexterm>
2547 <indexterm role="concept">
2548 <primary>GnuTLS</primary>
2549 <secondary>building Exim with</secondary>
2550 </indexterm>
2551 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2552 command as per RFC 2487. It can also support legacy clients that expect to
2553 start a TLS session immediately on connection to a non-standard port (see the
2554 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2555 line option).
2556 </para>
2557 <para>
2558 If you want to build Exim with TLS support, you must first install either the
2559 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2560 implementing SSL.
2561 </para>
2562 <para>
2563 If OpenSSL is installed, you should set
2564 </para>
2565 <literallayout class="monospaced">
2566 SUPPORT_TLS=yes
2567 TLS_LIBS=-lssl -lcrypto
2568 </literallayout>
2569 <para>
2570 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2571 OpenSSL library and include files. For example:
2572 </para>
2573 <literallayout class="monospaced">
2574 SUPPORT_TLS=yes
2575 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2576 TLS_INCLUDE=-I/usr/local/openssl/include/
2577 </literallayout>
2578 <para>
2579 <indexterm role="concept">
2580 <primary>pkg-config</primary>
2581 <secondary>OpenSSL</secondary>
2582 </indexterm>
2583 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2584 </para>
2585 <literallayout class="monospaced">
2586 SUPPORT_TLS=yes
2587 USE_OPENSSL_PC=openssl
2588 </literallayout>
2589 <para>
2590 <indexterm role="concept">
2591 <primary>USE_GNUTLS</primary>
2592 </indexterm>
2593 If GnuTLS is installed, you should set
2594 </para>
2595 <literallayout class="monospaced">
2596 SUPPORT_TLS=yes
2597 USE_GNUTLS=yes
2598 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2599 </literallayout>
2600 <para>
2601 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2602 library and include files. For example:
2603 </para>
2604 <literallayout class="monospaced">
2605 SUPPORT_TLS=yes
2606 USE_GNUTLS=yes
2607 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2608 TLS_INCLUDE=-I/usr/gnu/include
2609 </literallayout>
2610 <para>
2611 <indexterm role="concept">
2612 <primary>pkg-config</primary>
2613 <secondary>GnuTLS</secondary>
2614 </indexterm>
2615 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2616 </para>
2617 <literallayout class="monospaced">
2618 SUPPORT_TLS=yes
2619 USE_GNUTLS=yes
2620 USE_GNUTLS_PC=gnutls
2621 </literallayout>
2622 <para>
2623 You do not need to set TLS_INCLUDE if the relevant directory is already
2624 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2625 given in chapter <xref linkend="CHAPTLS"/>.
2626 </para>
2627 </section>
2628 <section id="SECID27">
2629 <title>Use of tcpwrappers</title>
2630 <para>
2631 <indexterm role="concept">
2632 <primary>tcpwrappers, building Exim to support</primary>
2633 </indexterm>
2634 <indexterm role="concept">
2635 <primary>USE_TCP_WRAPPERS</primary>
2636 </indexterm>
2637 <indexterm role="concept">
2638 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2639 </indexterm>
2640 <indexterm role="concept">
2641 <primary>tcp_wrappers_daemon_name</primary>
2642 </indexterm>
2643 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2644 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2645 alternative to Exim&#x2019;s own checking facilities for installations that are
2646 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2647 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2648 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2649 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2650 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2651 you might have
2652 </para>
2653 <literallayout class="monospaced">
2654 USE_TCP_WRAPPERS=yes
2655 CFLAGS=-O -I/usr/local/include
2656 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2657 </literallayout>
2658 <para>
2659 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2660 files is <quote>exim</quote>. For example, the line
2661 </para>
2662 <literallayout class="monospaced">
2663 exim : LOCAL  192.168.1.  .friendly.domain.example
2664 </literallayout>
2665 <para>
2666 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2667 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2668 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2669 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2670 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2671 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2672 further details.
2673 </para>
2674 </section>
2675 <section id="SECID28">
2676 <title>Including support for IPv6</title>
2677 <para>
2678 <indexterm role="concept">
2679 <primary>IPv6</primary>
2680 <secondary>including support for</secondary>
2681 </indexterm>
2682 Exim contains code for use on systems that have IPv6 support. Setting
2683 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2684 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2685 where the IPv6 support is not fully integrated into the normal include and
2686 library files.
2687 </para>
2688 <para>
2689 Two different types of DNS record for handling IPv6 addresses have been
2690 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2691 currently seen as the mainstream. Another record type called A6 was proposed
2692 as better than AAAA because it had more flexibility. However, it was felt to be
2693 over-complex, and its status was reduced to <quote>experimental</quote>.
2694 Exim used to
2695 have a compile option for including A6 record support but this has now been
2696 withdrawn.
2697 </para>
2698 </section>
2699 <section id="SECTdynamicmodules">
2700 <title>Dynamically loaded lookup module support</title>
2701 <para>
2702 <indexterm role="concept">
2703 <primary>lookup modules</primary>
2704 </indexterm>
2705 <indexterm role="concept">
2706 <primary>dynamic modules</primary>
2707 </indexterm>
2708 <indexterm role="concept">
2709 <primary>.so building</primary>
2710 </indexterm>
2711 On some platforms, Exim supports not compiling all lookup types directly into
2712 the main binary, instead putting some into external modules which can be loaded
2713 on demand.
2714 This permits packagers to build Exim with support for lookups with extensive
2715 library dependencies without requiring all users to install all of those
2716 dependencies.
2717 Most, but not all, lookup types can be built this way.
2718 </para>
2719 <para>
2720 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2721 installed; Exim will only load modules from that directory, as a security
2722 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2723 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2724 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2725 see <filename>src/EDITME</filename> for details.
2726 </para>
2727 <para>
2728 Then, for each module to be loaded dynamically, define the relevant
2729 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2730 For example, this will build in lsearch but load sqlite and mysql support
2731 on demand:
2732 </para>
2733 <literallayout class="monospaced">
2734 LOOKUP_LSEARCH=yes
2735 LOOKUP_SQLITE=2
2736 LOOKUP_MYSQL=2
2737 </literallayout>
2738 </section>
2739 <section id="SECID29">
2740 <title>The building process</title>
2741 <para>
2742 <indexterm role="concept">
2743 <primary>build directory</primary>
2744 </indexterm>
2745 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2746 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2747 operating system types, and creates a build directory if one does not exist.
2748 For example, on a Sun system running Solaris 8, the directory
2749 <filename>build-SunOS5-5.8-sparc</filename> is created.
2750 <indexterm role="concept">
2751 <primary>symbolic link</primary>
2752 <secondary>to source files</secondary>
2753 </indexterm>
2754 Symbolic links to relevant source files are installed in the build directory.
2755 </para>
2756 <para>
2757 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2758 a make file inside the build directory, using the configuration files from the
2759 <filename>Local</filename> directory. The new make file is then passed to another instance of
2760 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2761 then compiling and linking the binaries for the Exim monitor (if configured), a
2762 number of utility programs, and finally Exim itself. The command <literal>make
2763 makefile</literal> can be used to force a rebuild of the make file in the build
2764 directory, should this ever be necessary.
2765 </para>
2766 <para>
2767 If you have problems building Exim, check for any comments there may be in the
2768 <filename>README</filename> file concerning your operating system, and also take a look at the
2769 FAQ, where some common problems are covered.
2770 </para>
2771 </section>
2772 <section id="SECID283">
2773 <title>Output from <quote>make</quote></title>
2774 <para>
2775 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2776 unreadable, because these lines can be very long. For this reason, the normal
2777 output is suppressed by default, and instead output similar to that which
2778 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2779 each module that is being compiled or linked. However, it is still possible to
2780 get the full output, by calling <emphasis>make</emphasis> like this:
2781 </para>
2782 <literallayout class="monospaced">
2783 FULLECHO='' make -e
2784 </literallayout>
2785 <para>
2786 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2787 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2788 given in addition to the short output.
2789 </para>
2790 </section>
2791 <section id="SECToverride">
2792 <title>Overriding build-time options for Exim</title>
2793 <para>
2794 <indexterm role="concept">
2795 <primary>build-time options, overriding</primary>
2796 </indexterm>
2797 The main make file that is created at the beginning of the building process
2798 consists of the concatenation of a number of files which set configuration
2799 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2800 more than once, the last setting overrides any previous ones. This provides a
2801 convenient way of overriding defaults. The files that are concatenated are, in
2802 order:
2803 </para>
2804 <literallayout>
2805 <filename>OS/Makefile-Default</filename>
2806 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2807 <filename>Local/Makefile</filename>
2808 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2809 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2810 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2811 <filename>OS/Makefile-Base</filename>
2812 </literallayout>
2813 <para>
2814 <indexterm role="concept">
2815 <primary><filename>Local/Makefile</filename></primary>
2816 </indexterm>
2817 <indexterm role="concept">
2818 <primary>building Exim</primary>
2819 <secondary>operating system type</secondary>
2820 </indexterm>
2821 <indexterm role="concept">
2822 <primary>building Exim</primary>
2823 <secondary>architecture type</secondary>
2824 </indexterm>
2825 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2826 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2827 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2828 and are often not needed.
2829 </para>
2830 <para>
2831 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2832 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2833 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2834 values are used, thereby providing a means of forcing particular settings.
2835 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2836 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2837 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2838 that Exim expects. You can run these scripts directly from the shell in order
2839 to find out what values are being used on your system.
2840 </para>
2841 <para>
2842 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2843 therein. Some (but not all) are mentioned below. If there is something that
2844 needs changing, review the contents of this file and the contents of the make
2845 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2846 default values are.
2847 </para>
2848 <para>
2849 <indexterm role="concept">
2850 <primary>building Exim</primary>
2851 <secondary>overriding default settings</secondary>
2852 </indexterm>
2853 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2854 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2855 need to change the original files. Instead, you should make the changes by
2856 putting the new values in an appropriate <filename>Local</filename> file. For example,
2857 <indexterm role="concept">
2858 <primary>Tru64-Unix build-time settings</primary>
2859 </indexterm>
2860 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2861 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2862 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2863 called with the option <option>-std1</option>, to make it recognize some of the features of
2864 Standard C that Exim uses. (Most other compilers recognize Standard C by
2865 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2866 containing the lines
2867 </para>
2868 <literallayout class="monospaced">
2869 CC=cc
2870 CFLAGS=-std1
2871 </literallayout>
2872 <para>
2873 If you are compiling for just one operating system, it may be easier to put
2874 these lines directly into <filename>Local/Makefile</filename>.
2875 </para>
2876 <para>
2877 Keeping all your local configuration settings separate from the distributed
2878 files makes it easy to transfer them to new versions of Exim simply by copying
2879 the contents of the <filename>Local</filename> directory.
2880 </para>
2881 <para>
2882 <indexterm role="concept">
2883 <primary>NIS lookup type</primary>
2884 <secondary>including support for</secondary>
2885 </indexterm>
2886 <indexterm role="concept">
2887 <primary>NIS+ lookup type</primary>
2888 <secondary>including support for</secondary>
2889 </indexterm>
2890 <indexterm role="concept">
2891 <primary>LDAP</primary>
2892 <secondary>including support for</secondary>
2893 </indexterm>
2894 <indexterm role="concept">
2895 <primary>lookup</primary>
2896 <secondary>inclusion in binary</secondary>
2897 </indexterm>
2898 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2899 lookup, but not all systems have these components installed, so the default is
2900 not to include the relevant code in the binary. All the different kinds of file
2901 and database lookup that Exim supports are implemented as separate code modules
2902 which are included only if the relevant compile-time options are set. In the
2903 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2904 </para>
2905 <literallayout class="monospaced">
2906 LOOKUP_LDAP=yes
2907 LOOKUP_NIS=yes
2908 LOOKUP_NISPLUS=yes
2909 </literallayout>
2910 <para>
2911 and similar settings apply to the other lookup types. They are all listed in
2912 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2913 libraries need to be installed before compiling Exim.
2914 <indexterm role="concept">
2915 <primary>cdb</primary>
2916 <secondary>including support for</secondary>
2917 </indexterm>
2918 However, there are some optional lookup types (such as cdb) for which
2919 the code is entirely contained within Exim, and no external include
2920 files or libraries are required. When a lookup type is not included in the
2921 binary, attempts to configure Exim to use it cause run time configuration
2922 errors.
2923 </para>
2924 <para>
2925 <indexterm role="concept">
2926 <primary>pkg-config</primary>
2927 <secondary>lookups</secondary>
2928 </indexterm>
2929 <indexterm role="concept">
2930 <primary>pkg-config</primary>
2931 <secondary>authenticators</secondary>
2932 </indexterm>
2933 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2934 about how to compile against a library; Exim has some initial support for
2935 being able to use pkg-config for lookups and authenticators.  For any given
2936 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2937 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2938 name of the package to be queried.  The results of querying via the
2939 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2940 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2941 syntax.  For instance:
2942 </para>
2943 <literallayout class="monospaced">
2944 LOOKUP_SQLITE=yes
2945 LOOKUP_SQLITE_PC=sqlite3
2946 AUTH_GSASL=yes
2947 AUTH_GSASL_PC=libgsasl
2948 AUTH_HEIMDAL_GSSAPI=yes
2949 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2950 </literallayout>
2951 <para>
2952 <indexterm role="concept">
2953 <primary>Perl</primary>
2954 <secondary>including support for</secondary>
2955 </indexterm>
2956 Exim can be linked with an embedded Perl interpreter, allowing Perl
2957 subroutines to be called during string expansion. To enable this facility,
2958 </para>
2959 <literallayout class="monospaced">
2960 EXIM_PERL=perl.o
2961 </literallayout>
2962 <para>
2963 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2964 chapter <xref linkend="CHAPperl"/>.
2965 </para>
2966 <para>
2967 <indexterm role="concept">
2968 <primary>X11 libraries, location of</primary>
2969 </indexterm>
2970 The location of the X11 libraries is something that varies a lot between
2971 operating systems, and there may be different versions of X11 to cope
2972 with. Exim itself makes no use of X11, but if you are compiling the Exim
2973 monitor, the X11 libraries must be available.
2974 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2975 </para>
2976 <literallayout class="monospaced">
2977 X11=/usr/X11R6
2978 XINCLUDE=-I$(X11)/include
2979 XLFLAGS=-L$(X11)/lib
2980 </literallayout>
2981 <para>
2982 These are overridden in some of the operating-system configuration files. For
2983 example, in <filename>OS/Makefile-SunOS5</filename> there is
2984 </para>
2985 <literallayout class="monospaced">
2986 X11=/usr/openwin
2987 XINCLUDE=-I$(X11)/include
2988 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2989 </literallayout>
2990 <para>
2991 If you need to override the default setting for your operating system, place a
2992 definition of all three of these variables into your
2993 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2994 </para>
2995 <para>
2996 <indexterm role="concept">
2997 <primary>EXTRALIBS</primary>
2998 </indexterm>
2999 If you need to add any extra libraries to the link steps, these can be put in a
3000 variable called EXTRALIBS, which appears in all the link commands, but by
3001 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3002 command for linking the main Exim binary, and not for any associated utilities.
3003 </para>
3004 <para>
3005 <indexterm role="concept">
3006 <primary>DBM libraries</primary>
3007 <secondary>configuration for building</secondary>
3008 </indexterm>
3009 There is also DBMLIB, which appears in the link commands for binaries that
3010 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3011 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3012 binary, and which can be used, for example, to include additional X11
3013 libraries.
3014 </para>
3015 <para>
3016 <indexterm role="concept">
3017 <primary>configuration file</primary>
3018 <secondary>editing</secondary>
3019 </indexterm>
3020 The make file copes with rebuilding Exim correctly if any of the configuration
3021 files are edited. However, if an optional configuration file is deleted, it is
3022 necessary to touch the associated non-optional file (that is,
3023 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3024 </para>
3025 </section>
3026 <section id="SECID30">
3027 <title>OS-specific header files</title>
3028 <para>
3029 <indexterm role="concept">
3030 <primary><filename>os.h</filename></primary>
3031 </indexterm>
3032 <indexterm role="concept">
3033 <primary>building Exim</primary>
3034 <secondary>OS-specific C header files</secondary>
3035 </indexterm>
3036 The <filename>OS</filename> directory contains a number of files with names of the form
3037 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3038 normally need to be changed. There is a list of macro settings that are
3039 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3040 are porting Exim to a new operating system.
3041 </para>
3042 </section>
3043 <section id="SECID31">
3044 <title>Overriding build-time options for the monitor</title>
3045 <para>
3046 <indexterm role="concept">
3047 <primary>building Eximon</primary>
3048 </indexterm>
3049 A similar process is used for overriding things when building the Exim monitor,
3050 where the files that are involved are
3051 </para>
3052 <literallayout>
3053 <filename>OS/eximon.conf-Default</filename>
3054 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3055 <filename>Local/eximon.conf</filename>
3056 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3057 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3058 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3059 </literallayout>
3060 <para>
3061 <indexterm role="concept">
3062 <primary><filename>Local/eximon.conf</filename></primary>
3063 </indexterm>
3064 As with Exim itself, the final three files need not exist, and in this case the
3065 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3066 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3067 variables of the same name, preceded by EXIMON_. For example, setting
3068 EXIMON_LOG_DEPTH in the environment overrides the value of
3069 LOG_DEPTH at run time.
3070 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3071 </para>
3072 </section>
3073 <section id="SECID32">
3074 <title>Installing Exim binaries and scripts</title>
3075 <para>
3076 <indexterm role="concept">
3077 <primary>installing Exim</primary>
3078 </indexterm>
3079 <indexterm role="concept">
3080 <primary>BIN_DIRECTORY</primary>
3081 </indexterm>
3082 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3083 arguments. The script copies binaries and utility scripts into the directory
3084 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3085 <indexterm role="concept">
3086 <primary>setuid</primary>
3087 <secondary>installing Exim with</secondary>
3088 </indexterm>
3089 The install script copies files only if they are newer than the files they are
3090 going to replace. The Exim binary is required to be owned by root and have the
3091 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3092 install</literal> as root so that it can set up the Exim binary in this way. However, in
3093 some special situations (for example, if a host is doing no local deliveries)
3094 it may be possible to run Exim without making the binary setuid root (see
3095 chapter <xref linkend="CHAPsecurity"/> for details).
3096 </para>
3097 <para>
3098 <indexterm role="concept">
3099 <primary>CONFIGURE_FILE</primary>
3100 </indexterm>
3101 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3102 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3103 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3104 by the installation script. If a run time configuration file already exists, it
3105 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3106 alternative files, no default is installed.
3107 </para>
3108 <para>
3109 <indexterm role="concept">
3110 <primary>system aliases file</primary>
3111 </indexterm>
3112 <indexterm role="concept">
3113 <primary><filename>/etc/aliases</filename></primary>
3114 </indexterm>
3115 One change is made to the default configuration file when it is installed: the
3116 default configuration contains a router that references a system aliases file.
3117 The path to this file is set to the value specified by
3118 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3119 If the system aliases file does not exist, the installation script creates it,
3120 and outputs a comment to the user.
3121 </para>
3122 <para>
3123 The created file contains no aliases, but it does contain comments about the
3124 aliases a site should normally have. Mail aliases have traditionally been
3125 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3126 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3127 Exim&#x2019;s configuration if necessary.
3128 </para>
3129 <para>
3130 The default configuration uses the local host&#x2019;s name as the only local domain,
3131 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3132 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3133 directories are supported, but no NIS or NIS+ support is configured. Domains
3134 other than the name of the local host are routed using the DNS, with delivery
3135 over SMTP.
3136 </para>
3137 <para>
3138 It is possible to install Exim for special purposes (such as building a binary
3139 distribution) in a private part of the file system. You can do this by a
3140 command such as
3141 </para>
3142 <literallayout class="monospaced">
3143 make DESTDIR=/some/directory/ install
3144 </literallayout>
3145 <para>
3146 This has the effect of pre-pending the specified directory to all the file
3147 paths, except the name of the system aliases file that appears in the default
3148 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3149 For backwards compatibility, ROOT is used if DESTDIR is not set,
3150 but this usage is deprecated.
3151 </para>
3152 <para>
3153 <indexterm role="concept">
3154 <primary>installing Exim</primary>
3155 <secondary>what is not installed</secondary>
3156 </indexterm>
3157 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3158 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3159 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3160 directory are copied, except for the info files when you have set
3161 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3162 </para>
3163 <para>
3164 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3165 to their names. The Exim binary itself, however, is handled differently. It is
3166 installed under a name that includes the version number and the compile number,
3167 for example <filename>exim-4.89-1</filename>. The script then arranges for a symbolic link
3168 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3169 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3170 from the directory (as seen by other processes).
3171 </para>
3172 <para>
3173 <indexterm role="concept">
3174 <primary>installing Exim</primary>
3175 <secondary>testing the script</secondary>
3176 </indexterm>
3177 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3178 real, you can pass the <option>-n</option> option to the installation script by this
3179 command:
3180 </para>
3181 <literallayout class="monospaced">
3182 make INSTALL_ARG=-n install
3183 </literallayout>
3184 <para>
3185 The contents of the variable INSTALL_ARG are passed to the installation
3186 script. You do not need to be root to run this test. Alternatively, you can run
3187 the installation script directly, but this must be from within the build
3188 directory. For example, from the top-level Exim directory you could use this
3189 command:
3190 </para>
3191 <literallayout class="monospaced">
3192 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3193 </literallayout>
3194 <para>
3195 <indexterm role="concept">
3196 <primary>installing Exim</primary>
3197 <secondary>install script options</secondary>
3198 </indexterm>
3199 There are two other options that can be supplied to the installation script.
3200 </para>
3201 <itemizedlist>
3202 <listitem>
3203 <para>
3204 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3205 to root, and the call to make it a setuid binary.
3206 </para>
3207 </listitem>
3208 <listitem>
3209 <para>
3210 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3211 installed binary.
3212 </para>
3213 </listitem>
3214 </itemizedlist>
3215 <para>
3216 INSTALL_ARG can be used to pass these options to the script. For example:
3217 </para>
3218 <literallayout class="monospaced">
3219 make INSTALL_ARG=-no_symlink install
3220 </literallayout>
3221 <para>
3222 The installation script can also be given arguments specifying which files are
3223 to be copied. For example, to install just the Exim binary, and nothing else,
3224 without creating the symbolic link, you could use:
3225 </para>
3226 <literallayout class="monospaced">
3227 make INSTALL_ARG='-no_symlink exim' install
3228 </literallayout>
3229 </section>
3230 <section id="SECTinsinfdoc">
3231 <title>Installing info documentation</title>
3232 <para>
3233 <indexterm role="concept">
3234 <primary>installing Exim</primary>
3235 <secondary><emphasis>info</emphasis> documentation</secondary>
3236 </indexterm>
3237 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3238 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3239 distribution. Instead it is available separately from the ftp site (see section
3240 <xref linkend="SECTavail"/>).
3241 </para>
3242 <para>
3243 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3244 source of the documentation is found in the source tree, running <literal>make
3245 install</literal> automatically builds the info files and installs them.
3246 </para>
3247 </section>
3248 <section id="SECID33">
3249 <title>Setting up the spool directory</title>
3250 <para>
3251 <indexterm role="concept">
3252 <primary>spool directory</primary>
3253 <secondary>creating</secondary>
3254 </indexterm>
3255 When it starts up, Exim tries to create its spool directory if it does not
3256 exist. The Exim uid and gid are used for the owner and group of the spool
3257 directory. Sub-directories are automatically created in the spool directory as
3258 necessary.
3259 </para>
3260 </section>
3261 <section id="SECID34">
3262 <title>Testing</title>
3263 <para>
3264 <indexterm role="concept">
3265 <primary>testing</primary>
3266 <secondary>installation</secondary>
3267 </indexterm>
3268 Having installed Exim, you can check that the run time configuration file is
3269 syntactically valid by running the following command, which assumes that the
3270 Exim binary directory is within your PATH environment variable:
3271 </para>
3272 <literallayout class="monospaced">
3273 exim -bV
3274 </literallayout>
3275 <para>
3276 If there are any errors in the configuration file, Exim outputs error messages.
3277 Otherwise it outputs the version number and build date,
3278 the DBM library that is being used, and information about which drivers and
3279 other optional code modules are included in the binary.
3280 Some simple routing tests can be done by using the address testing option. For
3281 example,
3282 </para>
3283 <literallayout>
3284 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3285 </literallayout>
3286 <para>
3287 should verify that it recognizes a local mailbox, and
3288 </para>
3289 <literallayout>
3290 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3291 </literallayout>
3292 <para>
3293 a remote one. Then try getting it to deliver mail, both locally and remotely.
3294 This can be done by passing messages directly to Exim, without going through a
3295 user agent. For example:
3296 </para>
3297 <literallayout class="monospaced">
3298 exim -v postmaster@your.domain.example
3299 From: user@your.domain.example
3300 To: postmaster@your.domain.example
3301 Subject: Testing Exim
3302
3303 This is a test message.
3304 ^D
3305 </literallayout>
3306 <para>
3307 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3308 In this case you should see copies of three log lines, one for the message&#x2019;s
3309 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3310 </para>
3311 <para>
3312 <indexterm role="concept">
3313 <primary>delivery</primary>
3314 <secondary>problems with</secondary>
3315 </indexterm>
3316 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3317 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3318 of information is running Exim with debugging turned on, by specifying the
3319 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3320 with debugging turned on by a command of the form
3321 </para>
3322 <literallayout>
3323 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3324 </literallayout>
3325 <para>
3326 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3327 produces rather a lot of output, but you can cut this down to specific areas.
3328 For example, if you use <option>-d-all+route</option> only the debugging information
3329 relevant to routing is included. (See the <option>-d</option> option in chapter
3330 <xref linkend="CHAPcommandline"/> for more details.)
3331 </para>
3332 <para>
3333 <indexterm role="concept">
3334 <primary><quote>sticky</quote> bit</primary>
3335 </indexterm>
3336 <indexterm role="concept">
3337 <primary>lock files</primary>
3338 </indexterm>
3339 One specific problem that has shown up on some sites is the inability to do
3340 local deliveries into a shared mailbox directory, because it does not have the
3341 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3342 writing to a mailbox file, and if it cannot create the lock file, the delivery
3343 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3344 directory, or by setting a specific group for local deliveries and allowing
3345 that group to create files in the directory (see the comments above the
3346 <command>local_delivery</command> transport in the default configuration file). Another
3347 approach is to configure Exim not to use lock files, but just to rely on
3348 <function>fcntl()</function> locking instead. However, you should do this only if all user
3349 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3350 see chapter <xref linkend="CHAPappendfile"/>.
3351 </para>
3352 <para>
3353 One thing that cannot be tested on a system that is already running an MTA is
3354 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3355 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3356 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3357 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3358 incoming SMTP mail.
3359 </para>
3360 <para>
3361 Testing a new version on a system that is already running Exim can most easily
3362 be done by building a binary with a different CONFIGURE_FILE setting. From
3363 within the run time configuration, all other file and directory names
3364 that Exim uses can be altered, in order to keep it entirely clear of the
3365 production version.
3366 </para>
3367 </section>
3368 <section id="SECID35">
3369 <title>Replacing another MTA with Exim</title>
3370 <para>
3371 <indexterm role="concept">
3372 <primary>replacing another MTA</primary>
3373 </indexterm>
3374 Building and installing Exim for the first time does not of itself put it in
3375 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3376 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3377 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3378 binary in order to get the user agents to pass messages to Exim. This is
3379 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3380 or <filename>/usr/lib/sendmail</filename>
3381 <indexterm role="concept">
3382 <primary>symbolic link</primary>
3383 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3384 </indexterm>
3385 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3386 privilege and executable status from the old MTA. It is then necessary to stop
3387 and restart the mailer daemon, if one is running.
3388 </para>
3389 <para>
3390 <indexterm role="concept">
3391 <primary>FreeBSD, MTA indirection</primary>
3392 </indexterm>
3393 <indexterm role="concept">
3394 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3395 </indexterm>
3396 Some operating systems have introduced alternative ways of switching MTAs. For
3397 example, if you are running FreeBSD, you need to edit the file
3398 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3399 described. A typical example of the contents of this file for running Exim is
3400 as follows:
3401 </para>
3402 <literallayout class="monospaced">
3403 sendmail            /usr/exim/bin/exim
3404 send-mail           /usr/exim/bin/exim
3405 mailq               /usr/exim/bin/exim -bp
3406 newaliases          /usr/bin/true
3407 </literallayout>
3408 <para>
3409 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3410 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3411 favourite user agent.
3412 </para>
3413 <para>
3414 You should consider what to tell your users about the change of MTA. Exim may
3415 have different capabilities to what was previously running, and there are
3416 various operational differences such as the text of messages produced by
3417 command line options and in bounce messages. If you allow your users to make
3418 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3419 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3420 </para>
3421 </section>
3422 <section id="SECID36">
3423 <title>Upgrading Exim</title>
3424 <para>
3425 <indexterm role="concept">
3426 <primary>upgrading Exim</primary>
3427 </indexterm>
3428 If you are already running Exim on your host, building and installing a new
3429 version automatically makes it available to MUAs, or any other programs that
3430 call the MTA directly. However, if you are running an Exim daemon, you do need
3431 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3432 new binary. You do not need to stop processing mail in order to install a new
3433 version of Exim. The install script does not modify an existing runtime
3434 configuration file.
3435 </para>
3436 </section>
3437 <section id="SECID37">
3438 <title>Stopping the Exim daemon on Solaris</title>
3439 <para>
3440 <indexterm role="concept">
3441 <primary>Solaris</primary>
3442 <secondary>stopping Exim on</secondary>
3443 </indexterm>
3444 The standard command for stopping the mailer daemon on Solaris is
3445 </para>
3446 <literallayout class="monospaced">
3447 /etc/init.d/sendmail stop
3448 </literallayout>
3449 <para>
3450 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3451 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3452 for the text <quote>sendmail</quote>; this is not present because the actual program name
3453 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3454 solution is to replace the line that finds the process id with something like
3455 </para>
3456 <literallayout class="monospaced">
3457 pid=`cat /var/spool/exim/exim-daemon.pid`
3458 </literallayout>
3459 <para>
3460 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3461 </para>
3462 <para>
3463 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3464 still be received from local processes, and if automatic delivery is configured
3465 (the normal case), deliveries will still occur.
3466 </para>
3467 </section>
3468 </chapter>
3469
3470 <chapter id="CHAPcommandline">
3471 <title>The Exim command line</title>
3472 <para>
3473 <indexterm role="concept" id="IIDclo1" class="startofrange">
3474 <primary>command line</primary>
3475 <secondary>options</secondary>
3476 </indexterm>
3477 <indexterm role="concept" id="IIDclo2" class="startofrange">
3478 <primary>options</primary>
3479 <secondary>command line</secondary>
3480 </indexterm>
3481 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3482 each starting with a hyphen character, followed by a number of arguments. The
3483 options are compatible with the main options of Sendmail, and there are also
3484 some additional options, some of which are compatible with Smail 3. Certain
3485 combinations of options do not make sense, and provoke an error if used.
3486 The form of the arguments depends on which options are set.
3487 </para>
3488 <section id="SECID38">
3489 <title>Setting options by program name</title>
3490 <para>
3491 <indexterm role="concept">
3492 <primary><emphasis>mailq</emphasis></primary>
3493 </indexterm>
3494 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3495 were present before any other options.
3496 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3497 standard output.
3498 This feature is for compatibility with some systems that contain a command of
3499 that name in one of the standard libraries, symbolically linked to
3500 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3501 </para>
3502 <para>
3503 <indexterm role="concept">
3504 <primary><emphasis>rsmtp</emphasis></primary>
3505 </indexterm>
3506 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3507 were present before any other options, for compatibility with Smail. The
3508 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3509 format.
3510 </para>
3511 <para>
3512 <indexterm role="concept">
3513 <primary><emphasis>rmail</emphasis></primary>
3514 </indexterm>
3515 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3516 <option>-oee</option> options were present before any other options, for compatibility with
3517 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3518 </para>
3519 <para>
3520 <indexterm role="concept">
3521 <primary><emphasis>runq</emphasis></primary>
3522 </indexterm>
3523 <indexterm role="concept">
3524 <primary>queue runner</primary>
3525 </indexterm>
3526 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3527 were present before any other options, for compatibility with Smail. The <option>-q</option>
3528 option causes a single queue runner process to be started.
3529 </para>
3530 <para>
3531 <indexterm role="concept">
3532 <primary><emphasis>newaliases</emphasis></primary>
3533 </indexterm>
3534 <indexterm role="concept">
3535 <primary>alias file</primary>
3536 <secondary>building</secondary>
3537 </indexterm>
3538 <indexterm role="concept">
3539 <primary>Sendmail compatibility</primary>
3540 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3541 </indexterm>
3542 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3543 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3544 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3545 the concept of a single alias file, but can be configured to run a given
3546 command if called with the <option>-bi</option> option.
3547 </para>
3548 </section>
3549 <section id="SECTtrustedadmin">
3550 <title>Trusted and admin users</title>
3551 <para>
3552 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3553 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3554 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3555 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3556 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3557 </para>
3558 <itemizedlist>
3559 <listitem>
3560 <para>
3561 <indexterm role="concept">
3562 <primary>trusted users</primary>
3563 <secondary>definition of</secondary>
3564 </indexterm>
3565 <indexterm role="concept">
3566 <primary>user</primary>
3567 <secondary>trusted definition of</secondary>
3568 </indexterm>
3569 The trusted users are root, the Exim user, any user listed in the
3570 <option>trusted_users</option> configuration option, and any user whose current group or any
3571 supplementary group is one of those listed in the <option>trusted_groups</option>
3572 configuration option. Note that the Exim group is not automatically trusted.
3573 </para>
3574 <para>
3575 <indexterm role="concept">
3576 <primary><quote>From</quote> line</primary>
3577 </indexterm>
3578 <indexterm role="concept">
3579 <primary>envelope sender</primary>
3580 </indexterm>
3581 Trusted users are always permitted to use the <option>-f</option> option or a leading
3582 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3583 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3584 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3585 users to set envelope senders.
3586 </para>
3587 <para>
3588 <indexterm role="concept">
3589 <primary><emphasis>From:</emphasis> header line</primary>
3590 </indexterm>
3591 <indexterm role="concept">
3592 <primary><emphasis>Sender:</emphasis> header line</primary>
3593 </indexterm>
3594 <indexterm role="concept">
3595 <primary>header lines</primary>
3596 <secondary>From:</secondary>
3597 </indexterm>
3598 <indexterm role="concept">
3599 <primary>header lines</primary>
3600 <secondary>Sender:</secondary>
3601 </indexterm>
3602 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3603 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3604 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3605 </para>
3606 <para>
3607 Trusted users may also specify a host name, host address, interface address,
3608 protocol name, ident value, and authentication data when submitting a message
3609 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3610 have the characteristics of messages received from a remote host. Untrusted
3611 users may in some circumstances use <option>-f</option>, but can never set the other values
3612 that are available to trusted users.
3613 </para>
3614 </listitem>
3615 <listitem>
3616 <para>
3617 <indexterm role="concept">
3618 <primary>user</primary>
3619 <secondary>admin definition of</secondary>
3620 </indexterm>
3621 <indexterm role="concept">
3622 <primary>admin user</primary>
3623 <secondary>definition of</secondary>
3624 </indexterm>
3625 The admin users are root, the Exim user, and any user that is a member of the
3626 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3627 The current group does not have to be one of these groups.
3628 </para>
3629 <para>
3630 Admin users are permitted to list the queue, and to carry out certain
3631 operations on messages, for example, to force delivery failures. It is also
3632 necessary to be an admin user in order to see the full information provided by
3633 the Exim monitor, and full debugging output.
3634 </para>
3635 <para>
3636 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3637 Exim to attempt delivery of messages on its queue is restricted to admin users.
3638 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3639 option false (that is, specifying <option>no_prod_requires_admin</option>).
3640 </para>
3641 <para>
3642 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3643 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3644 false.
3645 </para>
3646 </listitem>
3647 </itemizedlist>
3648 <para>
3649 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3650 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3651 getting root. There is further discussion of this issue at the start of chapter
3652 <xref linkend="CHAPconf"/>.
3653 </para>
3654 </section>
3655 <section id="SECID39">
3656 <title>Command line options</title>
3657 <para>
3658 Exim&#x2019;s command line options are described in alphabetical order below. If none
3659 of the options that specifies a specific action (such as starting the daemon or
3660 a queue runner, or testing an address, or receiving a message in a specific
3661 format, or listing the queue) are present, and there is at least one argument
3662 on the command line, <option>-bm</option> (accept a local message on the standard input,
3663 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3664 outputs a brief message about itself and exits.
3665 </para>
3666 <!-- === Start of command line options === -->
3667 <variablelist>
3668 <varlistentry>
3669 <term><option>--</option></term>
3670 <listitem>
3671 <para>
3672 <indexterm role="option">
3673 <primary>--</primary>
3674 </indexterm>
3675 <indexterm role="concept">
3676 <primary>options</primary>
3677 <secondary>command line; terminating</secondary>
3678 </indexterm>
3679 This is a pseudo-option whose only purpose is to terminate the options and
3680 therefore to cause subsequent command line items to be treated as arguments
3681 rather than options, even if they begin with hyphens.
3682 </para>
3683 </listitem></varlistentry>
3684 <varlistentry>
3685 <term><option>--help</option></term>
3686 <listitem>
3687 <para>
3688 <indexterm role="option">
3689 <primary><option>--help</option></primary>
3690 </indexterm>
3691 This option causes Exim to output a few sentences stating what it is.
3692 The same output is generated if the Exim binary is called with no options and
3693 no arguments.
3694 </para>
3695 </listitem></varlistentry>
3696 <varlistentry>
3697 <term><option>--version</option></term>
3698 <listitem>
3699 <para>
3700 <indexterm role="option">
3701 <primary><option>--version</option></primary>
3702 </indexterm>
3703 This option is an alias for <option>-bV</option> and causes version information to be
3704 displayed.
3705 </para>
3706 </listitem></varlistentry>
3707 <varlistentry>
3708 <term><option>-Ac</option></term>
3709 <term><option>-Am</option></term>
3710 <listitem>
3711 <para>
3712 <indexterm role="option">
3713 <primary><option>-Ac</option></primary>
3714 </indexterm>
3715 <indexterm role="option">
3716 <primary><option>-Am</option></primary>
3717 </indexterm>
3718 These options are used by Sendmail for selecting configuration files and are
3719 ignored by Exim.
3720 </para>
3721 </listitem></varlistentry>
3722 <varlistentry>
3723 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3724 <listitem>
3725 <para>
3726 <indexterm role="option">
3727 <primary><option>-B</option></primary>
3728 </indexterm>
3729 <indexterm role="concept">
3730 <primary>8-bit characters</primary>
3731 </indexterm>
3732 <indexterm role="concept">
3733 <primary>Sendmail compatibility</primary>
3734 <secondary>8-bit characters</secondary>
3735 </indexterm>
3736 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3737 clean; it ignores this option.
3738 </para>
3739 </listitem></varlistentry>
3740 <varlistentry>
3741 <term><option>-bd</option></term>
3742 <listitem>
3743 <para>
3744 <indexterm role="option">
3745 <primary><option>-bd</option></primary>
3746 </indexterm>
3747 <indexterm role="concept">
3748 <primary>daemon</primary>
3749 </indexterm>
3750 <indexterm role="concept">
3751 <primary>SMTP</primary>
3752 <secondary>listener</secondary>
3753 </indexterm>
3754 <indexterm role="concept">
3755 <primary>queue runner</primary>
3756 </indexterm>
3757 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3758 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3759 that the daemon should also initiate periodic queue runs.
3760 </para>
3761 <para>
3762 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3763 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3764 disconnect from the controlling terminal. When running this way, it can be
3765 stopped by pressing ctrl-C.
3766 </para>
3767 <para>
3768 By default, Exim listens for incoming connections to the standard SMTP port on
3769 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3770 ports, on multiple ports, and only on specific interfaces. Chapter
3771 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3772 </para>
3773 <para>
3774 When a listening daemon
3775 <indexterm role="concept">
3776 <primary>daemon</primary>
3777 <secondary>process id (pid)</secondary>
3778 </indexterm>
3779 <indexterm role="concept">
3780 <primary>pid (process id)</primary>
3781 <secondary>of daemon</secondary>
3782 </indexterm>
3783 is started without the use of <option>-oX</option> (that is, without overriding the normal
3784 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3785 in Exim&#x2019;s spool directory. This location can be overridden by setting
3786 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3787 running as root.
3788 </para>
3789 <para>
3790 When <option>-oX</option> is used on the command line to start a listening daemon, the
3791 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3792 used to specify a path on the command line if a pid file is required.
3793 </para>
3794 <para>
3795 The SIGHUP signal
3796 <indexterm role="concept">
3797 <primary>SIGHUP</primary>
3798 </indexterm>
3799 <indexterm role="concept">
3800 <primary>daemon</primary>
3801 <secondary>restarting</secondary>
3802 </indexterm>
3803 can be used to cause the daemon to re-execute itself. This should be done
3804 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3805 means of the <option>.include</option> facility, is changed, and also whenever a new version
3806 of Exim is installed. It is not necessary to do this when other files that are
3807 referenced from the configuration (for example, alias files) are changed,
3808 because these are reread each time they are used.
3809 </para>
3810 </listitem></varlistentry>
3811 <varlistentry>
3812 <term><option>-bdf</option></term>
3813 <listitem>
3814 <para>
3815 <indexterm role="option">
3816 <primary><option>-bdf</option></primary>
3817 </indexterm>
3818 This option has the same effect as <option>-bd</option> except that it never disconnects
3819 from the controlling terminal, even when no debugging is specified.
3820 </para>
3821 </listitem></varlistentry>
3822 <varlistentry>
3823 <term><option>-be</option></term>
3824 <listitem>
3825 <para>
3826 <indexterm role="option">
3827 <primary><option>-be</option></primary>
3828 </indexterm>
3829 <indexterm role="concept">
3830 <primary>testing</primary>
3831 <secondary>string expansion</secondary>
3832 </indexterm>
3833 <indexterm role="concept">
3834 <primary>expansion</primary>
3835 <secondary>testing</secondary>
3836 </indexterm>
3837 Run Exim in expansion testing mode. Exim discards its root privilege, to
3838 prevent ordinary users from using this mode to read otherwise inaccessible
3839 files. If no arguments are given, Exim runs interactively, prompting for lines
3840 of data. Otherwise, it processes each argument in turn.
3841 </para>
3842 <para>
3843 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3844 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3845 used without command line arguments. If successful, it uses the <function>readline()</function>
3846 function, which provides extensive line-editing facilities, for reading the
3847 test data. A line history is supported.
3848 </para>
3849 <para>
3850 Long expansion expressions can be split over several lines by using backslash
3851 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3852 continuation lines is ignored. Each argument or data line is passed through the
3853 string expansion mechanism, and the result is output. Variable values from the
3854 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3855 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3856 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3857 </para>
3858 <para>
3859 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3860 files or databases you are using, you must exit and restart Exim before trying
3861 the same lookup again. Otherwise, because each Exim process caches the results
3862 of lookups, you will just get the same result as before.
3863 </para>
3864 </listitem></varlistentry>
3865 <varlistentry>
3866 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3867 <listitem>
3868 <para>
3869 <indexterm role="option">
3870 <primary><option>-bem</option></primary>
3871 </indexterm>
3872 <indexterm role="concept">
3873 <primary>testing</primary>
3874 <secondary>string expansion</secondary>
3875 </indexterm>
3876 <indexterm role="concept">
3877 <primary>expansion</primary>
3878 <secondary>testing</secondary>
3879 </indexterm>
3880 This option operates like <option>-be</option> except that it must be followed by the name
3881 of a file. For example:
3882 </para>
3883 <literallayout class="monospaced">
3884 exim -bem /tmp/testmessage
3885 </literallayout>
3886 <para>
3887 The file is read as a message (as if receiving a locally-submitted non-SMTP
3888 message) before any of the test expansions are done. Thus, message-specific
3889 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3890 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3891 recipients are read from the headers in the normal way, and are shown in the
3892 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3893 line, because further arguments are taken as strings to expand (just like
3894 <option>-be</option>).
3895 </para>
3896 </listitem></varlistentry>
3897 <varlistentry>
3898 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3899 <listitem>
3900 <para>
3901 <indexterm role="option">
3902 <primary><option>-bF</option></primary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>system filter</primary>
3906 <secondary>testing</secondary>
3907 </indexterm>
3908 <indexterm role="concept">
3909 <primary>testing</primary>
3910 <secondary>system filter</secondary>
3911 </indexterm>
3912 This option is the same as <option>-bf</option> except that it assumes that the filter being
3913 tested is a system filter. The additional commands that are available only in
3914 system filters are recognized.
3915 </para>
3916 </listitem></varlistentry>
3917 <varlistentry>
3918 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3919 <listitem>
3920 <para>
3921 <indexterm role="option">
3922 <primary><option>-bf</option></primary>
3923 </indexterm>
3924 <indexterm role="concept">
3925 <primary>filter</primary>
3926 <secondary>testing</secondary>
3927 </indexterm>
3928 <indexterm role="concept">
3929 <primary>testing</primary>
3930 <secondary>filter file</secondary>
3931 </indexterm>
3932 <indexterm role="concept">
3933 <primary>forward file</primary>
3934 <secondary>testing</secondary>
3935 </indexterm>
3936 <indexterm role="concept">
3937 <primary>testing</primary>
3938 <secondary>forward file</secondary>
3939 </indexterm>
3940 <indexterm role="concept">
3941 <primary>Sieve filter</primary>
3942 <secondary>testing</secondary>
3943 </indexterm>
3944 This option runs Exim in user filter testing mode; the file is the filter file
3945 to be tested, and a test message must be supplied on the standard input. If
3946 there are no message-dependent tests in the filter, an empty file can be
3947 supplied.
3948 </para>
3949 <para>
3950 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3951 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3952 filter and a user filter in the same run. For example:
3953 </para>
3954 <literallayout class="monospaced">
3955 exim -bF /system/filter -bf /user/filter &lt;/test/message
3956 </literallayout>
3957 <para>
3958 This is helpful when the system filter adds header lines or sets filter
3959 variables that are used by the user filter.
3960 </para>
3961 <para>
3962 If the test filter file does not begin with one of the special lines
3963 </para>
3964 <literallayout class="monospaced">
3965 # Exim filter
3966 # Sieve filter
3967 </literallayout>
3968 <para>
3969 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3970 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3971 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3972 redirection lists.
3973 </para>
3974 <para>
3975 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3976 detected, is a list of the actions that Exim would try to take if presented
3977 with the message for real. More details of filter testing are given in the
3978 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3979 </para>
3980 <para>
3981 When testing a filter file,
3982 <indexterm role="concept">
3983 <primary><quote>From</quote> line</primary>
3984 </indexterm>
3985 <indexterm role="concept">
3986 <primary>envelope sender</primary>
3987 </indexterm>
3988 <indexterm role="option">
3989 <primary><option>-f</option></primary>
3990 <secondary>for filter testing</secondary>
3991 </indexterm>
3992 the envelope sender can be set by the <option>-f</option> option,
3993 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3994 that would normally be taken from the envelope recipient address of the message
3995 can be set by means of additional command line options (see the next four
3996 options).
3997 </para>
3998 </listitem></varlistentry>
3999 <varlistentry>
4000 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4001 <listitem>
4002 <para>
4003 <indexterm role="option">
4004 <primary><option>-bfd</option></primary>
4005 </indexterm>
4006 <indexterm role="variable">
4007 <primary><varname>$qualify_domain</varname></primary>
4008 </indexterm>
4009 This sets the domain of the recipient address when a filter file is being
4010 tested by means of the <option>-bf</option> option. The default is the value of
4011 <varname>$qualify_domain</varname>.
4012 </para>
4013 </listitem></varlistentry>
4014 <varlistentry>
4015 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4016 <listitem>
4017 <para>
4018 <indexterm role="option">
4019 <primary><option>-bfl</option></primary>
4020 </indexterm>
4021 This sets the local part of the recipient address when a filter file is being
4022 tested by means of the <option>-bf</option> option. The default is the username of the
4023 process that calls Exim. A local part should be specified with any prefix or
4024 suffix stripped, because that is how it appears to the filter when a message is
4025 actually being delivered.
4026 </para>
4027 </listitem></varlistentry>
4028 <varlistentry>
4029 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4030 <listitem>
4031 <para>
4032 <indexterm role="option">
4033 <primary><option>-bfp</option></primary>
4034 </indexterm>
4035 This sets the prefix of the local part of the recipient address when a filter
4036 file is being tested by means of the <option>-bf</option> option. The default is an empty
4037 prefix.
4038 </para>
4039 </listitem></varlistentry>
4040 <varlistentry>
4041 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4042 <listitem>
4043 <para>
4044 <indexterm role="option">
4045 <primary><option>-bfs</option></primary>
4046 </indexterm>
4047 This sets the suffix of the local part of the recipient address when a filter
4048 file is being tested by means of the <option>-bf</option> option. The default is an empty
4049 suffix.
4050 </para>
4051 </listitem></varlistentry>
4052 <varlistentry>
4053 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4054 <listitem>
4055 <para>
4056 <indexterm role="option">
4057 <primary><option>-bh</option></primary>
4058 </indexterm>
4059 <indexterm role="concept">
4060 <primary>testing</primary>
4061 <secondary>incoming SMTP</secondary>
4062 </indexterm>
4063 <indexterm role="concept">
4064 <primary>SMTP</primary>
4065 <secondary>testing incoming</secondary>
4066 </indexterm>
4067 <indexterm role="concept">
4068 <primary>testing</primary>
4069 <secondary>relay control</secondary>
4070 </indexterm>
4071 <indexterm role="concept">
4072 <primary>relaying</primary>
4073 <secondary>testing configuration</secondary>
4074 </indexterm>
4075 <indexterm role="concept">
4076 <primary>policy control</primary>
4077 <secondary>testing</secondary>
4078 </indexterm>
4079 <indexterm role="concept">
4080 <primary>debugging</primary>
4081 <secondary><option>-bh</option> option</secondary>
4082 </indexterm>
4083 This option runs a fake SMTP session as if from the given IP address, using the
4084 standard input and output. The IP address may include a port number at the end,
4085 after a full stop. For example:
4086 </para>
4087 <literallayout class="monospaced">
4088 exim -bh 10.9.8.7.1234
4089 exim -bh fe80::a00:20ff:fe86:a061.5678
4090 </literallayout>
4091 <para>
4092 When an IPv6 address is given, it is converted into canonical form. In the case
4093 of the second example above, the value of <varname>$sender_host_address</varname> after
4094 conversion to the canonical form is
4095 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4096 </para>
4097 <para>
4098 Comments as to what is going on are written to the standard error file. These
4099 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4100 This facility is provided for testing configuration options for incoming
4101 messages, to make sure they implement the required policy. For example, you can
4102 test your relay controls using <option>-bh</option>.
4103 </para>
4104 <para>
4105 <emphasis role="bold">Warning 1</emphasis>:
4106 <indexterm role="concept">
4107 <primary>RFC 1413</primary>
4108 </indexterm>
4109 You can test features of the configuration that rely on ident (RFC 1413)
4110 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4111 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4112 connection.
4113 </para>
4114 <para>
4115 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4116 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4117 occur, use <option>-bhc</option> instead.
4118 </para>
4119 <para>
4120 Messages supplied during the testing session are discarded, and nothing is
4121 written to any of the real log files. There may be pauses when DNS (and other)
4122 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4123 can be used to specify a specific IP interface and port if this is important,
4124 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4125 session were authenticated.
4126 </para>
4127 <para>
4128 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4129 output just states whether a given recipient address from a given host is
4130 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4131 </para>
4132 <para>
4133 Features such as authentication and encryption, where the client input is not
4134 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4135 specialized SMTP test program such as
4136 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4137 </para>
4138 </listitem></varlistentry>
4139 <varlistentry>
4140 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4141 <listitem>
4142 <para>
4143 <indexterm role="option">
4144 <primary><option>-bhc</option></primary>
4145 </indexterm>
4146 This option operates in the same way as <option>-bh</option>, except that address
4147 verification callouts are performed if required. This includes consulting and
4148 updating the callout cache database.
4149 </para>
4150 </listitem></varlistentry>
4151 <varlistentry>
4152 <term><option>-bi</option></term>
4153 <listitem>
4154 <para>
4155 <indexterm role="option">
4156 <primary><option>-bi</option></primary>
4157 </indexterm>
4158 <indexterm role="concept">
4159 <primary>alias file</primary>
4160 <secondary>building</secondary>
4161 </indexterm>
4162 <indexterm role="concept">
4163 <primary>building alias file</primary>
4164 </indexterm>
4165 <indexterm role="concept">
4166 <primary>Sendmail compatibility</primary>
4167 <secondary><option>-bi</option> option</secondary>
4168 </indexterm>
4169 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4170 Exim does not have the concept of a single alias file, and so it cannot mimic
4171 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4172 tend to appear in various scripts such as NIS make files, so the option must be
4173 recognized.
4174 </para>
4175 <para>
4176 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4177 configuration option is run, under the uid and gid of the caller of Exim. If
4178 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4179 The command set by <option>bi_command</option> may not contain arguments. The command can
4180 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4181 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4182 <option>-bi</option> is a no-op.
4183 </para>
4184 </listitem></varlistentry>
4185 <varlistentry>
4186 <term><option>-bI:help</option></term>
4187 <listitem>
4188 <para>
4189 <indexterm role="option">
4190 <primary><option>-bI:help</option></primary>
4191 </indexterm>
4192 <indexterm role="concept">
4193 <primary>querying exim information</primary>
4194 </indexterm>
4195 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4196 information.  The output of many of these will be intended for machine
4197 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4198 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4199 options shall cause Exim to exit after producing the requested output.
4200 </para>
4201 </listitem></varlistentry>
4202 <varlistentry>
4203 <term><option>-bI:dscp</option></term>
4204 <listitem>
4205 <para>
4206 <indexterm role="option">
4207 <primary><option>-bI:dscp</option></primary>
4208 </indexterm>
4209 <indexterm role="concept">
4210 <primary>DSCP</primary>
4211 <secondary>values</secondary>
4212 </indexterm>
4213 This option causes Exim to emit an alphabetically sorted list of all
4214 recognised DSCP names.
4215 </para>
4216 </listitem></varlistentry>
4217 <varlistentry>
4218 <term><option>-bI:sieve</option></term>
4219 <listitem>
4220 <para>
4221 <indexterm role="option">
4222 <primary><option>-bI:sieve</option></primary>
4223 </indexterm>
4224 <indexterm role="concept">
4225 <primary>Sieve filter</primary>
4226 <secondary>capabilities</secondary>
4227 </indexterm>
4228 This option causes Exim to emit an alphabetically sorted list of all supported
4229 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4230 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4231 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4232 compile-time build options, which this option will adapt to, this is the only
4233 way to guarantee a correct response.
4234 </para>
4235 </listitem></varlistentry>
4236 <varlistentry>
4237 <term><option>-bm</option></term>
4238 <listitem>
4239 <para>
4240 <indexterm role="option">
4241 <primary><option>-bm</option></primary>
4242 </indexterm>
4243 <indexterm role="concept">
4244 <primary>local message reception</primary>
4245 </indexterm>
4246 This option runs an Exim receiving process that accepts an incoming,
4247 locally-generated message on the standard input. The recipients are given as the
4248 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4249 argument can be a comma-separated list of RFC 2822 addresses. This is the
4250 default option for selecting the overall action of an Exim call; it is assumed
4251 if no other conflicting option is present.
4252 </para>
4253 <para>
4254 If any addresses in the message are unqualified (have no domain), they are
4255 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4256 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4257 suppressing this for special cases.
4258 </para>
4259 <para>
4260 Policy checks on the contents of local messages can be enforced by means of
4261 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4262 </para>
4263 <para>
4264 <indexterm role="concept">
4265 <primary>return code</primary>
4266 <secondary>for <option>-bm</option></secondary>
4267 </indexterm>
4268 The return code is zero if the message is successfully accepted. Otherwise, the
4269 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4270 </para>
4271 <para>
4272 The format
4273 <indexterm role="concept">
4274 <primary>message</primary>
4275 <secondary>format</secondary>
4276 </indexterm>
4277 <indexterm role="concept">
4278 <primary>format</primary>
4279 <secondary>message</secondary>
4280 </indexterm>
4281 <indexterm role="concept">
4282 <primary><quote>From</quote> line</primary>
4283 </indexterm>
4284 <indexterm role="concept">
4285 <primary>UUCP</primary>
4286 <secondary><quote>From</quote> line</secondary>
4287 </indexterm>
4288 <indexterm role="concept">
4289 <primary>Sendmail compatibility</primary>
4290 <secondary><quote>From</quote> line</secondary>
4291 </indexterm>
4292 of the message must be as defined in RFC 2822, except that, for
4293 compatibility with Sendmail and Smail, a line in one of the forms
4294 </para>
4295 <literallayout class="monospaced">
4296 From sender Fri Jan  5 12:55 GMT 1997
4297 From sender Fri, 5 Jan 97 12:55:01
4298 </literallayout>
4299 <para>
4300 (with the weekday optional, and possibly with additional text after the date)
4301 is permitted to appear at the start of the message. There appears to be no
4302 authoritative specification of the format of this line. Exim recognizes it by
4303 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4304 option, which can be changed if necessary.
4305 </para>
4306 <para>
4307 <indexterm role="option">
4308 <primary><option>-f</option></primary>
4309 <secondary>overriding <quote>From</quote> line</secondary>
4310 </indexterm>
4311 The specified sender is treated as if it were given as the argument to the
4312 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4313 preference to the address taken from the message. The caller of Exim must be a
4314 trusted user for the sender of a message to be set in this way.
4315 </para>
4316 </listitem></varlistentry>
4317 <varlistentry>
4318 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4319 <listitem>
4320 <para>
4321 <indexterm role="option">
4322 <primary><option>-bmalware</option></primary>
4323 </indexterm>
4324 <indexterm role="concept">
4325 <primary>testing</primary>
4326 <secondary>,</secondary>
4327 </indexterm>
4328 <indexterm role="concept">
4329 <primary>malware scan test</primary>
4330 </indexterm>
4331 This debugging option causes Exim to scan the given file or directory
4332 (depending on the used scanner interface),
4333 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4334 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4335 the expansion should have defaults which apply to this invocation.  ACLs are
4336 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4337 will never be populated and <option>-bmalware</option> will fail.
4338 </para>
4339 <para>
4340 Exim will have changed working directory before resolving the filename, so
4341 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4342 user when it tries to open the file, rather than as the invoking user.
4343 This option requires admin privileges.
4344 </para>
4345 <para>
4346 The <option>-bmalware</option> option will not be extended to be more generally useful,
4347 there are better tools for file-scanning.  This option exists to help
4348 administrators verify their Exim and AV scanner configuration.
4349 </para>
4350 </listitem></varlistentry>
4351 <varlistentry>
4352 <term><option>-bnq</option></term>
4353 <listitem>
4354 <para>
4355 <indexterm role="option">
4356 <primary><option>-bnq</option></primary>
4357 </indexterm>
4358 <indexterm role="concept">
4359 <primary>address qualification, suppressing</primary>
4360 </indexterm>
4361 By default, Exim automatically qualifies unqualified addresses (those
4362 without domains) that appear in messages that are submitted locally (that
4363 is, not over TCP/IP). This qualification applies both to addresses in
4364 envelopes, and addresses in header lines. Sender addresses are qualified using
4365 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4366 defaults to the value of <option>qualify_domain</option>).
4367 </para>
4368 <para>
4369 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4370 being used to re-submit messages that originally came from remote hosts after
4371 content scanning, you probably do not want to qualify unqualified addresses in
4372 header lines. (Such lines will be present only if you have not enabled a header
4373 syntax check in the appropriate ACL.)
4374 </para>
4375 <para>
4376 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4377 messages that originate on the local host. When this is used, unqualified
4378 addresses in the envelope provoke errors (causing message rejection) and
4379 unqualified addresses in header lines are left alone.
4380 </para>
4381 </listitem></varlistentry>
4382 <varlistentry>
4383 <term><option>-bP</option></term>
4384 <listitem>
4385 <para>
4386 <indexterm role="option">
4387 <primary><option>-bP</option></primary>
4388 </indexterm>
4389 <indexterm role="concept">
4390 <primary>configuration options</primary>
4391 <secondary>extracting</secondary>
4392 </indexterm>
4393 <indexterm role="concept">
4394 <primary>options</primary>
4395 <secondary>configuration &ndash; extracting</secondary>
4396 </indexterm>
4397 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4398 main configuration options to be written to the standard output. The values
4399 of one or more specific options can be requested by giving their names as
4400 arguments, for example:
4401 </para>
4402 <literallayout class="monospaced">
4403 exim -bP qualify_domain hold_domains
4404 </literallayout>
4405 <para>
4406 <indexterm role="concept">
4407 <primary>hiding configuration option values</primary>
4408 </indexterm>
4409 <indexterm role="concept">
4410 <primary>configuration options</primary>
4411 <secondary>hiding value of</secondary>
4412 </indexterm>
4413 <indexterm role="concept">
4414 <primary>options</primary>
4415 <secondary>hiding value of</secondary>
4416 </indexterm>
4417 However, any option setting that is preceded by the word <quote>hide</quote> in the
4418 configuration file is not shown in full, except to an admin user. For other
4419 users, the output is as in this example:
4420 </para>
4421 <literallayout class="monospaced">
4422 mysql_servers = &lt;value not displayable&gt;
4423 </literallayout>
4424 <para>
4425 If <option>config</option> is given as an argument, the config is
4426 output, as it was parsed, any include file resolved, any comment removed.
4427 </para>
4428 <para>
4429 If <option>config_file</option> is given as an argument, the name of the run time
4430 configuration file is output. (<option>configure_file</option> works too, for
4431 backward compatibility.)
4432 If a list of configuration files was supplied, the value that is output here
4433 is the name of the file that was actually used.
4434 </para>
4435 <para>
4436 <indexterm role="concept">
4437 <primary>options</primary>
4438 <secondary>hiding name of</secondary>
4439 </indexterm>
4440 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4441 name will not be output.
4442 </para>
4443 <para>
4444 <indexterm role="concept">
4445 <primary>daemon</primary>
4446 <secondary>process id (pid)</secondary>
4447 </indexterm>
4448 <indexterm role="concept">
4449 <primary>pid (process id)</primary>
4450 <secondary>of daemon</secondary>
4451 </indexterm>
4452 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4453 directories where log files and daemon pid files are written are output,
4454 respectively. If these values are unset, log files are written in a
4455 sub-directory of the spool directory called <option>log</option>, and the pid file is
4456 written directly into the spool directory.
4457 </para>
4458 <para>
4459 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4460 </para>
4461 <literallayout class="monospaced">
4462 exim -bP +local_domains
4463 </literallayout>
4464 <para>
4465 it searches for a matching named list of any type (domain, host, address, or
4466 local part) and outputs what it finds.
4467 </para>
4468 <para>
4469 <indexterm role="concept">
4470 <primary>options</primary>
4471 <secondary>router &ndash; extracting</secondary>
4472 </indexterm>
4473 <indexterm role="concept">
4474 <primary>options</primary>
4475 <secondary>transport &ndash; extracting</secondary>
4476 </indexterm>
4477 <indexterm role="concept">
4478 <primary>options</primary>
4479 <secondary>authenticator &ndash; extracting</secondary>
4480 </indexterm>
4481 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4482 followed by the name of an appropriate driver instance, the option settings for
4483 that driver are output. For example:
4484 </para>
4485 <literallayout class="monospaced">
4486 exim -bP transport local_delivery
4487 </literallayout>
4488 <para>
4489 The generic driver options are output first, followed by the driver&#x2019;s private
4490 options. A list of the names of drivers of a particular type can be obtained by
4491 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4492 <option>authenticator_list</option>, and a complete list of all drivers with their option
4493 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4494 <option>authenticators</option>.
4495 </para>
4496 <para>
4497 <indexterm role="concept">
4498 <primary>environment</primary>
4499 </indexterm>
4500 If <option>environment</option> is given as an argument, the set of environment
4501 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4502 variables.
4503 </para>
4504 <para>
4505 <indexterm role="concept">
4506 <primary>options</primary>
4507 <secondary>macro &ndash; extracting</secondary>
4508 </indexterm>
4509 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4510 are available, similarly to the drivers.  Because macros are sometimes used
4511 for storing passwords, this option is restricted.
4512 The output format is one item per line.
4513 </para>
4514 </listitem></varlistentry>
4515 <varlistentry>
4516 <term><option>-bp</option></term>
4517 <listitem>
4518 <para>
4519 <indexterm role="option">
4520 <primary><option>-bp</option></primary>
4521 </indexterm>
4522 <indexterm role="concept">
4523 <primary>queue</primary>
4524 <secondary>listing messages on</secondary>
4525 </indexterm>
4526 <indexterm role="concept">
4527 <primary>listing</primary>
4528 <secondary>messages on the queue</secondary>
4529 </indexterm>
4530 This option requests a listing of the contents of the mail queue on the
4531 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4532 just those messages are listed. By default, this option can be used only by an
4533 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4534 to allow any user to see the queue.
4535 </para>
4536 <para>
4537 Each message on the queue is displayed as in the following example:
4538 </para>
4539 <literallayout class="monospaced">
4540 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4541           red.king@looking-glass.fict.example
4542           &lt;other addresses&gt;
4543 </literallayout>
4544 <para>
4545 <indexterm role="concept">
4546 <primary>message</primary>
4547 <secondary>size in queue listing</secondary>
4548 </indexterm>
4549 <indexterm role="concept">
4550 <primary>size</primary>
4551 <secondary>of message</secondary>
4552 </indexterm>
4553 The first line contains the length of time the message has been on the queue
4554 (in this case 25 minutes), the size of the message (2.9K), the unique local
4555 identifier for the message, and the message sender, as contained in the
4556 envelope. For bounce messages, the sender address is empty, and appears as
4557 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4558 the default sender address, the user&#x2019;s login name is shown in parentheses
4559 before the sender address.
4560 </para>
4561 <para>
4562 <indexterm role="concept">
4563 <primary>frozen messages</primary>
4564 <secondary>in queue listing</secondary>
4565 </indexterm>
4566 If the message is frozen (attempts to deliver it are suspended) then the text
4567 <quote>*** frozen ***</quote> is displayed at the end of this line.
4568 </para>
4569 <para>
4570 The recipients of the message (taken from the envelope, not the headers) are
4571 displayed on subsequent lines. Those addresses to which the message has already
4572 been delivered are marked with the letter D. If an original address gets
4573 expanded into several addresses via an alias or forward file, the original is
4574 displayed with a D only when deliveries for all of its child addresses are
4575 complete.
4576 </para>
4577 </listitem></varlistentry>
4578 <varlistentry>
4579 <term><option>-bpa</option></term>
4580 <listitem>
4581 <para>
4582 <indexterm role="option">
4583 <primary><option>-bpa</option></primary>
4584 </indexterm>
4585 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4586 that were generated from the original top level address(es) in each message by
4587 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4588 of just <quote>D</quote>.
4589 </para>
4590 </listitem></varlistentry>
4591 <varlistentry>
4592 <term><option>-bpc</option></term>
4593 <listitem>
4594 <para>
4595 <indexterm role="option">
4596 <primary><option>-bpc</option></primary>
4597 </indexterm>
4598 <indexterm role="concept">
4599 <primary>queue</primary>
4600 <secondary>count of messages on</secondary>
4601 </indexterm>
4602 This option counts the number of messages on the queue, and writes the total
4603 to the standard output. It is restricted to admin users, unless
4604 <option>queue_list_requires_admin</option> is set false.
4605 </para>
4606 </listitem></varlistentry>
4607 <varlistentry>
4608 <term><option>-bpr</option></term>
4609 <listitem>
4610 <para>
4611 <indexterm role="option">
4612 <primary><option>-bpr</option></primary>
4613 </indexterm>
4614 This option operates like <option>-bp</option>, but the output is not sorted into
4615 chronological order of message arrival. This can speed it up when there are
4616 lots of messages on the queue, and is particularly useful if the output is
4617 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4618 </para>
4619 </listitem></varlistentry>
4620 <varlistentry>
4621 <term><option>-bpra</option></term>
4622 <listitem>
4623 <para>
4624 <indexterm role="option">
4625 <primary><option>-bpra</option></primary>
4626 </indexterm>
4627 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4628 </para>
4629 </listitem></varlistentry>
4630 <varlistentry>
4631 <term><option>-bpru</option></term>
4632 <listitem>
4633 <para>
4634 <indexterm role="option">
4635 <primary><option>-bpru</option></primary>
4636 </indexterm>
4637 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4638 </para>
4639 </listitem></varlistentry>
4640 <varlistentry>
4641 <term><option>-bpu</option></term>
4642 <listitem>
4643 <para>
4644 <indexterm role="option">
4645 <primary><option>-bpu</option></primary>
4646 </indexterm>
4647 This option operates like <option>-bp</option> but shows only undelivered top-level
4648 addresses for each message displayed. Addresses generated by aliasing or
4649 forwarding are not shown, unless the message was deferred after processing by a
4650 router with the <option>one_time</option> option set.
4651 </para>
4652 </listitem></varlistentry>
4653 <varlistentry>
4654 <term><option>-brt</option></term>
4655 <listitem>
4656 <para>
4657 <indexterm role="option">
4658 <primary><option>-brt</option></primary>
4659 </indexterm>
4660 <indexterm role="concept">
4661 <primary>testing</primary>
4662 <secondary>retry configuration</secondary>
4663 </indexterm>
4664 <indexterm role="concept">
4665 <primary>retry</primary>
4666 <secondary>configuration testing</secondary>
4667 </indexterm>
4668 This option is for testing retry rules, and it must be followed by up to three
4669 arguments. It causes Exim to look for a retry rule that matches the values
4670 and to write it to the standard output. For example:
4671 </para>
4672 <literallayout class="monospaced">
4673 exim -brt bach.comp.mus.example
4674 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4675 </literallayout>
4676 <para>
4677 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4678 argument, which is required, can be a complete address in the form
4679 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4680 contains a dot, it is interpreted as an optional second domain name; if no
4681 retry rule is found for the first argument, the second is tried. This ties in
4682 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4683 rule is found that matches the host, one that matches the mail domain is
4684 sought. Finally, an argument that is the name of a specific delivery error, as
4685 used in setting up retry rules, can be given. For example:
4686 </para>
4687 <literallayout class="monospaced">
4688 exim -brt haydn.comp.mus.example quota_3d
4689 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4690 </literallayout>
4691 </listitem></varlistentry>
4692 <varlistentry>
4693 <term><option>-brw</option></term>
4694 <listitem>
4695 <para>
4696 <indexterm role="option">
4697 <primary><option>-brw</option></primary>
4698 </indexterm>
4699 <indexterm role="concept">
4700 <primary>testing</primary>
4701 <secondary>rewriting</secondary>
4702 </indexterm>
4703 <indexterm role="concept">
4704 <primary>rewriting</primary>
4705 <secondary>testing</secondary>
4706 </indexterm>
4707 This option is for testing address rewriting rules, and it must be followed by
4708 a single argument, consisting of either a local part without a domain, or a
4709 complete address with a fully qualified domain. Exim outputs how this address
4710 would be rewritten for each possible place it might appear. See chapter
4711 <xref linkend="CHAPrewrite"/> for further details.
4712 </para>
4713 </listitem></varlistentry>
4714 <varlistentry>
4715 <term><option>-bS</option></term>
4716 <listitem>
4717 <para>
4718 <indexterm role="option">
4719 <primary><option>-bS</option></primary>
4720 </indexterm>
4721 <indexterm role="concept">
4722 <primary>SMTP</primary>
4723 <secondary>batched incoming</secondary>
4724 </indexterm>
4725 <indexterm role="concept">
4726 <primary>batched SMTP input</primary>
4727 </indexterm>
4728 This option is used for batched SMTP input, which is an alternative interface
4729 for non-interactive local message submission. A number of messages can be
4730 submitted in a single run. However, despite its name, this is not really SMTP
4731 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4732 input, but generates no responses. If the caller is trusted, or
4733 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4734 believed; otherwise the sender is always the caller of Exim.
4735 </para>
4736 <para>
4737 The message itself is read from the standard input, in SMTP format (leading
4738 dots doubled), terminated by a line containing just a single dot. An error is
4739 provoked if the terminating dot is missing. A further message may then follow.
4740 </para>
4741 <para>
4742 As for other local message submissions, the contents of incoming batch SMTP
4743 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4744 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4745 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4746 </para>
4747 <para>
4748 Some other SMTP commands are recognized in the input. HELO and EHLO act
4749 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4750 QUIT quits, ignoring the rest of the standard input.
4751 </para>
4752 <para>
4753 <indexterm role="concept">
4754 <primary>return code</primary>
4755 <secondary>for <option>-bS</option></secondary>
4756 </indexterm>
4757 If any error is encountered, reports are written to the standard output and
4758 error streams, and Exim gives up immediately. The return code is 0 if no error
4759 was detected; it is 1 if one or more messages were accepted before the error
4760 was detected; otherwise it is 2.
4761 </para>
4762 <para>
4763 More details of input using batched SMTP are given in section
4764 <xref linkend="SECTincomingbatchedSMTP"/>.
4765 </para>
4766 </listitem></varlistentry>
4767 <varlistentry>
4768 <term><option>-bs</option></term>
4769 <listitem>
4770 <para>
4771 <indexterm role="option">
4772 <primary><option>-bs</option></primary>
4773 </indexterm>
4774 <indexterm role="concept">
4775 <primary>SMTP</primary>
4776 <secondary>local input</secondary>
4777 </indexterm>
4778 <indexterm role="concept">
4779 <primary>local SMTP input</primary>
4780 </indexterm>
4781 This option causes Exim to accept one or more messages by reading SMTP commands
4782 on the standard input, and producing SMTP replies on the standard output. SMTP
4783 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4784 Some user agents use this interface as a way of passing locally-generated
4785 messages to the MTA.
4786 </para>
4787 <para>
4788 In
4789 <indexterm role="concept">
4790 <primary>sender</primary>
4791 <secondary>source of</secondary>
4792 </indexterm>
4793 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4794 set, the senders of messages are taken from the SMTP MAIL commands.
4795 Otherwise the content of these commands is ignored and the sender is set up as
4796 the calling user. Unqualified addresses are automatically qualified using
4797 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4798 <option>-bnq</option> option is used.
4799 </para>
4800 <para>
4801 <indexterm role="concept">
4802 <primary>inetd</primary>
4803 </indexterm>
4804 The
4805 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4806 using a listening daemon. Exim can distinguish the two cases by checking
4807 whether the standard input is a TCP/IP socket. When Exim is called from
4808 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4809 above concerning senders and qualification do not apply. In this situation,
4810 Exim behaves in exactly the same way as it does when receiving a message via
4811 the listening daemon.
4812 </para>
4813 </listitem></varlistentry>
4814 <varlistentry>
4815 <term><option>-bt</option></term>
4816 <listitem>
4817 <para>
4818 <indexterm role="option">
4819 <primary><option>-bt</option></primary>
4820 </indexterm>
4821 <indexterm role="concept">
4822 <primary>testing</primary>
4823 <secondary>addresses</secondary>
4824 </indexterm>
4825 <indexterm role="concept">
4826 <primary>address</primary>
4827 <secondary>testing</secondary>
4828 </indexterm>
4829 This option runs Exim in address testing mode, in which each argument is taken
4830 as a recipient address to be tested for deliverability. The results are
4831 written to the standard output. If a test fails, and the caller is not an admin
4832 user, no details of the failure are output, because these might contain
4833 sensitive information such as usernames and passwords for database lookups.
4834 </para>
4835 <para>
4836 If no arguments are given, Exim runs in an interactive manner, prompting with a
4837 right angle bracket for addresses to be tested.
4838 </para>
4839 <para>
4840 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4841 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4842 security issues.
4843 </para>
4844 <para>
4845 Each address is handled as if it were the recipient address of a message
4846 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4847 written to the standard output. However, any router that has
4848 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4849 genuine routing tests if your first router passes everything to a scanner
4850 program.
4851 </para>
4852 <para>
4853 <indexterm role="concept">
4854 <primary>return code</primary>
4855 <secondary>for <option>-bt</option></secondary>
4856 </indexterm>
4857 The return code is 2 if any address failed outright; it is 1 if no address
4858 failed outright but at least one could not be resolved for some reason. Return
4859 code 0 is given only when all addresses succeed.
4860 </para>
4861 <para>
4862 <indexterm role="concept">
4863 <primary>duplicate addresses</primary>
4864 </indexterm>
4865 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4866 addresses after routing is complete, so that only one delivery takes place.
4867 This does not happen when testing with <option>-bt</option>; the full results of routing are
4868 always shown.
4869 </para>
4870 <para>
4871 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4872 routers in the configuration makes any tests on the sender address of a
4873 message,
4874 <indexterm role="option">
4875 <primary><option>-f</option></primary>
4876 <secondary>for address testing</secondary>
4877 </indexterm>
4878 you can use the <option>-f</option> option to set an appropriate sender when running
4879 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4880 default qualifying domain. However, if you have set up (for example) routers
4881 whose behaviour depends on the contents of an incoming message, you cannot test
4882 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4883 doing such tests.
4884 </para>
4885 </listitem></varlistentry>
4886 <varlistentry>
4887 <term><option>-bV</option></term>
4888 <listitem>
4889 <para>
4890 <indexterm role="option">
4891 <primary><option>-bV</option></primary>
4892 </indexterm>
4893 <indexterm role="concept">
4894 <primary>version number of Exim</primary>
4895 </indexterm>
4896 This option causes Exim to write the current version number, compilation
4897 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4898 It also lists the DBM library that is being used, the optional modules (such as
4899 specific lookup types), the drivers that are included in the binary, and the
4900 name of the run time configuration file that is in use.
4901 </para>
4902 <para>
4903 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4904 configuration file. However, this is a static check only. It cannot check
4905 values that are to be expanded. For example, although a misspelt ACL verb is
4906 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4907 alone to discover (for example) all the typos in the configuration; some
4908 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4909 dynamic testing facilities.
4910 </para>
4911 </listitem></varlistentry>
4912 <varlistentry>
4913 <term><option>-bv</option></term>
4914 <listitem>
4915 <para>
4916 <indexterm role="option">
4917 <primary><option>-bv</option></primary>
4918 </indexterm>
4919 <indexterm role="concept">
4920 <primary>verifying address</primary>
4921 <secondary>using <option>-bv</option></secondary>
4922 </indexterm>
4923 <indexterm role="concept">
4924 <primary>address</primary>
4925 <secondary>verification</secondary>
4926 </indexterm>
4927 This option runs Exim in address verification mode, in which each argument is
4928 taken as a recipient address to be verified by the routers. (This does
4929 not involve any verification callouts). During normal operation, verification
4930 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4931 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4932 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4933 </para>
4934 <para>
4935 If verification fails, and the caller is not an admin user, no details of the
4936 failure are output, because these might contain sensitive information such as
4937 usernames and passwords for database lookups.
4938 </para>
4939 <para>
4940 If no arguments are given, Exim runs in an interactive manner, prompting with a
4941 right angle bracket for addresses to be verified.
4942 </para>
4943 <para>
4944 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4945 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4946 security issues.
4947 </para>
4948 <para>
4949 Verification differs from address testing (the <option>-bt</option> option) in that routers
4950 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4951 router that has <option>fail_verify</option> set, verification fails. The address is
4952 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4953 address, <option>-bvs</option> should be used.
4954 </para>
4955 <para>
4956 If the <option>-v</option> option is not set, the output consists of a single line for each
4957 address, stating whether it was verified or not, and giving a reason in the
4958 latter case. Without <option>-v</option>, generating more than one address by redirection
4959 causes verification to end successfully, without considering the generated
4960 addresses. However, if just one address is generated, processing continues,
4961 and the generated address must verify successfully for the overall verification
4962 to succeed.
4963 </para>
4964 <para>
4965 When <option>-v</option> is set, more details are given of how the address has been handled,
4966 and in the case of address redirection, all the generated addresses are also
4967 considered. Verification may succeed for some and fail for others.
4968 </para>
4969 <para>
4970 The
4971 <indexterm role="concept">
4972 <primary>return code</primary>
4973 <secondary>for <option>-bv</option></secondary>
4974 </indexterm>
4975 return code is 2 if any address failed outright; it is 1 if no address
4976 failed outright but at least one could not be resolved for some reason. Return
4977 code 0 is given only when all addresses succeed.
4978 </para>
4979 <para>
4980 If any of the routers in the configuration makes any tests on the sender
4981 address of a message, you should use the <option>-f</option> option to set an appropriate
4982 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4983 calling user at the default qualifying domain.
4984 </para>
4985 </listitem></varlistentry>
4986 <varlistentry>
4987 <term><option>-bvs</option></term>
4988 <listitem>
4989 <para>
4990 <indexterm role="option">
4991 <primary><option>-bvs</option></primary>
4992 </indexterm>
4993 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4994 than a recipient address. This affects any rewriting and qualification that
4995 might happen.
4996 </para>
4997 </listitem></varlistentry>
4998 <varlistentry>
4999 <term><option>-bw</option></term>
5000 <listitem>
5001 <para>
5002 <indexterm role="option">
5003 <primary><option>-bw</option></primary>
5004 </indexterm>
5005 <indexterm role="concept">
5006 <primary>daemon</primary>
5007 </indexterm>
5008 <indexterm role="concept">
5009 <primary>inetd</primary>
5010 </indexterm>
5011 <indexterm role="concept">
5012 <primary>inetd</primary>
5013 <secondary>wait mode</secondary>
5014 </indexterm>
5015 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5016 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5017 and in the configuration file are ignored.  Queue-running may not be specified.
5018 </para>
5019 <para>
5020 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5021 listening for connections.  This permits the system to start up and have
5022 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5023 each port only when the first connection is received.
5024 </para>
5025 <para>
5026 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5027 which the daemon will exit, which should cause inetd to listen once more.
5028 </para>
5029 </listitem></varlistentry>
5030 <varlistentry>
5031 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5032 <listitem>
5033 <para>
5034 <indexterm role="option">
5035 <primary><option>-C</option></primary>
5036 </indexterm>
5037 <indexterm role="concept">
5038 <primary>configuration file</primary>
5039 <secondary>alternate</secondary>
5040 </indexterm>
5041 <indexterm role="concept">
5042 <primary>CONFIGURE_FILE</primary>
5043 </indexterm>
5044 <indexterm role="concept">
5045 <primary>alternate configuration file</primary>
5046 </indexterm>
5047 This option causes Exim to find the run time configuration file from the given
5048 list instead of from the list specified by the CONFIGURE_FILE
5049 compile-time setting. Usually, the list will consist of just a single file
5050 name, but it can be a colon-separated list of names. In this case, the first
5051 file that exists is used. Failure to open an existing file stops Exim from
5052 proceeding any further along the list, and an error is generated.
5053 </para>
5054 <para>
5055 When this option is used by a caller other than root, and the list is different
5056 from the compiled-in list, Exim gives up its root privilege immediately, and
5057 runs with the real and effective uid and gid set to those of the caller.
5058 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5059 file contains a list of full pathnames, one per line, for configuration files
5060 which are trusted. Root privilege is retained for any configuration file so
5061 listed, as long as the caller is the Exim user (or the user specified in the
5062 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5063 not writeable by inappropriate users or groups.
5064 </para>
5065 <para>
5066 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5067 configuration using <option>-C</option> right through message reception and delivery,
5068 even if the caller is root. The reception works, but by that time, Exim is
5069 running as the Exim user, so when it re-executes to regain privilege for the
5070 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5071 test reception and delivery using two separate commands (one to put a message
5072 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5073 </para>
5074 <para>
5075 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5076 prefix string with which any file named in a <option>-C</option> command line option
5077 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5078 However, if the value of the <option>-C</option> option is identical to the value of
5079 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5080 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5081 unset, any file name can be used with <option>-C</option>.
5082 </para>
5083 <para>
5084 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5085 to a directory to which only root has access. This prevents someone who has
5086 broken into the Exim account from running a privileged Exim with an arbitrary
5087 configuration file.
5088 </para>
5089 <para>
5090 The <option>-C</option> facility is useful for ensuring that configuration files are
5091 syntactically correct, but cannot be used for test deliveries, unless the
5092 caller is privileged, or unless it is an exotic configuration that does not
5093 require privilege. No check is made on the owner or group of the files
5094 specified by this option.
5095 </para>
5096 </listitem></varlistentry>
5097 <varlistentry>
5098 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5099 <listitem>
5100 <para>
5101 <indexterm role="option">
5102 <primary><option>-D</option></primary>
5103 </indexterm>
5104 <indexterm role="concept">
5105 <primary>macro</primary>
5106 <secondary>setting on command line</secondary>
5107 </indexterm>
5108 This option can be used to override macro definitions in the configuration file
5109 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5110 unprivileged caller, it causes Exim to give up its root privilege.
5111 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5112 completely disabled, and its use causes an immediate error exit.
5113 </para>
5114 <para>
5115 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5116 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5117 supplies macros from this list, and the values are acceptable, then Exim will
5118 not give up root privilege if the caller is root, the Exim run-time user, or
5119 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5120 to be removed in the future.  Acceptable values for the macros satisfy the
5121 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5122 </para>
5123 <para>
5124 The entire option (including equals sign if present) must all be within one
5125 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5126 string, in which case the equals sign is optional. These two commands are
5127 synonymous:
5128 </para>
5129 <literallayout class="monospaced">
5130 exim -DABC  ...
5131 exim -DABC= ...
5132 </literallayout>
5133 <para>
5134 To include spaces in a macro definition item, quotes must be used. If you use
5135 quotes, spaces are permitted around the macro name and the equals sign. For
5136 example:
5137 </para>
5138 <literallayout class="monospaced">
5139 exim '-D ABC = something' ...
5140 </literallayout>
5141 <para>
5142 <option>-D</option> may be repeated up to 10 times on a command line.
5143 Only macro names up to 22 letters long can be set.
5144 </para>
5145 </listitem></varlistentry>
5146 <varlistentry>
5147 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5148 <listitem>
5149 <para>
5150 <indexterm role="option">
5151 <primary><option>-d</option></primary>
5152 </indexterm>
5153 <indexterm role="concept">
5154 <primary>debugging</primary>
5155 <secondary>list of selectors</secondary>
5156 </indexterm>
5157 <indexterm role="concept">
5158 <primary>debugging</primary>
5159 <secondary><option>-d</option> option</secondary>
5160 </indexterm>
5161 This option causes debugging information to be written to the standard
5162 error stream. It is restricted to admin users because debugging output may show
5163 database queries that contain password information. Also, the details of users&#x2019;
5164 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5165 writes an error message to the standard error stream and exits with a non-zero
5166 return code.
5167 </para>
5168 <para>
5169 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5170 standard debugging data is output. This can be reduced, or increased to include
5171 some more rarely needed information, by directly following <option>-d</option> with a string
5172 made up of names preceded by plus or minus characters. These add or remove sets
5173 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5174 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5175 no spaces are allowed in the debug setting. The available debugging categories
5176 are:
5177 </para>
5178 <literallayout>
5179 <literal>acl            </literal> ACL interpretation
5180 <literal>auth           </literal> authenticators
5181 <literal>deliver        </literal> general delivery logic
5182 <literal>dns            </literal> DNS lookups (see also resolver)
5183 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5184 <literal>exec           </literal> arguments for <function>execv()</function> calls
5185 <literal>expand         </literal> detailed debugging for string expansions
5186 <literal>filter         </literal> filter handling
5187 <literal>hints_lookup   </literal> hints data lookups
5188 <literal>host_lookup    </literal> all types of name-to-IP address handling
5189 <literal>ident          </literal> ident lookup
5190 <literal>interface      </literal> lists of local interfaces
5191 <literal>lists          </literal> matching things in lists
5192 <literal>load           </literal> system load checks
5193 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5194 <literal>lookup         </literal> general lookup code and all lookups
5195 <literal>memory         </literal> memory handling
5196 <literal>pid            </literal> add pid to debug output lines
5197 <literal>process_info   </literal> setting info for the process log
5198 <literal>queue_run      </literal> queue runs
5199 <literal>receive        </literal> general message reception logic
5200 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5201 <literal>retry          </literal> retry handling
5202 <literal>rewrite        </literal> address rewriting
5203 <literal>route          </literal> address routing
5204 <literal>timestamp      </literal> add timestamp to debug output lines
5205 <literal>tls            </literal> TLS logic
5206 <literal>transport      </literal> transports
5207 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5208 <literal>verify         </literal> address verification logic
5209 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5210 </literallayout>
5211 <para>
5212 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5213 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5214 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5215 is included, an awful lot of output that is very rarely of interest is
5216 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5217 turn everything off.
5218 </para>
5219 <para>
5220 <indexterm role="concept">
5221 <primary>resolver, debugging output</primary>
5222 </indexterm>
5223 <indexterm role="concept">
5224 <primary>DNS resolver, debugging output</primary>
5225 </indexterm>
5226 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5227 with DEBUG enabled. This is not the case in some operating systems. Also,
5228 unfortunately, debugging output from the DNS resolver is written to stdout
5229 rather than stderr.
5230 </para>
5231 <para>
5232 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5233 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5234 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5235 daemon, which then passes it on to any re-executed Exims. Exim also
5236 automatically adds the pid to debug lines when several remote deliveries are
5237 run in parallel.
5238 </para>
5239 <para>
5240 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5241 of all debug output lines. This can be useful when trying to track down delays
5242 in processing.
5243 </para>
5244 <para>
5245 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5246 any debugging is selected, or if <option>-v</option> is used.
5247 </para>
5248 </listitem></varlistentry>
5249 <varlistentry>
5250 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5251 <listitem>
5252 <para>
5253 <indexterm role="option">
5254 <primary><option>-dd</option></primary>
5255 </indexterm>
5256 This option behaves exactly like <option>-d</option> except when used on a command that
5257 starts a daemon process. In that case, debugging is turned off for the
5258 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5259 behaviour of the daemon without creating as much output as full debugging does.
5260 </para>
5261 </listitem></varlistentry>
5262 <varlistentry>
5263 <term><option>-dropcr</option></term>
5264 <listitem>
5265 <para>
5266 <indexterm role="option">
5267 <primary><option>-dropcr</option></primary>
5268 </indexterm>
5269 This is an obsolete option that is now a no-op. It used to affect the way Exim
5270 handled CR and LF characters in incoming messages. What happens now is
5271 described in section <xref linkend="SECTlineendings"/>.
5272 </para>
5273 </listitem></varlistentry>
5274 <varlistentry>
5275 <term><option>-E</option></term>
5276 <listitem>
5277 <para>
5278 <indexterm role="option">
5279 <primary><option>-E</option></primary>
5280 </indexterm>
5281 <indexterm role="concept">
5282 <primary>bounce message</primary>
5283 <secondary>generating</secondary>
5284 </indexterm>
5285 This option specifies that an incoming message is a locally-generated delivery
5286 failure report. It is used internally by Exim when handling delivery failures
5287 and is not intended for external use. Its only effect is to stop Exim
5288 generating certain messages to the postmaster, as otherwise message cascades
5289 could occur in some situations. As part of the same option, a message id may
5290 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5291 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5292 </para>
5293 </listitem></varlistentry>
5294 <varlistentry>
5295 <term><option>-e</option><emphasis>x</emphasis></term>
5296 <listitem>
5297 <para>
5298 <indexterm role="option">
5299 <primary><option>-e</option><emphasis>x</emphasis></primary>
5300 </indexterm>
5301 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5302 called by various programs without the leading <option>o</option> in the option. For
5303 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5304 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5305 </para>
5306 </listitem></varlistentry>
5307 <varlistentry>
5308 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5309 <listitem>
5310 <para>
5311 <indexterm role="option">
5312 <primary><option>-F</option></primary>
5313 </indexterm>
5314 <indexterm role="concept">
5315 <primary>sender</primary>
5316 <secondary>name</secondary>
5317 </indexterm>
5318 <indexterm role="concept">
5319 <primary>name</primary>
5320 <secondary>of sender</secondary>
5321 </indexterm>
5322 This option sets the sender&#x2019;s full name for use when a locally-generated
5323 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5324 entry from the password data is used. As users are generally permitted to alter
5325 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5326 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5327 </para>
5328 </listitem></varlistentry>
5329 <varlistentry>
5330 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5331 <listitem>
5332 <para>
5333 <indexterm role="option">
5334 <primary><option>-f</option></primary>
5335 </indexterm>
5336 <indexterm role="concept">
5337 <primary>sender</primary>
5338 <secondary>address</secondary>
5339 </indexterm>
5340 <indexterm role="concept">
5341 <primary>address</primary>
5342 <secondary>sender</secondary>
5343 </indexterm>
5344 <indexterm role="concept">
5345 <primary>trusted users</primary>
5346 </indexterm>
5347 <indexterm role="concept">
5348 <primary>envelope sender</primary>
5349 </indexterm>
5350 <indexterm role="concept">
5351 <primary>user</primary>
5352 <secondary>trusted</secondary>
5353 </indexterm>
5354 This option sets the address of the envelope sender of a locally-generated
5355 message (also known as the return path). The option can normally be used only
5356 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5357 users to use it.
5358 </para>
5359 <para>
5360 Processes running as root or the Exim user are always trusted. Other
5361 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5362 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5363 of a local message is set to the caller&#x2019;s login name at the default qualify
5364 domain.
5365 </para>
5366 <para>
5367 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5368 can be specified by any user, trusted or not, to create a message that can
5369 never provoke a bounce. An empty sender can be specified either as an empty
5370 string, or as a pair of angle brackets with nothing between them, as in these
5371 examples of shell commands:
5372 </para>
5373 <literallayout class="monospaced">
5374 exim -f '&lt;&gt;' user@domain
5375 exim -f "" user@domain
5376 </literallayout>
5377 <para>
5378 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5379 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5380 <option>-bv</option> options.
5381 </para>
5382 <para>
5383 Allowing untrusted users to change the sender address does not of itself make
5384 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5385 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5386 though this can be overridden by setting <option>no_local_from_check</option>.
5387 </para>
5388 <para>
5389 White
5390 <indexterm role="concept">
5391 <primary><quote>From</quote> line</primary>
5392 </indexterm>
5393 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5394 given as two arguments or one combined argument). The sender of a
5395 locally-generated message can also be set (when permitted) by an initial
5396 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5397 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5398 </para>
5399 </listitem></varlistentry>
5400 <varlistentry>
5401 <term><option>-G</option></term>
5402 <listitem>
5403 <para>
5404 <indexterm role="option">
5405 <primary><option>-G</option></primary>
5406 </indexterm>
5407 <indexterm role="concept">
5408 <primary>submission fixups, suppressing (command-line)</primary>
5409 </indexterm>
5410 This option is equivalent to an ACL applying:
5411 </para>
5412 <literallayout class="monospaced">
5413 control = suppress_local_fixups
5414 </literallayout>
5415 <para>
5416 for every message received.  Note that Sendmail will complain about such
5417 bad formatting, where Exim silently just does not fix it up.  This may change
5418 in future.
5419 </para>
5420 <para>
5421 As this affects audit information, the caller must be a trusted user to use
5422 this option.
5423 </para>
5424 </listitem></varlistentry>
5425 <varlistentry>
5426 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5427 <listitem>
5428 <para>
5429 <indexterm role="option">
5430 <primary><option>-h</option></primary>
5431 </indexterm>
5432 <indexterm role="concept">
5433 <primary>Sendmail compatibility</primary>
5434 <secondary><option>-h</option> option ignored</secondary>
5435 </indexterm>
5436 This option is accepted for compatibility with Sendmail, but has no effect. (In
5437 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5438 headers.)
5439 </para>
5440 </listitem></varlistentry>
5441 <varlistentry>
5442 <term><option>-i</option></term>
5443 <listitem>
5444 <para>
5445 <indexterm role="option">
5446 <primary><option>-i</option></primary>
5447 </indexterm>
5448 <indexterm role="concept">
5449 <primary>Solaris</primary>
5450 <secondary><emphasis>mail</emphasis> command</secondary>
5451 </indexterm>
5452 <indexterm role="concept">
5453 <primary>dot</primary>
5454 <secondary>in incoming non-SMTP message</secondary>
5455 </indexterm>
5456 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5457 line by itself should not terminate an incoming, non-SMTP message. I can find
5458 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5459 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5460 </para>
5461 </listitem></varlistentry>
5462 <varlistentry>
5463 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5464 <listitem>
5465 <para>
5466 <indexterm role="option">
5467 <primary><option>-L</option></primary>
5468 </indexterm>
5469 <indexterm role="concept">
5470 <primary>syslog</primary>
5471 <secondary>process name; set with flag</secondary>
5472 </indexterm>
5473 This option is equivalent to setting <option>syslog_processname</option> in the config
5474 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5475 Its use is restricted to administrators.  The configuration file has to be
5476 read and parsed, to determine access rights, before this is set and takes
5477 effect, so early configuration file errors will not honour this flag.
5478 </para>
5479 <para>
5480 The tag should not be longer than 32 characters.
5481 </para>
5482 </listitem></varlistentry>
5483 <varlistentry>
5484 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5485 <listitem>
5486 <para>
5487 <indexterm role="option">
5488 <primary><option>-M</option></primary>
5489 </indexterm>
5490 <indexterm role="concept">
5491 <primary>forcing delivery</primary>
5492 </indexterm>
5493 <indexterm role="concept">
5494 <primary>delivery</primary>
5495 <secondary>forcing attempt</secondary>
5496 </indexterm>
5497 <indexterm role="concept">
5498 <primary>frozen messages</primary>
5499 <secondary>forcing delivery</secondary>
5500 </indexterm>
5501 This option requests Exim to run a delivery attempt on each message in turn. If
5502 any of the messages are frozen, they are automatically thawed before the
5503 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5504 and <option>hold_domains</option> are ignored.
5505 </para>
5506 <para>
5507 Retry
5508 <indexterm role="concept">
5509 <primary>hints database</primary>
5510 <secondary>overriding retry hints</secondary>
5511 </indexterm>
5512 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5513 the normal retry time has not yet been reached. This option requires the caller
5514 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5515 which can be set false to relax this restriction (and also the same requirement
5516 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5517 </para>
5518 <para>
5519 The deliveries happen synchronously, that is, the original Exim process does
5520 not terminate until all the delivery attempts have finished. No output is
5521 produced unless there is a serious error. If you want to see what is happening,
5522 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5523 </para>
5524 </listitem></varlistentry>
5525 <varlistentry>
5526 <term><option>-Mar</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5527 <listitem>
5528 <para>
5529 <indexterm role="option">
5530 <primary><option>-Mar</option></primary>
5531 </indexterm>
5532 <indexterm role="concept">
5533 <primary>message</primary>
5534 <secondary>adding recipients</secondary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>recipient</primary>
5538 <secondary>adding</secondary>
5539 </indexterm>
5540 This option requests Exim to add the addresses to the list of recipients of the
5541 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5542 id, and the remaining ones must be email addresses. However, if the message is
5543 active (in the middle of a delivery attempt), it is not altered. This option
5544 can be used only by an admin user.
5545 </para>
5546 </listitem></varlistentry>
5547 <varlistentry>
5548 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5549 <listitem>
5550 <para>
5551 <indexterm role="option">
5552 <primary><option>-MC</option></primary>
5553 </indexterm>
5554 <indexterm role="concept">
5555 <primary>SMTP</primary>
5556 <secondary>passed connection</secondary>
5557 </indexterm>
5558 <indexterm role="concept">
5559 <primary>SMTP</primary>
5560 <secondary>multiple deliveries</secondary>
5561 </indexterm>
5562 <indexterm role="concept">
5563 <primary>multiple SMTP deliveries</primary>
5564 </indexterm>
5565 This option is not intended for use by external callers. It is used internally
5566 by Exim to invoke another instance of itself to deliver a waiting message using
5567 an existing SMTP connection, which is passed as the standard input. Details are
5568 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5569 must be root or the Exim user in order to use it.
5570 </para>
5571 </listitem></varlistentry>
5572 <varlistentry>
5573 <term><option>-MCA</option></term>
5574 <listitem>
5575 <para>
5576 <indexterm role="option">
5577 <primary><option>-MCA</option></primary>
5578 </indexterm>
5579 This option is not intended for use by external callers. It is used internally
5580 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5581 connection to the remote host has been authenticated.
5582 </para>
5583 </listitem></varlistentry>
5584 <varlistentry>
5585 <term><option>-MCD</option></term>
5586 <listitem>
5587 <para>
5588 <indexterm role="option">
5589 <primary><option>-MCD</option></primary>
5590 </indexterm>
5591 This option is not intended for use by external callers. It is used internally
5592 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5593 remote host supports the ESMTP <filename>DSN</filename> extension.
5594 </para>
5595 </listitem></varlistentry>
5596 <varlistentry>
5597 <term><option>-MCG</option></term>
5598 <listitem>
5599 <para>
5600 <indexterm role="option">
5601 <primary><option>-MCG</option></primary>
5602 </indexterm>
5603 This option is not intended for use by external callers. It is used internally
5604 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5605 alternate queue is used, named by the following option.
5606 </para>
5607 </listitem></varlistentry>
5608 <varlistentry>
5609 <term><option>-MCP</option></term>
5610 <listitem>
5611 <para>
5612 <indexterm role="option">
5613 <primary><option>-MCP</option></primary>
5614 </indexterm>
5615 This option is not intended for use by external callers. It is used internally
5616 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5617 which Exim is connected supports pipelining.
5618 </para>
5619 </listitem></varlistentry>
5620 <varlistentry>
5621 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5622 <listitem>
5623 <para>
5624 <indexterm role="option">
5625 <primary><option>-MCQ</option></primary>
5626 </indexterm>
5627 This option is not intended for use by external callers. It is used internally
5628 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5629 started by a queue runner. It passes on the process id of the queue runner,
5630 together with the file descriptor number of an open pipe. Closure of the pipe
5631 signals the final completion of the sequence of processes that are passing
5632 messages through the same SMTP connection.
5633 </para>
5634 </listitem></varlistentry>
5635 <varlistentry>
5636 <term><option>-MCS</option></term>
5637 <listitem>
5638 <para>
5639 <indexterm role="option">
5640 <primary><option>-MCS</option></primary>
5641 </indexterm>
5642 This option is not intended for use by external callers. It is used internally
5643 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5644 SMTP SIZE option should be used on messages delivered down the existing
5645 connection.
5646 </para>
5647 </listitem></varlistentry>
5648 <varlistentry>
5649 <term><option>-MCT</option></term>
5650 <listitem>
5651 <para>
5652 <indexterm role="option">
5653 <primary><option>-MCT</option></primary>
5654 </indexterm>
5655 This option is not intended for use by external callers. It is used internally
5656 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5657 host to which Exim is connected supports TLS encryption.
5658 </para>
5659 </listitem></varlistentry>
5660 <varlistentry>
5661 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5662 <listitem>
5663 <para>
5664 <indexterm role="option">
5665 <primary><option>-Mc</option></primary>
5666 </indexterm>
5667 <indexterm role="concept">
5668 <primary>hints database</primary>
5669 <secondary>not overridden by <option>-Mc</option></secondary>
5670 </indexterm>
5671 <indexterm role="concept">
5672 <primary>delivery</primary>
5673 <secondary>manually started &ndash; not forced</secondary>
5674 </indexterm>
5675 This option requests Exim to run a delivery attempt on each message in turn,
5676 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5677 that are found. This option is not very useful to external callers. It is
5678 provided mainly for internal use by Exim when it needs to re-invoke itself in
5679 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5680 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5681 respects retry times and other options such as <option>hold_domains</option> that are
5682 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5683 If you want to run a specific delivery as if in a queue run, you should use
5684 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5685 and other deliveries is made in one or two places.
5686 </para>
5687 </listitem></varlistentry>
5688 <varlistentry>
5689 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5690 <listitem>
5691 <para>
5692 <indexterm role="option">
5693 <primary><option>-Mes</option></primary>
5694 </indexterm>
5695 <indexterm role="concept">
5696 <primary>message</primary>
5697 <secondary>changing sender</secondary>
5698 </indexterm>
5699 <indexterm role="concept">
5700 <primary>sender</primary>
5701 <secondary>changing</secondary>
5702 </indexterm>
5703 This option requests Exim to change the sender address in the message to the
5704 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5705 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5706 be a message id, and the second one an email address. However, if the message
5707 is active (in the middle of a delivery attempt), its status is not altered.
5708 This option can be used only by an admin user.
5709 </para>
5710 </listitem></varlistentry>
5711 <varlistentry>
5712 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5713 <listitem>
5714 <para>
5715 <indexterm role="option">
5716 <primary><option>-Mf</option></primary>
5717 </indexterm>
5718 <indexterm role="concept">
5719 <primary>freezing messages</primary>
5720 </indexterm>
5721 <indexterm role="concept">
5722 <primary>message</primary>
5723 <secondary>manually freezing</secondary>
5724 </indexterm>
5725 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5726 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5727 either manually or as a result of the <option>auto_thaw</option> configuration option.
5728 However, if any of the messages are active (in the middle of a delivery
5729 attempt), their status is not altered. This option can be used only by an admin
5730 user.
5731 </para>
5732 </listitem></varlistentry>
5733 <varlistentry>
5734 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5735 <listitem>
5736 <para>
5737 <indexterm role="option">
5738 <primary><option>-Mg</option></primary>
5739 </indexterm>
5740 <indexterm role="concept">
5741 <primary>giving up on messages</primary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>message</primary>
5745 <secondary>abandoning delivery attempts</secondary>
5746 </indexterm>
5747 <indexterm role="concept">
5748 <primary>delivery</primary>
5749 <secondary>abandoning further attempts</secondary>
5750 </indexterm>
5751 This option requests Exim to give up trying to deliver the listed messages,
5752 including any that are frozen. However, if any of the messages are active,
5753 their status is not altered. For non-bounce messages, a delivery error message
5754 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5755 Bounce messages are just discarded. This option can be used only by an admin
5756 user.
5757 </para>
5758 </listitem></varlistentry>
5759 <varlistentry>
5760 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5761 <listitem>
5762 <para>
5763 <indexterm role="option">
5764 <primary><option>-Mmad</option></primary>
5765 </indexterm>
5766 <indexterm role="concept">
5767 <primary>delivery</primary>
5768 <secondary>cancelling all</secondary>
5769 </indexterm>
5770 This option requests Exim to mark all the recipient addresses in the messages
5771 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5772 message is active (in the middle of a delivery attempt), its status is not
5773 altered. This option can be used only by an admin user.
5774 </para>
5775 </listitem></varlistentry>
5776 <varlistentry>
5777 <term><option>-Mmd</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5778 <listitem>
5779 <para>
5780 <indexterm role="option">
5781 <primary><option>-Mmd</option></primary>
5782 </indexterm>
5783 <indexterm role="concept">
5784 <primary>delivery</primary>
5785 <secondary>cancelling by address</secondary>
5786 </indexterm>
5787 <indexterm role="concept">
5788 <primary>recipient</primary>
5789 <secondary>removing</secondary>
5790 </indexterm>
5791 <indexterm role="concept">
5792 <primary>removing recipients</primary>
5793 </indexterm>
5794 This option requests Exim to mark the given addresses as already delivered
5795 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5796 the remaining ones must be email addresses. These are matched to recipient
5797 addresses in the message in a case-sensitive manner. If the message is active
5798 (in the middle of a delivery attempt), its status is not altered. This option
5799 can be used only by an admin user.
5800 </para>
5801 </listitem></varlistentry>
5802 <varlistentry>
5803 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5804 <listitem>
5805 <para>
5806 <indexterm role="option">
5807 <primary><option>-Mrm</option></primary>
5808 </indexterm>
5809 <indexterm role="concept">
5810 <primary>removing messages</primary>
5811 </indexterm>
5812 <indexterm role="concept">
5813 <primary>abandoning mail</primary>
5814 </indexterm>
5815 <indexterm role="concept">
5816 <primary>message</primary>
5817 <secondary>manually discarding</secondary>
5818 </indexterm>
5819 This option requests Exim to remove the given messages from the queue. No
5820 bounce messages are sent; each message is simply forgotten. However, if any of
5821 the messages are active, their status is not altered. This option can be used
5822 only by an admin user or by the user who originally caused the message to be
5823 placed on the queue.
5824 </para>
5825 </listitem></varlistentry>
5826 <varlistentry>
5827 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5828 <listitem>
5829 <para>
5830 <indexterm role="option">
5831 <primary><option>-Mset</option></primary>
5832 </indexterm>
5833 <indexterm role="concept">
5834 <primary>testing</primary>
5835 <secondary>string expansion</secondary>
5836 </indexterm>
5837 <indexterm role="concept">
5838 <primary>expansion</primary>
5839 <secondary>testing</secondary>
5840 </indexterm>
5841 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5842 string expansions). Exim loads the given message from its spool before doing
5843 the test expansions, thus setting message-specific variables such as
5844 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5845 available. This feature is provided to make it easier to test expansions that
5846 make use of these variables. However, this option can be used only by an admin
5847 user. See also <option>-bem</option>.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-Mt</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>thawing messages</primary>
5859 </indexterm>
5860 <indexterm role="concept">
5861 <primary>unfreezing messages</primary>
5862 </indexterm>
5863 <indexterm role="concept">
5864 <primary>frozen messages</primary>
5865 <secondary>thawing</secondary>
5866 </indexterm>
5867 <indexterm role="concept">
5868 <primary>message</primary>
5869 <secondary>thawing frozen</secondary>
5870 </indexterm>
5871 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5872 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5873 messages are active, their status is not altered. This option can be used only
5874 by an admin user.
5875 </para>
5876 </listitem></varlistentry>
5877 <varlistentry>
5878 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5879 <listitem>
5880 <para>
5881 <indexterm role="option">
5882 <primary><option>-Mvb</option></primary>
5883 </indexterm>
5884 <indexterm role="concept">
5885 <primary>listing</primary>
5886 <secondary>message body</secondary>
5887 </indexterm>
5888 <indexterm role="concept">
5889 <primary>message</primary>
5890 <secondary>listing body of</secondary>
5891 </indexterm>
5892 This option causes the contents of the message body (-D) spool file to be
5893 written to the standard output. This option can be used only by an admin user.
5894 </para>
5895 </listitem></varlistentry>
5896 <varlistentry>
5897 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5898 <listitem>
5899 <para>
5900 <indexterm role="option">
5901 <primary><option>-Mvc</option></primary>
5902 </indexterm>
5903 <indexterm role="concept">
5904 <primary>message</primary>
5905 <secondary>listing in RFC 2822 format</secondary>
5906 </indexterm>
5907 <indexterm role="concept">
5908 <primary>listing</primary>
5909 <secondary>message in RFC 2822 format</secondary>
5910 </indexterm>
5911 This option causes a copy of the complete message (header lines plus body) to
5912 be written to the standard output in RFC 2822 format. This option can be used
5913 only by an admin user.
5914 </para>
5915 </listitem></varlistentry>
5916 <varlistentry>
5917 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5918 <listitem>
5919 <para>
5920 <indexterm role="option">
5921 <primary><option>-Mvh</option></primary>
5922 </indexterm>
5923 <indexterm role="concept">
5924 <primary>listing</primary>
5925 <secondary>message headers</secondary>
5926 </indexterm>
5927 <indexterm role="concept">
5928 <primary>header lines</primary>
5929 <secondary>listing</secondary>
5930 </indexterm>
5931 <indexterm role="concept">
5932 <primary>message</primary>
5933 <secondary>listing header lines</secondary>
5934 </indexterm>
5935 This option causes the contents of the message headers (-H) spool file to be
5936 written to the standard output. This option can be used only by an admin user.
5937 </para>
5938 </listitem></varlistentry>
5939 <varlistentry>
5940 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5941 <listitem>
5942 <para>
5943 <indexterm role="option">
5944 <primary><option>-Mvl</option></primary>
5945 </indexterm>
5946 <indexterm role="concept">
5947 <primary>listing</primary>
5948 <secondary>message log</secondary>
5949 </indexterm>
5950 <indexterm role="concept">
5951 <primary>message</primary>
5952 <secondary>listing message log</secondary>
5953 </indexterm>
5954 This option causes the contents of the message log spool file to be written to
5955 the standard output. This option can be used only by an admin user.
5956 </para>
5957 </listitem></varlistentry>
5958 <varlistentry>
5959 <term><option>-m</option></term>
5960 <listitem>
5961 <para>
5962 <indexterm role="option">
5963 <primary><option>-m</option></primary>
5964 </indexterm>
5965 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5966 treats it that way too.
5967 </para>
5968 </listitem></varlistentry>
5969 <varlistentry>
5970 <term><option>-N</option></term>
5971 <listitem>
5972 <para>
5973 <indexterm role="option">
5974 <primary><option>-N</option></primary>
5975 </indexterm>
5976 <indexterm role="concept">
5977 <primary>debugging</primary>
5978 <secondary><option>-N</option> option</secondary>
5979 </indexterm>
5980 <indexterm role="concept">
5981 <primary>debugging</primary>
5982 <secondary>suppressing delivery</secondary>
5983 </indexterm>
5984 This is a debugging option that inhibits delivery of a message at the transport
5985 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5986 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5987 had successfully done so. However, it does not make any updates to the retry
5988 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5989 than <quote>=&gt;</quote>.
5990 </para>
5991 <para>
5992 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5993 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5994 words, an ordinary user can use it only when supplying an incoming message to
5995 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5996 address may be deferred because of a configuration problem on a transport, or a
5997 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5998 the message, and applies to any subsequent delivery attempts that may happen
5999 for that message.
6000 </para>
6001 </listitem></varlistentry>
6002 <varlistentry>
6003 <term><option>-n</option></term>
6004 <listitem>
6005 <para>
6006 <indexterm role="option">
6007 <primary><option>-n</option></primary>
6008 </indexterm>
6009 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6010 For normal modes of operation, it is ignored by Exim.
6011 When combined with <option>-bP</option> it makes the output more terse (suppresses
6012 option names, environment values and config pretty printing).
6013 </para>
6014 </listitem></varlistentry>
6015 <varlistentry>
6016 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6017 <listitem>
6018 <para>
6019 <indexterm role="option">
6020 <primary><option>-O</option></primary>
6021 </indexterm>
6022 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6023 Exim.
6024 </para>
6025 </listitem></varlistentry>
6026 <varlistentry>
6027 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6028 <listitem>
6029 <para>
6030 <indexterm role="option">
6031 <primary><option>-oA</option></primary>
6032 </indexterm>
6033 <indexterm role="concept">
6034 <primary>Sendmail compatibility</primary>
6035 <secondary><option>-oA</option> option</secondary>
6036 </indexterm>
6037 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6038 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6039 description above.
6040 </para>
6041 </listitem></varlistentry>
6042 <varlistentry>
6043 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6044 <listitem>
6045 <para>
6046 <indexterm role="option">
6047 <primary><option>-oB</option></primary>
6048 </indexterm>
6049 <indexterm role="concept">
6050 <primary>SMTP</primary>
6051 <secondary>passed connection</secondary>
6052 </indexterm>
6053 <indexterm role="concept">
6054 <primary>SMTP</primary>
6055 <secondary>multiple deliveries</secondary>
6056 </indexterm>
6057 <indexterm role="concept">
6058 <primary>multiple SMTP deliveries</primary>
6059 </indexterm>
6060 This is a debugging option which limits the maximum number of messages that can
6061 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6062 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6063 </para>
6064 </listitem></varlistentry>
6065 <varlistentry>
6066 <term><option>-odb</option></term>
6067 <listitem>
6068 <para>
6069 <indexterm role="option">
6070 <primary><option>-odb</option></primary>
6071 </indexterm>
6072 <indexterm role="concept">
6073 <primary>background delivery</primary>
6074 </indexterm>
6075 <indexterm role="concept">
6076 <primary>delivery</primary>
6077 <secondary>in the background</secondary>
6078 </indexterm>
6079 This option applies to all modes in which Exim accepts incoming messages,
6080 including the listening daemon. It requests <quote>background</quote> delivery of such
6081 messages, which means that the accepting process automatically starts a
6082 delivery process for each message received, but does not wait for the delivery
6083 processes to finish.
6084 </para>
6085 <para>
6086 When all the messages have been received, the reception process exits,
6087 leaving the delivery processes to finish in their own time. The standard output
6088 and error streams are closed at the start of each delivery process.
6089 This is the default action if none of the <option>-od</option> options are present.
6090 </para>
6091 <para>
6092 If one of the queueing options in the configuration file
6093 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6094 overrides it if <option>queue_only_override</option> is set true, which is the default
6095 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6096 </para>
6097 </listitem></varlistentry>
6098 <varlistentry>
6099 <term><option>-odf</option></term>
6100 <listitem>
6101 <para>
6102 <indexterm role="option">
6103 <primary><option>-odf</option></primary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>foreground delivery</primary>
6107 </indexterm>
6108 <indexterm role="concept">
6109 <primary>delivery</primary>
6110 <secondary>in the foreground</secondary>
6111 </indexterm>
6112 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6113 accepted a locally-generated message. (For the daemon it is exactly the same as
6114 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6115 and Exim waits for it to complete before proceeding.
6116 </para>
6117 <para>
6118 The original Exim reception process does not finish until the delivery
6119 process for the final message has ended. The standard error stream is left open
6120 during deliveries.
6121 </para>
6122 <para>
6123 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6124 false and one of the queueing options in the configuration file is in effect.
6125 </para>
6126 <para>
6127 If there is a temporary delivery error during foreground delivery, the
6128 message is left on the queue for later delivery, and the original reception
6129 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6130 restricted configuration that never queues messages.
6131 </para>
6132 </listitem></varlistentry>
6133 <varlistentry>
6134 <term><option>-odi</option></term>
6135 <listitem>
6136 <para>
6137 <indexterm role="option">
6138 <primary><option>-odi</option></primary>
6139 </indexterm>
6140 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6141 Sendmail.
6142 </para>
6143 </listitem></varlistentry>
6144 <varlistentry>
6145 <term><option>-odq</option></term>
6146 <listitem>
6147 <para>
6148 <indexterm role="option">
6149 <primary><option>-odq</option></primary>
6150 </indexterm>
6151 <indexterm role="concept">
6152 <primary>non-immediate delivery</primary>
6153 </indexterm>
6154 <indexterm role="concept">
6155 <primary>delivery</primary>
6156 <secondary>suppressing immediate</secondary>
6157 </indexterm>
6158 <indexterm role="concept">
6159 <primary>queueing incoming messages</primary>
6160 </indexterm>
6161 This option applies to all modes in which Exim accepts incoming messages,
6162 including the listening daemon. It specifies that the accepting process should
6163 not automatically start a delivery process for each message received. Messages
6164 are placed on the queue, and remain there until a subsequent queue runner
6165 process encounters them. There are several configuration options (such as
6166 <option>queue_only</option>) that can be used to queue incoming messages under certain
6167 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6168 forces queueing.
6169 </para>
6170 </listitem></varlistentry>
6171 <varlistentry>
6172 <term><option>-odqs</option></term>
6173 <listitem>
6174 <para>
6175 <indexterm role="option">
6176 <primary><option>-odqs</option></primary>
6177 </indexterm>
6178 <indexterm role="concept">
6179 <primary>SMTP</primary>
6180 <secondary>delaying delivery</secondary>
6181 </indexterm>
6182 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6183 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6184 <option>queue_only_override</option> is false and one of the queueing options in the
6185 configuration file is in effect.
6186 </para>
6187 <para>
6188 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6189 message, in the background by default, but in the foreground if <option>-odi</option> is
6190 also present. The recipient addresses are routed, and local deliveries are done
6191 in the normal way. However, if any SMTP deliveries are required, they are not
6192 done at this time, so the message remains on the queue until a subsequent queue
6193 runner process encounters it. Because routing was done, Exim knows which
6194 messages are waiting for which hosts, and so a number of messages for the same
6195 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6196 configuration option has the same effect for specific domains. See also the
6197 <option>-qq</option> option.
6198 </para>
6199 </listitem></varlistentry>
6200 <varlistentry>
6201 <term><option>-oee</option></term>
6202 <listitem>
6203 <para>
6204 <indexterm role="option">
6205 <primary><option>-oee</option></primary>
6206 </indexterm>
6207 <indexterm role="concept">
6208 <primary>error</primary>
6209 <secondary>reporting</secondary>
6210 </indexterm>
6211 If an error is detected while a non-SMTP message is being received (for
6212 example, a malformed address), the error is reported to the sender in a mail
6213 message.
6214 </para>
6215 <para>
6216 <indexterm role="concept">
6217 <primary>return code</primary>
6218 <secondary>for <option>-oee</option></secondary>
6219 </indexterm>
6220 Provided
6221 this error message is successfully sent, the Exim receiving process
6222 exits with a return code of zero. If not, the return code is 2 if the problem
6223 is that the original message has no recipients, or 1 for any other error.
6224 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6225 </para>
6226 </listitem></varlistentry>
6227 <varlistentry>
6228 <term><option>-oem</option></term>
6229 <listitem>
6230 <para>
6231 <indexterm role="option">
6232 <primary><option>-oem</option></primary>
6233 </indexterm>
6234 <indexterm role="concept">
6235 <primary>error</primary>
6236 <secondary>reporting</secondary>
6237 </indexterm>
6238 <indexterm role="concept">
6239 <primary>return code</primary>
6240 <secondary>for <option>-oem</option></secondary>
6241 </indexterm>
6242 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6243 return code, whether or not the error message was successfully sent.
6244 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6245 </para>
6246 </listitem></varlistentry>
6247 <varlistentry>
6248 <term><option>-oep</option></term>
6249 <listitem>
6250 <para>
6251 <indexterm role="option">
6252 <primary><option>-oep</option></primary>
6253 </indexterm>
6254 <indexterm role="concept">
6255 <primary>error</primary>
6256 <secondary>reporting</secondary>
6257 </indexterm>
6258 If an error is detected while a non-SMTP message is being received, the
6259 error is reported by writing a message to the standard error file (stderr).
6260 <indexterm role="concept">
6261 <primary>return code</primary>
6262 <secondary>for <option>-oep</option></secondary>
6263 </indexterm>
6264 The return code is 1 for all errors.
6265 </para>
6266 </listitem></varlistentry>
6267 <varlistentry>
6268 <term><option>-oeq</option></term>
6269 <listitem>
6270 <para>
6271 <indexterm role="option">
6272 <primary><option>-oeq</option></primary>
6273 </indexterm>
6274 <indexterm role="concept">
6275 <primary>error</primary>
6276 <secondary>reporting</secondary>
6277 </indexterm>
6278 This option is supported for compatibility with Sendmail, but has the same
6279 effect as <option>-oep</option>.
6280 </para>
6281 </listitem></varlistentry>
6282 <varlistentry>
6283 <term><option>-oew</option></term>
6284 <listitem>
6285 <para>
6286 <indexterm role="option">
6287 <primary><option>-oew</option></primary>
6288 </indexterm>
6289 <indexterm role="concept">
6290 <primary>error</primary>
6291 <secondary>reporting</secondary>
6292 </indexterm>
6293 This option is supported for compatibility with Sendmail, but has the same
6294 effect as <option>-oem</option>.
6295 </para>
6296 </listitem></varlistentry>
6297 <varlistentry>
6298 <term><option>-oi</option></term>
6299 <listitem>
6300 <para>
6301 <indexterm role="option">
6302 <primary><option>-oi</option></primary>
6303 </indexterm>
6304 <indexterm role="concept">
6305 <primary>dot</primary>
6306 <secondary>in incoming non-SMTP message</secondary>
6307 </indexterm>
6308 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6309 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6310 single dot does terminate, though Exim does no special processing for other
6311 lines that start with a dot. This option is set by default if Exim is called as
6312 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6313 </para>
6314 </listitem></varlistentry>
6315 <varlistentry>
6316 <term><option>-oitrue</option></term>
6317 <listitem>
6318 <para>
6319 <indexterm role="option">
6320 <primary><option>-oitrue</option></primary>
6321 </indexterm>
6322 This option is treated as synonymous with <option>-oi</option>.
6323 </para>
6324 </listitem></varlistentry>
6325 <varlistentry>
6326 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6327 <listitem>
6328 <para>
6329 <indexterm role="option">
6330 <primary><option>-oMa</option></primary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>sender</primary>
6334 <secondary>host address, specifying for local message</secondary>
6335 </indexterm>
6336 A number of options starting with <option>-oM</option> can be used to set values associated
6337 with remote hosts on locally-submitted messages (that is, messages not received
6338 over TCP/IP). These options can be used by any caller in conjunction with the
6339 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6340 other circumstances, they are ignored unless the caller is trusted.
6341 </para>
6342 <para>
6343 The <option>-oMa</option> option sets the sender host address. This may include a port
6344 number at the end, after a full stop (period). For example:
6345 </para>
6346 <literallayout class="monospaced">
6347 exim -bs -oMa 10.9.8.7.1234
6348 </literallayout>
6349 <para>
6350 An alternative syntax is to enclose the IP address in square brackets,
6351 followed by a colon and the port number:
6352 </para>
6353 <literallayout class="monospaced">
6354 exim -bs -oMa [10.9.8.7]:1234
6355 </literallayout>
6356 <para>
6357 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6358 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6359 are present on the command line, the sender host IP address is taken from
6360 whichever one is last.
6361 </para>
6362 </listitem></varlistentry>
6363 <varlistentry>
6364 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6365 <listitem>
6366 <para>
6367 <indexterm role="option">
6368 <primary><option>-oMaa</option></primary>
6369 </indexterm>
6370 <indexterm role="concept">
6371 <primary>authentication</primary>
6372 <secondary>name, specifying for local message</secondary>
6373 </indexterm>
6374 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6375 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6376 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6377 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6378 authenticated SMTP session without actually using the SMTP AUTH command.
6379 </para>
6380 </listitem></varlistentry>
6381 <varlistentry>
6382 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6383 <listitem>
6384 <para>
6385 <indexterm role="option">
6386 <primary><option>-oMai</option></primary>
6387 </indexterm>
6388 <indexterm role="concept">
6389 <primary>authentication</primary>
6390 <secondary>id, specifying for local message</secondary>
6391 </indexterm>
6392 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6393 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6394 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6395 where there is no default) for messages from local sources. See chapter
6396 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6397 </para>
6398 </listitem></varlistentry>
6399 <varlistentry>
6400 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6401 <listitem>
6402 <para>
6403 <indexterm role="option">
6404 <primary><option>-oMas</option></primary>
6405 </indexterm>
6406 <indexterm role="concept">
6407 <primary>authentication</primary>
6408 <secondary>sender, specifying for local message</secondary>
6409 </indexterm>
6410 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6411 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6412 overrides the sender address that is created from the caller&#x2019;s login id for
6413 messages from local sources, except when <option>-bh</option> is used, when there is no
6414 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6415 specified on a MAIL command overrides this value. See chapter
6416 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6421 <listitem>
6422 <para>
6423 <indexterm role="option">
6424 <primary><option>-oMi</option></primary>
6425 </indexterm>
6426 <indexterm role="concept">
6427 <primary>interface</primary>
6428 <secondary>address, specifying for local message</secondary>
6429 </indexterm>
6430 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6431 option sets the IP interface address value. A port number may be included,
6432 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6433 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6434 </para>
6435 </listitem></varlistentry>
6436 <varlistentry>
6437 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6438 <listitem>
6439 <para>
6440 <indexterm role="option">
6441 <primary><option>-oMm</option></primary>
6442 </indexterm>
6443 <indexterm role="concept">
6444 <primary>message reference</primary>
6445 <secondary>message reference, specifying for local message</secondary>
6446 </indexterm>
6447 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6448 option sets the message reference, e.g. message-id, and is logged during
6449 delivery. This is useful when some kind of audit trail is required to tie
6450 messages together. The format of the message reference is checked and will
6451 abort if the format is invalid. The option will only be accepted if exim is
6452 running in trusted mode, not as any regular user.
6453 </para>
6454 <para>
6455 The best example of a message reference is when Exim sends a bounce message.
6456 The message reference is the message-id of the original message for which Exim
6457 is sending the bounce.
6458 </para>
6459 </listitem></varlistentry>
6460 <varlistentry>
6461 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6462 <listitem>
6463 <para>
6464 <indexterm role="option">
6465 <primary><option>-oMr</option></primary>
6466 </indexterm>
6467 <indexterm role="concept">
6468 <primary>protocol, specifying for local message</primary>
6469 </indexterm>
6470 <indexterm role="variable">
6471 <primary><varname>$received_protocol</varname></primary>
6472 </indexterm>
6473 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6474 option sets the received protocol value that is stored in
6475 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6476 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6477 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6478 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6479 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6480 be set by <option>-oMr</option>.
6481 </para>
6482 </listitem></varlistentry>
6483 <varlistentry>
6484 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6485 <listitem>
6486 <para>
6487 <indexterm role="option">
6488 <primary><option>-oMs</option></primary>
6489 </indexterm>
6490 <indexterm role="concept">
6491 <primary>sender</primary>
6492 <secondary>host name, specifying for local message</secondary>
6493 </indexterm>
6494 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6495 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6496 present, Exim does not attempt to look up a host name from an IP address; it
6497 uses the name it is given.
6498 </para>
6499 </listitem></varlistentry>
6500 <varlistentry>
6501 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6502 <listitem>
6503 <para>
6504 <indexterm role="option">
6505 <primary><option>-oMt</option></primary>
6506 </indexterm>
6507 <indexterm role="concept">
6508 <primary>sender</primary>
6509 <secondary>ident string, specifying for local message</secondary>
6510 </indexterm>
6511 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6512 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6513 local callers is the login id of the calling process, except when <option>-bh</option> is
6514 used, when there is no default.
6515 </para>
6516 </listitem></varlistentry>
6517 <varlistentry>
6518 <term><option>-om</option></term>
6519 <listitem>
6520 <para>
6521 <indexterm role="option">
6522 <primary><option>-om</option></primary>
6523 </indexterm>
6524 <indexterm role="concept">
6525 <primary>Sendmail compatibility</primary>
6526 <secondary><option>-om</option> option ignored</secondary>
6527 </indexterm>
6528 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6529 message should receive a copy of the message if the sender appears in an alias
6530 expansion. Exim always does this, so the option does nothing.
6531 </para>
6532 </listitem></varlistentry>
6533 <varlistentry>
6534 <term><option>-oo</option></term>
6535 <listitem>
6536 <para>
6537 <indexterm role="option">
6538 <primary><option>-oo</option></primary>
6539 </indexterm>
6540 <indexterm role="concept">
6541 <primary>Sendmail compatibility</primary>
6542 <secondary><option>-oo</option> option ignored</secondary>
6543 </indexterm>
6544 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6545 whatever that means.
6546 </para>
6547 </listitem></varlistentry>
6548 <varlistentry>
6549 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6550 <listitem>
6551 <para>
6552 <indexterm role="option">
6553 <primary><option>-oP</option></primary>
6554 </indexterm>
6555 <indexterm role="concept">
6556 <primary>pid (process id)</primary>
6557 <secondary>of daemon</secondary>
6558 </indexterm>
6559 <indexterm role="concept">
6560 <primary>daemon</primary>
6561 <secondary>process id (pid)</secondary>
6562 </indexterm>
6563 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6564 value. The option specifies the file to which the process id of the daemon is
6565 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6566 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6567 because in those cases, the normal pid file is not used.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-or</option></primary>
6576 </indexterm>
6577 <indexterm role="concept">
6578 <primary>timeout</primary>
6579 <secondary>for non-SMTP input</secondary>
6580 </indexterm>
6581 This option sets a timeout value for incoming non-SMTP messages. If it is not
6582 set, Exim will wait forever for the standard input. The value can also be set
6583 by the <option>receive_timeout</option> option. The format used for specifying times is
6584 described in section <xref linkend="SECTtimeformat"/>.
6585 </para>
6586 </listitem></varlistentry>
6587 <varlistentry>
6588 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6589 <listitem>
6590 <para>
6591 <indexterm role="option">
6592 <primary><option>-os</option></primary>
6593 </indexterm>
6594 <indexterm role="concept">
6595 <primary>timeout</primary>
6596 <secondary>for SMTP input</secondary>
6597 </indexterm>
6598 <indexterm role="concept">
6599 <primary>SMTP</primary>
6600 <secondary>input timeout</secondary>
6601 </indexterm>
6602 This option sets a timeout value for incoming SMTP messages. The timeout
6603 applies to each SMTP command and block of data. The value can also be set by
6604 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6605 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6606 </para>
6607 </listitem></varlistentry>
6608 <varlistentry>
6609 <term><option>-ov</option></term>
6610 <listitem>
6611 <para>
6612 <indexterm role="option">
6613 <primary><option>-ov</option></primary>
6614 </indexterm>
6615 This option has exactly the same effect as <option>-v</option>.
6616 </para>
6617 </listitem></varlistentry>
6618 <varlistentry>
6619 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6620 <listitem>
6621 <para>
6622 <indexterm role="option">
6623 <primary><option>-oX</option></primary>
6624 </indexterm>
6625 <indexterm role="concept">
6626 <primary>TCP/IP</primary>
6627 <secondary>setting listening ports</secondary>
6628 </indexterm>
6629 <indexterm role="concept">
6630 <primary>TCP/IP</primary>
6631 <secondary>setting listening interfaces</secondary>
6632 </indexterm>
6633 <indexterm role="concept">
6634 <primary>port</primary>
6635 <secondary>receiving TCP/IP</secondary>
6636 </indexterm>
6637 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6638 is also given. It controls which ports and interfaces the daemon uses. Details
6639 of the syntax, and how it interacts with configuration file options, are given
6640 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6641 file is written unless <option>-oP</option> is also present to specify a pid file name.
6642 </para>
6643 </listitem></varlistentry>
6644 <varlistentry>
6645 <term><option>-pd</option></term>
6646 <listitem>
6647 <para>
6648 <indexterm role="option">
6649 <primary><option>-pd</option></primary>
6650 </indexterm>
6651 <indexterm role="concept">
6652 <primary>Perl</primary>
6653 <secondary>starting the interpreter</secondary>
6654 </indexterm>
6655 This option applies when an embedded Perl interpreter is linked with Exim (see
6656 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6657 option, forcing the starting of the interpreter to be delayed until it is
6658 needed.
6659 </para>
6660 </listitem></varlistentry>
6661 <varlistentry>
6662 <term><option>-ps</option></term>
6663 <listitem>
6664 <para>
6665 <indexterm role="option">
6666 <primary><option>-ps</option></primary>
6667 </indexterm>
6668 <indexterm role="concept">
6669 <primary>Perl</primary>
6670 <secondary>starting the interpreter</secondary>
6671 </indexterm>
6672 This option applies when an embedded Perl interpreter is linked with Exim (see
6673 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6674 option, forcing the starting of the interpreter to occur as soon as Exim is
6675 started.
6676 </para>
6677 </listitem></varlistentry>
6678 <varlistentry>
6679 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6680 <listitem>
6681 <para>
6682 <indexterm role="option">
6683 <primary><option>-p</option></primary>
6684 </indexterm>
6685 For compatibility with Sendmail, this option is equivalent to
6686 </para>
6687 <literallayout>
6688 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6689 </literallayout>
6690 <para>
6691 It sets the incoming protocol and host name (for trusted callers). The
6692 host name and its colon can be omitted when only the protocol is to be set.
6693 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6694 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6695 or <literal>s</literal> using this option (but that does not seem a real limitation).
6696 </para>
6697 </listitem></varlistentry>
6698 <varlistentry>
6699 <term><option>-q</option></term>
6700 <listitem>
6701 <para>
6702 <indexterm role="option">
6703 <primary><option>-q</option></primary>
6704 </indexterm>
6705 <indexterm role="concept">
6706 <primary>queue runner</primary>
6707 <secondary>starting manually</secondary>
6708 </indexterm>
6709 This option is normally restricted to admin users. However, there is a
6710 configuration option called <option>prod_requires_admin</option> which can be set false to
6711 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6712 and <option>-S</option> options).
6713 </para>
6714 <para>
6715 <indexterm role="concept">
6716 <primary>queue runner</primary>
6717 <secondary>description of operation</secondary>
6718 </indexterm>
6719 If other commandline options do not specify an action,
6720 the <option>-q</option> option starts one queue runner process. This scans the queue of
6721 waiting messages, and runs a delivery process for each one in turn. It waits
6722 for each delivery process to finish before starting the next one. A delivery
6723 process may not actually do any deliveries if the retry times for the addresses
6724 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6725 </para>
6726 <para>
6727 If
6728 <indexterm role="concept">
6729 <primary>SMTP</primary>
6730 <secondary>passed connection</secondary>
6731 </indexterm>
6732 <indexterm role="concept">
6733 <primary>SMTP</primary>
6734 <secondary>multiple deliveries</secondary>
6735 </indexterm>
6736 <indexterm role="concept">
6737 <primary>multiple SMTP deliveries</primary>
6738 </indexterm>
6739 the delivery process spawns other processes to deliver other messages down
6740 passed SMTP connections, the queue runner waits for these to finish before
6741 proceeding.
6742 </para>
6743 <para>
6744 When all the queued messages have been considered, the original queue runner
6745 process terminates. In other words, a single pass is made over the waiting
6746 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6747 this to be repeated periodically.
6748 </para>
6749 <para>
6750 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6751 random, but it is likely to be different each time, which is all that matters.
6752 If one particular message screws up a remote MTA, other messages to the same
6753 MTA have a chance of getting through if they get tried first.
6754 </para>
6755 <para>
6756 It is possible to cause the messages to be processed in lexical message id
6757 order, which is essentially the order in which they arrived, by setting the
6758 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6759 </para>
6760 </listitem></varlistentry>
6761 <varlistentry>
6762 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6763 <listitem>
6764 <para>
6765 The <option>-q</option> option may be followed by one or more flag letters that change its
6766 behaviour. They are all optional, but if more than one is present, they must
6767 appear in the correct order. Each flag is described in a separate item below.
6768 </para>
6769 </listitem></varlistentry>
6770 <varlistentry>
6771 <term><option>-qq...</option></term>
6772 <listitem>
6773 <para>
6774 <indexterm role="option">
6775 <primary><option>-qq</option></primary>
6776 </indexterm>
6777 <indexterm role="concept">
6778 <primary>queue</primary>
6779 <secondary>double scanning</secondary>
6780 </indexterm>
6781 <indexterm role="concept">
6782 <primary>queue</primary>
6783 <secondary>routing</secondary>
6784 </indexterm>
6785 <indexterm role="concept">
6786 <primary>routing</primary>
6787 <secondary>whole queue before delivery</secondary>
6788 </indexterm>
6789 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6790 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6791 every domain. Addresses are routed, local deliveries happen, but no remote
6792 transports are run.
6793 </para>
6794 <para>
6795 <indexterm role="concept">
6796 <primary>hints database</primary>
6797 <secondary>remembering routing</secondary>
6798 </indexterm>
6799 The hints database that remembers which messages are waiting for specific hosts
6800 is updated, as if delivery to those hosts had been deferred. After this is
6801 complete, a second, normal queue scan happens, with routing and delivery taking
6802 place as normal. Messages that are routed to the same host should mostly be
6803 delivered down a single SMTP
6804 <indexterm role="concept">
6805 <primary>SMTP</primary>
6806 <secondary>passed connection</secondary>
6807 </indexterm>
6808 <indexterm role="concept">
6809 <primary>SMTP</primary>
6810 <secondary>multiple deliveries</secondary>
6811 </indexterm>
6812 <indexterm role="concept">
6813 <primary>multiple SMTP deliveries</primary>
6814 </indexterm>
6815 connection because of the hints that were set up during the first queue scan.
6816 This option may be useful for hosts that are connected to the Internet
6817 intermittently.
6818 </para>
6819 </listitem></varlistentry>
6820 <varlistentry>
6821 <term><option>-q[q]i...</option></term>
6822 <listitem>
6823 <para>
6824 <indexterm role="option">
6825 <primary><option>-qi</option></primary>
6826 </indexterm>
6827 <indexterm role="concept">
6828 <primary>queue</primary>
6829 <secondary>initial delivery</secondary>
6830 </indexterm>
6831 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6832 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6833 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6834 <option>-odq</option> and want a queue runner just to process the new messages.
6835 </para>
6836 </listitem></varlistentry>
6837 <varlistentry>
6838 <term><option>-q[q][i]f...</option></term>
6839 <listitem>
6840 <para>
6841 <indexterm role="option">
6842 <primary><option>-qf</option></primary>
6843 </indexterm>
6844 <indexterm role="concept">
6845 <primary>queue</primary>
6846 <secondary>forcing delivery</secondary>
6847 </indexterm>
6848 <indexterm role="concept">
6849 <primary>delivery</primary>
6850 <secondary>forcing in queue run</secondary>
6851 </indexterm>
6852 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6853 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6854 their retry times are tried.
6855 </para>
6856 </listitem></varlistentry>
6857 <varlistentry>
6858 <term><option>-q[q][i]ff...</option></term>
6859 <listitem>
6860 <para>
6861 <indexterm role="option">
6862 <primary><option>-qff</option></primary>
6863 </indexterm>
6864 <indexterm role="concept">
6865 <primary>frozen messages</primary>
6866 <secondary>forcing delivery</secondary>
6867 </indexterm>
6868 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6869 frozen or not.
6870 </para>
6871 </listitem></varlistentry>
6872 <varlistentry>
6873 <term><option>-q[q][i][f[f]]l</option></term>
6874 <listitem>
6875 <para>
6876 <indexterm role="option">
6877 <primary><option>-ql</option></primary>
6878 </indexterm>
6879 <indexterm role="concept">
6880 <primary>queue</primary>
6881 <secondary>local deliveries only</secondary>
6882 </indexterm>
6883 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6884 be done. If a message requires any remote deliveries, it remains on the queue
6885 for later delivery.
6886 </para>
6887 </listitem></varlistentry>
6888 <varlistentry>
6889 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
6890 <listitem>
6891 <para>
6892 <indexterm role="option">
6893 <primary><option>-qG</option></primary>
6894 </indexterm>
6895 <indexterm role="concept">
6896 <primary>queue</primary>
6897 <secondary>named</secondary>
6898 </indexterm>
6899 <indexterm role="concept">
6900 <primary>named queues</primary>
6901 </indexterm>
6902 <indexterm role="concept">
6903 <primary>queue</primary>
6904 <secondary>delivering specific messages</secondary>
6905 </indexterm>
6906 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
6907 queue with the given name rather than the default queue.
6908 The name should not contain a <emphasis>/</emphasis> character.
6909 For a periodic queue run (see below)
6910 append to the name a slash and a time value.
6911 </para>
6912 <para>
6913 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
6914 will specify a queue to operate on.
6915 For example:
6916 </para>
6917 <literallayout class="monospaced">
6918 exim -bp -qGquarantine
6919 mailq -qGquarantine
6920 exim -qGoffpeak -Rf @special.domain.example
6921 </literallayout>
6922 </listitem></varlistentry>
6923 <varlistentry>
6924 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&nbsp;&lt;<emphasis>start&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>end&nbsp;id</emphasis>&gt;</term>
6925 <listitem>
6926 <para>
6927 When scanning the queue, Exim can be made to skip over messages whose ids are
6928 lexically less than a given value by following the <option>-q</option> option with a
6929 starting message id. For example:
6930 </para>
6931 <literallayout class="monospaced">
6932 exim -q 0t5C6f-0000c8-00
6933 </literallayout>
6934 <para>
6935 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6936 second message id is given, messages whose ids are lexically greater than it
6937 are also skipped. If the same id is given twice, for example,
6938 </para>
6939 <literallayout class="monospaced">
6940 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6941 </literallayout>
6942 <para>
6943 just one delivery process is started, for that message. This differs from
6944 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6945 that it counts as a delivery from a queue run. Note that the selection
6946 mechanism does not affect the order in which the messages are scanned. There
6947 are also other ways of selecting specific sets of messages for delivery in a
6948 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6949 </para>
6950 </listitem></varlistentry>
6951 <varlistentry>
6952 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6953 <listitem>
6954 <para>
6955 <indexterm role="concept">
6956 <primary>queue runner</primary>
6957 <secondary>starting periodically</secondary>
6958 </indexterm>
6959 <indexterm role="concept">
6960 <primary>periodic queue running</primary>
6961 </indexterm>
6962 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6963 starting a queue runner process at intervals specified by the given time value
6964 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6965 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6966 single daemon process handles both functions. A common way of starting up a
6967 combined daemon at system boot time is to use a command such as
6968 </para>
6969 <literallayout class="monospaced">
6970 /usr/exim/bin/exim -bd -q30m
6971 </literallayout>
6972 <para>
6973 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6974 process every 30 minutes.
6975 </para>
6976 <para>
6977 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6978 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6979 </para>
6980 </listitem></varlistentry>
6981 <varlistentry>
6982 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6983 <listitem>
6984 <para>
6985 <indexterm role="option">
6986 <primary><option>-qR</option></primary>
6987 </indexterm>
6988 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6989 compatibility.
6990 </para>
6991 </listitem></varlistentry>
6992 <varlistentry>
6993 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6994 <listitem>
6995 <para>
6996 <indexterm role="option">
6997 <primary><option>-qS</option></primary>
6998 </indexterm>
6999 This option is synonymous with <option>-S</option>.
7000 </para>
7001 </listitem></varlistentry>
7002 <varlistentry>
7003 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7004 <listitem>
7005 <para>
7006 <indexterm role="option">
7007 <primary><option>-R</option></primary>
7008 </indexterm>
7009 <indexterm role="concept">
7010 <primary>queue runner</primary>
7011 <secondary>for specific recipients</secondary>
7012 </indexterm>
7013 <indexterm role="concept">
7014 <primary>delivery</primary>
7015 <secondary>to given domain</secondary>
7016 </indexterm>
7017 <indexterm role="concept">
7018 <primary>domain</primary>
7019 <secondary>delivery to</secondary>
7020 </indexterm>
7021 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7022 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7023 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7024 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7025 </para>
7026 <para>
7027 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7028 perform a single queue run, except that, when scanning the messages on the
7029 queue, Exim processes only those that have at least one undelivered recipient
7030 address containing the given string, which is checked in a case-independent
7031 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7032 regular expression; otherwise it is a literal string.
7033 </para>
7034 <para>
7035 If you want to do periodic queue runs for messages with specific recipients,
7036 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7037 </para>
7038 <literallayout class="monospaced">
7039 exim -q25m -R @special.domain.example
7040 </literallayout>
7041 <para>
7042 This example does a queue run for messages with recipients in the given domain
7043 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7044 applied to each queue run.
7045 </para>
7046 <para>
7047 Once a message is selected for delivery by this mechanism, all its addresses
7048 are processed. For the first selected message, Exim overrides any retry
7049 information and forces a delivery attempt for each undelivered address. This
7050 means that if delivery of any address in the first message is successful, any
7051 existing retry information is deleted, and so delivery attempts for that
7052 address in subsequently selected messages (which are processed without forcing)
7053 will run. However, if delivery of any address does not succeed, the retry
7054 information is updated, and in subsequently selected messages, the failing
7055 address will be skipped.
7056 </para>
7057 <para>
7058 <indexterm role="concept">
7059 <primary>frozen messages</primary>
7060 <secondary>forcing delivery</secondary>
7061 </indexterm>
7062 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7063 all selected messages, not just the first; frozen messages are included when
7064 <emphasis>ff</emphasis> is present.
7065 </para>
7066 <para>
7067 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7068 to a given domain after a host has been down for some time. When the SMTP
7069 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7070 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7071 an arbitrary command instead.
7072 </para>
7073 </listitem></varlistentry>
7074 <varlistentry>
7075 <term><option>-r</option></term>
7076 <listitem>
7077 <para>
7078 <indexterm role="option">
7079 <primary><option>-r</option></primary>
7080 </indexterm>
7081 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7082 </para>
7083 </listitem></varlistentry>
7084 <varlistentry>
7085 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7086 <listitem>
7087 <para>
7088 <indexterm role="option">
7089 <primary><option>-S</option></primary>
7090 </indexterm>
7091 <indexterm role="concept">
7092 <primary>delivery</primary>
7093 <secondary>from given sender</secondary>
7094 </indexterm>
7095 <indexterm role="concept">
7096 <primary>queue runner</primary>
7097 <secondary>for specific senders</secondary>
7098 </indexterm>
7099 This option acts like <option>-R</option> except that it checks the string against each
7100 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7101 conditions must be met for a message to be selected. If either of the options
7102 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7103 </para>
7104 </listitem></varlistentry>
7105 <varlistentry>
7106 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7107 <listitem>
7108 <para>
7109 <indexterm role="option">
7110 <primary><option>-Tqt</option></primary>
7111 </indexterm>
7112 This is an option that is exclusively for use by the Exim testing suite. It is not
7113 recognized when Exim is run normally. It allows for the setting up of explicit
7114 <quote>queue times</quote> so that various warning/retry features can be tested.
7115 </para>
7116 </listitem></varlistentry>
7117 <varlistentry>
7118 <term><option>-t</option></term>
7119 <listitem>
7120 <para>
7121 <indexterm role="option">
7122 <primary><option>-t</option></primary>
7123 </indexterm>
7124 <indexterm role="concept">
7125 <primary>recipient</primary>
7126 <secondary>extracting from header lines</secondary>
7127 </indexterm>
7128 <indexterm role="concept">
7129 <primary><emphasis>Bcc:</emphasis> header line</primary>
7130 </indexterm>
7131 <indexterm role="concept">
7132 <primary><emphasis>Cc:</emphasis> header line</primary>
7133 </indexterm>
7134 <indexterm role="concept">
7135 <primary><emphasis>To:</emphasis> header line</primary>
7136 </indexterm>
7137 When Exim is receiving a locally-generated, non-SMTP message on its standard
7138 input, the <option>-t</option> option causes the recipients of the message to be obtained
7139 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7140 from the command arguments. The addresses are extracted before any rewriting
7141 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7142 </para>
7143 <para>
7144 <indexterm role="concept">
7145 <primary>Sendmail compatibility</primary>
7146 <secondary><option>-t</option> option</secondary>
7147 </indexterm>
7148 If the command has any arguments, they specify addresses to which the message
7149 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7150 the recipients list obtained from the headers. This is compatible with Smail 3
7151 and in accordance with the documented behaviour of several versions of
7152 Sendmail, as described in man pages on a number of operating systems (e.g.
7153 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7154 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7155 Sendmail book documents it that way. Exim can be made to add argument addresses
7156 instead of subtracting them by setting the option
7157 <option>extract_addresses_remove_arguments</option> false.
7158 </para>
7159 <para>
7160 <indexterm role="concept">
7161 <primary><option>Resent-</option> header lines</primary>
7162 <secondary>with <option>-t</option></secondary>
7163 </indexterm>
7164 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7165 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7166 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7167 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7168 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7169 </para>
7170 <para>
7171 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7172 message is resent several times). The RFC also specifies that they should be
7173 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7174 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7175 nor indeed exactly what constitutes a <quote>set</quote>.
7176 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7177 are often added at the end of the header, and if a message is resent more than
7178 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7179 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7180 </para>
7181 </listitem></varlistentry>
7182 <varlistentry>
7183 <term><option>-ti</option></term>
7184 <listitem>
7185 <para>
7186 <indexterm role="option">
7187 <primary><option>-ti</option></primary>
7188 </indexterm>
7189 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7190 compatibility with Sendmail.
7191 </para>
7192 </listitem></varlistentry>
7193 <varlistentry>
7194 <term><option>-tls-on-connect</option></term>
7195 <listitem>
7196 <para>
7197 <indexterm role="option">
7198 <primary><option>-tls-on-connect</option></primary>
7199 </indexterm>
7200 <indexterm role="concept">
7201 <primary>TLS</primary>
7202 <secondary>use without STARTTLS</secondary>
7203 </indexterm>
7204 <indexterm role="concept">
7205 <primary>TLS</primary>
7206 <secondary>automatic start</secondary>
7207 </indexterm>
7208 This option is available when Exim is compiled with TLS support. It forces all
7209 incoming SMTP connections to behave as if the incoming port is listed in the
7210 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7211 <xref linkend="CHAPTLS"/> for further details.
7212 </para>
7213 </listitem></varlistentry>
7214 <varlistentry>
7215 <term><option>-U</option></term>
7216 <listitem>
7217 <para>
7218 <indexterm role="option">
7219 <primary><option>-U</option></primary>
7220 </indexterm>
7221 <indexterm role="concept">
7222 <primary>Sendmail compatibility</primary>
7223 <secondary><option>-U</option> option ignored</secondary>
7224 </indexterm>
7225 Sendmail uses this option for <quote>initial message submission</quote>, and its
7226 documentation states that in future releases, it may complain about
7227 syntactically invalid messages rather than fixing them when this flag is not
7228 set. Exim ignores this option.
7229 </para>
7230 </listitem></varlistentry>
7231 <varlistentry>
7232 <term><option>-v</option></term>
7233 <listitem>
7234 <para>
7235 <indexterm role="option">
7236 <primary><option>-v</option></primary>
7237 </indexterm>
7238 This option causes Exim to write information to the standard error stream,
7239 describing what it is doing. In particular, it shows the log lines for
7240 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7241 dialogue is shown. Some of the log lines shown may not actually be written to
7242 the log if the setting of <option>log_selector</option> discards them. Any relevant
7243 selectors are shown with each log line. If none are shown, the logging is
7244 unconditional.
7245 </para>
7246 </listitem></varlistentry>
7247 <varlistentry>
7248 <term><option>-x</option></term>
7249 <listitem>
7250 <para>
7251 <indexterm role="option">
7252 <primary><option>-x</option></primary>
7253 </indexterm>
7254 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7255 National Language Support extended characters in the body of the mail item</quote>).
7256 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7257 this option.
7258 </para>
7259 </listitem></varlistentry>
7260 <varlistentry>
7261 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7262 <listitem>
7263 <para>
7264 <indexterm role="option">
7265 <primary><option>-X</option></primary>
7266 </indexterm>
7267 This option is interpreted by Sendmail to cause debug information to be sent
7268 to the named file.  It is ignored by Exim.
7269 </para>
7270 </listitem></varlistentry>
7271 <varlistentry>
7272 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7273 <listitem>
7274 <para>
7275 <indexterm role="option">
7276 <primary><option>-z</option></primary>
7277 </indexterm>
7278 This option writes its argument to Exim&#x2019;s logfile.
7279 Use is restricted to administrators; the intent is for operational notes.
7280 Quotes should be used to maintain a multi-word item as a single argument,
7281 under most shells.
7282 </para>
7283 </listitem></varlistentry>
7284 </variablelist>
7285 <para>
7286 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7287 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7288 </para>
7289 <!-- === End of command line options === -->
7290 </section>
7291 </chapter>
7292
7293 <chapter id="CHAPconf">
7294 <title>The Exim run time configuration file</title>
7295 <titleabbrev>The runtime configuration file</titleabbrev>
7296 <para>
7297 <indexterm role="concept">
7298 <primary>run time configuration</primary>
7299 </indexterm>
7300 <indexterm role="concept">
7301 <primary>configuration file</primary>
7302 <secondary>general description</secondary>
7303 </indexterm>
7304 <indexterm role="concept">
7305 <primary>CONFIGURE_FILE</primary>
7306 </indexterm>
7307 <indexterm role="concept">
7308 <primary>configuration file</primary>
7309 <secondary>errors in</secondary>
7310 </indexterm>
7311 <indexterm role="concept">
7312 <primary>error</primary>
7313 <secondary>in configuration file</secondary>
7314 </indexterm>
7315 <indexterm role="concept">
7316 <primary>return code</primary>
7317 <secondary>for bad configuration</secondary>
7318 </indexterm>
7319 Exim uses a single run time configuration file that is read whenever an Exim
7320 binary is executed. Note that in normal operation, this happens frequently,
7321 because Exim is designed to operate in a distributed manner, without central
7322 control.
7323 </para>
7324 <para>
7325 If a syntax error is detected while reading the configuration file, Exim
7326 writes a message on the standard error, and exits with a non-zero return code.
7327 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7328 errors can be detected at this time. The values of any expanded options are
7329 not checked until the expansion happens, even when the expansion does not
7330 actually alter the string.
7331 </para>
7332 <para>
7333 The name of the configuration file is compiled into the binary for security
7334 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7335 most configurations, this specifies a single file. However, it is permitted to
7336 give a colon-separated list of file names, in which case Exim uses the first
7337 existing file in the list.
7338 </para>
7339 <para>
7340 <indexterm role="concept">
7341 <primary>EXIM_USER</primary>
7342 </indexterm>
7343 <indexterm role="concept">
7344 <primary>EXIM_GROUP</primary>
7345 </indexterm>
7346 <indexterm role="concept">
7347 <primary>CONFIGURE_OWNER</primary>
7348 </indexterm>
7349 <indexterm role="concept">
7350 <primary>CONFIGURE_GROUP</primary>
7351 </indexterm>
7352 <indexterm role="concept">
7353 <primary>configuration file</primary>
7354 <secondary>ownership</secondary>
7355 </indexterm>
7356 <indexterm role="concept">
7357 <primary>ownership</primary>
7358 <secondary>configuration file</secondary>
7359 </indexterm>
7360 The run time configuration file must be owned by root or by the user that is
7361 specified at compile time by the CONFIGURE_OWNER option (if set). The
7362 configuration file must not be world-writeable, or group-writeable unless its
7363 group is the root group or the one specified at compile time by the
7364 CONFIGURE_GROUP option.
7365 </para>
7366 <para>
7367 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7368 to root, anybody who is able to edit the run time configuration file has an
7369 easy way to run commands as root. If you specify a user or group in the
7370 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7371 who are members of that group will trivially be able to obtain root privileges.
7372 </para>
7373 <para>
7374 Up to Exim version 4.72, the run time configuration file was also permitted to
7375 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7376 since it offered a simple privilege escalation for any attacker who managed to
7377 compromise the Exim user account.
7378 </para>
7379 <para>
7380 A default configuration file, which will work correctly in simple situations,
7381 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7382 defines just one file name, the installation process copies the default
7383 configuration to a new file of that name if it did not previously exist. If
7384 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7385 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7386 configuration.
7387 </para>
7388 <section id="SECID40">
7389 <title>Using a different configuration file</title>
7390 <para>
7391 <indexterm role="concept">
7392 <primary>configuration file</primary>
7393 <secondary>alternate</secondary>
7394 </indexterm>
7395 A one-off alternate configuration can be specified by the <option>-C</option> command line
7396 option, which may specify a single file or a list of files. However, when
7397 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7398 unless the argument for <option>-C</option> is identical to the built-in value from
7399 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7400 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7401 is useful mainly for checking the syntax of configuration files before
7402 installing them. No owner or group checks are done on a configuration file
7403 specified by <option>-C</option>, if root privilege has been dropped.
7404 </para>
7405 <para>
7406 Even the Exim user is not trusted to specify an arbitrary configuration file
7407 with the <option>-C</option> option to be used with root privileges, unless that file is
7408 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7409 testing a configuration using <option>-C</option> right through message reception and
7410 delivery, even if the caller is root. The reception works, but by that time,
7411 Exim is running as the Exim user, so when it re-execs to regain privilege for
7412 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7413 can test reception and delivery using two separate commands (one to put a
7414 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7415 <option>-M</option>).
7416 </para>
7417 <para>
7418 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7419 prefix string with which any file named in a <option>-C</option> command line option must
7420 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7421 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7422 name can be used with <option>-C</option>.
7423 </para>
7424 <para>
7425 One-off changes to a configuration can be specified by the <option>-D</option> command line
7426 option, which defines and overrides values for macros used inside the
7427 configuration file. However, like <option>-C</option>, the use of this option by a
7428 non-privileged user causes Exim to discard its root privilege.
7429 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7430 completely disabled, and its use causes an immediate error exit.
7431 </para>
7432 <para>
7433 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7434 to declare certain macro names trusted, such that root privilege will not
7435 necessarily be discarded.
7436 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7437 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7438 values are acceptable, then Exim will not give up root privilege if the caller
7439 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7440 transition mechanism and is expected to be removed in the future.  Acceptable
7441 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7442 </para>
7443 <para>
7444 Some sites may wish to use the same Exim binary on different machines that
7445 share a file system, but to use different configuration files on each machine.
7446 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7447 looks for a file whose name is the configuration file name followed by a dot
7448 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7449 file does not exist, the standard name is tried. This processing occurs for
7450 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7451 </para>
7452 <para>
7453 In some esoteric situations different versions of Exim may be run under
7454 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7455 help with this. See the comments in <filename>src/EDITME</filename> for details.
7456 </para>
7457 </section>
7458 <section id="SECTconffilfor">
7459 <title>Configuration file format</title>
7460 <para>
7461 <indexterm role="concept">
7462 <primary>configuration file</primary>
7463 <secondary>format of</secondary>
7464 </indexterm>
7465 <indexterm role="concept">
7466 <primary>format</primary>
7467 <secondary>configuration file</secondary>
7468 </indexterm>
7469 Exim&#x2019;s configuration file is divided into a number of different parts. General
7470 option settings must always appear at the start of the file. The other parts
7471 are all optional, and may appear in any order. Each part other than the first
7472 is introduced by the word <quote>begin</quote> followed by at least one literal
7473 space, and the name of the part. The optional parts are:
7474 </para>
7475 <itemizedlist>
7476 <listitem>
7477 <para>
7478 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7479 <xref linkend="CHAPACL"/>).
7480 </para>
7481 </listitem>
7482 <listitem>
7483 <para>
7484 <indexterm role="concept">
7485 <primary>AUTH</primary>
7486 <secondary>configuration</secondary>
7487 </indexterm>
7488 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7489 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7490 </para>
7491 </listitem>
7492 <listitem>
7493 <para>
7494 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7495 addresses and determine how the message is to be delivered (see chapters
7496 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7497 </para>
7498 </listitem>
7499 <listitem>
7500 <para>
7501 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7502 define mechanisms for copying messages to destinations (see chapters
7503 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7504 </para>
7505 </listitem>
7506 <listitem>
7507 <para>
7508 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7509 If there is no retry section, or if it is empty (that is, no retry rules are
7510 defined), Exim will not retry deliveries. In this situation, temporary errors
7511 are treated the same as permanent errors. Retry rules are discussed in chapter
7512 <xref linkend="CHAPretry"/>.
7513 </para>
7514 </listitem>
7515 <listitem>
7516 <para>
7517 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7518 when new addresses are generated during delivery. Rewriting is discussed in
7519 chapter <xref linkend="CHAPrewrite"/>.
7520 </para>
7521 </listitem>
7522 <listitem>
7523 <para>
7524 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7525 want to use this feature, you must set
7526 </para>
7527 <literallayout class="monospaced">
7528 LOCAL_SCAN_HAS_OPTIONS=yes
7529 </literallayout>
7530 <para>
7531 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7532 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7533 </para>
7534 </listitem>
7535 </itemizedlist>
7536 <para>
7537 <indexterm role="concept">
7538 <primary>configuration file</primary>
7539 <secondary>leading white space in</secondary>
7540 </indexterm>
7541 <indexterm role="concept">
7542 <primary>configuration file</primary>
7543 <secondary>trailing white space in</secondary>
7544 </indexterm>
7545 <indexterm role="concept">
7546 <primary>white space</primary>
7547 <secondary>in configuration file</secondary>
7548 </indexterm>
7549 Leading and trailing white space in configuration lines is always ignored.
7550 </para>
7551 <para>
7552 Blank lines in the file, and lines starting with a # character (ignoring
7553 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7554 # character other than at the beginning of a line is not treated specially,
7555 and does not introduce a comment.
7556 </para>
7557 <para>
7558 Any non-comment line can be continued by ending it with a backslash. Note that
7559 the general rule for white space means that trailing white space after the
7560 backslash and leading white space at the start of continuation
7561 lines is ignored. Comment lines beginning with # (but not empty lines) may
7562 appear in the middle of a sequence of continuation lines.
7563 </para>
7564 <para>
7565 A convenient way to create a configuration file is to start from the
7566 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7567 change settings as required.
7568 </para>
7569 <para>
7570 The ACLs, retry rules, and rewriting rules have their own syntax which is
7571 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7572 respectively. The other parts of the configuration file have some syntactic
7573 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7574 onwards. Before that, the inclusion, macro, and conditional facilities are
7575 described.
7576 </para>
7577 </section>
7578 <section id="SECID41">
7579 <title>File inclusions in the configuration file</title>
7580 <para>
7581 <indexterm role="concept">
7582 <primary>inclusions in configuration file</primary>
7583 </indexterm>
7584 <indexterm role="concept">
7585 <primary>configuration file</primary>
7586 <secondary>including other files</secondary>
7587 </indexterm>
7588 <indexterm role="concept">
7589 <primary><literal>.include</literal> in configuration file</primary>
7590 </indexterm>
7591 <indexterm role="concept">
7592 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7593 </indexterm>
7594 You can include other files inside Exim&#x2019;s run time configuration file by
7595 using this syntax:
7596 </para>
7597 <literallayout>
7598 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7599 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7600 </literallayout>
7601 <para>
7602 on a line by itself. Double quotes round the file name are optional. If you use
7603 the first form, a configuration error occurs if the file does not exist; the
7604 second form does nothing for non-existent files.
7605 </para>
7606 <para revisionflag="changed">
7607 The first form allows a relative name. It is resolved relative to
7608 the directory of the including file. For the second form an absolute file
7609 name is required.
7610 </para>
7611 <para>
7612 Includes may be nested to any depth, but remember that Exim reads its
7613 configuration file often, so it is a good idea to keep them to a minimum.
7614 If you change the contents of an included file, you must HUP the daemon,
7615 because an included file is read only when the configuration itself is read.
7616 </para>
7617 <para>
7618 The processing of inclusions happens early, at a physical line level, so, like
7619 comment lines, an inclusion can be used in the middle of an option setting,
7620 for example:
7621 </para>
7622 <literallayout class="monospaced">
7623 hosts_lookup = a.b.c \
7624                .include /some/file
7625 </literallayout>
7626 <para>
7627 Include processing happens after macro processing (see below). Its effect is to
7628 process the lines of the included file as if they occurred inline where the
7629 inclusion appears.
7630 </para>
7631 </section>
7632 <section id="SECTmacrodefs">
7633 <title>Macros in the configuration file</title>
7634 <para>
7635 <indexterm role="concept">
7636 <primary>macro</primary>
7637 <secondary>description of</secondary>
7638 </indexterm>
7639 <indexterm role="concept">
7640 <primary>configuration file</primary>
7641 <secondary>macros</secondary>
7642 </indexterm>
7643 If a line in the main part of the configuration (that is, before the first
7644 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7645 definition, and must be of the form
7646 </para>
7647 <literallayout>
7648 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7649 </literallayout>
7650 <para>
7651 The name must consist of letters, digits, and underscores, and need not all be
7652 in upper case, though that is recommended. The rest of the line, including any
7653 continuations, is the replacement text, and has leading and trailing white
7654 space removed. Quotes are not removed. The replacement text can never end with
7655 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7656 </para>
7657 <para>
7658 Macros may also be defined between router, transport, authenticator, or ACL
7659 definitions. They may not, however, be defined within an individual driver or
7660 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7661 </para>
7662 </section>
7663 <section id="SECID42">
7664 <title>Macro substitution</title>
7665 <para>
7666 Once a macro is defined, all subsequent lines in the file (and any included
7667 files) are scanned for the macro name; if there are several macros, the line is
7668 scanned for each in turn, in the order in which the macros are defined. The
7669 replacement text is not re-scanned for the current macro, though it is scanned
7670 for subsequently defined macros. For this reason, a macro name may not contain
7671 the name of a previously defined macro as a substring. You could, for example,
7672 define
7673 </para>
7674 <literallayout>
7675 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7676 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7677 </literallayout>
7678 <para>
7679 but putting the definitions in the opposite order would provoke a configuration
7680 error. Macro expansion is applied to individual physical lines from the file,
7681 before checking for line continuation or file inclusion (see above). If a line
7682 consists solely of a macro name, and the expansion of the macro is empty, the
7683 line is ignored. A macro at the start of a line may turn the line into a
7684 comment line or a <literal>.include</literal> line.
7685 </para>
7686 </section>
7687 <section id="SECID43">
7688 <title>Redefining macros</title>
7689 <para>
7690 Once defined, the value of a macro can be redefined later in the configuration
7691 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7692 <emphasis>=</emphasis>. For example:
7693 </para>
7694 <literallayout class="monospaced">
7695 MAC =  initial value
7696 ...
7697 MAC == updated value
7698 </literallayout>
7699 <para>
7700 Redefinition does not alter the order in which the macros are applied to the
7701 subsequent lines of the configuration file. It is still the same order in which
7702 the macros were originally defined. All that changes is the macro&#x2019;s value.
7703 Redefinition makes it possible to accumulate values. For example:
7704 </para>
7705 <literallayout class="monospaced">
7706 MAC =  initial value
7707 ...
7708 MAC == MAC and something added
7709 </literallayout>
7710 <para>
7711 This can be helpful in situations where the configuration file is built
7712 from a number of other files.
7713 </para>
7714 </section>
7715 <section id="SECID44">
7716 <title>Overriding macro values</title>
7717 <para>
7718 The values set for macros in the configuration file can be overridden by the
7719 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7720 used, unless called by root or the Exim user. A definition on the command line
7721 using the <option>-D</option> option causes all definitions and redefinitions within the
7722 file to be ignored.
7723 </para>
7724 </section>
7725 <section id="SECID45">
7726 <title>Example of macro usage</title>
7727 <para>
7728 As an example of macro usage, consider a configuration where aliases are looked
7729 up in a MySQL database. It helps to keep the file less cluttered if long
7730 strings such as SQL statements are defined separately as macros, for example:
7731 </para>
7732 <literallayout class="monospaced">
7733 ALIAS_QUERY = select mailbox from user where \
7734               login='${quote_mysql:$local_part}';
7735 </literallayout>
7736 <para>
7737 This can then be used in a <command>redirect</command> router setting like this:
7738 </para>
7739 <literallayout class="monospaced">
7740 data = ${lookup mysql{ALIAS_QUERY}}
7741 </literallayout>
7742 <para>
7743 In earlier versions of Exim macros were sometimes used for domain, host, or
7744 address lists. In Exim 4 these are handled better by named lists &ndash; see
7745 section <xref linkend="SECTnamedlists"/>.
7746 </para>
7747 </section>
7748 <section id="SECTbuiltinmacros">
7749 <title>Builtin macros</title>
7750 <para>
7751 Exim defines some macros depending on facilities available, which may
7752 differ due to build-time definitions and from one release to another.
7753 All of these macros start with an underscore.
7754 They can be used to conditionally include parts of a configuration
7755 (see below).
7756 </para>
7757 <para>
7758 The following classes of macros are defined:
7759 </para>
7760 <literallayout>
7761 <literal> _HAVE_*                    </literal>  build-time defines
7762 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7763 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7764 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7765 <literal> _OPT_MAIN_*                </literal>  main config options
7766 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7767 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7768 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7769 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7770 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7771 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7772 </literallayout>
7773 <para>
7774 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7775 </para>
7776 </section>
7777 <section id="SECID46">
7778 <title>Conditional skips in the configuration file</title>
7779 <para>
7780 <indexterm role="concept">
7781 <primary>configuration file</primary>
7782 <secondary>conditional skips</secondary>
7783 </indexterm>
7784 <indexterm role="concept">
7785 <primary><literal>.ifdef</literal></primary>
7786 </indexterm>
7787 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7788 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7789 portions of the configuration file. The processing happens whenever the file is
7790 read (that is, when an Exim binary starts to run).
7791 </para>
7792 <para>
7793 The implementation is very simple. Instances of the first four directives must
7794 be followed by text that includes the names of one or macros. The condition
7795 that is tested is whether or not any macro substitution has taken place in the
7796 line. Thus:
7797 </para>
7798 <literallayout class="monospaced">
7799 .ifdef AAA
7800 message_size_limit = 50M
7801 .else
7802 message_size_limit = 100M
7803 .endif
7804 </literallayout>
7805 <para>
7806 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7807 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7808 otherwise. If there is more than one macro named on the line, the condition
7809 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7810 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7811 </para>
7812 <para>
7813 Although you can use a macro expansion to generate one of these directives,
7814 it is not very useful, because the condition <quote>there was a macro substitution
7815 in this line</quote> will always be true.
7816 </para>
7817 <para>
7818 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7819 to clarify complicated nestings.
7820 </para>
7821 </section>
7822 <section id="SECTcos">
7823 <title>Common option syntax</title>
7824 <para>
7825 <indexterm role="concept">
7826 <primary>common option syntax</primary>
7827 </indexterm>
7828 <indexterm role="concept">
7829 <primary>syntax of common options</primary>
7830 </indexterm>
7831 <indexterm role="concept">
7832 <primary>configuration file</primary>
7833 <secondary>common option syntax</secondary>
7834 </indexterm>
7835 For the main set of options, driver options, and <function>local_scan()</function> options,
7836 each setting is on a line by itself, and starts with a name consisting of
7837 lower-case letters and underscores. Many options require a data value, and in
7838 these cases the name must be followed by an equals sign (with optional white
7839 space) and then the value. For example:
7840 </para>
7841 <literallayout class="monospaced">
7842 qualify_domain = mydomain.example.com
7843 </literallayout>
7844 <para>
7845 <indexterm role="concept">
7846 <primary>hiding configuration option values</primary>
7847 </indexterm>
7848 <indexterm role="concept">
7849 <primary>configuration options</primary>
7850 <secondary>hiding value of</secondary>
7851 </indexterm>
7852 <indexterm role="concept">
7853 <primary>options</primary>
7854 <secondary>hiding value of</secondary>
7855 </indexterm>
7856 Some option settings may contain sensitive data, for example, passwords for
7857 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7858 line option to read these values, you can precede the option settings with the
7859 word <quote>hide</quote>. For example:
7860 </para>
7861 <literallayout class="monospaced">
7862 hide mysql_servers = localhost/users/admin/secret-password
7863 </literallayout>
7864 <para>
7865 For non-admin users, such options are displayed like this:
7866 </para>
7867 <literallayout class="monospaced">
7868 mysql_servers = &lt;value not displayable&gt;
7869 </literallayout>
7870 <para>
7871 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7872 all instances of the same driver.
7873 </para>
7874 <para>
7875 The following sections describe the syntax used for the different data types
7876 that are found in option settings.
7877 </para>
7878 </section>
7879 <section id="SECID47">
7880 <title>Boolean options</title>
7881 <para>
7882 <indexterm role="concept">
7883 <primary>format</primary>
7884 <secondary>boolean</secondary>
7885 </indexterm>
7886 <indexterm role="concept">
7887 <primary>boolean configuration values</primary>
7888 </indexterm>
7889 <indexterm role="option">
7890 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7891 </indexterm>
7892 <indexterm role="option">
7893 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7894 </indexterm>
7895 Options whose type is given as boolean are on/off switches. There are two
7896 different ways of specifying such options: with and without a data value. If
7897 the option name is specified on its own without data, the switch is turned on;
7898 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7899 boolean options may be followed by an equals sign and one of the words
7900 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7901 the following two settings have exactly the same effect:
7902 </para>
7903 <literallayout class="monospaced">
7904 queue_only
7905 queue_only = true
7906 </literallayout>
7907 <para>
7908 The following two lines also have the same (opposite) effect:
7909 </para>
7910 <literallayout class="monospaced">
7911 no_queue_only
7912 queue_only = false
7913 </literallayout>
7914 <para>
7915 You can use whichever syntax you prefer.
7916 </para>
7917 </section>
7918 <section id="SECID48">
7919 <title>Integer values</title>
7920 <para>
7921 <indexterm role="concept">
7922 <primary>integer configuration values</primary>
7923 </indexterm>
7924 <indexterm role="concept">
7925 <primary>format</primary>
7926 <secondary>integer</secondary>
7927 </indexterm>
7928 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7929 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7930 number is assumed. Otherwise, it is treated as an octal number unless it starts
7931 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7932 hexadecimal number.
7933 </para>
7934 <para>
7935 If an integer value is followed by the letter K, it is multiplied by 1024; if
7936 it is followed by the letter M, it is multiplied by 1024x1024;
7937 if by the letter G, 1024x1024x1024.
7938 When the values
7939 of integer option settings are output, values which are an exact multiple of
7940 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7941 and M. The printing style is independent of the actual input format that was
7942 used.
7943 </para>
7944 </section>
7945 <section id="SECID49">
7946 <title>Octal integer values</title>
7947 <para>
7948 <indexterm role="concept">
7949 <primary>integer format</primary>
7950 </indexterm>
7951 <indexterm role="concept">
7952 <primary>format</primary>
7953 <secondary>octal integer</secondary>
7954 </indexterm>
7955 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7956 interpreted as an octal number, whether or not it starts with the digit zero.
7957 Such options are always output in octal.
7958 </para>
7959 </section>
7960 <section id="SECID50">
7961 <title>Fixed point numbers</title>
7962 <para>
7963 <indexterm role="concept">
7964 <primary>fixed point configuration values</primary>
7965 </indexterm>
7966 <indexterm role="concept">
7967 <primary>format</primary>
7968 <secondary>fixed point</secondary>
7969 </indexterm>
7970 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7971 integer, optionally followed by a decimal point and up to three further digits.
7972 </para>
7973 </section>
7974 <section id="SECTtimeformat">
7975 <title>Time intervals</title>
7976 <para>
7977 <indexterm role="concept">
7978 <primary>time interval</primary>
7979 <secondary>specifying in configuration</secondary>
7980 </indexterm>
7981 <indexterm role="concept">
7982 <primary>format</primary>
7983 <secondary>time interval</secondary>
7984 </indexterm>
7985 A time interval is specified as a sequence of numbers, each followed by one of
7986 the following letters, with no intervening white space:
7987 </para>
7988 <informaltable frame="none">
7989 <tgroup cols="2" colsep="0" rowsep="0">
7990 <colspec colwidth="30pt" align="left"/>
7991 <colspec colwidth="254pt" align="left"/>
7992 <tbody>
7993 <row>
7994 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7995 <entry>seconds</entry>
7996 </row>
7997 <row>
7998 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7999 <entry>minutes</entry>
8000 </row>
8001 <row>
8002 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8003 <entry>hours</entry>
8004 </row>
8005 <row>
8006 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8007 <entry>days</entry>
8008 </row>
8009 <row>
8010 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8011 <entry>weeks</entry>
8012 </row>
8013 </tbody>
8014 </tgroup>
8015 </informaltable>
8016 <para>
8017 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8018 intervals are output in the same format. Exim does not restrict the values; it
8019 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8020 </para>
8021 </section>
8022 <section id="SECTstrings">
8023 <title>String values</title>
8024 <para>
8025 <indexterm role="concept">
8026 <primary>string</primary>
8027 <secondary>format of configuration values</secondary>
8028 </indexterm>
8029 <indexterm role="concept">
8030 <primary>format</primary>
8031 <secondary>string</secondary>
8032 </indexterm>
8033 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8034 or without double-quotes. If it does not start with a double-quote, the value
8035 consists of the remainder of the line plus any continuation lines, starting at
8036 the first character after any leading white space, with trailing white space
8037 removed, and with no interpretation of the characters in the string. Because
8038 Exim removes comment lines (those beginning with #) at an early stage, they can
8039 appear in the middle of a multi-line string. The following two settings are
8040 therefore equivalent:
8041 </para>
8042 <literallayout class="monospaced">
8043 trusted_users = uucp:mail
8044 trusted_users = uucp:\
8045                 # This comment line is ignored
8046                 mail
8047 </literallayout>
8048 <para>
8049 <indexterm role="concept">
8050 <primary>string</primary>
8051 <secondary>quoted</secondary>
8052 </indexterm>
8053 <indexterm role="concept">
8054 <primary>escape characters in quoted strings</primary>
8055 </indexterm>
8056 If a string does start with a double-quote, it must end with a closing
8057 double-quote, and any backslash characters other than those used for line
8058 continuation are interpreted as escape characters, as follows:
8059 </para>
8060 <informaltable frame="none">
8061 <tgroup cols="2" colsep="0" rowsep="0">
8062 <colspec colwidth="100pt" align="left"/>
8063 <colspec colwidth="254pt" align="left"/>
8064 <tbody>
8065 <row>
8066 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8067 <entry>single backslash</entry>
8068 </row>
8069 <row>
8070 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8071 <entry>newline</entry>
8072 </row>
8073 <row>
8074 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8075 <entry>carriage return</entry>
8076 </row>
8077 <row>
8078 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8079 <entry>tab</entry>
8080 </row>
8081 <row>
8082 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8083 <entry>up to 3 octal digits specify one character</entry>
8084 </row>
8085 <row>
8086 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8087 <entry>up to 2 hexadecimal digits specify one character</entry>
8088 </row>
8089 </tbody>
8090 </tgroup>
8091 </informaltable>
8092 <para>
8093 If a backslash is followed by some other character, including a double-quote
8094 character, that character replaces the pair.
8095 </para>
8096 <para>
8097 Quoting is necessary only if you want to make use of the backslash escapes to
8098 insert special characters, or if you need to specify a value with leading or
8099 trailing spaces. These cases are rare, so quoting is almost never needed in
8100 current versions of Exim. In versions of Exim before 3.14, quoting was required
8101 in order to continue lines, so you may come across older configuration files
8102 and examples that apparently quote unnecessarily.
8103 </para>
8104 </section>
8105 <section id="SECID51">
8106 <title>Expanded strings</title>
8107 <para>
8108 <indexterm role="concept">
8109 <primary>expansion</primary>
8110 <secondary>definition of</secondary>
8111 </indexterm>
8112 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8113 by which means various parts of the string may be changed according to the
8114 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8115 is as just described; in particular, the handling of backslashes in quoted
8116 strings is done as part of the input process, before expansion takes place.
8117 However, backslash is also an escape character for the expander, so any
8118 backslashes that are required for that reason must be doubled if they are
8119 within a quoted configuration string.
8120 </para>
8121 </section>
8122 <section id="SECID52">
8123 <title>User and group names</title>
8124 <para>
8125 <indexterm role="concept">
8126 <primary>user name</primary>
8127 <secondary>format of</secondary>
8128 </indexterm>
8129 <indexterm role="concept">
8130 <primary>format</primary>
8131 <secondary>user name</secondary>
8132 </indexterm>
8133 <indexterm role="concept">
8134 <primary>groups</primary>
8135 <secondary>name format</secondary>
8136 </indexterm>
8137 <indexterm role="concept">
8138 <primary>format</primary>
8139 <secondary>group name</secondary>
8140 </indexterm>
8141 User and group names are specified as strings, using the syntax described
8142 above, but the strings are interpreted specially. A user or group name must
8143 either consist entirely of digits, or be a name that can be looked up using the
8144 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8145 </para>
8146 </section>
8147 <section id="SECTlistconstruct">
8148 <title>List construction</title>
8149 <para>
8150 <indexterm role="concept">
8151 <primary>list</primary>
8152 <secondary>syntax of in configuration</secondary>
8153 </indexterm>
8154 <indexterm role="concept">
8155 <primary>format</primary>
8156 <secondary>list item in configuration</secondary>
8157 </indexterm>
8158 <indexterm role="concept">
8159 <primary>string</primary>
8160 <secondary>list, definition of</secondary>
8161 </indexterm>
8162 The data for some configuration options is a list of items, with colon as the
8163 default separator. Many of these options are shown with type <quote>string list</quote> in
8164 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8165 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8166 are all the same; however, those other than <quote>string list</quote> are subject to
8167 particular kinds of interpretation, as described in chapter
8168 <xref linkend="CHAPdomhosaddlists"/>.
8169 </para>
8170 <para>
8171 In all these cases, the entire list is treated as a single string as far as the
8172 input syntax is concerned. The <option>trusted_users</option> setting in section
8173 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8174 in a list, it must be entered as two colons. Leading and trailing white space
8175 on each item in a list is ignored. This makes it possible to include items that
8176 start with a colon, and in particular, certain forms of IPv6 address. For
8177 example, the list
8178 </para>
8179 <literallayout class="monospaced">
8180 local_interfaces = 127.0.0.1 : ::::1
8181 </literallayout>
8182 <para>
8183 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8184 </para>
8185 <para>
8186 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8187 list items, it is not ignored when parsing the list. The space after the first
8188 colon in the example above is necessary. If it were not there, the list would
8189 be interpreted as the two items 127.0.0.1:: and 1.
8190 </para>
8191 </section>
8192 <section id="SECTlistsepchange">
8193 <title>Changing list separators</title>
8194 <para>
8195 <indexterm role="concept">
8196 <primary>list separator</primary>
8197 <secondary>changing</secondary>
8198 </indexterm>
8199 <indexterm role="concept">
8200 <primary>IPv6</primary>
8201 <secondary>addresses in lists</secondary>
8202 </indexterm>
8203 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8204 introduced to allow the separator character to be changed. If a list begins
8205 with a left angle bracket, followed by any punctuation character, that
8206 character is used instead of colon as the list separator. For example, the list
8207 above can be rewritten to use a semicolon separator like this:
8208 </para>
8209 <literallayout class="monospaced">
8210 local_interfaces = &lt;; 127.0.0.1 ; ::1
8211 </literallayout>
8212 <para>
8213 This facility applies to all lists, with the exception of the list in
8214 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8215 confined to circumstances where they really are needed.
8216 </para>
8217 <para>
8218 <indexterm role="concept">
8219 <primary>list separator</primary>
8220 <secondary>newline as</secondary>
8221 </indexterm>
8222 <indexterm role="concept">
8223 <primary>newline</primary>
8224 <secondary>as list separator</secondary>
8225 </indexterm>
8226 It is also possible to use newline and other control characters (those with
8227 code values less than 32, plus DEL) as separators in lists. Such separators
8228 must be provided literally at the time the list is processed. For options that
8229 are string-expanded, you can write the separator using a normal escape
8230 sequence. This will be processed by the expander before the string is
8231 interpreted as a list. For example, if a newline-separated list of domains is
8232 generated by a lookup, you can process it directly by a line such as this:
8233 </para>
8234 <literallayout class="monospaced">
8235 domains = &lt;\n ${lookup mysql{.....}}
8236 </literallayout>
8237 <para>
8238 This avoids having to change the list separator in such data. You are unlikely
8239 to want to use a control character as a separator in an option that is not
8240 expanded, because the value is literal text. However, it can be done by giving
8241 the value in quotes. For example:
8242 </para>
8243 <literallayout class="monospaced">
8244 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8245 </literallayout>
8246 <para>
8247 Unlike printing character separators, which can be included in list items by
8248 doubling, it is not possible to include a control character as data when it is
8249 set as the separator. Two such characters in succession are interpreted as
8250 enclosing an empty list item.
8251 </para>
8252 </section>
8253 <section id="SECTempitelis">
8254 <title>Empty items in lists</title>
8255 <para>
8256 <indexterm role="concept">
8257 <primary>list</primary>
8258 <secondary>empty item in</secondary>
8259 </indexterm>
8260 An empty item at the end of a list is always ignored. In other words, trailing
8261 separator characters are ignored. Thus, the list in
8262 </para>
8263 <literallayout class="monospaced">
8264 senders = user@domain :
8265 </literallayout>
8266 <para>
8267 contains only a single item. If you want to include an empty string as one item
8268 in a list, it must not be the last item. For example, this list contains three
8269 items, the second of which is empty:
8270 </para>
8271 <literallayout class="monospaced">
8272 senders = user1@domain : : user2@domain
8273 </literallayout>
8274 <para>
8275 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8276 are interpreted as representing a single colon data character (and the list
8277 would then contain just one item). If you want to specify a list that contains
8278 just one, empty item, you can do it as in this example:
8279 </para>
8280 <literallayout class="monospaced">
8281 senders = :
8282 </literallayout>
8283 <para>
8284 In this case, the first item is empty, and the second is discarded because it
8285 is at the end of the list.
8286 </para>
8287 </section>
8288 <section id="SECTfordricon">
8289 <title>Format of driver configurations</title>
8290 <para>
8291 <indexterm role="concept">
8292 <primary>drivers</primary>
8293 <secondary>configuration format</secondary>
8294 </indexterm>
8295 There are separate parts in the configuration for defining routers, transports,
8296 and authenticators. In each part, you are defining a number of driver
8297 instances, each with its own set of options. Each driver instance is defined by
8298 a sequence of lines like this:
8299 </para>
8300 <literallayout>
8301 &lt;<emphasis>instance name</emphasis>&gt;:
8302   &lt;<emphasis>option</emphasis>&gt;
8303   ...
8304   &lt;<emphasis>option</emphasis>&gt;
8305 </literallayout>
8306 <para>
8307 In the following example, the instance name is <command>localuser</command>, and it is
8308 followed by three options settings:
8309 </para>
8310 <literallayout class="monospaced">
8311 localuser:
8312   driver = accept
8313   check_local_user
8314   transport = local_delivery
8315 </literallayout>
8316 <para>
8317 For each driver instance, you specify which Exim code module it uses &ndash; by the
8318 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8319 settings. For example, in the case of transports, if you want a transport to
8320 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8321 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8322 described in detail in its own separate chapter later in this manual.
8323 </para>
8324 <para>
8325 You can have several routers, transports, or authenticators that are based on
8326 the same underlying driver (each must have a different instance name).
8327 </para>
8328 <para>
8329 The order in which routers are defined is important, because addresses are
8330 passed to individual routers one by one, in order. The order in which
8331 transports are defined does not matter at all. The order in which
8332 authenticators are defined is used only when Exim, as a client, is searching
8333 them to find one that matches an authentication mechanism offered by the
8334 server.
8335 </para>
8336 <para>
8337 <indexterm role="concept">
8338 <primary>generic options</primary>
8339 </indexterm>
8340 <indexterm role="concept">
8341 <primary>options</primary>
8342 <secondary>generic &ndash; definition of</secondary>
8343 </indexterm>
8344 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8345 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8346 same type (that is, all routers, all transports or all authenticators). The
8347 <option>driver</option> option is a generic option that must appear in every definition.
8348 <indexterm role="concept">
8349 <primary>private options</primary>
8350 </indexterm>
8351 The private options are special for each driver, and none need appear, because
8352 they all have default values.
8353 </para>
8354 <para>
8355 The options may appear in any order, except that the <option>driver</option> option must
8356 precede any private options, since these depend on the particular driver. For
8357 this reason, it is recommended that <option>driver</option> always be the first option.
8358 </para>
8359 <para>
8360 Driver instance names, which are used for reference in log entries and
8361 elsewhere, can be any sequence of letters, digits, and underscores (starting
8362 with a letter) and must be unique among drivers of the same type. A router and
8363 a transport (for example) can each have the same name, but no two router
8364 instances can have the same name. The name of a driver instance should not be
8365 confused with the name of the underlying driver module. For example, the
8366 configuration lines:
8367 </para>
8368 <literallayout class="monospaced">
8369 remote_smtp:
8370   driver = smtp
8371 </literallayout>
8372 <para>
8373 create an instance of the <command>smtp</command> transport driver whose name is
8374 <command>remote_smtp</command>. The same driver code can be used more than once, with
8375 different instance names and different option settings each time. A second
8376 instance of the <command>smtp</command> transport, with different options, might be defined
8377 thus:
8378 </para>
8379 <literallayout class="monospaced">
8380 special_smtp:
8381   driver = smtp
8382   port = 1234
8383   command_timeout = 10s
8384 </literallayout>
8385 <para>
8386 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8387 these transport instances from routers, and these names would appear in log
8388 lines.
8389 </para>
8390 <para>
8391 Comment lines may be present in the middle of driver specifications. The full
8392 list of option settings for any particular driver instance, including all the
8393 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8394 option.
8395 </para>
8396 </section>
8397 </chapter>
8398
8399 <chapter id="CHAPdefconfil">
8400 <title>The default configuration file</title>
8401 <para>
8402 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8403 <primary>configuration file</primary>
8404 <secondary>default <quote>walk through</quote></secondary>
8405 </indexterm>
8406 <indexterm role="concept">
8407 <primary>default</primary>
8408 <secondary>configuration file <quote>walk through</quote></secondary>
8409 </indexterm>
8410 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8411 is sufficient for a host with simple mail requirements. As an introduction to
8412 the way Exim is configured, this chapter <quote>walks through</quote> the default
8413 configuration, giving brief explanations of the settings. Detailed descriptions
8414 of the options are given in subsequent chapters. The default configuration file
8415 itself contains extensive comments about ways you might want to modify the
8416 initial settings. However, note that there are many options that are not
8417 mentioned at all in the default configuration.
8418 </para>
8419 <section id="SECTdefconfmain">
8420 <title>Main configuration settings</title>
8421 <para>
8422 The main (global) configuration option settings must always come first in the
8423 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8424 the line
8425 </para>
8426 <literallayout class="monospaced">
8427 # primary_hostname =
8428 </literallayout>
8429 <para>
8430 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8431 to know the official, fully qualified name of your host, and this is where you
8432 can specify it. However, in most cases you do not need to set this option. When
8433 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8434 </para>
8435 <para>
8436 The first three non-comment configuration lines are as follows:
8437 </para>
8438 <literallayout class="monospaced">
8439 domainlist local_domains    = @
8440 domainlist relay_to_domains =
8441 hostlist   relay_from_hosts = 127.0.0.1
8442 </literallayout>
8443 <para>
8444 These are not, in fact, option settings. They are definitions of two named
8445 domain lists and one named host list. Exim allows you to give names to lists of
8446 domains, hosts, and email addresses, in order to make it easier to manage the
8447 configuration file (see section <xref linkend="SECTnamedlists"/>).
8448 </para>
8449 <para>
8450 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8451 later in the configuration to identify domains that are to be delivered
8452 on the local host.
8453 </para>
8454 <para>
8455 <indexterm role="concept">
8456 <primary>@ in a domain list</primary>
8457 </indexterm>
8458 There is just one item in this list, the string <quote>@</quote>. This is a special form
8459 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8460 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8461 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8462 the same configuration file can be used on different hosts.
8463 </para>
8464 <para>
8465 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8466 list itself is empty. Later in the configuration we will come to the part that
8467 controls mail relaying through the local host; it allows relaying to any
8468 domains in this list. By default, therefore, no relaying on the basis of a mail
8469 domain is permitted.
8470 </para>
8471 <para>
8472 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8473 used later in the configuration to permit relaying from any host or IP address
8474 that matches the list. The default contains just the IP address of the IPv4
8475 loopback interface, which means that processes on the local host are able to
8476 submit mail for relaying by sending it over TCP/IP to that interface. No other
8477 hosts are permitted to submit messages for relaying.
8478 </para>
8479 <para>
8480 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8481 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8482 and hosts that will be used in the controls that are specified later.
8483 </para>
8484 <para>
8485 The next two configuration lines are genuine option settings:
8486 </para>
8487 <literallayout class="monospaced">
8488 acl_smtp_rcpt = acl_check_rcpt
8489 acl_smtp_data = acl_check_data
8490 </literallayout>
8491 <para>
8492 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8493 during an incoming SMTP session for every recipient of a message (every RCPT
8494 command), and after the contents of the message have been received,
8495 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8496 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8497 section of the configuration. The RCPT ACL controls which recipients are
8498 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8499 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8500 contents of a message to be checked.
8501 </para>
8502 <para>
8503 Two commented-out option settings are next:
8504 </para>
8505 <literallayout class="monospaced">
8506 # av_scanner = clamd:/tmp/clamd
8507 # spamd_address = 127.0.0.1 783
8508 </literallayout>
8509 <para>
8510 These are example settings that can be used when Exim is compiled with the
8511 content-scanning extension. The first specifies the interface to the virus
8512 scanner, and the second specifies the interface to SpamAssassin. Further
8513 details are given in chapter <xref linkend="CHAPexiscan"/>.
8514 </para>
8515 <para>
8516 Three more commented-out option settings follow:
8517 </para>
8518 <literallayout class="monospaced">
8519 # tls_advertise_hosts = *
8520 # tls_certificate = /etc/ssl/exim.crt
8521 # tls_privatekey = /etc/ssl/exim.pem
8522 </literallayout>
8523 <para>
8524 These are example settings that can be used when Exim is compiled with
8525 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8526 first one specifies the list of clients that are allowed to use TLS when
8527 connecting to this server; in this case the wildcard means all clients. The
8528 other options specify where Exim should find its TLS certificate and private
8529 key, which together prove the server&#x2019;s identity to any clients that connect.
8530 More details are given in chapter <xref linkend="CHAPTLS"/>.
8531 </para>
8532 <para>
8533 Another two commented-out option settings follow:
8534 </para>
8535 <literallayout class="monospaced">
8536 # daemon_smtp_ports = 25 : 465 : 587
8537 # tls_on_connect_ports = 465
8538 </literallayout>
8539 <para>
8540 <indexterm role="concept">
8541 <primary>port</primary>
8542 <secondary>465 and 587</secondary>
8543 </indexterm>
8544 <indexterm role="concept">
8545 <primary>port</primary>
8546 <secondary>for message submission</secondary>
8547 </indexterm>
8548 <indexterm role="concept">
8549 <primary>message</primary>
8550 <secondary>submission, ports for</secondary>
8551 </indexterm>
8552 <indexterm role="concept">
8553 <primary>ssmtp protocol</primary>
8554 </indexterm>
8555 <indexterm role="concept">
8556 <primary>smtps protocol</primary>
8557 </indexterm>
8558 <indexterm role="concept">
8559 <primary>SMTP</primary>
8560 <secondary>ssmtp protocol</secondary>
8561 </indexterm>
8562 <indexterm role="concept">
8563 <primary>SMTP</primary>
8564 <secondary>smtps protocol</secondary>
8565 </indexterm>
8566 These options provide better support for roaming users who wish to use this
8567 server for message submission. They are not much use unless you have turned on
8568 TLS (as described in the previous paragraph) and authentication (about which
8569 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8570 on end-user networks, so RFC 4409 specifies that message submission should use
8571 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8572 configured to use port 587 correctly, so these settings also enable the
8573 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8574 <xref linkend="SECTsupobssmt"/>).
8575 </para>
8576 <para>
8577 Two more commented-out options settings follow:
8578 </para>
8579 <literallayout class="monospaced">
8580 # qualify_domain =
8581 # qualify_recipient =
8582 </literallayout>
8583 <para>
8584 The first of these specifies a domain that Exim uses when it constructs a
8585 complete email address from a local login name. This is often needed when Exim
8586 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8587 the value of <option>primary_hostname</option> is used. If you set both of these options,
8588 you can have different qualification domains for sender and recipient
8589 addresses. If you set only the first one, its value is used in both cases.
8590 </para>
8591 <para>
8592 <indexterm role="concept">
8593 <primary>domain literal</primary>
8594 <secondary>recognizing format</secondary>
8595 </indexterm>
8596 The following line must be uncommented if you want Exim to recognize
8597 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8598 (an IP address within square brackets) instead of a named domain.
8599 </para>
8600 <literallayout class="monospaced">
8601 # allow_domain_literals
8602 </literallayout>
8603 <para>
8604 The RFCs still require this form, but many people think that in the modern
8605 Internet it makes little sense to permit mail to be sent to specific hosts by
8606 quoting their IP addresses. This ancient format has been used by people who
8607 try to abuse hosts by using them for unwanted relaying. However, some
8608 people believe there are circumstances (for example, messages addressed to
8609 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8610 </para>
8611 <para>
8612 The next configuration line is a kind of trigger guard:
8613 </para>
8614 <literallayout class="monospaced">
8615 never_users = root
8616 </literallayout>
8617 <para>
8618 It specifies that no delivery must ever be run as the root user. The normal
8619 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8620 setting is a guard against slips in the configuration.
8621 The list of users specified by <option>never_users</option> is not, however, the complete
8622 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8623 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8624 contents of <option>never_users</option> are added to this list. By default
8625 FIXED_NEVER_USERS also specifies root.
8626 </para>
8627 <para>
8628 When a remote host connects to Exim in order to send mail, the only information
8629 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8630 line,
8631 </para>
8632 <literallayout class="monospaced">
8633 host_lookup = *
8634 </literallayout>
8635 <para>
8636 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8637 in order to get a host name. This improves the quality of the logging
8638 information, but if you feel it is too expensive, you can remove it entirely,
8639 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8640 Note that it is not always possible to find a host name from an IP address,
8641 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8642 unreachable.
8643 </para>
8644 <para>
8645 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8646 1413 (hence their names):
8647 </para>
8648 <literallayout class="monospaced">
8649 rfc1413_hosts = *
8650 rfc1413_query_timeout = 0s
8651 </literallayout>
8652 <para>
8653 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8654 Few hosts offer RFC1413 service these days; calls have to be
8655 terminated by a timeout and this needlessly delays the startup
8656 of an incoming SMTP connection.
8657 If you have hosts for which you trust RFC1413 and need this
8658 information, you can change this.
8659 </para>
8660 <para>
8661 This line enables an efficiency SMTP option.  It is negotiated by clients
8662 and not expected to cause problems but can be disabled if needed.
8663 </para>
8664 <literallayout class="monospaced">
8665 prdr_enable = true
8666 </literallayout>
8667 <para>
8668 When Exim receives messages over SMTP connections, it expects all addresses to
8669 be fully qualified with a domain, as required by the SMTP definition. However,
8670 if you are running a server to which simple clients submit messages, you may
8671 find that they send unqualified addresses. The two commented-out options:
8672 </para>
8673 <literallayout class="monospaced">
8674 # sender_unqualified_hosts =
8675 # recipient_unqualified_hosts =
8676 </literallayout>
8677 <para>
8678 show how you can specify hosts that are permitted to send unqualified sender
8679 and recipient addresses, respectively.
8680 </para>
8681 <para>
8682 The <option>log_selector</option> option is used to increase the detail of logging
8683 over the default:
8684 </para>
8685 <literallayout class="monospaced">
8686 log_selector = +smtp_protocol_error +smtp_syntax_error \
8687                +tls_certificate_verified
8688 </literallayout>
8689 <para>
8690 The <option>percent_hack_domains</option> option is also commented out:
8691 </para>
8692 <literallayout class="monospaced">
8693 # percent_hack_domains =
8694 </literallayout>
8695 <para>
8696 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8697 This is an almost obsolete form of explicit email routing. If you do not know
8698 anything about it, you can safely ignore this topic.
8699 </para>
8700 <para>
8701 The next two settings in the main part of the default configuration are
8702 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8703 message is frozen, Exim no longer continues to try to deliver it. Freezing
8704 occurs when a bounce message encounters a permanent failure because the sender
8705 address of the original message that caused the bounce is invalid, so the
8706 bounce cannot be delivered. This is probably the most common case, but there
8707 are also other conditions that cause freezing, and frozen messages are not
8708 always bounce messages.
8709 </para>
8710 <literallayout class="monospaced">
8711 ignore_bounce_errors_after = 2d
8712 timeout_frozen_after = 7d
8713 </literallayout>
8714 <para>
8715 The first of these options specifies that failing bounce messages are to be
8716 discarded after 2 days on the queue. The second specifies that any frozen
8717 message (whether a bounce message or not) is to be timed out (and discarded)
8718 after a week. In this configuration, the first setting ensures that no failing
8719 bounce message ever lasts a week.
8720 </para>
8721 <para>
8722 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8723 large queues, you may consider using this option. It splits the spool
8724 directory into subdirectories to avoid file system degradation from
8725 many files in a single directory, resulting in better performance.
8726 Manual manipulation of queued messages becomes more complex (though fortunately
8727 not often needed).
8728 </para>
8729 <literallayout class="monospaced">
8730 # split_spool_directory = true
8731 </literallayout>
8732 <para>
8733 In an ideal world everybody follows the standards. For non-ASCII
8734 messages RFC 2047 is a standard, allowing a maximum line length of 76
8735 characters. Exim adheres that standard and won&#x2019;t process messages which
8736 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8737 In particular, the Exim maintainers have had multiple reports of
8738 problems from Russian administrators of issues until they disable this
8739 check, because of some popular, yet buggy, mail composition software.
8740 </para>
8741 <literallayout class="monospaced">
8742 # check_rfc2047_length = false
8743 </literallayout>
8744 <para>
8745 If you need to be strictly RFC compliant you may wish to disable the
8746 8BITMIME advertisement. Use this, if you exchange mails with systems
8747 that are not 8-bit clean.
8748 </para>
8749 <literallayout class="monospaced">
8750 # accept_8bitmime = false
8751 </literallayout>
8752 <para>
8753 Libraries you use may depend on specific environment settings.  This
8754 imposes a security risk (e.g. PATH). There are two lists:
8755 <option>keep_environment</option> for the variables to import as they are, and
8756 <option>add_environment</option> for variables we want to set to a fixed value.
8757 Note that TZ is handled separately, by the $%timezone%$ runtime
8758 option and by the TIMEZONE_DEFAULT buildtime option.
8759 </para>
8760 <literallayout class="monospaced">
8761 # keep_environment = ^LDAP
8762 # add_environment = PATH=/usr/bin::/bin
8763 </literallayout>
8764 </section>
8765 <section id="SECID54">
8766 <title>ACL configuration</title>
8767 <para>
8768 <indexterm role="concept">
8769 <primary>default</primary>
8770 <secondary>ACLs</secondary>
8771 </indexterm>
8772 <indexterm role="concept">
8773 <primary>access control lists (ACLs)</primary>
8774 <secondary>default configuration</secondary>
8775 </indexterm>
8776 In the default configuration, the ACL section follows the main configuration.
8777 It starts with the line
8778 </para>
8779 <literallayout class="monospaced">
8780 begin acl
8781 </literallayout>
8782 <para>
8783 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8784 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8785 and <option>acl_smtp_data</option> above.
8786 </para>
8787 <para>
8788 <indexterm role="concept">
8789 <primary>RCPT</primary>
8790 <secondary>ACL for</secondary>
8791 </indexterm>
8792 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8793 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8794 are considered in order, until the recipient address is either accepted or
8795 rejected. The RCPT command is then accepted or rejected, according to the
8796 result of the ACL processing.
8797 </para>
8798 <literallayout class="monospaced">
8799 acl_check_rcpt:
8800 </literallayout>
8801 <para>
8802 This line, consisting of a name terminated by a colon, marks the start of the
8803 ACL, and names it.
8804 </para>
8805 <literallayout class="monospaced">
8806 accept  hosts = :
8807 </literallayout>
8808 <para>
8809 This ACL statement accepts the recipient if the sending host matches the list.
8810 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8811 names or IP addresses. The presence of the colon puts an empty item in the
8812 list; Exim matches this only if the incoming message did not come from a remote
8813 host, because in that case, the remote hostname is empty. The colon is
8814 important. Without it, the list itself is empty, and can never match anything.
8815 </para>
8816 <para>
8817 What this statement is doing is to accept unconditionally all recipients in
8818 messages that are submitted by SMTP from local processes using the standard
8819 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8820 manner.
8821 </para>
8822 <literallayout class="monospaced">
8823 deny    message       = Restricted characters in address
8824         domains       = +local_domains
8825         local_parts   = ^[.] : ^.*[@%!/|]
8826
8827 deny    message       = Restricted characters in address
8828         domains       = !+local_domains
8829         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8830 </literallayout>
8831 <para>
8832 These statements are concerned with local parts that contain any of the
8833 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8834 Although these characters are entirely legal in local parts (in the case of
8835 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8836 in Internet mail addresses.
8837 </para>
8838 <para>
8839 The first three have in the past been associated with explicitly routed
8840 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8841 option). Addresses containing these characters are regularly tried by spammers
8842 in an attempt to bypass relaying restrictions, and also by open relay testing
8843 programs. Unless you really need them it is safest to reject these characters
8844 at this early stage. This configuration is heavy-handed in rejecting these
8845 characters for all messages it accepts from remote hosts. This is a deliberate
8846 policy of being as safe as possible.
8847 </para>
8848 <para>
8849 The first rule above is stricter, and is applied to messages that are addressed
8850 to one of the local domains handled by this host. This is implemented by the
8851 first condition, which restricts it to domains that are listed in the
8852 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8853 reference to a named list. In this configuration, there is just one domain in
8854 <emphasis>local_domains</emphasis>, but in general there may be many.
8855 </para>
8856 <para>
8857 The second condition on the first statement uses two regular expressions to
8858 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8859 or <quote>|</quote>. If you have local accounts that include these characters, you will
8860 have to modify this rule.
8861 </para>
8862 <para>
8863 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8864 allows them because they have been encountered in practice. (Consider the
8865 common convention of local parts constructed as
8866 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8867 the author of Exim, who has no second initial.) However, a local part starting
8868 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8869 file name (for example, for a mailing list). This is also true for local parts
8870 that contain slashes. A pipe symbol can also be troublesome if the local part
8871 is incorporated unthinkingly into a shell command line.
8872 </para>
8873 <para>
8874 The second rule above applies to all other domains, and is less strict. This
8875 allows your own users to send outgoing messages to sites that use slashes
8876 and vertical bars in their local parts. It blocks local parts that begin
8877 with a dot, slash, or vertical bar, but allows these characters within the
8878 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8879 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8880 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8881 </para>
8882 <literallayout class="monospaced">
8883 accept  local_parts   = postmaster
8884         domains       = +local_domains
8885 </literallayout>
8886 <para>
8887 This statement, which has two conditions, accepts an incoming address if the
8888 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8889 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8890 reference to a named list. In this configuration, there is just one domain in
8891 <emphasis>local_domains</emphasis>, but in general there may be many.
8892 </para>
8893 <para>
8894 The presence of this statement means that mail to postmaster is never blocked
8895 by any of the subsequent tests. This can be helpful while sorting out problems
8896 in cases where the subsequent tests are incorrectly denying access.
8897 </para>
8898 <literallayout class="monospaced">
8899 require verify        = sender
8900 </literallayout>
8901 <para>
8902 This statement requires the sender address to be verified before any subsequent
8903 ACL statement can be used. If verification fails, the incoming recipient
8904 address is refused. Verification consists of trying to route the address, to
8905 see if a bounce message could be delivered to it. In the case of remote
8906 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8907 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8908 discusses the details of address verification.
8909 </para>
8910 <literallayout class="monospaced">
8911 accept  hosts         = +relay_from_hosts
8912         control       = submission
8913 </literallayout>
8914 <para>
8915 This statement accepts the address if the message is coming from one of the
8916 hosts that are defined as being allowed to relay through this host. Recipient
8917 verification is omitted here, because in many cases the clients are dumb MUAs
8918 that do not cope well with SMTP error responses. For the same reason, the
8919 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8920 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8921 messages that are deficient in some way, for example, because they lack a
8922 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8923 probably add recipient verification here, and disable submission mode.
8924 </para>
8925 <literallayout class="monospaced">
8926 accept  authenticated = *
8927         control       = submission
8928 </literallayout>
8929 <para>
8930 This statement accepts the address if the client host has authenticated itself.
8931 Submission mode is again specified, on the grounds that such messages are most
8932 likely to come from MUAs. The default configuration does not define any
8933 authenticators, though it does include some nearly complete commented-out
8934 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8935 fact authenticate until you complete the authenticator definitions.
8936 </para>
8937 <literallayout class="monospaced">
8938 require message = relay not permitted
8939         domains = +local_domains : +relay_to_domains
8940 </literallayout>
8941 <para>
8942 This statement rejects the address if its domain is neither a local domain nor
8943 one of the domains for which this host is a relay.
8944 </para>
8945 <literallayout class="monospaced">
8946 require verify = recipient
8947 </literallayout>
8948 <para>
8949 This statement requires the recipient address to be verified; if verification
8950 fails, the address is rejected.
8951 </para>
8952 <literallayout class="monospaced">
8953 # deny    message     = rejected because $sender_host_address \
8954 #                       is in a black list at $dnslist_domain\n\
8955 #                       $dnslist_text
8956 #         dnslists    = black.list.example
8957 #
8958 # warn    dnslists    = black.list.example
8959 #         add_header  = X-Warning: $sender_host_address is in \
8960 #                       a black list at $dnslist_domain
8961 #         log_message = found in $dnslist_domain
8962 </literallayout>
8963 <para>
8964 These commented-out lines are examples of how you could configure Exim to check
8965 sending hosts against a DNS black list. The first statement rejects messages
8966 from blacklisted hosts, whereas the second just inserts a warning header
8967 line.
8968 </para>
8969 <literallayout class="monospaced">
8970 # require verify = csa
8971 </literallayout>
8972 <para>
8973 This commented-out line is an example of how you could turn on client SMTP
8974 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8975 records.
8976 </para>
8977 <literallayout class="monospaced">
8978 accept
8979 </literallayout>
8980 <para>
8981 The final statement in the first ACL unconditionally accepts any recipient
8982 address that has successfully passed all the previous tests.
8983 </para>
8984 <literallayout class="monospaced">
8985 acl_check_data:
8986 </literallayout>
8987 <para>
8988 This line marks the start of the second ACL, and names it. Most of the contents
8989 of this ACL are commented out:
8990 </para>
8991 <literallayout class="monospaced">
8992 # deny    malware   = *
8993 #         message   = This message contains a virus \
8994 #                     ($malware_name).
8995 </literallayout>
8996 <para>
8997 These lines are examples of how to arrange for messages to be scanned for
8998 viruses when Exim has been compiled with the content-scanning extension, and a
8999 suitable virus scanner is installed. If the message is found to contain a
9000 virus, it is rejected with the given custom error message.
9001 </para>
9002 <literallayout class="monospaced">
9003 # warn    spam      = nobody
9004 #         message   = X-Spam_score: $spam_score\n\
9005 #                     X-Spam_score_int: $spam_score_int\n\
9006 #                     X-Spam_bar: $spam_bar\n\
9007 #                     X-Spam_report: $spam_report
9008 </literallayout>
9009 <para>
9010 These lines are an example of how to arrange for messages to be scanned by
9011 SpamAssassin when Exim has been compiled with the content-scanning extension,
9012 and SpamAssassin has been installed. The SpamAssassin check is run with
9013 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9014 series of extra header line. In this case, the message is not rejected,
9015 whatever the spam score.
9016 </para>
9017 <literallayout class="monospaced">
9018 accept
9019 </literallayout>
9020 <para>
9021 This final line in the DATA ACL accepts the message unconditionally.
9022 </para>
9023 </section>
9024 <section id="SECID55">
9025 <title>Router configuration</title>
9026 <para>
9027 <indexterm role="concept">
9028 <primary>default</primary>
9029 <secondary>routers</secondary>
9030 </indexterm>
9031 <indexterm role="concept">
9032 <primary>routers</primary>
9033 <secondary>default</secondary>
9034 </indexterm>
9035 The router configuration comes next in the default configuration, introduced
9036 by the line
9037 </para>
9038 <literallayout class="monospaced">
9039 begin routers
9040 </literallayout>
9041 <para>
9042 Routers are the modules in Exim that make decisions about where to send
9043 messages. An address is passed to each router in turn, until it is either
9044 accepted, or failed. This means that the order in which you define the routers
9045 matters. Each router is fully described in its own chapter later in this
9046 manual. Here we give only brief overviews.
9047 </para>
9048 <literallayout class="monospaced">
9049 # domain_literal:
9050 #   driver = ipliteral
9051 #   domains = !+local_domains
9052 #   transport = remote_smtp
9053 </literallayout>
9054 <para>
9055 <indexterm role="concept">
9056 <primary>domain literal</primary>
9057 <secondary>default router</secondary>
9058 </indexterm>
9059 This router is commented out because the majority of sites do not want to
9060 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9061 you uncomment this router, you also need to uncomment the setting of
9062 <option>allow_domain_literals</option> in the main part of the configuration.
9063 </para>
9064 <literallayout class="monospaced">
9065 dnslookup:
9066   driver = dnslookup
9067   domains = ! +local_domains
9068   transport = remote_smtp
9069   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9070   no_more
9071 </literallayout>
9072 <para>
9073 The first uncommented router handles addresses that do not involve any local
9074 domains. This is specified by the line
9075 </para>
9076 <literallayout class="monospaced">
9077 domains = ! +local_domains
9078 </literallayout>
9079 <para>
9080 The <option>domains</option> option lists the domains to which this router applies, but the
9081 exclamation mark is a negation sign, so the router is used only for domains
9082 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9083 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9084 indicates that it is referring to a named list. Addresses in other domains are
9085 passed on to the following routers.
9086 </para>
9087 <para>
9088 The name of the router driver is <command>dnslookup</command>,
9089 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9090 the name of this router instance is the same as the name of the driver. The
9091 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9092 one of the driver modules that is in the Exim binary.
9093 </para>
9094 <para>
9095 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9096 DNS in order to obtain a list of hosts to which the address is routed. If the
9097 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9098 specified by the <option>transport</option> option. If the router does not find the domain
9099 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9100 the address fails and is bounced.
9101 </para>
9102 <para>
9103 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9104 be entirely ignored. This option is present because a number of cases have been
9105 encountered where MX records in the DNS point to host names
9106 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9107 Completely ignoring these IP addresses causes Exim to fail to route the
9108 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9109 continue to try to deliver the message periodically until the address timed
9110 out.
9111 </para>
9112 <literallayout class="monospaced">
9113 system_aliases:
9114   driver = redirect
9115   allow_fail
9116   allow_defer
9117   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9118 # user = exim
9119   file_transport = address_file
9120   pipe_transport = address_pipe
9121 </literallayout>
9122 <para>
9123 Control reaches this and subsequent routers only for addresses in the local
9124 domains. This router checks to see whether the local part is defined as an
9125 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9126 data that it looks up from that file. If no data is found for the local part,
9127 the value of the <option>data</option> option is empty, causing the address to be passed to
9128 the next router.
9129 </para>
9130 <para>
9131 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9132 often used. That is why it is referenced by from the default configuration
9133 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9134 <filename>Local/Makefile</filename> before building Exim.
9135 </para>
9136 <literallayout class="monospaced">
9137 userforward:
9138   driver = redirect
9139   check_local_user
9140 # local_part_suffix = +* : -*
9141 # local_part_suffix_optional
9142   file = $home/.forward
9143 # allow_filter
9144   no_verify
9145   no_expn
9146   check_ancestor
9147   file_transport = address_file
9148   pipe_transport = address_pipe
9149   reply_transport = address_reply
9150 </literallayout>
9151 <para>
9152 This is the most complicated router in the default configuration. It is another
9153 redirection router, but this time it is looking for forwarding data set up by
9154 individual users. The <option>check_local_user</option> setting specifies a check that the
9155 local part of the address is the login name of a local user. If it is not, the
9156 router is skipped. The two commented options that follow <option>check_local_user</option>,
9157 namely:
9158 </para>
9159 <literallayout class="monospaced">
9160 # local_part_suffix = +* : -*
9161 # local_part_suffix_optional
9162 </literallayout>
9163 <para>
9164 <indexterm role="variable">
9165 <primary><varname>$local_part_suffix</varname></primary>
9166 </indexterm>
9167 show how you can specify the recognition of local part suffixes. If the first
9168 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9169 by any sequence of characters, is removed from the local part and placed in the
9170 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9171 presence of a suffix in the local part is optional. When a suffix is present,
9172 the check for a local login uses the local part with the suffix removed.
9173 </para>
9174 <para>
9175 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9176 home directory is consulted. If it does not exist, or is empty, the router
9177 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9178 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9179 </para>
9180 <para>
9181 <indexterm role="concept">
9182 <primary>Sieve filter</primary>
9183 <secondary>enabling in default router</secondary>
9184 </indexterm>
9185 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9186 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9187 is commented out by default), the contents of the file are interpreted as a set
9188 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9189 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9190 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9191 </para>
9192 <para>
9193 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9194 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9195 There are two reasons for doing this:
9196 </para>
9197 <orderedlist numeration="arabic">
9198 <listitem>
9199 <para>
9200 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9201 checking an address for validity; it makes sense not to waste resources doing
9202 unnecessary work.
9203 </para>
9204 </listitem>
9205 <listitem>
9206 <para>
9207 More importantly, when Exim is verifying addresses or handling an EXPN
9208 command during an SMTP session, it is running as the Exim user, not as root.
9209 The group is the Exim group, and no additional groups are set up.
9210 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9211 this time.
9212 </para>
9213 </listitem>
9214 </orderedlist>
9215 <para>
9216 The setting of <option>check_ancestor</option> prevents the router from generating a new
9217 address that is the same as any previous address that was redirected. (This
9218 works round a problem concerning a bad interaction between aliasing and
9219 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9220 </para>
9221 <para>
9222 The final three option settings specify the transports that are to be used when
9223 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9224 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9225 </para>
9226 <literallayout class="monospaced">
9227 a.nother@elsewhere.example, /home/spqr/archive
9228 </literallayout>
9229 <para>
9230 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9231 transport.
9232 </para>
9233 <literallayout class="monospaced">
9234 localuser:
9235   driver = accept
9236   check_local_user
9237 # local_part_suffix = +* : -*
9238 # local_part_suffix_optional
9239   transport = local_delivery
9240 </literallayout>
9241 <para>
9242 The final router sets up delivery into local mailboxes, provided that the local
9243 part is the name of a local login, by accepting the address and assigning it to
9244 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9245 routers, so the address is bounced. The commented suffix settings fulfil the
9246 same purpose as they do for the <command>userforward</command> router.
9247 </para>
9248 </section>
9249 <section id="SECID56">
9250 <title>Transport configuration</title>
9251 <para>
9252 <indexterm role="concept">
9253 <primary>default</primary>
9254 <secondary>transports</secondary>
9255 </indexterm>
9256 <indexterm role="concept">
9257 <primary>transports</primary>
9258 <secondary>default</secondary>
9259 </indexterm>
9260 Transports define mechanisms for actually delivering messages. They operate
9261 only when referenced from routers, so the order in which they are defined does
9262 not matter. The transports section of the configuration starts with
9263 </para>
9264 <literallayout class="monospaced">
9265 begin transports
9266 </literallayout>
9267 <para>
9268 One remote transport and four local transports are defined.
9269 </para>
9270 <literallayout class="monospaced">
9271 remote_smtp:
9272   driver = smtp
9273   hosts_try_prdr = *
9274 </literallayout>
9275 <para>
9276 This transport is used for delivering messages over SMTP connections.
9277 The list of remote hosts comes from the router.
9278 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9279 It is negotiated between client and server
9280 and not expected to cause problems but can be disabled if needed.
9281 All other options are defaulted.
9282 </para>
9283 <literallayout class="monospaced">
9284 local_delivery:
9285   driver = appendfile
9286   file = /var/mail/$local_part
9287   delivery_date_add
9288   envelope_to_add
9289   return_path_add
9290 # group = mail
9291 # mode = 0660
9292 </literallayout>
9293 <para>
9294 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9295 traditional BSD mailbox format. By default it runs under the uid and gid of the
9296 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9297 directory. Some systems use the alternative approach of running mail deliveries
9298 under a particular group instead of using the sticky bit. The commented options
9299 show how this can be done.
9300 </para>
9301 <para>
9302 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9303 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9304 similarly-named options above.
9305 </para>
9306 <literallayout class="monospaced">
9307 address_pipe:
9308   driver = pipe
9309   return_output
9310 </literallayout>
9311 <para>
9312 This transport is used for handling deliveries to pipes that are generated by
9313 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9314 option specifies that any output on stdout or stderr generated by the pipe is to
9315 be returned to the sender.
9316 </para>
9317 <literallayout class="monospaced">
9318 address_file:
9319   driver = appendfile
9320   delivery_date_add
9321   envelope_to_add
9322   return_path_add
9323 </literallayout>
9324 <para>
9325 This transport is used for handling deliveries to files that are generated by
9326 redirection. The name of the file is not specified in this instance of
9327 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9328 </para>
9329 <literallayout class="monospaced">
9330 address_reply:
9331   driver = autoreply
9332 </literallayout>
9333 <para>
9334 This transport is used for handling automatic replies generated by users&#x2019;
9335 filter files.
9336 </para>
9337 </section>
9338 <section id="SECID57">
9339 <title>Default retry rule</title>
9340 <para>
9341 <indexterm role="concept">
9342 <primary>retry</primary>
9343 <secondary>default rule</secondary>
9344 </indexterm>
9345 <indexterm role="concept">
9346 <primary>default</primary>
9347 <secondary>retry rule</secondary>
9348 </indexterm>
9349 The retry section of the configuration file contains rules which affect the way
9350 Exim retries deliveries that cannot be completed at the first attempt. It is
9351 introduced by the line
9352 </para>
9353 <literallayout class="monospaced">
9354 begin retry
9355 </literallayout>
9356 <para>
9357 In the default configuration, there is just one rule, which applies to all
9358 errors:
9359 </para>
9360 <literallayout class="monospaced">
9361 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9362 </literallayout>
9363 <para>
9364 This causes any temporarily failing address to be retried every 15 minutes for
9365 2 hours, then at intervals starting at one hour and increasing by a factor of
9366 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9367 is not delivered after 4 days of temporary failure, it is bounced. The time is
9368 measured from first failure, not from the time the message was received.
9369 </para>
9370 <para>
9371 If the retry section is removed from the configuration, or is empty (that is,
9372 if no retry rules are defined), Exim will not retry deliveries. This turns
9373 temporary errors into permanent errors.
9374 </para>
9375 </section>
9376 <section id="SECID58">
9377 <title>Rewriting configuration</title>
9378 <para>
9379 The rewriting section of the configuration, introduced by
9380 </para>
9381 <literallayout class="monospaced">
9382 begin rewrite
9383 </literallayout>
9384 <para>
9385 contains rules for rewriting addresses in messages as they arrive. There are no
9386 rewriting rules in the default configuration file.
9387 </para>
9388 </section>
9389 <section id="SECTdefconfauth">
9390 <title>Authenticators configuration</title>
9391 <para>
9392 <indexterm role="concept">
9393 <primary>AUTH</primary>
9394 <secondary>configuration</secondary>
9395 </indexterm>
9396 The authenticators section of the configuration, introduced by
9397 </para>
9398 <literallayout class="monospaced">
9399 begin authenticators
9400 </literallayout>
9401 <para>
9402 defines mechanisms for the use of the SMTP AUTH command. The default
9403 configuration file contains two commented-out example authenticators
9404 which support plaintext username/password authentication using the
9405 standard PLAIN mechanism and the traditional but non-standard LOGIN
9406 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9407 to support most MUA software.
9408 </para>
9409 <para>
9410 The example PLAIN authenticator looks like this:
9411 </para>
9412 <literallayout class="monospaced">
9413 #PLAIN:
9414 #  driver                  = plaintext
9415 #  server_set_id           = $auth2
9416 #  server_prompts          = :
9417 #  server_condition        = Authentication is not yet configured
9418 #  server_advertise_condition = ${if def:tls_in_cipher }
9419 </literallayout>
9420 <para>
9421 And the example LOGIN authenticator looks like this:
9422 </para>
9423 <literallayout class="monospaced">
9424 #LOGIN:
9425 #  driver                  = plaintext
9426 #  server_set_id           = $auth1
9427 #  server_prompts          = &lt;| Username: | Password:
9428 #  server_condition        = Authentication is not yet configured
9429 #  server_advertise_condition = ${if def:tls_in_cipher }
9430 </literallayout>
9431 <para>
9432 The <option>server_set_id</option> option makes Exim remember the authenticated username
9433 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9434 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9435 that it implements the details of the specific authentication mechanism,
9436 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9437 when Exim offers authentication to clients; in the examples, this is only
9438 when TLS or SSL has been started, so to enable the authenticators you also
9439 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9440 </para>
9441 <para>
9442 The <option>server_condition</option> setting defines how to verify that the username and
9443 password are correct. In the examples it just produces an error message.
9444 To make the authenticators work, you can use a string expansion
9445 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9446 </para>
9447 <para>
9448 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9449 usercode and password are in different positions.
9450 Chapter <xref linkend="CHAPplaintext"/> covers both.
9451 </para>
9452 <para>
9453 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9454 </para>
9455 </section>
9456 </chapter>
9457
9458 <chapter id="CHAPregexp">
9459 <title>Regular expressions</title>
9460 <para>
9461 <indexterm role="concept">
9462 <primary>regular expressions</primary>
9463 <secondary>library</secondary>
9464 </indexterm>
9465 <indexterm role="concept">
9466 <primary>PCRE</primary>
9467 </indexterm>
9468 Exim supports the use of regular expressions in many of its options. It
9469 uses the PCRE regular expression library; this provides regular expression
9470 matching that is compatible with Perl 5. The syntax and semantics of
9471 regular expressions is discussed in
9472 online Perl manpages, in
9473 many Perl reference books, and also in
9474 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9475 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9476 </para>
9477 <para>
9478 The documentation for the syntax and semantics of the regular expressions that
9479 are supported by PCRE is included in the PCRE distribution, and no further
9480 description is included here. The PCRE functions are called from Exim using
9481 the default option settings (that is, with no PCRE options set), except that
9482 the PCRE_CASELESS option is set when the matching is required to be
9483 case-insensitive.
9484 </para>
9485 <para>
9486 In most cases, when a regular expression is required in an Exim configuration,
9487 it has to start with a circumflex, in order to distinguish it from plain text
9488 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9489 second item in the colon-separated list is a regular expression.
9490 </para>
9491 <literallayout class="monospaced">
9492 domains = a.b.c : ^\\d{3} : *.y.z : ...
9493 </literallayout>
9494 <para>
9495 The doubling of the backslash is required because of string expansion that
9496 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9497 of this issue, and a way of avoiding the need for doubling backslashes. The
9498 regular expression that is eventually used in this example contains just one
9499 backslash. The circumflex is included in the regular expression, and has the
9500 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9501 matched.
9502 </para>
9503 <para>
9504 There are, however, two cases where a circumflex is not required for the
9505 recognition of a regular expression: these are the <option>match</option> condition in a
9506 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9507 these cases, the relevant string is always treated as a regular expression; if
9508 it does not start with a circumflex, the expression is not anchored, and can
9509 match anywhere in the subject string.
9510 </para>
9511 <para>
9512 In all cases, if you want a regular expression to match at the end of a string,
9513 you must code the $ metacharacter to indicate this. For example:
9514 </para>
9515 <literallayout class="monospaced">
9516 domains = ^\\d{3}\\.example
9517 </literallayout>
9518 <para>
9519 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9520 You need to use:
9521 </para>
9522 <literallayout class="monospaced">
9523 domains = ^\\d{3}\\.example\$
9524 </literallayout>
9525 <para>
9526 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9527 $ is needed because string expansion also interprets dollar characters.
9528 </para>
9529 </chapter>
9530
9531 <chapter id="CHAPfdlookup">
9532 <title>File and database lookups</title>
9533 <para>
9534 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9535 <primary>file</primary>
9536 <secondary>lookups</secondary>
9537 </indexterm>
9538 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9539 <primary>database</primary>
9540 <secondary>lookups</secondary>
9541 </indexterm>
9542 <indexterm role="concept">
9543 <primary>lookup</primary>
9544 <secondary>description of</secondary>
9545 </indexterm>
9546 Exim can be configured to look up data in files or databases as it processes
9547 messages. Two different kinds of syntax are used:
9548 </para>
9549 <orderedlist numeration="arabic">
9550 <listitem>
9551 <para>
9552 A string that is to be expanded may contain explicit lookup requests. These
9553 cause parts of the string to be replaced by data that is obtained from the
9554 lookup. Lookups of this type are conditional expansion items. Different results
9555 can be defined for the cases of lookup success and failure. See chapter
9556 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9557 The key for the lookup is specified as part of the string expansion.
9558 </para>
9559 </listitem>
9560 <listitem>
9561 <para>
9562 Lists of domains, hosts, and email addresses can contain lookup requests as a
9563 way of avoiding excessively long linear lists. In this case, the data that is
9564 returned by the lookup is often (but not always) discarded; whether the lookup
9565 succeeds or fails is what really counts. These kinds of list are described in
9566 chapter <xref linkend="CHAPdomhosaddlists"/>.
9567 The key for the lookup is given by the context in which the list is expanded.
9568 </para>
9569 </listitem>
9570 </orderedlist>
9571 <para>
9572 String expansions, lists, and lookups interact with each other in such a way
9573 that there is no order in which to describe any one of them that does not
9574 involve references to the others. Each of these three chapters makes more sense
9575 if you have read the other two first. If you are reading this for the first
9576 time, be aware that some of it will make a lot more sense after you have read
9577 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9578 </para>
9579 <section id="SECID60">
9580 <title>Examples of different lookup syntax</title>
9581 <para>
9582 It is easy to confuse the two different kinds of lookup, especially as the
9583 lists that may contain the second kind are always expanded before being
9584 processed as lists. Therefore, they may also contain lookups of the first kind.
9585 Be careful to distinguish between the following two examples:
9586 </para>
9587 <literallayout class="monospaced">
9588 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9589 domains = lsearch;/some/file
9590 </literallayout>
9591 <para>
9592 The first uses a string expansion, the result of which must be a domain list.
9593 No strings have been specified for a successful or a failing lookup; the
9594 defaults in this case are the looked-up data and an empty string, respectively.
9595 The expansion takes place before the string is processed as a list, and the
9596 file that is searched could contain lines like this:
9597 </para>
9598 <literallayout class="monospaced">
9599 192.168.3.4: domain1:domain2:...
9600 192.168.1.9: domain3:domain4:...
9601 </literallayout>
9602 <para>
9603 When the lookup succeeds, the result of the expansion is a list of domains (and
9604 possibly other types of item that are allowed in domain lists).
9605 </para>
9606 <para>
9607 In the second example, the lookup is a single item in a domain list. It causes
9608 Exim to use a lookup to see if the domain that is being processed can be found
9609 in the file. The file could contains lines like this:
9610 </para>
9611 <literallayout class="monospaced">
9612 domain1:
9613 domain2:
9614 </literallayout>
9615 <para>
9616 Any data that follows the keys is not relevant when checking that the domain
9617 matches the list item.
9618 </para>
9619 <para>
9620 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9621 Consider a file containing lines like this:
9622 </para>
9623 <literallayout class="monospaced">
9624 192.168.5.6: lsearch;/another/file
9625 </literallayout>
9626 <para>
9627 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9628 first <option>domains</option> setting above generates the second setting, which therefore
9629 causes a second lookup to occur.
9630 </para>
9631 <para>
9632 The rest of this chapter describes the different lookup types that are
9633 available. Any of them can be used in any part of the configuration where a
9634 lookup is permitted.
9635 </para>
9636 </section>
9637 <section id="SECID61">
9638 <title>Lookup types</title>
9639 <para>
9640 <indexterm role="concept">
9641 <primary>lookup</primary>
9642 <secondary>types of</secondary>
9643 </indexterm>
9644 <indexterm role="concept">
9645 <primary>single-key lookup</primary>
9646 <secondary>definition of</secondary>
9647 </indexterm>
9648 Two different types of data lookup are implemented:
9649 </para>
9650 <itemizedlist>
9651 <listitem>
9652 <para>
9653 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9654 and a single key to search for. The key must be a non-empty string for the
9655 lookup to succeed. The lookup type determines how the file is searched.
9656 </para>
9657 </listitem>
9658 <listitem>
9659 <para>
9660 <indexterm role="concept">
9661 <primary>query-style lookup</primary>
9662 <secondary>definition of</secondary>
9663 </indexterm>
9664 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9665 key value is assumed by Exim for query-style lookups. You can use whichever
9666 Exim variables you need to construct the database query.
9667 </para>
9668 </listitem>
9669 </itemizedlist>
9670 <para>
9671 The code for each lookup type is in a separate source file that is included in
9672 the binary of Exim only if the corresponding compile-time option is set. The
9673 default settings in <filename>src/EDITME</filename> are:
9674 </para>
9675 <literallayout class="monospaced">
9676 LOOKUP_DBM=yes
9677 LOOKUP_LSEARCH=yes
9678 </literallayout>
9679 <para>
9680 which means that only linear searching and DBM lookups are included by default.
9681 For some types of lookup (e.g. SQL databases), you need to install appropriate
9682 libraries and header files before building Exim.
9683 </para>
9684 </section>
9685 <section id="SECTsinglekeylookups">
9686 <title>Single-key lookup types</title>
9687 <para>
9688 <indexterm role="concept">
9689 <primary>lookup</primary>
9690 <secondary>single-key types</secondary>
9691 </indexterm>
9692 <indexterm role="concept">
9693 <primary>single-key lookup</primary>
9694 <secondary>list of types</secondary>
9695 </indexterm>
9696 The following single-key lookup types are implemented:
9697 </para>
9698 <itemizedlist>
9699 <listitem>
9700 <para>
9701 <indexterm role="concept">
9702 <primary>cdb</primary>
9703 <secondary>description of</secondary>
9704 </indexterm>
9705 <indexterm role="concept">
9706 <primary>lookup</primary>
9707 <secondary>cdb</secondary>
9708 </indexterm>
9709 <indexterm role="concept">
9710 <primary>binary zero</primary>
9711 <secondary>in lookup key</secondary>
9712 </indexterm>
9713 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9714 string without a terminating binary zero. The cdb format is designed for
9715 indexed files that are read frequently and never updated, except by total
9716 re-creation. As such, it is particularly suitable for large files containing
9717 aliases or other indexed data referenced by an MTA. Information about cdb can
9718 be found in several places:
9719 </para>
9720 <literallayout>
9721 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9722 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9723 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9724 </literallayout>
9725 <para>
9726 A cdb distribution is not needed in order to build Exim with cdb support,
9727 because the code for reading cdb files is included directly in Exim itself.
9728 However, no means of building or testing cdb files is provided with Exim, so
9729 you need to obtain a cdb distribution in order to do this.
9730 </para>
9731 </listitem>
9732 <listitem>
9733 <para>
9734 <indexterm role="concept">
9735 <primary>DBM</primary>
9736 <secondary>lookup type</secondary>
9737 </indexterm>
9738 <indexterm role="concept">
9739 <primary>lookup</primary>
9740 <secondary>dbm</secondary>
9741 </indexterm>
9742 <indexterm role="concept">
9743 <primary>binary zero</primary>
9744 <secondary>in lookup key</secondary>
9745 </indexterm>
9746 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9747 DBM file by looking up the record with the given key. A terminating binary
9748 zero is included in the key that is passed to the DBM library. See section
9749 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9750 </para>
9751 <para>
9752 <indexterm role="concept">
9753 <primary>Berkeley DB library</primary>
9754 <secondary>file format</secondary>
9755 </indexterm>
9756 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9757 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9758 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9759 the DB_UNKNOWN option. This enables it to handle any of the types of database
9760 that the library supports, and can be useful for accessing DBM files created by
9761 other applications. (For earlier DB versions, DB_HASH is always used.)
9762 </para>
9763 </listitem>
9764 <listitem>
9765 <para>
9766 <indexterm role="concept">
9767 <primary>lookup</primary>
9768 <secondary>dbmjz</secondary>
9769 </indexterm>
9770 <indexterm role="concept">
9771 <primary>lookup</primary>
9772 <secondary>dbm &ndash; embedded NULs</secondary>
9773 </indexterm>
9774 <indexterm role="concept">
9775 <primary>sasldb2</primary>
9776 </indexterm>
9777 <indexterm role="concept">
9778 <primary>dbmjz lookup type</primary>
9779 </indexterm>
9780 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9781 interpreted as an Exim list; the elements of the list are joined together with
9782 ASCII NUL characters to form the lookup key.  An example usage would be to
9783 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9784 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9785 <command>cram_md5</command> authenticator.
9786 </para>
9787 </listitem>
9788 <listitem>
9789 <para>
9790 <indexterm role="concept">
9791 <primary>lookup</primary>
9792 <secondary>dbmnz</secondary>
9793 </indexterm>
9794 <indexterm role="concept">
9795 <primary>lookup</primary>
9796 <secondary>dbm &ndash; terminating zero</secondary>
9797 </indexterm>
9798 <indexterm role="concept">
9799 <primary>binary zero</primary>
9800 <secondary>in lookup key</secondary>
9801 </indexterm>
9802 <indexterm role="concept">
9803 <primary>Courier</primary>
9804 </indexterm>
9805 <indexterm role="concept">
9806 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9807 </indexterm>
9808 <indexterm role="concept">
9809 <primary>dbmnz lookup type</primary>
9810 </indexterm>
9811 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9812 is not included in the key that is passed to the DBM library. You may need this
9813 if you want to look up data in files that are created by or shared with some
9814 other application that does not use terminating zeros. For example, you need to
9815 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9816 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9817 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9818 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9819 </para>
9820 </listitem>
9821 <listitem>
9822 <para>
9823 <indexterm role="concept">
9824 <primary>lookup</primary>
9825 <secondary>dsearch</secondary>
9826 </indexterm>
9827 <indexterm role="concept">
9828 <primary>dsearch lookup type</primary>
9829 </indexterm>
9830 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9831 whose name is the key by calling the <function>lstat()</function> function. The key may not
9832 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9833 the lookup is the name of the entry, which may be a file, directory,
9834 symbolic link, or any other kind of directory entry. An example of how this
9835 lookup can be used to support virtual domains is given in section
9836 <xref linkend="SECTvirtualdomains"/>.
9837 </para>
9838 </listitem>
9839 <listitem>
9840 <para>
9841 <indexterm role="concept">
9842 <primary>lookup</primary>
9843 <secondary>iplsearch</secondary>
9844 </indexterm>
9845 <indexterm role="concept">
9846 <primary>iplsearch lookup type</primary>
9847 </indexterm>
9848 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9849 terminated by a colon or white space or the end of the line. The keys in the
9850 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9851 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9852 being interpreted as a key terminator. For example:
9853 </para>
9854 <literallayout class="monospaced">
9855 1.2.3.4:           data for 1.2.3.4
9856 192.168.0.0/16:    data for 192.168.0.0/16
9857 "abcd::cdab":      data for abcd::cdab
9858 "abcd:abcd::/32"   data for abcd:abcd::/32
9859 </literallayout>
9860 <para>
9861 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9862 file is searched linearly, using the CIDR masks where present, until a matching
9863 key is found. The first key that matches is used; there is no attempt to find a
9864 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9865 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9866 </para>
9867 <para>
9868 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9869 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9870 lookup types support only literal keys.
9871 </para>
9872 <para>
9873 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9874 the implicit key is the host&#x2019;s IP address rather than its name (see section
9875 <xref linkend="SECThoslispatsikey"/>).
9876 </para>
9877 </listitem>
9878 <listitem>
9879 <para>
9880 <indexterm role="concept">
9881 <primary>linear search</primary>
9882 </indexterm>
9883 <indexterm role="concept">
9884 <primary>lookup</primary>
9885 <secondary>lsearch</secondary>
9886 </indexterm>
9887 <indexterm role="concept">
9888 <primary>lsearch lookup type</primary>
9889 </indexterm>
9890 <indexterm role="concept">
9891 <primary>case sensitivity</primary>
9892 <secondary>in lsearch lookup</secondary>
9893 </indexterm>
9894 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9895 line beginning with the search key, terminated by a colon or white space or the
9896 end of the line. The search is case-insensitive; that is, upper and lower case
9897 letters are treated as the same. The first occurrence of the key that is found
9898 in the file is used.
9899 </para>
9900 <para>
9901 White space between the key and the colon is permitted. The remainder of the
9902 line, with leading and trailing white space removed, is the data. This can be
9903 continued onto subsequent lines by starting them with any amount of white
9904 space, but only a single space character is included in the data at such a
9905 junction. If the data begins with a colon, the key must be terminated by a
9906 colon, for example:
9907 </para>
9908 <literallayout class="monospaced">
9909 baduser:  :fail:
9910 </literallayout>
9911 <para>
9912 Empty lines and lines beginning with # are ignored, even if they occur in the
9913 middle of an item. This is the traditional textual format of alias files. Note
9914 that the keys in an <command>lsearch</command> file are literal strings. There is no
9915 wildcarding of any kind.
9916 </para>
9917 <para>
9918 <indexterm role="concept">
9919 <primary>lookup</primary>
9920 <secondary>lsearch &ndash; colons in keys</secondary>
9921 </indexterm>
9922 <indexterm role="concept">
9923 <primary>white space</primary>
9924 <secondary>in lsearch key</secondary>
9925 </indexterm>
9926 In most <command>lsearch</command> files, keys are not required to contain colons or #
9927 characters, or white space. However, if you need this feature, it is available.
9928 If a key begins with a doublequote character, it is terminated only by a
9929 matching quote (or end of line), and the normal escaping rules apply to its
9930 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9931 quoted keys (exactly as for unquoted keys). There is no special handling of
9932 quotes for the data part of an <command>lsearch</command> line.
9933 </para>
9934 </listitem>
9935 <listitem>
9936 <para>
9937 <indexterm role="concept">
9938 <primary>NIS lookup type</primary>
9939 </indexterm>
9940 <indexterm role="concept">
9941 <primary>lookup</primary>
9942 <secondary>NIS</secondary>
9943 </indexterm>
9944 <indexterm role="concept">
9945 <primary>binary zero</primary>
9946 <secondary>in lookup key</secondary>
9947 </indexterm>
9948 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9949 the given key, without a terminating binary zero. There is a variant called
9950 <command>nis0</command> which does include the terminating binary zero in the key. This is
9951 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9952 aliases; the full map names must be used.
9953 </para>
9954 </listitem>
9955 <listitem>
9956 <para>
9957 <indexterm role="concept">
9958 <primary>wildlsearch lookup type</primary>
9959 </indexterm>
9960 <indexterm role="concept">
9961 <primary>lookup</primary>
9962 <secondary>wildlsearch</secondary>
9963 </indexterm>
9964 <indexterm role="concept">
9965 <primary>nwildlsearch lookup type</primary>
9966 </indexterm>
9967 <indexterm role="concept">
9968 <primary>lookup</primary>
9969 <secondary>nwildlsearch</secondary>
9970 </indexterm>
9971 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9972 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9973 the file may be wildcarded. The difference between these two lookup types is
9974 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9975 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9976 </para>
9977 <para>
9978 <indexterm role="concept">
9979 <primary>case sensitivity</primary>
9980 <secondary>in (n)wildlsearch lookup</secondary>
9981 </indexterm>
9982 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9983 file that are regular expressions can be made case-sensitive by the use of
9984 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9985 </para>
9986 <orderedlist numeration="arabic">
9987 <listitem>
9988 <para>
9989 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9990 </para>
9991 <literallayout class="monospaced">
9992     *.a.b.c       data for anything.a.b.c
9993     *fish         data for anythingfish
9994 </literallayout>
9995 </listitem>
9996 <listitem>
9997 <para>
9998 The string may begin with a circumflex to indicate a regular expression. For
9999 example, for <command>wildlsearch</command>:
10000 </para>
10001 <literallayout class="monospaced">
10002     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10003 </literallayout>
10004 <para>
10005 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10006 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10007 string-expanded, the equivalent entry is:
10008 </para>
10009 <literallayout class="monospaced">
10010     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10011 </literallayout>
10012 <para>
10013 The case-insensitive flag is set at the start of compiling the regular
10014 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10015 For example, to make the entire pattern case-sensitive:
10016 </para>
10017 <literallayout class="monospaced">
10018     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10019 </literallayout>
10020 <para>
10021 If the regular expression contains white space or colon characters, you must
10022 either quote it (see <command>lsearch</command> above), or represent these characters in other
10023 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10024 colon. This may be easier than quoting, because if you quote, you have to
10025 escape all the backslashes inside the quotes.
10026 </para>
10027 <para>
10028 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10029 match for later use, because the results of all lookups are cached. If a lookup
10030 is repeated, the result is taken from the cache, and no actual pattern matching
10031 takes place. The values of all the numeric variables are unset after a
10032 <command>(n)wildlsearch</command> match.
10033 </para>
10034 </listitem>
10035 <listitem>
10036 <para>
10037 Although I cannot see it being of much use, the general matching function that
10038 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10039 lookup name terminated by a semicolon, and followed by lookup data. For
10040 example:
10041 </para>
10042 <literallayout class="monospaced">
10043     cdb;/some/file  data for keys that match the file
10044 </literallayout>
10045 <para>
10046 The data that is obtained from the nested lookup is discarded.
10047 </para>
10048 </listitem>
10049 </orderedlist>
10050 <para>
10051 Keys that do not match any of these patterns are interpreted literally. The
10052 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10053 be followed by optional colons.
10054 </para>
10055 <para>
10056 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10057 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10058 lookup types support only literal keys.
10059 </para>
10060 </listitem>
10061 </itemizedlist>
10062 </section>
10063 <section id="SECTquerystylelookups">
10064 <title>Query-style lookup types</title>
10065 <para>
10066 <indexterm role="concept">
10067 <primary>lookup</primary>
10068 <secondary>query-style types</secondary>
10069 </indexterm>
10070 <indexterm role="concept">
10071 <primary>query-style lookup</primary>
10072 <secondary>list of types</secondary>
10073 </indexterm>
10074 The supported query-style lookup types are listed below. Further details about
10075 many of them are given in later sections.
10076 </para>
10077 <itemizedlist>
10078 <listitem>
10079 <para>
10080 <indexterm role="concept">
10081 <primary>DNS</primary>
10082 <secondary>as a lookup type</secondary>
10083 </indexterm>
10084 <indexterm role="concept">
10085 <primary>lookup</primary>
10086 <secondary>DNS</secondary>
10087 </indexterm>
10088 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10089 are given in the supplied query. The resulting data is the contents of the
10090 records. See section <xref linkend="SECTdnsdb"/>.
10091 </para>
10092 </listitem>
10093 <listitem>
10094 <para>
10095 <indexterm role="concept">
10096 <primary>InterBase lookup type</primary>
10097 </indexterm>
10098 <indexterm role="concept">
10099 <primary>lookup</primary>
10100 <secondary>InterBase</secondary>
10101 </indexterm>
10102 <command>ibase</command>: This does a lookup in an InterBase database.
10103 </para>
10104 </listitem>
10105 <listitem>
10106 <para>
10107 <indexterm role="concept">
10108 <primary>LDAP</primary>
10109 <secondary>lookup type</secondary>
10110 </indexterm>
10111 <indexterm role="concept">
10112 <primary>lookup</primary>
10113 <secondary>LDAP</secondary>
10114 </indexterm>
10115 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10116 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10117 that permits values from multiple entries to be returned. A third variant
10118 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10119 any attribute values. See section <xref linkend="SECTldap"/>.
10120 </para>
10121 </listitem>
10122 <listitem>
10123 <para>
10124 <indexterm role="concept">
10125 <primary>MySQL</primary>
10126 <secondary>lookup type</secondary>
10127 </indexterm>
10128 <indexterm role="concept">
10129 <primary>lookup</primary>
10130 <secondary>MySQL</secondary>
10131 </indexterm>
10132 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10133 MySQL database. See section <xref linkend="SECTsql"/>.
10134 </para>
10135 </listitem>
10136 <listitem>
10137 <para>
10138 <indexterm role="concept">
10139 <primary>NIS+ lookup type</primary>
10140 </indexterm>
10141 <indexterm role="concept">
10142 <primary>lookup</primary>
10143 <secondary>NIS+</secondary>
10144 </indexterm>
10145 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10146 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10147 </para>
10148 </listitem>
10149 <listitem>
10150 <para>
10151 <indexterm role="concept">
10152 <primary>Oracle</primary>
10153 <secondary>lookup type</secondary>
10154 </indexterm>
10155 <indexterm role="concept">
10156 <primary>lookup</primary>
10157 <secondary>Oracle</secondary>
10158 </indexterm>
10159 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10160 Oracle database. See section <xref linkend="SECTsql"/>.
10161 </para>
10162 </listitem>
10163 <listitem>
10164 <para>
10165 <indexterm role="concept">
10166 <primary>lookup</primary>
10167 <secondary>passwd</secondary>
10168 </indexterm>
10169 <indexterm role="concept">
10170 <primary>passwd lookup type</primary>
10171 </indexterm>
10172 <indexterm role="concept">
10173 <primary><filename>/etc/passwd</filename></primary>
10174 </indexterm>
10175 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10176 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10177 success, the result string is the same as you would get from an <command>lsearch</command>
10178 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10179 password value. For example:
10180 </para>
10181 <literallayout class="monospaced">
10182 *:42:42:King Rat:/home/kr:/bin/bash
10183 </literallayout>
10184 </listitem>
10185 <listitem>
10186 <para>
10187 <indexterm role="concept">
10188 <primary>PostgreSQL lookup type</primary>
10189 </indexterm>
10190 <indexterm role="concept">
10191 <primary>lookup</primary>
10192 <secondary>PostgreSQL</secondary>
10193 </indexterm>
10194 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10195 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10196 </para>
10197 </listitem>
10198 <listitem>
10199 <para>
10200 <indexterm role="concept">
10201 <primary>Redis lookup type</primary>
10202 </indexterm>
10203 <indexterm role="concept">
10204 <primary>lookup</primary>
10205 <secondary>Redis</secondary>
10206 </indexterm>
10207 <command>redis</command>: The format of the query is either a simple get or simple set,
10208 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10209 </para>
10210 </listitem>
10211 <listitem>
10212 <para>
10213 <indexterm role="concept">
10214 <primary>sqlite lookup type</primary>
10215 </indexterm>
10216 <indexterm role="concept">
10217 <primary>lookup</primary>
10218 <secondary>sqlite</secondary>
10219 </indexterm>
10220 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10221 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10222 </para>
10223 </listitem>
10224 <listitem>
10225 <para>
10226 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10227 not likely to be useful in normal operation.
10228 </para>
10229 </listitem>
10230 <listitem>
10231 <para>
10232 <indexterm role="concept">
10233 <primary>whoson lookup type</primary>
10234 </indexterm>
10235 <indexterm role="concept">
10236 <primary>lookup</primary>
10237 <secondary>whoson</secondary>
10238 </indexterm>
10239 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
10240 allows a server to check whether a particular (dynamically allocated) IP
10241 address is currently allocated to a known (trusted) user and, optionally, to
10242 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10243 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10244 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10245 <quote>POP before SMTP</quote> checking using ACL statements such as
10246 </para>
10247 <literallayout class="monospaced">
10248 require condition = \
10249   ${lookup whoson {$sender_host_address}{yes}{no}}
10250 </literallayout>
10251 <para>
10252 The query consists of a single IP address. The value returned is the name of
10253 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10254 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10255 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10256 </para>
10257 </listitem>
10258 </itemizedlist>
10259 </section>
10260 <section id="SECID63">
10261 <title>Temporary errors in lookups</title>
10262 <para>
10263 <indexterm role="concept">
10264 <primary>lookup</primary>
10265 <secondary>temporary error in</secondary>
10266 </indexterm>
10267 Lookup functions can return temporary error codes if the lookup cannot be
10268 completed. For example, an SQL or LDAP database might be unavailable. For this
10269 reason, it is not advisable to use a lookup that might do this for critical
10270 options such as a list of local domains.
10271 </para>
10272 <para>
10273 When a lookup cannot be completed in a router or transport, delivery
10274 of the message (to the relevant address) is deferred, as for any other
10275 temporary error. In other circumstances Exim may assume the lookup has failed,
10276 or may give up altogether.
10277 </para>
10278 </section>
10279 <section id="SECTdefaultvaluelookups">
10280 <title>Default values in single-key lookups</title>
10281 <para>
10282 <indexterm role="concept">
10283 <primary>wildcard lookups</primary>
10284 </indexterm>
10285 <indexterm role="concept">
10286 <primary>lookup</primary>
10287 <secondary>default values</secondary>
10288 </indexterm>
10289 <indexterm role="concept">
10290 <primary>lookup</primary>
10291 <secondary>wildcard</secondary>
10292 </indexterm>
10293 <indexterm role="concept">
10294 <primary>lookup</primary>
10295 <secondary>* added to type</secondary>
10296 </indexterm>
10297 <indexterm role="concept">
10298 <primary>default</primary>
10299 <secondary>in single-key lookups</secondary>
10300 </indexterm>
10301 In this context, a <quote>default value</quote> is a value specified by the administrator
10302 that is to be used if a lookup fails.
10303 </para>
10304 <para>
10305 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10306 lookups, the facilities of the query language must be used. An attempt to
10307 specify a default for a query-style lookup provokes an error.
10308 </para>
10309 <para>
10310 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10311 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10312 provide a default value. See also the section on partial matching below.
10313 </para>
10314 <para>
10315 <indexterm role="concept">
10316 <primary>*@ with single-key lookup</primary>
10317 </indexterm>
10318 <indexterm role="concept">
10319 <primary>lookup</primary>
10320 <secondary>*@ added to type</secondary>
10321 </indexterm>
10322 <indexterm role="concept">
10323 <primary>alias file</primary>
10324 <secondary>per-domain default</secondary>
10325 </indexterm>
10326 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10327 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10328 character, a second lookup is done with everything before the last @ replaced
10329 by *. This makes it possible to provide per-domain defaults in alias files
10330 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10331 take place because there is no @ in the key), <quote>*</quote> is looked up.
10332 For example, a <command>redirect</command> router might contain:
10333 </para>
10334 <literallayout class="monospaced">
10335 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10336 </literallayout>
10337 <para>
10338 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10339 looks up these keys, in this order:
10340 </para>
10341 <literallayout class="monospaced">
10342 jane@eyre.example
10343 *@eyre.example
10344 *
10345 </literallayout>
10346 <para>
10347 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10348 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10349 complete scan is done for each key, and only if it is not found at all does
10350 Exim move on to try the next key.
10351 </para>
10352 </section>
10353 <section id="SECTpartiallookup">
10354 <title>Partial matching in single-key lookups</title>
10355 <para>
10356 <indexterm role="concept">
10357 <primary>partial matching</primary>
10358 </indexterm>
10359 <indexterm role="concept">
10360 <primary>wildcard lookups</primary>
10361 </indexterm>
10362 <indexterm role="concept">
10363 <primary>lookup</primary>
10364 <secondary>partial matching</secondary>
10365 </indexterm>
10366 <indexterm role="concept">
10367 <primary>lookup</primary>
10368 <secondary>wildcard</secondary>
10369 </indexterm>
10370 <indexterm role="concept">
10371 <primary>asterisk</primary>
10372 <secondary>in search type</secondary>
10373 </indexterm>
10374 The normal operation of a single-key lookup is to search the file for an exact
10375 match with the given key. However, in a number of situations where domains are
10376 being looked up, it is useful to be able to do partial matching. In this case,
10377 information in the file that has a key starting with <quote>*.</quote> is matched by any
10378 domain that ends with the components that follow the full stop. For example, if
10379 a key in a DBM file is
10380 </para>
10381 <literallayout class="monospaced">
10382 *.dates.fict.example
10383 </literallayout>
10384 <para>
10385 then when partial matching is enabled this is matched by (amongst others)
10386 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10387 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10388 file.
10389 </para>
10390 <para>
10391 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10392 also not available for any lookup items in address lists (see section
10393 <xref linkend="SECTaddresslist"/>).
10394 </para>
10395 <para>
10396 Partial matching is implemented by doing a series of separate lookups using
10397 keys constructed by modifying the original subject key. This means that it can
10398 be used with any of the single-key lookup types, provided that
10399 partial matching keys
10400 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10401 Keys in the file that do not begin with the prefix are matched only by
10402 unmodified subject keys when partial matching is in use.
10403 </para>
10404 <para>
10405 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10406 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10407 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10408 is added at the start of the subject key, and it is looked up again. If that
10409 fails, further lookups are tried with dot-separated components removed from the
10410 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10411 remains.
10412 </para>
10413 <para>
10414 A minimum number of two non-* components are required. This can be adjusted
10415 by including a number before the hyphen in the search type. For example,
10416 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10417 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10418 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10419 up when the minimum number of non-* components is two:
10420 </para>
10421 <literallayout class="monospaced">
10422 2250.dates.fict.example
10423 *.2250.dates.fict.example
10424 *.dates.fict.example
10425 *.fict.example
10426 </literallayout>
10427 <para>
10428 As soon as one key in the sequence is successfully looked up, the lookup
10429 finishes.
10430 </para>
10431 <para>
10432 <indexterm role="concept">
10433 <primary>lookup</primary>
10434 <secondary>partial matching &ndash; changing prefix</secondary>
10435 </indexterm>
10436 <indexterm role="concept">
10437 <primary>prefix</primary>
10438 <secondary>for partial matching</secondary>
10439 </indexterm>
10440 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10441 changed. The motivation for this feature is to allow Exim to operate with file
10442 formats that are used by other MTAs. A different prefix can be supplied in
10443 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10444 </para>
10445 <literallayout class="monospaced">
10446 domains = partial(.)lsearch;/some/file
10447 </literallayout>
10448 <para>
10449 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10450 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10451 components is unchanged). The prefix may consist of any punctuation characters
10452 other than a closing parenthesis. It may be empty, for example:
10453 </para>
10454 <literallayout class="monospaced">
10455 domains = partial1()cdb;/some/file
10456 </literallayout>
10457 <para>
10458 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10459 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10460 </para>
10461 <para>
10462 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10463 just one non-wild component has failed, and the original key is shortened right
10464 down to the null string) depends on the prefix:
10465 </para>
10466 <itemizedlist>
10467 <listitem>
10468 <para>
10469 If the prefix has zero length, the whole lookup fails.
10470 </para>
10471 </listitem>
10472 <listitem>
10473 <para>
10474 If the prefix has length 1, a lookup for just the prefix is done. For
10475 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10476 </para>
10477 </listitem>
10478 <listitem>
10479 <para>
10480 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10481 remainder is looked up. With the default prefix, therefore, the final lookup is
10482 for <quote>*</quote> on its own.
10483 </para>
10484 </listitem>
10485 <listitem>
10486 <para>
10487 Otherwise, the whole prefix is looked up.
10488 </para>
10489 </listitem>
10490 </itemizedlist>
10491 <para>
10492 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10493 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10494 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10495 specified, adding <quote>*</quote> to the search type has no effect with the default
10496 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10497 lookups. However, there might be a use for lookup types such as
10498 <quote>partial0(.)lsearch*</quote>.
10499 </para>
10500 <para>
10501 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10502 in domain lists and the like. Partial matching works only in terms of
10503 dot-separated components; a key such as <literal>*fict.example</literal>
10504 in a database file is useless, because the asterisk in a partial matching
10505 subject key is always followed by a dot.
10506 </para>
10507 </section>
10508 <section id="SECID64">
10509 <title>Lookup caching</title>
10510 <para>
10511 <indexterm role="concept">
10512 <primary>lookup</primary>
10513 <secondary>caching</secondary>
10514 </indexterm>
10515 <indexterm role="concept">
10516 <primary>caching</primary>
10517 <secondary>lookup data</secondary>
10518 </indexterm>
10519 Exim caches all lookup results in order to avoid needless repetition of
10520 lookups. However, because (apart from the daemon) Exim operates as a collection
10521 of independent, short-lived processes, this caching applies only within a
10522 single Exim process. There is no inter-process lookup caching facility.
10523 </para>
10524 <para>
10525 For single-key lookups, Exim keeps the relevant files open in case there is
10526 another lookup that needs them. In some types of configuration this can lead to
10527 many files being kept open for messages with many recipients. To avoid hitting
10528 the operating system limit on the number of simultaneously open files, Exim
10529 closes the least recently used file when it needs to open more files than its
10530 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10531 </para>
10532 <para>
10533 The single-key lookup files are closed and the lookup caches are flushed at
10534 strategic points during delivery &ndash; for example, after all routing is
10535 complete.
10536 </para>
10537 </section>
10538 <section id="SECID65">
10539 <title>Quoting lookup data</title>
10540 <para>
10541 <indexterm role="concept">
10542 <primary>lookup</primary>
10543 <secondary>quoting</secondary>
10544 </indexterm>
10545 <indexterm role="concept">
10546 <primary>quoting</primary>
10547 <secondary>in lookups</secondary>
10548 </indexterm>
10549 When data from an incoming message is included in a query-style lookup, there
10550 is the possibility of special characters in the data messing up the syntax of
10551 the query. For example, a NIS+ query that contains
10552 </para>
10553 <literallayout class="monospaced">
10554 [name=$local_part]
10555 </literallayout>
10556 <para>
10557 will be broken if the local part happens to contain a closing square bracket.
10558 For NIS+, data can be enclosed in double quotes like this:
10559 </para>
10560 <literallayout class="monospaced">
10561 [name="$local_part"]
10562 </literallayout>
10563 <para>
10564 but this still leaves the problem of a double quote in the data. The rule for
10565 NIS+ is that double quotes must be doubled. Other lookup types have different
10566 rules, and to cope with the differing requirements, an expansion operator
10567 of the following form is provided:
10568 </para>
10569 <literallayout class="monospaced">
10570 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10571 </literallayout>
10572 <para>
10573 For example, the safest way to write the NIS+ query is
10574 </para>
10575 <literallayout class="monospaced">
10576 [name="${quote_nisplus:$local_part}"]
10577 </literallayout>
10578 <para>
10579 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10580 operator can be used for all lookup types, but has no effect for single-key
10581 lookups, since no quoting is ever needed in their key strings.
10582 </para>
10583 </section>
10584 <section id="SECTdnsdb">
10585 <title>More about dnsdb</title>
10586 <para>
10587 <indexterm role="concept">
10588 <primary>dnsdb lookup</primary>
10589 </indexterm>
10590 <indexterm role="concept">
10591 <primary>lookup</primary>
10592 <secondary>dnsdb</secondary>
10593 </indexterm>
10594 <indexterm role="concept">
10595 <primary>DNS</primary>
10596 <secondary>as a lookup type</secondary>
10597 </indexterm>
10598 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10599 of a record type and a domain name, separated by an equals sign. For example,
10600 an expansion string could contain:
10601 </para>
10602 <literallayout class="monospaced">
10603 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10604 </literallayout>
10605 <para>
10606 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10607 is used on its own as the result. If the lookup does not succeed, the
10608 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10609 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10610 </para>
10611 <para>
10612 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10613 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10614 If no type is given, TXT is assumed.
10615 </para>
10616 <para>
10617 For any record type, if multiple records are found, the data is returned as a
10618 concatenation, with newline as the default separator. The order, of course,
10619 depends on the DNS resolver. You can specify a different separator character
10620 between multiple records by putting a right angle-bracket followed immediately
10621 by the new separator at the start of the query. For example:
10622 </para>
10623 <literallayout class="monospaced">
10624 ${lookup dnsdb{&gt;: a=host1.example}}
10625 </literallayout>
10626 <para>
10627 It is permitted to specify a space as the separator character. Further
10628 white space is ignored.
10629 For lookup types that return multiple fields per record,
10630 an alternate field separator can be specified using a comma after the main
10631 separator character, followed immediately by the field separator.
10632 </para>
10633 <para>
10634 <indexterm role="concept">
10635 <primary>PTR record</primary>
10636 <secondary>in <command>dnsdb</command> lookup</secondary>
10637 </indexterm>
10638 When the type is PTR,
10639 the data can be an IP address, written as normal; inversion and the addition of
10640 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10641 </para>
10642 <literallayout class="monospaced">
10643 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10644 </literallayout>
10645 <para>
10646 If the data for a PTR record is not a syntactically valid IP address, it is not
10647 altered and nothing is added.
10648 </para>
10649 <para>
10650 <indexterm role="concept">
10651 <primary>MX record</primary>
10652 <secondary>in <command>dnsdb</command> lookup</secondary>
10653 </indexterm>
10654 <indexterm role="concept">
10655 <primary>SRV record</primary>
10656 <secondary>in <command>dnsdb</command> lookup</secondary>
10657 </indexterm>
10658 For an MX lookup, both the preference value and the host name are returned for
10659 each record, separated by a space. For an SRV lookup, the priority, weight,
10660 port, and host name are returned for each record, separated by spaces.
10661 The field separator can be modified as above.
10662 </para>
10663 <para>
10664 <indexterm role="concept">
10665 <primary>TXT record</primary>
10666 <secondary>in <command>dnsdb</command> lookup</secondary>
10667 </indexterm>
10668 <indexterm role="concept">
10669 <primary>SPF record</primary>
10670 <secondary>in <command>dnsdb</command> lookup</secondary>
10671 </indexterm>
10672 For TXT records with multiple items of data, only the first item is returned,
10673 unless a field separator is specified.
10674 To concatenate items without a separator, use a semicolon instead.
10675 For SPF records the
10676 default behaviour is to concatenate multiple items without using a separator.
10677 </para>
10678 <literallayout class="monospaced">
10679 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10680 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10681 ${lookup dnsdb{spf=example.org}}
10682 </literallayout>
10683 <para>
10684 It is permitted to specify a space as the separator character. Further
10685 white space is ignored.
10686 </para>
10687 <para>
10688 <indexterm role="concept">
10689 <primary>SOA record</primary>
10690 <secondary>in <command>dnsdb</command> lookup</secondary>
10691 </indexterm>
10692 For an SOA lookup, while no result is obtained the lookup is redone with
10693 successively more leading components dropped from the given domain.
10694 Only the primary-nameserver field is returned unless a field separator is
10695 specified.
10696 </para>
10697 <literallayout class="monospaced">
10698 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10699 </literallayout>
10700 </section>
10701 <section id="SECTdnsdb_mod">
10702 <title>Dnsdb lookup modifiers</title>
10703 <para>
10704 <indexterm role="concept">
10705 <primary>dnsdb modifiers</primary>
10706 </indexterm>
10707 <indexterm role="concept">
10708 <primary>modifiers</primary>
10709 <secondary>dnsdb</secondary>
10710 </indexterm>
10711 <indexterm role="concept">
10712 <primary>options</primary>
10713 <secondary>dnsdb</secondary>
10714 </indexterm>
10715 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10716 each followed by a comma,
10717 that may appear before the record type.
10718 </para>
10719 <para>
10720 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10721 temporary DNS error for any of them, the behaviour is controlled by
10722 a defer-option modifier.
10723 The possible keywords are
10724 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10725 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10726 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10727 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10728 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10729 error causes the whole lookup to defer only if none of the other lookups
10730 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10731 </para>
10732 <literallayout class="monospaced">
10733 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10734 ${lookup dnsdb{a=one.host.com:two.host.com}}
10735 </literallayout>
10736 <para>
10737 Thus, in the default case, as long as at least one of the DNS lookups
10738 yields some data, the lookup succeeds.
10739 </para>
10740 <para>
10741 <indexterm role="concept">
10742 <primary>DNSSEC</primary>
10743 <secondary>dns lookup</secondary>
10744 </indexterm>
10745 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10746 The possible keywords are
10747 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10748 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10749 with the lookup.
10750 With <quote>strict</quote> a response from the DNS resolver that
10751 is not labelled as authenticated data
10752 is treated as equivalent to a temporary DNS error.
10753 The default is <quote>never</quote>.
10754 </para>
10755 <para>
10756 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10757 </para>
10758 <para>
10759 <indexterm role="concept">
10760 <primary>timeout</primary>
10761 <secondary>dns lookup</secondary>
10762 </indexterm>
10763 <indexterm role="concept">
10764 <primary>DNS</primary>
10765 <secondary>timeout</secondary>
10766 </indexterm>
10767 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10768 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10769 (e.g. <quote>5s</quote>).
10770 The default value is set by the main configuration option <option>dns_retrans</option>.
10771 </para>
10772 <para>
10773 Retries for the dnsdb lookup can be controlled by a retry modifier.
10774 The form if <quote>retry_VAL</quote> where VAL is an integer.
10775 The default count is set by the main configuration option <option>dns_retry</option>.
10776 </para>
10777 <para>
10778 <indexterm role="concept">
10779 <primary>caching</primary>
10780 <secondary>of dns lookup</secondary>
10781 </indexterm>
10782 <indexterm role="concept">
10783 <primary>TTL</primary>
10784 <secondary>of dns lookup</secondary>
10785 </indexterm>
10786 <indexterm role="concept">
10787 <primary>DNS</primary>
10788 <secondary>TTL</secondary>
10789 </indexterm>
10790 Dnsdb lookup results are cached within a single process (and its children).
10791 The cache entry lifetime is limited to the smallest time-to-live (TTL)
10792 value of the set of returned DNS records.
10793 </para>
10794 </section>
10795 <section id="SECID66">
10796 <title>Pseudo dnsdb record types</title>
10797 <para>
10798 <indexterm role="concept">
10799 <primary>MX record</primary>
10800 <secondary>in <command>dnsdb</command> lookup</secondary>
10801 </indexterm>
10802 By default, both the preference value and the host name are returned for
10803 each MX record, separated by a space. If you want only host names, you can use
10804 the pseudo-type MXH:
10805 </para>
10806 <literallayout class="monospaced">
10807 ${lookup dnsdb{mxh=a.b.example}}
10808 </literallayout>
10809 <para>
10810 In this case, the preference values are omitted, and just the host names are
10811 returned.
10812 </para>
10813 <para>
10814 <indexterm role="concept">
10815 <primary>name server for enclosing domain</primary>
10816 </indexterm>
10817 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10818 records on the given domain, but if none are found, it removes the first
10819 component of the domain name, and tries again. This process continues until NS
10820 records are found or there are no more components left (or there is a DNS
10821 error). In other words, it may return the name servers for a top-level domain,
10822 but it never returns the root name servers. If there are no NS records for the
10823 top-level domain, the lookup fails. Consider these examples:
10824 </para>
10825 <literallayout class="monospaced">
10826 ${lookup dnsdb{zns=xxx.quercite.com}}
10827 ${lookup dnsdb{zns=xxx.edu}}
10828 </literallayout>
10829 <para>
10830 Assuming that in each case there are no NS records for the full domain name,
10831 the first returns the name servers for <option>quercite.com</option>, and the second returns
10832 the name servers for <option>edu</option>.
10833 </para>
10834 <para>
10835 You should be careful about how you use this lookup because, unless the
10836 top-level domain does not exist, the lookup always returns some host names. The
10837 sort of use to which this might be put is for seeing if the name servers for a
10838 given domain are on a blacklist. You can probably assume that the name servers
10839 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10840 such a list.
10841 </para>
10842 <para>
10843 <indexterm role="concept">
10844 <primary>CSA</primary>
10845 <secondary>in <command>dnsdb</command> lookup</secondary>
10846 </indexterm>
10847 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10848 records according to the CSA rules, which are described in section
10849 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10850 not sufficient because of the extra parent domain search behaviour of CSA. The
10851 result of a successful lookup such as:
10852 </para>
10853 <literallayout class="monospaced">
10854 ${lookup dnsdb {csa=$sender_helo_name}}
10855 </literallayout>
10856 <para>
10857 has two space-separated fields: an authorization code and a target host name.
10858 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10859 authorization required but absent, or <quote>?</quote> for unknown.
10860 </para>
10861 <para>
10862 <indexterm role="concept">
10863 <primary>A+</primary>
10864 <secondary>in <command>dnsdb</command> lookup</secondary>
10865 </indexterm>
10866 The pseudo-type A+ performs an AAAA
10867 and then an A lookup.  All results are returned; defer processing
10868 (see below) is handled separately for each lookup.  Example:
10869 </para>
10870 <literallayout class="monospaced">
10871 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10872 </literallayout>
10873 </section>
10874 <section id="SECID67">
10875 <title>Multiple dnsdb lookups</title>
10876 <para>
10877 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10878 However, you can specify a list of domains or IP addresses in a single
10879 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10880 the default separator, but with the ability to change this. For example:
10881 </para>
10882 <literallayout class="monospaced">
10883 ${lookup dnsdb{one.domain.com:two.domain.com}}
10884 ${lookup dnsdb{a=one.host.com:two.host.com}}
10885 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10886 </literallayout>
10887 <para>
10888 In order to retain backwards compatibility, there is one special case: if
10889 the lookup type is PTR and no change of separator is specified, Exim looks
10890 to see if the rest of the string is precisely one IPv6 address. In this
10891 case, it does not treat it as a list.
10892 </para>
10893 <para>
10894 The data from each lookup is concatenated, with newline separators by default,
10895 in the same way that multiple DNS records for a single item are handled. A
10896 different separator can be specified, as described above.
10897 </para>
10898 </section>
10899 <section id="SECTldap">
10900 <title>More about LDAP</title>
10901 <para>
10902 <indexterm role="concept">
10903 <primary>LDAP</primary>
10904 <secondary>lookup, more about</secondary>
10905 </indexterm>
10906 <indexterm role="concept">
10907 <primary>lookup</primary>
10908 <secondary>LDAP</secondary>
10909 </indexterm>
10910 <indexterm role="concept">
10911 <primary>Solaris</primary>
10912 <secondary>LDAP</secondary>
10913 </indexterm>
10914 The original LDAP implementation came from the University of Michigan; this has
10915 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10916 implementation comes from Netscape, and Solaris 7 and subsequent releases
10917 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10918 the lookup function level, their error handling is different. For this reason
10919 it is necessary to set a compile-time variable when building Exim with LDAP, to
10920 indicate which LDAP library is in use. One of the following should appear in
10921 your <filename>Local/Makefile</filename>:
10922 </para>
10923 <literallayout class="monospaced">
10924 LDAP_LIB_TYPE=UMICHIGAN
10925 LDAP_LIB_TYPE=OPENLDAP1
10926 LDAP_LIB_TYPE=OPENLDAP2
10927 LDAP_LIB_TYPE=NETSCAPE
10928 LDAP_LIB_TYPE=SOLARIS
10929 </literallayout>
10930 <para>
10931 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10932 same interface as the University of Michigan version.
10933 </para>
10934 <para>
10935 There are three LDAP lookup types in Exim. These behave slightly differently in
10936 the way they handle the results of a query:
10937 </para>
10938 <itemizedlist>
10939 <listitem>
10940 <para>
10941 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10942 gives an error.
10943 </para>
10944 </listitem>
10945 <listitem>
10946 <para>
10947 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10948 Distinguished Name that is returned rather than any attribute values.
10949 </para>
10950 </listitem>
10951 <listitem>
10952 <para>
10953 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10954 from all of them are returned.
10955 </para>
10956 </listitem>
10957 </itemizedlist>
10958 <para>
10959 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10960 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10961 the data returned by a successful lookup is described in the next section.
10962 First we explain how LDAP queries are coded.
10963 </para>
10964 </section>
10965 <section id="SECTforldaque">
10966 <title>Format of LDAP queries</title>
10967 <para>
10968 <indexterm role="concept">
10969 <primary>LDAP</primary>
10970 <secondary>query format</secondary>
10971 </indexterm>
10972 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10973 the configuration of a <command>redirect</command> router one might have this setting:
10974 </para>
10975 <literallayout class="monospaced">
10976 data = ${lookup ldap \
10977   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10978   c=UK?mailbox?base?}}
10979 </literallayout>
10980 <para>
10981 <indexterm role="concept">
10982 <primary>LDAP</primary>
10983 <secondary>with TLS</secondary>
10984 </indexterm>
10985 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10986 secure (encrypted) LDAP connections. The second of these ensures that an
10987 encrypted TLS connection is used.
10988 </para>
10989 <para>
10990 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10991 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10992 See the <option>ldap_start_tls</option> option.
10993 </para>
10994 <para>
10995 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10996 controlled. Every part of the TLS configuration can be configured by settings in
10997 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10998 your system, some of the initialization may have required setting options in
10999 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11000 certificates. This revealed a nuance where the current UID that exim was
11001 running as could affect which config files it read. With Exim 4.83, these
11002 methods become optional, only taking effect if not specifically set in
11003 <filename>exim.conf</filename>.
11004 </para>
11005 </section>
11006 <section id="SECID68">
11007 <title>LDAP quoting</title>
11008 <para>
11009 <indexterm role="concept">
11010 <primary>LDAP</primary>
11011 <secondary>quoting</secondary>
11012 </indexterm>
11013 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11014 and the second because the LDAP query is represented as a URL. Furthermore,
11015 within an LDAP query, two different kinds of quoting are required. For this
11016 reason, there are two different LDAP-specific quoting operators.
11017 </para>
11018 <para>
11019 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11020 filter specifications. Conceptually, it first does the following conversions on
11021 the string:
11022 </para>
11023 <literallayout class="monospaced">
11024 *   =&gt;   \2A
11025 (   =&gt;   \28
11026 )   =&gt;   \29
11027 \   =&gt;   \5C
11028 </literallayout>
11029 <para>
11030 in accordance with RFC 2254. The resulting string is then quoted according
11031 to the rules for URLs, that is, all non-alphanumeric characters except
11032 </para>
11033 <literallayout class="monospaced">
11034 ! $ ' - . _ ( ) * +
11035 </literallayout>
11036 <para>
11037 are converted to their hex values, preceded by a percent sign. For example:
11038 </para>
11039 <literallayout class="monospaced">
11040 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11041 </literallayout>
11042 <para>
11043 yields
11044 </para>
11045 <literallayout class="monospaced">
11046 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11047 </literallayout>
11048 <para>
11049 Removing the URL quoting, this is (with a leading and a trailing space):
11050 </para>
11051 <literallayout class="monospaced">
11052 a\28bc\29\2A, a&lt;yz&gt;;
11053 </literallayout>
11054 <para>
11055 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11056 base DN specifications in queries. Conceptually, it first converts the string
11057 by inserting a backslash in front of any of the following characters:
11058 </para>
11059 <literallayout class="monospaced">
11060 , + " \ &lt; &gt; ;
11061 </literallayout>
11062 <para>
11063 It also inserts a backslash before any leading spaces or # characters, and
11064 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11065 is then quoted according to the rules for URLs. For example:
11066 </para>
11067 <literallayout class="monospaced">
11068 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11069 </literallayout>
11070 <para>
11071 yields
11072 </para>
11073 <literallayout class="monospaced">
11074 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11075 </literallayout>
11076 <para>
11077 Removing the URL quoting, this is (with a trailing space):
11078 </para>
11079 <literallayout class="monospaced">
11080 \ a(bc)*\, a\&lt;yz\&gt;\;\
11081 </literallayout>
11082 <para>
11083 There are some further comments about quoting in the section on LDAP
11084 authentication below.
11085 </para>
11086 </section>
11087 <section id="SECID69">
11088 <title>LDAP connections</title>
11089 <para>
11090 <indexterm role="concept">
11091 <primary>LDAP</primary>
11092 <secondary>connections</secondary>
11093 </indexterm>
11094 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11095 is in use, via a Unix domain socket. The example given above does not specify
11096 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11097 by starting it with
11098 </para>
11099 <literallayout class="monospaced">
11100 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11101 </literallayout>
11102 <para>
11103 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11104 used. When no server is specified in a query, a list of default servers is
11105 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11106 colon-separated list of servers which are tried in turn until one successfully
11107 handles a query, or there is a serious error. Successful handling either
11108 returns the requested data, or indicates that it does not exist. Serious errors
11109 are syntactical, or multiple values when only a single value is expected.
11110 Errors which cause the next server to be tried are connection failures, bind
11111 failures, and timeouts.
11112 </para>
11113 <para>
11114 For each server name in the list, a port number can be given. The standard way
11115 of specifying a host and port is to use a colon separator (RFC 1738). Because
11116 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11117 doubled. For example
11118 </para>
11119 <literallayout class="monospaced">
11120 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11121 </literallayout>
11122 <para>
11123 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11124 to the LDAP library with no server name, and the library&#x2019;s default (normally
11125 the local host) is used.
11126 </para>
11127 <para>
11128 If you are using the OpenLDAP library, you can connect to an LDAP server using
11129 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11130 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11131 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11132 not available.
11133 </para>
11134 <para>
11135 For this type of connection, instead of a host name for the server, a pathname
11136 for the socket is required, and the port number is not relevant. The pathname
11137 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11138 the query. In the former case, you can have settings such as
11139 </para>
11140 <literallayout class="monospaced">
11141 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11142 </literallayout>
11143 <para>
11144 When the pathname is given in the query, you have to escape the slashes as
11145 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11146 </para>
11147 <literallayout class="monospaced">
11148 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11149 </literallayout>
11150 <para>
11151 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11152 a pathname, it uses the Unix domain socket code, even if the query actually
11153 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11154 socket connection. This behaviour means that you can use a setting of
11155 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11156 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11157 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11158 backup host.
11159 </para>
11160 <para>
11161 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11162 specified, an error is diagnosed. However, if there are more items in
11163 <option>ldap_default_servers</option>, they are tried. In other words:
11164 </para>
11165 <itemizedlist>
11166 <listitem>
11167 <para>
11168 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11169 interface.
11170 </para>
11171 </listitem>
11172 <listitem>
11173 <para>
11174 Using <literal>ldapi</literal> with a host name causes an error.
11175 </para>
11176 </listitem>
11177 </itemizedlist>
11178 <para>
11179 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11180 <option>ldap_default_servers</option>, does whatever the library does by default.
11181 </para>
11182 </section>
11183 <section id="SECID70">
11184 <title>LDAP authentication and control information</title>
11185 <para>
11186 <indexterm role="concept">
11187 <primary>LDAP</primary>
11188 <secondary>authentication</secondary>
11189 </indexterm>
11190 The LDAP URL syntax provides no way of passing authentication and other control
11191 information to the server. To make this possible, the URL in an LDAP query may
11192 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11193 spaces. If a value contains spaces it must be enclosed in double quotes, and
11194 when double quotes are used, backslash is interpreted in the usual way inside
11195 them. The following names are recognized:
11196 </para>
11197 <literallayout>
11198 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11199 <literal>NETTIME    </literal>  set a timeout for a network operation
11200 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11201 <literal>PASS       </literal>  set the password, likewise
11202 <literal>REFERRALS  </literal>  set the referrals parameter
11203 <literal>SERVERS    </literal>  set alternate server list for this query only
11204 <literal>SIZE       </literal>  set the limit for the number of entries returned
11205 <literal>TIME       </literal>  set the maximum waiting time for a query
11206 </literallayout>
11207 <para>
11208 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11209 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11210 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11211 library from trying to follow referrals issued by the LDAP server.
11212 </para>
11213 <para>
11214 <indexterm role="concept">
11215 <primary>LDAP</primary>
11216 <secondary>timeout</secondary>
11217 </indexterm>
11218 <indexterm role="concept">
11219 <primary>timeout</primary>
11220 <secondary>LDAP lookup</secondary>
11221 </indexterm>
11222 The name CONNECT is an obsolete name for NETTIME, retained for
11223 backwards compatibility. This timeout (specified as a number of seconds) is
11224 enforced from the client end for operations that can be carried out over a
11225 network. Specifically, it applies to network connections and calls to the
11226 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11227 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11228 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11229 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11230 Netscape SDK; for OpenLDAP no action is taken.
11231 </para>
11232 <para>
11233 The TIME parameter (also a number of seconds) is passed to the server to
11234 set a server-side limit on the time taken to complete a search.
11235 </para>
11236 <para>
11237 The SERVERS parameter allows you to specify an alternate list of ldap servers
11238 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11239 default list of ldap servers, and a single lookup can specify a single ldap
11240 server to use.  But when you need to do a lookup with a list of servers that is
11241 different than the default list (maybe different order, maybe a completely
11242 different set of servers), the SERVERS parameter allows you to specify this
11243 alternate list (colon-separated).
11244 </para>
11245 <para>
11246 Here is an example of an LDAP query in an Exim lookup that uses some of these
11247 values. This is a single line, folded to fit on the page:
11248 </para>
11249 <literallayout class="monospaced">
11250 ${lookup ldap
11251   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11252   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11253   {$value}fail}
11254 </literallayout>
11255 <para>
11256 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11257 any of the auxiliary data. Exim configuration settings that include lookups
11258 which contain password information should be preceded by <quote>hide</quote> to prevent
11259 non-admin users from using the <option>-bP</option> option to see their values.
11260 </para>
11261 <para>
11262 The auxiliary data items may be given in any order. The default is no
11263 connection timeout (the system timeout is used), no user or password, no limit
11264 on the number of entries returned, and no time limit on queries.
11265 </para>
11266 <para>
11267 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11268 removes any URL quoting that it may contain before passing it LDAP. Apparently
11269 some libraries do this for themselves, but some do not. Removing the URL
11270 quoting has two advantages:
11271 </para>
11272 <itemizedlist>
11273 <listitem>
11274 <para>
11275 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11276 DNs as with DNs inside actual queries.
11277 </para>
11278 </listitem>
11279 <listitem>
11280 <para>
11281 It permits spaces inside USER= DNs.
11282 </para>
11283 </listitem>
11284 </itemizedlist>
11285 <para>
11286 For example, a setting such as
11287 </para>
11288 <literallayout class="monospaced">
11289 USER=cn=${quote_ldap_dn:$1}
11290 </literallayout>
11291 <para>
11292 should work even if <varname>$1</varname> contains spaces.
11293 </para>
11294 <para>
11295 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11296 expansion operator, rather than the LDAP quote operators. The only reason this
11297 field needs quoting is to ensure that it conforms to the Exim syntax, which
11298 does not allow unquoted spaces. For example:
11299 </para>
11300 <literallayout class="monospaced">
11301 PASS=${quote:$3}
11302 </literallayout>
11303 <para>
11304 The LDAP authentication mechanism can be used to check passwords as part of
11305 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11306 <xref linkend="CHAPexpand"/>.
11307 </para>
11308 </section>
11309 <section id="SECID71">
11310 <title>Format of data returned by LDAP</title>
11311 <para>
11312 <indexterm role="concept">
11313 <primary>LDAP</primary>
11314 <secondary>returned data formats</secondary>
11315 </indexterm>
11316 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11317 as a sequence of values, for example
11318 </para>
11319 <literallayout class="monospaced">
11320 cn=manager,o=University of Cambridge,c=UK
11321 </literallayout>
11322 <para>
11323 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11324 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11325 the result between the data from different entries. It is possible for multiple
11326 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11327 you know that whatever values are returned all came from a single entry in the
11328 directory.
11329 </para>
11330 <para>
11331 In the common case where you specify a single attribute in your LDAP query, the
11332 result is not quoted, and does not contain the attribute name. If the attribute
11333 has multiple values, they are separated by commas. Any comma that is
11334 part of an attribute&#x2019;s value is doubled.
11335 </para>
11336 <para>
11337 If you specify multiple attributes, the result contains space-separated, quoted
11338 strings, each preceded by the attribute name and an equals sign. Within the
11339 quotes, the quote character, backslash, and newline are escaped with
11340 backslashes, and commas are used to separate multiple values for the attribute.
11341 Any commas in attribute values are doubled
11342 (permitting treatment of the values as a comma-separated list).
11343 Apart from the escaping, the string within quotes takes the same form as the
11344 output when a single attribute is requested. Specifying no attributes is the
11345 same as specifying all of an entry&#x2019;s attributes.
11346 </para>
11347 <para>
11348 Here are some examples of the output format. The first line of each pair is an
11349 LDAP query, and the second is the data that is returned. The attribute called
11350 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11351 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11352 (they have SUP <option>attr</option> in their schema definitions).
11353 </para>
11354 <literallayout class="monospaced">
11355 ldap:///o=base?attr1?sub?(uid=fred)
11356 value1.1,value1,,2
11357
11358 ldap:///o=base?attr2?sub?(uid=fred)
11359 value two
11360
11361 ldap:///o=base?attr?sub?(uid=fred)
11362 value1.1,value1,,2,value two
11363
11364 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11365 attr1="value1.1,value1,,2" attr2="value two"
11366
11367 ldap:///o=base??sub?(uid=fred)
11368 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11369 </literallayout>
11370 <para>
11371 You can
11372 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11373 results of LDAP lookups.
11374 The <option>extract</option> operator in string expansions can be used to pick out
11375 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11376 The <option>listextract</option> operator should be used to pick out individual values
11377 of attributes, even when only a single value is expected.
11378 The doubling of embedded commas allows you to use the returned data as a
11379 comma separated list (using the "&lt;," syntax for changing the input list separator).
11380 </para>
11381 </section>
11382 <section id="SECTnisplus">
11383 <title>More about NIS+</title>
11384 <para>
11385 <indexterm role="concept">
11386 <primary>NIS+ lookup type</primary>
11387 </indexterm>
11388 <indexterm role="concept">
11389 <primary>lookup</primary>
11390 <secondary>NIS+</secondary>
11391 </indexterm>
11392 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11393 and field name. If this is given, the result of a successful query is the
11394 contents of the named field; otherwise the result consists of a concatenation
11395 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11396 values containing spaces are quoted. For example, the query
11397 </para>
11398 <literallayout class="monospaced">
11399 [name=mg1456],passwd.org_dir
11400 </literallayout>
11401 <para>
11402 might return the string
11403 </para>
11404 <literallayout class="monospaced">
11405 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11406 home=/home/mg1456 shell=/bin/bash shadow=""
11407 </literallayout>
11408 <para>
11409 (split over two lines here to fit on the page), whereas
11410 </para>
11411 <literallayout class="monospaced">
11412 [name=mg1456],passwd.org_dir:gcos
11413 </literallayout>
11414 <para>
11415 would just return
11416 </para>
11417 <literallayout class="monospaced">
11418 Martin Guerre
11419 </literallayout>
11420 <para>
11421 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11422 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11423 operator is to double any quote characters within the text.
11424 </para>
11425 </section>
11426 <section id="SECTsql">
11427 <title>SQL lookups</title>
11428 <para>
11429 <indexterm role="concept">
11430 <primary>SQL lookup types</primary>
11431 </indexterm>
11432 <indexterm role="concept">
11433 <primary>MySQL</primary>
11434 <secondary>lookup type</secondary>
11435 </indexterm>
11436 <indexterm role="concept">
11437 <primary>PostgreSQL lookup type</primary>
11438 </indexterm>
11439 <indexterm role="concept">
11440 <primary>lookup</primary>
11441 <secondary>MySQL</secondary>
11442 </indexterm>
11443 <indexterm role="concept">
11444 <primary>lookup</primary>
11445 <secondary>PostgreSQL</secondary>
11446 </indexterm>
11447 <indexterm role="concept">
11448 <primary>Oracle</primary>
11449 <secondary>lookup type</secondary>
11450 </indexterm>
11451 <indexterm role="concept">
11452 <primary>lookup</primary>
11453 <secondary>Oracle</secondary>
11454 </indexterm>
11455 <indexterm role="concept">
11456 <primary>InterBase lookup type</primary>
11457 </indexterm>
11458 <indexterm role="concept">
11459 <primary>lookup</primary>
11460 <secondary>InterBase</secondary>
11461 </indexterm>
11462 <indexterm role="concept">
11463 <primary>Redis lookup type</primary>
11464 </indexterm>
11465 <indexterm role="concept">
11466 <primary>lookup</primary>
11467 <secondary>Redis</secondary>
11468 </indexterm>
11469 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11470 and SQLite
11471 databases. Queries for these databases contain SQL statements, so an example
11472 might be
11473 </para>
11474 <literallayout class="monospaced">
11475 ${lookup mysql{select mailbox from users where id='userx'}\
11476   {$value}fail}
11477 </literallayout>
11478 <para>
11479 If the result of the query contains more than one field, the data for each
11480 field in the row is returned, preceded by its name, so the result of
11481 </para>
11482 <literallayout class="monospaced">
11483 ${lookup pgsql{select home,name from users where id='userx'}\
11484   {$value}}
11485 </literallayout>
11486 <para>
11487 might be
11488 </para>
11489 <literallayout class="monospaced">
11490 home=/home/userx name="Mister X"
11491 </literallayout>
11492 <para>
11493 Empty values and values containing spaces are double quoted, with embedded
11494 quotes escaped by a backslash. If the result of the query contains just one
11495 field, the value is passed back verbatim, without a field name, for example:
11496 </para>
11497 <literallayout class="monospaced">
11498 Mister X
11499 </literallayout>
11500 <para>
11501 If the result of the query yields more than one row, it is all concatenated,
11502 with a newline between the data for each row.
11503 </para>
11504 </section>
11505 <section id="SECID72">
11506 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11507 <para>
11508 <indexterm role="concept">
11509 <primary>MySQL</primary>
11510 <secondary>lookup type</secondary>
11511 </indexterm>
11512 <indexterm role="concept">
11513 <primary>PostgreSQL lookup type</primary>
11514 </indexterm>
11515 <indexterm role="concept">
11516 <primary>lookup</primary>
11517 <secondary>MySQL</secondary>
11518 </indexterm>
11519 <indexterm role="concept">
11520 <primary>lookup</primary>
11521 <secondary>PostgreSQL</secondary>
11522 </indexterm>
11523 <indexterm role="concept">
11524 <primary>Oracle</primary>
11525 <secondary>lookup type</secondary>
11526 </indexterm>
11527 <indexterm role="concept">
11528 <primary>lookup</primary>
11529 <secondary>Oracle</secondary>
11530 </indexterm>
11531 <indexterm role="concept">
11532 <primary>InterBase lookup type</primary>
11533 </indexterm>
11534 <indexterm role="concept">
11535 <primary>lookup</primary>
11536 <secondary>InterBase</secondary>
11537 </indexterm>
11538 <indexterm role="concept">
11539 <primary>Redis lookup type</primary>
11540 </indexterm>
11541 <indexterm role="concept">
11542 <primary>lookup</primary>
11543 <secondary>Redis</secondary>
11544 </indexterm>
11545 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11546 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11547 or <option>redis_servers</option>
11548 option (as appropriate) must be set to a colon-separated list of server
11549 information.
11550 (For MySQL and PostgreSQL, the global option need not be set if all
11551 queries contain their own server information &ndash; see section
11552 <xref linkend="SECTspeserque"/>.)
11553 For all but Redis
11554 each item in the list is a slash-separated list of four
11555 items: host name, database name, user name, and password. In the case of
11556 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11557 name field is not used and should be empty. For example:
11558 </para>
11559 <literallayout class="monospaced">
11560 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11561 </literallayout>
11562 <para>
11563 Because password data is sensitive, you should always precede the setting with
11564 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11565 option. Here is an example where two MySQL servers are listed:
11566 </para>
11567 <literallayout class="monospaced">
11568 hide mysql_servers = localhost/users/root/secret:\
11569                      otherhost/users/root/othersecret
11570 </literallayout>
11571 <para>
11572 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11573 because this is a colon-separated list, the colon has to be doubled. For each
11574 query, these parameter groups are tried in order until a connection is made and
11575 a query is successfully processed. The result of a query may be that no data is
11576 found, but that is still a successful query. In other words, the list of
11577 servers provides a backup facility, not a list of different places to look.
11578 </para>
11579 <para>
11580 For Redis the global option need not be specified if all queries contain their
11581 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11582 If specified, the option must be set to a colon-separated list of server
11583 information.
11584 Each item in the list is a slash-separated list of three items:
11585 host, database number, and password.
11586 </para>
11587 <orderedlist numeration="arabic">
11588 <listitem>
11589 <para>
11590 The host is required and may be either an IPv4 address and optional
11591 port number (separated by a colon, which needs doubling due to the
11592 higher-level list), or a Unix socket pathname enclosed in parentheses
11593 </para>
11594 </listitem>
11595 <listitem>
11596 <para>
11597 The database number is optional; if present that number is selected in the backend
11598 </para>
11599 </listitem>
11600 <listitem>
11601 <para>
11602 The password is optional; if present it is used to authenticate to the backend
11603 </para>
11604 </listitem>
11605 </orderedlist>
11606 <para>
11607 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11608 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11609 respectively, and the characters single-quote, double-quote, and backslash
11610 itself are escaped with backslashes.
11611 </para>
11612 <para>
11613 The <option>quote_redis</option> expansion operator
11614 escapes whitespace and backslash characters with a backslash.
11615 </para>
11616 </section>
11617 <section id="SECTspeserque">
11618 <title>Specifying the server in the query</title>
11619 <para>
11620 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11621 it is possible to specify a list of servers with an individual query. This is
11622 done by starting the query with
11623 </para>
11624 <literallayout>
11625 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11626 </literallayout>
11627 <para>
11628 Each item in the list may take one of two forms:
11629 </para>
11630 <orderedlist numeration="arabic">
11631 <listitem>
11632 <para>
11633 If it contains no slashes it is assumed to be just a host name. The appropriate
11634 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11635 of the same name, and the remaining parameters (database, user, password) are
11636 taken from there.
11637 </para>
11638 </listitem>
11639 <listitem>
11640 <para>
11641 If it contains any slashes, it is taken as a complete parameter set.
11642 </para>
11643 </listitem>
11644 </orderedlist>
11645 <para>
11646 The list of servers is used in exactly the same way as the global list.
11647 Once a connection to a server has happened and a query has been
11648 successfully executed, processing of the lookup ceases.
11649 </para>
11650 <para>
11651 This feature is intended for use in master/slave situations where updates
11652 are occurring and you want to update the master rather than a slave. If the
11653 master is in the list as a backup for reading, you might have a global setting
11654 like this:
11655 </para>
11656 <literallayout class="monospaced">
11657 mysql_servers = slave1/db/name/pw:\
11658                 slave2/db/name/pw:\
11659                 master/db/name/pw
11660 </literallayout>
11661 <para>
11662 In an updating lookup, you could then write:
11663 </para>
11664 <literallayout class="monospaced">
11665 ${lookup mysql{servers=master; UPDATE ...} }
11666 </literallayout>
11667 <para>
11668 That query would then be sent only to the master server. If, on the other hand,
11669 the master is not to be used for reading, and so is not present in the global
11670 option, you can still update it by a query of this form:
11671 </para>
11672 <literallayout class="monospaced">
11673 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11674 </literallayout>
11675 </section>
11676 <section id="SECID73">
11677 <title>Special MySQL features</title>
11678 <para>
11679 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11680 causes a connection to the server on the local host by means of a Unix domain
11681 socket. An alternate socket can be specified in parentheses.
11682 An option group name for MySQL option files can be specified in square brackets;
11683 the default value is <quote>exim</quote>.
11684 The full syntax of each item in <option>mysql_servers</option> is:
11685 </para>
11686 <literallayout>
11687 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)[&lt;<emphasis>option group</emphasis>&gt;]/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
11688 </literallayout>
11689 <para>
11690 Any of the four sub-parts of the first field can be omitted. For normal use on
11691 the local host it can be left blank or set to just <quote>localhost</quote>.
11692 </para>
11693 <para>
11694 No database need be supplied &ndash; but if it is absent here, it must be given in
11695 the queries.
11696 </para>
11697 <para>
11698 If a MySQL query is issued that does not request any data (an insert, update,
11699 or delete command), the result of the lookup is the number of rows affected.
11700 </para>
11701 <para>
11702 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11703 anything (for example, setting a field to the value it already has), the result
11704 is zero because no rows are affected.
11705 </para>
11706 </section>
11707 <section id="SECID74">
11708 <title>Special PostgreSQL features</title>
11709 <para>
11710 PostgreSQL lookups can also use Unix domain socket connections to the database.
11711 This is usually faster and costs less CPU time than a TCP/IP connection.
11712 However it can be used only if the mail server runs on the same machine as the
11713 database server. A configuration line for PostgreSQL via Unix domain sockets
11714 looks like this:
11715 </para>
11716 <literallayout class="monospaced">
11717 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11718 </literallayout>
11719 <para>
11720 In other words, instead of supplying a host name, a path to the socket is
11721 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11722 visually confused with the delimiters for the other server parameters.
11723 </para>
11724 <para>
11725 If a PostgreSQL query is issued that does not request any data (an insert,
11726 update, or delete command), the result of the lookup is the number of rows
11727 affected.
11728 </para>
11729 </section>
11730 <section id="SECTsqlite">
11731 <title>More about SQLite</title>
11732 <para>
11733 <indexterm role="concept">
11734 <primary>lookup</primary>
11735 <secondary>SQLite</secondary>
11736 </indexterm>
11737 <indexterm role="concept">
11738 <primary>sqlite lookup type</primary>
11739 </indexterm>
11740 SQLite is different to the other SQL lookups because a file name is required in
11741 addition to the SQL query. An SQLite database is a single file, and there is no
11742 daemon as in the other SQL databases. The interface to Exim requires the name
11743 of the file, as an absolute path, to be given at the start of the query. It is
11744 separated from the query by white space. This means that the path name cannot
11745 contain white space. Here is a lookup expansion example:
11746 </para>
11747 <literallayout class="monospaced">
11748 ${lookup sqlite {/some/thing/sqlitedb \
11749   select name from aliases where id='userx';}}
11750 </literallayout>
11751 <para>
11752 In a list, the syntax is similar. For example:
11753 </para>
11754 <literallayout class="monospaced">
11755 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11756    select * from relays where ip='$sender_host_address';
11757 </literallayout>
11758 <para>
11759 The only character affected by the <option>quote_sqlite</option> operator is a single
11760 quote, which it doubles.
11761 </para>
11762 <para>
11763 <indexterm role="concept">
11764 <primary>timeout</primary>
11765 <secondary>SQLite</secondary>
11766 </indexterm>
11767 <indexterm role="concept">
11768 <primary>sqlite</primary>
11769 <secondary>lookup timeout</secondary>
11770 </indexterm>
11771 The SQLite library handles multiple simultaneous accesses to the database
11772 internally. Multiple readers are permitted, but only one process can
11773 update at once. Attempts to access the database while it is being updated
11774 are rejected after a timeout period, during which the SQLite library
11775 waits for the lock to be released. In Exim, the default timeout is set
11776 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11777 option.
11778 </para>
11779 </section>
11780 <section id="SECTredis" revisionflag="changed">
11781 <title>More about Redis</title>
11782 <para revisionflag="changed">
11783 <indexterm role="concept">
11784 <primary>lookup</primary>
11785 <secondary>Redis</secondary>
11786 </indexterm>
11787 <indexterm role="concept">
11788 <primary>redis lookup type</primary>
11789 </indexterm>
11790 Redis is a non-SQL database. Commands are simple get and set.
11791 Examples:
11792 </para>
11793 <literallayout class="monospaced" revisionflag="changed">
11794 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
11795 ${lookup redis{get keyname}}
11796 </literallayout>
11797 <para>
11798 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11799 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11800 </para>
11801 </section>
11802 </chapter>
11803
11804 <chapter id="CHAPdomhosaddlists">
11805 <title>Domain, host, address, and local part lists</title>
11806 <titleabbrev>Domain, host, and address lists</titleabbrev>
11807 <para>
11808 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11809 <primary>lists of domains; hosts; etc.</primary>
11810 </indexterm>
11811 A number of Exim configuration options contain lists of domains, hosts,
11812 email addresses, or local parts. For example, the <option>hold_domains</option> option
11813 contains a list of domains whose delivery is currently suspended. These lists
11814 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11815 arguments to expansion conditions such as <option>match_domain</option>.
11816 </para>
11817 <para>
11818 Each item in one of these lists is a pattern to be matched against a domain,
11819 host, email address, or local part, respectively. In the sections below, the
11820 different types of pattern for each case are described, but first we cover some
11821 general facilities that apply to all four kinds of list.
11822 </para>
11823 <para>
11824 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11825 support all the complexity available in
11826 domain, host, address and local part lists.
11827 </para>
11828 <section id="SECTlistexpand">
11829 <title>Expansion of lists</title>
11830 <para>
11831 <indexterm role="concept">
11832 <primary>expansion</primary>
11833 <secondary>of lists</secondary>
11834 </indexterm>
11835 Each list is expanded as a single string before it is used.
11836 </para>
11837 <para>
11838 <emphasis>Exception: the router headers_remove option, where list-item
11839 splitting is done before string-expansion.</emphasis>
11840 </para>
11841 <para>
11842 The result of
11843 expansion must be a list, possibly containing empty items, which is split up
11844 into separate items for matching. By default, colon is the separator character,
11845 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11846 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11847 discusses the way to specify empty list items.
11848 </para>
11849 <para>
11850 If the string expansion is forced to fail, Exim behaves as if the item it is
11851 testing (domain, host, address, or local part) is not in the list. Other
11852 expansion failures cause temporary errors.
11853 </para>
11854 <para>
11855 If an item in a list is a regular expression, backslashes, dollars and possibly
11856 other special characters in the expression must be protected against
11857 misinterpretation by the string expander. The easiest way to do this is to use
11858 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11859 expression should not be expanded. For example, in an ACL you might have:
11860 </para>
11861 <literallayout class="monospaced">
11862 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11863                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11864 </literallayout>
11865 <para>
11866 The first item is a regular expression that is protected from expansion by
11867 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11868 senders based on the receiving domain.
11869 </para>
11870 </section>
11871 <section id="SECID76">
11872 <title>Negated items in lists</title>
11873 <para>
11874 <indexterm role="concept">
11875 <primary>list</primary>
11876 <secondary>negation</secondary>
11877 </indexterm>
11878 <indexterm role="concept">
11879 <primary>negation</primary>
11880 <secondary>in lists</secondary>
11881 </indexterm>
11882 Items in a list may be positive or negative. Negative items are indicated by a
11883 leading exclamation mark, which may be followed by optional white space. A list
11884 defines a set of items (domains, etc). When Exim processes one of these lists,
11885 it is trying to find out whether a domain, host, address, or local part
11886 (respectively) is in the set that is defined by the list. It works like this:
11887 </para>
11888 <para>
11889 The list is scanned from left to right. If a positive item is matched, the
11890 subject that is being checked is in the set; if a negative item is matched, the
11891 subject is not in the set. If the end of the list is reached without the
11892 subject having matched any of the patterns, it is in the set if the last item
11893 was a negative one, but not if it was a positive one. For example, the list in
11894 </para>
11895 <literallayout class="monospaced">
11896 domainlist relay_to_domains = !a.b.c : *.b.c
11897 </literallayout>
11898 <para>
11899 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11900 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11901 list is positive. However, if the setting were
11902 </para>
11903 <literallayout class="monospaced">
11904 domainlist relay_to_domains = !a.b.c
11905 </literallayout>
11906 <para>
11907 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11908 list is negative. In other words, a list that ends with a negative item behaves
11909 as if it had an extra item <literal>:*</literal> on the end.
11910 </para>
11911 <para>
11912 Another way of thinking about positive and negative items in lists is to read
11913 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11914 item.
11915 </para>
11916 </section>
11917 <section id="SECTfilnamlis">
11918 <title>File names in lists</title>
11919 <para>
11920 <indexterm role="concept">
11921 <primary>list</primary>
11922 <secondary>file name in</secondary>
11923 </indexterm>
11924 If an item in a domain, host, address, or local part list is an absolute file
11925 name (beginning with a slash character), each line of the file is read and
11926 processed as if it were an independent item in the list, except that further
11927 file names are not allowed,
11928 and no expansion of the data from the file takes place.
11929 Empty lines in the file are ignored, and the file may also contain comment
11930 lines:
11931 </para>
11932 <itemizedlist>
11933 <listitem>
11934 <para>
11935 For domain and host lists, if a # character appears anywhere in a line of the
11936 file, it and all following characters are ignored.
11937 </para>
11938 </listitem>
11939 <listitem>
11940 <para>
11941 Because local parts may legitimately contain # characters, a comment in an
11942 address list or local part list file is recognized only if # is preceded by
11943 white space or the start of the line. For example:
11944 </para>
11945 <literallayout class="monospaced">
11946 not#comment@x.y.z   # but this is a comment
11947 </literallayout>
11948 </listitem>
11949 </itemizedlist>
11950 <para>
11951 Putting a file name in a list has the same effect as inserting each line of the
11952 file as an item in the list (blank lines and comments excepted). However, there
11953 is one important difference: the file is read each time the list is processed,
11954 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11955 </para>
11956 <para>
11957 If a file name is preceded by an exclamation mark, the sense of any match
11958 within the file is inverted. For example, if
11959 </para>
11960 <literallayout class="monospaced">
11961 hold_domains = !/etc/nohold-domains
11962 </literallayout>
11963 <para>
11964 and the file contains the lines
11965 </para>
11966 <literallayout class="monospaced">
11967 !a.b.c
11968 *.b.c
11969 </literallayout>
11970 <para>
11971 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11972 any domain matching <literal>*.b.c</literal> is not.
11973 </para>
11974 </section>
11975 <section id="SECID77">
11976 <title>An lsearch file is not an out-of-line list</title>
11977 <para>
11978 As will be described in the sections that follow, lookups can be used in lists
11979 to provide indexed methods of checking list membership. There has been some
11980 confusion about the way <command>lsearch</command> lookups work in lists. Because
11981 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11982 sometimes thought that it is allowed to contain wild cards and other kinds of
11983 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11984 always fixed strings, just as for any other single-key lookup type.
11985 </para>
11986 <para>
11987 If you want to use a file to contain wild-card patterns that form part of a
11988 list, just give the file name on its own, without a search type, as described
11989 in the previous section. You could also use the <command>wildlsearch</command> or
11990 <command>nwildlsearch</command>, but there is no advantage in doing this.
11991 </para>
11992 </section>
11993 <section id="SECTnamedlists">
11994 <title>Named lists</title>
11995 <para>
11996 <indexterm role="concept">
11997 <primary>named lists</primary>
11998 </indexterm>
11999 <indexterm role="concept">
12000 <primary>list</primary>
12001 <secondary>named</secondary>
12002 </indexterm>
12003 A list of domains, hosts, email addresses, or local parts can be given a name
12004 which is then used to refer to the list elsewhere in the configuration. This is
12005 particularly convenient if the same list is required in several different
12006 places. It also allows lists to be given meaningful names, which can improve
12007 the readability of the configuration. For example, it is conventional to define
12008 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12009 locally on a host, using a configuration line such as
12010 </para>
12011 <literallayout class="monospaced">
12012 domainlist local_domains = localhost:my.dom.example
12013 </literallayout>
12014 <para>
12015 Named lists are referenced by giving their name preceded by a plus sign, so,
12016 for example, a router that is intended to handle local domains would be
12017 configured with the line
12018 </para>
12019 <literallayout class="monospaced">
12020 domains = +local_domains
12021 </literallayout>
12022 <para>
12023 The first router in a configuration is often one that handles all domains
12024 except the local ones, using a configuration with a negated item like this:
12025 </para>
12026 <literallayout class="monospaced">
12027 dnslookup:
12028   driver = dnslookup
12029   domains = ! +local_domains
12030   transport = remote_smtp
12031   no_more
12032 </literallayout>
12033 <para>
12034 The four kinds of named list are created by configuration lines starting with
12035 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12036 respectively. Then there follows the name that you are defining, followed by an
12037 equals sign and the list itself. For example:
12038 </para>
12039 <literallayout class="monospaced">
12040 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12041 addresslist bad_senders = cdb;/etc/badsenders
12042 </literallayout>
12043 <para>
12044 A named list may refer to other named lists:
12045 </para>
12046 <literallayout class="monospaced">
12047 domainlist  dom1 = first.example : second.example
12048 domainlist  dom2 = +dom1 : third.example
12049 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12050 </literallayout>
12051 <para>
12052 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12053 effect may not be what you intended, because the negation does not propagate
12054 out to the higher level. For example, consider:
12055 </para>
12056 <literallayout class="monospaced">
12057 domainlist  dom1 = !a.b
12058 domainlist  dom2 = +dom1 : *.b
12059 </literallayout>
12060 <para>
12061 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12062 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12063 means it matches the second list as well. The effect is not the same as
12064 </para>
12065 <literallayout class="monospaced">
12066 domainlist  dom2 = !a.b : *.b
12067 </literallayout>
12068 <para>
12069 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12070 referenced lists if you can.
12071 </para>
12072 <para>
12073 Named lists may have a performance advantage. When Exim is routing an
12074 address or checking an incoming message, it caches the result of tests on named
12075 lists. So, if you have a setting such as
12076 </para>
12077 <literallayout class="monospaced">
12078 domains = +local_domains
12079 </literallayout>
12080 <para>
12081 on several of your routers
12082 or in several ACL statements,
12083 the actual test is done only for the first one. However, the caching works only
12084 if there are no expansions within the list itself or any sublists that it
12085 references. In other words, caching happens only for lists that are known to be
12086 the same each time they are referenced.
12087 </para>
12088 <para>
12089 By default, there may be up to 16 named lists of each type. This limit can be
12090 extended by changing a compile-time variable. The use of domain and host lists
12091 is recommended for concepts such as local domains, relay domains, and relay
12092 hosts. The default configuration is set up like this.
12093 </para>
12094 </section>
12095 <section id="SECID78">
12096 <title>Named lists compared with macros</title>
12097 <para>
12098 <indexterm role="concept">
12099 <primary>list</primary>
12100 <secondary>named compared with macro</secondary>
12101 </indexterm>
12102 <indexterm role="concept">
12103 <primary>macro</primary>
12104 <secondary>compared with named list</secondary>
12105 </indexterm>
12106 At first sight, named lists might seem to be no different from macros in the
12107 configuration file. However, macros are just textual substitutions. If you
12108 write
12109 </para>
12110 <literallayout class="monospaced">
12111 ALIST = host1 : host2
12112 auth_advertise_hosts = !ALIST
12113 </literallayout>
12114 <para>
12115 it probably won&#x2019;t do what you want, because that is exactly the same as
12116 </para>
12117 <literallayout class="monospaced">
12118 auth_advertise_hosts = !host1 : host2
12119 </literallayout>
12120 <para>
12121 Notice that the second host name is not negated. However, if you use a host
12122 list, and write
12123 </para>
12124 <literallayout class="monospaced">
12125 hostlist alist = host1 : host2
12126 auth_advertise_hosts = ! +alist
12127 </literallayout>
12128 <para>
12129 the negation applies to the whole list, and so that is equivalent to
12130 </para>
12131 <literallayout class="monospaced">
12132 auth_advertise_hosts = !host1 : !host2
12133 </literallayout>
12134 </section>
12135 <section id="SECID79">
12136 <title>Named list caching</title>
12137 <para>
12138 <indexterm role="concept">
12139 <primary>list</primary>
12140 <secondary>caching of named</secondary>
12141 </indexterm>
12142 <indexterm role="concept">
12143 <primary>caching</primary>
12144 <secondary>named lists</secondary>
12145 </indexterm>
12146 While processing a message, Exim caches the result of checking a named list if
12147 it is sure that the list is the same each time. In practice, this means that
12148 the cache operates only if the list contains no $ characters, which guarantees
12149 that it will not change when it is expanded. Sometimes, however, you may have
12150 an expanded list that you know will be the same each time within a given
12151 message. For example:
12152 </para>
12153 <literallayout class="monospaced">
12154 domainlist special_domains = \
12155            ${lookup{$sender_host_address}cdb{/some/file}}
12156 </literallayout>
12157 <para>
12158 This provides a list of domains that depends only on the sending host&#x2019;s IP
12159 address. If this domain list is referenced a number of times (for example,
12160 in several ACL lines, or in several routers) the result of the check is not
12161 cached by default, because Exim does not know that it is going to be the
12162 same list each time.
12163 </para>
12164 <para>
12165 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12166 cache the result anyway. For example:
12167 </para>
12168 <literallayout class="monospaced">
12169 domainlist_cache special_domains = ${lookup{...
12170 </literallayout>
12171 <para>
12172 If you do this, you should be absolutely sure that caching is going to do
12173 the right thing in all cases. When in doubt, leave it out.
12174 </para>
12175 </section>
12176 <section id="SECTdomainlist">
12177 <title>Domain lists</title>
12178 <para>
12179 <indexterm role="concept">
12180 <primary>domain list</primary>
12181 <secondary>patterns for</secondary>
12182 </indexterm>
12183 <indexterm role="concept">
12184 <primary>list</primary>
12185 <secondary>domain list</secondary>
12186 </indexterm>
12187 Domain lists contain patterns that are to be matched against a mail domain.
12188 The following types of item may appear in domain lists:
12189 </para>
12190 <itemizedlist>
12191 <listitem>
12192 <para>
12193 <indexterm role="concept">
12194 <primary>primary host name</primary>
12195 </indexterm>
12196 <indexterm role="concept">
12197 <primary>host name</primary>
12198 <secondary>matched in domain list</secondary>
12199 </indexterm>
12200 <indexterm role="option">
12201 <primary><option>primary_hostname</option></primary>
12202 </indexterm>
12203 <indexterm role="concept">
12204 <primary>domain list</primary>
12205 <secondary>matching primary host name</secondary>
12206 </indexterm>
12207 <indexterm role="concept">
12208 <primary>@ in a domain list</primary>
12209 </indexterm>
12210 If a pattern consists of a single @ character, it matches the local host name,
12211 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12212 possible to use the same configuration file on several different hosts that
12213 differ only in their names.
12214 </para>
12215 </listitem>
12216 <listitem>
12217 <para>
12218 <indexterm role="concept">
12219 <primary>@[] in a domain list</primary>
12220 </indexterm>
12221 <indexterm role="concept">
12222 <primary>domain list</primary>
12223 <secondary>matching local IP interfaces</secondary>
12224 </indexterm>
12225 <indexterm role="concept">
12226 <primary>domain literal</primary>
12227 </indexterm>
12228 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12229 in square brackets (as in an email address that contains a domain literal), but
12230 only if that IP address is recognized as local for email routing purposes. The
12231 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12232 control which of a host&#x2019;s several IP addresses are treated as local.
12233 In today&#x2019;s Internet, the use of domain literals is controversial.
12234 </para>
12235 </listitem>
12236 <listitem>
12237 <para>
12238 <indexterm role="concept">
12239 <primary>@mx_any</primary>
12240 </indexterm>
12241 <indexterm role="concept">
12242 <primary>@mx_primary</primary>
12243 </indexterm>
12244 <indexterm role="concept">
12245 <primary>@mx_secondary</primary>
12246 </indexterm>
12247 <indexterm role="concept">
12248 <primary>domain list</primary>
12249 <secondary>matching MX pointers to local host</secondary>
12250 </indexterm>
12251 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12252 has an MX record pointing to the local host or to any host that is listed in
12253 <indexterm role="option">
12254 <primary><option>hosts_treat_as_local</option></primary>
12255 </indexterm>
12256 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12257 are similar, except that the first matches only when a primary MX target is the
12258 local host, and the second only when no primary MX target is the local host,
12259 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12260 preference value &ndash; there may of course be more than one of them.
12261 </para>
12262 <para>
12263 The MX lookup that takes place when matching a pattern of this type is
12264 performed with the resolver options for widening names turned off. Thus, for
12265 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12266 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12267 options of the <command>dnslookup</command> router for a discussion of domain widening.
12268 </para>
12269 <para>
12270 Sometimes you may want to ignore certain IP addresses when using one of these
12271 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12272 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12273 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12274 on a router). For example:
12275 </para>
12276 <literallayout class="monospaced">
12277 domains = @mx_any/ignore=127.0.0.1
12278 </literallayout>
12279 <para>
12280 This example matches any domain that has an MX record pointing to one of
12281 the local host&#x2019;s IP addresses other than 127.0.0.1.
12282 </para>
12283 <para>
12284 The list of IP addresses is in fact processed by the same code that processes
12285 host lists, so it may contain CIDR-coded network specifications and it may also
12286 contain negative items.
12287 </para>
12288 <para>
12289 Because the list of IP addresses is a sublist within a domain list, you have to
12290 be careful about delimiters if there is more than one address. Like any other
12291 list, the default delimiter can be changed. Thus, you might have:
12292 </para>
12293 <literallayout class="monospaced">
12294 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12295           an.other.domain : ...
12296 </literallayout>
12297 <para>
12298 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12299 involved, it is easiest to change the delimiter for the main list as well:
12300 </para>
12301 <literallayout class="monospaced">
12302 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12303           an.other.domain ? ...
12304 </literallayout>
12305 </listitem>
12306 <listitem>
12307 <para>
12308 <indexterm role="concept">
12309 <primary>asterisk</primary>
12310 <secondary>in domain list</secondary>
12311 </indexterm>
12312 <indexterm role="concept">
12313 <primary>domain list</primary>
12314 <secondary>asterisk in</secondary>
12315 </indexterm>
12316 <indexterm role="concept">
12317 <primary>domain list</primary>
12318 <secondary>matching <quote>ends with</quote></secondary>
12319 </indexterm>
12320 If a pattern starts with an asterisk, the remaining characters of the pattern
12321 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12322 domain lists differs from its use in partial matching lookups. In a domain
12323 list, the character following the asterisk need not be a dot, whereas partial
12324 matching works only in terms of dot-separated components. For example, a domain
12325 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12326 <emphasis>cipher.key.ex</emphasis>.
12327 </para>
12328 </listitem>
12329 <listitem>
12330 <para>
12331 <indexterm role="concept">
12332 <primary>regular expressions</primary>
12333 <secondary>in domain list</secondary>
12334 </indexterm>
12335 <indexterm role="concept">
12336 <primary>domain list</primary>
12337 <secondary>matching regular expression</secondary>
12338 </indexterm>
12339 If a pattern starts with a circumflex character, it is treated as a regular
12340 expression, and matched against the domain using a regular expression matching
12341 function. The circumflex is treated as part of the regular expression.
12342 Email domains are case-independent, so this regular expression match is by
12343 default case-independent, but you can make it case-dependent by starting it
12344 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12345 are given in chapter <xref linkend="CHAPregexp"/>.
12346 </para>
12347 <para>
12348 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12349 must escape any backslash and dollar characters in the regular expression, or
12350 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12351 it is not to be expanded (unless you really do want to build a regular
12352 expression by expansion, of course).
12353 </para>
12354 </listitem>
12355 <listitem>
12356 <para>
12357 <indexterm role="concept">
12358 <primary>lookup</primary>
12359 <secondary>in domain list</secondary>
12360 </indexterm>
12361 <indexterm role="concept">
12362 <primary>domain list</primary>
12363 <secondary>matching by lookup</secondary>
12364 </indexterm>
12365 If a pattern starts with the name of a single-key lookup type followed by a
12366 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12367 must be a file name in a suitable format for the lookup type. For example, for
12368 <quote>cdb;</quote> it must be an absolute path:
12369 </para>
12370 <literallayout class="monospaced">
12371 domains = cdb;/etc/mail/local_domains.cdb
12372 </literallayout>
12373 <para>
12374 The appropriate type of lookup is done on the file using the domain name as the
12375 key. In most cases, the data that is looked up is not used; Exim is interested
12376 only in whether or not the key is present in the file. However, when a lookup
12377 is used for the <option>domains</option> option on a router
12378 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12379 <varname>$domain_data</varname> variable and can be referred to in other router options or
12380 other statements in the same ACL.
12381 </para>
12382 </listitem>
12383 <listitem>
12384 <para>
12385 Any of the single-key lookup type names may be preceded by
12386 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12387 </para>
12388 <literallayout class="monospaced">
12389 domains = partial-dbm;/partial/domains
12390 </literallayout>
12391 <para>
12392 This causes partial matching logic to be invoked; a description of how this
12393 works is given in section <xref linkend="SECTpartiallookup"/>.
12394 </para>
12395 </listitem>
12396 <listitem>
12397 <para>
12398 <indexterm role="concept">
12399 <primary>asterisk</primary>
12400 <secondary>in lookup type</secondary>
12401 </indexterm>
12402 Any of the single-key lookup types may be followed by an asterisk. This causes
12403 a default lookup for a key consisting of a single asterisk to be done if the
12404 original lookup fails. This is not a useful feature when using a domain list to
12405 select particular domains (because any domain would match), but it might have
12406 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12407 expansion variable.
12408 </para>
12409 </listitem>
12410 <listitem>
12411 <para>
12412 If the pattern starts with the name of a query-style lookup type followed by a
12413 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12414 pattern must be an appropriate query for the lookup type, as described in
12415 chapter <xref linkend="CHAPfdlookup"/>. For example:
12416 </para>
12417 <literallayout class="monospaced">
12418 hold_domains = mysql;select domain from holdlist \
12419   where domain = '${quote_mysql:$domain}';
12420 </literallayout>
12421 <para>
12422 In most cases, the data that is looked up is not used (so for an SQL query, for
12423 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12424 whether or not the query succeeds. However, when a lookup is used for the
12425 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12426 variable and can be referred to in other options.
12427 </para>
12428 </listitem>
12429 <listitem>
12430 <para>
12431 <indexterm role="concept">
12432 <primary>domain list</primary>
12433 <secondary>matching literal domain name</secondary>
12434 </indexterm>
12435 If none of the above cases apply, a caseless textual comparison is made
12436 between the pattern and the domain.
12437 </para>
12438 </listitem>
12439 </itemizedlist>
12440 <para>
12441 Here is an example that uses several different kinds of pattern:
12442 </para>
12443 <literallayout class="monospaced">
12444 domainlist funny_domains = \
12445   @ : \
12446   lib.unseen.edu : \
12447   *.foundation.fict.example : \
12448   \N^[1-2]\d{3}\.fict\.example$\N : \
12449   partial-dbm;/opt/data/penguin/book : \
12450   nis;domains.byname : \
12451   nisplus;[name=$domain,status=local],domains.org_dir
12452 </literallayout>
12453 <para>
12454 There are obvious processing trade-offs among the various matching modes. Using
12455 an asterisk is faster than a regular expression, and listing a few names
12456 explicitly probably is too. The use of a file or database lookup is expensive,
12457 but may be the only option if hundreds of names are required. Because the
12458 patterns are tested in order, it makes sense to put the most commonly matched
12459 patterns earlier.
12460 </para>
12461 </section>
12462 <section id="SECThostlist">
12463 <title>Host lists</title>
12464 <para>
12465 <indexterm role="concept">
12466 <primary>host list</primary>
12467 <secondary>patterns in</secondary>
12468 </indexterm>
12469 <indexterm role="concept">
12470 <primary>list</primary>
12471 <secondary>host list</secondary>
12472 </indexterm>
12473 Host lists are used to control what remote hosts are allowed to do. For
12474 example, some hosts may be allowed to use the local host as a relay, and some
12475 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12476 two different ways, by name or by IP address. In a host list, some types of
12477 pattern are matched to a host name, and some are matched to an IP address.
12478 You need to be particularly careful with this when single-key lookups are
12479 involved, to ensure that the right value is being used as the key.
12480 </para>
12481 </section>
12482 <section id="SECID80">
12483 <title>Special host list patterns</title>
12484 <para>
12485 <indexterm role="concept">
12486 <primary>empty item in hosts list</primary>
12487 </indexterm>
12488 <indexterm role="concept">
12489 <primary>host list</primary>
12490 <secondary>empty string in</secondary>
12491 </indexterm>
12492 If a host list item is the empty string, it matches only when no remote host is
12493 involved. This is the case when a message is being received from a local
12494 process using SMTP on the standard input, that is, when a TCP/IP connection is
12495 not used.
12496 </para>
12497 <para>
12498 <indexterm role="concept">
12499 <primary>asterisk</primary>
12500 <secondary>in host list</secondary>
12501 </indexterm>
12502 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12503 the IP address nor the name is actually inspected.
12504 </para>
12505 </section>
12506 <section id="SECThoslispatip">
12507 <title>Host list patterns that match by IP address</title>
12508 <para>
12509 <indexterm role="concept">
12510 <primary>host list</primary>
12511 <secondary>matching IP addresses</secondary>
12512 </indexterm>
12513 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12514 the incoming address actually appears in the IPv6 host as
12515 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12516 list, it is converted into a traditional IPv4 address first. (Not all operating
12517 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12518 concerns.)
12519 </para>
12520 <para>
12521 The following types of pattern in a host list check the remote host by
12522 inspecting its IP address:
12523 </para>
12524 <itemizedlist>
12525 <listitem>
12526 <para>
12527 If the pattern is a plain domain name (not a regular expression, not starting
12528 with *, not a lookup of any kind), Exim calls the operating system function
12529 to find the associated IP address(es). Exim uses the newer
12530 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12531 This typically causes a forward DNS lookup of the name. The result is compared
12532 with the IP address of the subject host.
12533 </para>
12534 <para>
12535 If there is a temporary problem (such as a DNS timeout) with the host name
12536 lookup, a temporary error occurs. For example, if the list is being used in an
12537 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12538 temporary SMTP error code. If no IP address can be found for the host name,
12539 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12540 </para>
12541 </listitem>
12542 <listitem>
12543 <para>
12544 <indexterm role="concept">
12545 <primary>@ in a host list</primary>
12546 </indexterm>
12547 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12548 domain name, as just described.
12549 </para>
12550 </listitem>
12551 <listitem>
12552 <para>
12553 If the pattern is an IP address, it is matched against the IP address of the
12554 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12555 IPv6 addresses can be given in colon-separated format, but the colons have to
12556 be doubled so as not to be taken as item separators when the default list
12557 separator is used. IPv6 addresses are recognized even when Exim is compiled
12558 without IPv6 support. This means that if they appear in a host list on an
12559 IPv4-only host, Exim will not treat them as host names. They are just addresses
12560 that can never match a client host.
12561 </para>
12562 </listitem>
12563 <listitem>
12564 <para>
12565 <indexterm role="concept">
12566 <primary>@[] in a host list</primary>
12567 </indexterm>
12568 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12569 the local host. For example, if the local host is an IPv4 host with one
12570 interface address 10.45.23.56, these two ACL statements have the same effect:
12571 </para>
12572 <literallayout class="monospaced">
12573 accept hosts = 127.0.0.1 : 10.45.23.56
12574 accept hosts = @[]
12575 </literallayout>
12576 </listitem>
12577 <listitem>
12578 <para>
12579 <indexterm role="concept">
12580 <primary>CIDR notation</primary>
12581 </indexterm>
12582 If the pattern is an IP address followed by a slash and a mask length (for
12583 example 10.11.42.0/24), it is matched against the IP address of the subject
12584 host under the given mask. This allows, an entire network of hosts to be
12585 included (or excluded) by a single item. The mask uses CIDR notation; it
12586 specifies the number of address bits that must match, starting from the most
12587 significant end of the address.
12588 </para>
12589 <para>
12590 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12591 of a range of addresses. It is the number of bits in the network portion of the
12592 address. The above example specifies a 24-bit netmask, so it matches all 256
12593 addresses in the 10.11.42.0 network. An item such as
12594 </para>
12595 <literallayout class="monospaced">
12596 192.168.23.236/31
12597 </literallayout>
12598 <para>
12599 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12600 32 for an IPv4 address is the same as no mask at all; just a single address
12601 matches.
12602 </para>
12603 <para>
12604 Here is another example which shows an IPv4 and an IPv6 network:
12605 </para>
12606 <literallayout class="monospaced">
12607 recipient_unqualified_hosts = 192.168.0.0/16: \
12608                               3ffe::ffff::836f::::/48
12609 </literallayout>
12610 <para>
12611 The doubling of list separator characters applies only when these items
12612 appear inline in a host list. It is not required when indirecting via a file.
12613 For example:
12614 </para>
12615 <literallayout class="monospaced">
12616 recipient_unqualified_hosts = /opt/exim/unqualnets
12617 </literallayout>
12618 <para>
12619 could make use of a file containing
12620 </para>
12621 <literallayout class="monospaced">
12622 172.16.0.0/12
12623 3ffe:ffff:836f::/48
12624 </literallayout>
12625 <para>
12626 to have exactly the same effect as the previous example. When listing IPv6
12627 addresses inline, it is usually more convenient to use the facility for
12628 changing separator characters. This list contains the same two networks:
12629 </para>
12630 <literallayout class="monospaced">
12631 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12632                                  3ffe:ffff:836f::/48
12633 </literallayout>
12634 <para>
12635 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12636 list.
12637 </para>
12638 </listitem>
12639 </itemizedlist>
12640 </section>
12641 <section id="SECThoslispatsikey">
12642 <title>Host list patterns for single-key lookups by host address</title>
12643 <para>
12644 <indexterm role="concept">
12645 <primary>host list</primary>
12646 <secondary>lookup of IP address</secondary>
12647 </indexterm>
12648 When a host is to be identified by a single-key lookup of its complete IP
12649 address, the pattern takes this form:
12650 </para>
12651 <literallayout>
12652 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12653 </literallayout>
12654 <para>
12655 For example:
12656 </para>
12657 <literallayout class="monospaced">
12658 hosts_lookup = net-cdb;/hosts-by-ip.db
12659 </literallayout>
12660 <para>
12661 The text form of the IP address of the subject host is used as the lookup key.
12662 IPv6 addresses are converted to an unabbreviated form, using lower case
12663 letters, with dots as separators because colon is the key terminator in
12664 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12665 quoting the keys, but this is a facility that was added later.] The data
12666 returned by the lookup is not used.
12667 </para>
12668 <para>
12669 <indexterm role="concept">
12670 <primary>IP address</primary>
12671 <secondary>masking</secondary>
12672 </indexterm>
12673 <indexterm role="concept">
12674 <primary>host list</primary>
12675 <secondary>masked IP address</secondary>
12676 </indexterm>
12677 Single-key lookups can also be performed using masked IP addresses, using
12678 patterns of this form:
12679 </para>
12680 <literallayout>
12681 <literal>net&lt;</literal><emphasis>number</emphasis><literal>&gt;-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12682 </literallayout>
12683 <para>
12684 For example:
12685 </para>
12686 <literallayout class="monospaced">
12687 net24-dbm;/networks.db
12688 </literallayout>
12689 <para>
12690 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12691 length. A textual string is constructed from the masked value, followed by the
12692 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12693 is 192.168.34.6, the key that is looked up for the above example is
12694 <quote>192.168.34.0/24</quote>.
12695 </para>
12696 <para>
12697 When an IPv6 address is converted to a string, dots are normally used instead
12698 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12699 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12700 to quote keys was made available in <command>lsearch</command> files. However, the more
12701 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12702 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12703 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12704 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12705 addresses are always used.
12706 </para>
12707 <para>
12708 Ideally, it would be nice to tidy up this anomalous situation by changing to
12709 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12710 However, this would be an incompatible change that might break some existing
12711 configurations.
12712 </para>
12713 <para>
12714 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12715 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12716 the former case the key strings include the mask value, whereas in the latter
12717 case the IP address is used on its own.
12718 </para>
12719 </section>
12720 <section id="SECThoslispatnam">
12721 <title>Host list patterns that match by host name</title>
12722 <para>
12723 <indexterm role="concept">
12724 <primary>host</primary>
12725 <secondary>lookup failures</secondary>
12726 </indexterm>
12727 <indexterm role="concept">
12728 <primary>unknown host name</primary>
12729 </indexterm>
12730 <indexterm role="concept">
12731 <primary>host list</primary>
12732 <secondary>matching host name</secondary>
12733 </indexterm>
12734 There are several types of pattern that require Exim to know the name of the
12735 remote host. These are either wildcard patterns or lookups by name. (If a
12736 complete hostname is given without any wildcarding, it is used to find an IP
12737 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12738 above.)
12739 </para>
12740 <para>
12741 If the remote host name is not already known when Exim encounters one of these
12742 patterns, it has to be found from the IP address.
12743 Although many sites on the Internet are conscientious about maintaining reverse
12744 DNS data for their hosts, there are also many that do not do this.
12745 Consequently, a name cannot always be found, and this may lead to unwanted
12746 effects. Take care when configuring host lists with wildcarded name patterns.
12747 Consider what will happen if a name cannot be found.
12748 </para>
12749 <para>
12750 Because of the problems of determining host names from IP addresses, matching
12751 against host names is not as common as matching against IP addresses.
12752 </para>
12753 <para>
12754 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12755 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12756 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12757 are done can be changed by setting the <option>host_lookup_order</option> option. For
12758 security, once Exim has found one or more names, it looks up the IP addresses
12759 for these names and compares them with the IP address that it started with.
12760 Only those names whose IP addresses match are accepted. Any other names are
12761 discarded. If no names are left, Exim behaves as if the host name cannot be
12762 found. In the most common case there is only one name and one IP address.
12763 </para>
12764 <para>
12765 There are some options that control what happens if a host name cannot be
12766 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12767 </para>
12768 <para>
12769 <indexterm role="concept">
12770 <primary>host</primary>
12771 <secondary>alias for</secondary>
12772 </indexterm>
12773 <indexterm role="concept">
12774 <primary>alias for host</primary>
12775 </indexterm>
12776 As a result of aliasing, hosts may have more than one name. When processing any
12777 of the following types of pattern, all the host&#x2019;s names are checked:
12778 </para>
12779 <itemizedlist>
12780 <listitem>
12781 <para>
12782 <indexterm role="concept">
12783 <primary>asterisk</primary>
12784 <secondary>in host list</secondary>
12785 </indexterm>
12786 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12787 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12788 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12789 requirement. Other kinds of wildcarding require the use of a regular
12790 expression.
12791 </para>
12792 </listitem>
12793 <listitem>
12794 <para>
12795 <indexterm role="concept">
12796 <primary>regular expressions</primary>
12797 <secondary>in host list</secondary>
12798 </indexterm>
12799 <indexterm role="concept">
12800 <primary>host list</primary>
12801 <secondary>regular expression in</secondary>
12802 </indexterm>
12803 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12804 matched against the host name. Host names are case-independent, so this regular
12805 expression match is by default case-independent, but you can make it
12806 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12807 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12808 example,
12809 </para>
12810 <literallayout class="monospaced">
12811 ^(a|b)\.c\.d$
12812 </literallayout>
12813 <para>
12814 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12815 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12816 that backslash and dollar characters are not misinterpreted as part of the
12817 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12818 part of the string as non-expandable. For example:
12819 </para>
12820 <literallayout class="monospaced">
12821 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12822 </literallayout>
12823 <para>
12824 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12825 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12826 example. Without it, a match at the start of the host name is all that is
12827 required.
12828 </para>
12829 </listitem>
12830 </itemizedlist>
12831 </section>
12832 <section id="SECTbehipnot">
12833 <title>Behaviour when an IP address or name cannot be found</title>
12834 <para>
12835 <indexterm role="concept">
12836 <primary>host</primary>
12837 <secondary>lookup failures, permanent</secondary>
12838 </indexterm>
12839 While processing a host list, Exim may need to look up an IP address from a
12840 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12841 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12842 behaviour when it fails to find the information it is seeking is the same.
12843 </para>
12844 <para>
12845 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12846 apply to temporary DNS errors, whose handling is described in the next section.
12847 </para>
12848 <para>
12849 <indexterm role="concept">
12850 <primary><literal>+include_unknown</literal></primary>
12851 </indexterm>
12852 <indexterm role="concept">
12853 <primary><literal>+ignore_unknown</literal></primary>
12854 </indexterm>
12855 Exim parses a host list from left to right. If it encounters a permanent
12856 lookup failure in any item in the host list before it has found a match,
12857 Exim treats it as a failure and the default behavior is as if the host
12858 does not match the list. This may not always be what you want to happen.
12859 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12860 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12861 not recognized in an indirected file).
12862 </para>
12863 <itemizedlist>
12864 <listitem>
12865 <para>
12866 If any item that follows <literal>+include_unknown</literal> requires information that
12867 cannot found, Exim behaves as if the host does match the list. For example,
12868 </para>
12869 <literallayout class="monospaced">
12870 host_reject_connection = +include_unknown:*.enemy.ex
12871 </literallayout>
12872 <para>
12873 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12874 any hosts whose name it cannot find.
12875 </para>
12876 </listitem>
12877 <listitem>
12878 <para>
12879 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12880 be found, Exim ignores that item and proceeds to the rest of the list. For
12881 example:
12882 </para>
12883 <literallayout class="monospaced">
12884 accept hosts = +ignore_unknown : friend.example : \
12885                192.168.4.5
12886 </literallayout>
12887 <para>
12888 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12889 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12890 name can be found for 192.168.4.5, it is rejected.
12891 </para>
12892 </listitem>
12893 </itemizedlist>
12894 <para>
12895 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12896 list. The effect of each one lasts until the next, or until the end of the
12897 list.
12898 </para>
12899 </section>
12900 <section id="SECTmixwilhos">
12901 <title>Mixing wildcarded host names and addresses in host lists</title>
12902 <para>
12903 <indexterm role="concept">
12904 <primary>host list</primary>
12905 <secondary>mixing names and addresses in</secondary>
12906 </indexterm>
12907 </para>
12908 <para>
12909 This section explains the host/ip processing logic with the same concepts
12910 as the previous section, but specifically addresses what happens when a
12911 wildcarded hostname is one of the items in the hostlist.
12912 </para>
12913 <itemizedlist>
12914 <listitem>
12915 <para>
12916 If you have name lookups or wildcarded host names and
12917 IP addresses in the same host list, you should normally put the IP
12918 addresses first. For example, in an ACL you could have:
12919 </para>
12920 <literallayout class="monospaced">
12921 accept hosts = 10.9.8.7 : *.friend.example
12922 </literallayout>
12923 <para>
12924 The reason you normally would order it this way lies in the
12925 left-to-right way that Exim processes lists.  It can test IP addresses
12926 without doing any DNS lookups, but when it reaches an item that requires
12927 a host name, it fails if it cannot find a host name to compare with the
12928 pattern. If the above list is given in the opposite order, the
12929 <option>accept</option> statement fails for a host whose name cannot be found, even
12930 if its IP address is 10.9.8.7.
12931 </para>
12932 </listitem>
12933 <listitem>
12934 <para>
12935 If you really do want to do the name check first, and still recognize the IP
12936 address, you can rewrite the ACL like this:
12937 </para>
12938 <literallayout class="monospaced">
12939 accept hosts = *.friend.example
12940 accept hosts = 10.9.8.7
12941 </literallayout>
12942 <para>
12943 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12944 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12945 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12946 this section.
12947 </para>
12948 </listitem>
12949 </itemizedlist>
12950 </section>
12951 <section id="SECTtemdnserr">
12952 <title>Temporary DNS errors when looking up host information</title>
12953 <para>
12954 <indexterm role="concept">
12955 <primary>host</primary>
12956 <secondary>lookup failures, temporary</secondary>
12957 </indexterm>
12958 <indexterm role="concept">
12959 <primary><literal>+include_defer</literal></primary>
12960 </indexterm>
12961 <indexterm role="concept">
12962 <primary><literal>+ignore_defer</literal></primary>
12963 </indexterm>
12964 A temporary DNS lookup failure normally causes a defer action (except when
12965 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12966 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12967 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12968 section. These options should be used with care, probably only in non-critical
12969 host lists such as whitelists.
12970 </para>
12971 </section>
12972 <section id="SECThoslispatnamsk">
12973 <title>Host list patterns for single-key lookups by host name</title>
12974 <para>
12975 <indexterm role="concept">
12976 <primary>unknown host name</primary>
12977 </indexterm>
12978 <indexterm role="concept">
12979 <primary>host list</primary>
12980 <secondary>matching host name</secondary>
12981 </indexterm>
12982 If a pattern is of the form
12983 </para>
12984 <literallayout>
12985 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12986 </literallayout>
12987 <para>
12988 for example
12989 </para>
12990 <literallayout class="monospaced">
12991 dbm;/host/accept/list
12992 </literallayout>
12993 <para>
12994 a single-key lookup is performed, using the host name as its key. If the
12995 lookup succeeds, the host matches the item. The actual data that is looked up
12996 is not used.
12997 </para>
12998 <para>
12999 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13000 keys in the file, not IP addresses. If you want to do lookups based on IP
13001 addresses, you must precede the search type with <quote>net-</quote> (see section
13002 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13003 two items in the same list, one doing an address lookup and one doing a name
13004 lookup, both using the same file.
13005 </para>
13006 </section>
13007 <section id="SECID81">
13008 <title>Host list patterns for query-style lookups</title>
13009 <para>
13010 If a pattern is of the form
13011 </para>
13012 <literallayout>
13013 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13014 </literallayout>
13015 <para>
13016 the query is obeyed, and if it succeeds, the host matches the item. The actual
13017 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13018 <varname>$sender_host_name</varname> can be used in the query. For example:
13019 </para>
13020 <literallayout class="monospaced">
13021 hosts_lookup = pgsql;\
13022   select ip from hostlist where ip='$sender_host_address'
13023 </literallayout>
13024 <para>
13025 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13026 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13027 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13028 operator.
13029 </para>
13030 <para>
13031 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13032 looks up the host name if it has not already done so. (See section
13033 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13034 </para>
13035 <para>
13036 Historical note: prior to release 4.30, Exim would always attempt to find a
13037 host name before running the query, unless the search type was preceded by
13038 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13039 still recognized for query-style lookups, but its presence or absence has no
13040 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13041 See section <xref linkend="SECThoslispatsikey"/>.)
13042 </para>
13043 </section>
13044 <section id="SECTaddresslist">
13045 <title>Address lists</title>
13046 <para>
13047 <indexterm role="concept">
13048 <primary>list</primary>
13049 <secondary>address list</secondary>
13050 </indexterm>
13051 <indexterm role="concept">
13052 <primary>address list</primary>
13053 <secondary>empty item</secondary>
13054 </indexterm>
13055 <indexterm role="concept">
13056 <primary>address list</primary>
13057 <secondary>patterns</secondary>
13058 </indexterm>
13059 Address lists contain patterns that are matched against mail addresses. There
13060 is one special case to be considered: the sender address of a bounce message is
13061 always empty. You can test for this by providing an empty item in an address
13062 list. For example, you can set up a router to process bounce messages by
13063 using this option setting:
13064 </para>
13065 <literallayout class="monospaced">
13066 senders = :
13067 </literallayout>
13068 <para>
13069 The presence of the colon creates an empty item. If you do not provide any
13070 data, the list is empty and matches nothing. The empty sender can also be
13071 detected by a regular expression that matches an empty string,
13072 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13073 </para>
13074 <para>
13075 Non-empty items in an address list can be straightforward email addresses. For
13076 example:
13077 </para>
13078 <literallayout class="monospaced">
13079 senders = jbc@askone.example : hs@anacreon.example
13080 </literallayout>
13081 <para>
13082 A certain amount of wildcarding is permitted. If a pattern contains an @
13083 character, but is not a regular expression and does not begin with a
13084 semicolon-terminated lookup type (described below), the local part of the
13085 subject address is compared with the local part of the pattern, which may start
13086 with an asterisk. If the local parts match, the domain is checked in exactly
13087 the same way as for a pattern in a domain list. For example, the domain can be
13088 wildcarded, refer to a named list, or be a lookup:
13089 </para>
13090 <literallayout class="monospaced">
13091 deny senders = *@*.spamming.site:\
13092                *@+hostile_domains:\
13093                bozo@partial-lsearch;/list/of/dodgy/sites:\
13094                *@dbm;/bad/domains.db
13095 </literallayout>
13096 <para>
13097 <indexterm role="concept">
13098 <primary>local part</primary>
13099 <secondary>starting with !</secondary>
13100 </indexterm>
13101 <indexterm role="concept">
13102 <primary>address list</primary>
13103 <secondary>local part starting with !</secondary>
13104 </indexterm>
13105 If a local part that begins with an exclamation mark is required, it has to be
13106 specified using a regular expression, because otherwise the exclamation mark is
13107 treated as a sign of negation, as is standard in lists.
13108 </para>
13109 <para>
13110 If a non-empty pattern that is not a regular expression or a lookup does not
13111 contain an @ character, it is matched against the domain part of the subject
13112 address. The only two formats that are recognized this way are a literal
13113 domain, or a domain pattern that starts with *. In both these cases, the effect
13114 is the same as if <literal>*@</literal> preceded the pattern. For example:
13115 </para>
13116 <literallayout class="monospaced">
13117 deny senders = enemy.domain : *.enemy.domain
13118 </literallayout>
13119 <para>
13120 The following kinds of more complicated address list pattern can match any
13121 address, including the empty address that is characteristic of bounce message
13122 senders:
13123 </para>
13124 <itemizedlist>
13125 <listitem>
13126 <para>
13127 <indexterm role="concept">
13128 <primary>regular expressions</primary>
13129 <secondary>in address list</secondary>
13130 </indexterm>
13131 <indexterm role="concept">
13132 <primary>address list</primary>
13133 <secondary>regular expression in</secondary>
13134 </indexterm>
13135 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13136 done against the complete address, with the pattern as the regular expression.
13137 You must take care that backslash and dollar characters are not misinterpreted
13138 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13139 to mark that part of the string as non-expandable. For example:
13140 </para>
13141 <literallayout class="monospaced">
13142 deny senders = \N^.*this.*@example\.com$\N : \
13143                \N^\d{8}.+@spamhaus.example$\N : ...
13144 </literallayout>
13145 <para>
13146 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13147 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13148 </para>
13149 </listitem>
13150 <listitem>
13151 <para>
13152 <indexterm role="concept">
13153 <primary>address list</primary>
13154 <secondary>lookup for complete address</secondary>
13155 </indexterm>
13156 Complete addresses can be looked up by using a pattern that starts with a
13157 lookup type terminated by a semicolon, followed by the data for the lookup. For
13158 example:
13159 </para>
13160 <literallayout class="monospaced">
13161 deny senders = cdb;/etc/blocked.senders : \
13162   mysql;select address from blocked where \
13163   address='${quote_mysql:$sender_address}'
13164 </literallayout>
13165 <para>
13166 Both query-style and single-key lookup types can be used. For a single-key
13167 lookup type, Exim uses the complete address as the key. However, empty keys are
13168 not supported for single-key lookups, so a match against the empty address
13169 always fails. This restriction does not apply to query-style lookups.
13170 </para>
13171 <para>
13172 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13173 cannot be used, and is ignored if specified, with an entry being written to the
13174 panic log.
13175 <indexterm role="concept">
13176 <primary>*@ with single-key lookup</primary>
13177 </indexterm>
13178 However, you can configure lookup defaults, as described in section
13179 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13180 default. For example, with this lookup:
13181 </para>
13182 <literallayout class="monospaced">
13183 accept senders = lsearch*@;/some/file
13184 </literallayout>
13185 <para>
13186 the file could contains lines like this:
13187 </para>
13188 <literallayout class="monospaced">
13189 user1@domain1.example
13190 *@domain2.example
13191 </literallayout>
13192 <para>
13193 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13194 that are tried is:
13195 </para>
13196 <literallayout class="monospaced">
13197 nimrod@jaeger.example
13198 *@jaeger.example
13199 *
13200 </literallayout>
13201 <para>
13202 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13203 would mean that every address matches, thus rendering the test useless.
13204 </para>
13205 <para>
13206 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13207 </para>
13208 <literallayout class="monospaced">
13209 deny recipients = dbm*@;/some/file
13210 deny recipients = *@dbm;/some/file
13211 </literallayout>
13212 <para>
13213 The first does a whole address lookup, with defaulting, as just described,
13214 because it starts with a lookup type. The second matches the local part and
13215 domain independently, as described in a bullet point below.
13216 </para>
13217 </listitem>
13218 </itemizedlist>
13219 <para>
13220 The following kinds of address list pattern can match only non-empty addresses.
13221 If the subject address is empty, a match against any of these pattern types
13222 always fails.
13223 </para>
13224 <itemizedlist>
13225 <listitem>
13226 <para>
13227 <indexterm role="concept">
13228 <primary>@@ with single-key lookup</primary>
13229 </indexterm>
13230 <indexterm role="concept">
13231 <primary>address list</primary>
13232 <secondary>@@ lookup type</secondary>
13233 </indexterm>
13234 <indexterm role="concept">
13235 <primary>address list</primary>
13236 <secondary>split local part and domain</secondary>
13237 </indexterm>
13238 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13239 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13240 split into a local part and a domain. The domain is looked up in the file. If
13241 it is not found, there is no match. If it is found, the data that is looked up
13242 from the file is treated as a colon-separated list of local part patterns, each
13243 of which is matched against the subject local part in turn.
13244 </para>
13245 <para>
13246 <indexterm role="concept">
13247 <primary>asterisk</primary>
13248 <secondary>in address list</secondary>
13249 </indexterm>
13250 The lookup may be a partial one, and/or one involving a search for a default
13251 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13252 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13253 even be further lookups. They may also be independently negated. For example,
13254 with
13255 </para>
13256 <literallayout class="monospaced">
13257 deny senders = @@dbm;/etc/reject-by-domain
13258 </literallayout>
13259 <para>
13260 the data from which the DBM file is built could contain lines like
13261 </para>
13262 <literallayout class="monospaced">
13263 baddomain.com:  !postmaster : *
13264 </literallayout>
13265 <para>
13266 to reject all senders except <option>postmaster</option> from that domain.
13267 </para>
13268 <para>
13269 <indexterm role="concept">
13270 <primary>local part</primary>
13271 <secondary>starting with !</secondary>
13272 </indexterm>
13273 If a local part that actually begins with an exclamation mark is required, it
13274 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13275 may be split over several lines by indenting the second and subsequent lines,
13276 but the separating colon must still be included at line breaks. White space
13277 surrounding the colons is ignored. For example:
13278 </para>
13279 <literallayout class="monospaced">
13280 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13281   spammer3 : spammer4
13282 </literallayout>
13283 <para>
13284 As in all colon-separated lists in Exim, a colon can be included in an item by
13285 doubling.
13286 </para>
13287 <para>
13288 If the last item in the list starts with a right angle-bracket, the remainder
13289 of the item is taken as a new key to look up in order to obtain a continuation
13290 list of local parts. The new key can be any sequence of characters. Thus one
13291 might have entries like
13292 </para>
13293 <literallayout class="monospaced">
13294 aol.com: spammer1 : spammer 2 : &gt;*
13295 xyz.com: spammer3 : &gt;*
13296 *:       ^\d{8}$
13297 </literallayout>
13298 <para>
13299 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13300 local parts for all domains, in addition to the specific local parts listed for
13301 each domain. Of course, using this feature costs another lookup each time a
13302 chain is followed, but the effort needed to maintain the data is reduced.
13303 </para>
13304 <para>
13305 <indexterm role="concept">
13306 <primary>loop</primary>
13307 <secondary>in lookups</secondary>
13308 </indexterm>
13309 It is possible to construct loops using this facility, and in order to catch
13310 them, the chains may be no more than fifty items long.
13311 </para>
13312 </listitem>
13313 <listitem>
13314 <para>
13315 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13316 lookup, but in this case, the chaining facility is not available. The lookup
13317 can only return a single list of local parts.
13318 </para>
13319 </listitem>
13320 </itemizedlist>
13321 <para>
13322 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13323 in these two examples:
13324 </para>
13325 <literallayout class="monospaced">
13326 senders = +my_list
13327 senders = *@+my_list
13328 </literallayout>
13329 <para>
13330 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13331 example it is a named domain list.
13332 </para>
13333 </section>
13334 <section id="SECTcasletadd">
13335 <title>Case of letters in address lists</title>
13336 <para>
13337 <indexterm role="concept">
13338 <primary>case of local parts</primary>
13339 </indexterm>
13340 <indexterm role="concept">
13341 <primary>address list</primary>
13342 <secondary>case forcing</secondary>
13343 </indexterm>
13344 <indexterm role="concept">
13345 <primary>case forcing in address lists</primary>
13346 </indexterm>
13347 Domains in email addresses are always handled caselessly, but for local parts
13348 case may be significant on some systems (see <option>caseful_local_part</option> for how
13349 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13350 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13351 blocking lists should be done in a case-independent manner. Since most address
13352 lists in Exim are used for this kind of control, Exim attempts to do this by
13353 default.
13354 </para>
13355 <para>
13356 The domain portion of an address is always lowercased before matching it to an
13357 address list. The local part is lowercased by default, and any string
13358 comparisons that take place are done caselessly. This means that the data in
13359 the address list itself, in files included as plain file names, and in any file
13360 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13361 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13362 works caselessly) must be in lower case, because these lookups are not
13363 case-independent.
13364 </para>
13365 <para>
13366 <indexterm role="concept">
13367 <primary><literal>+caseful</literal></primary>
13368 </indexterm>
13369 To allow for the possibility of caseful address list matching, if an item in
13370 an address list is the string <quote>+caseful</quote>, the original case of the local
13371 part is restored for any comparisons that follow, and string comparisons are no
13372 longer case-independent. This does not affect the domain, which remains in
13373 lower case. However, although independent matches on the domain alone are still
13374 performed caselessly, regular expressions that match against an entire address
13375 become case-sensitive after <quote>+caseful</quote> has been seen.
13376 </para>
13377 </section>
13378 <section id="SECTlocparlis">
13379 <title>Local part lists</title>
13380 <para>
13381 <indexterm role="concept">
13382 <primary>list</primary>
13383 <secondary>local part list</secondary>
13384 </indexterm>
13385 <indexterm role="concept">
13386 <primary>local part</primary>
13387 <secondary>list</secondary>
13388 </indexterm>
13389 Case-sensitivity in local part lists is handled in the same way as for address
13390 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13391 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13392 set false, the subject is lowercased and the matching is initially
13393 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13394 matching in the local part list, but not elsewhere in the router. If
13395 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13396 option is case-sensitive from the start.
13397 </para>
13398 <para>
13399 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13400 comments are handled in the same way as address lists &ndash; they are recognized
13401 only if the # is preceded by white space or the start of the line.
13402 Otherwise, local part lists are matched in the same way as domain lists, except
13403 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13404 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13405 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13406 types.
13407 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13408 </para>
13409 </section>
13410 </chapter>
13411
13412 <chapter id="CHAPexpand">
13413 <title>String expansions</title>
13414 <para>
13415 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13416 <primary>expansion</primary>
13417 <secondary>of strings</secondary>
13418 </indexterm>
13419 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13420 them are expanded every time they are used; others are expanded only once.
13421 </para>
13422 <para>
13423 When a string is being expanded it is copied verbatim from left to right except
13424 when a dollar or backslash character is encountered. A dollar specifies the
13425 start of a portion of the string that is interpreted and replaced as described
13426 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13427 escape character, as described in the following section.
13428 </para>
13429 <para>
13430 Whether a string is expanded depends upon the context.  Usually this is solely
13431 dependent upon the option for which a value is sought; in this documentation,
13432 options for which string expansion is performed are marked with &dagger; after
13433 the data type.  ACL rules always expand strings.  A couple of expansion
13434 conditions do not expand some of the brace-delimited branches, for security
13435 reasons.
13436 </para>
13437 <section id="SECTlittext">
13438 <title>Literal text in expanded strings</title>
13439 <para>
13440 <indexterm role="concept">
13441 <primary>expansion</primary>
13442 <secondary>including literal text</secondary>
13443 </indexterm>
13444 An uninterpreted dollar can be included in an expanded string by putting a
13445 backslash in front of it. A backslash can be used to prevent any special
13446 character being treated specially in an expansion, including backslash itself.
13447 If the string appears in quotes in the configuration file, two backslashes are
13448 required because the quotes themselves cause interpretation of backslashes when
13449 the string is read in (see section <xref linkend="SECTstrings"/>).
13450 </para>
13451 <para>
13452 <indexterm role="concept">
13453 <primary>expansion</primary>
13454 <secondary>non-expandable substrings</secondary>
13455 </indexterm>
13456 A portion of the string can specified as non-expandable by placing it between
13457 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13458 expressions, which often contain backslashes and dollar signs. For example:
13459 </para>
13460 <literallayout class="monospaced">
13461 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13462 </literallayout>
13463 <para>
13464 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13465 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13466 string.
13467 </para>
13468 </section>
13469 <section id="SECID82">
13470 <title>Character escape sequences in expanded strings</title>
13471 <para>
13472 <indexterm role="concept">
13473 <primary>expansion</primary>
13474 <secondary>escape sequences</secondary>
13475 </indexterm>
13476 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13477 expanded string is recognized as an escape sequence for the character newline,
13478 carriage return, or tab, respectively. A backslash followed by up to three
13479 octal digits is recognized as an octal encoding for a single character, and a
13480 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13481 encoding.
13482 </para>
13483 <para>
13484 These escape sequences are also recognized in quoted strings when they are read
13485 in. Their interpretation in expansions as well is useful for unquoted strings,
13486 and for other cases such as looked-up strings that are then expanded.
13487 </para>
13488 </section>
13489 <section id="SECID83">
13490 <title>Testing string expansions</title>
13491 <para>
13492 <indexterm role="concept">
13493 <primary>expansion</primary>
13494 <secondary>testing</secondary>
13495 </indexterm>
13496 <indexterm role="concept">
13497 <primary>testing</primary>
13498 <secondary>string expansion</secondary>
13499 </indexterm>
13500 <indexterm role="option">
13501 <primary><option>-be</option></primary>
13502 </indexterm>
13503 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13504 takes the command arguments, or lines from the standard input if there are no
13505 arguments, runs them through the string expansion code, and writes the results
13506 to the standard output. Variables based on configuration values are set up, but
13507 since no message is being processed, variables such as <varname>$local_part</varname> have no
13508 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13509 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13510 and <option>nhash</option>.
13511 </para>
13512 <para>
13513 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13514 instead runs under the uid and gid it was called with, to prevent users from
13515 using <option>-be</option> for reading files to which they do not have access.
13516 </para>
13517 <para>
13518 <indexterm role="option">
13519 <primary><option>-bem</option></primary>
13520 </indexterm>
13521 If you want to test expansions that include variables whose values are taken
13522 from a message, there are two other options that can be used. The <option>-bem</option>
13523 option is like <option>-be</option> except that it is followed by a file name. The file is
13524 read as a message before doing the test expansions. For example:
13525 </para>
13526 <literallayout class="monospaced">
13527 exim -bem /tmp/test.message '$h_subject:'
13528 </literallayout>
13529 <para>
13530 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13531 Exim message identifier. For example:
13532 </para>
13533 <literallayout class="monospaced">
13534 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13535 </literallayout>
13536 <para>
13537 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13538 is therefore restricted to admin users.
13539 </para>
13540 </section>
13541 <section id="SECTforexpfai">
13542 <title>Forced expansion failure</title>
13543 <para>
13544 <indexterm role="concept">
13545 <primary>expansion</primary>
13546 <secondary>forced failure</secondary>
13547 </indexterm>
13548 A number of expansions that are described in the following section have
13549 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13550 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13551 used depends on some condition that is evaluated as part of the expansion. If,
13552 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13553 the entire string expansion fails in a way that can be detected by the code
13554 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13555 its consequences depend on the circumstances. In some cases it is no different
13556 from any other expansion failure, but in others a different action may be
13557 taken. Such variations are mentioned in the documentation of the option that is
13558 being expanded.
13559 </para>
13560 </section>
13561 <section id="SECTexpansionitems">
13562 <title>Expansion items</title>
13563 <para>
13564 The following items are recognized in expanded strings. White space may be used
13565 between sub-items that are keywords or substrings enclosed in braces inside an
13566 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13567 white space is significant.
13568 </para>
13569 <variablelist>
13570 <varlistentry>
13571 <term><emphasis role="bold">$</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;&nbsp;or&nbsp;<emphasis role="bold">${</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13572 <listitem>
13573 <para>
13574 <indexterm role="concept">
13575 <primary>expansion</primary>
13576 <secondary>variables</secondary>
13577 </indexterm>
13578 Substitute the contents of the named variable, for example:
13579 </para>
13580 <literallayout class="monospaced">
13581 $local_part
13582 ${domain}
13583 </literallayout>
13584 <para>
13585 The second form can be used to separate the name from subsequent alphanumeric
13586 characters. This form (using braces) is available only for variables; it does
13587 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13588 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13589 given, the expansion fails.
13590 </para>
13591 </listitem></varlistentry>
13592 <varlistentry>
13593 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13594 <listitem>
13595 <para>
13596 <indexterm role="concept">
13597 <primary>expansion</primary>
13598 <secondary>operators</secondary>
13599 </indexterm>
13600 The string is first itself expanded, and then the operation specified by
13601 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13602 </para>
13603 <literallayout class="monospaced">
13604 ${lc:$local_part}
13605 </literallayout>
13606 <para>
13607 The string starts with the first character after the colon, which may be
13608 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13609 below. The operator notation is used for simple expansion items that have just
13610 one argument, because it reduces the number of braces and therefore makes the
13611 string easier to understand.
13612 </para>
13613 </listitem></varlistentry>
13614 <varlistentry>
13615 <term><emphasis role="bold">$bheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$bh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
13616 <listitem>
13617 <para>
13618 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13619 expansion item below.
13620 </para>
13621 </listitem></varlistentry>
13622 <varlistentry>
13623 <term><emphasis role="bold">${acl{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
13624 <listitem>
13625 <para>
13626 <indexterm role="concept">
13627 <primary>expansion</primary>
13628 <secondary>calling an acl</secondary>
13629 </indexterm>
13630 <indexterm role="concept">
13631 <primary><option>acl</option></primary>
13632 <secondary>call from expansion</secondary>
13633 </indexterm>
13634 The name and zero to nine argument strings are first expanded separately.  The expanded
13635 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13636 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13637 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13638 and may use the variables; if another acl expansion is used the values
13639 are restored after it returns.  If the ACL sets
13640 a value using a "message =" modifier and returns accept or deny, the value becomes
13641 the result of the expansion.
13642 If no message is set and the ACL returns accept or deny
13643 the expansion result is an empty string.
13644 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13645 </para>
13646 </listitem></varlistentry>
13647 <varlistentry>
13648 <term><emphasis role="bold">${certextract{</emphasis>&lt;<emphasis>field</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13649 <listitem>
13650 <para>
13651 <indexterm role="concept">
13652 <primary>expansion</primary>
13653 <secondary>extracting certificate fields</secondary>
13654 </indexterm>
13655 <indexterm role="concept">
13656 <primary><option>certextract</option></primary>
13657 <secondary>certificate fields</secondary>
13658 </indexterm>
13659 <indexterm role="concept">
13660 <primary>certificate</primary>
13661 <secondary>extracting fields</secondary>
13662 </indexterm>
13663 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13664 The field name is expanded and used to retrieve the relevant field from
13665 the certificate.  Supported fields are:
13666 </para>
13667 <literallayout>
13668 <literal>version        </literal>
13669 <literal>serial_number  </literal>
13670 <literal>subject        </literal> RFC4514 DN
13671 <literal>issuer         </literal> RFC4514 DN
13672 <literal>notbefore      </literal> time
13673 <literal>notafter       </literal> time
13674 <literal>sig_algorithm  </literal>
13675 <literal>signature      </literal>
13676 <literal>subj_altname   </literal> tagged list
13677 <literal>ocsp_uri       </literal> list
13678 <literal>crl_uri        </literal> list
13679 </literallayout>
13680 <para>
13681 If the field is found,
13682 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13683 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13684 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13685 is restored to any previous value it might have had.
13686 </para>
13687 <para>
13688 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13689 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13690 extracted is used.
13691 </para>
13692 <para>
13693 Some field names take optional modifiers, appended and separated by commas.
13694 </para>
13695 <para>
13696 The field selectors marked as "RFC4514" above
13697 output a Distinguished Name string which is
13698 not quite
13699 parseable by Exim as a comma-separated tagged list
13700 (the exceptions being elements containing commas).
13701 RDN elements of a single type may be selected by
13702 a modifier of the type label; if so the expansion
13703 result is a list (newline-separated by default).
13704 The separator may be changed by another modifier of
13705 a right angle-bracket followed immediately by the new separator.
13706 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13707 </para>
13708 <para>
13709 The field selectors marked as "time" above
13710 take an optional modifier of "int"
13711 for which the result is the number of seconds since epoch.
13712 Otherwise the result is a human-readable string
13713 in the timezone selected by the main "timezone" option.
13714 </para>
13715 <para>
13716 The field selectors marked as "list" above return a list,
13717 newline-separated by default,
13718 (embedded separator characters in elements are doubled).
13719 The separator may be changed by a modifier of
13720 a right angle-bracket followed immediately by the new separator.
13721 </para>
13722 <para>
13723 The field selectors marked as "tagged" above
13724 prefix each list element with a type string and an equals sign.
13725 Elements of only one type may be selected by a modifier
13726 which is one of "dns", "uri" or "mail";
13727 if so the element tags are omitted.
13728 </para>
13729 <para>
13730 If not otherwise noted field values are presented in human-readable form.
13731 </para>
13732 </listitem></varlistentry>
13733 <varlistentry>
13734 <term><emphasis role="bold">${dlfunc{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>function</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
13735 <listitem>
13736 <para>
13737 <indexterm role="concept">
13738 <primary><option>dlfunc</option></primary>
13739 </indexterm>
13740 This expansion dynamically loads and then calls a locally-written C function.
13741 This functionality is available only if Exim is compiled with
13742 </para>
13743 <literallayout class="monospaced">
13744 EXPAND_DLFUNC=yes
13745 </literallayout>
13746 <para>
13747 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13748 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13749 (but of course Exim does start new processes frequently).
13750 </para>
13751 <para>
13752 There may be from zero to eight arguments to the function. When compiling
13753 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13754 included. The Exim variables and functions that are defined by that API
13755 are also available for dynamically loaded functions. The function itself
13756 must have the following type:
13757 </para>
13758 <literallayout class="monospaced">
13759 int dlfunction(uschar **yield, int argc, uschar *argv[])
13760 </literallayout>
13761 <para>
13762 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13763 function should return one of the following values:
13764 </para>
13765 <para>
13766 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13767 into the expanded string that is being built.
13768 </para>
13769 <para>
13770 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13771 from <emphasis>yield</emphasis>, if it is set.
13772 </para>
13773 <para>
13774 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13775 taken from <emphasis>yield</emphasis> if it is set.
13776 </para>
13777 <para>
13778 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13779 </para>
13780 <para>
13781 When compiling a function that is to be used in this way with gcc,
13782 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13783 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13784 </para>
13785 </listitem></varlistentry>
13786 <varlistentry>
13787 <term><emphasis role="bold">${env{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13788 <listitem>
13789 <para>
13790 <indexterm role="concept">
13791 <primary>expansion</primary>
13792 <secondary>extracting value from environment</secondary>
13793 </indexterm>
13794 <indexterm role="concept">
13795 <primary>environment</primary>
13796 <secondary>values from</secondary>
13797 </indexterm>
13798 The key is first expanded separately, and leading and trailing white space
13799 removed.
13800 This is then searched for as a name in the environment.
13801 If a variable is found then its value is placed in <varname>$value</varname>
13802 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13803 </para>
13804 <para>
13805 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13806 appear, for example:
13807 </para>
13808 <literallayout class="monospaced">
13809 ${env{USER}{$value} fail }
13810 </literallayout>
13811 <para>
13812 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13813 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13814 </para>
13815 <para>
13816 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13817 search failure.
13818 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13819 search success.
13820 </para>
13821 <para>
13822 The environment is adjusted by the <option>keep_environment</option> and
13823 <option>add_environment</option> main section options.
13824 </para>
13825 </listitem></varlistentry>
13826 <varlistentry>
13827 <term><emphasis role="bold">${extract{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13828 <listitem>
13829 <para>
13830 <indexterm role="concept">
13831 <primary>expansion</primary>
13832 <secondary>extracting substrings by key</secondary>
13833 </indexterm>
13834 <indexterm role="concept">
13835 <primary><option>extract</option></primary>
13836 <secondary>substrings by key</secondary>
13837 </indexterm>
13838 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13839 white space is removed from the key (but not from any of the strings). The key
13840 must not be empty and must not consist entirely of digits.
13841 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
13842 </para>
13843 <literallayout>
13844 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13845 </literallayout>
13846 <para>
13847 <indexterm role="variable">
13848 <primary><varname>$value</varname></primary>
13849 </indexterm>
13850 where the equals signs and spaces (but not both) are optional. If any of the
13851 values contain white space, they must be enclosed in double quotes, and any
13852 values that are enclosed in double quotes are subject to escape processing as
13853 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13854 for the value that corresponds to the key. The search is case-insensitive. If
13855 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13856 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13857 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13858 is restored to any previous value it might have had.
13859 </para>
13860 <para>
13861 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13862 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13863 extracted is used. Thus, for example, these two expansions are identical, and
13864 yield <quote>2001</quote>:
13865 </para>
13866 <literallayout class="monospaced">
13867 ${extract{gid}{uid=1984 gid=2001}}
13868 ${extract{gid}{uid=1984 gid=2001}{$value}}
13869 </literallayout>
13870 <para>
13871 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13872 appear, for example:
13873 </para>
13874 <literallayout class="monospaced">
13875 ${extract{Z}{A=... B=...}{$value} fail }
13876 </literallayout>
13877 <para>
13878 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13879 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13880 </para>
13881 </listitem></varlistentry>
13882 <varlistentry>
13883 <term><emphasis role="bold">${extract{</emphasis>&lt;<emphasis>number</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>separators</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13884 <listitem>
13885 <para>
13886 <indexterm role="concept">
13887 <primary>expansion</primary>
13888 <secondary>extracting substrings by number</secondary>
13889 </indexterm>
13890 <indexterm role="concept">
13891 <primary><option>extract</option></primary>
13892 <secondary>substrings by number</secondary>
13893 </indexterm>
13894 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13895 apart from leading and trailing white space, which is ignored.
13896 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13897 behaves in the same way, except that, instead of extracting a named field, it
13898 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13899 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13900 &lt;<emphasis>string3</emphasis>&gt; as before.
13901 </para>
13902 <para>
13903 The fields in the string are separated by any one of the characters in the
13904 separator string. These may include space or tab characters.
13905 The first field is numbered one. If the number is negative, the fields are
13906 counted from the end of the string, with the rightmost one numbered -1. If the
13907 number given is zero, the entire string is returned. If the modulus of the
13908 number is greater than the number of fields in the string, the result is the
13909 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13910 provided. For example:
13911 </para>
13912 <literallayout class="monospaced">
13913 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13914 </literallayout>
13915 <para>
13916 yields <quote>42</quote>, and
13917 </para>
13918 <literallayout class="monospaced">
13919 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13920 </literallayout>
13921 <para>
13922 yields <quote>99</quote>. Two successive separators mean that the field between them is
13923 empty (for example, the fifth field above).
13924 </para>
13925 </listitem></varlistentry>
13926 <varlistentry>
13927 <term><emphasis role="bold">${filter{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>condition</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13928 <listitem>
13929 <para>
13930 <indexterm role="concept">
13931 <primary>list</primary>
13932 <secondary>selecting by condition</secondary>
13933 </indexterm>
13934 <indexterm role="concept">
13935 <primary>expansion</primary>
13936 <secondary>selecting from list by condition</secondary>
13937 </indexterm>
13938 <indexterm role="variable">
13939 <primary><varname>$item</varname></primary>
13940 </indexterm>
13941 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13942 default, but the separator can be changed in the usual way. For each item
13943 in this list, its value is place in <varname>$item</varname>, and then the condition is
13944 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13945 item in a new list; if the condition is false, the item is discarded. The
13946 separator used for the output list is the same as the one used for the
13947 input, but a separator setting is not included in the output. For example:
13948 </para>
13949 <literallayout class="monospaced">
13950 ${filter{a:b:c}{!eq{$item}{b}}
13951 </literallayout>
13952 <para>
13953 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13954 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13955 </para>
13956 </listitem></varlistentry>
13957 <varlistentry>
13958 <term><emphasis role="bold">${hash{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13959 <listitem>
13960 <para>
13961 <indexterm role="concept">
13962 <primary>hash function</primary>
13963 <secondary>textual</secondary>
13964 </indexterm>
13965 <indexterm role="concept">
13966 <primary>expansion</primary>
13967 <secondary>textual hash</secondary>
13968 </indexterm>
13969 This is a textual hashing function, and was the first to be implemented in
13970 early versions of Exim. In current releases, there are other hashing functions
13971 (numeric, MD5, and SHA-1), which are described below.
13972 </para>
13973 <para>
13974 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13975 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13976 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13977 use the simpler operator notation that avoids some of the braces:
13978 </para>
13979 <literallayout class="monospaced">
13980 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13981 </literallayout>
13982 <para>
13983 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13984 or equal to the length of the string, the expansion item returns the string.
13985 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13986 function to the string. The new string consists of characters taken from the
13987 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13988 </para>
13989 <literallayout class="monospaced">
13990 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13991 </literallayout>
13992 <para>
13993 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13994 letters appear. For example:
13995 </para>
13996 <literallayout>
13997 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13998 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13999 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14000 </literallayout>
14001 </listitem></varlistentry>
14002 <varlistentry>
14003 <term><emphasis role="bold">$header_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$h_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
14004 <term><emphasis role="bold">$bheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$bh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
14005 <term><emphasis role="bold">$rheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$rh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
14006 <listitem>
14007 <para>
14008 <indexterm role="concept">
14009 <primary>expansion</primary>
14010 <secondary>header insertion</secondary>
14011 </indexterm>
14012 <indexterm role="variable">
14013 <primary><varname>$header_</varname></primary>
14014 </indexterm>
14015 <indexterm role="variable">
14016 <primary><varname>$bheader_</varname></primary>
14017 </indexterm>
14018 <indexterm role="variable">
14019 <primary><varname>$rheader_</varname></primary>
14020 </indexterm>
14021 <indexterm role="concept">
14022 <primary>header lines</primary>
14023 <secondary>in expansion strings</secondary>
14024 </indexterm>
14025 <indexterm role="concept">
14026 <primary>header lines</primary>
14027 <secondary>character sets</secondary>
14028 </indexterm>
14029 <indexterm role="concept">
14030 <primary>header lines</primary>
14031 <secondary>decoding</secondary>
14032 </indexterm>
14033 Substitute the contents of the named message header line, for example
14034 </para>
14035 <literallayout class="monospaced">
14036 $header_reply-to:
14037 </literallayout>
14038 <para>
14039 The newline that terminates a header line is not included in the expansion, but
14040 internal newlines (caused by splitting the header line over several physical
14041 lines) may be present.
14042 </para>
14043 <para>
14044 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
14045 the data in the header line is interpreted.
14046 </para>
14047 <itemizedlist>
14048 <listitem>
14049 <para>
14050 <indexterm role="concept">
14051 <primary>white space</primary>
14052 <secondary>in header lines</secondary>
14053 </indexterm>
14054 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14055 processing at all, and without the removal of leading and trailing white space.
14056 </para>
14057 </listitem>
14058 <listitem>
14059 <para>
14060 <indexterm role="concept">
14061 <primary>base64 encoding</primary>
14062 <secondary>in header lines</secondary>
14063 </indexterm>
14064 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14065 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14066 character set translation. If decoding of what looks superficially like a MIME
14067 <quote>word</quote> fails, the raw string is returned. If decoding
14068 <indexterm role="concept">
14069 <primary>binary zero</primary>
14070 <secondary>in header line</secondary>
14071 </indexterm>
14072 produces a binary zero character, it is replaced by a question mark &ndash; this is
14073 what Exim does for binary zeros that are actually received in header lines.
14074 </para>
14075 </listitem>
14076 <listitem>
14077 <para>
14078 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14079 standard character set. This is an attempt to produce the same string as would
14080 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14081 returned. Translation is attempted only on operating systems that support the
14082 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14083 a system Makefile or in <filename>Local/Makefile</filename>.
14084 </para>
14085 </listitem>
14086 </itemizedlist>
14087 <para>
14088 In a filter file, the target character set for <option>header</option> can be specified by a
14089 command of the following form:
14090 </para>
14091 <literallayout class="monospaced">
14092 headers charset "UTF-8"
14093 </literallayout>
14094 <para>
14095 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14096 subsequently obeyed filter commands. In the absence of this command, the target
14097 character set in a filter is taken from the setting of the <option>headers_charset</option>
14098 option in the runtime configuration. The value of this option defaults to the
14099 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14100 ISO-8859-1.
14101 </para>
14102 <para>
14103 Header names follow the syntax of RFC 2822, which states that they may contain
14104 any printing characters except space and colon. Consequently, curly brackets
14105 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14106 if they were variables. Attempting to do so causes a syntax error.
14107 </para>
14108 <para>
14109 Only header lines that are common to all copies of a message are visible to
14110 this mechanism. These are the original header lines that are received with the
14111 message, and any that are added by an ACL statement or by a system
14112 filter. Header lines that are added to a particular copy of a message by a
14113 router or transport are not accessible.
14114 </para>
14115 <para>
14116 For incoming SMTP messages, no header lines are visible in
14117 </para>
14118 <para revisionflag="changed">
14119 ACLs that are obeyed before the data phase completes,
14120 </para>
14121 <para>
14122 because the header structure is not set up until the message is received.
14123 They are visible in DKIM, PRDR and DATA ACLs.
14124 Header lines that are added in a RCPT ACL (for example)
14125 are saved until the message&#x2019;s incoming header lines are available, at which
14126 point they are added.
14127 </para>
14128 <para revisionflag="changed">
14129 When any of the above ACLs ar
14130 </para>
14131 <para>
14132 running, however, header lines added by earlier ACLs are visible.
14133 </para>
14134 <para>
14135 Upper case and lower case letters are synonymous in header names. If the
14136 following character is white space, the terminating colon may be omitted, but
14137 this is not recommended, because you may then forget it when it is needed. When
14138 white space terminates the header name, this white space is included in the
14139 expanded string.  If the message does not contain the given header, the
14140 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14141 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14142 header.)
14143 </para>
14144 <para>
14145 If there is more than one header with the same name, they are all concatenated
14146 to form the substitution string, up to a maximum length of 64K. Unless
14147 <option>rheader</option> is being used, leading and trailing white space is removed from
14148 each header before concatenation, and a completely empty header is ignored. A
14149 newline character is then inserted between non-empty headers, but there is no
14150 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14151 those headers that contain lists of addresses, a comma is also inserted at the
14152 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14153 </para>
14154 </listitem></varlistentry>
14155 <varlistentry>
14156 <term><emphasis role="bold">${hmac{</emphasis>&lt;<emphasis>hashname</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14157 <listitem>
14158 <para>
14159 <indexterm role="concept">
14160 <primary>expansion</primary>
14161 <secondary>hmac hashing</secondary>
14162 </indexterm>
14163 <indexterm role="concept">
14164 <primary><option>hmac</option></primary>
14165 </indexterm>
14166 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14167 shared secret and some text into a message authentication code, as specified in
14168 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14169 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14170 cryptographic hash, allowing for authentication that is not possible with MD5
14171 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14172 present. For example:
14173 </para>
14174 <literallayout class="monospaced">
14175 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14176 </literallayout>
14177 <para>
14178 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14179 produces:
14180 </para>
14181 <literallayout class="monospaced">
14182 dd97e3ba5d1a61b5006108f8c8252953
14183 </literallayout>
14184 <para>
14185 As an example of how this might be used, you might put in the main part of
14186 an Exim configuration:
14187 </para>
14188 <literallayout class="monospaced">
14189 SPAMSCAN_SECRET=cohgheeLei2thahw
14190 </literallayout>
14191 <para>
14192 In a router or a transport you could then have:
14193 </para>
14194 <literallayout class="monospaced">
14195 headers_add = \
14196   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14197   ${hmac{md5}{SPAMSCAN_SECRET}\
14198   {${primary_hostname},${message_exim_id},$h_message-id:}}
14199 </literallayout>
14200 <para>
14201 Then given a message, you can check where it was scanned by looking at the
14202 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14203 this header line is authentic by recomputing the authentication code from the
14204 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14205 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
14206 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14207 </para>
14208 </listitem></varlistentry>
14209 <varlistentry>
14210 <term><emphasis role="bold">${if&nbsp;</emphasis>&lt;<emphasis>condition</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14211 <listitem>
14212 <para>
14213 <indexterm role="concept">
14214 <primary>expansion</primary>
14215 <secondary>conditional</secondary>
14216 </indexterm>
14217 <indexterm role="concept">
14218 <primary><option>if</option>, expansion item</primary>
14219 </indexterm>
14220 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14221 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14222 in section <xref linkend="SECTexpcond"/> below. For example:
14223 </para>
14224 <literallayout class="monospaced">
14225 ${if eq {$local_part}{postmaster} {yes}{no} }
14226 </literallayout>
14227 <para>
14228 The second string need not be present; if it is not and the condition is not
14229 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14230 be present instead of the second string (without any curly brackets). In this
14231 case, the expansion is forced to fail if the condition is not true (see section
14232 <xref linkend="SECTforexpfai"/>).
14233 </para>
14234 <para>
14235 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14236 is true, and the empty string if the condition is false. This makes it less
14237 cumbersome to write custom ACL and router conditions. For example, instead of
14238 </para>
14239 <literallayout class="monospaced">
14240 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14241 </literallayout>
14242 <para>
14243 you can use
14244 </para>
14245 <literallayout class="monospaced">
14246 condition = ${if &gt;{$acl_m4}{3}}
14247 </literallayout>
14248 </listitem></varlistentry>
14249 <varlistentry>
14250 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14251 <listitem>
14252 <para>
14253 <indexterm role="concept">
14254 <primary>expansion</primary>
14255 <secondary>imap folder</secondary>
14256 </indexterm>
14257 <indexterm role="concept">
14258 <primary><option>imapfolder</option> expansion item</primary>
14259 </indexterm>
14260 This item converts a (possibly multilevel, or with non-ASCII characters)
14261 folder specification to a Maildir name for filesystem use.
14262 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14263 </para>
14264 </listitem></varlistentry>
14265 <varlistentry>
14266 <term><emphasis role="bold">${length{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14267 <listitem>
14268 <para>
14269 <indexterm role="concept">
14270 <primary>expansion</primary>
14271 <secondary>string truncation</secondary>
14272 </indexterm>
14273 <indexterm role="concept">
14274 <primary><option>length</option> expansion item</primary>
14275 </indexterm>
14276 The <option>length</option> item is used to extract the initial portion of a string. Both
14277 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14278 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14279 change when expanded, you can use the simpler operator notation that avoids
14280 some of the braces:
14281 </para>
14282 <literallayout class="monospaced">
14283 ${length_&lt;n&gt;:&lt;string&gt;}
14284 </literallayout>
14285 <para>
14286 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
14287 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14288 <option>strlen</option>, which gives the length of a string.
14289 </para>
14290 </listitem></varlistentry>
14291 <varlistentry>
14292 <term><emphasis role="bold">${listextract{</emphasis>&lt;<emphasis>number</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14293 <listitem>
14294 <para>
14295 <indexterm role="concept">
14296 <primary>expansion</primary>
14297 <secondary>extracting list elements by number</secondary>
14298 </indexterm>
14299 <indexterm role="concept">
14300 <primary><option>listextract</option></primary>
14301 <secondary>extract list elements by number</secondary>
14302 </indexterm>
14303 <indexterm role="concept">
14304 <primary>list</primary>
14305 <secondary>extracting elements by number</secondary>
14306 </indexterm>
14307 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14308 apart from an optional leading minus,
14309 and leading and trailing white space (which is ignored).
14310 </para>
14311 <para>
14312 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14313 default, but the separator can be changed in the usual way.
14314 </para>
14315 <para>
14316 The first field of the list is numbered one.
14317 If the number is negative, the fields are
14318 counted from the end of the list, with the rightmost one numbered -1.
14319 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14320 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14321 </para>
14322 <para>
14323 If the modulus of the
14324 number is zero or greater than the number of fields in the string,
14325 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14326 </para>
14327 <para>
14328 For example:
14329 </para>
14330 <literallayout class="monospaced">
14331 ${listextract{2}{x:42:99}}
14332 </literallayout>
14333 <para>
14334 yields <quote>42</quote>, and
14335 </para>
14336 <literallayout class="monospaced">
14337 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14338 </literallayout>
14339 <para>
14340 yields <quote>result: 42</quote>.
14341 </para>
14342 <para>
14343 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14344 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14345 extracted is used.
14346 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14347 </para>
14348 </listitem></varlistentry>
14349 <varlistentry>
14350 <term><emphasis role="bold">${lookup{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14351 <listitem>
14352 <para>
14353 This is the first of one of two different types of lookup item, which are both
14354 described in the next item.
14355 </para>
14356 </listitem></varlistentry>
14357 <varlistentry>
14358 <term><emphasis role="bold">${lookup&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>query</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14359 <listitem>
14360 <para>
14361 <indexterm role="concept">
14362 <primary>expansion</primary>
14363 <secondary>lookup in</secondary>
14364 </indexterm>
14365 <indexterm role="concept">
14366 <primary>file</primary>
14367 <secondary>lookups</secondary>
14368 </indexterm>
14369 <indexterm role="concept">
14370 <primary>lookup</primary>
14371 <secondary>in expanded string</secondary>
14372 </indexterm>
14373 The two forms of lookup item specify data lookups in files and databases, as
14374 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14375 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14376 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14377 </para>
14378 <para>
14379 If there is any white space in a lookup item which is part of a filter command,
14380 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14381 other place where white space is significant, the lookup item must be enclosed
14382 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14383 out by the system administrator.
14384 </para>
14385 <para>
14386 <indexterm role="variable">
14387 <primary><varname>$value</varname></primary>
14388 </indexterm>
14389 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14390 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14391 lookup. Afterwards it reverts to the value it had previously (at the outer
14392 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14393 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14394 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14395 lookup, thus providing a mechanism for looking up a default value when the
14396 original lookup fails.
14397 </para>
14398 <para>
14399 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14400 data for the outer lookup while the parameters of the second lookup are
14401 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14402 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14403 appear, and in this case, if the lookup fails, the entire expansion is forced
14404 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14405 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14406 successful lookup, and nothing in the case of failure.
14407 </para>
14408 <para>
14409 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14410 search type in order to do partial matching, and * or *@ may follow a search
14411 type to request default lookups if the key does not match (see sections
14412 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14413 </para>
14414 <para>
14415 <indexterm role="concept">
14416 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14417 <secondary>in lookup expansion</secondary>
14418 </indexterm>
14419 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14420 and non-wild parts of the key during the expansion of the replacement text.
14421 They return to their previous values at the end of the lookup item.
14422 </para>
14423 <para>
14424 This example looks up the postmaster alias in the conventional alias file:
14425 </para>
14426 <literallayout class="monospaced">
14427 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14428 </literallayout>
14429 <para>
14430 This example uses NIS+ to look up the full name of the user corresponding to
14431 the local part of an address, forcing the expansion to fail if it is not found:
14432 </para>
14433 <literallayout class="monospaced">
14434 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14435   {$value}fail}
14436 </literallayout>
14437 </listitem></varlistentry>
14438 <varlistentry>
14439 <term><emphasis role="bold">${map{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14440 <listitem>
14441 <para>
14442 <indexterm role="concept">
14443 <primary>expansion</primary>
14444 <secondary>list creation</secondary>
14445 </indexterm>
14446 <indexterm role="variable">
14447 <primary><varname>$item</varname></primary>
14448 </indexterm>
14449 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14450 default, but the separator can be changed in the usual way. For each item
14451 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14452 expanded and added to the output as an item in a new list. The separator used
14453 for the output list is the same as the one used for the input, but a separator
14454 setting is not included in the output. For example:
14455 </para>
14456 <literallayout class="monospaced">
14457 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14458 </literallayout>
14459 <para>
14460 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14461 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14462 and <emphasis role="bold">reduce</emphasis> expansion items.
14463 </para>
14464 </listitem></varlistentry>
14465 <varlistentry>
14466 <term><emphasis role="bold">${nhash{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14467 <listitem>
14468 <para>
14469 <indexterm role="concept">
14470 <primary>expansion</primary>
14471 <secondary>numeric hash</secondary>
14472 </indexterm>
14473 <indexterm role="concept">
14474 <primary>hash function</primary>
14475 <secondary>numeric</secondary>
14476 </indexterm>
14477 The three strings are expanded; the first two must yield numbers. Call them
14478 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14479 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14480 can use the simpler operator notation that avoids some of the braces:
14481 </para>
14482 <literallayout class="monospaced">
14483 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14484 </literallayout>
14485 <para>
14486 The second number is optional (in both notations). If there is only one number,
14487 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14488 processed by a div/mod hash function that returns two numbers, separated by a
14489 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14490 example,
14491 </para>
14492 <literallayout class="monospaced">
14493 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14494 </literallayout>
14495 <para>
14496 returns the string <quote>6/33</quote>.
14497 </para>
14498 </listitem></varlistentry>
14499 <varlistentry>
14500 <term><emphasis role="bold">${perl{</emphasis>&lt;<emphasis>subroutine</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
14501 <listitem>
14502 <para>
14503 <indexterm role="concept">
14504 <primary>Perl</primary>
14505 <secondary>use in expanded string</secondary>
14506 </indexterm>
14507 <indexterm role="concept">
14508 <primary>expansion</primary>
14509 <secondary>calling Perl from</secondary>
14510 </indexterm>
14511 This item is available only if Exim has been built to include an embedded Perl
14512 interpreter. The subroutine name and the arguments are first separately
14513 expanded, and then the Perl subroutine is called with those arguments. No
14514 additional arguments need be given; the maximum number permitted, including the
14515 name of the subroutine, is nine.
14516 </para>
14517 <para>
14518 The return value of the subroutine is inserted into the expanded string, unless
14519 the return value is <option>undef</option>. In that case, the expansion fails in the same
14520 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14521 Whatever you return is evaluated in a scalar context. For example, if you
14522 return the name of a Perl vector, the return value is the size of the vector,
14523 not its contents.
14524 </para>
14525 <para>
14526 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14527 with the error message that was passed to <option>die</option>. More details of the embedded
14528 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14529 </para>
14530 <para>
14531 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14532 out the use of this expansion item in filter files.
14533 </para>
14534 </listitem></varlistentry>
14535 <varlistentry>
14536 <term><emphasis role="bold">${prvs{</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>keynumber</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14537 <listitem>
14538 <para>
14539 <indexterm role="concept">
14540 <primary><option>prvs</option> expansion item</primary>
14541 </indexterm>
14542 The first argument is a complete email address and the second is secret
14543 keystring. The third argument, specifying a key number, is optional. If absent,
14544 it defaults to 0. The result of the expansion is a prvs-signed email address,
14545 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14546 as part of a bounce address tag validation (BATV) scheme. For more discussion
14547 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14548 </para>
14549 </listitem></varlistentry>
14550 <varlistentry>
14551 <term><emphasis role="bold">${prvscheck{</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14552 <listitem>
14553 <para>
14554 <indexterm role="concept">
14555 <primary><option>prvscheck</option> expansion item</primary>
14556 </indexterm>
14557 This expansion item is the complement of the <option>prvs</option> item. It is used for
14558 checking prvs-signed addresses. If the expansion of the first argument does not
14559 yield a syntactically valid prvs-signed address, the whole item expands to the
14560 empty string. When the first argument does expand to a syntactically valid
14561 prvs-signed address, the second argument is expanded, with the prvs-decoded
14562 version of the address and the key number extracted from the address in the
14563 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14564 </para>
14565 <para>
14566 These two variables can be used in the expansion of the second argument to
14567 retrieve the secret. The validity of the prvs-signed address is then checked
14568 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14569 which is empty for failure or <quote>1</quote> for success.
14570 </para>
14571 <para>
14572 The third argument is optional; if it is missing, it defaults to an empty
14573 string. This argument is now expanded. If the result is an empty string, the
14574 result of the expansion is the decoded version of the address. This is the case
14575 whether or not the signature was valid. Otherwise, the result of the expansion
14576 is the expansion of the third argument.
14577 </para>
14578 <para>
14579 All three variables can be used in the expansion of the third argument.
14580 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14581 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14582 </para>
14583 </listitem></varlistentry>
14584 <varlistentry>
14585 <term><emphasis role="bold">${readfile{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>eol&nbsp;string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14586 <listitem>
14587 <para>
14588 <indexterm role="concept">
14589 <primary>expansion</primary>
14590 <secondary>inserting an entire file</secondary>
14591 </indexterm>
14592 <indexterm role="concept">
14593 <primary>file</primary>
14594 <secondary>inserting into expansion</secondary>
14595 </indexterm>
14596 <indexterm role="concept">
14597 <primary><option>readfile</option> expansion item</primary>
14598 </indexterm>
14599 The file name and end-of-line string are first expanded separately. The file is
14600 then read, and its contents replace the entire item. All newline characters in
14601 the file are replaced by the end-of-line string if it is present. Otherwise,
14602 newlines are left in the string.
14603 String expansion is not applied to the contents of the file. If you want this,
14604 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14605 the string expansion fails.
14606 </para>
14607 <para>
14608 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14609 locks out the use of this expansion item in filter files.
14610 </para>
14611 </listitem></varlistentry>
14612 <varlistentry>
14613 <term><emphasis role="bold">${readsocket{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>request</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>timeout</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>eol&nbsp;string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>fail&nbsp;string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14614 <listitem>
14615 <para>
14616 <indexterm role="concept">
14617 <primary>expansion</primary>
14618 <secondary>inserting from a socket</secondary>
14619 </indexterm>
14620 <indexterm role="concept">
14621 <primary>socket, use of in expansion</primary>
14622 </indexterm>
14623 <indexterm role="concept">
14624 <primary><option>readsocket</option> expansion item</primary>
14625 </indexterm>
14626 This item inserts data from a Unix domain or TCP socket into the expanded
14627 string. The minimal way of using it uses just two arguments, as in these
14628 examples:
14629 </para>
14630 <literallayout class="monospaced">
14631 ${readsocket{/socket/name}{request string}}
14632 ${readsocket{inet:some.host:1234}{request string}}
14633 </literallayout>
14634 <para>
14635 For a Unix domain socket, the first substring must be the path to the socket.
14636 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14637 a host name or IP address, followed by a colon and a port, which can be a
14638 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14639 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14640 example:
14641 </para>
14642 <literallayout class="monospaced">
14643 ${readsocket{inet:[::1]:1234}{request string}}
14644 </literallayout>
14645 <para>
14646 Only a single host name may be given, but if looking it up yields more than
14647 one IP address, they are each tried in turn until a connection is made. For
14648 both kinds of socket, Exim makes a connection, writes the request string
14649 unless it is an empty string; and no terminating NUL is ever sent)
14650 and reads from the socket until an end-of-file
14651 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14652 extend what can be done. Firstly, you can vary the timeout. For example:
14653 </para>
14654 <literallayout class="monospaced">
14655 ${readsocket{/socket/name}{request string}{3s}}
14656 </literallayout>
14657 <para>
14658 A fourth argument allows you to change any newlines that are in the data
14659 that is read, in the same way as for <option>readfile</option> (see above). This example
14660 turns them into spaces:
14661 </para>
14662 <literallayout class="monospaced">
14663 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14664 </literallayout>
14665 <para>
14666 As with all expansions, the substrings are expanded before the processing
14667 happens. Errors in these sub-expansions cause the expansion to fail. In
14668 addition, the following errors can occur:
14669 </para>
14670 <itemizedlist>
14671 <listitem>
14672 <para>
14673 Failure to create a socket file descriptor;
14674 </para>
14675 </listitem>
14676 <listitem>
14677 <para>
14678 Failure to connect the socket;
14679 </para>
14680 </listitem>
14681 <listitem>
14682 <para>
14683 Failure to write the request string;
14684 </para>
14685 </listitem>
14686 <listitem>
14687 <para>
14688 Timeout on reading from the socket.
14689 </para>
14690 </listitem>
14691 </itemizedlist>
14692 <para>
14693 By default, any of these errors causes the expansion to fail. However, if
14694 you supply a fifth substring, it is expanded and used when any of the above
14695 errors occurs. For example:
14696 </para>
14697 <literallayout class="monospaced">
14698 ${readsocket{/socket/name}{request string}{3s}{\n}\
14699   {socket failure}}
14700 </literallayout>
14701 <para>
14702 You can test for the existence of a Unix domain socket by wrapping this
14703 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14704 and the actual opening of the socket, so it is safer to use the fifth argument
14705 if you want to be absolutely sure of avoiding an expansion error for a
14706 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14707 </para>
14708 <para>
14709 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14710 locks out the use of this expansion item in filter files.
14711 </para>
14712 </listitem></varlistentry>
14713 <varlistentry>
14714 <term><emphasis role="bold">${reduce{</emphasis>&lt;<emphasis>string1</emphasis>&gt;}{&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14715 <listitem>
14716 <para>
14717 <indexterm role="concept">
14718 <primary>expansion</primary>
14719 <secondary>reducing a list to a scalar</secondary>
14720 </indexterm>
14721 <indexterm role="concept">
14722 <primary>list</primary>
14723 <secondary>reducing to a scalar</secondary>
14724 </indexterm>
14725 <indexterm role="variable">
14726 <primary><varname>$value</varname></primary>
14727 </indexterm>
14728 <indexterm role="variable">
14729 <primary><varname>$item</varname></primary>
14730 </indexterm>
14731 This operation reduces a list to a single, scalar string. After expansion,
14732 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14733 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14734 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14735 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14736 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14737 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14738 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14739 number of ways. For example, to add up a list of numbers:
14740 </para>
14741 <literallayout class="monospaced">
14742 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14743 </literallayout>
14744 <para>
14745 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14746 can be found:
14747 </para>
14748 <literallayout class="monospaced">
14749 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14750 </literallayout>
14751 <para>
14752 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14753 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14754 expansion items.
14755 </para>
14756 </listitem></varlistentry>
14757 <varlistentry>
14758 <term><emphasis role="bold">$rheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$rh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
14759 <listitem>
14760 <para>
14761 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14762 expansion item above.
14763 </para>
14764 </listitem></varlistentry>
14765 <varlistentry>
14766 <term><emphasis role="bold">${run{</emphasis>&lt;<emphasis>command</emphasis>&gt;<emphasis role="bold">&nbsp;</emphasis>&lt;<emphasis>args</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14767 <listitem>
14768 <para>
14769 <indexterm role="concept">
14770 <primary>expansion</primary>
14771 <secondary>running a command</secondary>
14772 </indexterm>
14773 <indexterm role="concept">
14774 <primary><option>run</option> expansion item</primary>
14775 </indexterm>
14776 The command and its arguments are first expanded as one string. The string is
14777 split apart into individual arguments by spaces, and then the command is run
14778 in a separate process, but under the same uid and gid.  As in other command
14779 executions from Exim, a shell is not used by default. If the command requires
14780 a shell, you must explicitly code it.
14781 </para>
14782 <para>
14783 Since the arguments are split by spaces, when there is a variable expansion
14784 which has an empty result, it will cause the situation that the argument will
14785 simply be omitted when the program is actually executed by Exim. If the
14786 script/program requires a specific number of arguments and the expanded
14787 variable could possibly result in this empty expansion, the variable must be
14788 quoted. This is more difficult if the expanded variable itself could result
14789 in a string containing quotes, because it would interfere with the quotes
14790 around the command arguments. A possible guard against this is to wrap the
14791 variable in the <option>sg</option> operator to change any quote marks to some other
14792 character.
14793 </para>
14794 <para>
14795 The standard input for the command exists, but is empty. The standard output
14796 and standard error are set to the same file descriptor.
14797 <indexterm role="concept">
14798 <primary>return code</primary>
14799 <secondary>from <option>run</option> expansion</secondary>
14800 </indexterm>
14801 <indexterm role="variable">
14802 <primary><varname>$value</varname></primary>
14803 </indexterm>
14804 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14805 and replaces the entire item; during this expansion, the standard output/error
14806 from the command is in the variable <varname>$value</varname>. If the command fails,
14807 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14808 expansion, the standard output/error from the command is in the variable
14809 <varname>$value</varname>.
14810 </para>
14811 <para>
14812 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14813 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14814 command does not succeed. If both strings are omitted, the result is contents
14815 of the standard output/error on success, and nothing on failure.
14816 </para>
14817 <para>
14818 <indexterm role="variable">
14819 <primary><varname>$run_in_acl</varname></primary>
14820 </indexterm>
14821 The standard output/error of the command is put in the variable <varname>$value</varname>.
14822 In this ACL example, the output of a command is logged for the admin to
14823 troubleshoot:
14824 </para>
14825 <literallayout class="monospaced">
14826 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14827       log_message  = Output of id: $value
14828 </literallayout>
14829 <para>
14830 If the command requires shell idioms, such as the &gt; redirect operator, the
14831 shell must be invoked directly, such as with:
14832 </para>
14833 <literallayout class="monospaced">
14834 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14835 </literallayout>
14836 <para>
14837 <indexterm role="variable">
14838 <primary><varname>$runrc</varname></primary>
14839 </indexterm>
14840 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14841 remains set afterwards, so in a filter file you can do things like this:
14842 </para>
14843 <literallayout class="monospaced">
14844 if "${run{x y z}{}}$runrc" is 1 then ...
14845   elif $runrc is 2 then ...
14846   ...
14847 endif
14848 </literallayout>
14849 <para>
14850 If execution of the command fails (for example, the command does not exist),
14851 the return code is 127 &ndash; the same code that shells use for non-existent
14852 commands.
14853 </para>
14854 <para>
14855 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14856 option values are expanded, except for those preconditions whose order of
14857 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14858 by the expansion of one option, and use it in another.
14859 </para>
14860 <para>
14861 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14862 out the use of this expansion item in filter files.
14863 </para>
14864 </listitem></varlistentry>
14865 <varlistentry>
14866 <term><emphasis role="bold">${sg{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>regex</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>replacement</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14867 <listitem>
14868 <para>
14869 <indexterm role="concept">
14870 <primary>expansion</primary>
14871 <secondary>string substitution</secondary>
14872 </indexterm>
14873 <indexterm role="concept">
14874 <primary><option>sg</option> expansion item</primary>
14875 </indexterm>
14876 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14877 option; hence its name. However, unlike the Perl equivalent, Exim does not
14878 modify the subject string; instead it returns the modified string for insertion
14879 into the overall expansion. The item takes three arguments: the subject string,
14880 a regular expression, and a substitution string. For example:
14881 </para>
14882 <literallayout class="monospaced">
14883 ${sg{abcdefabcdef}{abc}{xyz}}
14884 </literallayout>
14885 <para>
14886 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14887 if any $ or \ characters are required in the regular expression or in the
14888 substitution string, they have to be escaped. For example:
14889 </para>
14890 <literallayout class="monospaced">
14891 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14892 </literallayout>
14893 <para>
14894 yields <quote>defabc</quote>, and
14895 </para>
14896 <literallayout class="monospaced">
14897 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14898 </literallayout>
14899 <para>
14900 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14901 the regular expression from string expansion.
14902 </para>
14903 </listitem></varlistentry>
14904 <varlistentry>
14905 <term><emphasis role="bold">${sort{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>comparator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>extractor</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14906 <listitem>
14907 <para>
14908 <indexterm role="concept">
14909 <primary>sorting</primary>
14910 <secondary>a list</secondary>
14911 </indexterm>
14912 <indexterm role="concept">
14913 <primary>list</primary>
14914 <secondary>sorting</secondary>
14915 </indexterm>
14916 <indexterm role="concept">
14917 <primary>expansion</primary>
14918 <secondary>list sorting</secondary>
14919 </indexterm>
14920 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14921 default, but the separator can be changed in the usual way.
14922 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14923 of a two-argument expansion condition.
14924 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14925 The comparison should return true when applied to two values
14926 if the first value should sort before the second value.
14927 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14928 the element being placed in <varname>$item</varname>,
14929 to give values for comparison.
14930 </para>
14931 <para>
14932 The item result is a sorted list,
14933 with the original list separator,
14934 of the list elements (in full) of the original.
14935 </para>
14936 <para>
14937 Examples:
14938 </para>
14939 <literallayout class="monospaced">
14940 ${sort{3:2:1:4}{&lt;}{$item}}
14941 </literallayout>
14942 <para>
14943 sorts a list of numbers, and
14944 </para>
14945 <literallayout class="monospaced">
14946 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14947 </literallayout>
14948 <para>
14949 will sort an MX lookup into priority order.
14950 </para>
14951 </listitem></varlistentry>
14952 <varlistentry>
14953 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14954 <listitem>
14955 <para>
14956 <indexterm role="concept">
14957 <primary><option>substr</option> expansion item</primary>
14958 </indexterm>
14959 <indexterm role="concept">
14960 <primary>substring extraction</primary>
14961 </indexterm>
14962 <indexterm role="concept">
14963 <primary>expansion</primary>
14964 <secondary>substring extraction</secondary>
14965 </indexterm>
14966 The three strings are expanded; the first two must yield numbers. Call them
14967 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14968 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14969 can use the simpler operator notation that avoids some of the braces:
14970 </para>
14971 <literallayout class="monospaced">
14972 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14973 </literallayout>
14974 <para>
14975 The second number is optional (in both notations).
14976 If it is absent in the simpler format, the preceding underscore must also be
14977 omitted.
14978 </para>
14979 <para>
14980 The <option>substr</option> item can be used to extract more general substrings than
14981 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14982 length required. For example
14983 </para>
14984 <literallayout class="monospaced">
14985 ${substr{3}{2}{$local_part}}
14986 </literallayout>
14987 <para>
14988 If the starting offset is greater than the string length the result is the
14989 null string; if the length plus starting offset is greater than the string
14990 length, the result is the right-hand part of the string, starting from the
14991 given offset. The first character in the string has offset zero.
14992 </para>
14993 <para>
14994 The <option>substr</option> expansion item can take negative offset values to count
14995 from the right-hand end of its operand. The last character is offset -1, the
14996 second-last is offset -2, and so on. Thus, for example,
14997 </para>
14998 <literallayout class="monospaced">
14999 ${substr{-5}{2}{1234567}}
15000 </literallayout>
15001 <para>
15002 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15003 length of the string, the substring starts at the beginning of the string, and
15004 the length is reduced by the amount of overshoot. Thus, for example,
15005 </para>
15006 <literallayout class="monospaced">
15007 ${substr{-5}{2}{12}}
15008 </literallayout>
15009 <para>
15010 yields an empty string, but
15011 </para>
15012 <literallayout class="monospaced">
15013 ${substr{-3}{2}{12}}
15014 </literallayout>
15015 <para>
15016 yields <quote>1</quote>.
15017 </para>
15018 <para>
15019 When the second number is omitted from <option>substr</option>, the remainder of the string
15020 is taken if the offset is positive. If it is negative, all characters in the
15021 string preceding the offset point are taken. For example, an offset of -1 and
15022 no length, as in these semantically identical examples:
15023 </para>
15024 <literallayout class="monospaced">
15025 ${substr_-1:abcde}
15026 ${substr{-1}{abcde}}
15027 </literallayout>
15028 <para>
15029 yields all but the last character of the string, that is, <quote>abcd</quote>.
15030 </para>
15031 </listitem></varlistentry>
15032 <varlistentry>
15033 <term><emphasis role="bold">${tr{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>characters</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>replacements</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15034 <listitem>
15035 <para>
15036 <indexterm role="concept">
15037 <primary>expansion</primary>
15038 <secondary>character translation</secondary>
15039 </indexterm>
15040 <indexterm role="concept">
15041 <primary><option>tr</option> expansion item</primary>
15042 </indexterm>
15043 This item does single-character translation on its subject string. The second
15044 argument is a list of characters to be translated in the subject string. Each
15045 matching character is replaced by the corresponding character from the
15046 replacement list. For example
15047 </para>
15048 <literallayout class="monospaced">
15049 ${tr{abcdea}{ac}{13}}
15050 </literallayout>
15051 <para>
15052 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15053 last occurrence is used. If the third string is shorter than the second, its
15054 last character is replicated. However, if it is empty, no translation takes
15055 place.
15056 </para>
15057 </listitem></varlistentry>
15058 </variablelist>
15059 </section>
15060 <section id="SECTexpop">
15061 <title>Expansion operators</title>
15062 <para>
15063 <indexterm role="concept">
15064 <primary>expansion</primary>
15065 <secondary>operators</secondary>
15066 </indexterm>
15067 For expansion items that perform transformations on a single argument string,
15068 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15069 The substring is first expanded before the operation is applied to it. The
15070 following operations can be performed:
15071 </para>
15072 <variablelist>
15073 <varlistentry>
15074 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15075 <listitem>
15076 <para>
15077 <indexterm role="concept">
15078 <primary>expansion</primary>
15079 <secondary>RFC 2822 address handling</secondary>
15080 </indexterm>
15081 <indexterm role="concept">
15082 <primary><option>address</option> expansion item</primary>
15083 </indexterm>
15084 The string is interpreted as an RFC 2822 address, as it might appear in a
15085 header line, and the effective address is extracted from it. If the string does
15086 not parse successfully, the result is empty.
15087 </para>
15088 </listitem></varlistentry>
15089 <varlistentry>
15090 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15091 <listitem>
15092 <para>
15093 <indexterm role="concept">
15094 <primary>expansion</primary>
15095 <secondary>RFC 2822 address handling</secondary>
15096 </indexterm>
15097 <indexterm role="concept">
15098 <primary><option>addresses</option> expansion item</primary>
15099 </indexterm>
15100 The string (after expansion) is interpreted as a list of addresses in RFC
15101 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15102 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15103 result of the expansion is a colon-separated list, with appropriate
15104 doubling of colons should any happen to be present in the email addresses.
15105 Syntactically invalid RFC2822 address items are omitted from the output.
15106 </para>
15107 <para>
15108 It is possible to specify a character other than colon for the output
15109 separator by starting the string with &gt; followed by the new separator
15110 character. For example:
15111 </para>
15112 <literallayout class="monospaced">
15113 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15114 </literallayout>
15115 <para>
15116 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
15117 expansion item, which extracts the working address from a single RFC2822
15118 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
15119 processing lists.
15120 </para>
15121 <para>
15122 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15123 a strict interpretation of header line formatting.  Exim parses the bare,
15124 unquoted portion of an email address and if it finds a comma, treats it as an
15125 email address separator. For the example header line:
15126 </para>
15127 <literallayout class="monospaced">
15128 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15129 </literallayout>
15130 <para>
15131 The first example below demonstrates that Q-encoded email addresses are parsed
15132 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15133 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15134 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15135 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15136 The third example shows that the presence of a comma is skipped when it is
15137 quoted.
15138 </para>
15139 <literallayout class="monospaced">
15140 # exim -be '${addresses:From: \
15141 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15142 user@example.com
15143 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15144 Last:user@example.com
15145 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15146 user@example.com
15147 </literallayout>
15148 </listitem></varlistentry>
15149 <varlistentry>
15150 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15151 <listitem>
15152 <para>
15153 <indexterm role="concept">
15154 <primary><option>base32</option> expansion item</primary>
15155 </indexterm>
15156 <indexterm role="concept">
15157 <primary>expansion</primary>
15158 <secondary>conversion to base 32</secondary>
15159 </indexterm>
15160 The string must consist entirely of decimal digits. The number is converted to
15161 base 32 and output as a (empty, for zero) string of characters.
15162 Only lowercase letters are used.
15163 </para>
15164 </listitem></varlistentry>
15165 <varlistentry>
15166 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15167 <listitem>
15168 <para>
15169 <indexterm role="concept">
15170 <primary><option>base32d</option> expansion item</primary>
15171 </indexterm>
15172 <indexterm role="concept">
15173 <primary>expansion</primary>
15174 <secondary>conversion to base 32</secondary>
15175 </indexterm>
15176 The string must consist entirely of base-32 digits.
15177 The number is converted to decimal and output as a string.
15178 </para>
15179 </listitem></varlistentry>
15180 <varlistentry>
15181 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15182 <listitem>
15183 <para>
15184 <indexterm role="concept">
15185 <primary><option>base62</option> expansion item</primary>
15186 </indexterm>
15187 <indexterm role="concept">
15188 <primary>expansion</primary>
15189 <secondary>conversion to base 62</secondary>
15190 </indexterm>
15191 The string must consist entirely of decimal digits. The number is converted to
15192 base 62 and output as a string of six characters, including leading zeros. In
15193 the few operating environments where Exim uses base 36 instead of base 62 for
15194 its message identifiers (because those systems do not have case-sensitive file
15195 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
15196 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15197 </para>
15198 </listitem></varlistentry>
15199 <varlistentry>
15200 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15201 <listitem>
15202 <para>
15203 <indexterm role="concept">
15204 <primary><option>base62d</option> expansion item</primary>
15205 </indexterm>
15206 <indexterm role="concept">
15207 <primary>expansion</primary>
15208 <secondary>conversion to base 62</secondary>
15209 </indexterm>
15210 The string must consist entirely of base-62 digits, or, in operating
15211 environments where Exim uses base 36 instead of base 62 for its message
15212 identifiers, base-36 digits. The number is converted to decimal and output as a
15213 string.
15214 </para>
15215 </listitem></varlistentry>
15216 <varlistentry>
15217 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15218 <listitem>
15219 <para>
15220 <indexterm role="concept">
15221 <primary>expansion</primary>
15222 <secondary>base64 encoding</secondary>
15223 </indexterm>
15224 <indexterm role="concept">
15225 <primary>base64 encoding</primary>
15226 <secondary>in string expansion</secondary>
15227 </indexterm>
15228 <indexterm role="concept">
15229 <primary><option>base64</option> expansion item</primary>
15230 </indexterm>
15231 <indexterm role="concept">
15232 <primary>certificate</primary>
15233 <secondary>base64 of DER</secondary>
15234 </indexterm>
15235 This operator converts a string into one that is base64 encoded.
15236 </para>
15237 <para>
15238 If the string is a single variable of type certificate,
15239 returns the base64 encoding of the DER form of the certificate.
15240 </para>
15241 </listitem></varlistentry>
15242 <varlistentry>
15243 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15244 <listitem>
15245 <para>
15246 <indexterm role="concept">
15247 <primary>expansion</primary>
15248 <secondary>base64 decoding</secondary>
15249 </indexterm>
15250 <indexterm role="concept">
15251 <primary>base64 decoding</primary>
15252 <secondary>in string expansion</secondary>
15253 </indexterm>
15254 <indexterm role="concept">
15255 <primary><option>base64d</option> expansion item</primary>
15256 </indexterm>
15257 This operator converts a base64-encoded string into the un-coded form.
15258 </para>
15259 </listitem></varlistentry>
15260 <varlistentry>
15261 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15262 <listitem>
15263 <para>
15264 <indexterm role="concept">
15265 <primary>domain</primary>
15266 <secondary>extraction</secondary>
15267 </indexterm>
15268 <indexterm role="concept">
15269 <primary>expansion</primary>
15270 <secondary>domain extraction</secondary>
15271 </indexterm>
15272 The string is interpreted as an RFC 2822 address and the domain is extracted
15273 from it. If the string does not parse successfully, the result is empty.
15274 </para>
15275 </listitem></varlistentry>
15276 <varlistentry>
15277 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15278 <listitem>
15279 <para>
15280 <indexterm role="concept">
15281 <primary>expansion</primary>
15282 <secondary>escaping non-printing characters</secondary>
15283 </indexterm>
15284 <indexterm role="concept">
15285 <primary><option>escape</option> expansion item</primary>
15286 </indexterm>
15287 If the string contains any non-printing characters, they are converted to
15288 escape sequences starting with a backslash. Whether characters with the most
15289 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15290 is controlled by the <option>print_topbitchars</option> option.
15291 </para>
15292 </listitem></varlistentry>
15293 <varlistentry>
15294 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15295 <listitem>
15296 <para>
15297 <indexterm role="concept">
15298 <primary>expansion</primary>
15299 <secondary>escaping 8-bit characters</secondary>
15300 </indexterm>
15301 <indexterm role="concept">
15302 <primary><option>escape8bit</option> expansion item</primary>
15303 </indexterm>
15304 If the string contains and characters with the most significant bit set,
15305 they are converted to escape sequences starting with a backslash.
15306 Backslashes and DEL characters are also converted.
15307 </para>
15308 </listitem></varlistentry>
15309 <varlistentry>
15310 <term><emphasis role="bold">${eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis>&nbsp;and&nbsp;<emphasis role="bold">${eval10:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15311 <listitem>
15312 <para>
15313 <indexterm role="concept">
15314 <primary>expansion</primary>
15315 <secondary>expression evaluation</secondary>
15316 </indexterm>
15317 <indexterm role="concept">
15318 <primary>expansion</primary>
15319 <secondary>arithmetic expression</secondary>
15320 </indexterm>
15321 <indexterm role="concept">
15322 <primary><option>eval</option> expansion item</primary>
15323 </indexterm>
15324 These items supports simple arithmetic and bitwise logical operations in
15325 expansion strings. The string (after expansion) must be a conventional
15326 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15327 logical operators, and parentheses. All operations are carried out using
15328 integer arithmetic. The operator priorities are as follows (the same as in the
15329 C programming language):
15330 </para>
15331 <informaltable frame="none">
15332 <tgroup cols="2" colsep="0" rowsep="0">
15333 <colspec colwidth="70pt" align="left"/>
15334 <colspec colwidth="300pt" align="left"/>
15335 <tbody>
15336 <row>
15337 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15338 <entry>not (~), negate (-)</entry>
15339 </row>
15340 <row>
15341 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15342 <entry>multiply (*), divide (/), remainder (%)</entry>
15343 </row>
15344 <row>
15345 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15346 <entry>plus (+), minus (-)</entry>
15347 </row>
15348 <row>
15349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15350 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15351 </row>
15352 <row>
15353 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15354 <entry>and (&amp;)</entry>
15355 </row>
15356 <row>
15357 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15358 <entry>xor (^)</entry>
15359 </row>
15360 <row>
15361 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15362 <entry>or (|)</entry>
15363 </row>
15364 </tbody>
15365 </tgroup>
15366 </informaltable>
15367 <para>
15368 Binary operators with the same priority are evaluated from left to right. White
15369 space is permitted before or after operators.
15370 </para>
15371 <para>
15372 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15373 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15374 decimal, even if they start with a leading zero; hexadecimal numbers are not
15375 permitted. This can be useful when processing numbers extracted from dates or
15376 times, which often do have leading zeros.
15377 </para>
15378 <para>
15379 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15380 or 1024*1024*1024,
15381 respectively. Negative numbers are supported. The result of the computation is
15382 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15383 </para>
15384 <literallayout>
15385 <literal>${eval:1+1}            </literal>  yields 2
15386 <literal>${eval:1+2*3}          </literal>  yields 7
15387 <literal>${eval:(1+2)*3}        </literal>  yields 9
15388 <literal>${eval:2+42%5}         </literal>  yields 4
15389 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15390 <literal>${eval:0xc|5}          </literal>  yields 13
15391 <literal>${eval:0xc^5}          </literal>  yields 9
15392 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15393 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15394 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15395 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15396 </literallayout>
15397 <para>
15398 As a more realistic example, in an ACL you might have
15399 </para>
15400 <literallayout class="monospaced">
15401 deny   message = Too many bad recipients
15402        condition =                    \
15403          ${if and {                   \
15404            {&gt;{$rcpt_count}{10}}       \
15405            {                          \
15406            &lt;                          \
15407              {$recipients_count}      \
15408              {${eval:$rcpt_count/2}}  \
15409            }                          \
15410          }{yes}{no}}
15411 </literallayout>
15412 <para>
15413 The condition is true if there have been more than 10 RCPT commands and
15414 fewer than half of them have resulted in a valid recipient.
15415 </para>
15416 </listitem></varlistentry>
15417 <varlistentry>
15418 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15419 <listitem>
15420 <para>
15421 <indexterm role="concept">
15422 <primary>expansion</primary>
15423 <secondary>re-expansion of substring</secondary>
15424 </indexterm>
15425 The <option>expand</option> operator causes a string to be expanded for a second time. For
15426 example,
15427 </para>
15428 <literallayout class="monospaced">
15429 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15430 </literallayout>
15431 <para>
15432 first looks up a string in a file while expanding the operand for <option>expand</option>,
15433 and then re-expands what it has found.
15434 </para>
15435 </listitem></varlistentry>
15436 <varlistentry>
15437 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15438 <listitem>
15439 <para>
15440 <indexterm role="concept">
15441 <primary>Unicode</primary>
15442 </indexterm>
15443 <indexterm role="concept">
15444 <primary>UTF-8</primary>
15445 <secondary>conversion from</secondary>
15446 </indexterm>
15447 <indexterm role="concept">
15448 <primary>expansion</primary>
15449 <secondary>UTF-8 conversion</secondary>
15450 </indexterm>
15451 <indexterm role="concept">
15452 <primary><option>from_utf8</option> expansion item</primary>
15453 </indexterm>
15454 The world is slowly moving towards Unicode, although there are no standards for
15455 email yet. However, other applications (including some databases) are starting
15456 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15457 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15458 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15459 the result is an undefined sequence of bytes.
15460 </para>
15461 <para>
15462 Unicode code points with values less than 256 are compatible with ASCII and
15463 ISO-8859-1 (also known as Latin-1).
15464 For example, character 169 is the copyright symbol in both cases, though the
15465 way it is encoded is different. In UTF-8, more than one byte is needed for
15466 characters with code values greater than 127, whereas ISO-8859-1 is a
15467 single-byte encoding (but thereby limited to 256 characters). This makes
15468 translation from UTF-8 to ISO-8859-1 straightforward.
15469 </para>
15470 </listitem></varlistentry>
15471 <varlistentry>
15472 <term><emphasis role="bold">${hash_</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>m</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15473 <listitem>
15474 <para>
15475 <indexterm role="concept">
15476 <primary>hash function</primary>
15477 <secondary>textual</secondary>
15478 </indexterm>
15479 <indexterm role="concept">
15480 <primary>expansion</primary>
15481 <secondary>textual hash</secondary>
15482 </indexterm>
15483 The <option>hash</option> operator is a simpler interface to the hashing function that can
15484 be used when the two parameters are fixed numbers (as opposed to strings that
15485 change when expanded). The effect is the same as
15486 </para>
15487 <literallayout class="monospaced">
15488 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15489 </literallayout>
15490 <para>
15491 See the description of the general <option>hash</option> item above for details. The
15492 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15493 </para>
15494 </listitem></varlistentry>
15495 <varlistentry>
15496 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15497 <listitem>
15498 <para>
15499 <indexterm role="concept">
15500 <primary>base64 encoding</primary>
15501 <secondary>conversion from hex</secondary>
15502 </indexterm>
15503 <indexterm role="concept">
15504 <primary>expansion</primary>
15505 <secondary>hex to base64</secondary>
15506 </indexterm>
15507 <indexterm role="concept">
15508 <primary><option>hex2b64</option> expansion item</primary>
15509 </indexterm>
15510 This operator converts a hex string into one that is base64 encoded. This can
15511 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15512 </para>
15513 </listitem></varlistentry>
15514 <varlistentry>
15515 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15516 <listitem>
15517 <para>
15518 <indexterm role="concept">
15519 <primary>quoting</primary>
15520 <secondary>hex-encoded unprintable characters</secondary>
15521 </indexterm>
15522 <indexterm role="concept">
15523 <primary><option>hexquote</option> expansion item</primary>
15524 </indexterm>
15525 This operator converts non-printable characters in a string into a hex
15526 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15527 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15528 byte value 127 is converted to <literal>\x7f</literal>.
15529 </para>
15530 </listitem></varlistentry>
15531 <varlistentry>
15532 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15533 <listitem>
15534 <para>
15535 <indexterm role="concept">
15536 <primary><option>ipv6denorm</option> expansion item</primary>
15537 </indexterm>
15538 <indexterm role="concept">
15539 <primary>IP address</primary>
15540 <secondary>normalisation</secondary>
15541 </indexterm>
15542 This expands an IPv6 address to a full eight-element colon-separated set
15543 of hex digits including leading zeroes.
15544 A trailing ipv4-style dotted-decimal set is converted to hex.
15545 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15546 </para>
15547 </listitem></varlistentry>
15548 <varlistentry>
15549 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15550 <listitem>
15551 <para>
15552 <indexterm role="concept">
15553 <primary><option>ipv6norm</option> expansion item</primary>
15554 </indexterm>
15555 <indexterm role="concept">
15556 <primary>IP address</primary>
15557 <secondary>normalisation</secondary>
15558 </indexterm>
15559 <indexterm role="concept">
15560 <primary>IP address</primary>
15561 <secondary>canonical form</secondary>
15562 </indexterm>
15563 This converts an IPv6 address to canonical form.
15564 Leading zeroes of groups are omitted, and the longest
15565 set of zero-valued groups is replaced with a double colon.
15566 A trailing ipv4-style dotted-decimal set is converted to hex.
15567 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15568 </para>
15569 </listitem></varlistentry>
15570 <varlistentry>
15571 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15572 <listitem>
15573 <para>
15574 <indexterm role="concept">
15575 <primary>case forcing in strings</primary>
15576 </indexterm>
15577 <indexterm role="concept">
15578 <primary>string</primary>
15579 <secondary>case forcing</secondary>
15580 </indexterm>
15581 <indexterm role="concept">
15582 <primary>lower casing</primary>
15583 </indexterm>
15584 <indexterm role="concept">
15585 <primary>expansion</primary>
15586 <secondary>case forcing</secondary>
15587 </indexterm>
15588 <indexterm role="concept">
15589 <primary><option>lc</option> expansion item</primary>
15590 </indexterm>
15591 This forces the letters in the string into lower-case, for example:
15592 </para>
15593 <literallayout class="monospaced">
15594 ${lc:$local_part}
15595 </literallayout>
15596 </listitem></varlistentry>
15597 <varlistentry>
15598 <term><emphasis role="bold">${length_</emphasis>&lt;<emphasis>number</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15599 <listitem>
15600 <para>
15601 <indexterm role="concept">
15602 <primary>expansion</primary>
15603 <secondary>string truncation</secondary>
15604 </indexterm>
15605 <indexterm role="concept">
15606 <primary><option>length</option> expansion item</primary>
15607 </indexterm>
15608 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15609 can be used when the parameter is a fixed number (as opposed to a string that
15610 changes when expanded). The effect is the same as
15611 </para>
15612 <literallayout class="monospaced">
15613 ${length{&lt;number&gt;}{&lt;string&gt;}}
15614 </literallayout>
15615 <para>
15616 See the description of the general <option>length</option> item above for details. Note that
15617 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15618 when <option>length</option> is used as an operator.
15619 </para>
15620 </listitem></varlistentry>
15621 <varlistentry>
15622 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15623 <listitem>
15624 <para>
15625 <indexterm role="concept">
15626 <primary>expansion</primary>
15627 <secondary>list item count</secondary>
15628 </indexterm>
15629 <indexterm role="concept">
15630 <primary>list</primary>
15631 <secondary>item count</secondary>
15632 </indexterm>
15633 <indexterm role="concept">
15634 <primary>list</primary>
15635 <secondary>count of items</secondary>
15636 </indexterm>
15637 <indexterm role="concept">
15638 <primary><option>listcount</option> expansion item</primary>
15639 </indexterm>
15640 The string is interpreted as a list and the number of items is returned.
15641 </para>
15642 </listitem></varlistentry>
15643 <varlistentry>
15644 <term><emphasis role="bold">${listnamed:</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}</emphasis>&nbsp;and&nbsp;<emphasis role="bold">${listnamed_</emphasis>&lt;<emphasis>type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15645 <listitem>
15646 <para>
15647 <indexterm role="concept">
15648 <primary>expansion</primary>
15649 <secondary>named list</secondary>
15650 </indexterm>
15651 <indexterm role="concept">
15652 <primary><option>listnamed</option> expansion item</primary>
15653 </indexterm>
15654 The name is interpreted as a named list and the content of the list is returned,
15655 expanding any referenced lists, re-quoting as needed for colon-separation.
15656 If the optional type is given it must be one of "a", "d", "h" or "l"
15657 and selects address-, domain-, host- or localpart- lists to search among respectively.
15658 Otherwise all types are searched in an undefined order and the first
15659 matching list is returned.
15660 </para>
15661 </listitem></varlistentry>
15662 <varlistentry>
15663 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15664 <listitem>
15665 <para>
15666 <indexterm role="concept">
15667 <primary>expansion</primary>
15668 <secondary>local part extraction</secondary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary><option>local_part</option> expansion item</primary>
15672 </indexterm>
15673 The string is interpreted as an RFC 2822 address and the local part is
15674 extracted from it. If the string does not parse successfully, the result is
15675 empty.
15676 </para>
15677 </listitem></varlistentry>
15678 <varlistentry>
15679 <term><emphasis role="bold">${mask:</emphasis>&lt;<emphasis>IP&nbsp;address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>bit&nbsp;count</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15680 <listitem>
15681 <para>
15682 <indexterm role="concept">
15683 <primary>masked IP address</primary>
15684 </indexterm>
15685 <indexterm role="concept">
15686 <primary>IP address</primary>
15687 <secondary>masking</secondary>
15688 </indexterm>
15689 <indexterm role="concept">
15690 <primary>CIDR notation</primary>
15691 </indexterm>
15692 <indexterm role="concept">
15693 <primary>expansion</primary>
15694 <secondary>IP address masking</secondary>
15695 </indexterm>
15696 <indexterm role="concept">
15697 <primary><option>mask</option> expansion item</primary>
15698 </indexterm>
15699 If the form of the string to be operated on is not an IP address followed by a
15700 slash and an integer (that is, a network address in CIDR notation), the
15701 expansion fails. Otherwise, this operator converts the IP address to binary,
15702 masks off the least significant bits according to the bit count, and converts
15703 the result back to text, with mask appended. For example,
15704 </para>
15705 <literallayout class="monospaced">
15706 ${mask:10.111.131.206/28}
15707 </literallayout>
15708 <para>
15709 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15710 be mostly used for looking up masked addresses in files, the result for an IPv6
15711 address uses dots to separate components instead of colons, because colon
15712 terminates a key string in lsearch files. So, for example,
15713 </para>
15714 <literallayout class="monospaced">
15715 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15716 </literallayout>
15717 <para>
15718 returns the string
15719 </para>
15720 <literallayout class="monospaced">
15721 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15722 </literallayout>
15723 <para>
15724 Letters in IPv6 addresses are always output in lower case.
15725 </para>
15726 </listitem></varlistentry>
15727 <varlistentry>
15728 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15729 <listitem>
15730 <para>
15731 <indexterm role="concept">
15732 <primary>MD5 hash</primary>
15733 </indexterm>
15734 <indexterm role="concept">
15735 <primary>expansion</primary>
15736 <secondary>MD5 hash</secondary>
15737 </indexterm>
15738 <indexterm role="concept">
15739 <primary>certificate</primary>
15740 <secondary>fingerprint</secondary>
15741 </indexterm>
15742 <indexterm role="concept">
15743 <primary><option>md5</option> expansion item</primary>
15744 </indexterm>
15745 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15746 as a 32-digit hexadecimal number, in which any letters are in lower case.
15747 </para>
15748 <para>
15749 If the string is a single variable of type certificate,
15750 returns the MD5 hash fingerprint of the certificate.
15751 </para>
15752 </listitem></varlistentry>
15753 <varlistentry>
15754 <term><emphasis role="bold">${nhash_</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>m</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15755 <listitem>
15756 <para>
15757 <indexterm role="concept">
15758 <primary>expansion</primary>
15759 <secondary>numeric hash</secondary>
15760 </indexterm>
15761 <indexterm role="concept">
15762 <primary>hash function</primary>
15763 <secondary>numeric</secondary>
15764 </indexterm>
15765 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15766 that can be used when the two parameters are fixed numbers (as opposed to
15767 strings that change when expanded). The effect is the same as
15768 </para>
15769 <literallayout class="monospaced">
15770 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15771 </literallayout>
15772 <para>
15773 See the description of the general <option>nhash</option> item above for details.
15774 </para>
15775 </listitem></varlistentry>
15776 <varlistentry>
15777 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15778 <listitem>
15779 <para>
15780 <indexterm role="concept">
15781 <primary>quoting</primary>
15782 <secondary>in string expansions</secondary>
15783 </indexterm>
15784 <indexterm role="concept">
15785 <primary>expansion</primary>
15786 <secondary>quoting</secondary>
15787 </indexterm>
15788 <indexterm role="concept">
15789 <primary><option>quote</option> expansion item</primary>
15790 </indexterm>
15791 The <option>quote</option> operator puts its argument into double quotes if it
15792 is an empty string or
15793 contains anything other than letters, digits, underscores, dots, and hyphens.
15794 Any occurrences of double quotes and backslashes are escaped with a backslash.
15795 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15796 respectively For example,
15797 </para>
15798 <literallayout class="monospaced">
15799 ${quote:ab"*"cd}
15800 </literallayout>
15801 <para>
15802 becomes
15803 </para>
15804 <literallayout class="monospaced">
15805 "ab\"*\"cd"
15806 </literallayout>
15807 <para>
15808 The place where this is useful is when the argument is a substitution from a
15809 variable or a message header.
15810 </para>
15811 </listitem></varlistentry>
15812 <varlistentry>
15813 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15814 <listitem>
15815 <para>
15816 <indexterm role="concept">
15817 <primary><option>quote_local_part</option> expansion item</primary>
15818 </indexterm>
15819 This operator is like <option>quote</option>, except that it quotes the string only if
15820 required to do so by the rules of RFC 2822 for quoting local parts. For
15821 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15822 If you are creating a new email address from the contents of <varname>$local_part</varname>
15823 (or any other unknown data), you should always use this operator.
15824 </para>
15825 </listitem></varlistentry>
15826 <varlistentry>
15827 <term><emphasis role="bold">${quote_</emphasis>&lt;<emphasis>lookup-type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15828 <listitem>
15829 <para>
15830 <indexterm role="concept">
15831 <primary>quoting</primary>
15832 <secondary>lookup-specific</secondary>
15833 </indexterm>
15834 This operator applies lookup-specific quoting rules to the string. Each
15835 query-style lookup type has its own quoting rules which are described with
15836 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15837 </para>
15838 <literallayout class="monospaced">
15839 ${quote_ldap:two * two}
15840 </literallayout>
15841 <para>
15842 returns
15843 </para>
15844 <literallayout class="monospaced">
15845 two%20%5C2A%20two
15846 </literallayout>
15847 <para>
15848 For single-key lookup types, no quoting is ever necessary and this operator
15849 yields an unchanged string.
15850 </para>
15851 </listitem></varlistentry>
15852 <varlistentry>
15853 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15854 <listitem>
15855 <para>
15856 <indexterm role="concept">
15857 <primary>random number</primary>
15858 </indexterm>
15859 This operator returns a somewhat random number which is less than the
15860 supplied number and is at least 0.  The quality of this randomness depends
15861 on how Exim was built; the values are not suitable for keying material.
15862 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15863 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15864 for versions of GnuTLS with that function.
15865 Otherwise, the implementation may be arc4random(), random() seeded by
15866 srandomdev() or srandom(), or a custom implementation even weaker than
15867 random().
15868 </para>
15869 </listitem></varlistentry>
15870 <varlistentry>
15871 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15872 <listitem>
15873 <para>
15874 <indexterm role="concept">
15875 <primary>expansion</primary>
15876 <secondary>IP address</secondary>
15877 </indexterm>
15878 This operator reverses an IP address; for IPv4 addresses, the result is in
15879 dotted-quad decimal form, while for IPv6 addresses the result is in
15880 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15881 for DNS.  For example,
15882 </para>
15883 <literallayout class="monospaced">
15884 ${reverse_ip:192.0.2.4}
15885 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15886 </literallayout>
15887 <para>
15888 returns
15889 </para>
15890 <literallayout class="monospaced">
15891 4.2.0.192
15892 f.7.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
15893 </literallayout>
15894 </listitem></varlistentry>
15895 <varlistentry>
15896 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15897 <listitem>
15898 <para>
15899 <indexterm role="concept">
15900 <primary>expansion</primary>
15901 <secondary>RFC 2047</secondary>
15902 </indexterm>
15903 <indexterm role="concept">
15904 <primary>RFC 2047</primary>
15905 <secondary>expansion operator</secondary>
15906 </indexterm>
15907 <indexterm role="concept">
15908 <primary><option>rfc2047</option> expansion item</primary>
15909 </indexterm>
15910 This operator encodes text according to the rules of RFC 2047. This is an
15911 encoding that is used in header lines to encode non-ASCII characters. It is
15912 assumed that the input string is in the encoding specified by the
15913 <option>headers_charset</option> option, which gets its default at build time. If the string
15914 contains only characters in the range 33&ndash;126, and no instances of the
15915 characters
15916 </para>
15917 <literallayout class="monospaced">
15918 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15919 </literallayout>
15920 <para>
15921 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15922 string, using as many <quote>encoded words</quote> as necessary to encode all the
15923 characters.
15924 </para>
15925 </listitem></varlistentry>
15926 <varlistentry>
15927 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15928 <listitem>
15929 <para>
15930 <indexterm role="concept">
15931 <primary>expansion</primary>
15932 <secondary>RFC 2047</secondary>
15933 </indexterm>
15934 <indexterm role="concept">
15935 <primary>RFC 2047</primary>
15936 <secondary>decoding</secondary>
15937 </indexterm>
15938 <indexterm role="concept">
15939 <primary><option>rfc2047d</option> expansion item</primary>
15940 </indexterm>
15941 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15942 bytes are replaced by question marks. Characters are converted into the
15943 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15944 not recognized unless <option>check_rfc2047_length</option> is set false.
15945 </para>
15946 <para>
15947 <emphasis role="bold">Note</emphasis>: If you use <option>$header</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis> (or <option>$h</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis>) to
15948 access a header line, RFC 2047 decoding is done automatically. You do not need
15949 to use this operator as well.
15950 </para>
15951 </listitem></varlistentry>
15952 <varlistentry>
15953 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15954 <listitem>
15955 <para>
15956 <indexterm role="concept">
15957 <primary>quoting</primary>
15958 <secondary>in regular expressions</secondary>
15959 </indexterm>
15960 <indexterm role="concept">
15961 <primary>regular expressions</primary>
15962 <secondary>quoting</secondary>
15963 </indexterm>
15964 <indexterm role="concept">
15965 <primary><option>rxquote</option> expansion item</primary>
15966 </indexterm>
15967 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15968 characters in its argument. This is useful when substituting the values of
15969 variables or headers inside regular expressions.
15970 </para>
15971 </listitem></varlistentry>
15972 <varlistentry>
15973 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15974 <listitem>
15975 <para>
15976 <indexterm role="concept">
15977 <primary>SHA-1 hash</primary>
15978 </indexterm>
15979 <indexterm role="concept">
15980 <primary>expansion</primary>
15981 <secondary>SHA-1 hashing</secondary>
15982 </indexterm>
15983 <indexterm role="concept">
15984 <primary>certificate</primary>
15985 <secondary>fingerprint</secondary>
15986 </indexterm>
15987 <indexterm role="concept">
15988 <primary><option>sha1</option> expansion item</primary>
15989 </indexterm>
15990 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15991 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15992 </para>
15993 <para>
15994 If the string is a single variable of type certificate,
15995 returns the SHA-1 hash fingerprint of the certificate.
15996 </para>
15997 </listitem></varlistentry>
15998 <varlistentry>
15999 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16000 <listitem>
16001 <para>
16002 <indexterm role="concept">
16003 <primary>SHA-256 hash</primary>
16004 </indexterm>
16005 <indexterm role="concept">
16006 <primary>certificate</primary>
16007 <secondary>fingerprint</secondary>
16008 </indexterm>
16009 <indexterm role="concept">
16010 <primary>expansion</primary>
16011 <secondary>SHA-256 hashing</secondary>
16012 </indexterm>
16013 <indexterm role="concept">
16014 <primary><option>sha256</option> expansion item</primary>
16015 </indexterm>
16016 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16017 and returns
16018 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16019 </para>
16020 <para>
16021 If the string is a single variable of type certificate,
16022 returns the SHA-256 hash fingerprint of the certificate.
16023 </para>
16024 </listitem></varlistentry>
16025 <varlistentry>
16026 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16027 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16028 <listitem>
16029 <para>
16030 <indexterm role="concept">
16031 <primary>SHA3 hash</primary>
16032 </indexterm>
16033 <indexterm role="concept">
16034 <primary>expansion</primary>
16035 <secondary>SHA3 hashing</secondary>
16036 </indexterm>
16037 <indexterm role="concept">
16038 <primary><option>sha3</option> expansion item</primary>
16039 </indexterm>
16040 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16041 and returns
16042 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16043 </para>
16044 <para>
16045 If a number is appended, separated by an underbar, it specifies
16046 the output length.  Values of 224, 256, 384 and 512 are accepted;
16047 with 256 being the default.
16048 </para>
16049 <para>
16050 The <option>sha3</option> expansion item is only supported if Exim has been
16051 compiled with GnuTLS 3.5.0 or later.
16052 </para>
16053 </listitem></varlistentry>
16054 <varlistentry>
16055 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16056 <listitem>
16057 <para>
16058 <indexterm role="concept">
16059 <primary>expansion</primary>
16060 <secondary>statting a file</secondary>
16061 </indexterm>
16062 <indexterm role="concept">
16063 <primary>file</primary>
16064 <secondary>extracting characteristics</secondary>
16065 </indexterm>
16066 <indexterm role="concept">
16067 <primary><option>stat</option> expansion item</primary>
16068 </indexterm>
16069 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16070 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16071 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16072 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16073 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16074 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16075 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16076 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16077 can extract individual fields using the <option>extract</option> expansion item.
16078 </para>
16079 <para>
16080 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16081 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16082 systems for files larger than 2GB.
16083 </para>
16084 </listitem></varlistentry>
16085 <varlistentry>
16086 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16087 <listitem>
16088 <para>
16089 <indexterm role="concept">
16090 <primary><option>str2b64</option> expansion item</primary>
16091 </indexterm>
16092 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16093 </para>
16094 </listitem></varlistentry>
16095 <varlistentry>
16096 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16097 <listitem>
16098 <para>
16099 <indexterm role="concept">
16100 <primary>expansion</primary>
16101 <secondary>string length</secondary>
16102 </indexterm>
16103 <indexterm role="concept">
16104 <primary>string</primary>
16105 <secondary>length in expansion</secondary>
16106 </indexterm>
16107 <indexterm role="concept">
16108 <primary><option>strlen</option> expansion item</primary>
16109 </indexterm>
16110 The item is replace by the length of the expanded string, expressed as a
16111 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
16112 </para>
16113 </listitem></varlistentry>
16114 <varlistentry>
16115 <term><emphasis role="bold">${substr_</emphasis>&lt;<emphasis>start</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>length</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16116 <listitem>
16117 <para>
16118 <indexterm role="concept">
16119 <primary><option>substr</option> expansion item</primary>
16120 </indexterm>
16121 <indexterm role="concept">
16122 <primary>substring extraction</primary>
16123 </indexterm>
16124 <indexterm role="concept">
16125 <primary>expansion</primary>
16126 <secondary>substring expansion</secondary>
16127 </indexterm>
16128 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
16129 can be used when the two parameters are fixed numbers (as opposed to strings
16130 that change when expanded). The effect is the same as
16131 </para>
16132 <literallayout class="monospaced">
16133 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
16134 </literallayout>
16135 <para>
16136 See the description of the general <option>substr</option> item above for details. The
16137 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
16138 </para>
16139 </listitem></varlistentry>
16140 <varlistentry>
16141 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16142 <listitem>
16143 <para>
16144 <indexterm role="concept">
16145 <primary><option>time_eval</option> expansion item</primary>
16146 </indexterm>
16147 <indexterm role="concept">
16148 <primary>time interval</primary>
16149 <secondary>decoding</secondary>
16150 </indexterm>
16151 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
16152 seconds.
16153 </para>
16154 </listitem></varlistentry>
16155 <varlistentry>
16156 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16157 <listitem>
16158 <para>
16159 <indexterm role="concept">
16160 <primary><option>time_interval</option> expansion item</primary>
16161 </indexterm>
16162 <indexterm role="concept">
16163 <primary>time interval</primary>
16164 <secondary>formatting</secondary>
16165 </indexterm>
16166 The argument (after sub-expansion) must be a sequence of decimal digits that
16167 represents an interval of time as a number of seconds. It is converted into a
16168 number of larger units and output in Exim&#x2019;s normal time format, for example,
16169 <literal>1w3d4h2m6s</literal>.
16170 </para>
16171 </listitem></varlistentry>
16172 <varlistentry>
16173 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16174 <listitem>
16175 <para>
16176 <indexterm role="concept">
16177 <primary>case forcing in strings</primary>
16178 </indexterm>
16179 <indexterm role="concept">
16180 <primary>string</primary>
16181 <secondary>case forcing</secondary>
16182 </indexterm>
16183 <indexterm role="concept">
16184 <primary>upper casing</primary>
16185 </indexterm>
16186 <indexterm role="concept">
16187 <primary>expansion</primary>
16188 <secondary>case forcing</secondary>
16189 </indexterm>
16190 <indexterm role="concept">
16191 <primary><option>uc</option> expansion item</primary>
16192 </indexterm>
16193 This forces the letters in the string into upper-case.
16194 </para>
16195 </listitem></varlistentry>
16196 <varlistentry>
16197 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16198 <listitem>
16199 <para>
16200 <indexterm role="concept">
16201 <primary>correction of invalid utf-8 sequences in strings</primary>
16202 </indexterm>
16203 <indexterm role="concept">
16204 <primary>utf-8</primary>
16205 <secondary>utf-8 sequences</secondary>
16206 </indexterm>
16207 <indexterm role="concept">
16208 <primary>incorrect utf-8</primary>
16209 </indexterm>
16210 <indexterm role="concept">
16211 <primary>expansion</primary>
16212 <secondary>utf-8 forcing</secondary>
16213 </indexterm>
16214 <indexterm role="concept">
16215 <primary><option>utf8clean</option> expansion item</primary>
16216 </indexterm>
16217 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16218 </para>
16219 </listitem></varlistentry>
16220 <varlistentry>
16221 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16222 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16223 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16224 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16225 <listitem>
16226 <para>
16227 <indexterm role="concept">
16228 <primary>expansion</primary>
16229 <secondary>UTF-8</secondary>
16230 </indexterm>
16231 <indexterm role="concept">
16232 <primary>UTF-8</primary>
16233 <secondary>expansion</secondary>
16234 </indexterm>
16235 <indexterm role="concept">
16236 <primary>EAI</primary>
16237 </indexterm>
16238 <indexterm role="concept">
16239 <primary>internationalisation</primary>
16240 </indexterm>
16241 <indexterm role="concept">
16242 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16243 </indexterm>
16244 <indexterm role="concept">
16245 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16246 </indexterm>
16247 <indexterm role="concept">
16248 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16249 </indexterm>
16250 <indexterm role="concept">
16251 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16252 </indexterm>
16253 These convert EAI mail name components between UTF-8 and a-label forms.
16254 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16255 </para>
16256 </listitem></varlistentry>
16257 </variablelist>
16258 </section>
16259 <section id="SECTexpcond">
16260 <title>Expansion conditions</title>
16261 <para>
16262 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16263 <primary>expansion</primary>
16264 <secondary>conditions</secondary>
16265 </indexterm>
16266 The following conditions are available for testing by the <option>${if</option> construct
16267 while expanding strings:
16268 </para>
16269 <variablelist>
16270 <varlistentry>
16271 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16272 <listitem>
16273 <para>
16274 <indexterm role="concept">
16275 <primary>expansion</primary>
16276 <secondary>negating a condition</secondary>
16277 </indexterm>
16278 <indexterm role="concept">
16279 <primary>negation</primary>
16280 <secondary>in expansion condition</secondary>
16281 </indexterm>
16282 Preceding any condition with an exclamation mark negates the result of the
16283 condition.
16284 </para>
16285 </listitem></varlistentry>
16286 <varlistentry>
16287 <term>&lt;<emphasis>symbolic&nbsp;operator</emphasis>&gt;&nbsp;<emphasis role="bold">{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16288 <listitem>
16289 <para>
16290 <indexterm role="concept">
16291 <primary>numeric comparison</primary>
16292 </indexterm>
16293 <indexterm role="concept">
16294 <primary>expansion</primary>
16295 <secondary>numeric comparison</secondary>
16296 </indexterm>
16297 There are a number of symbolic operators for doing numeric comparisons. They
16298 are:
16299 </para>
16300 <literallayout>
16301 <literal>=   </literal>   equal
16302 <literal>==  </literal>   equal
16303 <literal>&gt;   </literal>   greater
16304 <literal>&gt;=  </literal>   greater or equal
16305 <literal>&lt;   </literal>   less
16306 <literal>&lt;=  </literal>   less or equal
16307 </literallayout>
16308 <para>
16309 For example:
16310 </para>
16311 <literallayout class="monospaced">
16312 ${if &gt;{$message_size}{10M} ...
16313 </literallayout>
16314 <para>
16315 Note that the general negation operator provides for inequality testing. The
16316 two strings must take the form of optionally signed decimal integers,
16317 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16318 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16319 As a special case, the numerical value of an empty string is taken as
16320 zero.
16321 </para>
16322 <para>
16323 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16324 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16325 10M, not if 10M is larger than <varname>$message_size</varname>.
16326 </para>
16327 </listitem></varlistentry>
16328 <varlistentry>
16329 <term><emphasis role="bold">acl&nbsp;{{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
16330 <listitem>
16331 <para>
16332 <indexterm role="concept">
16333 <primary>expansion</primary>
16334 <secondary>calling an acl</secondary>
16335 </indexterm>
16336 <indexterm role="concept">
16337 <primary><option>acl</option></primary>
16338 <secondary>expansion condition</secondary>
16339 </indexterm>
16340 The name and zero to nine argument strings are first expanded separately.  The expanded
16341 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16342 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16343 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16344 and may use the variables; if another acl expansion is used the values
16345 are restored after it returns.  If the ACL sets
16346 a value using a "message =" modifier the variable $value becomes
16347 the result of the expansion, otherwise it is empty.
16348 If the ACL returns accept the condition is true; if deny, false.
16349 If the ACL returns defer the result is a forced-fail.
16350 </para>
16351 </listitem></varlistentry>
16352 <varlistentry>
16353 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16354 <listitem>
16355 <para>
16356 <indexterm role="concept">
16357 <primary>expansion</primary>
16358 <secondary>boolean parsing</secondary>
16359 </indexterm>
16360 <indexterm role="concept">
16361 <primary><option>bool</option> expansion condition</primary>
16362 </indexterm>
16363 This condition turns a string holding a true or false representation into
16364 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16365 (case-insensitively); also integer numbers map to true if non-zero,
16366 false if zero.
16367 An empty string is treated as false.
16368 Leading and trailing whitespace is ignored;
16369 thus a string consisting only of whitespace is false.
16370 All other string values will result in expansion failure.
16371 </para>
16372 <para>
16373 When combined with ACL variables, this expansion condition will let you
16374 make decisions in one place and act on those decisions in another place.
16375 For example:
16376 </para>
16377 <literallayout class="monospaced">
16378 ${if bool{$acl_m_privileged_sender} ...
16379 </literallayout>
16380 </listitem></varlistentry>
16381 <varlistentry>
16382 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16383 <listitem>
16384 <para>
16385 <indexterm role="concept">
16386 <primary>expansion</primary>
16387 <secondary>boolean parsing</secondary>
16388 </indexterm>
16389 <indexterm role="concept">
16390 <primary><option>bool_lax</option> expansion condition</primary>
16391 </indexterm>
16392 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16393 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16394 loose definition that the Router <option>condition</option> option uses.  The empty string
16395 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16396 true.  Leading and trailing whitespace is ignored.
16397 </para>
16398 <para>
16399 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16400 </para>
16401 </listitem></varlistentry>
16402 <varlistentry>
16403 <term><emphasis role="bold">crypteq&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16404 <listitem>
16405 <para>
16406 <indexterm role="concept">
16407 <primary>expansion</primary>
16408 <secondary>encrypted comparison</secondary>
16409 </indexterm>
16410 <indexterm role="concept">
16411 <primary>encrypted strings, comparing</primary>
16412 </indexterm>
16413 <indexterm role="concept">
16414 <primary><option>crypteq</option> expansion condition</primary>
16415 </indexterm>
16416 This condition is included in the Exim binary if it is built to support any
16417 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16418 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16419 included in the binary.
16420 </para>
16421 <para>
16422 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16423 compared against the second, which is already encrypted. The second string may
16424 be in the LDAP form for storing encrypted strings, which starts with the
16425 encryption type in curly brackets, followed by the data. If the second string
16426 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16427 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16428 Typically this will be a field from a password file. An example of an encrypted
16429 string in LDAP form is:
16430 </para>
16431 <literallayout class="monospaced">
16432 {md5}CY9rzUYh03PK3k6DJie09g==
16433 </literallayout>
16434 <para>
16435 If such a string appears directly in an expansion, the curly brackets have to
16436 be quoted, because they are part of the expansion syntax. For example:
16437 </para>
16438 <literallayout class="monospaced">
16439 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16440 </literallayout>
16441 <para>
16442 The following encryption types (whose names are matched case-independently) are
16443 supported:
16444 </para>
16445 <itemizedlist>
16446 <listitem>
16447 <para>
16448 <indexterm role="concept">
16449 <primary>MD5 hash</primary>
16450 </indexterm>
16451 <indexterm role="concept">
16452 <primary>base64 encoding</primary>
16453 <secondary>in encrypted password</secondary>
16454 </indexterm>
16455 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16456 printable characters to compare with the remainder of the second string. If the
16457 length of the comparison string is 24, Exim assumes that it is base64 encoded
16458 (as in the above example). If the length is 32, Exim assumes that it is a
16459 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16460 comparison fails.
16461 </para>
16462 </listitem>
16463 <listitem>
16464 <para>
16465 <indexterm role="concept">
16466 <primary>SHA-1 hash</primary>
16467 </indexterm>
16468 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16469 printable characters to compare with the remainder of the second string. If the
16470 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16471 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16472 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16473 </para>
16474 </listitem>
16475 <listitem>
16476 <para>
16477 <indexterm role="concept">
16478 <primary><function>crypt()</function></primary>
16479 </indexterm>
16480 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16481 only the first eight characters of the password. However, in modern operating
16482 systems this is no longer true, and in many cases the entire password is used,
16483 whatever its length.
16484 </para>
16485 </listitem>
16486 <listitem>
16487 <para>
16488 <indexterm role="concept">
16489 <primary><function>crypt16()</function></primary>
16490 </indexterm>
16491 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16492 use up to 16 characters of the password in some operating systems. Again, in
16493 modern operating systems, more characters may be used.
16494 </para>
16495 </listitem>
16496 </itemizedlist>
16497 <para>
16498 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16499 <function>crypt()</function>. For operating systems that have their own version, setting
16500 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16501 operating system version instead of its own. This option is set by default in
16502 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16503 support <function>crypt16()</function>.
16504 </para>
16505 <para>
16506 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16507 it was not using the same algorithm as some operating systems&#x2019; versions. It
16508 turns out that as well as <function>crypt16()</function> there is a function called
16509 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16510 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16511 </para>
16512 <para>
16513 However, since there is now a move away from the traditional <function>crypt()</function>
16514 functions towards using SHA1 and other algorithms, tidying up this area of
16515 Exim is seen as very low priority.
16516 </para>
16517 <para>
16518 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16519 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16520 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16521 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16522 function by specifying it explicitly in curly brackets.
16523 </para>
16524 </listitem></varlistentry>
16525 <varlistentry>
16526 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16527 <listitem>
16528 <para>
16529 <indexterm role="concept">
16530 <primary>expansion</primary>
16531 <secondary>checking for empty variable</secondary>
16532 </indexterm>
16533 <indexterm role="concept">
16534 <primary><option>def</option> expansion condition</primary>
16535 </indexterm>
16536 The <option>def</option> condition must be followed by the name of one of the expansion
16537 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16538 variable does not contain the empty string. For example:
16539 </para>
16540 <literallayout class="monospaced">
16541 ${if def:sender_ident {from $sender_ident}}
16542 </literallayout>
16543 <para>
16544 Note that the variable name is given without a leading <option>$</option> character. If the
16545 variable does not exist, the expansion fails.
16546 </para>
16547 </listitem></varlistentry>
16548 <varlistentry>
16549 <term><emphasis role="bold">def:header_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;&nbsp;or&nbsp;&nbsp;<emphasis role="bold">def:h_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
16550 <listitem>
16551 <para>
16552 <indexterm role="concept">
16553 <primary>expansion</primary>
16554 <secondary>checking header line existence</secondary>
16555 </indexterm>
16556 This condition is true if a message is being processed and the named header
16557 exists in the message. For example,
16558 </para>
16559 <literallayout class="monospaced">
16560 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16561 </literallayout>
16562 <para>
16563 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16564 the header name must be terminated by a colon if white space does not follow.
16565 </para>
16566 </listitem></varlistentry>
16567 <varlistentry>
16568 <term><emphasis role="bold">eq&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16569 <term><emphasis role="bold">eqi&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16570 <listitem>
16571 <para>
16572 <indexterm role="concept">
16573 <primary>string</primary>
16574 <secondary>comparison</secondary>
16575 </indexterm>
16576 <indexterm role="concept">
16577 <primary>expansion</primary>
16578 <secondary>string comparison</secondary>
16579 </indexterm>
16580 <indexterm role="concept">
16581 <primary><option>eq</option> expansion condition</primary>
16582 </indexterm>
16583 <indexterm role="concept">
16584 <primary><option>eqi</option> expansion condition</primary>
16585 </indexterm>
16586 The two substrings are first expanded. The condition is true if the two
16587 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16588 letters, whereas for <option>eqi</option> the comparison is case-independent.
16589 </para>
16590 </listitem></varlistentry>
16591 <varlistentry>
16592 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16593 <listitem>
16594 <para>
16595 <indexterm role="concept">
16596 <primary>expansion</primary>
16597 <secondary>file existence test</secondary>
16598 </indexterm>
16599 <indexterm role="concept">
16600 <primary>file</primary>
16601 <secondary>existence test</secondary>
16602 </indexterm>
16603 <indexterm role="concept">
16604 <primary><option>exists</option>, expansion condition</primary>
16605 </indexterm>
16606 The substring is first expanded and then interpreted as an absolute path. The
16607 condition is true if the named file (or directory) exists. The existence test
16608 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16609 users&#x2019; filter files may be locked out by the system administrator.
16610 </para>
16611 </listitem></varlistentry>
16612 <varlistentry>
16613 <term><emphasis role="bold">first_delivery</emphasis></term>
16614 <listitem>
16615 <para>
16616 <indexterm role="concept">
16617 <primary>delivery</primary>
16618 <secondary>first</secondary>
16619 </indexterm>
16620 <indexterm role="concept">
16621 <primary>first delivery</primary>
16622 </indexterm>
16623 <indexterm role="concept">
16624 <primary>expansion</primary>
16625 <secondary>first delivery test</secondary>
16626 </indexterm>
16627 <indexterm role="concept">
16628 <primary><option>first_delivery</option> expansion condition</primary>
16629 </indexterm>
16630 This condition, which has no data, is true during a message&#x2019;s first delivery
16631 attempt. It is false during any subsequent delivery attempts.
16632 </para>
16633 </listitem></varlistentry>
16634 <varlistentry>
16635 <term><emphasis role="bold">forall{</emphasis>&lt;<emphasis>a list</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16636 <term><emphasis role="bold">forany{</emphasis>&lt;<emphasis>a list</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16637 <listitem>
16638 <para>
16639 <indexterm role="concept">
16640 <primary>list</primary>
16641 <secondary>iterative conditions</secondary>
16642 </indexterm>
16643 <indexterm role="concept">
16644 <primary>expansion</primary>
16645 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16646 </indexterm>
16647 <indexterm role="concept">
16648 <primary>expansion</primary>
16649 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16650 </indexterm>
16651 <indexterm role="variable">
16652 <primary><varname>$item</varname></primary>
16653 </indexterm>
16654 These conditions iterate over a list. The first argument is expanded to form
16655 the list. By default, the list separator is a colon, but it can be changed by
16656 the normal method. The second argument is interpreted as a condition that is to
16657 be applied to each item in the list in turn. During the interpretation of the
16658 condition, the current list item is placed in a variable called <varname>$item</varname>.
16659 </para>
16660 <itemizedlist>
16661 <listitem>
16662 <para>
16663 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16664 the result of the whole condition is true. If the condition is false for all
16665 items in the list, the overall condition is false.
16666 </para>
16667 </listitem>
16668 <listitem>
16669 <para>
16670 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16671 and the result of the whole condition is false. If the condition is true for
16672 all items in the list, the overall condition is true.
16673 </para>
16674 </listitem>
16675 </itemizedlist>
16676 <para>
16677 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16678 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16679 that the condition must be false for at least one item. In this example, the
16680 list separator is changed to a comma:
16681 </para>
16682 <literallayout class="monospaced">
16683 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16684 </literallayout>
16685 <para>
16686 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16687 being processed, to enable these expansion items to be nested.
16688 </para>
16689 <para>
16690 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16691 </para>
16692 </listitem></varlistentry>
16693 <varlistentry>
16694 <term><emphasis role="bold">ge&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16695 <term><emphasis role="bold">gei&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16696 <listitem>
16697 <para>
16698 <indexterm role="concept">
16699 <primary>string</primary>
16700 <secondary>comparison</secondary>
16701 </indexterm>
16702 <indexterm role="concept">
16703 <primary>expansion</primary>
16704 <secondary>string comparison</secondary>
16705 </indexterm>
16706 <indexterm role="concept">
16707 <primary><option>ge</option> expansion condition</primary>
16708 </indexterm>
16709 <indexterm role="concept">
16710 <primary><option>gei</option> expansion condition</primary>
16711 </indexterm>
16712 The two substrings are first expanded. The condition is true if the first
16713 string is lexically greater than or equal to the second string. For <option>ge</option> the
16714 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16715 case-independent.
16716 </para>
16717 </listitem></varlistentry>
16718 <varlistentry>
16719 <term><emphasis role="bold">gt&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16720 <term><emphasis role="bold">gti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16721 <listitem>
16722 <para>
16723 <indexterm role="concept">
16724 <primary>string</primary>
16725 <secondary>comparison</secondary>
16726 </indexterm>
16727 <indexterm role="concept">
16728 <primary>expansion</primary>
16729 <secondary>string comparison</secondary>
16730 </indexterm>
16731 <indexterm role="concept">
16732 <primary><option>gt</option> expansion condition</primary>
16733 </indexterm>
16734 <indexterm role="concept">
16735 <primary><option>gti</option> expansion condition</primary>
16736 </indexterm>
16737 The two substrings are first expanded. The condition is true if the first
16738 string is lexically greater than the second string. For <option>gt</option> the comparison
16739 includes the case of letters, whereas for <option>gti</option> the comparison is
16740 case-independent.
16741 </para>
16742 </listitem></varlistentry>
16743 <varlistentry>
16744 <term><emphasis role="bold">inlist&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16745 <term><emphasis role="bold">inlisti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16746 <listitem>
16747 <para>
16748 <indexterm role="concept">
16749 <primary>string</primary>
16750 <secondary>comparison</secondary>
16751 </indexterm>
16752 <indexterm role="concept">
16753 <primary>list</primary>
16754 <secondary>iterative conditions</secondary>
16755 </indexterm>
16756 Both strings are expanded; the second string is treated as a list of simple
16757 strings; if the first string is a member of the second, then the condition
16758 is true.
16759 </para>
16760 <para>
16761 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16762 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16763 </para>
16764 <literallayout class="monospaced">
16765 ${if inlist{needle}{foo:needle:bar}}
16766   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16767 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16768   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16769 </literallayout>
16770 </listitem></varlistentry>
16771 <varlistentry>
16772 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16773 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16774 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16775 <listitem>
16776 <para>
16777 <indexterm role="concept">
16778 <primary>IP address</primary>
16779 <secondary>testing string format</secondary>
16780 </indexterm>
16781 <indexterm role="concept">
16782 <primary>string</primary>
16783 <secondary>testing for IP address</secondary>
16784 </indexterm>
16785 <indexterm role="concept">
16786 <primary><option>isip</option> expansion condition</primary>
16787 </indexterm>
16788 <indexterm role="concept">
16789 <primary><option>isip4</option> expansion condition</primary>
16790 </indexterm>
16791 <indexterm role="concept">
16792 <primary><option>isip6</option> expansion condition</primary>
16793 </indexterm>
16794 The substring is first expanded, and then tested to see if it has the form of
16795 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16796 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16797 </para>
16798 <para>
16799 For an IPv4 address, the test is for four dot-separated components, each of
16800 which consists of from one to three digits. For an IPv6 address, up to eight
16801 colon-separated components are permitted, each containing from one to four
16802 hexadecimal digits. There may be fewer than eight components if an empty
16803 component (adjacent colons) is present. Only one empty component is permitted.
16804 </para>
16805 <para>
16806 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16807 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16808 check. The main use of these tests is to distinguish between IP addresses and
16809 host names, or between IPv4 and IPv6 addresses. For example, you could use
16810 </para>
16811 <literallayout class="monospaced">
16812 ${if isip4{$sender_host_address}...
16813 </literallayout>
16814 <para>
16815 to test which IP version an incoming SMTP connection is using.
16816 </para>
16817 </listitem></varlistentry>
16818 <varlistentry>
16819 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16820 <listitem>
16821 <para>
16822 <indexterm role="concept">
16823 <primary>LDAP</primary>
16824 <secondary>use for authentication</secondary>
16825 </indexterm>
16826 <indexterm role="concept">
16827 <primary>expansion</primary>
16828 <secondary>LDAP authentication test</secondary>
16829 </indexterm>
16830 <indexterm role="concept">
16831 <primary><option>ldapauth</option> expansion condition</primary>
16832 </indexterm>
16833 This condition supports user authentication using LDAP. See section
16834 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16835 queries. For this use, the query must contain a user name and password. The
16836 query itself is not used, and can be empty. The condition is true if the
16837 password is not empty, and the user name and password are accepted by the LDAP
16838 server. An empty password is rejected without calling LDAP because LDAP binds
16839 with an empty password are considered anonymous regardless of the username, and
16840 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16841 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16842 this can be used.
16843 </para>
16844 </listitem></varlistentry>
16845 <varlistentry>
16846 <term><emphasis role="bold">le&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16847 <term><emphasis role="bold">lei&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16848 <listitem>
16849 <para>
16850 <indexterm role="concept">
16851 <primary>string</primary>
16852 <secondary>comparison</secondary>
16853 </indexterm>
16854 <indexterm role="concept">
16855 <primary>expansion</primary>
16856 <secondary>string comparison</secondary>
16857 </indexterm>
16858 <indexterm role="concept">
16859 <primary><option>le</option> expansion condition</primary>
16860 </indexterm>
16861 <indexterm role="concept">
16862 <primary><option>lei</option> expansion condition</primary>
16863 </indexterm>
16864 The two substrings are first expanded. The condition is true if the first
16865 string is lexically less than or equal to the second string. For <option>le</option> the
16866 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16867 case-independent.
16868 </para>
16869 </listitem></varlistentry>
16870 <varlistentry>
16871 <term><emphasis role="bold">lt&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16872 <term><emphasis role="bold">lti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16873 <listitem>
16874 <para>
16875 <indexterm role="concept">
16876 <primary>string</primary>
16877 <secondary>comparison</secondary>
16878 </indexterm>
16879 <indexterm role="concept">
16880 <primary>expansion</primary>
16881 <secondary>string comparison</secondary>
16882 </indexterm>
16883 <indexterm role="concept">
16884 <primary><option>lt</option> expansion condition</primary>
16885 </indexterm>
16886 <indexterm role="concept">
16887 <primary><option>lti</option> expansion condition</primary>
16888 </indexterm>
16889 The two substrings are first expanded. The condition is true if the first
16890 string is lexically less than the second string. For <option>lt</option> the comparison
16891 includes the case of letters, whereas for <option>lti</option> the comparison is
16892 case-independent.
16893 </para>
16894 </listitem></varlistentry>
16895 <varlistentry>
16896 <term><emphasis role="bold">match&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16897 <listitem>
16898 <para>
16899 <indexterm role="concept">
16900 <primary>expansion</primary>
16901 <secondary>regular expression comparison</secondary>
16902 </indexterm>
16903 <indexterm role="concept">
16904 <primary>regular expressions</primary>
16905 <secondary>match in expanded string</secondary>
16906 </indexterm>
16907 <indexterm role="concept">
16908 <primary><option>match</option> expansion condition</primary>
16909 </indexterm>
16910 The two substrings are first expanded. The second is then treated as a regular
16911 expression and applied to the first. Because of the pre-expansion, if the
16912 regular expression contains dollar, or backslash characters, they must be
16913 escaped. Care must also be taken if the regular expression contains braces
16914 (curly brackets). A closing brace must be escaped so that it is not taken as a
16915 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16916 <literal>\N</literal> feature to disable expansion of the regular expression.
16917 For example,
16918 </para>
16919 <literallayout class="monospaced">
16920 ${if match {$local_part}{\N^\d{3}\N} ...
16921 </literallayout>
16922 <para>
16923 If the whole expansion string is in double quotes, further escaping of
16924 backslashes is also required.
16925 </para>
16926 <para>
16927 The condition is true if the regular expression match succeeds.
16928 The regular expression is not required to begin with a circumflex
16929 metacharacter, but if there is no circumflex, the expression is not anchored,
16930 and it may match anywhere in the subject, not just at the start. If you want
16931 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16932 metacharacter at an appropriate point.
16933 </para>
16934 <para>
16935 <indexterm role="concept">
16936 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16937 <secondary>in <option>if</option> expansion</secondary>
16938 </indexterm>
16939 At the start of an <option>if</option> expansion the values of the numeric variable
16940 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16941 succeeds causes them to be reset to the substrings of that condition and they
16942 will have these values during the expansion of the success string. At the end
16943 of the <option>if</option> expansion, the previous values are restored. After testing a
16944 combination of conditions using <option>or</option>, the subsequent values of the numeric
16945 variables are those of the condition that succeeded.
16946 </para>
16947 </listitem></varlistentry>
16948 <varlistentry>
16949 <term><emphasis role="bold">match_address&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16950 <listitem>
16951 <para>
16952 <indexterm role="concept">
16953 <primary><option>match_address</option> expansion condition</primary>
16954 </indexterm>
16955 See <emphasis role="bold">match_local_part</emphasis>.
16956 </para>
16957 </listitem></varlistentry>
16958 <varlistentry>
16959 <term><emphasis role="bold">match_domain&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16960 <listitem>
16961 <para>
16962 <indexterm role="concept">
16963 <primary><option>match_domain</option> expansion condition</primary>
16964 </indexterm>
16965 See <emphasis role="bold">match_local_part</emphasis>.
16966 </para>
16967 </listitem></varlistentry>
16968 <varlistentry>
16969 <term><emphasis role="bold">match_ip&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16970 <listitem>
16971 <para>
16972 <indexterm role="concept">
16973 <primary><option>match_ip</option> expansion condition</primary>
16974 </indexterm>
16975 This condition matches an IP address to a list of IP address patterns. It must
16976 be followed by two argument strings. The first (after expansion) must be an IP
16977 address or an empty string. The second (not expanded) is a restricted host
16978 list that can match only an IP address, not a host name. For example:
16979 </para>
16980 <literallayout class="monospaced">
16981 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16982 </literallayout>
16983 <para>
16984 The specific types of host list item that are permitted in the list are:
16985 </para>
16986 <itemizedlist>
16987 <listitem>
16988 <para>
16989 An IP address, optionally with a CIDR mask.
16990 </para>
16991 </listitem>
16992 <listitem>
16993 <para>
16994 A single asterisk, which matches any IP address.
16995 </para>
16996 </listitem>
16997 <listitem>
16998 <para>
16999 An empty item, which matches only if the IP address is empty. This could be
17000 useful for testing for a locally submitted message or one from specific hosts
17001 in a single test such as
17002 </para>
17003 <literallayout class="monospaced">
17004   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17005 </literallayout>
17006 <para>
17007 where the first item in the list is the empty string.
17008 </para>
17009 </listitem>
17010 <listitem>
17011 <para>
17012 The item @[] matches any of the local host&#x2019;s interface addresses.
17013 </para>
17014 </listitem>
17015 <listitem>
17016 <para>
17017 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17018 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17019 address into a host name. The most common type of linear search for
17020 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17021 masks. For example:
17022 </para>
17023 <literallayout class="monospaced">
17024   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17025 </literallayout>
17026 <para>
17027 It is of course possible to use other kinds of lookup, and in such a case, you
17028 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
17029 address mask, for example:
17030 </para>
17031 <literallayout class="monospaced">
17032   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
17033 </literallayout>
17034 <para>
17035 However, unless you are combining a <option>match_ip</option> condition with others, it is
17036 just as easy to use the fact that a lookup is itself a condition, and write:
17037 </para>
17038 <literallayout class="monospaced">
17039   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
17040 </literallayout>
17041 </listitem>
17042 </itemizedlist>
17043 <para>
17044 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17045 Exim was built with the EXPAND_LISTMATCH_RHS option.
17046 </para>
17047 <para>
17048 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
17049 </para>
17050 </listitem></varlistentry>
17051 <varlistentry>
17052 <term><emphasis role="bold">match_local_part&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17053 <listitem>
17054 <para>
17055 <indexterm role="concept">
17056 <primary>domain list</primary>
17057 <secondary>in expansion condition</secondary>
17058 </indexterm>
17059 <indexterm role="concept">
17060 <primary>address list</primary>
17061 <secondary>in expansion condition</secondary>
17062 </indexterm>
17063 <indexterm role="concept">
17064 <primary>local part</primary>
17065 <secondary>list, in expansion condition</secondary>
17066 </indexterm>
17067 <indexterm role="concept">
17068 <primary><option>match_local_part</option> expansion condition</primary>
17069 </indexterm>
17070 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
17071 possible to test domain, address, and local part lists within expansions. Each
17072 condition requires two arguments: an item and a list to match. A trivial
17073 example is:
17074 </para>
17075 <literallayout class="monospaced">
17076 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
17077 </literallayout>
17078 <para>
17079 In each case, the second argument may contain any of the allowable items for a
17080 list of the appropriate type. Also, because the second argument (after
17081 expansion) is a standard form of list, it is possible to refer to a named list.
17082 Thus, you can use conditions like this:
17083 </para>
17084 <literallayout class="monospaced">
17085 ${if match_domain{$domain}{+local_domains}{...
17086 </literallayout>
17087 <para>
17088 <indexterm role="concept">
17089 <primary><literal>+caseful</literal></primary>
17090 </indexterm>
17091 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
17092 item can be used, as in all address lists, to cause subsequent items to
17093 have their local parts matched casefully. Domains are always matched
17094 caselessly.
17095 </para>
17096 <para>
17097 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17098 Exim was built with the EXPAND_LISTMATCH_RHS option.
17099 </para>
17100 <para>
17101 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
17102 hosts have two identities: a name and an IP address, and it is not clear
17103 how to specify cleanly how such a test would work. However, IP addresses can be
17104 matched using <option>match_ip</option>.
17105 </para>
17106 </listitem></varlistentry>
17107 <varlistentry>
17108 <term><emphasis role="bold">pam&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">:...}</emphasis></term>
17109 <listitem>
17110 <para>
17111 <indexterm role="concept">
17112 <primary>PAM authentication</primary>
17113 </indexterm>
17114 <indexterm role="concept">
17115 <primary>AUTH</primary>
17116 <secondary>with PAM</secondary>
17117 </indexterm>
17118 <indexterm role="concept">
17119 <primary>Solaris</primary>
17120 <secondary>PAM support</secondary>
17121 </indexterm>
17122 <indexterm role="concept">
17123 <primary>expansion</primary>
17124 <secondary>PAM authentication test</secondary>
17125 </indexterm>
17126 <indexterm role="concept">
17127 <primary><option>pam</option> expansion condition</primary>
17128 </indexterm>
17129 <emphasis>Pluggable Authentication Modules</emphasis>
17130 (<emphasis role="bold"><ulink url="http://www.kernel.org/pub/linux/libs/pam/">http://www.kernel.org/pub/linux/libs/pam/</ulink></emphasis>) are a facility that is
17131 available in the latest releases of Solaris and in some GNU/Linux
17132 distributions. The Exim support, which is intended for use in conjunction with
17133 the SMTP AUTH command, is available only if Exim is compiled with
17134 </para>
17135 <literallayout class="monospaced">
17136 SUPPORT_PAM=yes
17137 </literallayout>
17138 <para>
17139 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
17140 in some releases of GNU/Linux <option>-ldl</option> is also needed.
17141 </para>
17142 <para>
17143 The argument string is first expanded, and the result must be a
17144 colon-separated list of strings. Leading and trailing white space is ignored.
17145 The PAM module is initialized with the service name <quote>exim</quote> and the user name
17146 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
17147 The remaining items in the data string are passed over in response to requests
17148 from the authentication function. In the simple case there will only be one
17149 request, for a password, so the data consists of just two strings.
17150 </para>
17151 <para>
17152 There can be problems if any of the strings are permitted to contain colon
17153 characters. In the usual way, these have to be doubled to avoid being taken as
17154 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
17155 item can be used to double any existing colons. For example, the configuration
17156 of a LOGIN authenticator might contain this setting:
17157 </para>
17158 <literallayout class="monospaced">
17159 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
17160 </literallayout>
17161 <para>
17162 For a PLAIN authenticator you could use:
17163 </para>
17164 <literallayout class="monospaced">
17165 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
17166 </literallayout>
17167 <para>
17168 In some operating systems, PAM authentication can be done only from a process
17169 running as root. Since Exim is running as the Exim user when receiving
17170 messages, this means that PAM cannot be used directly in those systems.
17171 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
17172 Linux PAM package is available from <emphasis role="bold"><ulink url="http://www.e-admin.de/pam_exim/">http://www.e-admin.de/pam_exim/</ulink></emphasis>.
17173 The patched module allows one special uid/gid combination, in addition to root,
17174 to authenticate. If you build the patched module to allow the Exim user and
17175 group, PAM can then be used from an Exim authenticator.
17176 </para>
17177 </listitem></varlistentry>
17178 <varlistentry>
17179 <term><emphasis role="bold">pwcheck&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17180 <listitem>
17181 <para>
17182 <indexterm role="concept">
17183 <primary><emphasis>pwcheck</emphasis> daemon</primary>
17184 </indexterm>
17185 <indexterm role="concept">
17186 <primary>Cyrus</primary>
17187 </indexterm>
17188 <indexterm role="concept">
17189 <primary>expansion</primary>
17190 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
17191 </indexterm>
17192 <indexterm role="concept">
17193 <primary><option>pwcheck</option> expansion condition</primary>
17194 </indexterm>
17195 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
17196 This is one way of making it possible for passwords to be checked by a process
17197 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
17198 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
17199 </para>
17200 <para>
17201 The pwcheck support is not included in Exim by default. You need to specify
17202 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17203 building Exim. For example:
17204 </para>
17205 <literallayout class="monospaced">
17206 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17207 </literallayout>
17208 <para>
17209 You do not need to install the full Cyrus software suite in order to use
17210 the pwcheck daemon. You can compile and install just the daemon alone
17211 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17212 access to the <filename>/var/pwcheck</filename> directory.
17213 </para>
17214 <para>
17215 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17216 password, separated by a colon. For example, in a LOGIN authenticator
17217 configuration, you might have this:
17218 </para>
17219 <literallayout class="monospaced">
17220 server_condition = ${if pwcheck{$auth1:$auth2}}
17221 </literallayout>
17222 <para>
17223 Again, for a PLAIN authenticator configuration, this would be:
17224 </para>
17225 <literallayout class="monospaced">
17226 server_condition = ${if pwcheck{$auth2:$auth3}}
17227 </literallayout>
17228 </listitem></varlistentry>
17229 <varlistentry>
17230 <term><emphasis role="bold">queue_running</emphasis></term>
17231 <listitem>
17232 <para>
17233 <indexterm role="concept">
17234 <primary>queue runner</primary>
17235 <secondary>detecting when delivering from</secondary>
17236 </indexterm>
17237 <indexterm role="concept">
17238 <primary>expansion</primary>
17239 <secondary>queue runner test</secondary>
17240 </indexterm>
17241 <indexterm role="concept">
17242 <primary><option>queue_running</option> expansion condition</primary>
17243 </indexterm>
17244 This condition, which has no data, is true during delivery attempts that are
17245 initiated by queue runner processes, and false otherwise.
17246 </para>
17247 </listitem></varlistentry>
17248 <varlistentry>
17249 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17250 <listitem>
17251 <para>
17252 <indexterm role="concept">
17253 <primary>Radius</primary>
17254 </indexterm>
17255 <indexterm role="concept">
17256 <primary>expansion</primary>
17257 <secondary>Radius authentication</secondary>
17258 </indexterm>
17259 <indexterm role="concept">
17260 <primary><option>radius</option> expansion condition</primary>
17261 </indexterm>
17262 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17263 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17264 the Radius client configuration file in order to build Exim with Radius
17265 support.
17266 </para>
17267 <para>
17268 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17269 library, using the original API. If you are using release 0.4.0 or later of
17270 this library, you need to set
17271 </para>
17272 <literallayout class="monospaced">
17273 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17274 </literallayout>
17275 <para>
17276 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17277 <option>libradius</option> library that comes with FreeBSD. To do this, set
17278 </para>
17279 <literallayout class="monospaced">
17280 RADIUS_LIB_TYPE=RADLIB
17281 </literallayout>
17282 <para>
17283 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17284 You may also have to supply a suitable setting in EXTRALIBS so that the
17285 Radius library can be found when Exim is linked.
17286 </para>
17287 <para>
17288 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17289 Radius client library, which calls the Radius server. The condition is true if
17290 the authentication is successful. For example:
17291 </para>
17292 <literallayout class="monospaced">
17293 server_condition = ${if radius{&lt;arguments&gt;}}
17294 </literallayout>
17295 </listitem></varlistentry>
17296 <varlistentry>
17297 <term><emphasis role="bold">saslauthd&nbsp;{{</emphasis>&lt;<emphasis>user</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>password</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>service</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>realm</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
17298 <listitem>
17299 <para>
17300 <indexterm role="concept">
17301 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17302 </indexterm>
17303 <indexterm role="concept">
17304 <primary>Cyrus</primary>
17305 </indexterm>
17306 <indexterm role="concept">
17307 <primary>expansion</primary>
17308 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17309 </indexterm>
17310 <indexterm role="concept">
17311 <primary><option>saslauthd</option> expansion condition</primary>
17312 </indexterm>
17313 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17314 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17315 Using this daemon is one way of making it possible for passwords to be checked
17316 by a process that is not running as root.
17317 </para>
17318 <para>
17319 The saslauthd support is not included in Exim by default. You need to specify
17320 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17321 building Exim. For example:
17322 </para>
17323 <literallayout class="monospaced">
17324 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17325 </literallayout>
17326 <para>
17327 You do not need to install the full Cyrus software suite in order to use
17328 the saslauthd daemon. You can compile and install just the daemon alone
17329 from the Cyrus SASL library.
17330 </para>
17331 <para>
17332 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17333 two are mandatory. For example:
17334 </para>
17335 <literallayout class="monospaced">
17336 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17337 </literallayout>
17338 <para>
17339 The service and the realm are optional (which is why the arguments are enclosed
17340 in their own set of braces). For details of the meaning of the service and
17341 realm, and how to run the daemon, consult the Cyrus documentation.
17342 </para>
17343 </listitem></varlistentry>
17344 </variablelist>
17345 </section>
17346 <section id="SECID84">
17347 <title>Combining expansion conditions</title>
17348 <para>
17349 <indexterm role="concept">
17350 <primary>expansion</primary>
17351 <secondary>combining conditions</secondary>
17352 </indexterm>
17353 Several conditions can be tested at once by combining them using the <option>and</option>
17354 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17355 conditions on their own, and precede their lists of sub-conditions. Each
17356 sub-condition must be enclosed in braces within the overall braces that contain
17357 the list. No repetition of <option>if</option> is used.
17358 </para>
17359 <variablelist>
17360 <varlistentry>
17361 <term><emphasis role="bold">or&nbsp;{{</emphasis>&lt;<emphasis>cond1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>cond2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
17362 <listitem>
17363 <para>
17364 <indexterm role="concept">
17365 <primary><quote>or</quote> expansion condition</primary>
17366 </indexterm>
17367 <indexterm role="concept">
17368 <primary>expansion</primary>
17369 <secondary><quote>or</quote> of conditions</secondary>
17370 </indexterm>
17371 The sub-conditions are evaluated from left to right. The condition is true if
17372 any one of the sub-conditions is true.
17373 For example,
17374 </para>
17375 <literallayout class="monospaced">
17376 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17377 </literallayout>
17378 <para>
17379 When a true sub-condition is found, the following ones are parsed but not
17380 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17381 numeric variables afterwards are taken from the first one that succeeds.
17382 </para>
17383 </listitem></varlistentry>
17384 <varlistentry>
17385 <term><emphasis role="bold">and&nbsp;{{</emphasis>&lt;<emphasis>cond1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>cond2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
17386 <listitem>
17387 <para>
17388 <indexterm role="concept">
17389 <primary><quote>and</quote> expansion condition</primary>
17390 </indexterm>
17391 <indexterm role="concept">
17392 <primary>expansion</primary>
17393 <secondary><quote>and</quote> of conditions</secondary>
17394 </indexterm>
17395 The sub-conditions are evaluated from left to right. The condition is true if
17396 all of the sub-conditions are true. If there are several <quote>match</quote>
17397 sub-conditions, the values of the numeric variables afterwards are taken from
17398 the last one. When a false sub-condition is found, the following ones are
17399 parsed but not evaluated.
17400 </para>
17401 </listitem></varlistentry>
17402 </variablelist>
17403 <para>
17404 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17405 </para>
17406 </section>
17407 <section id="SECTexpvar">
17408 <title>Expansion variables</title>
17409 <para>
17410 <indexterm role="concept">
17411 <primary>expansion</primary>
17412 <secondary>variables, list of</secondary>
17413 </indexterm>
17414 This section contains an alphabetical list of all the expansion variables. Some
17415 of them are available only when Exim is compiled with specific options such as
17416 support for TLS or the content scanning extension.
17417 </para>
17418 <variablelist>
17419 <varlistentry>
17420 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17421 <listitem>
17422 <para>
17423 <indexterm role="concept">
17424 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17425 </indexterm>
17426 When a <option>match</option> expansion condition succeeds, these variables contain the
17427 captured substrings identified by the regular expression during subsequent
17428 processing of the success string of the containing <option>if</option> expansion item.
17429 In the expansion condition case
17430 they do not retain their values afterwards; in fact, their previous
17431 values are restored at the end of processing an <option>if</option> item. The numerical
17432 variables may also be set externally by some other matching process which
17433 precedes the expansion of the string. For example, the commands available in
17434 Exim filter files include an <option>if</option> command with its own regular expression
17435 matching condition.
17436 </para>
17437 </listitem></varlistentry>
17438 <varlistentry>
17439 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17440 <listitem>
17441 <para>
17442 Within an acl condition, expansion condition or expansion item
17443 any arguments are copied to these variables,
17444 any unused variables being made empty.
17445 </para>
17446 </listitem></varlistentry>
17447 <varlistentry>
17448 <term><varname>$acl_c...</varname></term>
17449 <listitem>
17450 <para>
17451 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17452 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17453 long, but the sixth character must be either a digit or an underscore. For
17454 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17455 variables persist throughout the lifetime of an SMTP connection. They can be
17456 used to pass information between ACLs and between different invocations of the
17457 same ACL. When a message is received, the values of these variables are saved
17458 with the message, and can be accessed by filters, routers, and transports
17459 during subsequent delivery.
17460 </para>
17461 </listitem></varlistentry>
17462 <varlistentry>
17463 <term><varname>$acl_m...</varname></term>
17464 <listitem>
17465 <para>
17466 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17467 are reset after a message has been received. Thus, if several messages are
17468 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17469 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17470 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17471 message is received, the values of these variables are saved with the message,
17472 and can be accessed by filters, routers, and transports during subsequent
17473 delivery.
17474 </para>
17475 </listitem></varlistentry>
17476 <varlistentry>
17477 <term><varname>$acl_narg</varname></term>
17478 <listitem>
17479 <para>
17480 Within an acl condition, expansion condition or expansion item
17481 this variable has the number of arguments.
17482 </para>
17483 </listitem></varlistentry>
17484 <varlistentry>
17485 <term><varname>$acl_verify_message</varname></term>
17486 <listitem>
17487 <para>
17488 <indexterm role="variable">
17489 <primary><varname>$acl_verify_message</varname></primary>
17490 </indexterm>
17491 After an address verification has failed, this variable contains the failure
17492 message. It retains its value for use in subsequent modifiers. The message can
17493 be preserved by coding like this:
17494 </para>
17495 <literallayout class="monospaced">
17496 warn !verify = sender
17497      set acl_m0 = $acl_verify_message
17498 </literallayout>
17499 <para>
17500 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17501 <option>log_message</option> modifiers, to include information about the verification
17502 failure.
17503 </para>
17504 </listitem></varlistentry>
17505 <varlistentry>
17506 <term><varname>$address_data</varname></term>
17507 <listitem>
17508 <para>
17509 <indexterm role="variable">
17510 <primary><varname>$address_data</varname></primary>
17511 </indexterm>
17512 This variable is set by means of the <option>address_data</option> option in routers. The
17513 value then remains with the address while it is processed by subsequent routers
17514 and eventually a transport. If the transport is handling multiple addresses,
17515 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17516 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17517 user filter files.
17518 </para>
17519 <para>
17520 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17521 a recipient address, the final value is still in the variable for subsequent
17522 conditions and modifiers of the ACL statement. If routing the address caused it
17523 to be redirected to just one address, the child address is also routed as part
17524 of the verification, and in this case the final value of <varname>$address_data</varname> is
17525 from the child&#x2019;s routing.
17526 </para>
17527 <para>
17528 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17529 sender address, the final value is also preserved, but this time in
17530 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17531 address.
17532 </para>
17533 <para>
17534 In both cases (recipient and sender verification), the value does not persist
17535 after the end of the current ACL statement. If you want to preserve
17536 these values for longer, you can save them in ACL variables.
17537 </para>
17538 </listitem></varlistentry>
17539 <varlistentry>
17540 <term><varname>$address_file</varname></term>
17541 <listitem>
17542 <para>
17543 <indexterm role="variable">
17544 <primary><varname>$address_file</varname></primary>
17545 </indexterm>
17546 When, as a result of aliasing, forwarding, or filtering, a message is directed
17547 to a specific file, this variable holds the name of the file when the transport
17548 is running. At other times, the variable is empty. For example, using the
17549 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17550 </para>
17551 <literallayout class="monospaced">
17552 /home/r2d2/savemail
17553 </literallayout>
17554 <para>
17555 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17556 contains the text string <literal>/home/r2d2/savemail</literal>.
17557 <indexterm role="concept">
17558 <primary>Sieve filter</primary>
17559 <secondary>value of <varname>$address_file</varname></secondary>
17560 </indexterm>
17561 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17562 then up to the transport configuration to generate an appropriate absolute path
17563 to the relevant file.
17564 </para>
17565 </listitem></varlistentry>
17566 <varlistentry>
17567 <term><varname>$address_pipe</varname></term>
17568 <listitem>
17569 <para>
17570 <indexterm role="variable">
17571 <primary><varname>$address_pipe</varname></primary>
17572 </indexterm>
17573 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17574 this variable holds the pipe command when the transport is running.
17575 </para>
17576 </listitem></varlistentry>
17577 <varlistentry>
17578 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17579 <listitem>
17580 <para>
17581 <indexterm role="variable">
17582 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17583 </indexterm>
17584 These variables are used in SMTP authenticators (see chapters
17585 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
17586 </para>
17587 </listitem></varlistentry>
17588 <varlistentry>
17589 <term><varname>$authenticated_id</varname></term>
17590 <listitem>
17591 <para>
17592 <indexterm role="concept">
17593 <primary>authentication</primary>
17594 <secondary>id</secondary>
17595 </indexterm>
17596 <indexterm role="variable">
17597 <primary><varname>$authenticated_id</varname></primary>
17598 </indexterm>
17599 When a server successfully authenticates a client it may be configured to
17600 preserve some of the authentication information in the variable
17601 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17602 user/password authenticator configuration might preserve the user name for use
17603 in the routers. Note that this is not the same information that is saved in
17604 <varname>$sender_host_authenticated</varname>.
17605 When a message is submitted locally (that is, not over a TCP connection)
17606 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17607 process. However, a trusted user can override this by means of the <option>-oMai</option>
17608 command line option.
17609 </para>
17610 </listitem></varlistentry>
17611 <varlistentry>
17612 <term><varname>$authenticated_fail_id</varname></term>
17613 <listitem>
17614 <para>
17615 <indexterm role="concept">
17616 <primary>authentication</primary>
17617 <secondary>fail</secondary>
17618 </indexterm>
17619 <indexterm role="variable">
17620 <primary><varname>$authenticated_fail_id</varname></primary>
17621 </indexterm>
17622 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17623 will contain the failed authentication id. If more than one authentication
17624 id is attempted, it will contain only the last one. The variable is
17625 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17626 A message to a local recipient could still be accepted without requiring
17627 authentication, which means this variable could also be visible in all of
17628 the ACL&#x2019;s as well.
17629 </para>
17630 </listitem></varlistentry>
17631 <varlistentry>
17632 <term><varname>$authenticated_sender</varname></term>
17633 <listitem>
17634 <para>
17635 <indexterm role="concept">
17636 <primary>sender</primary>
17637 <secondary>authenticated</secondary>
17638 </indexterm>
17639 <indexterm role="concept">
17640 <primary>authentication</primary>
17641 <secondary>sender</secondary>
17642 </indexterm>
17643 <indexterm role="concept">
17644 <primary>AUTH</primary>
17645 <secondary>on MAIL command</secondary>
17646 </indexterm>
17647 <indexterm role="variable">
17648 <primary><varname>$authenticated_sender</varname></primary>
17649 </indexterm>
17650 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17651 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17652 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17653 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17654 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17655 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17656 </para>
17657 <para>
17658 <indexterm role="variable">
17659 <primary><varname>$qualify_domain</varname></primary>
17660 </indexterm>
17661 When a message is submitted locally (that is, not over a TCP connection), the
17662 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17663 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17664 can override this by means of the <option>-oMas</option> command line option.
17665 </para>
17666 </listitem></varlistentry>
17667 <varlistentry>
17668 <term><varname>$authentication_failed</varname></term>
17669 <listitem>
17670 <para>
17671 <indexterm role="concept">
17672 <primary>authentication</primary>
17673 <secondary>failure</secondary>
17674 </indexterm>
17675 <indexterm role="variable">
17676 <primary><varname>$authentication_failed</varname></primary>
17677 </indexterm>
17678 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17679 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17680 possible to distinguish between <quote>did not try to authenticate</quote>
17681 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17682 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17683 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17684 negative response to an AUTH command, including (for example) an attempt to use
17685 an undefined mechanism.
17686 </para>
17687 </listitem></varlistentry>
17688 <varlistentry>
17689 <term><varname>$av_failed</varname></term>
17690 <listitem>
17691 <para>
17692 <indexterm role="concept">
17693 <primary>content scanning</primary>
17694 <secondary>AV scanner failure</secondary>
17695 </indexterm>
17696 This variable is available when Exim is compiled with the content-scanning
17697 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17698 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17699 the ACL malware condition.
17700 </para>
17701 </listitem></varlistentry>
17702 <varlistentry>
17703 <term><varname>$body_linecount</varname></term>
17704 <listitem>
17705 <para>
17706 <indexterm role="concept">
17707 <primary>message body</primary>
17708 <secondary>line count</secondary>
17709 </indexterm>
17710 <indexterm role="concept">
17711 <primary>body of message</primary>
17712 <secondary>line count</secondary>
17713 </indexterm>
17714 <indexterm role="variable">
17715 <primary><varname>$body_linecount</varname></primary>
17716 </indexterm>
17717 When a message is being received or delivered, this variable contains the
17718 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17719 </para>
17720 </listitem></varlistentry>
17721 <varlistentry>
17722 <term><varname>$body_zerocount</varname></term>
17723 <listitem>
17724 <para>
17725 <indexterm role="concept">
17726 <primary>message body</primary>
17727 <secondary>binary zero count</secondary>
17728 </indexterm>
17729 <indexterm role="concept">
17730 <primary>body of message</primary>
17731 <secondary>binary zero count</secondary>
17732 </indexterm>
17733 <indexterm role="concept">
17734 <primary>binary zero</primary>
17735 <secondary>in message body</secondary>
17736 </indexterm>
17737 <indexterm role="variable">
17738 <primary><varname>$body_zerocount</varname></primary>
17739 </indexterm>
17740 When a message is being received or delivered, this variable contains the
17741 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17742 </para>
17743 </listitem></varlistentry>
17744 <varlistentry>
17745 <term><varname>$bounce_recipient</varname></term>
17746 <listitem>
17747 <para>
17748 <indexterm role="variable">
17749 <primary><varname>$bounce_recipient</varname></primary>
17750 </indexterm>
17751 This is set to the recipient address of a bounce message while Exim is creating
17752 it. It is useful if a customized bounce message text file is in use (see
17753 chapter <xref linkend="CHAPemsgcust"/>).
17754 </para>
17755 </listitem></varlistentry>
17756 <varlistentry>
17757 <term><varname>$bounce_return_size_limit</varname></term>
17758 <listitem>
17759 <para>
17760 <indexterm role="variable">
17761 <primary><varname>$bounce_return_size_limit</varname></primary>
17762 </indexterm>
17763 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17764 up to a multiple of 1000. It is useful when a customized error message text
17765 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17766 </para>
17767 </listitem></varlistentry>
17768 <varlistentry>
17769 <term><varname>$caller_gid</varname></term>
17770 <listitem>
17771 <para>
17772 <indexterm role="concept">
17773 <primary>gid (group id)</primary>
17774 <secondary>caller</secondary>
17775 </indexterm>
17776 <indexterm role="variable">
17777 <primary><varname>$caller_gid</varname></primary>
17778 </indexterm>
17779 The real group id under which the process that called Exim was running. This is
17780 not the same as the group id of the originator of a message (see
17781 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17782 incarnation normally contains the Exim gid.
17783 </para>
17784 </listitem></varlistentry>
17785 <varlistentry>
17786 <term><varname>$caller_uid</varname></term>
17787 <listitem>
17788 <para>
17789 <indexterm role="concept">
17790 <primary>uid (user id)</primary>
17791 <secondary>caller</secondary>
17792 </indexterm>
17793 <indexterm role="variable">
17794 <primary><varname>$caller_uid</varname></primary>
17795 </indexterm>
17796 The real user id under which the process that called Exim was running. This is
17797 not the same as the user id of the originator of a message (see
17798 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17799 incarnation normally contains the Exim uid.
17800 </para>
17801 </listitem></varlistentry>
17802 <varlistentry>
17803 <term><varname>$callout_address</varname></term>
17804 <listitem>
17805 <para>
17806 <indexterm role="variable">
17807 <primary><varname>$callout_address</varname></primary>
17808 </indexterm>
17809 After a callout for verification, spamd or malware daemon service, the
17810 address that was connected to.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$compile_number</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="variable">
17818 <primary><varname>$compile_number</varname></primary>
17819 </indexterm>
17820 The building process for Exim keeps a count of the number
17821 of times it has been compiled. This serves to distinguish different
17822 compilations of the same version of the program.
17823 </para>
17824 </listitem></varlistentry>
17825 <varlistentry>
17826 <term><varname>$config_dir</varname></term>
17827 <listitem>
17828 <para>
17829 <indexterm role="variable">
17830 <primary><varname>$config_dir</varname></primary>
17831 </indexterm>
17832 The directory name of the main configuration file. That is, the content of
17833 <varname>$config_file</varname> with the last component stripped. The value does not
17834 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17835 <varname>$config_dir</varname> is ".".
17836 </para>
17837 </listitem></varlistentry>
17838 <varlistentry>
17839 <term><varname>$config_file</varname></term>
17840 <listitem>
17841 <para>
17842 <indexterm role="variable">
17843 <primary><varname>$config_file</varname></primary>
17844 </indexterm>
17845 The name of the main configuration file Exim is using.
17846 </para>
17847 </listitem></varlistentry>
17848 <varlistentry>
17849 <term><varname>$dkim_cur_signer</varname></term>
17850 <term><varname>$dkim_verify_status</varname></term>
17851 <term><varname>$dkim_verify_reason</varname></term>
17852 <term><varname>$dkim_domain</varname></term>
17853 <term><varname>$dkim_identity</varname></term>
17854 <term><varname>$dkim_selector</varname></term>
17855 <term><varname>$dkim_algo</varname></term>
17856 <term><varname>$dkim_canon_body</varname></term>
17857 <term><varname>$dkim_canon_headers</varname></term>
17858 <term><varname>$dkim_copiedheaders</varname></term>
17859 <term><varname>$dkim_bodylength</varname></term>
17860 <term><varname>$dkim_created</varname></term>
17861 <term><varname>$dkim_expires</varname></term>
17862 <term><varname>$dkim_headernames</varname></term>
17863 <term><varname>$dkim_key_testing</varname></term>
17864 <term><varname>$dkim_key_nosubdomains</varname></term>
17865 <term><varname>$dkim_key_srvtype</varname></term>
17866 <term><varname>$dkim_key_granularity</varname></term>
17867 <term><varname>$dkim_key_notes</varname></term>
17868 <term><varname>$dkim_key_length</varname></term>
17869 <listitem>
17870 <para>
17871 These variables are only available within the DKIM ACL.
17872 For details see chapter <xref linkend="CHAPdkim"/>.
17873 </para>
17874 </listitem></varlistentry>
17875 <varlistentry>
17876 <term><varname>$dkim_signers</varname></term>
17877 <listitem>
17878 <para>
17879 <indexterm role="variable">
17880 <primary><varname>$dkim_signers</varname></primary>
17881 </indexterm>
17882 When a message has been received this variable contains
17883 a colon-separated list of signer domains and identities for the message.
17884 For details see chapter <xref linkend="CHAPdkim"/>.
17885 </para>
17886 </listitem></varlistentry>
17887 <varlistentry>
17888 <term><varname>$dnslist_domain</varname></term>
17889 <term><varname>$dnslist_matched</varname></term>
17890 <term><varname>$dnslist_text</varname></term>
17891 <term><varname>$dnslist_value</varname></term>
17892 <listitem>
17893 <para>
17894 <indexterm role="variable">
17895 <primary><varname>$dnslist_domain</varname></primary>
17896 </indexterm>
17897 <indexterm role="variable">
17898 <primary><varname>$dnslist_matched</varname></primary>
17899 </indexterm>
17900 <indexterm role="variable">
17901 <primary><varname>$dnslist_text</varname></primary>
17902 </indexterm>
17903 <indexterm role="variable">
17904 <primary><varname>$dnslist_value</varname></primary>
17905 </indexterm>
17906 <indexterm role="concept">
17907 <primary>black list (DNS)</primary>
17908 </indexterm>
17909 When a DNS (black) list lookup succeeds, these variables are set to contain
17910 the following data from the lookup: the list&#x2019;s domain name, the key that was
17911 looked up, the contents of any associated TXT record, and the value from the
17912 main A record. See section <xref linkend="SECID204"/> for more details.
17913 </para>
17914 </listitem></varlistentry>
17915 <varlistentry>
17916 <term><varname>$domain</varname></term>
17917 <listitem>
17918 <para>
17919 <indexterm role="variable">
17920 <primary><varname>$domain</varname></primary>
17921 </indexterm>
17922 When an address is being routed, or delivered on its own, this variable
17923 contains the domain. Uppercase letters in the domain are converted into lower
17924 case for <varname>$domain</varname>.
17925 </para>
17926 <para>
17927 Global address rewriting happens when a message is received, so the value of
17928 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17929 is set during user filtering, but not during system filtering, because a
17930 message may have many recipients and the system filter is called just once.
17931 </para>
17932 <para>
17933 When more than one address is being delivered at once (for example, several
17934 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17935 have the same domain. Transports can be restricted to handling only one domain
17936 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17937 the default for local transports. For further details of the environment in
17938 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17939 </para>
17940 <para>
17941 <indexterm role="option">
17942 <primary><option>delay_warning_condition</option></primary>
17943 </indexterm>
17944 At the end of a delivery, if all deferred addresses have the same domain, it is
17945 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17946 </para>
17947 <para>
17948 The <varname>$domain</varname> variable is also used in some other circumstances:
17949 </para>
17950 <itemizedlist>
17951 <listitem>
17952 <para>
17953 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17954 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17955 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17956 normally set during the running of the MAIL ACL. However, if the sender address
17957 is verified with a callout during the MAIL ACL, the sender domain is placed in
17958 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17959 the <command>smtp</command> transport.
17960 </para>
17961 </listitem>
17962 <listitem>
17963 <para>
17964 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17965 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17966 it can be used in the expansion of the replacement address, for example, to
17967 rewrite domains by file lookup.
17968 </para>
17969 </listitem>
17970 <listitem>
17971 <para>
17972 With one important exception, whenever a domain list is being scanned,
17973 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17974 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17975 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17976 that, in a RCPT ACL, the sender domain list can be dependent on the
17977 recipient domain (which is what is in <varname>$domain</varname> at this time).
17978 </para>
17979 </listitem>
17980 <listitem>
17981 <para>
17982 <indexterm role="concept">
17983 <primary>ETRN</primary>
17984 <secondary>value of <varname>$domain</varname></secondary>
17985 </indexterm>
17986 <indexterm role="option">
17987 <primary><option>smtp_etrn_command</option></primary>
17988 </indexterm>
17989 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17990 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17991 </para>
17992 </listitem>
17993 </itemizedlist>
17994 </listitem></varlistentry>
17995 <varlistentry>
17996 <term><varname>$domain_data</varname></term>
17997 <listitem>
17998 <para>
17999 <indexterm role="variable">
18000 <primary><varname>$domain_data</varname></primary>
18001 </indexterm>
18002 When the <option>domains</option> option on a router matches a domain by
18003 means of a lookup, the data read by the lookup is available during the running
18004 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
18005 address to a transport, the value is available in that transport. If the
18006 transport is handling multiple addresses, the value from the first address is
18007 used.
18008 </para>
18009 <para>
18010 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
18011 domain by means of a lookup. The data read by the lookup is available during
18012 the rest of the ACL statement. In all other situations, this variable expands
18013 to nothing.
18014 </para>
18015 </listitem></varlistentry>
18016 <varlistentry>
18017 <term><varname>$exim_gid</varname></term>
18018 <listitem>
18019 <para>
18020 <indexterm role="variable">
18021 <primary><varname>$exim_gid</varname></primary>
18022 </indexterm>
18023 This variable contains the numerical value of the Exim group id.
18024 </para>
18025 </listitem></varlistentry>
18026 <varlistentry>
18027 <term><varname>$exim_path</varname></term>
18028 <listitem>
18029 <para>
18030 <indexterm role="variable">
18031 <primary><varname>$exim_path</varname></primary>
18032 </indexterm>
18033 This variable contains the path to the Exim binary.
18034 </para>
18035 </listitem></varlistentry>
18036 <varlistentry>
18037 <term><varname>$exim_uid</varname></term>
18038 <listitem>
18039 <para>
18040 <indexterm role="variable">
18041 <primary><varname>$exim_uid</varname></primary>
18042 </indexterm>
18043 This variable contains the numerical value of the Exim user id.
18044 </para>
18045 </listitem></varlistentry>
18046 <varlistentry>
18047 <term><varname>$exim_version</varname></term>
18048 <listitem>
18049 <para>
18050 <indexterm role="variable">
18051 <primary><varname>$exim_version</varname></primary>
18052 </indexterm>
18053 This variable contains the version string of the Exim build.
18054 The first character is a major version number, currently 4.
18055 Then after a dot, the next group of digits is a minor version number.
18056 There may be other characters following the minor version.
18057 </para>
18058 </listitem></varlistentry>
18059 <varlistentry>
18060 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
18061 <listitem>
18062 <para>
18063 This is not strictly an expansion variable. It is expansion syntax for
18064 inserting the message header line with the given name. Note that the name must
18065 be terminated by colon or white space, because it may contain a wide variety of
18066 characters. Note also that braces must <emphasis>not</emphasis> be used.
18067 </para>
18068 </listitem></varlistentry>
18069 <varlistentry>
18070 <term><varname>$headers_added</varname></term>
18071 <listitem>
18072 <para>
18073 <indexterm role="variable">
18074 <primary><varname>$headers_added</varname></primary>
18075 </indexterm>
18076 Within an ACL this variable contains the headers added so far by
18077 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
18078 The headers are a newline-separated list.
18079 </para>
18080 </listitem></varlistentry>
18081 <varlistentry>
18082 <term><varname>$home</varname></term>
18083 <listitem>
18084 <para>
18085 <indexterm role="variable">
18086 <primary><varname>$home</varname></primary>
18087 </indexterm>
18088 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
18089 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
18090 means it is set during the running of users&#x2019; filter files. A router may also
18091 explicitly set a home directory for use by a transport; this can be overridden
18092 by a setting on the transport itself.
18093 </para>
18094 <para>
18095 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
18096 of the environment variable HOME, which is subject to the
18097 <option>keep_environment</option> and <option>add_environment</option> main config options.
18098 </para>
18099 </listitem></varlistentry>
18100 <varlistentry>
18101 <term><varname>$host</varname></term>
18102 <listitem>
18103 <para>
18104 <indexterm role="variable">
18105 <primary><varname>$host</varname></primary>
18106 </indexterm>
18107 If a router assigns an address to a transport (any transport), and passes a
18108 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
18109 to run is the name of the first host on the list. Note that this applies both
18110 to local and remote transports.
18111 </para>
18112 <para>
18113 <indexterm role="concept">
18114 <primary>transport</primary>
18115 <secondary>filter</secondary>
18116 </indexterm>
18117 <indexterm role="concept">
18118 <primary>filter</primary>
18119 <secondary>transport filter</secondary>
18120 </indexterm>
18121 For the <command>smtp</command> transport, if there is more than one host, the value of
18122 <varname>$host</varname> changes as the transport works its way through the list. In
18123 particular, when the <command>smtp</command> transport is expanding its options for encryption
18124 using TLS, or for specifying a transport filter (see chapter
18125 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
18126 is connected.
18127 </para>
18128 <para>
18129 When used in the client part of an authenticator configuration (see chapter
18130 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
18131 client is connected.
18132 </para>
18133 </listitem></varlistentry>
18134 <varlistentry>
18135 <term><varname>$host_address</varname></term>
18136 <listitem>
18137 <para>
18138 <indexterm role="variable">
18139 <primary><varname>$host_address</varname></primary>
18140 </indexterm>
18141 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
18142 for a remote connection. It is also set to the IP address that is being checked
18143 when the <option>ignore_target_hosts</option> option is being processed.
18144 </para>
18145 </listitem></varlistentry>
18146 <varlistentry>
18147 <term><varname>$host_data</varname></term>
18148 <listitem>
18149 <para>
18150 <indexterm role="variable">
18151 <primary><varname>$host_data</varname></primary>
18152 </indexterm>
18153 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
18154 result of the lookup is made available in the <varname>$host_data</varname> variable. This
18155 allows you, for example, to do things like this:
18156 </para>
18157 <literallayout class="monospaced">
18158 deny  hosts = net-lsearch;/some/file
18159 message = $host_data
18160 </literallayout>
18161 </listitem></varlistentry>
18162 <varlistentry>
18163 <term><varname>$host_lookup_deferred</varname></term>
18164 <listitem>
18165 <para>
18166 <indexterm role="concept">
18167 <primary>host name</primary>
18168 <secondary>lookup, failure of</secondary>
18169 </indexterm>
18170 <indexterm role="variable">
18171 <primary><varname>$host_lookup_deferred</varname></primary>
18172 </indexterm>
18173 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18174 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18175 name from its IP address, and the attempt is not successful, one of these
18176 variables is set to <quote>1</quote>.
18177 </para>
18178 <itemizedlist>
18179 <listitem>
18180 <para>
18181 If the lookup receives a definite negative response (for example, a DNS lookup
18182 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18183 </para>
18184 </listitem>
18185 <listitem>
18186 <para>
18187 If there is any kind of problem during the lookup, such that Exim cannot
18188 tell whether or not the host name is defined (for example, a timeout for a DNS
18189 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18190 </para>
18191 </listitem>
18192 </itemizedlist>
18193 <para>
18194 Looking up a host&#x2019;s name from its IP address consists of more than just a
18195 single reverse lookup. Exim checks that a forward lookup of at least one of the
18196 names it receives from a reverse lookup yields the original IP address. If this
18197 is not the case, Exim does not accept the looked up name(s), and
18198 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18199 IP address (for example, the existence of a PTR record in the DNS) is not
18200 sufficient on its own for the success of a host name lookup. If the reverse
18201 lookup succeeds, but there is a lookup problem such as a timeout when checking
18202 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18203 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18204 </para>
18205 </listitem></varlistentry>
18206 <varlistentry>
18207 <term><varname>$host_lookup_failed</varname></term>
18208 <listitem>
18209 <para>
18210 <indexterm role="variable">
18211 <primary><varname>$host_lookup_failed</varname></primary>
18212 </indexterm>
18213 See <varname>$host_lookup_deferred</varname>.
18214 </para>
18215 </listitem></varlistentry>
18216 <varlistentry>
18217 <term><varname>$host_port</varname></term>
18218 <listitem>
18219 <para>
18220 <indexterm role="variable">
18221 <primary><varname>$host_port</varname></primary>
18222 </indexterm>
18223 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18224 for an outbound connection.
18225 </para>
18226 </listitem></varlistentry>
18227 <varlistentry>
18228 <term><varname>$initial_cwd</varname></term>
18229 <listitem>
18230 <para>
18231 <indexterm role="variable">
18232 <primary><varname>$initial_cwd</varname></primary>
18233 </indexterm>
18234 This variable contains the full path name of the initial working
18235 directory of the current Exim process. This may differ from the current
18236 working directory, as Exim changes this to "/" during early startup, and
18237 to <varname>$spool_directory</varname> later.
18238 </para>
18239 </listitem></varlistentry>
18240 <varlistentry>
18241 <term><varname>$inode</varname></term>
18242 <listitem>
18243 <para>
18244 <indexterm role="variable">
18245 <primary><varname>$inode</varname></primary>
18246 </indexterm>
18247 The only time this variable is set is while expanding the <option>directory_file</option>
18248 option in the <command>appendfile</command> transport. The variable contains the inode number
18249 of the temporary file which is about to be renamed. It can be used to construct
18250 a unique name for the file.
18251 </para>
18252 </listitem></varlistentry>
18253 <varlistentry>
18254 <term><varname>$interface_address</varname></term>
18255 <listitem>
18256 <para>
18257 <indexterm role="variable">
18258 <primary><varname>$interface_address</varname></primary>
18259 </indexterm>
18260 This is an obsolete name for <varname>$received_ip_address</varname>.
18261 </para>
18262 </listitem></varlistentry>
18263 <varlistentry>
18264 <term><varname>$interface_port</varname></term>
18265 <listitem>
18266 <para>
18267 <indexterm role="variable">
18268 <primary><varname>$interface_port</varname></primary>
18269 </indexterm>
18270 This is an obsolete name for <varname>$received_port</varname>.
18271 </para>
18272 </listitem></varlistentry>
18273 <varlistentry>
18274 <term><varname>$item</varname></term>
18275 <listitem>
18276 <para>
18277 <indexterm role="variable">
18278 <primary><varname>$item</varname></primary>
18279 </indexterm>
18280 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18281 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18282 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18283 empty.
18284 </para>
18285 </listitem></varlistentry>
18286 <varlistentry>
18287 <term><varname>$ldap_dn</varname></term>
18288 <listitem>
18289 <para>
18290 <indexterm role="variable">
18291 <primary><varname>$ldap_dn</varname></primary>
18292 </indexterm>
18293 This variable, which is available only when Exim is compiled with LDAP support,
18294 contains the DN from the last entry in the most recently successful LDAP
18295 lookup.
18296 </para>
18297 </listitem></varlistentry>
18298 <varlistentry>
18299 <term><varname>$load_average</varname></term>
18300 <listitem>
18301 <para>
18302 <indexterm role="variable">
18303 <primary><varname>$load_average</varname></primary>
18304 </indexterm>
18305 This variable contains the system load average, multiplied by 1000 so that it
18306 is an integer. For example, if the load average is 0.21, the value of the
18307 variable is 210. The value is recomputed every time the variable is referenced.
18308 </para>
18309 </listitem></varlistentry>
18310 <varlistentry>
18311 <term><varname>$local_part</varname></term>
18312 <listitem>
18313 <para>
18314 <indexterm role="variable">
18315 <primary><varname>$local_part</varname></primary>
18316 </indexterm>
18317 When an address is being routed, or delivered on its own, this
18318 variable contains the local part. When a number of addresses are being
18319 delivered together (for example, multiple RCPT commands in an SMTP
18320 session), <varname>$local_part</varname> is not set.
18321 </para>
18322 <para>
18323 Global address rewriting happens when a message is received, so the value of
18324 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18325 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18326 because a message may have many recipients and the system filter is called just
18327 once.
18328 </para>
18329 <para>
18330 <indexterm role="variable">
18331 <primary><varname>$local_part_prefix</varname></primary>
18332 </indexterm>
18333 <indexterm role="variable">
18334 <primary><varname>$local_part_suffix</varname></primary>
18335 </indexterm>
18336 If a local part prefix or suffix has been recognized, it is not included in the
18337 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18338 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18339 <varname>$local_part_suffix</varname>, respectively.
18340 </para>
18341 <para>
18342 When a message is being delivered to a file, pipe, or autoreply transport as a
18343 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18344 the parent address, not to the file name or command (see <varname>$address_file</varname> and
18345 <varname>$address_pipe</varname>).
18346 </para>
18347 <para>
18348 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18349 local part of the recipient address.
18350 </para>
18351 <para>
18352 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18353 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18354 it can be used in the expansion of the replacement address, for example.
18355 </para>
18356 <para>
18357 In all cases, all quoting is removed from the local part. For example, for both
18358 the addresses
18359 </para>
18360 <literallayout class="monospaced">
18361 "abc:xyz"@test.example
18362 abc\:xyz@test.example
18363 </literallayout>
18364 <para>
18365 the value of <varname>$local_part</varname> is
18366 </para>
18367 <literallayout class="monospaced">
18368 abc:xyz
18369 </literallayout>
18370 <para>
18371 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18372 inside a quoting operator. For example, in a <command>redirect</command> router you could
18373 have:
18374 </para>
18375 <literallayout class="monospaced">
18376 data = ${quote_local_part:$local_part}@new.domain.example
18377 </literallayout>
18378 <para>
18379 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18380 to process local parts in a case-dependent manner in a router, you can set the
18381 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18382 </para>
18383 </listitem></varlistentry>
18384 <varlistentry>
18385 <term><varname>$local_part_data</varname></term>
18386 <listitem>
18387 <para>
18388 <indexterm role="variable">
18389 <primary><varname>$local_part_data</varname></primary>
18390 </indexterm>
18391 When the <option>local_parts</option> option on a router matches a local part by means of a
18392 lookup, the data read by the lookup is available during the running of the
18393 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18394 to a transport, the value is available in that transport. If the transport is
18395 handling multiple addresses, the value from the first address is used.
18396 </para>
18397 <para>
18398 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18399 matches a local part by means of a lookup. The data read by the lookup is
18400 available during the rest of the ACL statement. In all other situations, this
18401 variable expands to nothing.
18402 </para>
18403 </listitem></varlistentry>
18404 <varlistentry>
18405 <term><varname>$local_part_prefix</varname></term>
18406 <listitem>
18407 <para>
18408 <indexterm role="variable">
18409 <primary><varname>$local_part_prefix</varname></primary>
18410 </indexterm>
18411 When an address is being routed or delivered, and a
18412 specific prefix for the local part was recognized, it is available in this
18413 variable, having been removed from <varname>$local_part</varname>.
18414 </para>
18415 </listitem></varlistentry>
18416 <varlistentry>
18417 <term><varname>$local_part_suffix</varname></term>
18418 <listitem>
18419 <para>
18420 <indexterm role="variable">
18421 <primary><varname>$local_part_suffix</varname></primary>
18422 </indexterm>
18423 When an address is being routed or delivered, and a
18424 specific suffix for the local part was recognized, it is available in this
18425 variable, having been removed from <varname>$local_part</varname>.
18426 </para>
18427 </listitem></varlistentry>
18428 <varlistentry>
18429 <term><varname>$local_scan_data</varname></term>
18430 <listitem>
18431 <para>
18432 <indexterm role="variable">
18433 <primary><varname>$local_scan_data</varname></primary>
18434 </indexterm>
18435 This variable contains the text returned by the <function>local_scan()</function> function when
18436 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18437 </para>
18438 </listitem></varlistentry>
18439 <varlistentry>
18440 <term><varname>$local_user_gid</varname></term>
18441 <listitem>
18442 <para>
18443 <indexterm role="variable">
18444 <primary><varname>$local_user_gid</varname></primary>
18445 </indexterm>
18446 See <varname>$local_user_uid</varname>.
18447 </para>
18448 </listitem></varlistentry>
18449 <varlistentry>
18450 <term><varname>$local_user_uid</varname></term>
18451 <listitem>
18452 <para>
18453 <indexterm role="variable">
18454 <primary><varname>$local_user_uid</varname></primary>
18455 </indexterm>
18456 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18457 <option>check_local_user</option> router precondition succeeds. This means that their values
18458 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18459 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18460 router-specific expansions. At all other times, the values in these variables
18461 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18462 </para>
18463 </listitem></varlistentry>
18464 <varlistentry>
18465 <term><varname>$localhost_number</varname></term>
18466 <listitem>
18467 <para>
18468 <indexterm role="variable">
18469 <primary><varname>$localhost_number</varname></primary>
18470 </indexterm>
18471 This contains the expanded value of the
18472 <option>localhost_number</option> option. The expansion happens after the main options have
18473 been read.
18474 </para>
18475 </listitem></varlistentry>
18476 <varlistentry>
18477 <term><varname>$log_inodes</varname></term>
18478 <listitem>
18479 <para>
18480 <indexterm role="variable">
18481 <primary><varname>$log_inodes</varname></primary>
18482 </indexterm>
18483 The number of free inodes in the disk partition where Exim&#x2019;s
18484 log files are being written. The value is recalculated whenever the variable is
18485 referenced. If the relevant file system does not have the concept of inodes,
18486 the value of is -1. See also the <option>check_log_inodes</option> option.
18487 </para>
18488 </listitem></varlistentry>
18489 <varlistentry>
18490 <term><varname>$log_space</varname></term>
18491 <listitem>
18492 <para>
18493 <indexterm role="variable">
18494 <primary><varname>$log_space</varname></primary>
18495 </indexterm>
18496 The amount of free space (as a number of kilobytes) in the disk
18497 partition where Exim&#x2019;s log files are being written. The value is recalculated
18498 whenever the variable is referenced. If the operating system does not have the
18499 ability to find the amount of free space (only true for experimental systems),
18500 the space value is -1. See also the <option>check_log_space</option> option.
18501 </para>
18502 </listitem></varlistentry>
18503 <varlistentry>
18504 <term><varname>$lookup_dnssec_authenticated</varname></term>
18505 <listitem>
18506 <para>
18507 <indexterm role="variable">
18508 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18509 </indexterm>
18510 This variable is set after a DNS lookup done by
18511 a dnsdb lookup expansion, dnslookup router or smtp transport.
18512 <indexterm role="concept">
18513 <primary>DNS</primary>
18514 <secondary>DNSSEC</secondary>
18515 </indexterm>
18516 It will be empty if <command>DNSSEC</command> was not requested,
18517 <quote>no</quote> if the result was not labelled as authenticated data
18518 and <quote>yes</quote> if it was.
18519 Results that are labelled as authoritative answer that match
18520 the <option>dns_trust_aa</option> configuration variable count also
18521 as authenticated data.
18522 </para>
18523 </listitem></varlistentry>
18524 <varlistentry>
18525 <term><varname>$mailstore_basename</varname></term>
18526 <listitem>
18527 <para>
18528 <indexterm role="variable">
18529 <primary><varname>$mailstore_basename</varname></primary>
18530 </indexterm>
18531 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18532 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18533 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18534 contains the basename of the files that are being written, that is, the name
18535 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18536 variable is empty.
18537 </para>
18538 </listitem></varlistentry>
18539 <varlistentry>
18540 <term><varname>$malware_name</varname></term>
18541 <listitem>
18542 <para>
18543 <indexterm role="variable">
18544 <primary><varname>$malware_name</varname></primary>
18545 </indexterm>
18546 This variable is available when Exim is compiled with the
18547 content-scanning extension. It is set to the name of the virus that was found
18548 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18549 </para>
18550 </listitem></varlistentry>
18551 <varlistentry>
18552 <term><varname>$max_received_linelength</varname></term>
18553 <listitem>
18554 <para>
18555 <indexterm role="variable">
18556 <primary><varname>$max_received_linelength</varname></primary>
18557 </indexterm>
18558 <indexterm role="concept">
18559 <primary>maximum</primary>
18560 <secondary>line length</secondary>
18561 </indexterm>
18562 <indexterm role="concept">
18563 <primary>line length</primary>
18564 <secondary>maximum</secondary>
18565 </indexterm>
18566 This variable contains the number of bytes in the longest line that was
18567 received as part of the message, not counting the line termination
18568 character(s).
18569 </para>
18570 </listitem></varlistentry>
18571 <varlistentry>
18572 <term><varname>$message_age</varname></term>
18573 <listitem>
18574 <para>
18575 <indexterm role="concept">
18576 <primary>message</primary>
18577 <secondary>age of</secondary>
18578 </indexterm>
18579 <indexterm role="variable">
18580 <primary><varname>$message_age</varname></primary>
18581 </indexterm>
18582 This variable is set at the start of a delivery attempt to contain the number
18583 of seconds since the message was received. It does not change during a single
18584 delivery attempt.
18585 </para>
18586 </listitem></varlistentry>
18587 <varlistentry>
18588 <term><varname>$message_body</varname></term>
18589 <listitem>
18590 <para>
18591 <indexterm role="concept">
18592 <primary>body of message</primary>
18593 <secondary>expansion variable</secondary>
18594 </indexterm>
18595 <indexterm role="concept">
18596 <primary>message body</primary>
18597 <secondary>in expansion</secondary>
18598 </indexterm>
18599 <indexterm role="concept">
18600 <primary>binary zero</primary>
18601 <secondary>in message body</secondary>
18602 </indexterm>
18603 <indexterm role="variable">
18604 <primary><varname>$message_body</varname></primary>
18605 </indexterm>
18606 <indexterm role="option">
18607 <primary><option>message_body_visible</option></primary>
18608 </indexterm>
18609 This variable contains the initial portion of a message&#x2019;s body while it is
18610 being delivered, and is intended mainly for use in filter files. The maximum
18611 number of characters of the body that are put into the variable is set by the
18612 <option>message_body_visible</option> configuration option; the default is 500.
18613 </para>
18614 <para>
18615 <indexterm role="option">
18616 <primary><option>message_body_newlines</option></primary>
18617 </indexterm>
18618 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18619 easier to search for phrases that might be split over a line break. However,
18620 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18621 zeros are always converted into spaces.
18622 </para>
18623 </listitem></varlistentry>
18624 <varlistentry>
18625 <term><varname>$message_body_end</varname></term>
18626 <listitem>
18627 <para>
18628 <indexterm role="concept">
18629 <primary>body of message</primary>
18630 <secondary>expansion variable</secondary>
18631 </indexterm>
18632 <indexterm role="concept">
18633 <primary>message body</primary>
18634 <secondary>in expansion</secondary>
18635 </indexterm>
18636 <indexterm role="variable">
18637 <primary><varname>$message_body_end</varname></primary>
18638 </indexterm>
18639 This variable contains the final portion of a message&#x2019;s
18640 body while it is being delivered. The format and maximum size are as for
18641 <varname>$message_body</varname>.
18642 </para>
18643 </listitem></varlistentry>
18644 <varlistentry>
18645 <term><varname>$message_body_size</varname></term>
18646 <listitem>
18647 <para>
18648 <indexterm role="concept">
18649 <primary>body of message</primary>
18650 <secondary>size</secondary>
18651 </indexterm>
18652 <indexterm role="concept">
18653 <primary>message body</primary>
18654 <secondary>size</secondary>
18655 </indexterm>
18656 <indexterm role="variable">
18657 <primary><varname>$message_body_size</varname></primary>
18658 </indexterm>
18659 When a message is being delivered, this variable contains the size of the body
18660 in bytes. The count starts from the character after the blank line that
18661 separates the body from the header. Newlines are included in the count. See
18662 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18663 </para>
18664 </listitem></varlistentry>
18665 <varlistentry>
18666 <term><varname>$message_exim_id</varname></term>
18667 <listitem>
18668 <para>
18669 <indexterm role="variable">
18670 <primary><varname>$message_exim_id</varname></primary>
18671 </indexterm>
18672 When a message is being received or delivered, this variable contains the
18673 unique message id that is generated and used by Exim to identify the message.
18674 An id is not created for a message until after its header has been successfully
18675 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18676 line; it is the local id that Exim assigns to the message, for example:
18677 <literal>1BXTIK-0001yO-VA</literal>.
18678 </para>
18679 </listitem></varlistentry>
18680 <varlistentry>
18681 <term><varname>$message_headers</varname></term>
18682 <listitem>
18683 <para>
18684 <indexterm role="variable">
18685 <primary><varname>$message_headers</varname></primary>
18686 </indexterm>
18687 This variable contains a concatenation of all the header lines when a message
18688 is being processed, except for lines added by routers or transports. The header
18689 lines are separated by newline characters. Their contents are decoded in the
18690 same way as a header line that is inserted by <option>bheader</option>.
18691 </para>
18692 </listitem></varlistentry>
18693 <varlistentry>
18694 <term><varname>$message_headers_raw</varname></term>
18695 <listitem>
18696 <para>
18697 <indexterm role="variable">
18698 <primary><varname>$message_headers_raw</varname></primary>
18699 </indexterm>
18700 This variable is like <varname>$message_headers</varname> except that no processing of the
18701 contents of header lines is done.
18702 </para>
18703 </listitem></varlistentry>
18704 <varlistentry>
18705 <term><varname>$message_id</varname></term>
18706 <listitem>
18707 <para>
18708 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18709 </para>
18710 </listitem></varlistentry>
18711 <varlistentry>
18712 <term><varname>$message_linecount</varname></term>
18713 <listitem>
18714 <para>
18715 <indexterm role="variable">
18716 <primary><varname>$message_linecount</varname></primary>
18717 </indexterm>
18718 This variable contains the total number of lines in the header and body of the
18719 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18720 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18721 number of lines received. Before delivery happens (that is, before filters,
18722 routers, and transports run) the count is increased to include the
18723 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18724 lines that are added by ACLs. The blank line that separates the message header
18725 from the body is not counted.
18726 </para>
18727 <para>
18728 As with the special case of <varname>$message_size</varname>, during the expansion of the
18729 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18730 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18731 file that has been written (minus one for the blank line between the
18732 header and the body).
18733 </para>
18734 <para>
18735 Here is an example of the use of this variable in a DATA ACL:
18736 </para>
18737 <literallayout class="monospaced">
18738 deny message   = Too many lines in message header
18739      condition = \
18740       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18741 </literallayout>
18742 <para>
18743 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18744 message has not yet been received.
18745 </para>
18746 </listitem></varlistentry>
18747 <varlistentry>
18748 <term><varname>$message_size</varname></term>
18749 <listitem>
18750 <para>
18751 <indexterm role="concept">
18752 <primary>size</primary>
18753 <secondary>of message</secondary>
18754 </indexterm>
18755 <indexterm role="concept">
18756 <primary>message</primary>
18757 <secondary>size</secondary>
18758 </indexterm>
18759 <indexterm role="variable">
18760 <primary><varname>$message_size</varname></primary>
18761 </indexterm>
18762 When a message is being processed, this variable contains its size in bytes. In
18763 most cases, the size includes those headers that were received with the
18764 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18765 deliveries as they are written. However, there is one special case: during the
18766 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18767 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18768 precise size of the file that has been written. See also
18769 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18770 </para>
18771 <para>
18772 <indexterm role="concept">
18773 <primary>RCPT</primary>
18774 <secondary>value of <varname>$message_size</varname></secondary>
18775 </indexterm>
18776 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18777 contains the size supplied on the MAIL command, or -1 if no size was given. The
18778 value may not, of course, be truthful.
18779 </para>
18780 </listitem></varlistentry>
18781 <varlistentry>
18782 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18783 <listitem>
18784 <para>
18785 A number of variables whose names start with <varname>$mime</varname> are
18786 available when Exim is compiled with the content-scanning extension. For
18787 details, see section <xref linkend="SECTscanmimepart"/>.
18788 </para>
18789 </listitem></varlistentry>
18790 <varlistentry>
18791 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18792 <listitem>
18793 <para>
18794 These variables are counters that can be incremented by means
18795 of the <option>add</option> command in filter files.
18796 </para>
18797 </listitem></varlistentry>
18798 <varlistentry>
18799 <term><varname>$original_domain</varname></term>
18800 <listitem>
18801 <para>
18802 <indexterm role="variable">
18803 <primary><varname>$domain</varname></primary>
18804 </indexterm>
18805 <indexterm role="variable">
18806 <primary><varname>$original_domain</varname></primary>
18807 </indexterm>
18808 When a top-level address is being processed for delivery, this contains the
18809 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18810 generated by an alias, forward, or filter file) is being processed, this
18811 variable contains the domain of the original address (lower cased). This
18812 differs from <varname>$parent_domain</varname> only when there is more than one level of
18813 aliasing or forwarding. When more than one address is being delivered in a
18814 single transport run, <varname>$original_domain</varname> is not set.
18815 </para>
18816 <para>
18817 If a new address is created by means of a <option>deliver</option> command in a system
18818 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18819 part <emphasis>system-filter</emphasis> and the default qualify domain.
18820 </para>
18821 </listitem></varlistentry>
18822 <varlistentry>
18823 <term><varname>$original_local_part</varname></term>
18824 <listitem>
18825 <para>
18826 <indexterm role="variable">
18827 <primary><varname>$local_part</varname></primary>
18828 </indexterm>
18829 <indexterm role="variable">
18830 <primary><varname>$original_local_part</varname></primary>
18831 </indexterm>
18832 When a top-level address is being processed for delivery, this contains the
18833 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18834 local part, because <varname>$original_local_part</varname> always contains the full local
18835 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18836 filter file) is being processed, this variable contains the full local part of
18837 the original address.
18838 </para>
18839 <para>
18840 If the router that did the redirection processed the local part
18841 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18842 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18843 one level of aliasing or forwarding. When more than one address is being
18844 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18845 </para>
18846 <para>
18847 If a new address is created by means of a <option>deliver</option> command in a system
18848 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18849 part <emphasis>system-filter</emphasis> and the default qualify domain.
18850 </para>
18851 </listitem></varlistentry>
18852 <varlistentry>
18853 <term><varname>$originator_gid</varname></term>
18854 <listitem>
18855 <para>
18856 <indexterm role="concept">
18857 <primary>gid (group id)</primary>
18858 <secondary>of originating user</secondary>
18859 </indexterm>
18860 <indexterm role="concept">
18861 <primary>sender</primary>
18862 <secondary>gid</secondary>
18863 </indexterm>
18864 <indexterm role="variable">
18865 <primary><varname>$caller_gid</varname></primary>
18866 </indexterm>
18867 <indexterm role="variable">
18868 <primary><varname>$originator_gid</varname></primary>
18869 </indexterm>
18870 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18871 message was received. For messages received via the command line, this is the
18872 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18873 normally the gid of the Exim user.
18874 </para>
18875 </listitem></varlistentry>
18876 <varlistentry>
18877 <term><varname>$originator_uid</varname></term>
18878 <listitem>
18879 <para>
18880 <indexterm role="concept">
18881 <primary>uid (user id)</primary>
18882 <secondary>of originating user</secondary>
18883 </indexterm>
18884 <indexterm role="concept">
18885 <primary>sender</primary>
18886 <secondary>uid</secondary>
18887 </indexterm>
18888 <indexterm role="variable">
18889 <primary><varname>$caller_uid</varname></primary>
18890 </indexterm>
18891 <indexterm role="variable">
18892 <primary><varname>$originator_uid</varname></primary>
18893 </indexterm>
18894 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18895 messages received via the command line, this is the uid of the sending user.
18896 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18897 user.
18898 </para>
18899 </listitem></varlistentry>
18900 <varlistentry>
18901 <term><varname>$parent_domain</varname></term>
18902 <listitem>
18903 <para>
18904 <indexterm role="variable">
18905 <primary><varname>$parent_domain</varname></primary>
18906 </indexterm>
18907 This variable is similar to <varname>$original_domain</varname> (see
18908 above), except that it refers to the immediately preceding parent address.
18909 </para>
18910 </listitem></varlistentry>
18911 <varlistentry>
18912 <term><varname>$parent_local_part</varname></term>
18913 <listitem>
18914 <para>
18915 <indexterm role="variable">
18916 <primary><varname>$parent_local_part</varname></primary>
18917 </indexterm>
18918 This variable is similar to <varname>$original_local_part</varname>
18919 (see above), except that it refers to the immediately preceding parent address.
18920 </para>
18921 </listitem></varlistentry>
18922 <varlistentry>
18923 <term><varname>$pid</varname></term>
18924 <listitem>
18925 <para>
18926 <indexterm role="concept">
18927 <primary>pid (process id)</primary>
18928 <secondary>of current process</secondary>
18929 </indexterm>
18930 <indexterm role="variable">
18931 <primary><varname>$pid</varname></primary>
18932 </indexterm>
18933 This variable contains the current process id.
18934 </para>
18935 </listitem></varlistentry>
18936 <varlistentry>
18937 <term><varname>$pipe_addresses</varname></term>
18938 <listitem>
18939 <para>
18940 <indexterm role="concept">
18941 <primary>filter</primary>
18942 <secondary>transport filter</secondary>
18943 </indexterm>
18944 <indexterm role="concept">
18945 <primary>transport</primary>
18946 <secondary>filter</secondary>
18947 </indexterm>
18948 <indexterm role="variable">
18949 <primary><varname>$pipe_addresses</varname></primary>
18950 </indexterm>
18951 This is not an expansion variable, but is mentioned here because the string
18952 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18953 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18954 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18955 It cannot be used in general expansion strings, and provokes an <quote>unknown
18956 variable</quote> error if encountered.
18957 </para>
18958 </listitem></varlistentry>
18959 <varlistentry>
18960 <term><varname>$primary_hostname</varname></term>
18961 <listitem>
18962 <para>
18963 <indexterm role="variable">
18964 <primary><varname>$primary_hostname</varname></primary>
18965 </indexterm>
18966 This variable contains the value set by <option>primary_hostname</option> in the
18967 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18968 a single-component name, Exim calls <function>gethostbyname()</function> (or
18969 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18970 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18971 </para>
18972 </listitem></varlistentry>
18973 <varlistentry>
18974 <term><varname>$proxy_external_address</varname></term>
18975 <term><varname>$proxy_external_port</varname></term>
18976 <term><varname>$proxy_local_address</varname></term>
18977 <term><varname>$proxy_local_port</varname></term>
18978 <term><varname>$proxy_session</varname></term>
18979 <listitem>
18980 <para>
18981 These variables are only available when built with Proxy Protocol
18982 or SOCKS5 support.
18983 For details see chapter <xref linkend="SECTproxyInbound"/>.
18984 </para>
18985 </listitem></varlistentry>
18986 <varlistentry>
18987 <term><varname>$prdr_requested</varname></term>
18988 <listitem>
18989 <para>
18990 <indexterm role="concept">
18991 <primary>PRDR</primary>
18992 <secondary>variable for</secondary>
18993 </indexterm>
18994 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
18995 current message, otherwise <quote>no</quote>.
18996 </para>
18997 </listitem></varlistentry>
18998 <varlistentry>
18999 <term><varname>$prvscheck_address</varname></term>
19000 <listitem>
19001 <para>
19002 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19003 which is described in sections <xref linkend="SECTexpansionitems"/> and
19004 <xref linkend="SECTverifyPRVS"/>.
19005 </para>
19006 </listitem></varlistentry>
19007 <varlistentry>
19008 <term><varname>$prvscheck_keynum</varname></term>
19009 <listitem>
19010 <para>
19011 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19012 which is described in sections <xref linkend="SECTexpansionitems"/> and
19013 <xref linkend="SECTverifyPRVS"/>.
19014 </para>
19015 </listitem></varlistentry>
19016 <varlistentry>
19017 <term><varname>$prvscheck_result</varname></term>
19018 <listitem>
19019 <para>
19020 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19021 which is described in sections <xref linkend="SECTexpansionitems"/> and
19022 <xref linkend="SECTverifyPRVS"/>.
19023 </para>
19024 </listitem></varlistentry>
19025 <varlistentry>
19026 <term><varname>$qualify_domain</varname></term>
19027 <listitem>
19028 <para>
19029 <indexterm role="variable">
19030 <primary><varname>$qualify_domain</varname></primary>
19031 </indexterm>
19032 The value set for the <option>qualify_domain</option> option in the configuration file.
19033 </para>
19034 </listitem></varlistentry>
19035 <varlistentry>
19036 <term><varname>$qualify_recipient</varname></term>
19037 <listitem>
19038 <para>
19039 <indexterm role="variable">
19040 <primary><varname>$qualify_recipient</varname></primary>
19041 </indexterm>
19042 The value set for the <option>qualify_recipient</option> option in the configuration file,
19043 or if not set, the value of <varname>$qualify_domain</varname>.
19044 </para>
19045 </listitem></varlistentry>
19046 <varlistentry>
19047 <term><varname>$queue_name</varname></term>
19048 <listitem>
19049 <para>
19050 <indexterm role="variable">
19051 <primary><varname>$queue_name</varname></primary>
19052 </indexterm>
19053 <indexterm role="concept">
19054 <primary>named queues</primary>
19055 </indexterm>
19056 <indexterm role="concept">
19057 <primary>queues</primary>
19058 <secondary>named</secondary>
19059 </indexterm>
19060 The name of the spool queue in use; empty for the default queue.
19061 </para>
19062 </listitem></varlistentry>
19063 <varlistentry>
19064 <term><varname>$rcpt_count</varname></term>
19065 <listitem>
19066 <para>
19067 <indexterm role="variable">
19068 <primary><varname>$rcpt_count</varname></primary>
19069 </indexterm>
19070 When a message is being received by SMTP, this variable contains the number of
19071 RCPT commands received for the current message. If this variable is used in a
19072 RCPT ACL, its value includes the current command.
19073 </para>
19074 </listitem></varlistentry>
19075 <varlistentry>
19076 <term><varname>$rcpt_defer_count</varname></term>
19077 <listitem>
19078 <para>
19079 <indexterm role="variable">
19080 <primary><varname>$rcpt_defer_count</varname></primary>
19081 </indexterm>
19082 <indexterm role="concept">
19083 <primary>4<emphasis>xx</emphasis> responses</primary>
19084 <secondary>count of</secondary>
19085 </indexterm>
19086 When a message is being received by SMTP, this variable contains the number of
19087 RCPT commands in the current message that have previously been rejected with a
19088 temporary (4<emphasis>xx</emphasis>) response.
19089 </para>
19090 </listitem></varlistentry>
19091 <varlistentry>
19092 <term><varname>$rcpt_fail_count</varname></term>
19093 <listitem>
19094 <para>
19095 <indexterm role="variable">
19096 <primary><varname>$rcpt_fail_count</varname></primary>
19097 </indexterm>
19098 When a message is being received by SMTP, this variable contains the number of
19099 RCPT commands in the current message that have previously been rejected with a
19100 permanent (5<emphasis>xx</emphasis>) response.
19101 </para>
19102 </listitem></varlistentry>
19103 <varlistentry>
19104 <term><varname>$received_count</varname></term>
19105 <listitem>
19106 <para>
19107 <indexterm role="variable">
19108 <primary><varname>$received_count</varname></primary>
19109 </indexterm>
19110 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
19111 including the one added by Exim (so its value is always greater than zero). It
19112 is available in the DATA ACL, the non-SMTP ACL, and while routing and
19113 delivering.
19114 </para>
19115 </listitem></varlistentry>
19116 <varlistentry>
19117 <term><varname>$received_for</varname></term>
19118 <listitem>
19119 <para>
19120 <indexterm role="variable">
19121 <primary><varname>$received_for</varname></primary>
19122 </indexterm>
19123 If there is only a single recipient address in an incoming message, this
19124 variable contains that address when the <emphasis>Received:</emphasis> header line is being
19125 built. The value is copied after recipient rewriting has happened, but before
19126 the <function>local_scan()</function> function is run.
19127 </para>
19128 </listitem></varlistentry>
19129 <varlistentry>
19130 <term><varname>$received_ip_address</varname></term>
19131 <listitem>
19132 <para>
19133 <indexterm role="variable">
19134 <primary><varname>$received_ip_address</varname></primary>
19135 </indexterm>
19136 As soon as an Exim server starts processing an incoming TCP/IP connection, this
19137 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
19138 is set to the local port number. (The remote IP address and port are in
19139 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
19140 the port value is -1 unless it has been set using the <option>-oMi</option> command line
19141 option.
19142 </para>
19143 <para>
19144 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
19145 could be used, for example, to make the file name for a TLS certificate depend
19146 on which interface and/or port is being used for the incoming connection. The
19147 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
19148 messages that are received, thus making these variables available at delivery
19149 time.
19150 For outbound connections see <varname>$sending_ip_address</varname>.
19151 </para>
19152 </listitem></varlistentry>
19153 <varlistentry>
19154 <term><varname>$received_port</varname></term>
19155 <listitem>
19156 <para>
19157 <indexterm role="variable">
19158 <primary><varname>$received_port</varname></primary>
19159 </indexterm>
19160 See <varname>$received_ip_address</varname>.
19161 </para>
19162 </listitem></varlistentry>
19163 <varlistentry>
19164 <term><varname>$received_protocol</varname></term>
19165 <listitem>
19166 <para>
19167 <indexterm role="variable">
19168 <primary><varname>$received_protocol</varname></primary>
19169 </indexterm>
19170 When a message is being processed, this variable contains the name of the
19171 protocol by which it was received. Most of the names used by Exim are defined
19172 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
19173 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
19174 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
19175 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
19176 connection and the client was successfully authenticated.
19177 </para>
19178 <para>
19179 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
19180 automatically set up on connection without the use of STARTTLS (see
19181 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
19182 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
19183 where the client initially uses EHLO, sets up an encrypted connection using
19184 STARTTLS, and then uses HELO afterwards.
19185 </para>
19186 <para>
19187 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19188 messages that are injected locally by trusted callers. This is commonly used to
19189 identify messages that are being re-injected after some kind of scanning.
19190 </para>
19191 </listitem></varlistentry>
19192 <varlistentry>
19193 <term><varname>$received_time</varname></term>
19194 <listitem>
19195 <para>
19196 <indexterm role="variable">
19197 <primary><varname>$received_time</varname></primary>
19198 </indexterm>
19199 This variable contains the date and time when the current message was received,
19200 as a number of seconds since the start of the Unix epoch.
19201 </para>
19202 </listitem></varlistentry>
19203 <varlistentry>
19204 <term><varname>$recipient_data</varname></term>
19205 <listitem>
19206 <para>
19207 <indexterm role="variable">
19208 <primary><varname>$recipient_data</varname></primary>
19209 </indexterm>
19210 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19211 condition. It contains the data from the lookup, and the value remains set
19212 until the next <option>recipients</option> test. Thus, you can do things like this:
19213 </para>
19214 <literallayout>
19215 <literal>require recipients  = cdb*@;/some/file</literal>
19216 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19217 </literallayout>
19218 <para>
19219 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19220 method in the address list, using the semicolon syntax as in the example above.
19221 The variable is not set for a lookup that is used as part of the string
19222 expansion that all such lists undergo before being interpreted.
19223 </para>
19224 </listitem></varlistentry>
19225 <varlistentry>
19226 <term><varname>$recipient_verify_failure</varname></term>
19227 <listitem>
19228 <para>
19229 <indexterm role="variable">
19230 <primary><varname>$recipient_verify_failure</varname></primary>
19231 </indexterm>
19232 In an ACL, when a recipient verification fails, this variable contains
19233 information about the failure. It is set to one of the following words:
19234 </para>
19235 <itemizedlist>
19236 <listitem>
19237 <para>
19238 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19239 was neither local nor came from an exempted host.
19240 </para>
19241 </listitem>
19242 <listitem>
19243 <para>
19244 <quote>route</quote>: Routing failed.
19245 </para>
19246 </listitem>
19247 <listitem>
19248 <para>
19249 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19250 or before the MAIL command (that is, on initial connection, HELO, or
19251 MAIL).
19252 </para>
19253 </listitem>
19254 <listitem>
19255 <para>
19256 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19257 </para>
19258 </listitem>
19259 <listitem>
19260 <para>
19261 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19262 </para>
19263 </listitem>
19264 </itemizedlist>
19265 <para>
19266 The main use of this variable is expected to be to distinguish between
19267 rejections of MAIL and rejections of RCPT.
19268 </para>
19269 </listitem></varlistentry>
19270 <varlistentry>
19271 <term><varname>$recipients</varname></term>
19272 <listitem>
19273 <para>
19274 <indexterm role="variable">
19275 <primary><varname>$recipients</varname></primary>
19276 </indexterm>
19277 This variable contains a list of envelope recipients for a message. A comma and
19278 a space separate the addresses in the replacement text. However, the variable
19279 is not generally available, to prevent exposure of Bcc recipients in
19280 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19281 cases:
19282 </para>
19283 <orderedlist numeration="arabic">
19284 <listitem>
19285 <para>
19286 In a system filter file.
19287 </para>
19288 </listitem>
19289 <listitem>
19290 <para>
19291 In the ACLs associated with the DATA command and with non-SMTP messages, that
19292 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19293 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19294 <option>acl_not_smtp_mime</option>.
19295 </para>
19296 </listitem>
19297 <listitem>
19298 <para>
19299 From within a <function>local_scan()</function> function.
19300 </para>
19301 </listitem>
19302 </orderedlist>
19303 </listitem></varlistentry>
19304 <varlistentry>
19305 <term><varname>$recipients_count</varname></term>
19306 <listitem>
19307 <para>
19308 <indexterm role="variable">
19309 <primary><varname>$recipients_count</varname></primary>
19310 </indexterm>
19311 When a message is being processed, this variable contains the number of
19312 envelope recipients that came with the message. Duplicates are not excluded
19313 from the count. While a message is being received over SMTP, the number
19314 increases for each accepted recipient. It can be referenced in an ACL.
19315 </para>
19316 </listitem></varlistentry>
19317 <varlistentry>
19318 <term><varname>$regex_match_string</varname></term>
19319 <listitem>
19320 <para>
19321 <indexterm role="variable">
19322 <primary><varname>$regex_match_string</varname></primary>
19323 </indexterm>
19324 This variable is set to contain the matching regular expression after a
19325 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19326 </para>
19327 </listitem></varlistentry>
19328 <varlistentry>
19329 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19330 <listitem>
19331 <para>
19332 <indexterm role="concept">
19333 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19334 </indexterm>
19335 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19336 these variables contain the
19337 captured substrings identified by the regular expression.
19338 </para>
19339 </listitem></varlistentry>
19340 <varlistentry>
19341 <term><varname>$reply_address</varname></term>
19342 <listitem>
19343 <para>
19344 <indexterm role="variable">
19345 <primary><varname>$reply_address</varname></primary>
19346 </indexterm>
19347 When a message is being processed, this variable contains the contents of the
19348 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19349 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19350 white space, the value is not processed in any way. In particular, no RFC 2047
19351 decoding or character code translation takes place.
19352 </para>
19353 </listitem></varlistentry>
19354 <varlistentry>
19355 <term><varname>$return_path</varname></term>
19356 <listitem>
19357 <para>
19358 <indexterm role="variable">
19359 <primary><varname>$return_path</varname></primary>
19360 </indexterm>
19361 When a message is being delivered, this variable contains the return path &ndash;
19362 the sender field that will be sent as part of the envelope. It is not enclosed
19363 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19364 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19365 mailing list has been expanded by a router which specifies a different address
19366 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19367 address, whereas <varname>$sender_address</varname> always contains the original sender address
19368 that was received with the message. In other words, <varname>$sender_address</varname> contains
19369 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19370 envelope sender.
19371 </para>
19372 </listitem></varlistentry>
19373 <varlistentry>
19374 <term><varname>$return_size_limit</varname></term>
19375 <listitem>
19376 <para>
19377 <indexterm role="variable">
19378 <primary><varname>$return_size_limit</varname></primary>
19379 </indexterm>
19380 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19381 </para>
19382 </listitem></varlistentry>
19383 <varlistentry>
19384 <term><varname>$router_name</varname></term>
19385 <listitem>
19386 <para>
19387 <indexterm role="concept">
19388 <primary>router</primary>
19389 <secondary>name</secondary>
19390 </indexterm>
19391 <indexterm role="concept">
19392 <primary>name</primary>
19393 <secondary>of router</secondary>
19394 </indexterm>
19395 <indexterm role="variable">
19396 <primary><varname>$router_name</varname></primary>
19397 </indexterm>
19398 During the running of a router this variable contains its name.
19399 </para>
19400 </listitem></varlistentry>
19401 <varlistentry>
19402 <term><varname>$runrc</varname></term>
19403 <listitem>
19404 <para>
19405 <indexterm role="concept">
19406 <primary>return code</primary>
19407 <secondary>from <option>run</option> expansion</secondary>
19408 </indexterm>
19409 <indexterm role="variable">
19410 <primary><varname>$runrc</varname></primary>
19411 </indexterm>
19412 This variable contains the return code from a command that is run by the
19413 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19414 assume the order in which option values are expanded, except for those
19415 preconditions whose order of testing is documented. Therefore, you cannot
19416 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19417 another.
19418 </para>
19419 </listitem></varlistentry>
19420 <varlistentry>
19421 <term><varname>$self_hostname</varname></term>
19422 <listitem>
19423 <para>
19424 <indexterm role="option">
19425 <primary><option>self</option></primary>
19426 <secondary>value of host name</secondary>
19427 </indexterm>
19428 <indexterm role="variable">
19429 <primary><varname>$self_hostname</varname></primary>
19430 </indexterm>
19431 When an address is routed to a supposedly remote host that turns out to be the
19432 local host, what happens is controlled by the <option>self</option> generic router option.
19433 One of its values causes the address to be passed to another router. When this
19434 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19435 original router encountered. In other circumstances its contents are null.
19436 </para>
19437 </listitem></varlistentry>
19438 <varlistentry>
19439 <term><varname>$sender_address</varname></term>
19440 <listitem>
19441 <para>
19442 <indexterm role="variable">
19443 <primary><varname>$sender_address</varname></primary>
19444 </indexterm>
19445 When a message is being processed, this variable contains the sender&#x2019;s address
19446 that was received in the message&#x2019;s envelope. The case of letters in the address
19447 is retained, in both the local part and the domain. For bounce messages, the
19448 value of this variable is the empty string. See also <varname>$return_path</varname>.
19449 </para>
19450 </listitem></varlistentry>
19451 <varlistentry>
19452 <term><varname>$sender_address_data</varname></term>
19453 <listitem>
19454 <para>
19455 <indexterm role="variable">
19456 <primary><varname>$address_data</varname></primary>
19457 </indexterm>
19458 <indexterm role="variable">
19459 <primary><varname>$sender_address_data</varname></primary>
19460 </indexterm>
19461 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19462 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19463 distinguish it from data from a recipient address. The value does not persist
19464 after the end of the current ACL statement. If you want to preserve it for
19465 longer, you can save it in an ACL variable.
19466 </para>
19467 </listitem></varlistentry>
19468 <varlistentry>
19469 <term><varname>$sender_address_domain</varname></term>
19470 <listitem>
19471 <para>
19472 <indexterm role="variable">
19473 <primary><varname>$sender_address_domain</varname></primary>
19474 </indexterm>
19475 The domain portion of <varname>$sender_address</varname>.
19476 </para>
19477 </listitem></varlistentry>
19478 <varlistentry>
19479 <term><varname>$sender_address_local_part</varname></term>
19480 <listitem>
19481 <para>
19482 <indexterm role="variable">
19483 <primary><varname>$sender_address_local_part</varname></primary>
19484 </indexterm>
19485 The local part portion of <varname>$sender_address</varname>.
19486 </para>
19487 </listitem></varlistentry>
19488 <varlistentry>
19489 <term><varname>$sender_data</varname></term>
19490 <listitem>
19491 <para>
19492 <indexterm role="variable">
19493 <primary><varname>$sender_data</varname></primary>
19494 </indexterm>
19495 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19496 in a router <option>senders</option> option. It contains the data from the lookup, and the
19497 value remains set until the next <option>senders</option> test. Thus, you can do things like
19498 this:
19499 </para>
19500 <literallayout>
19501 <literal>require senders      = cdb*@;/some/file</literal>
19502 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19503 </literallayout>
19504 <para>
19505 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19506 method in the address list, using the semicolon syntax as in the example above.
19507 The variable is not set for a lookup that is used as part of the string
19508 expansion that all such lists undergo before being interpreted.
19509 </para>
19510 </listitem></varlistentry>
19511 <varlistentry>
19512 <term><varname>$sender_fullhost</varname></term>
19513 <listitem>
19514 <para>
19515 <indexterm role="variable">
19516 <primary><varname>$sender_fullhost</varname></primary>
19517 </indexterm>
19518 When a message is received from a remote host, this variable contains the host
19519 name and IP address in a single string. It ends with the IP address in square
19520 brackets, followed by a colon and a port number if the logging of ports is
19521 enabled. The format of the rest of the string depends on whether the host
19522 issued a HELO or EHLO SMTP command, and whether the host name was verified by
19523 looking up its IP address. (Looking up the IP address can be forced by the
19524 <option>host_lookup</option> option, independent of verification.) A plain host name at the
19525 start of the string is a verified host name; if this is not present,
19526 verification either failed or was not requested. A host name in parentheses is
19527 the argument of a HELO or EHLO command. This is omitted if it is identical to
19528 the verified host name or to the host&#x2019;s IP address in square brackets.
19529 </para>
19530 </listitem></varlistentry>
19531 <varlistentry>
19532 <term><varname>$sender_helo_dnssec</varname></term>
19533 <listitem>
19534 <para>
19535 <indexterm role="variable">
19536 <primary><varname>$sender_helo_dnssec</varname></primary>
19537 </indexterm>
19538 This boolean variable is true if a successful HELO verification was
19539 <indexterm role="concept">
19540 <primary>DNS</primary>
19541 <secondary>DNSSEC</secondary>
19542 </indexterm>
19543 done using DNS information the resolver library stated was authenticated data.
19544 </para>
19545 </listitem></varlistentry>
19546 <varlistentry>
19547 <term><varname>$sender_helo_name</varname></term>
19548 <listitem>
19549 <para>
19550 <indexterm role="variable">
19551 <primary><varname>$sender_helo_name</varname></primary>
19552 </indexterm>
19553 When a message is received from a remote host that has issued a HELO or EHLO
19554 command, the argument of that command is placed in this variable. It is also
19555 set if HELO or EHLO is used when a message is received using SMTP locally via
19556 the <option>-bs</option> or <option>-bS</option> options.
19557 </para>
19558 </listitem></varlistentry>
19559 <varlistentry>
19560 <term><varname>$sender_host_address</varname></term>
19561 <listitem>
19562 <para>
19563 <indexterm role="variable">
19564 <primary><varname>$sender_host_address</varname></primary>
19565 </indexterm>
19566 When a message is received from a remote host using SMTP,
19567 this variable contains that
19568 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19569 </para>
19570 </listitem></varlistentry>
19571 <varlistentry>
19572 <term><varname>$sender_host_authenticated</varname></term>
19573 <listitem>
19574 <para>
19575 <indexterm role="variable">
19576 <primary><varname>$sender_host_authenticated</varname></primary>
19577 </indexterm>
19578 This variable contains the name (not the public name) of the authenticator
19579 driver that successfully authenticated the client from which the message was
19580 received. It is empty if there was no successful authentication. See also
19581 <varname>$authenticated_id</varname>.
19582 </para>
19583 </listitem></varlistentry>
19584 <varlistentry>
19585 <term><varname>$sender_host_dnssec</varname></term>
19586 <listitem>
19587 <para>
19588 <indexterm role="variable">
19589 <primary><varname>$sender_host_dnssec</varname></primary>
19590 </indexterm>
19591 If an attempt to populate <varname>$sender_host_name</varname> has been made
19592 (by reference, <option>hosts_lookup</option> or
19593 otherwise) then this boolean will have been set true if, and only if, the
19594 resolver library states that both
19595 the reverse and forward DNS were authenticated data.  At all
19596 other times, this variable is false.
19597 </para>
19598 <para>
19599 <indexterm role="concept">
19600 <primary>DNS</primary>
19601 <secondary>DNSSEC</secondary>
19602 </indexterm>
19603 It is likely that you will need to coerce DNSSEC support on in the resolver
19604 library, by setting:
19605 </para>
19606 <literallayout class="monospaced">
19607 dns_dnssec_ok = 1
19608 </literallayout>
19609 <para>
19610 Exim does not perform DNSSEC validation itself, instead leaving that to a
19611 validating resolver (e.g. unbound, or bind with suitable configuration).
19612 </para>
19613 <para>
19614 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19615 mechanism in the list, then this variable will be false.
19616 </para>
19617 <para revisionflag="changed">
19618 This requires that your system resolver library support EDNS0 (and that
19619 DNSSEC flags exist in the system headers).  If the resolver silently drops
19620 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
19621 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
19622 </para>
19623 </listitem></varlistentry>
19624 <varlistentry>
19625 <term><varname>$sender_host_name</varname></term>
19626 <listitem>
19627 <para>
19628 <indexterm role="variable">
19629 <primary><varname>$sender_host_name</varname></primary>
19630 </indexterm>
19631 When a message is received from a remote host, this variable contains the
19632 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19633 other means, this variable is empty.
19634 </para>
19635 <para>
19636 <indexterm role="variable">
19637 <primary><varname>$host_lookup_failed</varname></primary>
19638 </indexterm>
19639 If the host name has not previously been looked up, a reference to
19640 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19641 A looked up name is accepted only if it leads back to the original IP address
19642 via a forward lookup. If either the reverse or the forward lookup fails to find
19643 any data, or if the forward lookup does not yield the original IP address,
19644 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19645 </para>
19646 <para>
19647 <indexterm role="variable">
19648 <primary><varname>$host_lookup_deferred</varname></primary>
19649 </indexterm>
19650 However, if either of the lookups cannot be completed (for example, there is a
19651 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19652 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19653 </para>
19654 <para>
19655 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19656 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19657 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19658 is set to <quote>1</quote>.
19659 </para>
19660 <para>
19661 Exim does not automatically look up every calling host&#x2019;s name. If you want
19662 maximum efficiency, you should arrange your configuration so that it avoids
19663 these lookups altogether. The lookup happens only if one or more of the
19664 following are true:
19665 </para>
19666 <itemizedlist>
19667 <listitem>
19668 <para>
19669 A string containing <varname>$sender_host_name</varname> is expanded.
19670 </para>
19671 </listitem>
19672 <listitem>
19673 <para>
19674 The calling host matches the list in <option>host_lookup</option>. In the default
19675 configuration, this option is set to *, so it must be changed if lookups are
19676 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19677 </para>
19678 </listitem>
19679 <listitem>
19680 <para>
19681 Exim needs the host name in order to test an item in a host list. The items
19682 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19683 <xref linkend="SECThoslispatnamsk"/>.
19684 </para>
19685 </listitem>
19686 <listitem>
19687 <para>
19688 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19689 In this case, the host name is required to compare with the name quoted in any
19690 EHLO or HELO commands that the client issues.
19691 </para>
19692 </listitem>
19693 <listitem>
19694 <para>
19695 The remote host issues a EHLO or HELO command that quotes one of the
19696 domains in <option>helo_lookup_domains</option>. The default value of this option is
19697 </para>
19698 <literallayout class="monospaced">
19699   helo_lookup_domains = @ : @[]
19700 </literallayout>
19701 <para>
19702 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19703 IP address in an EHLO or HELO command.
19704 </para>
19705 </listitem>
19706 </itemizedlist>
19707 </listitem></varlistentry>
19708 <varlistentry>
19709 <term><varname>$sender_host_port</varname></term>
19710 <listitem>
19711 <para>
19712 <indexterm role="variable">
19713 <primary><varname>$sender_host_port</varname></primary>
19714 </indexterm>
19715 When a message is received from a remote host, this variable contains the port
19716 number that was used on the remote host.
19717 </para>
19718 </listitem></varlistentry>
19719 <varlistentry>
19720 <term><varname>$sender_ident</varname></term>
19721 <listitem>
19722 <para>
19723 <indexterm role="variable">
19724 <primary><varname>$sender_ident</varname></primary>
19725 </indexterm>
19726 When a message is received from a remote host, this variable contains the
19727 identification received in response to an RFC 1413 request. When a message has
19728 been received locally, this variable contains the login name of the user that
19729 called Exim.
19730 </para>
19731 </listitem></varlistentry>
19732 <varlistentry>
19733 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19734 <listitem>
19735 <para>
19736 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19737 <option>ratelimit</option> ACL condition. Details are given in section
19738 <xref linkend="SECTratelimiting"/>.
19739 </para>
19740 </listitem></varlistentry>
19741 <varlistentry>
19742 <term><varname>$sender_rcvhost</varname></term>
19743 <listitem>
19744 <para>
19745 <indexterm role="concept">
19746 <primary>DNS</primary>
19747 <secondary>reverse lookup</secondary>
19748 </indexterm>
19749 <indexterm role="concept">
19750 <primary>reverse DNS lookup</primary>
19751 </indexterm>
19752 <indexterm role="variable">
19753 <primary><varname>$sender_rcvhost</varname></primary>
19754 </indexterm>
19755 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19756 either the verified host name (as obtained from a reverse DNS lookup) or, if
19757 there is no verified host name, the IP address in square brackets. After that
19758 there may be text in parentheses. When the first item is a verified host name,
19759 the first thing in the parentheses is the IP address in square brackets,
19760 followed by a colon and a port number if port logging is enabled. When the
19761 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19762 the parentheses.
19763 </para>
19764 <para>
19765 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19766 was used and its argument was not identical to the real host name or IP
19767 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19768 all three items are present in the parentheses, a newline and tab are inserted
19769 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19770 </para>
19771 </listitem></varlistentry>
19772 <varlistentry>
19773 <term><varname>$sender_verify_failure</varname></term>
19774 <listitem>
19775 <para>
19776 <indexterm role="variable">
19777 <primary><varname>$sender_verify_failure</varname></primary>
19778 </indexterm>
19779 In an ACL, when a sender verification fails, this variable contains information
19780 about the failure. The details are the same as for
19781 <varname>$recipient_verify_failure</varname>.
19782 </para>
19783 </listitem></varlistentry>
19784 <varlistentry>
19785 <term><varname>$sending_ip_address</varname></term>
19786 <listitem>
19787 <para>
19788 <indexterm role="variable">
19789 <primary><varname>$sending_ip_address</varname></primary>
19790 </indexterm>
19791 This variable is set whenever an outgoing SMTP connection to another host has
19792 been set up. It contains the IP address of the local interface that is being
19793 used. This is useful if a host that has more than one IP address wants to take
19794 on different personalities depending on which one is being used. For incoming
19795 connections, see <varname>$received_ip_address</varname>.
19796 </para>
19797 </listitem></varlistentry>
19798 <varlistentry>
19799 <term><varname>$sending_port</varname></term>
19800 <listitem>
19801 <para>
19802 <indexterm role="variable">
19803 <primary><varname>$sending_port</varname></primary>
19804 </indexterm>
19805 This variable is set whenever an outgoing SMTP connection to another host has
19806 been set up. It contains the local port that is being used. For incoming
19807 connections, see <varname>$received_port</varname>.
19808 </para>
19809 </listitem></varlistentry>
19810 <varlistentry>
19811 <term><varname>$smtp_active_hostname</varname></term>
19812 <listitem>
19813 <para>
19814 <indexterm role="variable">
19815 <primary><varname>$smtp_active_hostname</varname></primary>
19816 </indexterm>
19817 During an incoming SMTP session, this variable contains the value of the active
19818 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19819 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19820 value can be consulted during routing and delivery.
19821 </para>
19822 </listitem></varlistentry>
19823 <varlistentry>
19824 <term><varname>$smtp_command</varname></term>
19825 <listitem>
19826 <para>
19827 <indexterm role="variable">
19828 <primary><varname>$smtp_command</varname></primary>
19829 </indexterm>
19830 During the processing of an incoming SMTP command, this variable contains the
19831 entire command. This makes it possible to distinguish between HELO and EHLO in
19832 the HELO ACL, and also to distinguish between commands such as these:
19833 </para>
19834 <literallayout class="monospaced">
19835 MAIL FROM:&lt;&gt;
19836 MAIL FROM: &lt;&gt;
19837 </literallayout>
19838 <para>
19839 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19840 command, the address in <varname>$smtp_command</varname> is the original address before any
19841 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19842 the address after SMTP-time rewriting.
19843 </para>
19844 </listitem></varlistentry>
19845 <varlistentry>
19846 <term><varname>$smtp_command_argument</varname></term>
19847 <listitem>
19848 <para>
19849 <indexterm role="concept">
19850 <primary>SMTP</primary>
19851 <secondary>command, argument for</secondary>
19852 </indexterm>
19853 <indexterm role="variable">
19854 <primary><varname>$smtp_command_argument</varname></primary>
19855 </indexterm>
19856 While an ACL is running to check an SMTP command, this variable contains the
19857 argument, that is, the text that follows the command name, with leading white
19858 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19859 somewhat redundant, but is retained for backwards compatibility.
19860 </para>
19861 </listitem></varlistentry>
19862 <varlistentry>
19863 <term><varname>$smtp_count_at_connection_start</varname></term>
19864 <listitem>
19865 <para>
19866 <indexterm role="variable">
19867 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19868 </indexterm>
19869 This variable is set greater than zero only in processes spawned by the Exim
19870 daemon for handling incoming SMTP connections. The name is deliberately long,
19871 in order to emphasize what the contents are. When the daemon accepts a new
19872 connection, it increments this variable. A copy of the variable is passed to
19873 the child process that handles the connection, but its value is fixed, and
19874 never changes. It is only an approximation of how many incoming connections
19875 there actually are, because many other connections may come and go while a
19876 single connection is being processed. When a child process terminates, the
19877 daemon decrements its copy of the variable.
19878 </para>
19879 </listitem></varlistentry>
19880 <varlistentry>
19881 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19882 <listitem>
19883 <para>
19884 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19885 that were current at the end of the system filter file. This allows a system
19886 filter file to set values that can be tested in users&#x2019; filter files. For
19887 example, a system filter could set a value indicating how likely it is that a
19888 message is junk mail.
19889 </para>
19890 </listitem></varlistentry>
19891 <varlistentry>
19892 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19893 <listitem>
19894 <para>
19895 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19896 is compiled with the content-scanning extension. For details, see section
19897 <xref linkend="SECTscanspamass"/>.
19898 </para>
19899 </listitem></varlistentry>
19900 <varlistentry>
19901 <term><varname>$spool_directory</varname></term>
19902 <listitem>
19903 <para>
19904 <indexterm role="variable">
19905 <primary><varname>$spool_directory</varname></primary>
19906 </indexterm>
19907 The name of Exim&#x2019;s spool directory.
19908 </para>
19909 </listitem></varlistentry>
19910 <varlistentry>
19911 <term><varname>$spool_inodes</varname></term>
19912 <listitem>
19913 <para>
19914 <indexterm role="variable">
19915 <primary><varname>$spool_inodes</varname></primary>
19916 </indexterm>
19917 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19918 being written. The value is recalculated whenever the variable is referenced.
19919 If the relevant file system does not have the concept of inodes, the value of
19920 is -1. See also the <option>check_spool_inodes</option> option.
19921 </para>
19922 </listitem></varlistentry>
19923 <varlistentry>
19924 <term><varname>$spool_space</varname></term>
19925 <listitem>
19926 <para>
19927 <indexterm role="variable">
19928 <primary><varname>$spool_space</varname></primary>
19929 </indexterm>
19930 The amount of free space (as a number of kilobytes) in the disk partition where
19931 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19932 variable is referenced. If the operating system does not have the ability to
19933 find the amount of free space (only true for experimental systems), the space
19934 value is -1. For example, to check in an ACL that there is at least 50
19935 megabytes free on the spool, you could write:
19936 </para>
19937 <literallayout class="monospaced">
19938 condition = ${if &gt; {$spool_space}{50000}}
19939 </literallayout>
19940 <para>
19941 See also the <option>check_spool_space</option> option.
19942 </para>
19943 </listitem></varlistentry>
19944 <varlistentry>
19945 <term><varname>$thisaddress</varname></term>
19946 <listitem>
19947 <para>
19948 <indexterm role="variable">
19949 <primary><varname>$thisaddress</varname></primary>
19950 </indexterm>
19951 This variable is set only during the processing of the <option>foranyaddress</option>
19952 command in a filter file. Its use is explained in the description of that
19953 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19954 interfaces to mail filtering</emphasis>.
19955 </para>
19956 </listitem></varlistentry>
19957 <varlistentry>
19958 <term><varname>$tls_in_bits</varname></term>
19959 <listitem>
19960 <para>
19961 <indexterm role="variable">
19962 <primary><varname>$tls_in_bits</varname></primary>
19963 </indexterm>
19964 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19965 on the inbound connection; the meaning of
19966 this depends upon the TLS implementation used.
19967 If TLS has not been negotiated, the value will be 0.
19968 The value of this is automatically fed into the Cyrus SASL authenticator
19969 when acting as a server, to specify the "external SSF" (a SASL term).
19970 </para>
19971 <para>
19972 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19973 except when used in the context of an outbound SMTP delivery, when it refers to
19974 the outbound.
19975 </para>
19976 </listitem></varlistentry>
19977 <varlistentry>
19978 <term><varname>$tls_out_bits</varname></term>
19979 <listitem>
19980 <para>
19981 <indexterm role="variable">
19982 <primary><varname>$tls_out_bits</varname></primary>
19983 </indexterm>
19984 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19985 on an outbound SMTP connection; the meaning of
19986 this depends upon the TLS implementation used.
19987 If TLS has not been negotiated, the value will be 0.
19988 </para>
19989 </listitem></varlistentry>
19990 <varlistentry>
19991 <term><varname>$tls_in_ourcert</varname></term>
19992 <listitem>
19993 <para>
19994 <indexterm role="variable">
19995 <primary><varname>$tls_in_ourcert</varname></primary>
19996 </indexterm>
19997 <indexterm role="concept">
19998 <primary>certificate</primary>
19999 <secondary>variables</secondary>
20000 </indexterm>
20001 This variable refers to the certificate presented to the peer of an
20002 inbound connection when the message was received.
20003 It is only useful as the argument of a
20004 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20005 or a <option>def</option> condition.
20006 </para>
20007 </listitem></varlistentry>
20008 <varlistentry>
20009 <term><varname>$tls_in_peercert</varname></term>
20010 <listitem>
20011 <para>
20012 <indexterm role="variable">
20013 <primary><varname>$tls_in_peercert</varname></primary>
20014 </indexterm>
20015 This variable refers to the certificate presented by the peer of an
20016 inbound connection when the message was received.
20017 It is only useful as the argument of a
20018 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20019 or a <option>def</option> condition.
20020 If certificate verification fails it may refer to a failing chain element
20021 which is not the leaf.
20022 </para>
20023 </listitem></varlistentry>
20024 <varlistentry>
20025 <term><varname>$tls_out_ourcert</varname></term>
20026 <listitem>
20027 <para>
20028 <indexterm role="variable">
20029 <primary><varname>$tls_out_ourcert</varname></primary>
20030 </indexterm>
20031 This variable refers to the certificate presented to the peer of an
20032 outbound connection.  It is only useful as the argument of a
20033 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20034 or a <option>def</option> condition.
20035 </para>
20036 </listitem></varlistentry>
20037 <varlistentry>
20038 <term><varname>$tls_out_peercert</varname></term>
20039 <listitem>
20040 <para>
20041 <indexterm role="variable">
20042 <primary><varname>$tls_out_peercert</varname></primary>
20043 </indexterm>
20044 This variable refers to the certificate presented by the peer of an
20045 outbound connection.  It is only useful as the argument of a
20046 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20047 or a <option>def</option> condition.
20048 If certificate verification fails it may refer to a failing chain element
20049 which is not the leaf.
20050 </para>
20051 </listitem></varlistentry>
20052 <varlistentry>
20053 <term><varname>$tls_in_certificate_verified</varname></term>
20054 <listitem>
20055 <para>
20056 <indexterm role="variable">
20057 <primary><varname>$tls_in_certificate_verified</varname></primary>
20058 </indexterm>
20059 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
20060 message was received, and <quote>0</quote> otherwise.
20061 </para>
20062 <para>
20063 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
20064 except when used in the context of an outbound SMTP delivery, when it refers to
20065 the outbound.
20066 </para>
20067 </listitem></varlistentry>
20068 <varlistentry>
20069 <term><varname>$tls_out_certificate_verified</varname></term>
20070 <listitem>
20071 <para>
20072 <indexterm role="variable">
20073 <primary><varname>$tls_out_certificate_verified</varname></primary>
20074 </indexterm>
20075 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
20076 outbound SMTP connection was made,
20077 and <quote>0</quote> otherwise.
20078 </para>
20079 </listitem></varlistentry>
20080 <varlistentry>
20081 <term><varname>$tls_in_cipher</varname></term>
20082 <listitem>
20083 <para>
20084 <indexterm role="variable">
20085 <primary><varname>$tls_in_cipher</varname></primary>
20086 </indexterm>
20087 <indexterm role="variable">
20088 <primary><varname>$tls_cipher</varname></primary>
20089 </indexterm>
20090 When a message is received from a remote host over an encrypted SMTP
20091 connection, this variable is set to the cipher suite that was negotiated, for
20092 example DES-CBC3-SHA. In other circumstances, in particular, for message
20093 received over unencrypted connections, the variable is empty. Testing
20094 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
20095 non-encrypted connections during ACL processing.
20096 </para>
20097 <para>
20098 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
20099 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
20100 becomes the same as <varname>$tls_out_cipher</varname>.
20101 </para>
20102 </listitem></varlistentry>
20103 <varlistentry>
20104 <term><varname>$tls_out_cipher</varname></term>
20105 <listitem>
20106 <para>
20107 <indexterm role="variable">
20108 <primary><varname>$tls_out_cipher</varname></primary>
20109 </indexterm>
20110 This variable is
20111 cleared before any outgoing SMTP connection is made,
20112 and then set to the outgoing cipher suite if one is negotiated. See chapter
20113 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
20114 details of the <command>smtp</command> transport.
20115 </para>
20116 </listitem></varlistentry>
20117 <varlistentry>
20118 <term><varname>$tls_in_ocsp</varname></term>
20119 <listitem>
20120 <para>
20121 <indexterm role="variable">
20122 <primary><varname>$tls_in_ocsp</varname></primary>
20123 </indexterm>
20124 When a message is received from a remote client connection
20125 the result of any OCSP request from the client is encoded in this variable:
20126 </para>
20127 <literallayout class="monospaced">
20128 0 OCSP proof was not requested (default value)
20129 1 No response to request
20130 2 Response not verified
20131 3 Verification failed
20132 4 Verification succeeded
20133 </literallayout>
20134 </listitem></varlistentry>
20135 <varlistentry>
20136 <term><varname>$tls_out_ocsp</varname></term>
20137 <listitem>
20138 <para>
20139 <indexterm role="variable">
20140 <primary><varname>$tls_out_ocsp</varname></primary>
20141 </indexterm>
20142 When a message is sent to a remote host connection
20143 the result of any OCSP request made is encoded in this variable.
20144 See <varname>$tls_in_ocsp</varname> for values.
20145 </para>
20146 </listitem></varlistentry>
20147 <varlistentry>
20148 <term><varname>$tls_in_peerdn</varname></term>
20149 <listitem>
20150 <para>
20151 <indexterm role="variable">
20152 <primary><varname>$tls_in_peerdn</varname></primary>
20153 </indexterm>
20154 <indexterm role="variable">
20155 <primary><varname>$tls_peerdn</varname></primary>
20156 </indexterm>
20157 <indexterm role="concept">
20158 <primary>certificate</primary>
20159 <secondary>extracting fields</secondary>
20160 </indexterm>
20161 When a message is received from a remote host over an encrypted SMTP
20162 connection, and Exim is configured to request a certificate from the client,
20163 the value of the Distinguished Name of the certificate is made available in the
20164 <varname>$tls_in_peerdn</varname> during subsequent processing.
20165 If certificate verification fails it may refer to a failing chain element
20166 which is not the leaf.
20167 </para>
20168 <para>
20169 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
20170 except when used in the context of an outbound SMTP delivery, when it refers to
20171 the outbound.
20172 </para>
20173 </listitem></varlistentry>
20174 <varlistentry>
20175 <term><varname>$tls_out_peerdn</varname></term>
20176 <listitem>
20177 <para>
20178 <indexterm role="variable">
20179 <primary><varname>$tls_out_peerdn</varname></primary>
20180 </indexterm>
20181 When a message is being delivered to a remote host over an encrypted SMTP
20182 connection, and Exim is configured to request a certificate from the server,
20183 the value of the Distinguished Name of the certificate is made available in the
20184 <varname>$tls_out_peerdn</varname> during subsequent processing.
20185 If certificate verification fails it may refer to a failing chain element
20186 which is not the leaf.
20187 </para>
20188 </listitem></varlistentry>
20189 <varlistentry>
20190 <term><varname>$tls_in_sni</varname></term>
20191 <listitem>
20192 <para>
20193 <indexterm role="variable">
20194 <primary><varname>$tls_in_sni</varname></primary>
20195 </indexterm>
20196 <indexterm role="variable">
20197 <primary><varname>$tls_sni</varname></primary>
20198 </indexterm>
20199 <indexterm role="concept">
20200 <primary>TLS</primary>
20201 <secondary>Server Name Indication</secondary>
20202 </indexterm>
20203 When a TLS session is being established, if the client sends the Server
20204 Name Indication extension, the value will be placed in this variable.
20205 If the variable appears in <option>tls_certificate</option> then this option and
20206 some others, described in <xref linkend="SECTtlssni"/>,
20207 will be re-expanded early in the TLS session, to permit
20208 a different certificate to be presented (and optionally a different key to be
20209 used) to the client, based upon the value of the SNI extension.
20210 </para>
20211 <para>
20212 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20213 except when used in the context of an outbound SMTP delivery, when it refers to
20214 the outbound.
20215 </para>
20216 </listitem></varlistentry>
20217 <varlistentry>
20218 <term><varname>$tls_out_sni</varname></term>
20219 <listitem>
20220 <para>
20221 <indexterm role="variable">
20222 <primary><varname>$tls_out_sni</varname></primary>
20223 </indexterm>
20224 <indexterm role="concept">
20225 <primary>TLS</primary>
20226 <secondary>Server Name Indication</secondary>
20227 </indexterm>
20228 During outbound
20229 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20230 the transport.
20231 </para>
20232 </listitem></varlistentry>
20233 <varlistentry>
20234 <term><varname>$tod_bsdinbox</varname></term>
20235 <listitem>
20236 <para>
20237 <indexterm role="variable">
20238 <primary><varname>$tod_bsdinbox</varname></primary>
20239 </indexterm>
20240 The time of day and the date, in the format required for BSD-style mailbox
20241 files, for example: Thu Oct 17 17:14:09 1995.
20242 </para>
20243 </listitem></varlistentry>
20244 <varlistentry>
20245 <term><varname>$tod_epoch</varname></term>
20246 <listitem>
20247 <para>
20248 <indexterm role="variable">
20249 <primary><varname>$tod_epoch</varname></primary>
20250 </indexterm>
20251 The time and date as a number of seconds since the start of the Unix epoch.
20252 </para>
20253 </listitem></varlistentry>
20254 <varlistentry>
20255 <term><varname>$tod_epoch_l</varname></term>
20256 <listitem>
20257 <para>
20258 <indexterm role="variable">
20259 <primary><varname>$tod_epoch_l</varname></primary>
20260 </indexterm>
20261 The time and date as a number of microseconds since the start of the Unix epoch.
20262 </para>
20263 </listitem></varlistentry>
20264 <varlistentry>
20265 <term><varname>$tod_full</varname></term>
20266 <listitem>
20267 <para>
20268 <indexterm role="variable">
20269 <primary><varname>$tod_full</varname></primary>
20270 </indexterm>
20271 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20272 +0100. The timezone is always given as a numerical offset from UTC, with
20273 positive values used for timezones that are ahead (east) of UTC, and negative
20274 values for those that are behind (west).
20275 </para>
20276 </listitem></varlistentry>
20277 <varlistentry>
20278 <term><varname>$tod_log</varname></term>
20279 <listitem>
20280 <para>
20281 <indexterm role="variable">
20282 <primary><varname>$tod_log</varname></primary>
20283 </indexterm>
20284 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20285 1995-10-12 15:32:29, but without a timezone.
20286 </para>
20287 </listitem></varlistentry>
20288 <varlistentry>
20289 <term><varname>$tod_logfile</varname></term>
20290 <listitem>
20291 <para>
20292 <indexterm role="variable">
20293 <primary><varname>$tod_logfile</varname></primary>
20294 </indexterm>
20295 This variable contains the date in the format yyyymmdd. This is the format that
20296 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20297 flag.
20298 </para>
20299 </listitem></varlistentry>
20300 <varlistentry>
20301 <term><varname>$tod_zone</varname></term>
20302 <listitem>
20303 <para>
20304 <indexterm role="variable">
20305 <primary><varname>$tod_zone</varname></primary>
20306 </indexterm>
20307 This variable contains the numerical value of the local timezone, for example:
20308 -0500.
20309 </para>
20310 </listitem></varlistentry>
20311 <varlistentry>
20312 <term><varname>$tod_zulu</varname></term>
20313 <listitem>
20314 <para>
20315 <indexterm role="variable">
20316 <primary><varname>$tod_zulu</varname></primary>
20317 </indexterm>
20318 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20319 by ISO 8601, for example: 20030221154023Z.
20320 </para>
20321 </listitem></varlistentry>
20322 <varlistentry>
20323 <term><varname>$transport_name</varname></term>
20324 <listitem>
20325 <para>
20326 <indexterm role="concept">
20327 <primary>transport</primary>
20328 <secondary>name</secondary>
20329 </indexterm>
20330 <indexterm role="concept">
20331 <primary>name</primary>
20332 <secondary>of transport</secondary>
20333 </indexterm>
20334 <indexterm role="variable">
20335 <primary><varname>$transport_name</varname></primary>
20336 </indexterm>
20337 During the running of a transport, this variable contains its name.
20338 </para>
20339 </listitem></varlistentry>
20340 <varlistentry>
20341 <term><varname>$value</varname></term>
20342 <listitem>
20343 <para>
20344 <indexterm role="variable">
20345 <primary><varname>$value</varname></primary>
20346 </indexterm>
20347 This variable contains the result of an expansion lookup, extraction operation,
20348 or external command, as described above. It is also used during a
20349 <emphasis role="bold">reduce</emphasis> expansion.
20350 </para>
20351 </listitem></varlistentry>
20352 <varlistentry>
20353 <term><varname>$verify_mode</varname></term>
20354 <listitem>
20355 <para>
20356 <indexterm role="variable">
20357 <primary><varname>$verify_mode</varname></primary>
20358 </indexterm>
20359 While a router or transport is being run in verify mode or for cutthrough delivery,
20360 contains "S" for sender-verification or "R" for recipient-verification.
20361 Otherwise, empty.
20362 </para>
20363 </listitem></varlistentry>
20364 <varlistentry>
20365 <term><varname>$version_number</varname></term>
20366 <listitem>
20367 <para>
20368 <indexterm role="variable">
20369 <primary><varname>$version_number</varname></primary>
20370 </indexterm>
20371 The version number of Exim.
20372 </para>
20373 </listitem></varlistentry>
20374 <varlistentry>
20375 <term><varname>$warn_message_delay</varname></term>
20376 <listitem>
20377 <para>
20378 <indexterm role="variable">
20379 <primary><varname>$warn_message_delay</varname></primary>
20380 </indexterm>
20381 This variable is set only during the creation of a message warning about a
20382 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20383 </para>
20384 </listitem></varlistentry>
20385 <varlistentry>
20386 <term><varname>$warn_message_recipients</varname></term>
20387 <listitem>
20388 <para>
20389 <indexterm role="variable">
20390 <primary><varname>$warn_message_recipients</varname></primary>
20391 </indexterm>
20392 This variable is set only during the creation of a message warning about a
20393 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20394 </para>
20395 </listitem></varlistentry>
20396 </variablelist>
20397 <para>
20398 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20399 </para>
20400 </section>
20401 </chapter>
20402
20403 <chapter id="CHAPperl">
20404 <title>Embedded Perl</title>
20405 <para>
20406 <indexterm role="concept" id="IIDperl" class="startofrange">
20407 <primary>Perl</primary>
20408 <secondary>calling from Exim</secondary>
20409 </indexterm>
20410 Exim can be built to include an embedded Perl interpreter. When this is done,
20411 Perl subroutines can be called as part of the string expansion process. To make
20412 use of the Perl support, you need version 5.004 or later of Perl installed on
20413 your system. To include the embedded interpreter in the Exim binary, include
20414 the line
20415 </para>
20416 <literallayout class="monospaced">
20417 EXIM_PERL = perl.o
20418 </literallayout>
20419 <para>
20420 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20421 </para>
20422 <section id="SECID85">
20423 <title>Setting up so Perl can be used</title>
20424 <para>
20425 <indexterm role="option">
20426 <primary><option>perl_startup</option></primary>
20427 </indexterm>
20428 Access to Perl subroutines is via a global configuration option called
20429 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20430 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20431 interpreter is started and there is almost no overhead for Exim (since none of
20432 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20433 option then the associated value is taken to be Perl code which is executed in
20434 a newly created Perl interpreter.
20435 </para>
20436 <para>
20437 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20438 need backslashes before any characters to escape special meanings. The option
20439 should usually be something like
20440 </para>
20441 <literallayout class="monospaced">
20442 perl_startup = do '/etc/exim.pl'
20443 </literallayout>
20444 <para>
20445 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20446 use from Exim. Exim can be configured either to start up a Perl interpreter as
20447 soon as it is entered, or to wait until the first time it is needed. Starting
20448 the interpreter at the beginning ensures that it is done while Exim still has
20449 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20450 fact used in a particular run. Also, note that this does not mean that Exim is
20451 necessarily running as root when Perl is called at a later time. By default,
20452 the interpreter is started only when it is needed, but this can be changed in
20453 two ways:
20454 </para>
20455 <itemizedlist>
20456 <listitem>
20457 <para>
20458 <indexterm role="option">
20459 <primary><option>perl_at_start</option></primary>
20460 </indexterm>
20461 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
20462 a startup when Exim is entered.
20463 </para>
20464 </listitem>
20465 <listitem>
20466 <para>
20467 The command line option <option>-ps</option> also requests a startup when Exim is entered,
20468 overriding the setting of <option>perl_at_start</option>.
20469 </para>
20470 </listitem>
20471 </itemizedlist>
20472 <para>
20473 There is also a command line option <option>-pd</option> (for delay) which suppresses the
20474 initial startup, even if <option>perl_at_start</option> is set.
20475 </para>
20476 <itemizedlist>
20477 <listitem>
20478 <para>
20479 <indexterm role="option">
20480 <primary><option>perl_taintmode</option></primary>
20481 </indexterm>
20482 <indexterm role="concept">
20483 <primary>Perl</primary>
20484 <secondary>taintmode</secondary>
20485 </indexterm>
20486 To provide more security executing Perl code via the embedded Perl
20487 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
20488 taint mode of the Perl interpreter. You are encouraged to set this
20489 option to a true value. To avoid breaking existing installations, it
20490 defaults to false.
20491 </para>
20492 </listitem>
20493 </itemizedlist>
20494 </section>
20495 <section id="SECID86">
20496 <title>Calling Perl subroutines</title>
20497 <para>
20498 When the configuration file includes a <option>perl_startup</option> option you can make use
20499 of the string expansion item to call the Perl subroutines that are defined
20500 by the <option>perl_startup</option> code. The operator is used in any of the following
20501 forms:
20502 </para>
20503 <literallayout class="monospaced">
20504 ${perl{foo}}
20505 ${perl{foo}{argument}}
20506 ${perl{foo}{argument1}{argument2} ... }
20507 </literallayout>
20508 <para>
20509 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
20510 arguments may be passed. Passing more than this results in an expansion failure
20511 with an error message of the form
20512 </para>
20513 <literallayout class="monospaced">
20514 Too many arguments passed to Perl subroutine "foo" (max is 8)
20515 </literallayout>
20516 <para>
20517 The return value of the Perl subroutine is evaluated in a scalar context before
20518 it is passed back to Exim to be inserted into the expanded string. If the
20519 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
20520 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
20521 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
20522 that was passed to <option>die</option>.
20523 </para>
20524 </section>
20525 <section id="SECID87">
20526 <title>Calling Exim functions from Perl</title>
20527 <para>
20528 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
20529 is available to call back into Exim&#x2019;s string expansion function. For example,
20530 the Perl code
20531 </para>
20532 <literallayout class="monospaced">
20533 my $lp = Exim::expand_string('$local_part');
20534 </literallayout>
20535 <para>
20536 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
20537 Note those are single quotes and not double quotes to protect against
20538 <varname>$local_part</varname> being interpolated as a Perl variable.
20539 </para>
20540 <para>
20541 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
20542 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
20543 expansion string, the Perl call from the original expansion string fails with
20544 an appropriate error message, in the same way as if <option>die</option> were used.
20545 </para>
20546 <para>
20547 <indexterm role="concept">
20548 <primary>debugging</primary>
20549 <secondary>from embedded Perl</secondary>
20550 </indexterm>
20551 <indexterm role="concept">
20552 <primary>log</primary>
20553 <secondary>writing from embedded Perl</secondary>
20554 </indexterm>
20555 Two other Exim functions are available for use from within Perl code.
20556 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
20557 debugging is enabled. If you want a newline at the end, you must supply it.
20558 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20559 timestamp. In this case, you should not supply a terminating newline.
20560 </para>
20561 </section>
20562 <section id="SECID88">
20563 <title>Use of standard output and error by Perl</title>
20564 <para>
20565 <indexterm role="concept">
20566 <primary>Perl</primary>
20567 <secondary>standard output and error</secondary>
20568 </indexterm>
20569 You should not write to the standard error or output streams from within your
20570 Perl code, as it is not defined how these are set up. In versions of Exim
20571 before 4.50, it is possible for the standard output or error to refer to the
20572 SMTP connection during message reception via the daemon. Writing to this stream
20573 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20574 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20575 avoided, but the output is lost.
20576 </para>
20577 <para>
20578 <indexterm role="concept">
20579 <primary>Perl</primary>
20580 <secondary>use of <option>warn</option></secondary>
20581 </indexterm>
20582 The Perl <option>warn</option> statement writes to the standard error stream by default.
20583 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20584 you have no control. When Exim starts up the Perl interpreter, it arranges for
20585 output from the <option>warn</option> statement to be written to the Exim main log. You can
20586 change this by including appropriate Perl magic somewhere in your Perl code.
20587 For example, to discard <option>warn</option> output completely, you need this:
20588 </para>
20589 <literallayout class="monospaced">
20590 $SIG{__WARN__} = sub { };
20591 </literallayout>
20592 <para>
20593 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20594 example, the code for the subroutine is empty, so it does nothing, but you can
20595 include any Perl code that you like. The text of the <option>warn</option> message is passed
20596 as the first subroutine argument.
20597 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20598 </para>
20599 </section>
20600 </chapter>
20601
20602 <chapter id="CHAPinterfaces">
20603 <title>Starting the daemon and the use of network interfaces</title>
20604 <titleabbrev>Starting the daemon</titleabbrev>
20605 <para>
20606 <indexterm role="concept">
20607 <primary>daemon</primary>
20608 <secondary>starting</secondary>
20609 </indexterm>
20610 <indexterm role="concept">
20611 <primary>interface</primary>
20612 <secondary>listening</secondary>
20613 </indexterm>
20614 <indexterm role="concept">
20615 <primary>network interface</primary>
20616 </indexterm>
20617 <indexterm role="concept">
20618 <primary>interface</primary>
20619 <secondary>network</secondary>
20620 </indexterm>
20621 <indexterm role="concept">
20622 <primary>IP address</primary>
20623 <secondary>for listening</secondary>
20624 </indexterm>
20625 <indexterm role="concept">
20626 <primary>daemon</primary>
20627 <secondary>listening IP addresses</secondary>
20628 </indexterm>
20629 <indexterm role="concept">
20630 <primary>TCP/IP</primary>
20631 <secondary>setting listening interfaces</secondary>
20632 </indexterm>
20633 <indexterm role="concept">
20634 <primary>TCP/IP</primary>
20635 <secondary>setting listening ports</secondary>
20636 </indexterm>
20637 A host that is connected to a TCP/IP network may have one or more physical
20638 hardware network interfaces. Each of these interfaces may be configured as one
20639 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20640 works with. Each of these logical interfaces is associated with an IP address.
20641 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20642 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20643 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20644 </para>
20645 <orderedlist numeration="arabic">
20646 <listitem>
20647 <para>
20648 When a listening daemon is started, Exim needs to know which interfaces
20649 and ports to listen on.
20650 </para>
20651 </listitem>
20652 <listitem>
20653 <para>
20654 When Exim is routing an address, it needs to know which IP addresses
20655 are associated with local interfaces. This is required for the correct
20656 processing of MX lists by removing the local host and others with the
20657 same or higher priority values. Also, Exim needs to detect cases
20658 when an address is routed to an IP address that in fact belongs to the
20659 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20660 option of the smtp transport is set (as appropriate), this is treated
20661 as an error situation.
20662 </para>
20663 </listitem>
20664 <listitem>
20665 <para>
20666 When Exim connects to a remote host, it may need to know which interface to use
20667 for the outgoing connection.
20668 </para>
20669 </listitem>
20670 </orderedlist>
20671 <para>
20672 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20673 of cases. If your host has only one interface, and you want all its IP
20674 addresses to be treated in the same way, and you are using only the
20675 standard SMTP port, you should not need to take any special action. The
20676 rest of this chapter does not apply to you.
20677 </para>
20678 <para>
20679 In a more complicated situation you may want to listen only on certain
20680 interfaces, or on different ports, and for this reason there are a number of
20681 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20682 chapter describes how they operate.
20683 </para>
20684 <para>
20685 When a message is received over TCP/IP, the interface and port that were
20686 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20687 </para>
20688 <section id="SECID89">
20689 <title>Starting a listening daemon</title>
20690 <para>
20691 When a listening daemon is started (by means of the <option>-bd</option> command line
20692 option), the interfaces and ports on which it listens are controlled by the
20693 following options:
20694 </para>
20695 <itemizedlist>
20696 <listitem>
20697 <para>
20698 <option>daemon_smtp_ports</option> contains a list of default ports
20699 or service names.
20700 (For backward compatibility, this option can also be specified in the singular.)
20701 </para>
20702 </listitem>
20703 <listitem>
20704 <para>
20705 <option>local_interfaces</option> contains list of interface IP addresses on which to
20706 listen. Each item may optionally also specify a port.
20707 </para>
20708 </listitem>
20709 </itemizedlist>
20710 <para>
20711 The default list separator in both cases is a colon, but this can be changed as
20712 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20713 it is usually best to change the separator to avoid having to double all the
20714 colons. For example:
20715 </para>
20716 <literallayout class="monospaced">
20717 local_interfaces = &lt;; 127.0.0.1 ; \
20718                       192.168.23.65 ; \
20719                       ::1 ; \
20720                       3ffe:ffff:836f::fe86:a061
20721 </literallayout>
20722 <para>
20723 There are two different formats for specifying a port along with an IP address
20724 in <option>local_interfaces</option>:
20725 </para>
20726 <orderedlist numeration="arabic">
20727 <listitem>
20728 <para>
20729 The port is added onto the address with a dot separator. For example, to listen
20730 on port 1234 on two different IP addresses:
20731 </para>
20732 <literallayout class="monospaced">
20733 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20734                       3ffe:ffff:836f::fe86:a061.1234
20735 </literallayout>
20736 </listitem>
20737 <listitem>
20738 <para>
20739 The IP address is enclosed in square brackets, and the port is added
20740 with a colon separator, for example:
20741 </para>
20742 <literallayout class="monospaced">
20743 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20744                       [3ffe:ffff:836f::fe86:a061]:1234
20745 </literallayout>
20746 </listitem>
20747 </orderedlist>
20748 <para>
20749 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20750 default setting contains just one port:
20751 </para>
20752 <literallayout class="monospaced">
20753 daemon_smtp_ports = smtp
20754 </literallayout>
20755 <para>
20756 If more than one port is listed, each interface that does not have its own port
20757 specified listens on all of them. Ports that are listed in
20758 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20759 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20760 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20761 </para>
20762 </section>
20763 <section id="SECID90">
20764 <title>Special IP listening addresses</title>
20765 <para>
20766 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20767 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20768 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20769 instead of setting up separate listening sockets for each interface. The
20770 default value of <option>local_interfaces</option> is
20771 </para>
20772 <literallayout class="monospaced">
20773 local_interfaces = 0.0.0.0
20774 </literallayout>
20775 <para>
20776 when Exim is built without IPv6 support; otherwise it is:
20777 </para>
20778 <literallayout class="monospaced">
20779 local_interfaces = &lt;; ::0 ; 0.0.0.0
20780 </literallayout>
20781 <para>
20782 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20783 </para>
20784 </section>
20785 <section id="SECID91">
20786 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20787 <para>
20788 The <option>-oX</option> command line option can be used to override the values of
20789 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20790 instance. Another way of doing this would be to use macros and the <option>-D</option>
20791 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20792 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20793 exim.
20794 </para>
20795 <para>
20796 The value of <option>-oX</option> is a list of items. The default colon separator can be
20797 changed in the usual way if required. If there are any items that do not
20798 contain dots or colons (that is, are not IP addresses), the value of
20799 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20800 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20801 replaced by those items. Thus, for example,
20802 </para>
20803 <literallayout class="monospaced">
20804 -oX 1225
20805 </literallayout>
20806 <para>
20807 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20808 whereas
20809 </para>
20810 <literallayout class="monospaced">
20811 -oX 192.168.34.5.1125
20812 </literallayout>
20813 <para>
20814 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20815 (However, since <option>local_interfaces</option> now contains no items without ports, the
20816 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20817 </para>
20818 </section>
20819 <section id="SECTsupobssmt">
20820 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20821 <para>
20822 <indexterm role="concept">
20823 <primary>ssmtp protocol</primary>
20824 </indexterm>
20825 <indexterm role="concept">
20826 <primary>smtps protocol</primary>
20827 </indexterm>
20828 <indexterm role="concept">
20829 <primary>SMTP</primary>
20830 <secondary>ssmtp protocol</secondary>
20831 </indexterm>
20832 <indexterm role="concept">
20833 <primary>SMTP</primary>
20834 <secondary>smtps protocol</secondary>
20835 </indexterm>
20836 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20837 before the STARTTLS command was standardized for SMTP. Some legacy clients
20838 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20839 list of port numbers or service names,
20840 connections to those ports must use SSMTP. The most
20841 common use of this option is expected to be
20842 </para>
20843 <literallayout class="monospaced">
20844 tls_on_connect_ports = 465
20845 </literallayout>
20846 <para>
20847 because 465 is the usual port number used by the legacy clients. There is also
20848 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20849 this way when a daemon is started.
20850 </para>
20851 <para>
20852 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20853 daemon to listen on those ports. You must still specify them in
20854 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20855 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20856 connections via the daemon.)
20857 </para>
20858 </section>
20859 <section id="SECID92">
20860 <title>IPv6 address scopes</title>
20861 <para>
20862 <indexterm role="concept">
20863 <primary>IPv6</primary>
20864 <secondary>address scopes</secondary>
20865 </indexterm>
20866 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20867 can, in principle, have the same link-local IPv6 address on different
20868 interfaces. Thus, additional information is needed, over and above the IP
20869 address, to distinguish individual interfaces. A convention of using a
20870 percent sign followed by something (often the interface name) has been
20871 adopted in some cases, leading to addresses like this:
20872 </para>
20873 <literallayout class="monospaced">
20874 fe80::202:b3ff:fe03:45c1%eth0
20875 </literallayout>
20876 <para>
20877 To accommodate this usage, a percent sign followed by an arbitrary string is
20878 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20879 to convert a textual IPv6 address for actual use. This function recognizes the
20880 percent convention in operating systems that support it, and it processes the
20881 address appropriately. Unfortunately, some older libraries have problems with
20882 <function>getaddrinfo()</function>. If
20883 </para>
20884 <literallayout class="monospaced">
20885 IPV6_USE_INET_PTON=yes
20886 </literallayout>
20887 <para>
20888 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20889 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20890 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20891 function.) Of course, this means that the additional functionality of
20892 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20893 </para>
20894 </section>
20895 <section id="SECID93">
20896 <title>Disabling IPv6</title>
20897 <para>
20898 <indexterm role="concept">
20899 <primary>IPv6</primary>
20900 <secondary>disabling</secondary>
20901 </indexterm>
20902 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20903 run on a host whose kernel does not support IPv6. The binary will fall back to
20904 using IPv4, but it may waste resources looking up AAAA records, and trying to
20905 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20906 <indexterm role="option">
20907 <primary><option>disable_ipv6</option></primary>
20908 </indexterm>
20909 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20910 activities take place. AAAA records are never looked up, and any IPv6 addresses
20911 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20912 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20913 to handle IPv6 literal addresses.
20914 </para>
20915 <para>
20916 On the other hand, when IPv6 is in use, there may be times when you want to
20917 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20918 option to globally suppress the lookup of AAAA records for specified domains,
20919 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20920 IPv6 addresses in an individual router.
20921 </para>
20922 </section>
20923 <section id="SECID94">
20924 <title>Examples of starting a listening daemon</title>
20925 <para>
20926 The default case in an IPv6 environment is
20927 </para>
20928 <literallayout class="monospaced">
20929 daemon_smtp_ports = smtp
20930 local_interfaces = &lt;; ::0 ; 0.0.0.0
20931 </literallayout>
20932 <para>
20933 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20934 Either one or two sockets may be used, depending on the characteristics of
20935 the TCP/IP stack. (This is complicated and messy; for more information,
20936 read the comments in the <filename>daemon.c</filename> source file.)
20937 </para>
20938 <para>
20939 To specify listening on ports 25 and 26 on all interfaces:
20940 </para>
20941 <literallayout class="monospaced">
20942 daemon_smtp_ports = 25 : 26
20943 </literallayout>
20944 <para>
20945 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20946 </para>
20947 <literallayout class="monospaced">
20948 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20949                       0.0.0.0.25 ; 0.0.0.0.26
20950 </literallayout>
20951 <para>
20952 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20953 IPv4 loopback address only:
20954 </para>
20955 <literallayout class="monospaced">
20956 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20957 </literallayout>
20958 <para>
20959 To specify listening on the default port on specific interfaces only:
20960 </para>
20961 <literallayout class="monospaced">
20962 local_interfaces = 10.0.0.67 : 192.168.34.67
20963 </literallayout>
20964 <para>
20965 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20966 </para>
20967 </section>
20968 <section id="SECTreclocipadd">
20969 <title>Recognizing the local host</title>
20970 <para>
20971 The <option>local_interfaces</option> option is also used when Exim needs to determine
20972 whether or not an IP address refers to the local host. That is, the IP
20973 addresses of all the interfaces on which a daemon is listening are always
20974 treated as local.
20975 </para>
20976 <para>
20977 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20978 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20979 available interfaces from the operating system, and extracts the relevant
20980 (that is, IPv4 or IPv6) addresses to use for checking.
20981 </para>
20982 <para>
20983 Some systems set up large numbers of virtual interfaces in order to provide
20984 many virtual web servers. In this situation, you may want to listen for
20985 email on only a few of the available interfaces, but nevertheless treat all
20986 interfaces as local when routing. You can do this by setting
20987 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20988 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20989 used for listening. Consider this example:
20990 </para>
20991 <literallayout class="monospaced">
20992 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20993                       192.168.53.235 ; \
20994                       3ffe:2101:12:1:a00:20ff:fe86:a061
20995
20996 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20997 </literallayout>
20998 <para>
20999 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
21000 address, but all available interface addresses are treated as local when
21001 Exim is routing.
21002 </para>
21003 <para>
21004 In some environments the local host name may be in an MX list, but with an IP
21005 address that is not assigned to any local interface. In other cases it may be
21006 desirable to treat other host names as if they referred to the local host. Both
21007 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
21008 This contains host names rather than IP addresses. When a host is referenced
21009 during routing, either via an MX record or directly, it is treated as the local
21010 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
21011 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
21012 </para>
21013 </section>
21014 <section id="SECID95">
21015 <title>Delivering to a remote host</title>
21016 <para>
21017 Delivery to a remote host is handled by the smtp transport. By default, it
21018 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
21019 there is more than one) when connecting to a remote host. However, the
21020 <option>interface</option> option can be set to specify which interface is used. See the
21021 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
21022 details.
21023 </para>
21024 </section>
21025 </chapter>
21026
21027 <chapter id="CHAPmainconfig">
21028 <title>Main configuration</title>
21029 <para>
21030 <indexterm role="concept" id="IIDconfima" class="startofrange">
21031 <primary>configuration file</primary>
21032 <secondary>main section</secondary>
21033 </indexterm>
21034 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
21035 <primary>main configuration</primary>
21036 </indexterm>
21037 The first part of the run time configuration file contains three types of item:
21038 </para>
21039 <itemizedlist>
21040 <listitem>
21041 <para>
21042 Macro definitions: These lines start with an upper case letter. See section
21043 <xref linkend="SECTmacrodefs"/> for details of macro processing.
21044 </para>
21045 </listitem>
21046 <listitem>
21047 <para>
21048 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
21049 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
21050 section <xref linkend="SECTnamedlists"/>.
21051 </para>
21052 </listitem>
21053 <listitem>
21054 <para>
21055 Main configuration settings: Each setting occupies one line of the file
21056 (with possible continuations). If any setting is preceded by the word
21057 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
21058 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
21059 settings.
21060 </para>
21061 </listitem>
21062 </itemizedlist>
21063 <para>
21064 This chapter specifies all the main configuration options, along with their
21065 types and default values. For ease of finding a particular option, they appear
21066 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
21067 are now so many options, they are first listed briefly in functional groups, as
21068 an aid to finding the name of the option you are looking for. Some options are
21069 listed in more than one group.
21070 </para>
21071 <section id="SECID96">
21072 <title>Miscellaneous</title>
21073 <informaltable frame="none">
21074 <tgroup cols="2" colsep="0" rowsep="0">
21075 <colspec colwidth="196pt" align="left"/>
21076 <colspec colwidth="254pt" align="left"/>
21077 <tbody>
21078 <row>
21079 <entry><option>bi_command</option></entry>
21080 <entry>to run for <option>-bi</option> command line option</entry>
21081 </row>
21082 <row>
21083 <entry><option>debug_store</option></entry>
21084 <entry>do extra internal checks</entry>
21085 </row>
21086 <row>
21087 <entry><option>disable_ipv6</option></entry>
21088 <entry>do no IPv6 processing</entry>
21089 </row>
21090 <row>
21091 <entry><option>keep_malformed</option></entry>
21092 <entry>for broken files &ndash; should not happen</entry>
21093 </row>
21094 <row>
21095 <entry><option>localhost_number</option></entry>
21096 <entry>for unique message ids in clusters</entry>
21097 </row>
21098 <row>
21099 <entry><option>message_body_newlines</option></entry>
21100 <entry>retain newlines in <varname>$message_body</varname></entry>
21101 </row>
21102 <row>
21103 <entry><option>message_body_visible</option></entry>
21104 <entry>how much to show in <varname>$message_body</varname></entry>
21105 </row>
21106 <row>
21107 <entry><option>mua_wrapper</option></entry>
21108 <entry>run in <quote>MUA wrapper</quote> mode</entry>
21109 </row>
21110 <row>
21111 <entry><option>print_topbitchars</option></entry>
21112 <entry>top-bit characters are printing</entry>
21113 </row>
21114 <row>
21115 <entry><option>timezone</option></entry>
21116 <entry>force time zone</entry>
21117 </row>
21118 </tbody>
21119 </tgroup>
21120 </informaltable>
21121 </section>
21122 <section id="SECID97">
21123 <title>Exim parameters</title>
21124 <informaltable frame="none">
21125 <tgroup cols="2" colsep="0" rowsep="0">
21126 <colspec colwidth="196pt" align="left"/>
21127 <colspec colwidth="254pt" align="left"/>
21128 <tbody>
21129 <row>
21130 <entry><option>exim_group</option></entry>
21131 <entry>override compiled-in value</entry>
21132 </row>
21133 <row>
21134 <entry><option>exim_path</option></entry>
21135 <entry>override compiled-in value</entry>
21136 </row>
21137 <row>
21138 <entry><option>exim_user</option></entry>
21139 <entry>override compiled-in value</entry>
21140 </row>
21141 <row>
21142 <entry><option>primary_hostname</option></entry>
21143 <entry>default from <function>uname()</function></entry>
21144 </row>
21145 <row>
21146 <entry><option>split_spool_directory</option></entry>
21147 <entry>use multiple directories</entry>
21148 </row>
21149 <row>
21150 <entry><option>spool_directory</option></entry>
21151 <entry>override compiled-in value</entry>
21152 </row>
21153 </tbody>
21154 </tgroup>
21155 </informaltable>
21156 </section>
21157 <section id="SECID98">
21158 <title>Privilege controls</title>
21159 <informaltable frame="none">
21160 <tgroup cols="2" colsep="0" rowsep="0">
21161 <colspec colwidth="196pt" align="left"/>
21162 <colspec colwidth="254pt" align="left"/>
21163 <tbody>
21164 <row>
21165 <entry><option>admin_groups</option></entry>
21166 <entry>groups that are Exim admin users</entry>
21167 </row>
21168 <row>
21169 <entry><option>deliver_drop_privilege</option></entry>
21170 <entry>drop root for delivery processes</entry>
21171 </row>
21172 <row>
21173 <entry><option>local_from_check</option></entry>
21174 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
21175 </row>
21176 <row>
21177 <entry><option>local_from_prefix</option></entry>
21178 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21179 </row>
21180 <row>
21181 <entry><option>local_from_suffix</option></entry>
21182 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21183 </row>
21184 <row>
21185 <entry><option>local_sender_retain</option></entry>
21186 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
21187 </row>
21188 <row>
21189 <entry><option>never_users</option></entry>
21190 <entry>do not run deliveries as these</entry>
21191 </row>
21192 <row>
21193 <entry><option>prod_requires_admin</option></entry>
21194 <entry>forced delivery requires admin user</entry>
21195 </row>
21196 <row>
21197 <entry><option>queue_list_requires_admin</option></entry>
21198 <entry>queue listing requires admin user</entry>
21199 </row>
21200 <row>
21201 <entry><option>trusted_groups</option></entry>
21202 <entry>groups that are trusted</entry>
21203 </row>
21204 <row>
21205 <entry><option>trusted_users</option></entry>
21206 <entry>users that are trusted</entry>
21207 </row>
21208 </tbody>
21209 </tgroup>
21210 </informaltable>
21211 </section>
21212 <section id="SECID99">
21213 <title>Logging</title>
21214 <informaltable frame="none">
21215 <tgroup cols="2" colsep="0" rowsep="0">
21216 <colspec colwidth="196pt" align="left"/>
21217 <colspec colwidth="254pt" align="left"/>
21218 <tbody>
21219 <row>
21220 <entry><option>event_action</option></entry>
21221 <entry>custom logging</entry>
21222 </row>
21223 <row>
21224 <entry><option>hosts_connection_nolog</option></entry>
21225 <entry>exemption from connect logging</entry>
21226 </row>
21227 <row>
21228 <entry><option>log_file_path</option></entry>
21229 <entry>override compiled-in value</entry>
21230 </row>
21231 <row>
21232 <entry><option>log_selector</option></entry>
21233 <entry>set/unset optional logging</entry>
21234 </row>
21235 <row>
21236 <entry><option>log_timezone</option></entry>
21237 <entry>add timezone to log lines</entry>
21238 </row>
21239 <row>
21240 <entry><option>message_logs</option></entry>
21241 <entry>create per-message logs</entry>
21242 </row>
21243 <row>
21244 <entry><option>preserve_message_logs</option></entry>
21245 <entry>after message completion</entry>
21246 </row>
21247 <row>
21248 <entry><option>process_log_path</option></entry>
21249 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21250 </row>
21251 <row>
21252 <entry><option>slow_lookup_log</option></entry>
21253 <entry>control logging of slow DNS lookups</entry>
21254 </row>
21255 <row>
21256 <entry><option>syslog_duplication</option></entry>
21257 <entry>controls duplicate log lines on syslog</entry>
21258 </row>
21259 <row>
21260 <entry><option>syslog_facility</option></entry>
21261 <entry>set syslog <quote>facility</quote> field</entry>
21262 </row>
21263 <row>
21264 <entry><option>syslog_pid</option></entry>
21265 <entry>pid in syslog lines</entry>
21266 </row>
21267 <row>
21268 <entry><option>syslog_processname</option></entry>
21269 <entry>set syslog <quote>ident</quote> field</entry>
21270 </row>
21271 <row>
21272 <entry><option>syslog_timestamp</option></entry>
21273 <entry>timestamp syslog lines</entry>
21274 </row>
21275 <row>
21276 <entry><option>write_rejectlog</option></entry>
21277 <entry>control use of message log</entry>
21278 </row>
21279 </tbody>
21280 </tgroup>
21281 </informaltable>
21282 </section>
21283 <section id="SECID100">
21284 <title>Frozen messages</title>
21285 <informaltable frame="none">
21286 <tgroup cols="2" colsep="0" rowsep="0">
21287 <colspec colwidth="196pt" align="left"/>
21288 <colspec colwidth="254pt" align="left"/>
21289 <tbody>
21290 <row>
21291 <entry><option>auto_thaw</option></entry>
21292 <entry>sets time for retrying frozen messages</entry>
21293 </row>
21294 <row>
21295 <entry><option>freeze_tell</option></entry>
21296 <entry>send message when freezing</entry>
21297 </row>
21298 <row>
21299 <entry><option>move_frozen_messages</option></entry>
21300 <entry>to another directory</entry>
21301 </row>
21302 <row>
21303 <entry><option>timeout_frozen_after</option></entry>
21304 <entry>keep frozen messages only so long</entry>
21305 </row>
21306 </tbody>
21307 </tgroup>
21308 </informaltable>
21309 </section>
21310 <section id="SECID101">
21311 <title>Data lookups</title>
21312 <informaltable frame="none">
21313 <tgroup cols="2" colsep="0" rowsep="0">
21314 <colspec colwidth="196pt" align="left"/>
21315 <colspec colwidth="254pt" align="left"/>
21316 <tbody>
21317 <row>
21318 <entry><option>ibase_servers</option></entry>
21319 <entry>InterBase servers</entry>
21320 </row>
21321 <row>
21322 <entry><option>ldap_ca_cert_dir</option></entry>
21323 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21324 </row>
21325 <row>
21326 <entry><option>ldap_ca_cert_file</option></entry>
21327 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21328 </row>
21329 <row>
21330 <entry><option>ldap_cert_file</option></entry>
21331 <entry>client cert file for LDAP</entry>
21332 </row>
21333 <row>
21334 <entry><option>ldap_cert_key</option></entry>
21335 <entry>client key file for LDAP</entry>
21336 </row>
21337 <row>
21338 <entry><option>ldap_cipher_suite</option></entry>
21339 <entry>TLS negotiation preference control</entry>
21340 </row>
21341 <row>
21342 <entry><option>ldap_default_servers</option></entry>
21343 <entry>used if no server in query</entry>
21344 </row>
21345 <row>
21346 <entry><option>ldap_require_cert</option></entry>
21347 <entry>action to take without LDAP server cert</entry>
21348 </row>
21349 <row>
21350 <entry><option>ldap_start_tls</option></entry>
21351 <entry>require TLS within LDAP</entry>
21352 </row>
21353 <row>
21354 <entry><option>ldap_version</option></entry>
21355 <entry>set protocol version</entry>
21356 </row>
21357 <row>
21358 <entry><option>lookup_open_max</option></entry>
21359 <entry>lookup files held open</entry>
21360 </row>
21361 <row>
21362 <entry><option>mysql_servers</option></entry>
21363 <entry>default MySQL servers</entry>
21364 </row>
21365 <row>
21366 <entry><option>oracle_servers</option></entry>
21367 <entry>Oracle servers</entry>
21368 </row>
21369 <row>
21370 <entry><option>pgsql_servers</option></entry>
21371 <entry>default PostgreSQL servers</entry>
21372 </row>
21373 <row>
21374 <entry><option>sqlite_lock_timeout</option></entry>
21375 <entry>as it says</entry>
21376 </row>
21377 </tbody>
21378 </tgroup>
21379 </informaltable>
21380 </section>
21381 <section id="SECID102">
21382 <title>Message ids</title>
21383 <informaltable frame="none">
21384 <tgroup cols="2" colsep="0" rowsep="0">
21385 <colspec colwidth="196pt" align="left"/>
21386 <colspec colwidth="254pt" align="left"/>
21387 <tbody>
21388 <row>
21389 <entry><option>message_id_header_domain</option></entry>
21390 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21391 </row>
21392 <row>
21393 <entry><option>message_id_header_text</option></entry>
21394 <entry>ditto</entry>
21395 </row>
21396 </tbody>
21397 </tgroup>
21398 </informaltable>
21399 </section>
21400 <section id="SECID103">
21401 <title>Embedded Perl Startup</title>
21402 <informaltable frame="none">
21403 <tgroup cols="2" colsep="0" rowsep="0">
21404 <colspec colwidth="196pt" align="left"/>
21405 <colspec colwidth="254pt" align="left"/>
21406 <tbody>
21407 <row>
21408 <entry><option>perl_at_start</option></entry>
21409 <entry>always start the interpreter</entry>
21410 </row>
21411 <row>
21412 <entry><option>perl_startup</option></entry>
21413 <entry>code to obey when starting Perl</entry>
21414 </row>
21415 <row>
21416 <entry><option>perl_taintmode</option></entry>
21417 <entry>enable taint mode in Perl</entry>
21418 </row>
21419 </tbody>
21420 </tgroup>
21421 </informaltable>
21422 </section>
21423 <section id="SECID104">
21424 <title>Daemon</title>
21425 <informaltable frame="none">
21426 <tgroup cols="2" colsep="0" rowsep="0">
21427 <colspec colwidth="196pt" align="left"/>
21428 <colspec colwidth="254pt" align="left"/>
21429 <tbody>
21430 <row>
21431 <entry><option>daemon_smtp_ports</option></entry>
21432 <entry>default ports</entry>
21433 </row>
21434 <row>
21435 <entry><option>daemon_startup_retries</option></entry>
21436 <entry>number of times to retry</entry>
21437 </row>
21438 <row>
21439 <entry><option>daemon_startup_sleep</option></entry>
21440 <entry>time to sleep between tries</entry>
21441 </row>
21442 <row>
21443 <entry><option>extra_local_interfaces</option></entry>
21444 <entry>not necessarily listened on</entry>
21445 </row>
21446 <row>
21447 <entry><option>local_interfaces</option></entry>
21448 <entry>on which to listen, with optional ports</entry>
21449 </row>
21450 <row>
21451 <entry><option>pid_file_path</option></entry>
21452 <entry>override compiled-in value</entry>
21453 </row>
21454 <row>
21455 <entry><option>queue_run_max</option></entry>
21456 <entry>maximum simultaneous queue runners</entry>
21457 </row>
21458 </tbody>
21459 </tgroup>
21460 </informaltable>
21461 </section>
21462 <section id="SECID105">
21463 <title>Resource control</title>
21464 <informaltable frame="none">
21465 <tgroup cols="2" colsep="0" rowsep="0">
21466 <colspec colwidth="196pt" align="left"/>
21467 <colspec colwidth="254pt" align="left"/>
21468 <tbody>
21469 <row>
21470 <entry><option>check_log_inodes</option></entry>
21471 <entry>before accepting a message</entry>
21472 </row>
21473 <row>
21474 <entry><option>check_log_space</option></entry>
21475 <entry>before accepting a message</entry>
21476 </row>
21477 <row>
21478 <entry><option>check_spool_inodes</option></entry>
21479 <entry>before accepting a message</entry>
21480 </row>
21481 <row>
21482 <entry><option>check_spool_space</option></entry>
21483 <entry>before accepting a message</entry>
21484 </row>
21485 <row>
21486 <entry><option>deliver_queue_load_max</option></entry>
21487 <entry>no queue deliveries if load high</entry>
21488 </row>
21489 <row>
21490 <entry><option>queue_only_load</option></entry>
21491 <entry>queue incoming if load high</entry>
21492 </row>
21493 <row>
21494 <entry><option>queue_only_load_latch</option></entry>
21495 <entry>don&#x2019;t re-evaluate load for each message</entry>
21496 </row>
21497 <row>
21498 <entry><option>queue_run_max</option></entry>
21499 <entry>maximum simultaneous queue runners</entry>
21500 </row>
21501 <row>
21502 <entry><option>remote_max_parallel</option></entry>
21503 <entry>parallel SMTP delivery per message</entry>
21504 </row>
21505 <row>
21506 <entry><option>smtp_accept_max</option></entry>
21507 <entry>simultaneous incoming connections</entry>
21508 </row>
21509 <row>
21510 <entry><option>smtp_accept_max_nonmail</option></entry>
21511 <entry>non-mail commands</entry>
21512 </row>
21513 <row>
21514 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21515 <entry>hosts to which the limit applies</entry>
21516 </row>
21517 <row>
21518 <entry><option>smtp_accept_max_per_connection</option></entry>
21519 <entry>messages per connection</entry>
21520 </row>
21521 <row>
21522 <entry><option>smtp_accept_max_per_host</option></entry>
21523 <entry>connections from one host</entry>
21524 </row>
21525 <row>
21526 <entry><option>smtp_accept_queue</option></entry>
21527 <entry>queue mail if more connections</entry>
21528 </row>
21529 <row>
21530 <entry><option>smtp_accept_queue_per_connection</option></entry>
21531 <entry>queue if more messages per connection</entry>
21532 </row>
21533 <row>
21534 <entry><option>smtp_accept_reserve</option></entry>
21535 <entry>only reserve hosts if more connections</entry>
21536 </row>
21537 <row>
21538 <entry><option>smtp_check_spool_space</option></entry>
21539 <entry>from SIZE on MAIL command</entry>
21540 </row>
21541 <row>
21542 <entry><option>smtp_connect_backlog</option></entry>
21543 <entry>passed to TCP/IP stack</entry>
21544 </row>
21545 <row>
21546 <entry><option>smtp_load_reserve</option></entry>
21547 <entry>SMTP from reserved hosts if load high</entry>
21548 </row>
21549 <row>
21550 <entry><option>smtp_reserve_hosts</option></entry>
21551 <entry>these are the reserve hosts</entry>
21552 </row>
21553 </tbody>
21554 </tgroup>
21555 </informaltable>
21556 </section>
21557 <section id="SECID106">
21558 <title>Policy controls</title>
21559 <informaltable frame="none">
21560 <tgroup cols="2" colsep="0" rowsep="0">
21561 <colspec colwidth="196pt" align="left"/>
21562 <colspec colwidth="254pt" align="left"/>
21563 <tbody>
21564 <row>
21565 <entry><option>acl_not_smtp</option></entry>
21566 <entry>ACL for non-SMTP messages</entry>
21567 </row>
21568 <row>
21569 <entry><option>acl_not_smtp_mime</option></entry>
21570 <entry>ACL for non-SMTP MIME parts</entry>
21571 </row>
21572 <row>
21573 <entry><option>acl_not_smtp_start</option></entry>
21574 <entry>ACL for start of non-SMTP message</entry>
21575 </row>
21576 <row>
21577 <entry><option>acl_smtp_auth</option></entry>
21578 <entry>ACL for AUTH</entry>
21579 </row>
21580 <row>
21581 <entry><option>acl_smtp_connect</option></entry>
21582 <entry>ACL for connection</entry>
21583 </row>
21584 <row>
21585 <entry><option>acl_smtp_data</option></entry>
21586 <entry>ACL for DATA</entry>
21587 </row>
21588 <row>
21589 <entry><option>acl_smtp_data_prdr</option></entry>
21590 <entry>ACL for DATA, per-recipient</entry>
21591 </row>
21592 <row>
21593 <entry><option>acl_smtp_dkim</option></entry>
21594 <entry>ACL for DKIM verification</entry>
21595 </row>
21596 <row>
21597 <entry><option>acl_smtp_etrn</option></entry>
21598 <entry>ACL for ETRN</entry>
21599 </row>
21600 <row>
21601 <entry><option>acl_smtp_expn</option></entry>
21602 <entry>ACL for EXPN</entry>
21603 </row>
21604 <row>
21605 <entry><option>acl_smtp_helo</option></entry>
21606 <entry>ACL for EHLO or HELO</entry>
21607 </row>
21608 <row>
21609 <entry><option>acl_smtp_mail</option></entry>
21610 <entry>ACL for MAIL</entry>
21611 </row>
21612 <row>
21613 <entry><option>acl_smtp_mailauth</option></entry>
21614 <entry>ACL for AUTH on MAIL command</entry>
21615 </row>
21616 <row>
21617 <entry><option>acl_smtp_mime</option></entry>
21618 <entry>ACL for MIME parts</entry>
21619 </row>
21620 <row>
21621 <entry><option>acl_smtp_notquit</option></entry>
21622 <entry>ACL for non-QUIT terminations</entry>
21623 </row>
21624 <row>
21625 <entry><option>acl_smtp_predata</option></entry>
21626 <entry>ACL for start of data</entry>
21627 </row>
21628 <row>
21629 <entry><option>acl_smtp_quit</option></entry>
21630 <entry>ACL for QUIT</entry>
21631 </row>
21632 <row>
21633 <entry><option>acl_smtp_rcpt</option></entry>
21634 <entry>ACL for RCPT</entry>
21635 </row>
21636 <row>
21637 <entry><option>acl_smtp_starttls</option></entry>
21638 <entry>ACL for STARTTLS</entry>
21639 </row>
21640 <row>
21641 <entry><option>acl_smtp_vrfy</option></entry>
21642 <entry>ACL for VRFY</entry>
21643 </row>
21644 <row>
21645 <entry><option>av_scanner</option></entry>
21646 <entry>specify virus scanner</entry>
21647 </row>
21648 <row>
21649 <entry><option>check_rfc2047_length</option></entry>
21650 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21651 </row>
21652 <row>
21653 <entry><option>dns_csa_search_limit</option></entry>
21654 <entry>control CSA parent search depth</entry>
21655 </row>
21656 <row>
21657 <entry><option>dns_csa_use_reverse</option></entry>
21658 <entry>en/disable CSA IP reverse search</entry>
21659 </row>
21660 <row>
21661 <entry><option>header_maxsize</option></entry>
21662 <entry>total size of message header</entry>
21663 </row>
21664 <row>
21665 <entry><option>header_line_maxsize</option></entry>
21666 <entry>individual header line limit</entry>
21667 </row>
21668 <row>
21669 <entry><option>helo_accept_junk_hosts</option></entry>
21670 <entry>allow syntactic junk from these hosts</entry>
21671 </row>
21672 <row>
21673 <entry><option>helo_allow_chars</option></entry>
21674 <entry>allow illegal chars in HELO names</entry>
21675 </row>
21676 <row>
21677 <entry><option>helo_lookup_domains</option></entry>
21678 <entry>lookup hostname for these HELO names</entry>
21679 </row>
21680 <row>
21681 <entry><option>helo_try_verify_hosts</option></entry>
21682 <entry>HELO soft-checked for these hosts</entry>
21683 </row>
21684 <row>
21685 <entry><option>helo_verify_hosts</option></entry>
21686 <entry>HELO hard-checked for these hosts</entry>
21687 </row>
21688 <row>
21689 <entry><option>host_lookup</option></entry>
21690 <entry>host name looked up for these hosts</entry>
21691 </row>
21692 <row>
21693 <entry><option>host_lookup_order</option></entry>
21694 <entry>order of DNS and local name lookups</entry>
21695 </row>
21696 <row>
21697 <entry><option>hosts_proxy</option></entry>
21698 <entry>use proxy protocol for these hosts</entry>
21699 </row>
21700 <row>
21701 <entry><option>host_reject_connection</option></entry>
21702 <entry>reject connection from these hosts</entry>
21703 </row>
21704 <row>
21705 <entry><option>hosts_treat_as_local</option></entry>
21706 <entry>useful in some cluster configurations</entry>
21707 </row>
21708 <row>
21709 <entry><option>local_scan_timeout</option></entry>
21710 <entry>timeout for <function>local_scan()</function></entry>
21711 </row>
21712 <row>
21713 <entry><option>message_size_limit</option></entry>
21714 <entry>for all messages</entry>
21715 </row>
21716 <row>
21717 <entry><option>percent_hack_domains</option></entry>
21718 <entry>recognize %-hack for these domains</entry>
21719 </row>
21720 <row>
21721 <entry><option>spamd_address</option></entry>
21722 <entry>set interface to SpamAssassin</entry>
21723 </row>
21724 <row>
21725 <entry><option>strict_acl_vars</option></entry>
21726 <entry>object to unset ACL variables</entry>
21727 </row>
21728 </tbody>
21729 </tgroup>
21730 </informaltable>
21731 </section>
21732 <section id="SECID107">
21733 <title>Callout cache</title>
21734 <informaltable frame="none">
21735 <tgroup cols="2" colsep="0" rowsep="0">
21736 <colspec colwidth="196pt" align="left"/>
21737 <colspec colwidth="254pt" align="left"/>
21738 <tbody>
21739 <row>
21740 <entry><option>callout_domain_negative_expire</option></entry>
21741 <entry>timeout for negative domain cache item</entry>
21742 </row>
21743 <row>
21744 <entry><option>callout_domain_positive_expire</option></entry>
21745 <entry>timeout for positive domain cache item</entry>
21746 </row>
21747 <row>
21748 <entry><option>callout_negative_expire</option></entry>
21749 <entry>timeout for negative address cache item</entry>
21750 </row>
21751 <row>
21752 <entry><option>callout_positive_expire</option></entry>
21753 <entry>timeout for positive address cache item</entry>
21754 </row>
21755 <row>
21756 <entry><option>callout_random_local_part</option></entry>
21757 <entry>string to use for <quote>random</quote> testing</entry>
21758 </row>
21759 </tbody>
21760 </tgroup>
21761 </informaltable>
21762 </section>
21763 <section id="SECID108">
21764 <title>TLS</title>
21765 <informaltable frame="none">
21766 <tgroup cols="2" colsep="0" rowsep="0">
21767 <colspec colwidth="196pt" align="left"/>
21768 <colspec colwidth="254pt" align="left"/>
21769 <tbody>
21770 <row>
21771 <entry><option>gnutls_compat_mode</option></entry>
21772 <entry>use GnuTLS compatibility mode</entry>
21773 </row>
21774 <row>
21775 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21776 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21777 </row>
21778 <row>
21779 <entry><option>openssl_options</option></entry>
21780 <entry>adjust OpenSSL compatibility options</entry>
21781 </row>
21782 <row>
21783 <entry><option>tls_advertise_hosts</option></entry>
21784 <entry>advertise TLS to these hosts</entry>
21785 </row>
21786 <row>
21787 <entry><option>tls_certificate</option></entry>
21788 <entry>location of server certificate</entry>
21789 </row>
21790 <row>
21791 <entry><option>tls_crl</option></entry>
21792 <entry>certificate revocation list</entry>
21793 </row>
21794 <row>
21795 <entry><option>tls_dh_max_bits</option></entry>
21796 <entry>clamp D-H bit count suggestion</entry>
21797 </row>
21798 <row>
21799 <entry><option>tls_dhparam</option></entry>
21800 <entry>DH parameters for server</entry>
21801 </row>
21802 <row>
21803 <entry><option>tls_eccurve</option></entry>
21804 <entry>EC curve selection for server</entry>
21805 </row>
21806 <row>
21807 <entry><option>tls_ocsp_file</option></entry>
21808 <entry>location of server certificate status proof</entry>
21809 </row>
21810 <row>
21811 <entry><option>tls_on_connect_ports</option></entry>
21812 <entry>specify SSMTP (SMTPS) ports</entry>
21813 </row>
21814 <row>
21815 <entry><option>tls_privatekey</option></entry>
21816 <entry>location of server private key</entry>
21817 </row>
21818 <row>
21819 <entry><option>tls_remember_esmtp</option></entry>
21820 <entry>don&#x2019;t reset after starting TLS</entry>
21821 </row>
21822 <row>
21823 <entry><option>tls_require_ciphers</option></entry>
21824 <entry>specify acceptable ciphers</entry>
21825 </row>
21826 <row>
21827 <entry><option>tls_try_verify_hosts</option></entry>
21828 <entry>try to verify client certificate</entry>
21829 </row>
21830 <row>
21831 <entry><option>tls_verify_certificates</option></entry>
21832 <entry>expected client certificates</entry>
21833 </row>
21834 <row>
21835 <entry><option>tls_verify_hosts</option></entry>
21836 <entry>insist on client certificate verify</entry>
21837 </row>
21838 </tbody>
21839 </tgroup>
21840 </informaltable>
21841 </section>
21842 <section id="SECID109">
21843 <title>Local user handling</title>
21844 <informaltable frame="none">
21845 <tgroup cols="2" colsep="0" rowsep="0">
21846 <colspec colwidth="196pt" align="left"/>
21847 <colspec colwidth="254pt" align="left"/>
21848 <tbody>
21849 <row>
21850 <entry><option>finduser_retries</option></entry>
21851 <entry>useful in NIS environments</entry>
21852 </row>
21853 <row>
21854 <entry><option>gecos_name</option></entry>
21855 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21856 </row>
21857 <row>
21858 <entry><option>gecos_pattern</option></entry>
21859 <entry>ditto</entry>
21860 </row>
21861 <row>
21862 <entry><option>max_username_length</option></entry>
21863 <entry>for systems that truncate</entry>
21864 </row>
21865 <row>
21866 <entry><option>unknown_login</option></entry>
21867 <entry>used when no login name found</entry>
21868 </row>
21869 <row>
21870 <entry><option>unknown_username</option></entry>
21871 <entry>ditto</entry>
21872 </row>
21873 <row>
21874 <entry><option>uucp_from_pattern</option></entry>
21875 <entry>for recognizing <quote>From </quote> lines</entry>
21876 </row>
21877 <row>
21878 <entry><option>uucp_from_sender</option></entry>
21879 <entry>ditto</entry>
21880 </row>
21881 </tbody>
21882 </tgroup>
21883 </informaltable>
21884 </section>
21885 <section id="SECID110">
21886 <title>All incoming messages (SMTP and non-SMTP)</title>
21887 <informaltable frame="none">
21888 <tgroup cols="2" colsep="0" rowsep="0">
21889 <colspec colwidth="196pt" align="left"/>
21890 <colspec colwidth="254pt" align="left"/>
21891 <tbody>
21892 <row>
21893 <entry><option>header_maxsize</option></entry>
21894 <entry>total size of message header</entry>
21895 </row>
21896 <row>
21897 <entry><option>header_line_maxsize</option></entry>
21898 <entry>individual header line limit</entry>
21899 </row>
21900 <row>
21901 <entry><option>message_size_limit</option></entry>
21902 <entry>applies to all messages</entry>
21903 </row>
21904 <row>
21905 <entry><option>percent_hack_domains</option></entry>
21906 <entry>recognize %-hack for these domains</entry>
21907 </row>
21908 <row>
21909 <entry><option>received_header_text</option></entry>
21910 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21911 </row>
21912 <row>
21913 <entry><option>received_headers_max</option></entry>
21914 <entry>for mail loop detection</entry>
21915 </row>
21916 <row>
21917 <entry><option>recipients_max</option></entry>
21918 <entry>limit per message</entry>
21919 </row>
21920 <row>
21921 <entry><option>recipients_max_reject</option></entry>
21922 <entry>permanently reject excess recipients</entry>
21923 </row>
21924 </tbody>
21925 </tgroup>
21926 </informaltable>
21927 </section>
21928 <section id="SECID111">
21929 <title>Non-SMTP incoming messages</title>
21930 <informaltable frame="none">
21931 <tgroup cols="2" colsep="0" rowsep="0">
21932 <colspec colwidth="196pt" align="left"/>
21933 <colspec colwidth="254pt" align="left"/>
21934 <tbody>
21935 <row>
21936 <entry><option>receive_timeout</option></entry>
21937 <entry>for non-SMTP messages</entry>
21938 </row>
21939 </tbody>
21940 </tgroup>
21941 </informaltable>
21942 </section>
21943 <section id="SECID112">
21944 <title>Incoming SMTP messages</title>
21945 <para>
21946 See also the <emphasis>Policy controls</emphasis> section above.
21947 </para>
21948 <informaltable frame="none">
21949 <tgroup cols="2" colsep="0" rowsep="0">
21950 <colspec colwidth="196pt" align="left"/>
21951 <colspec colwidth="254pt" align="left"/>
21952 <tbody>
21953 <row>
21954 <entry><option>dkim_verify_signers</option></entry>
21955 <entry>DKIM domain for which DKIM ACL is run</entry>
21956 </row>
21957 <row>
21958 <entry><option>host_lookup</option></entry>
21959 <entry>host name looked up for these hosts</entry>
21960 </row>
21961 <row>
21962 <entry><option>host_lookup_order</option></entry>
21963 <entry>order of DNS and local name lookups</entry>
21964 </row>
21965 <row>
21966 <entry><option>recipient_unqualified_hosts</option></entry>
21967 <entry>may send unqualified recipients</entry>
21968 </row>
21969 <row>
21970 <entry><option>rfc1413_hosts</option></entry>
21971 <entry>make ident calls to these hosts</entry>
21972 </row>
21973 <row>
21974 <entry><option>rfc1413_query_timeout</option></entry>
21975 <entry>zero disables ident calls</entry>
21976 </row>
21977 <row>
21978 <entry><option>sender_unqualified_hosts</option></entry>
21979 <entry>may send unqualified senders</entry>
21980 </row>
21981 <row>
21982 <entry><option>smtp_accept_keepalive</option></entry>
21983 <entry>some TCP/IP magic</entry>
21984 </row>
21985 <row>
21986 <entry><option>smtp_accept_max</option></entry>
21987 <entry>simultaneous incoming connections</entry>
21988 </row>
21989 <row>
21990 <entry><option>smtp_accept_max_nonmail</option></entry>
21991 <entry>non-mail commands</entry>
21992 </row>
21993 <row>
21994 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21995 <entry>hosts to which the limit applies</entry>
21996 </row>
21997 <row>
21998 <entry><option>smtp_accept_max_per_connection</option></entry>
21999 <entry>messages per connection</entry>
22000 </row>
22001 <row>
22002 <entry><option>smtp_accept_max_per_host</option></entry>
22003 <entry>connections from one host</entry>
22004 </row>
22005 <row>
22006 <entry><option>smtp_accept_queue</option></entry>
22007 <entry>queue mail if more connections</entry>
22008 </row>
22009 <row>
22010 <entry><option>smtp_accept_queue_per_connection</option></entry>
22011 <entry>queue if more messages per connection</entry>
22012 </row>
22013 <row>
22014 <entry><option>smtp_accept_reserve</option></entry>
22015 <entry>only reserve hosts if more connections</entry>
22016 </row>
22017 <row>
22018 <entry><option>smtp_active_hostname</option></entry>
22019 <entry>host name to use in messages</entry>
22020 </row>
22021 <row>
22022 <entry><option>smtp_banner</option></entry>
22023 <entry>text for welcome banner</entry>
22024 </row>
22025 <row>
22026 <entry><option>smtp_check_spool_space</option></entry>
22027 <entry>from SIZE on MAIL command</entry>
22028 </row>
22029 <row>
22030 <entry><option>smtp_connect_backlog</option></entry>
22031 <entry>passed to TCP/IP stack</entry>
22032 </row>
22033 <row>
22034 <entry><option>smtp_enforce_sync</option></entry>
22035 <entry>of SMTP command/responses</entry>
22036 </row>
22037 <row>
22038 <entry><option>smtp_etrn_command</option></entry>
22039 <entry>what to run for ETRN</entry>
22040 </row>
22041 <row>
22042 <entry><option>smtp_etrn_serialize</option></entry>
22043 <entry>only one at once</entry>
22044 </row>
22045 <row>
22046 <entry><option>smtp_load_reserve</option></entry>
22047 <entry>only reserve hosts if this load</entry>
22048 </row>
22049 <row>
22050 <entry><option>smtp_max_unknown_commands</option></entry>
22051 <entry>before dropping connection</entry>
22052 </row>
22053 <row>
22054 <entry><option>smtp_ratelimit_hosts</option></entry>
22055 <entry>apply ratelimiting to these hosts</entry>
22056 </row>
22057 <row>
22058 <entry><option>smtp_ratelimit_mail</option></entry>
22059 <entry>ratelimit for MAIL commands</entry>
22060 </row>
22061 <row>
22062 <entry><option>smtp_ratelimit_rcpt</option></entry>
22063 <entry>ratelimit for RCPT commands</entry>
22064 </row>
22065 <row>
22066 <entry><option>smtp_receive_timeout</option></entry>
22067 <entry>per command or data line</entry>
22068 </row>
22069 <row>
22070 <entry><option>smtp_reserve_hosts</option></entry>
22071 <entry>these are the reserve hosts</entry>
22072 </row>
22073 <row>
22074 <entry><option>smtp_return_error_details</option></entry>
22075 <entry>give detail on rejections</entry>
22076 </row>
22077 </tbody>
22078 </tgroup>
22079 </informaltable>
22080 </section>
22081 <section id="SECID113">
22082 <title>SMTP extensions</title>
22083 <informaltable frame="none">
22084 <tgroup cols="2" colsep="0" rowsep="0">
22085 <colspec colwidth="196pt" align="left"/>
22086 <colspec colwidth="254pt" align="left"/>
22087 <tbody>
22088 <row>
22089 <entry><option>accept_8bitmime</option></entry>
22090 <entry>advertise 8BITMIME</entry>
22091 </row>
22092 <row>
22093 <entry><option>auth_advertise_hosts</option></entry>
22094 <entry>advertise AUTH to these hosts</entry>
22095 </row>
22096 <row>
22097 <entry><option>chunking_advertise_hosts</option></entry>
22098 <entry>advertise CHUNKING to these hosts</entry>
22099 </row>
22100 <row>
22101 <entry><option>dsn_advertise_hosts</option></entry>
22102 <entry>advertise DSN extensions to these hosts</entry>
22103 </row>
22104 <row>
22105 <entry><option>ignore_fromline_hosts</option></entry>
22106 <entry>allow <quote>From </quote> from these hosts</entry>
22107 </row>
22108 <row>
22109 <entry><option>ignore_fromline_local</option></entry>
22110 <entry>allow <quote>From </quote> from local SMTP</entry>
22111 </row>
22112 <row>
22113 <entry><option>pipelining_advertise_hosts</option></entry>
22114 <entry>advertise pipelining to these hosts</entry>
22115 </row>
22116 <row>
22117 <entry><option>prdr_enable</option></entry>
22118 <entry>advertise PRDR to all hosts</entry>
22119 </row>
22120 <row>
22121 <entry><option>smtputf8_advertise_hosts</option></entry>
22122 <entry>advertise SMTPUTF8 to these hosts</entry>
22123 </row>
22124 <row>
22125 <entry><option>tls_advertise_hosts</option></entry>
22126 <entry>advertise TLS to these hosts</entry>
22127 </row>
22128 </tbody>
22129 </tgroup>
22130 </informaltable>
22131 </section>
22132 <section id="SECID114">
22133 <title>Processing messages</title>
22134 <informaltable frame="none">
22135 <tgroup cols="2" colsep="0" rowsep="0">
22136 <colspec colwidth="196pt" align="left"/>
22137 <colspec colwidth="254pt" align="left"/>
22138 <tbody>
22139 <row>
22140 <entry><option>allow_domain_literals</option></entry>
22141 <entry>recognize domain literal syntax</entry>
22142 </row>
22143 <row>
22144 <entry><option>allow_mx_to_ip</option></entry>
22145 <entry>allow MX to point to IP address</entry>
22146 </row>
22147 <row>
22148 <entry><option>allow_utf8_domains</option></entry>
22149 <entry>in addresses</entry>
22150 </row>
22151 <row>
22152 <entry><option>check_rfc2047_length</option></entry>
22153 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22154 </row>
22155 <row>
22156 <entry><option>delivery_date_remove</option></entry>
22157 <entry>from incoming messages</entry>
22158 </row>
22159 <row>
22160 <entry><option>envelope_to_remove</option></entry>
22161 <entry>from incoming messages</entry>
22162 </row>
22163 <row>
22164 <entry><option>extract_addresses_remove_arguments</option></entry>
22165 <entry>affects <option>-t</option> processing</entry>
22166 </row>
22167 <row>
22168 <entry><option>headers_charset</option></entry>
22169 <entry>default for translations</entry>
22170 </row>
22171 <row>
22172 <entry><option>qualify_domain</option></entry>
22173 <entry>default for senders</entry>
22174 </row>
22175 <row>
22176 <entry><option>qualify_recipient</option></entry>
22177 <entry>default for recipients</entry>
22178 </row>
22179 <row>
22180 <entry><option>return_path_remove</option></entry>
22181 <entry>from incoming messages</entry>
22182 </row>
22183 <row>
22184 <entry><option>strip_excess_angle_brackets</option></entry>
22185 <entry>in addresses</entry>
22186 </row>
22187 <row>
22188 <entry><option>strip_trailing_dot</option></entry>
22189 <entry>at end of addresses</entry>
22190 </row>
22191 <row>
22192 <entry><option>untrusted_set_sender</option></entry>
22193 <entry>untrusted can set envelope sender</entry>
22194 </row>
22195 </tbody>
22196 </tgroup>
22197 </informaltable>
22198 </section>
22199 <section id="SECID115">
22200 <title>System filter</title>
22201 <informaltable frame="none">
22202 <tgroup cols="2" colsep="0" rowsep="0">
22203 <colspec colwidth="196pt" align="left"/>
22204 <colspec colwidth="254pt" align="left"/>
22205 <tbody>
22206 <row>
22207 <entry><option>system_filter</option></entry>
22208 <entry>locate system filter</entry>
22209 </row>
22210 <row>
22211 <entry><option>system_filter_directory_transport</option></entry>
22212 <entry>transport for delivery to a directory</entry>
22213 </row>
22214 <row>
22215 <entry><option>system_filter_file_transport</option></entry>
22216 <entry>transport for delivery to a file</entry>
22217 </row>
22218 <row>
22219 <entry><option>system_filter_group</option></entry>
22220 <entry>group for filter running</entry>
22221 </row>
22222 <row>
22223 <entry><option>system_filter_pipe_transport</option></entry>
22224 <entry>transport for delivery to a pipe</entry>
22225 </row>
22226 <row>
22227 <entry><option>system_filter_reply_transport</option></entry>
22228 <entry>transport for autoreply delivery</entry>
22229 </row>
22230 <row>
22231 <entry><option>system_filter_user</option></entry>
22232 <entry>user for filter running</entry>
22233 </row>
22234 </tbody>
22235 </tgroup>
22236 </informaltable>
22237 </section>
22238 <section id="SECID116">
22239 <title>Routing and delivery</title>
22240 <informaltable frame="none">
22241 <tgroup cols="2" colsep="0" rowsep="0">
22242 <colspec colwidth="196pt" align="left"/>
22243 <colspec colwidth="254pt" align="left"/>
22244 <tbody>
22245 <row>
22246 <entry><option>disable_ipv6</option></entry>
22247 <entry>do no IPv6 processing</entry>
22248 </row>
22249 <row>
22250 <entry><option>dns_again_means_nonexist</option></entry>
22251 <entry>for broken domains</entry>
22252 </row>
22253 <row>
22254 <entry><option>dns_check_names_pattern</option></entry>
22255 <entry>pre-DNS syntax check</entry>
22256 </row>
22257 <row>
22258 <entry><option>dns_dnssec_ok</option></entry>
22259 <entry>parameter for resolver</entry>
22260 </row>
22261 <row>
22262 <entry><option>dns_ipv4_lookup</option></entry>
22263 <entry>only v4 lookup for these domains</entry>
22264 </row>
22265 <row>
22266 <entry><option>dns_retrans</option></entry>
22267 <entry>parameter for resolver</entry>
22268 </row>
22269 <row>
22270 <entry><option>dns_retry</option></entry>
22271 <entry>parameter for resolver</entry>
22272 </row>
22273 <row>
22274 <entry><option>dns_trust_aa</option></entry>
22275 <entry>DNS zones trusted as authentic</entry>
22276 </row>
22277 <row>
22278 <entry><option>dns_use_edns0</option></entry>
22279 <entry>parameter for resolver</entry>
22280 </row>
22281 <row>
22282 <entry><option>hold_domains</option></entry>
22283 <entry>hold delivery for these domains</entry>
22284 </row>
22285 <row>
22286 <entry><option>local_interfaces</option></entry>
22287 <entry>for routing checks</entry>
22288 </row>
22289 <row>
22290 <entry><option>queue_domains</option></entry>
22291 <entry>no immediate delivery for these</entry>
22292 </row>
22293 <row>
22294 <entry><option>queue_only</option></entry>
22295 <entry>no immediate delivery at all</entry>
22296 </row>
22297 <row>
22298 <entry><option>queue_only_file</option></entry>
22299 <entry>no immediate delivery if file exists</entry>
22300 </row>
22301 <row>
22302 <entry><option>queue_only_load</option></entry>
22303 <entry>no immediate delivery if load is high</entry>
22304 </row>
22305 <row>
22306 <entry><option>queue_only_load_latch</option></entry>
22307 <entry>don&#x2019;t re-evaluate load for each message</entry>
22308 </row>
22309 <row>
22310 <entry><option>queue_only_override</option></entry>
22311 <entry>allow command line to override</entry>
22312 </row>
22313 <row>
22314 <entry><option>queue_run_in_order</option></entry>
22315 <entry>order of arrival</entry>
22316 </row>
22317 <row>
22318 <entry><option>queue_run_max</option></entry>
22319 <entry>of simultaneous queue runners</entry>
22320 </row>
22321 <row>
22322 <entry><option>queue_smtp_domains</option></entry>
22323 <entry>no immediate SMTP delivery for these</entry>
22324 </row>
22325 <row>
22326 <entry><option>remote_max_parallel</option></entry>
22327 <entry>parallel SMTP delivery per message</entry>
22328 </row>
22329 <row>
22330 <entry><option>remote_sort_domains</option></entry>
22331 <entry>order of remote deliveries</entry>
22332 </row>
22333 <row>
22334 <entry><option>retry_data_expire</option></entry>
22335 <entry>timeout for retry data</entry>
22336 </row>
22337 <row>
22338 <entry><option>retry_interval_max</option></entry>
22339 <entry>safety net for retry rules</entry>
22340 </row>
22341 </tbody>
22342 </tgroup>
22343 </informaltable>
22344 </section>
22345 <section id="SECID117">
22346 <title>Bounce and warning messages</title>
22347 <informaltable frame="none">
22348 <tgroup cols="2" colsep="0" rowsep="0">
22349 <colspec colwidth="196pt" align="left"/>
22350 <colspec colwidth="254pt" align="left"/>
22351 <tbody>
22352 <row>
22353 <entry><option>bounce_message_file</option></entry>
22354 <entry>content of bounce</entry>
22355 </row>
22356 <row>
22357 <entry><option>bounce_message_text</option></entry>
22358 <entry>content of bounce</entry>
22359 </row>
22360 <row>
22361 <entry><option>bounce_return_body</option></entry>
22362 <entry>include body if returning message</entry>
22363 </row>
22364 <row>
22365 <entry><option>bounce_return_linesize_limit</option></entry>
22366 <entry>limit on returned message line length</entry>
22367 </row>
22368 <row>
22369 <entry><option>bounce_return_message</option></entry>
22370 <entry>include original message in bounce</entry>
22371 </row>
22372 <row>
22373 <entry><option>bounce_return_size_limit</option></entry>
22374 <entry>limit on returned message</entry>
22375 </row>
22376 <row>
22377 <entry><option>bounce_sender_authentication</option></entry>
22378 <entry>send authenticated sender with bounce</entry>
22379 </row>
22380 <row>
22381 <entry><option>dsn_from</option></entry>
22382 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22383 </row>
22384 <row>
22385 <entry><option>errors_copy</option></entry>
22386 <entry>copy bounce messages</entry>
22387 </row>
22388 <row>
22389 <entry><option>errors_reply_to</option></entry>
22390 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22391 </row>
22392 <row>
22393 <entry><option>delay_warning</option></entry>
22394 <entry>time schedule</entry>
22395 </row>
22396 <row>
22397 <entry><option>delay_warning_condition</option></entry>
22398 <entry>condition for warning messages</entry>
22399 </row>
22400 <row>
22401 <entry><option>ignore_bounce_errors_after</option></entry>
22402 <entry>discard undeliverable bounces</entry>
22403 </row>
22404 <row>
22405 <entry><option>smtp_return_error_details</option></entry>
22406 <entry>give detail on rejections</entry>
22407 </row>
22408 <row>
22409 <entry><option>warn_message_file</option></entry>
22410 <entry>content of warning message</entry>
22411 </row>
22412 </tbody>
22413 </tgroup>
22414 </informaltable>
22415 </section>
22416 <section id="SECTalomo">
22417 <title>Alphabetical list of main options</title>
22418 <para>
22419 Those options that undergo string expansion before use are marked with
22420 &dagger;.
22421 </para>
22422 <para>
22423 <indexterm role="option">
22424 <primary><option>accept_8bitmime</option></primary>
22425 </indexterm>
22426 </para>
22427 <informaltable frame="all">
22428 <tgroup cols="4" colsep="0" rowsep="0">
22429 <colspec colwidth="8*" align="left"/>
22430 <colspec colwidth="6*" align="center"/>
22431 <colspec colwidth="6*" align="center"/>
22432 <colspec colwidth="6*" align="right"/>
22433 <tbody>
22434 <row>
22435 <entry><option>accept_8bitmime</option></entry>
22436 <entry>Use: <emphasis>main</emphasis></entry>
22437 <entry>Type: <emphasis>boolean</emphasis></entry>
22438 <entry>Default: <emphasis>true</emphasis></entry>
22439 </row>
22440 </tbody>
22441 </tgroup>
22442 </informaltable>
22443 <para>
22444 <indexterm role="concept">
22445 <primary>8BITMIME</primary>
22446 </indexterm>
22447 <indexterm role="concept">
22448 <primary>8-bit characters</primary>
22449 </indexterm>
22450 <indexterm role="concept">
22451 <primary>log</primary>
22452 <secondary>selectors</secondary>
22453 </indexterm>
22454 <indexterm role="concept">
22455 <primary>log</primary>
22456 <secondary>8BITMIME</secondary>
22457 </indexterm>
22458 This option causes Exim to send 8BITMIME in its response to an SMTP
22459 EHLO command, and to accept the BODY= parameter on MAIL commands.
22460 However, though Exim is 8-bit clean, it is not a protocol converter, and it
22461 takes no steps to do anything special with messages received by this route.
22462 </para>
22463 <para>
22464 Historically Exim kept this option off by default, but the maintainers
22465 feel that in today&#x2019;s Internet, this causes more problems than it solves.
22466 It now defaults to true.
22467 A more detailed analysis of the issues is provided by Dan Bernstein:
22468 </para>
22469 <literallayout>
22470 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
22471 </literallayout>
22472 <para>
22473 To log received 8BITMIME status use
22474 </para>
22475 <literallayout class="monospaced">
22476 log_selector = +8bitmime
22477 </literallayout>
22478 <para>
22479 <indexterm role="option">
22480 <primary><option>acl_not_smtp</option></primary>
22481 </indexterm>
22482 </para>
22483 <informaltable frame="all">
22484 <tgroup cols="4" colsep="0" rowsep="0">
22485 <colspec colwidth="8*" align="left"/>
22486 <colspec colwidth="6*" align="center"/>
22487 <colspec colwidth="6*" align="center"/>
22488 <colspec colwidth="6*" align="right"/>
22489 <tbody>
22490 <row>
22491 <entry><option>acl_not_smtp</option></entry>
22492 <entry>Use: <emphasis>main</emphasis></entry>
22493 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22494 <entry>Default: <emphasis>unset</emphasis></entry>
22495 </row>
22496 </tbody>
22497 </tgroup>
22498 </informaltable>
22499 <para>
22500 <indexterm role="concept">
22501 <primary>access control lists (ACLs)</primary>
22502 <secondary>for non-SMTP messages</secondary>
22503 </indexterm>
22504 <indexterm role="concept">
22505 <primary>non-SMTP messages</primary>
22506 <secondary>ACLs for</secondary>
22507 </indexterm>
22508 This option defines the ACL that is run when a non-SMTP message has been
22509 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
22510 further details.
22511 </para>
22512 <para>
22513 <indexterm role="option">
22514 <primary><option>acl_not_smtp_mime</option></primary>
22515 </indexterm>
22516 </para>
22517 <informaltable frame="all">
22518 <tgroup cols="4" colsep="0" rowsep="0">
22519 <colspec colwidth="8*" align="left"/>
22520 <colspec colwidth="6*" align="center"/>
22521 <colspec colwidth="6*" align="center"/>
22522 <colspec colwidth="6*" align="right"/>
22523 <tbody>
22524 <row>
22525 <entry><option>acl_not_smtp_mime</option></entry>
22526 <entry>Use: <emphasis>main</emphasis></entry>
22527 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22528 <entry>Default: <emphasis>unset</emphasis></entry>
22529 </row>
22530 </tbody>
22531 </tgroup>
22532 </informaltable>
22533 <para>
22534 This option defines the ACL that is run for individual MIME parts of non-SMTP
22535 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
22536 SMTP messages.
22537 </para>
22538 <para>
22539 <indexterm role="option">
22540 <primary><option>acl_not_smtp_start</option></primary>
22541 </indexterm>
22542 </para>
22543 <informaltable frame="all">
22544 <tgroup cols="4" colsep="0" rowsep="0">
22545 <colspec colwidth="8*" align="left"/>
22546 <colspec colwidth="6*" align="center"/>
22547 <colspec colwidth="6*" align="center"/>
22548 <colspec colwidth="6*" align="right"/>
22549 <tbody>
22550 <row>
22551 <entry><option>acl_not_smtp_start</option></entry>
22552 <entry>Use: <emphasis>main</emphasis></entry>
22553 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22554 <entry>Default: <emphasis>unset</emphasis></entry>
22555 </row>
22556 </tbody>
22557 </tgroup>
22558 </informaltable>
22559 <para>
22560 <indexterm role="concept">
22561 <primary>access control lists (ACLs)</primary>
22562 <secondary>at start of non-SMTP message</secondary>
22563 </indexterm>
22564 <indexterm role="concept">
22565 <primary>non-SMTP messages</primary>
22566 <secondary>ACLs for</secondary>
22567 </indexterm>
22568 This option defines the ACL that is run before Exim starts reading a
22569 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
22570 </para>
22571 <para>
22572 <indexterm role="option">
22573 <primary><option>acl_smtp_auth</option></primary>
22574 </indexterm>
22575 </para>
22576 <informaltable frame="all">
22577 <tgroup cols="4" colsep="0" rowsep="0">
22578 <colspec colwidth="8*" align="left"/>
22579 <colspec colwidth="6*" align="center"/>
22580 <colspec colwidth="6*" align="center"/>
22581 <colspec colwidth="6*" align="right"/>
22582 <tbody>
22583 <row>
22584 <entry><option>acl_smtp_auth</option></entry>
22585 <entry>Use: <emphasis>main</emphasis></entry>
22586 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22587 <entry>Default: <emphasis>unset</emphasis></entry>
22588 </row>
22589 </tbody>
22590 </tgroup>
22591 </informaltable>
22592 <para>
22593 <indexterm role="concept">
22594 <primary>access control lists (ACLs)</primary>
22595 <secondary>setting up for SMTP commands</secondary>
22596 </indexterm>
22597 <indexterm role="concept">
22598 <primary>AUTH</primary>
22599 <secondary>ACL for</secondary>
22600 </indexterm>
22601 This option defines the ACL that is run when an SMTP AUTH command is
22602 received. See chapter <xref linkend="CHAPACL"/> for further details.
22603 </para>
22604 <para>
22605 <indexterm role="option">
22606 <primary><option>acl_smtp_connect</option></primary>
22607 </indexterm>
22608 </para>
22609 <informaltable frame="all">
22610 <tgroup cols="4" colsep="0" rowsep="0">
22611 <colspec colwidth="8*" align="left"/>
22612 <colspec colwidth="6*" align="center"/>
22613 <colspec colwidth="6*" align="center"/>
22614 <colspec colwidth="6*" align="right"/>
22615 <tbody>
22616 <row>
22617 <entry><option>acl_smtp_connect</option></entry>
22618 <entry>Use: <emphasis>main</emphasis></entry>
22619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22620 <entry>Default: <emphasis>unset</emphasis></entry>
22621 </row>
22622 </tbody>
22623 </tgroup>
22624 </informaltable>
22625 <para>
22626 <indexterm role="concept">
22627 <primary>access control lists (ACLs)</primary>
22628 <secondary>on SMTP connection</secondary>
22629 </indexterm>
22630 This option defines the ACL that is run when an SMTP connection is received.
22631 See chapter <xref linkend="CHAPACL"/> for further details.
22632 </para>
22633 <para>
22634 <indexterm role="option">
22635 <primary><option>acl_smtp_data</option></primary>
22636 </indexterm>
22637 </para>
22638 <informaltable frame="all">
22639 <tgroup cols="4" colsep="0" rowsep="0">
22640 <colspec colwidth="8*" align="left"/>
22641 <colspec colwidth="6*" align="center"/>
22642 <colspec colwidth="6*" align="center"/>
22643 <colspec colwidth="6*" align="right"/>
22644 <tbody>
22645 <row>
22646 <entry><option>acl_smtp_data</option></entry>
22647 <entry>Use: <emphasis>main</emphasis></entry>
22648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22649 <entry>Default: <emphasis>unset</emphasis></entry>
22650 </row>
22651 </tbody>
22652 </tgroup>
22653 </informaltable>
22654 <para>
22655 <indexterm role="concept">
22656 <primary>DATA</primary>
22657 <secondary>ACL for</secondary>
22658 </indexterm>
22659 This option defines the ACL that is run after an SMTP DATA command has been
22660 processed and the message itself has been received, but before the final
22661 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22662 </para>
22663 <para>
22664 <indexterm role="option">
22665 <primary><option>acl_smtp_data_prdr</option></primary>
22666 </indexterm>
22667 </para>
22668 <informaltable frame="all">
22669 <tgroup cols="4" colsep="0" rowsep="0">
22670 <colspec colwidth="8*" align="left"/>
22671 <colspec colwidth="6*" align="center"/>
22672 <colspec colwidth="6*" align="center"/>
22673 <colspec colwidth="6*" align="right"/>
22674 <tbody>
22675 <row>
22676 <entry><option>acl_smtp_data_prdr</option></entry>
22677 <entry>Use: <emphasis>main</emphasis></entry>
22678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22679 <entry>Default: <emphasis>accept</emphasis></entry>
22680 </row>
22681 </tbody>
22682 </tgroup>
22683 </informaltable>
22684 <para>
22685 <indexterm role="concept">
22686 <primary>PRDR</primary>
22687 <secondary>ACL for</secondary>
22688 </indexterm>
22689 <indexterm role="concept">
22690 <primary>DATA</primary>
22691 <secondary>PRDR ACL for</secondary>
22692 </indexterm>
22693 <indexterm role="concept">
22694 <primary>access control lists (ACLs)</primary>
22695 <secondary>PRDR-related</secondary>
22696 </indexterm>
22697 <indexterm role="concept">
22698 <primary>access control lists (ACLs)</primary>
22699 <secondary>per-user data processing</secondary>
22700 </indexterm>
22701 This option defines the ACL that,
22702 if the PRDR feature has been negotiated,
22703 is run for each recipient after an SMTP DATA command has been
22704 processed and the message itself has been received, but before the
22705 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22706 </para>
22707 <para>
22708 <indexterm role="option">
22709 <primary><option>acl_smtp_dkim</option></primary>
22710 </indexterm>
22711 </para>
22712 <informaltable frame="all">
22713 <tgroup cols="4" colsep="0" rowsep="0">
22714 <colspec colwidth="8*" align="left"/>
22715 <colspec colwidth="6*" align="center"/>
22716 <colspec colwidth="6*" align="center"/>
22717 <colspec colwidth="6*" align="right"/>
22718 <tbody>
22719 <row>
22720 <entry><option>acl_smtp_dkim</option></entry>
22721 <entry>Use: <emphasis>main</emphasis></entry>
22722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22723 <entry>Default: <emphasis>unset</emphasis></entry>
22724 </row>
22725 </tbody>
22726 </tgroup>
22727 </informaltable>
22728 <para>
22729 <indexterm role="concept">
22730 <primary>DKIM</primary>
22731 <secondary>ACL for</secondary>
22732 </indexterm>
22733 This option defines the ACL that is run for each DKIM signature
22734 (by default, or as specified in the dkim_verify_signers option)
22735 of a received message.
22736 See chapter <xref linkend="CHAPdkim"/> for further details.
22737 </para>
22738 <para>
22739 <indexterm role="option">
22740 <primary><option>acl_smtp_etrn</option></primary>
22741 </indexterm>
22742 </para>
22743 <informaltable frame="all">
22744 <tgroup cols="4" colsep="0" rowsep="0">
22745 <colspec colwidth="8*" align="left"/>
22746 <colspec colwidth="6*" align="center"/>
22747 <colspec colwidth="6*" align="center"/>
22748 <colspec colwidth="6*" align="right"/>
22749 <tbody>
22750 <row>
22751 <entry><option>acl_smtp_etrn</option></entry>
22752 <entry>Use: <emphasis>main</emphasis></entry>
22753 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22754 <entry>Default: <emphasis>unset</emphasis></entry>
22755 </row>
22756 </tbody>
22757 </tgroup>
22758 </informaltable>
22759 <para>
22760 <indexterm role="concept">
22761 <primary>ETRN</primary>
22762 <secondary>ACL for</secondary>
22763 </indexterm>
22764 This option defines the ACL that is run when an SMTP ETRN command is
22765 received. See chapter <xref linkend="CHAPACL"/> for further details.
22766 </para>
22767 <para>
22768 <indexterm role="option">
22769 <primary><option>acl_smtp_expn</option></primary>
22770 </indexterm>
22771 </para>
22772 <informaltable frame="all">
22773 <tgroup cols="4" colsep="0" rowsep="0">
22774 <colspec colwidth="8*" align="left"/>
22775 <colspec colwidth="6*" align="center"/>
22776 <colspec colwidth="6*" align="center"/>
22777 <colspec colwidth="6*" align="right"/>
22778 <tbody>
22779 <row>
22780 <entry><option>acl_smtp_expn</option></entry>
22781 <entry>Use: <emphasis>main</emphasis></entry>
22782 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22783 <entry>Default: <emphasis>unset</emphasis></entry>
22784 </row>
22785 </tbody>
22786 </tgroup>
22787 </informaltable>
22788 <para>
22789 <indexterm role="concept">
22790 <primary>EXPN</primary>
22791 <secondary>ACL for</secondary>
22792 </indexterm>
22793 This option defines the ACL that is run when an SMTP EXPN command is
22794 received. See chapter <xref linkend="CHAPACL"/> for further details.
22795 </para>
22796 <para>
22797 <indexterm role="option">
22798 <primary><option>acl_smtp_helo</option></primary>
22799 </indexterm>
22800 </para>
22801 <informaltable frame="all">
22802 <tgroup cols="4" colsep="0" rowsep="0">
22803 <colspec colwidth="8*" align="left"/>
22804 <colspec colwidth="6*" align="center"/>
22805 <colspec colwidth="6*" align="center"/>
22806 <colspec colwidth="6*" align="right"/>
22807 <tbody>
22808 <row>
22809 <entry><option>acl_smtp_helo</option></entry>
22810 <entry>Use: <emphasis>main</emphasis></entry>
22811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22812 <entry>Default: <emphasis>unset</emphasis></entry>
22813 </row>
22814 </tbody>
22815 </tgroup>
22816 </informaltable>
22817 <para>
22818 <indexterm role="concept">
22819 <primary>EHLO</primary>
22820 <secondary>ACL for</secondary>
22821 </indexterm>
22822 <indexterm role="concept">
22823 <primary>HELO</primary>
22824 <secondary>ACL for</secondary>
22825 </indexterm>
22826 This option defines the ACL that is run when an SMTP EHLO or HELO
22827 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22828 </para>
22829 <para>
22830 <indexterm role="option">
22831 <primary><option>acl_smtp_mail</option></primary>
22832 </indexterm>
22833 </para>
22834 <informaltable frame="all">
22835 <tgroup cols="4" colsep="0" rowsep="0">
22836 <colspec colwidth="8*" align="left"/>
22837 <colspec colwidth="6*" align="center"/>
22838 <colspec colwidth="6*" align="center"/>
22839 <colspec colwidth="6*" align="right"/>
22840 <tbody>
22841 <row>
22842 <entry><option>acl_smtp_mail</option></entry>
22843 <entry>Use: <emphasis>main</emphasis></entry>
22844 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22845 <entry>Default: <emphasis>unset</emphasis></entry>
22846 </row>
22847 </tbody>
22848 </tgroup>
22849 </informaltable>
22850 <para>
22851 <indexterm role="concept">
22852 <primary>MAIL</primary>
22853 <secondary>ACL for</secondary>
22854 </indexterm>
22855 This option defines the ACL that is run when an SMTP MAIL command is
22856 received. See chapter <xref linkend="CHAPACL"/> for further details.
22857 </para>
22858 <para>
22859 <indexterm role="option">
22860 <primary><option>acl_smtp_mailauth</option></primary>
22861 </indexterm>
22862 </para>
22863 <informaltable frame="all">
22864 <tgroup cols="4" colsep="0" rowsep="0">
22865 <colspec colwidth="8*" align="left"/>
22866 <colspec colwidth="6*" align="center"/>
22867 <colspec colwidth="6*" align="center"/>
22868 <colspec colwidth="6*" align="right"/>
22869 <tbody>
22870 <row>
22871 <entry><option>acl_smtp_mailauth</option></entry>
22872 <entry>Use: <emphasis>main</emphasis></entry>
22873 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22874 <entry>Default: <emphasis>unset</emphasis></entry>
22875 </row>
22876 </tbody>
22877 </tgroup>
22878 </informaltable>
22879 <para>
22880 <indexterm role="concept">
22881 <primary>AUTH</primary>
22882 <secondary>on MAIL command</secondary>
22883 </indexterm>
22884 This option defines the ACL that is run when there is an AUTH parameter on
22885 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22886 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22887 </para>
22888 <para>
22889 <indexterm role="option">
22890 <primary><option>acl_smtp_mime</option></primary>
22891 </indexterm>
22892 </para>
22893 <informaltable frame="all">
22894 <tgroup cols="4" colsep="0" rowsep="0">
22895 <colspec colwidth="8*" align="left"/>
22896 <colspec colwidth="6*" align="center"/>
22897 <colspec colwidth="6*" align="center"/>
22898 <colspec colwidth="6*" align="right"/>
22899 <tbody>
22900 <row>
22901 <entry><option>acl_smtp_mime</option></entry>
22902 <entry>Use: <emphasis>main</emphasis></entry>
22903 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22904 <entry>Default: <emphasis>unset</emphasis></entry>
22905 </row>
22906 </tbody>
22907 </tgroup>
22908 </informaltable>
22909 <para>
22910 <indexterm role="concept">
22911 <primary>MIME content scanning</primary>
22912 <secondary>ACL for</secondary>
22913 </indexterm>
22914 This option is available when Exim is built with the content-scanning
22915 extension. It defines the ACL that is run for each MIME part in a message. See
22916 section <xref linkend="SECTscanmimepart"/> for details.
22917 </para>
22918 <para>
22919 <indexterm role="option">
22920 <primary><option>acl_smtp_notquit</option></primary>
22921 </indexterm>
22922 </para>
22923 <informaltable frame="all">
22924 <tgroup cols="4" colsep="0" rowsep="0">
22925 <colspec colwidth="8*" align="left"/>
22926 <colspec colwidth="6*" align="center"/>
22927 <colspec colwidth="6*" align="center"/>
22928 <colspec colwidth="6*" align="right"/>
22929 <tbody>
22930 <row>
22931 <entry><option>acl_smtp_notquit</option></entry>
22932 <entry>Use: <emphasis>main</emphasis></entry>
22933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22934 <entry>Default: <emphasis>unset</emphasis></entry>
22935 </row>
22936 </tbody>
22937 </tgroup>
22938 </informaltable>
22939 <para>
22940 <indexterm role="concept">
22941 <primary>not-QUIT, ACL for</primary>
22942 </indexterm>
22943 This option defines the ACL that is run when an SMTP session
22944 ends without a QUIT command being received.
22945 See chapter <xref linkend="CHAPACL"/> for further details.
22946 </para>
22947 <para>
22948 <indexterm role="option">
22949 <primary><option>acl_smtp_predata</option></primary>
22950 </indexterm>
22951 </para>
22952 <informaltable frame="all">
22953 <tgroup cols="4" colsep="0" rowsep="0">
22954 <colspec colwidth="8*" align="left"/>
22955 <colspec colwidth="6*" align="center"/>
22956 <colspec colwidth="6*" align="center"/>
22957 <colspec colwidth="6*" align="right"/>
22958 <tbody>
22959 <row>
22960 <entry><option>acl_smtp_predata</option></entry>
22961 <entry>Use: <emphasis>main</emphasis></entry>
22962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22963 <entry>Default: <emphasis>unset</emphasis></entry>
22964 </row>
22965 </tbody>
22966 </tgroup>
22967 </informaltable>
22968 <para>
22969 This option defines the ACL that is run when an SMTP DATA command is
22970 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22971 further details.
22972 </para>
22973 <para>
22974 <indexterm role="option">
22975 <primary><option>acl_smtp_quit</option></primary>
22976 </indexterm>
22977 </para>
22978 <informaltable frame="all">
22979 <tgroup cols="4" colsep="0" rowsep="0">
22980 <colspec colwidth="8*" align="left"/>
22981 <colspec colwidth="6*" align="center"/>
22982 <colspec colwidth="6*" align="center"/>
22983 <colspec colwidth="6*" align="right"/>
22984 <tbody>
22985 <row>
22986 <entry><option>acl_smtp_quit</option></entry>
22987 <entry>Use: <emphasis>main</emphasis></entry>
22988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22989 <entry>Default: <emphasis>unset</emphasis></entry>
22990 </row>
22991 </tbody>
22992 </tgroup>
22993 </informaltable>
22994 <para>
22995 <indexterm role="concept">
22996 <primary>QUIT, ACL for</primary>
22997 </indexterm>
22998 This option defines the ACL that is run when an SMTP QUIT command is
22999 received. See chapter <xref linkend="CHAPACL"/> for further details.
23000 </para>
23001 <para>
23002 <indexterm role="option">
23003 <primary><option>acl_smtp_rcpt</option></primary>
23004 </indexterm>
23005 </para>
23006 <informaltable frame="all">
23007 <tgroup cols="4" colsep="0" rowsep="0">
23008 <colspec colwidth="8*" align="left"/>
23009 <colspec colwidth="6*" align="center"/>
23010 <colspec colwidth="6*" align="center"/>
23011 <colspec colwidth="6*" align="right"/>
23012 <tbody>
23013 <row>
23014 <entry><option>acl_smtp_rcpt</option></entry>
23015 <entry>Use: <emphasis>main</emphasis></entry>
23016 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23017 <entry>Default: <emphasis>unset</emphasis></entry>
23018 </row>
23019 </tbody>
23020 </tgroup>
23021 </informaltable>
23022 <para>
23023 <indexterm role="concept">
23024 <primary>RCPT</primary>
23025 <secondary>ACL for</secondary>
23026 </indexterm>
23027 This option defines the ACL that is run when an SMTP RCPT command is
23028 received. See chapter <xref linkend="CHAPACL"/> for further details.
23029 </para>
23030 <para>
23031 <indexterm role="option">
23032 <primary><option>acl_smtp_starttls</option></primary>
23033 </indexterm>
23034 </para>
23035 <informaltable frame="all">
23036 <tgroup cols="4" colsep="0" rowsep="0">
23037 <colspec colwidth="8*" align="left"/>
23038 <colspec colwidth="6*" align="center"/>
23039 <colspec colwidth="6*" align="center"/>
23040 <colspec colwidth="6*" align="right"/>
23041 <tbody>
23042 <row>
23043 <entry><option>acl_smtp_starttls</option></entry>
23044 <entry>Use: <emphasis>main</emphasis></entry>
23045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23046 <entry>Default: <emphasis>unset</emphasis></entry>
23047 </row>
23048 </tbody>
23049 </tgroup>
23050 </informaltable>
23051 <para>
23052 <indexterm role="concept">
23053 <primary>STARTTLS, ACL for</primary>
23054 </indexterm>
23055 This option defines the ACL that is run when an SMTP STARTTLS command is
23056 received. See chapter <xref linkend="CHAPACL"/> for further details.
23057 </para>
23058 <para>
23059 <indexterm role="option">
23060 <primary><option>acl_smtp_vrfy</option></primary>
23061 </indexterm>
23062 </para>
23063 <informaltable frame="all">
23064 <tgroup cols="4" colsep="0" rowsep="0">
23065 <colspec colwidth="8*" align="left"/>
23066 <colspec colwidth="6*" align="center"/>
23067 <colspec colwidth="6*" align="center"/>
23068 <colspec colwidth="6*" align="right"/>
23069 <tbody>
23070 <row>
23071 <entry><option>acl_smtp_vrfy</option></entry>
23072 <entry>Use: <emphasis>main</emphasis></entry>
23073 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23074 <entry>Default: <emphasis>unset</emphasis></entry>
23075 </row>
23076 </tbody>
23077 </tgroup>
23078 </informaltable>
23079 <para>
23080 <indexterm role="concept">
23081 <primary>VRFY</primary>
23082 <secondary>ACL for</secondary>
23083 </indexterm>
23084 This option defines the ACL that is run when an SMTP VRFY command is
23085 received. See chapter <xref linkend="CHAPACL"/> for further details.
23086 </para>
23087 <para>
23088 <indexterm role="option">
23089 <primary><option>add_environment</option></primary>
23090 </indexterm>
23091 </para>
23092 <informaltable frame="all">
23093 <tgroup cols="4" colsep="0" rowsep="0">
23094 <colspec colwidth="8*" align="left"/>
23095 <colspec colwidth="6*" align="center"/>
23096 <colspec colwidth="6*" align="center"/>
23097 <colspec colwidth="6*" align="right"/>
23098 <tbody>
23099 <row>
23100 <entry><option>add_environment</option></entry>
23101 <entry>Use: <emphasis>main</emphasis></entry>
23102 <entry>Type: <emphasis>string list</emphasis></entry>
23103 <entry>Default: <emphasis>empty</emphasis></entry>
23104 </row>
23105 </tbody>
23106 </tgroup>
23107 </informaltable>
23108 <para>
23109 <indexterm role="concept">
23110 <primary>environment</primary>
23111 <secondary>set values</secondary>
23112 </indexterm>
23113 This option allows to set individual environment variables that the
23114 currently linked libraries and programs in child processes use.
23115 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
23116 </para>
23117 <para>
23118 <indexterm role="option">
23119 <primary><option>admin_groups</option></primary>
23120 </indexterm>
23121 </para>
23122 <informaltable frame="all">
23123 <tgroup cols="4" colsep="0" rowsep="0">
23124 <colspec colwidth="8*" align="left"/>
23125 <colspec colwidth="6*" align="center"/>
23126 <colspec colwidth="6*" align="center"/>
23127 <colspec colwidth="6*" align="right"/>
23128 <tbody>
23129 <row>
23130 <entry><option>admin_groups</option></entry>
23131 <entry>Use: <emphasis>main</emphasis></entry>
23132 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23133 <entry>Default: <emphasis>unset</emphasis></entry>
23134 </row>
23135 </tbody>
23136 </tgroup>
23137 </informaltable>
23138 <para>
23139 <indexterm role="concept">
23140 <primary>admin user</primary>
23141 </indexterm>
23142 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
23143 current group or any of the supplementary groups of an Exim caller is in this
23144 colon-separated list, the caller has admin privileges. If all your system
23145 programmers are in a specific group, for example, you can give them all Exim
23146 admin privileges by putting that group in <option>admin_groups</option>. However, this does
23147 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
23148 To permit this, you have to add individuals to the Exim group.
23149 </para>
23150 <para>
23151 <indexterm role="option">
23152 <primary><option>allow_domain_literals</option></primary>
23153 </indexterm>
23154 </para>
23155 <informaltable frame="all">
23156 <tgroup cols="4" colsep="0" rowsep="0">
23157 <colspec colwidth="8*" align="left"/>
23158 <colspec colwidth="6*" align="center"/>
23159 <colspec colwidth="6*" align="center"/>
23160 <colspec colwidth="6*" align="right"/>
23161 <tbody>
23162 <row>
23163 <entry><option>allow_domain_literals</option></entry>
23164 <entry>Use: <emphasis>main</emphasis></entry>
23165 <entry>Type: <emphasis>boolean</emphasis></entry>
23166 <entry>Default: <emphasis>false</emphasis></entry>
23167 </row>
23168 </tbody>
23169 </tgroup>
23170 </informaltable>
23171 <para>
23172 <indexterm role="concept">
23173 <primary>domain literal</primary>
23174 </indexterm>
23175 If this option is set, the RFC 2822 domain literal format is permitted in
23176 email addresses. The option is not set by default, because the domain literal
23177 format is not normally required these days, and few people know about it. It
23178 has, however, been exploited by mail abusers.
23179 </para>
23180 <para>
23181 Unfortunately, it seems that some DNS black list maintainers are using this
23182 format to report black listing to postmasters. If you want to accept messages
23183 addressed to your hosts by IP address, you need to set
23184 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
23185 domains (defined in the named domain list <option>local_domains</option> in the default
23186 configuration). This <quote>magic string</quote> matches the domain literal form of all
23187 the local host&#x2019;s IP addresses.
23188 </para>
23189 <para>
23190 <indexterm role="option">
23191 <primary><option>allow_mx_to_ip</option></primary>
23192 </indexterm>
23193 </para>
23194 <informaltable frame="all">
23195 <tgroup cols="4" colsep="0" rowsep="0">
23196 <colspec colwidth="8*" align="left"/>
23197 <colspec colwidth="6*" align="center"/>
23198 <colspec colwidth="6*" align="center"/>
23199 <colspec colwidth="6*" align="right"/>
23200 <tbody>
23201 <row>
23202 <entry><option>allow_mx_to_ip</option></entry>
23203 <entry>Use: <emphasis>main</emphasis></entry>
23204 <entry>Type: <emphasis>boolean</emphasis></entry>
23205 <entry>Default: <emphasis>false</emphasis></entry>
23206 </row>
23207 </tbody>
23208 </tgroup>
23209 </informaltable>
23210 <para>
23211 <indexterm role="concept">
23212 <primary>MX record</primary>
23213 <secondary>pointing to IP address</secondary>
23214 </indexterm>
23215 It appears that more and more DNS zone administrators are breaking the rules
23216 and putting domain names that look like IP addresses on the right hand side of
23217 MX records. Exim follows the rules and rejects this, giving an error message
23218 that explains the misconfiguration. However, some other MTAs support this
23219 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
23220 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
23221 recommended, except when you have no other choice.
23222 </para>
23223 <para>
23224 <indexterm role="option">
23225 <primary><option>allow_utf8_domains</option></primary>
23226 </indexterm>
23227 </para>
23228 <informaltable frame="all">
23229 <tgroup cols="4" colsep="0" rowsep="0">
23230 <colspec colwidth="8*" align="left"/>
23231 <colspec colwidth="6*" align="center"/>
23232 <colspec colwidth="6*" align="center"/>
23233 <colspec colwidth="6*" align="right"/>
23234 <tbody>
23235 <row>
23236 <entry><option>allow_utf8_domains</option></entry>
23237 <entry>Use: <emphasis>main</emphasis></entry>
23238 <entry>Type: <emphasis>boolean</emphasis></entry>
23239 <entry>Default: <emphasis>false</emphasis></entry>
23240 </row>
23241 </tbody>
23242 </tgroup>
23243 </informaltable>
23244 <para>
23245 <indexterm role="concept">
23246 <primary>domain</primary>
23247 <secondary>UTF-8 characters in</secondary>
23248 </indexterm>
23249 <indexterm role="concept">
23250 <primary>UTF-8</primary>
23251 <secondary>in domain name</secondary>
23252 </indexterm>
23253 Lots of discussion is going on about internationalized domain names. One
23254 camp is strongly in favour of just using UTF-8 characters, and it seems
23255 that at least two other MTAs permit this. This option allows Exim users to
23256 experiment if they wish.
23257 </para>
23258 <para>
23259 If it is set true, Exim&#x2019;s domain parsing function allows valid
23260 UTF-8 multicharacters to appear in domain name components, in addition to
23261 letters, digits, and hyphens. However, just setting this option is not
23262 enough; if you want to look up these domain names in the DNS, you must also
23263 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23264 suitable setting is:
23265 </para>
23266 <literallayout class="monospaced">
23267 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23268   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23269 </literallayout>
23270 <para>
23271 Alternatively, you can just disable this feature by setting
23272 </para>
23273 <literallayout class="monospaced">
23274 dns_check_names_pattern =
23275 </literallayout>
23276 <para>
23277 That is, set the option to an empty string so that no check is done.
23278 </para>
23279 <para>
23280 <indexterm role="option">
23281 <primary><option>auth_advertise_hosts</option></primary>
23282 </indexterm>
23283 </para>
23284 <informaltable frame="all">
23285 <tgroup cols="4" colsep="0" rowsep="0">
23286 <colspec colwidth="8*" align="left"/>
23287 <colspec colwidth="6*" align="center"/>
23288 <colspec colwidth="6*" align="center"/>
23289 <colspec colwidth="6*" align="right"/>
23290 <tbody>
23291 <row>
23292 <entry><option>auth_advertise_hosts</option></entry>
23293 <entry>Use: <emphasis>main</emphasis></entry>
23294 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23295 <entry>Default: <emphasis>*</emphasis></entry>
23296 </row>
23297 </tbody>
23298 </tgroup>
23299 </informaltable>
23300 <para>
23301 <indexterm role="concept">
23302 <primary>authentication</primary>
23303 <secondary>advertising</secondary>
23304 </indexterm>
23305 <indexterm role="concept">
23306 <primary>AUTH</primary>
23307 <secondary>advertising</secondary>
23308 </indexterm>
23309 If any server authentication mechanisms are configured, Exim advertises them in
23310 response to an EHLO command only if the calling host matches this list.
23311 Otherwise, Exim does not advertise AUTH.
23312 Exim does not accept AUTH commands from clients to which it has not
23313 advertised the availability of AUTH. The advertising of individual
23314 authentication mechanisms can be controlled by the use of the
23315 <option>server_advertise_condition</option> generic authenticator option on the individual
23316 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23317 </para>
23318 <para>
23319 Certain mail clients (for example, Netscape) require the user to provide a name
23320 and password for authentication if AUTH is advertised, even though it may
23321 not be needed (the host may accept messages from hosts on its local LAN without
23322 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23323 to make these clients more friendly by excluding them from the set of hosts to
23324 which Exim advertises AUTH.
23325 </para>
23326 <para>
23327 <indexterm role="concept">
23328 <primary>AUTH</primary>
23329 <secondary>advertising when encrypted</secondary>
23330 </indexterm>
23331 If you want to advertise the availability of AUTH only when the connection
23332 is encrypted using TLS, you can make use of the fact that the value of this
23333 option is expanded, with a setting like this:
23334 </para>
23335 <literallayout class="monospaced">
23336 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23337 </literallayout>
23338 <para>
23339 <indexterm role="variable">
23340 <primary><varname>$tls_in_cipher</varname></primary>
23341 </indexterm>
23342 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23343 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23344 expansion is *, which matches all hosts.
23345 </para>
23346 <para>
23347 <indexterm role="option">
23348 <primary><option>auto_thaw</option></primary>
23349 </indexterm>
23350 </para>
23351 <informaltable frame="all">
23352 <tgroup cols="4" colsep="0" rowsep="0">
23353 <colspec colwidth="8*" align="left"/>
23354 <colspec colwidth="6*" align="center"/>
23355 <colspec colwidth="6*" align="center"/>
23356 <colspec colwidth="6*" align="right"/>
23357 <tbody>
23358 <row>
23359 <entry><option>auto_thaw</option></entry>
23360 <entry>Use: <emphasis>main</emphasis></entry>
23361 <entry>Type: <emphasis>time</emphasis></entry>
23362 <entry>Default: <emphasis>0s</emphasis></entry>
23363 </row>
23364 </tbody>
23365 </tgroup>
23366 </informaltable>
23367 <para>
23368 <indexterm role="concept">
23369 <primary>thawing messages</primary>
23370 </indexterm>
23371 <indexterm role="concept">
23372 <primary>unfreezing messages</primary>
23373 </indexterm>
23374 If this option is set to a time greater than zero, a queue runner will try a
23375 new delivery attempt on any frozen message, other than a bounce message, if
23376 this much time has passed since it was frozen. This may result in the message
23377 being re-frozen if nothing has changed since the last attempt. It is a way of
23378 saying <quote>keep on trying, even though there are big problems</quote>.
23379 </para>
23380 <para>
23381 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23382 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23383 thought to be very useful any more, and its use should probably be avoided.
23384 </para>
23385 <para>
23386 <indexterm role="option">
23387 <primary><option>av_scanner</option></primary>
23388 </indexterm>
23389 </para>
23390 <informaltable frame="all">
23391 <tgroup cols="4" colsep="0" rowsep="0">
23392 <colspec colwidth="8*" align="left"/>
23393 <colspec colwidth="6*" align="center"/>
23394 <colspec colwidth="6*" align="center"/>
23395 <colspec colwidth="6*" align="right"/>
23396 <tbody>
23397 <row>
23398 <entry><option>av_scanner</option></entry>
23399 <entry>Use: <emphasis>main</emphasis></entry>
23400 <entry>Type: <emphasis>string</emphasis></entry>
23401 <entry>Default: <emphasis>see below</emphasis></entry>
23402 </row>
23403 </tbody>
23404 </tgroup>
23405 </informaltable>
23406 <para>
23407 This option is available if Exim is built with the content-scanning extension.
23408 It specifies which anti-virus scanner to use. The default value is:
23409 </para>
23410 <literallayout class="monospaced">
23411 sophie:/var/run/sophie
23412 </literallayout>
23413 <para>
23414 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23415 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23416 </para>
23417 <para>
23418 <indexterm role="option">
23419 <primary><option>bi_command</option></primary>
23420 </indexterm>
23421 </para>
23422 <informaltable frame="all">
23423 <tgroup cols="4" colsep="0" rowsep="0">
23424 <colspec colwidth="8*" align="left"/>
23425 <colspec colwidth="6*" align="center"/>
23426 <colspec colwidth="6*" align="center"/>
23427 <colspec colwidth="6*" align="right"/>
23428 <tbody>
23429 <row>
23430 <entry><option>bi_command</option></entry>
23431 <entry>Use: <emphasis>main</emphasis></entry>
23432 <entry>Type: <emphasis>string</emphasis></entry>
23433 <entry>Default: <emphasis>unset</emphasis></entry>
23434 </row>
23435 </tbody>
23436 </tgroup>
23437 </informaltable>
23438 <para>
23439 <indexterm role="option">
23440 <primary><option>-bi</option></primary>
23441 </indexterm>
23442 This option supplies the name of a command that is run when Exim is called with
23443 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
23444 just the command name, it is not a complete command line. If an argument is
23445 required, it must come from the <option>-oA</option> command line option.
23446 </para>
23447 <para>
23448 <indexterm role="option">
23449 <primary><option>bounce_message_file</option></primary>
23450 </indexterm>
23451 </para>
23452 <informaltable frame="all">
23453 <tgroup cols="4" colsep="0" rowsep="0">
23454 <colspec colwidth="8*" align="left"/>
23455 <colspec colwidth="6*" align="center"/>
23456 <colspec colwidth="6*" align="center"/>
23457 <colspec colwidth="6*" align="right"/>
23458 <tbody>
23459 <row>
23460 <entry><option>bounce_message_file</option></entry>
23461 <entry>Use: <emphasis>main</emphasis></entry>
23462 <entry>Type: <emphasis>string</emphasis></entry>
23463 <entry>Default: <emphasis>unset</emphasis></entry>
23464 </row>
23465 </tbody>
23466 </tgroup>
23467 </informaltable>
23468 <para>
23469 <indexterm role="concept">
23470 <primary>bounce message</primary>
23471 <secondary>customizing</secondary>
23472 </indexterm>
23473 <indexterm role="concept">
23474 <primary>customizing</primary>
23475 <secondary>bounce message</secondary>
23476 </indexterm>
23477 This option defines a template file containing paragraphs of text to be used
23478 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
23479 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
23480 </para>
23481 <para>
23482 <indexterm role="option">
23483 <primary><option>bounce_message_text</option></primary>
23484 </indexterm>
23485 </para>
23486 <informaltable frame="all">
23487 <tgroup cols="4" colsep="0" rowsep="0">
23488 <colspec colwidth="8*" align="left"/>
23489 <colspec colwidth="6*" align="center"/>
23490 <colspec colwidth="6*" align="center"/>
23491 <colspec colwidth="6*" align="right"/>
23492 <tbody>
23493 <row>
23494 <entry><option>bounce_message_text</option></entry>
23495 <entry>Use: <emphasis>main</emphasis></entry>
23496 <entry>Type: <emphasis>string</emphasis></entry>
23497 <entry>Default: <emphasis>unset</emphasis></entry>
23498 </row>
23499 </tbody>
23500 </tgroup>
23501 </informaltable>
23502 <para>
23503 When this option is set, its contents are included in the default bounce
23504 message immediately after <quote>This message was created automatically by mail
23505 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
23506 </para>
23507 <para>
23508 <indexterm role="option">
23509 <primary><option>bounce_return_body</option></primary>
23510 </indexterm>
23511 </para>
23512 <informaltable frame="all">
23513 <tgroup cols="4" colsep="0" rowsep="0">
23514 <colspec colwidth="8*" align="left"/>
23515 <colspec colwidth="6*" align="center"/>
23516 <colspec colwidth="6*" align="center"/>
23517 <colspec colwidth="6*" align="right"/>
23518 <tbody>
23519 <row>
23520 <entry><option>bounce_return_body</option></entry>
23521 <entry>Use: <emphasis>main</emphasis></entry>
23522 <entry>Type: <emphasis>boolean</emphasis></entry>
23523 <entry>Default: <emphasis>true</emphasis></entry>
23524 </row>
23525 </tbody>
23526 </tgroup>
23527 </informaltable>
23528 <para>
23529 <indexterm role="concept">
23530 <primary>bounce message</primary>
23531 <secondary>including body</secondary>
23532 </indexterm>
23533 This option controls whether the body of an incoming message is included in a
23534 bounce message when <option>bounce_return_message</option> is true. The default setting
23535 causes the entire message, both header and body, to be returned (subject to the
23536 value of <option>bounce_return_size_limit</option>). If this option is false, only the
23537 message header is included. In the case of a non-SMTP message containing an
23538 error that is detected during reception, only those header lines preceding the
23539 point at which the error was detected are returned.
23540 <indexterm role="concept">
23541 <primary>bounce message</primary>
23542 <secondary>including original</secondary>
23543 </indexterm>
23544 </para>
23545 <para>
23546 <indexterm role="option">
23547 <primary><option>bounce_return_linesize_limit</option></primary>
23548 </indexterm>
23549 </para>
23550 <informaltable frame="all">
23551 <tgroup cols="4" colsep="0" rowsep="0">
23552 <colspec colwidth="8*" align="left"/>
23553 <colspec colwidth="6*" align="center"/>
23554 <colspec colwidth="6*" align="center"/>
23555 <colspec colwidth="6*" align="right"/>
23556 <tbody>
23557 <row>
23558 <entry><option>bounce_return_linesize_limit</option></entry>
23559 <entry>Use: <emphasis>main</emphasis></entry>
23560 <entry>Type: <emphasis>integer</emphasis></entry>
23561 <entry>Default: <emphasis>998</emphasis></entry>
23562 </row>
23563 </tbody>
23564 </tgroup>
23565 </informaltable>
23566 <para>
23567 <indexterm role="concept">
23568 <primary>size</primary>
23569 <secondary>of bounce lines, limit</secondary>
23570 </indexterm>
23571 <indexterm role="concept">
23572 <primary>bounce message</primary>
23573 <secondary>line length limit</secondary>
23574 </indexterm>
23575 <indexterm role="concept">
23576 <primary>limit</primary>
23577 <secondary>bounce message line length</secondary>
23578 </indexterm>
23579 This option sets a limit in bytes on the line length of messages
23580 that are returned to senders due to delivery problems,
23581 when <option>bounce_return_message</option> is true.
23582 The default value corresponds to RFC limits.
23583 If the message being returned has lines longer than this value it is
23584 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
23585 </para>
23586 <para>
23587 The option also applies to bounces returned when an error is detected
23588 during reception of a message.
23589 In this case lines from the original are truncated.
23590 </para>
23591 <para>
23592 The option does not apply to messages generated by an <command>autoreply</command> transport.
23593 </para>
23594 <para>
23595 <indexterm role="option">
23596 <primary><option>bounce_return_message</option></primary>
23597 </indexterm>
23598 </para>
23599 <informaltable frame="all">
23600 <tgroup cols="4" colsep="0" rowsep="0">
23601 <colspec colwidth="8*" align="left"/>
23602 <colspec colwidth="6*" align="center"/>
23603 <colspec colwidth="6*" align="center"/>
23604 <colspec colwidth="6*" align="right"/>
23605 <tbody>
23606 <row>
23607 <entry><option>bounce_return_message</option></entry>
23608 <entry>Use: <emphasis>main</emphasis></entry>
23609 <entry>Type: <emphasis>boolean</emphasis></entry>
23610 <entry>Default: <emphasis>true</emphasis></entry>
23611 </row>
23612 </tbody>
23613 </tgroup>
23614 </informaltable>
23615 <para>
23616 If this option is set false, none of the original message is included in
23617 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
23618 <option>bounce_return_body</option>.
23619 </para>
23620 <para>
23621 <indexterm role="option">
23622 <primary><option>bounce_return_size_limit</option></primary>
23623 </indexterm>
23624 </para>
23625 <informaltable frame="all">
23626 <tgroup cols="4" colsep="0" rowsep="0">
23627 <colspec colwidth="8*" align="left"/>
23628 <colspec colwidth="6*" align="center"/>
23629 <colspec colwidth="6*" align="center"/>
23630 <colspec colwidth="6*" align="right"/>
23631 <tbody>
23632 <row>
23633 <entry><option>bounce_return_size_limit</option></entry>
23634 <entry>Use: <emphasis>main</emphasis></entry>
23635 <entry>Type: <emphasis>integer</emphasis></entry>
23636 <entry>Default: <emphasis>100K</emphasis></entry>
23637 </row>
23638 </tbody>
23639 </tgroup>
23640 </informaltable>
23641 <para>
23642 <indexterm role="concept">
23643 <primary>size</primary>
23644 <secondary>of bounce, limit</secondary>
23645 </indexterm>
23646 <indexterm role="concept">
23647 <primary>bounce message</primary>
23648 <secondary>size limit</secondary>
23649 </indexterm>
23650 <indexterm role="concept">
23651 <primary>limit</primary>
23652 <secondary>bounce message size</secondary>
23653 </indexterm>
23654 This option sets a limit in bytes on the size of messages that are returned to
23655 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23656 limit should be less than the value of the global <option>message_size_limit</option> and of
23657 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23658 that Exim generates. If this option is set to zero there is no limit.
23659 </para>
23660 <para>
23661 When the body of any message that is to be included in a bounce message is
23662 greater than the limit, it is truncated, and a comment pointing this out is
23663 added at the top. The actual cutoff may be greater than the value given, owing
23664 to the use of buffering for transferring the message in chunks (typically 8K in
23665 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23666 messages.
23667 </para>
23668 <para>
23669 <indexterm role="option">
23670 <primary><option>bounce_sender_authentication</option></primary>
23671 </indexterm>
23672 </para>
23673 <informaltable frame="all">
23674 <tgroup cols="4" colsep="0" rowsep="0">
23675 <colspec colwidth="8*" align="left"/>
23676 <colspec colwidth="6*" align="center"/>
23677 <colspec colwidth="6*" align="center"/>
23678 <colspec colwidth="6*" align="right"/>
23679 <tbody>
23680 <row>
23681 <entry><option>bounce_sender_authentication</option></entry>
23682 <entry>Use: <emphasis>main</emphasis></entry>
23683 <entry>Type: <emphasis>string</emphasis></entry>
23684 <entry>Default: <emphasis>unset</emphasis></entry>
23685 </row>
23686 </tbody>
23687 </tgroup>
23688 </informaltable>
23689 <para>
23690 <indexterm role="concept">
23691 <primary>bounce message</primary>
23692 <secondary>sender authentication</secondary>
23693 </indexterm>
23694 <indexterm role="concept">
23695 <primary>authentication</primary>
23696 <secondary>bounce message</secondary>
23697 </indexterm>
23698 <indexterm role="concept">
23699 <primary>AUTH</primary>
23700 <secondary>on bounce message</secondary>
23701 </indexterm>
23702 This option provides an authenticated sender address that is sent with any
23703 bounce messages generated by Exim that are sent over an authenticated SMTP
23704 connection. A typical setting might be:
23705 </para>
23706 <literallayout class="monospaced">
23707 bounce_sender_authentication = mailer-daemon@my.domain.example
23708 </literallayout>
23709 <para>
23710 which would cause bounce messages to be sent using the SMTP command:
23711 </para>
23712 <literallayout class="monospaced">
23713 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23714 </literallayout>
23715 <para>
23716 The value of <option>bounce_sender_authentication</option> must always be a complete email
23717 address.
23718 </para>
23719 <para>
23720 <indexterm role="option">
23721 <primary><option>callout_domain_negative_expire</option></primary>
23722 </indexterm>
23723 </para>
23724 <informaltable frame="all">
23725 <tgroup cols="4" colsep="0" rowsep="0">
23726 <colspec colwidth="8*" align="left"/>
23727 <colspec colwidth="6*" align="center"/>
23728 <colspec colwidth="6*" align="center"/>
23729 <colspec colwidth="6*" align="right"/>
23730 <tbody>
23731 <row>
23732 <entry><option>callout_domain_negative_expire</option></entry>
23733 <entry>Use: <emphasis>main</emphasis></entry>
23734 <entry>Type: <emphasis>time</emphasis></entry>
23735 <entry>Default: <emphasis>3h</emphasis></entry>
23736 </row>
23737 </tbody>
23738 </tgroup>
23739 </informaltable>
23740 <para>
23741 <indexterm role="concept">
23742 <primary>caching</primary>
23743 <secondary>callout timeouts</secondary>
23744 </indexterm>
23745 <indexterm role="concept">
23746 <primary>callout</primary>
23747 <secondary>caching timeouts</secondary>
23748 </indexterm>
23749 This option specifies the expiry time for negative callout cache data for a
23750 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23751 section <xref linkend="SECTcallvercache"/> for details of the caching.
23752 </para>
23753 <para>
23754 <indexterm role="option">
23755 <primary><option>callout_domain_positive_expire</option></primary>
23756 </indexterm>
23757 </para>
23758 <informaltable frame="all">
23759 <tgroup cols="4" colsep="0" rowsep="0">
23760 <colspec colwidth="8*" align="left"/>
23761 <colspec colwidth="6*" align="center"/>
23762 <colspec colwidth="6*" align="center"/>
23763 <colspec colwidth="6*" align="right"/>
23764 <tbody>
23765 <row>
23766 <entry><option>callout_domain_positive_expire</option></entry>
23767 <entry>Use: <emphasis>main</emphasis></entry>
23768 <entry>Type: <emphasis>time</emphasis></entry>
23769 <entry>Default: <emphasis>7d</emphasis></entry>
23770 </row>
23771 </tbody>
23772 </tgroup>
23773 </informaltable>
23774 <para>
23775 This option specifies the expiry time for positive callout cache data for a
23776 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23777 section <xref linkend="SECTcallvercache"/> for details of the caching.
23778 </para>
23779 <para>
23780 <indexterm role="option">
23781 <primary><option>callout_negative_expire</option></primary>
23782 </indexterm>
23783 </para>
23784 <informaltable frame="all">
23785 <tgroup cols="4" colsep="0" rowsep="0">
23786 <colspec colwidth="8*" align="left"/>
23787 <colspec colwidth="6*" align="center"/>
23788 <colspec colwidth="6*" align="center"/>
23789 <colspec colwidth="6*" align="right"/>
23790 <tbody>
23791 <row>
23792 <entry><option>callout_negative_expire</option></entry>
23793 <entry>Use: <emphasis>main</emphasis></entry>
23794 <entry>Type: <emphasis>time</emphasis></entry>
23795 <entry>Default: <emphasis>2h</emphasis></entry>
23796 </row>
23797 </tbody>
23798 </tgroup>
23799 </informaltable>
23800 <para>
23801 This option specifies the expiry time for negative callout cache data for an
23802 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23803 section <xref linkend="SECTcallvercache"/> for details of the caching.
23804 </para>
23805 <para>
23806 <indexterm role="option">
23807 <primary><option>callout_positive_expire</option></primary>
23808 </indexterm>
23809 </para>
23810 <informaltable frame="all">
23811 <tgroup cols="4" colsep="0" rowsep="0">
23812 <colspec colwidth="8*" align="left"/>
23813 <colspec colwidth="6*" align="center"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="right"/>
23816 <tbody>
23817 <row>
23818 <entry><option>callout_positive_expire</option></entry>
23819 <entry>Use: <emphasis>main</emphasis></entry>
23820 <entry>Type: <emphasis>time</emphasis></entry>
23821 <entry>Default: <emphasis>24h</emphasis></entry>
23822 </row>
23823 </tbody>
23824 </tgroup>
23825 </informaltable>
23826 <para>
23827 This option specifies the expiry time for positive callout cache data for an
23828 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23829 section <xref linkend="SECTcallvercache"/> for details of the caching.
23830 </para>
23831 <para>
23832 <indexterm role="option">
23833 <primary><option>callout_random_local_part</option></primary>
23834 </indexterm>
23835 </para>
23836 <informaltable frame="all">
23837 <tgroup cols="4" colsep="0" rowsep="0">
23838 <colspec colwidth="8*" align="left"/>
23839 <colspec colwidth="6*" align="center"/>
23840 <colspec colwidth="6*" align="center"/>
23841 <colspec colwidth="6*" align="right"/>
23842 <tbody>
23843 <row>
23844 <entry><option>callout_random_local_part</option></entry>
23845 <entry>Use: <emphasis>main</emphasis></entry>
23846 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23847 <entry>Default: <emphasis>see below</emphasis></entry>
23848 </row>
23849 </tbody>
23850 </tgroup>
23851 </informaltable>
23852 <para>
23853 This option defines the <quote>random</quote> local part that can be used as part of
23854 callout verification. The default value is
23855 </para>
23856 <literallayout class="monospaced">
23857 $primary_hostname-$tod_epoch-testing
23858 </literallayout>
23859 <para>
23860 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23861 </para>
23862 <para>
23863 <indexterm role="option">
23864 <primary><option>check_log_inodes</option></primary>
23865 </indexterm>
23866 </para>
23867 <informaltable frame="all">
23868 <tgroup cols="4" colsep="0" rowsep="0">
23869 <colspec colwidth="8*" align="left"/>
23870 <colspec colwidth="6*" align="center"/>
23871 <colspec colwidth="6*" align="center"/>
23872 <colspec colwidth="6*" align="right"/>
23873 <tbody>
23874 <row>
23875 <entry><option>check_log_inodes</option></entry>
23876 <entry>Use: <emphasis>main</emphasis></entry>
23877 <entry>Type: <emphasis>integer</emphasis></entry>
23878 <entry>Default: <emphasis>100</emphasis></entry>
23879 </row>
23880 </tbody>
23881 </tgroup>
23882 </informaltable>
23883 <para>
23884 See <option>check_spool_space</option> below.
23885 </para>
23886 <para>
23887 <indexterm role="option">
23888 <primary><option>check_log_space</option></primary>
23889 </indexterm>
23890 </para>
23891 <informaltable frame="all">
23892 <tgroup cols="4" colsep="0" rowsep="0">
23893 <colspec colwidth="8*" align="left"/>
23894 <colspec colwidth="6*" align="center"/>
23895 <colspec colwidth="6*" align="center"/>
23896 <colspec colwidth="6*" align="right"/>
23897 <tbody>
23898 <row>
23899 <entry><option>check_log_space</option></entry>
23900 <entry>Use: <emphasis>main</emphasis></entry>
23901 <entry>Type: <emphasis>integer</emphasis></entry>
23902 <entry>Default: <emphasis>10M</emphasis></entry>
23903 </row>
23904 </tbody>
23905 </tgroup>
23906 </informaltable>
23907 <para>
23908 See <option>check_spool_space</option> below.
23909 </para>
23910 <para>
23911 <indexterm role="option">
23912 <primary><option>check_rfc2047_length</option></primary>
23913 </indexterm>
23914 <indexterm role="concept">
23915 <primary>RFC 2047</primary>
23916 <secondary>disabling length check</secondary>
23917 </indexterm>
23918 <indexterm role="option">
23919 <primary><option>check_rfc2047_length</option></primary>
23920 </indexterm>
23921 </para>
23922 <informaltable frame="all">
23923 <tgroup cols="4" colsep="0" rowsep="0">
23924 <colspec colwidth="8*" align="left"/>
23925 <colspec colwidth="6*" align="center"/>
23926 <colspec colwidth="6*" align="center"/>
23927 <colspec colwidth="6*" align="right"/>
23928 <tbody>
23929 <row>
23930 <entry><option>check_rfc2047_length</option></entry>
23931 <entry>Use: <emphasis>main</emphasis></entry>
23932 <entry>Type: <emphasis>boolean</emphasis></entry>
23933 <entry>Default: <emphasis>true</emphasis></entry>
23934 </row>
23935 </tbody>
23936 </tgroup>
23937 </informaltable>
23938 <para>
23939 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23940 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23941 word; strings to be encoded that exceed this length are supposed to use
23942 multiple encoded words. By default, Exim does not recognize encoded words that
23943 exceed the maximum length. However, it seems that some software, in violation
23944 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23945 set false, Exim recognizes encoded words of any length.
23946 </para>
23947 <para>
23948 <indexterm role="option">
23949 <primary><option>check_spool_inodes</option></primary>
23950 </indexterm>
23951 </para>
23952 <informaltable frame="all">
23953 <tgroup cols="4" colsep="0" rowsep="0">
23954 <colspec colwidth="8*" align="left"/>
23955 <colspec colwidth="6*" align="center"/>
23956 <colspec colwidth="6*" align="center"/>
23957 <colspec colwidth="6*" align="right"/>
23958 <tbody>
23959 <row>
23960 <entry><option>check_spool_inodes</option></entry>
23961 <entry>Use: <emphasis>main</emphasis></entry>
23962 <entry>Type: <emphasis>integer</emphasis></entry>
23963 <entry>Default: <emphasis>100</emphasis></entry>
23964 </row>
23965 </tbody>
23966 </tgroup>
23967 </informaltable>
23968 <para>
23969 See <option>check_spool_space</option> below.
23970 </para>
23971 <para>
23972 <indexterm role="option">
23973 <primary><option>check_spool_space</option></primary>
23974 </indexterm>
23975 </para>
23976 <informaltable frame="all">
23977 <tgroup cols="4" colsep="0" rowsep="0">
23978 <colspec colwidth="8*" align="left"/>
23979 <colspec colwidth="6*" align="center"/>
23980 <colspec colwidth="6*" align="center"/>
23981 <colspec colwidth="6*" align="right"/>
23982 <tbody>
23983 <row>
23984 <entry><option>check_spool_space</option></entry>
23985 <entry>Use: <emphasis>main</emphasis></entry>
23986 <entry>Type: <emphasis>integer</emphasis></entry>
23987 <entry>Default: <emphasis>10M</emphasis></entry>
23988 </row>
23989 </tbody>
23990 </tgroup>
23991 </informaltable>
23992 <para>
23993 <indexterm role="concept">
23994 <primary>checking disk space</primary>
23995 </indexterm>
23996 <indexterm role="concept">
23997 <primary>disk space, checking</primary>
23998 </indexterm>
23999 <indexterm role="concept">
24000 <primary>spool directory</primary>
24001 <secondary>checking space</secondary>
24002 </indexterm>
24003 The four <option>check_...</option> options allow for checking of disk resources before a
24004 message is accepted.
24005 </para>
24006 <para>
24007 <indexterm role="variable">
24008 <primary><varname>$log_inodes</varname></primary>
24009 </indexterm>
24010 <indexterm role="variable">
24011 <primary><varname>$log_space</varname></primary>
24012 </indexterm>
24013 <indexterm role="variable">
24014 <primary><varname>$spool_inodes</varname></primary>
24015 </indexterm>
24016 <indexterm role="variable">
24017 <primary><varname>$spool_space</varname></primary>
24018 </indexterm>
24019 When any of these options are nonzero, they apply to all incoming messages. If you
24020 want to apply different checks to different kinds of message, you can do so by
24021 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
24022 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
24023 </para>
24024 <para>
24025 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
24026 either value is greater than zero, for example:
24027 </para>
24028 <literallayout class="monospaced">
24029 check_spool_space = 100M
24030 check_spool_inodes = 100
24031 </literallayout>
24032 <para>
24033 The spool partition is the one that contains the directory defined by
24034 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
24035 transit.
24036 </para>
24037 <para>
24038 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
24039 files are written if either is greater than zero. These should be set only if
24040 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
24041 </para>
24042 <para>
24043 If there is less space or fewer inodes than requested, Exim refuses to accept
24044 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
24045 error response to the MAIL command. If ESMTP is in use and there was a
24046 SIZE parameter on the MAIL command, its value is added to the
24047 <option>check_spool_space</option> value, and the check is performed even if
24048 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
24049 </para>
24050 <para>
24051 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
24052 number of kilobytes (though specified in bytes).
24053 If a non-multiple of 1024 is specified, it is rounded up.
24054 </para>
24055 <para>
24056 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
24057 failure a message is written to stderr and Exim exits with a non-zero code, as
24058 it obviously cannot send an error message of any kind.
24059 </para>
24060 <para>
24061 There is a slight performance penalty for these checks.
24062 Versions of Exim preceding 4.88 had these disabled by default;
24063 high-rate installations confident they will never run out of resources
24064 may wish to deliberately disable them.
24065 </para>
24066 <para>
24067 <indexterm role="option">
24068 <primary><option>chunking_advertise_hosts</option></primary>
24069 </indexterm>
24070 </para>
24071 <informaltable frame="all">
24072 <tgroup cols="4" colsep="0" rowsep="0">
24073 <colspec colwidth="8*" align="left"/>
24074 <colspec colwidth="6*" align="center"/>
24075 <colspec colwidth="6*" align="center"/>
24076 <colspec colwidth="6*" align="right"/>
24077 <tbody>
24078 <row>
24079 <entry><option>chunking_advertise_hosts</option></entry>
24080 <entry>Use: <emphasis>main</emphasis></entry>
24081 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24082 <entry>Default: <emphasis>*</emphasis></entry>
24083 </row>
24084 </tbody>
24085 </tgroup>
24086 </informaltable>
24087 <para>
24088 <indexterm role="concept">
24089 <primary>CHUNKING</primary>
24090 <secondary>advertisement</secondary>
24091 </indexterm>
24092 <indexterm role="concept">
24093 <primary>RFC 3030</primary>
24094 <secondary>CHUNKING</secondary>
24095 </indexterm>
24096 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
24097 these hosts.
24098 Hosts may use the BDAT command as an alternate to DATA.
24099 </para>
24100 <para revisionflag="changed">
24101 <indexterm role="option">
24102 <primary><option>debug_store</option></primary>
24103 </indexterm>
24104 </para>
24105 <informaltable frame="all" revisionflag="changed">
24106 <tgroup cols="4" colsep="0" rowsep="0">
24107 <colspec colwidth="8*" align="left"/>
24108 <colspec colwidth="6*" align="center"/>
24109 <colspec colwidth="6*" align="center"/>
24110 <colspec colwidth="6*" align="right"/>
24111 <tbody>
24112 <row>
24113 <entry><option>debug_store</option></entry>
24114 <entry>Use: <emphasis>main</emphasis></entry>
24115 <entry>Type: <emphasis>boolean</emphasis></entry>
24116 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24117 </row>
24118 </tbody>
24119 </tgroup>
24120 </informaltable>
24121 <para revisionflag="changed">
24122 <indexterm role="concept">
24123 <primary>debugging</primary>
24124 <secondary>memory corruption</secondary>
24125 </indexterm>
24126 <indexterm role="concept">
24127 <primary>memory</primary>
24128 <secondary>debugging</secondary>
24129 </indexterm>
24130 This option, when true, enables extra checking in Exim&#x2019;s internal memory
24131 management.  For use when a memory corruption issue is being investigated,
24132 it should normally be left as default.
24133 </para>
24134 <para>
24135 <indexterm role="option">
24136 <primary><option>daemon_smtp_ports</option></primary>
24137 </indexterm>
24138 </para>
24139 <informaltable frame="all">
24140 <tgroup cols="4" colsep="0" rowsep="0">
24141 <colspec colwidth="8*" align="left"/>
24142 <colspec colwidth="6*" align="center"/>
24143 <colspec colwidth="6*" align="center"/>
24144 <colspec colwidth="6*" align="right"/>
24145 <tbody>
24146 <row>
24147 <entry><option>daemon_smtp_ports</option></entry>
24148 <entry>Use: <emphasis>main</emphasis></entry>
24149 <entry>Type: <emphasis>string</emphasis></entry>
24150 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
24151 </row>
24152 </tbody>
24153 </tgroup>
24154 </informaltable>
24155 <para>
24156 <indexterm role="concept">
24157 <primary>port</primary>
24158 <secondary>for daemon</secondary>
24159 </indexterm>
24160 <indexterm role="concept">
24161 <primary>TCP/IP</primary>
24162 <secondary>setting listening ports</secondary>
24163 </indexterm>
24164 This option specifies one or more default SMTP ports on which the Exim daemon
24165 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
24166 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
24167 </para>
24168 <para>
24169 <indexterm role="option">
24170 <primary><option>daemon_startup_retries</option></primary>
24171 </indexterm>
24172 </para>
24173 <informaltable frame="all">
24174 <tgroup cols="4" colsep="0" rowsep="0">
24175 <colspec colwidth="8*" align="left"/>
24176 <colspec colwidth="6*" align="center"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="right"/>
24179 <tbody>
24180 <row>
24181 <entry><option>daemon_startup_retries</option></entry>
24182 <entry>Use: <emphasis>main</emphasis></entry>
24183 <entry>Type: <emphasis>integer</emphasis></entry>
24184 <entry>Default: <emphasis>9</emphasis></entry>
24185 </row>
24186 </tbody>
24187 </tgroup>
24188 </informaltable>
24189 <para>
24190 <indexterm role="concept">
24191 <primary>daemon startup, retrying</primary>
24192 </indexterm>
24193 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
24194 the daemon at startup when it cannot immediately bind a listening socket
24195 (typically because the socket is already in use): <option>daemon_startup_retries</option>
24196 defines the number of retries after the first failure, and
24197 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
24198 </para>
24199 <para>
24200 <indexterm role="option">
24201 <primary><option>daemon_startup_sleep</option></primary>
24202 </indexterm>
24203 </para>
24204 <informaltable frame="all">
24205 <tgroup cols="4" colsep="0" rowsep="0">
24206 <colspec colwidth="8*" align="left"/>
24207 <colspec colwidth="6*" align="center"/>
24208 <colspec colwidth="6*" align="center"/>
24209 <colspec colwidth="6*" align="right"/>
24210 <tbody>
24211 <row>
24212 <entry><option>daemon_startup_sleep</option></entry>
24213 <entry>Use: <emphasis>main</emphasis></entry>
24214 <entry>Type: <emphasis>time</emphasis></entry>
24215 <entry>Default: <emphasis>30s</emphasis></entry>
24216 </row>
24217 </tbody>
24218 </tgroup>
24219 </informaltable>
24220 <para>
24221 See <option>daemon_startup_retries</option>.
24222 </para>
24223 <para>
24224 <indexterm role="option">
24225 <primary><option>delay_warning</option></primary>
24226 </indexterm>
24227 </para>
24228 <informaltable frame="all">
24229 <tgroup cols="4" colsep="0" rowsep="0">
24230 <colspec colwidth="8*" align="left"/>
24231 <colspec colwidth="6*" align="center"/>
24232 <colspec colwidth="6*" align="center"/>
24233 <colspec colwidth="6*" align="right"/>
24234 <tbody>
24235 <row>
24236 <entry><option>delay_warning</option></entry>
24237 <entry>Use: <emphasis>main</emphasis></entry>
24238 <entry>Type: <emphasis>time list</emphasis></entry>
24239 <entry>Default: <emphasis>24h</emphasis></entry>
24240 </row>
24241 </tbody>
24242 </tgroup>
24243 </informaltable>
24244 <para>
24245 <indexterm role="concept">
24246 <primary>warning of delay</primary>
24247 </indexterm>
24248 <indexterm role="concept">
24249 <primary>delay warning, specifying</primary>
24250 </indexterm>
24251 <indexterm role="concept">
24252 <primary>queue</primary>
24253 <secondary>delay warning</secondary>
24254 </indexterm>
24255 When a message is delayed, Exim sends a warning message to the sender at
24256 intervals specified by this option. The data is a colon-separated list of times
24257 after which to send warning messages. If the value of the option is an empty
24258 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
24259 message has been on the queue for longer than the last time, the last interval
24260 between the times is used to compute subsequent warning times. For example,
24261 with
24262 </para>
24263 <literallayout class="monospaced">
24264 delay_warning = 4h:8h:24h
24265 </literallayout>
24266 <para>
24267 the first message is sent after 4 hours, the second after 8 hours, and
24268 the third one after 24 hours. After that, messages are sent every 16 hours,
24269 because that is the interval between the last two times on the list. If you set
24270 just one time, it specifies the repeat interval. For example, with:
24271 </para>
24272 <literallayout class="monospaced">
24273 delay_warning = 6h
24274 </literallayout>
24275 <para>
24276 messages are repeated every six hours. To stop warnings after a given time, set
24277 a very large time at the end of the list. For example:
24278 </para>
24279 <literallayout class="monospaced">
24280 delay_warning = 2h:12h:99d
24281 </literallayout>
24282 <para>
24283 Note that the option is only evaluated at the time a delivery attempt fails,
24284 which depends on retry and queue-runner configuration.
24285 Typically retries will be configured more frequently than warning messages.
24286 </para>
24287 <para>
24288 <indexterm role="option">
24289 <primary><option>delay_warning_condition</option></primary>
24290 </indexterm>
24291 </para>
24292 <informaltable frame="all">
24293 <tgroup cols="4" colsep="0" rowsep="0">
24294 <colspec colwidth="8*" align="left"/>
24295 <colspec colwidth="6*" align="center"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="right"/>
24298 <tbody>
24299 <row>
24300 <entry><option>delay_warning_condition</option></entry>
24301 <entry>Use: <emphasis>main</emphasis></entry>
24302 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24303 <entry>Default: <emphasis>see below</emphasis></entry>
24304 </row>
24305 </tbody>
24306 </tgroup>
24307 </informaltable>
24308 <para>
24309 <indexterm role="variable">
24310 <primary><varname>$domain</varname></primary>
24311 </indexterm>
24312 The string is expanded at the time a warning message might be sent. If all the
24313 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24314 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24315 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24316 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24317 not sent. The default is:
24318 </para>
24319 <literallayout class="monospaced">
24320 delay_warning_condition = ${if or {\
24321   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24322   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24323   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24324   } {no}{yes}}
24325 </literallayout>
24326 <para>
24327 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24328 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24329 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24330 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24331 </para>
24332 <para>
24333 <indexterm role="option">
24334 <primary><option>deliver_drop_privilege</option></primary>
24335 </indexterm>
24336 </para>
24337 <informaltable frame="all">
24338 <tgroup cols="4" colsep="0" rowsep="0">
24339 <colspec colwidth="8*" align="left"/>
24340 <colspec colwidth="6*" align="center"/>
24341 <colspec colwidth="6*" align="center"/>
24342 <colspec colwidth="6*" align="right"/>
24343 <tbody>
24344 <row>
24345 <entry><option>deliver_drop_privilege</option></entry>
24346 <entry>Use: <emphasis>main</emphasis></entry>
24347 <entry>Type: <emphasis>boolean</emphasis></entry>
24348 <entry>Default: <emphasis>false</emphasis></entry>
24349 </row>
24350 </tbody>
24351 </tgroup>
24352 </informaltable>
24353 <para>
24354 <indexterm role="concept">
24355 <primary>unprivileged delivery</primary>
24356 </indexterm>
24357 <indexterm role="concept">
24358 <primary>delivery</primary>
24359 <secondary>unprivileged</secondary>
24360 </indexterm>
24361 If this option is set true, Exim drops its root privilege at the start of a
24362 delivery process, and runs as the Exim user throughout. This severely restricts
24363 the kinds of local delivery that are possible, but is viable in certain types
24364 of configuration. There is a discussion about the use of root privilege in
24365 chapter <xref linkend="CHAPsecurity"/>.
24366 </para>
24367 <para>
24368 <indexterm role="option">
24369 <primary><option>deliver_queue_load_max</option></primary>
24370 </indexterm>
24371 </para>
24372 <informaltable frame="all">
24373 <tgroup cols="4" colsep="0" rowsep="0">
24374 <colspec colwidth="8*" align="left"/>
24375 <colspec colwidth="6*" align="center"/>
24376 <colspec colwidth="6*" align="center"/>
24377 <colspec colwidth="6*" align="right"/>
24378 <tbody>
24379 <row>
24380 <entry><option>deliver_queue_load_max</option></entry>
24381 <entry>Use: <emphasis>main</emphasis></entry>
24382 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24383 <entry>Default: <emphasis>unset</emphasis></entry>
24384 </row>
24385 </tbody>
24386 </tgroup>
24387 </informaltable>
24388 <para>
24389 <indexterm role="concept">
24390 <primary>load average</primary>
24391 </indexterm>
24392 <indexterm role="concept">
24393 <primary>queue runner</primary>
24394 <secondary>abandoning</secondary>
24395 </indexterm>
24396 When this option is set, a queue run is abandoned if the system load average
24397 becomes greater than the value of the option. The option has no effect on
24398 ancient operating systems on which Exim cannot determine the load average.
24399 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24400 </para>
24401 <para>
24402 <indexterm role="option">
24403 <primary><option>delivery_date_remove</option></primary>
24404 </indexterm>
24405 </para>
24406 <informaltable frame="all">
24407 <tgroup cols="4" colsep="0" rowsep="0">
24408 <colspec colwidth="8*" align="left"/>
24409 <colspec colwidth="6*" align="center"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="right"/>
24412 <tbody>
24413 <row>
24414 <entry><option>delivery_date_remove</option></entry>
24415 <entry>Use: <emphasis>main</emphasis></entry>
24416 <entry>Type: <emphasis>boolean</emphasis></entry>
24417 <entry>Default: <emphasis>true</emphasis></entry>
24418 </row>
24419 </tbody>
24420 </tgroup>
24421 </informaltable>
24422 <para>
24423 <indexterm role="concept">
24424 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
24425 </indexterm>
24426 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
24427 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24428 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
24429 should not be present in incoming messages, and this option causes them to be
24430 removed at the time the message is received, to avoid any problems that might
24431 occur when a delivered message is subsequently sent on to some other recipient.
24432 </para>
24433 <para>
24434 <indexterm role="option">
24435 <primary><option>disable_fsync</option></primary>
24436 </indexterm>
24437 </para>
24438 <informaltable frame="all">
24439 <tgroup cols="4" colsep="0" rowsep="0">
24440 <colspec colwidth="8*" align="left"/>
24441 <colspec colwidth="6*" align="center"/>
24442 <colspec colwidth="6*" align="center"/>
24443 <colspec colwidth="6*" align="right"/>
24444 <tbody>
24445 <row>
24446 <entry><option>disable_fsync</option></entry>
24447 <entry>Use: <emphasis>main</emphasis></entry>
24448 <entry>Type: <emphasis>boolean</emphasis></entry>
24449 <entry>Default: <emphasis>false</emphasis></entry>
24450 </row>
24451 </tbody>
24452 </tgroup>
24453 </informaltable>
24454 <para>
24455 <indexterm role="concept">
24456 <primary><function>fsync()</function>, disabling</primary>
24457 </indexterm>
24458 This option is available only if Exim was built with the compile-time option
24459 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
24460 a runtime configuration generates an <quote>unknown option</quote> error. You should not
24461 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
24462 really, really, really understand what you are doing. <emphasis>No pre-compiled
24463 distributions of Exim should ever make this option available.</emphasis>
24464 </para>
24465 <para>
24466 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
24467 updated files&#x2019; data to be written to disc before continuing. Unexpected events
24468 such as crashes and power outages may cause data to be lost or scrambled.
24469 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
24470 </para>
24471 <para>
24472 <indexterm role="option">
24473 <primary><option>disable_ipv6</option></primary>
24474 </indexterm>
24475 </para>
24476 <informaltable frame="all">
24477 <tgroup cols="4" colsep="0" rowsep="0">
24478 <colspec colwidth="8*" align="left"/>
24479 <colspec colwidth="6*" align="center"/>
24480 <colspec colwidth="6*" align="center"/>
24481 <colspec colwidth="6*" align="right"/>
24482 <tbody>
24483 <row>
24484 <entry><option>disable_ipv6</option></entry>
24485 <entry>Use: <emphasis>main</emphasis></entry>
24486 <entry>Type: <emphasis>boolean</emphasis></entry>
24487 <entry>Default: <emphasis>false</emphasis></entry>
24488 </row>
24489 </tbody>
24490 </tgroup>
24491 </informaltable>
24492 <para>
24493 <indexterm role="concept">
24494 <primary>IPv6</primary>
24495 <secondary>disabling</secondary>
24496 </indexterm>
24497 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
24498 activities take place. AAAA records are never looked up, and any IPv6 addresses
24499 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
24500 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
24501 to handle IPv6 literal addresses.
24502 </para>
24503 <para>
24504 <indexterm role="option">
24505 <primary><option>dkim_verify_signers</option></primary>
24506 </indexterm>
24507 </para>
24508 <informaltable frame="all">
24509 <tgroup cols="4" colsep="0" rowsep="0">
24510 <colspec colwidth="8*" align="left"/>
24511 <colspec colwidth="6*" align="center"/>
24512 <colspec colwidth="6*" align="center"/>
24513 <colspec colwidth="6*" align="right"/>
24514 <tbody>
24515 <row>
24516 <entry><option>dkim_verify_signers</option></entry>
24517 <entry>Use: <emphasis>main</emphasis></entry>
24518 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24519 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
24520 </row>
24521 </tbody>
24522 </tgroup>
24523 </informaltable>
24524 <para>
24525 <indexterm role="concept">
24526 <primary>DKIM</primary>
24527 <secondary>controlling calls to the ACL</secondary>
24528 </indexterm>
24529 This option gives a list of DKIM domains for which the DKIM ACL is run.
24530 It is expanded after the message is received; by default it runs
24531 the ACL once for each signature in the message.
24532 See chapter <xref linkend="CHAPdkim"/>.
24533 </para>
24534 <para>
24535 <indexterm role="option">
24536 <primary><option>dns_again_means_nonexist</option></primary>
24537 </indexterm>
24538 </para>
24539 <informaltable frame="all">
24540 <tgroup cols="4" colsep="0" rowsep="0">
24541 <colspec colwidth="8*" align="left"/>
24542 <colspec colwidth="6*" align="center"/>
24543 <colspec colwidth="6*" align="center"/>
24544 <colspec colwidth="6*" align="right"/>
24545 <tbody>
24546 <row>
24547 <entry><option>dns_again_means_nonexist</option></entry>
24548 <entry>Use: <emphasis>main</emphasis></entry>
24549 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24550 <entry>Default: <emphasis>unset</emphasis></entry>
24551 </row>
24552 </tbody>
24553 </tgroup>
24554 </informaltable>
24555 <para>
24556 <indexterm role="concept">
24557 <primary>DNS</primary>
24558 <secondary><quote>try again</quote> response; overriding</secondary>
24559 </indexterm>
24560 DNS lookups give a <quote>try again</quote> response for the DNS errors
24561 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
24562 keep trying to deliver a message, or to give repeated temporary errors to
24563 incoming mail. Sometimes the effect is caused by a badly set up name server and
24564 may persist for a long time. If a domain which exhibits this problem matches
24565 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
24566 This option should be used with care. You can make it apply to reverse lookups
24567 by a setting such as this:
24568 </para>
24569 <literallayout class="monospaced">
24570 dns_again_means_nonexist = *.in-addr.arpa
24571 </literallayout>
24572 <para>
24573 This option applies to all DNS lookups that Exim does. It also applies when the
24574 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
24575 since these are most likely to be caused by DNS lookup problems. The
24576 <command>dnslookup</command> router has some options of its own for controlling what happens
24577 when lookups for MX or SRV records give temporary errors. These more specific
24578 options are applied after this global option.
24579 </para>
24580 <para>
24581 <indexterm role="option">
24582 <primary><option>dns_check_names_pattern</option></primary>
24583 </indexterm>
24584 </para>
24585 <informaltable frame="all">
24586 <tgroup cols="4" colsep="0" rowsep="0">
24587 <colspec colwidth="8*" align="left"/>
24588 <colspec colwidth="6*" align="center"/>
24589 <colspec colwidth="6*" align="center"/>
24590 <colspec colwidth="6*" align="right"/>
24591 <tbody>
24592 <row>
24593 <entry><option>dns_check_names_pattern</option></entry>
24594 <entry>Use: <emphasis>main</emphasis></entry>
24595 <entry>Type: <emphasis>string</emphasis></entry>
24596 <entry>Default: <emphasis>see below</emphasis></entry>
24597 </row>
24598 </tbody>
24599 </tgroup>
24600 </informaltable>
24601 <para>
24602 <indexterm role="concept">
24603 <primary>DNS</primary>
24604 <secondary>pre-check of name syntax</secondary>
24605 </indexterm>
24606 When this option is set to a non-empty string, it causes Exim to check domain
24607 names for characters that are not allowed in host names before handing them to
24608 the DNS resolver, because some resolvers give temporary errors for names that
24609 contain unusual characters. If a domain name contains any unwanted characters,
24610 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
24611 done by matching the domain name against a regular expression, which is the
24612 value of this option. The default pattern is
24613 </para>
24614 <literallayout class="monospaced">
24615 dns_check_names_pattern = \
24616   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
24617 </literallayout>
24618 <para>
24619 which permits only letters, digits, slashes, and hyphens in components, but
24620 they must start and end with a letter or digit. Slashes are not, in fact,
24621 permitted in host names, but they are found in certain NS records (which can be
24622 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
24623 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
24624 empty string.
24625 </para>
24626 <para>
24627 <indexterm role="option">
24628 <primary><option>dns_csa_search_limit</option></primary>
24629 </indexterm>
24630 </para>
24631 <informaltable frame="all">
24632 <tgroup cols="4" colsep="0" rowsep="0">
24633 <colspec colwidth="8*" align="left"/>
24634 <colspec colwidth="6*" align="center"/>
24635 <colspec colwidth="6*" align="center"/>
24636 <colspec colwidth="6*" align="right"/>
24637 <tbody>
24638 <row>
24639 <entry><option>dns_csa_search_limit</option></entry>
24640 <entry>Use: <emphasis>main</emphasis></entry>
24641 <entry>Type: <emphasis>integer</emphasis></entry>
24642 <entry>Default: <emphasis>5</emphasis></entry>
24643 </row>
24644 </tbody>
24645 </tgroup>
24646 </informaltable>
24647 <para>
24648 This option controls the depth of parental searching for CSA SRV records in the
24649 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
24650 </para>
24651 <para>
24652 <indexterm role="option">
24653 <primary><option>dns_csa_use_reverse</option></primary>
24654 </indexterm>
24655 </para>
24656 <informaltable frame="all">
24657 <tgroup cols="4" colsep="0" rowsep="0">
24658 <colspec colwidth="8*" align="left"/>
24659 <colspec colwidth="6*" align="center"/>
24660 <colspec colwidth="6*" align="center"/>
24661 <colspec colwidth="6*" align="right"/>
24662 <tbody>
24663 <row>
24664 <entry><option>dns_csa_use_reverse</option></entry>
24665 <entry>Use: <emphasis>main</emphasis></entry>
24666 <entry>Type: <emphasis>boolean</emphasis></entry>
24667 <entry>Default: <emphasis>true</emphasis></entry>
24668 </row>
24669 </tbody>
24670 </tgroup>
24671 </informaltable>
24672 <para>
24673 This option controls whether or not an IP address, given as a CSA domain, is
24674 reversed and looked up in the reverse DNS, as described in more detail in
24675 section <xref linkend="SECTverifyCSA"/>.
24676 </para>
24677 <para>
24678 <indexterm role="option">
24679 <primary><option>dns_dnssec_ok</option></primary>
24680 </indexterm>
24681 </para>
24682 <informaltable frame="all">
24683 <tgroup cols="4" colsep="0" rowsep="0">
24684 <colspec colwidth="8*" align="left"/>
24685 <colspec colwidth="6*" align="center"/>
24686 <colspec colwidth="6*" align="center"/>
24687 <colspec colwidth="6*" align="right"/>
24688 <tbody>
24689 <row>
24690 <entry><option>dns_dnssec_ok</option></entry>
24691 <entry>Use: <emphasis>main</emphasis></entry>
24692 <entry>Type: <emphasis>integer</emphasis></entry>
24693 <entry>Default: <emphasis>-1</emphasis></entry>
24694 </row>
24695 </tbody>
24696 </tgroup>
24697 </informaltable>
24698 <para>
24699 <indexterm role="concept">
24700 <primary>DNS</primary>
24701 <secondary>resolver options</secondary>
24702 </indexterm>
24703 <indexterm role="concept">
24704 <primary>DNS</primary>
24705 <secondary>DNSSEC</secondary>
24706 </indexterm>
24707 If this option is set to a non-negative number then Exim will initialise the
24708 DNS resolver library to either use or not use DNSSEC, overriding the system
24709 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
24710 </para>
24711 <para>
24712 If the resolver library does not support DNSSEC then this option has no effect.
24713 </para>
24714 <para>
24715 <indexterm role="option">
24716 <primary><option>dns_ipv4_lookup</option></primary>
24717 </indexterm>
24718 </para>
24719 <informaltable frame="all">
24720 <tgroup cols="4" colsep="0" rowsep="0">
24721 <colspec colwidth="8*" align="left"/>
24722 <colspec colwidth="6*" align="center"/>
24723 <colspec colwidth="6*" align="center"/>
24724 <colspec colwidth="6*" align="right"/>
24725 <tbody>
24726 <row>
24727 <entry><option>dns_ipv4_lookup</option></entry>
24728 <entry>Use: <emphasis>main</emphasis></entry>
24729 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24730 <entry>Default: <emphasis>unset</emphasis></entry>
24731 </row>
24732 </tbody>
24733 </tgroup>
24734 </informaltable>
24735 <para>
24736 <indexterm role="concept">
24737 <primary>IPv6</primary>
24738 <secondary>DNS lookup for AAAA records</secondary>
24739 </indexterm>
24740 <indexterm role="concept">
24741 <primary>DNS</primary>
24742 <secondary>IPv6 lookup for AAAA records</secondary>
24743 </indexterm>
24744 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
24745 looks for IPv6 address records (AAAA records) as well as IPv4 address records
24746 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
24747 domain matches this list.
24748 </para>
24749 <para>
24750 This is a fudge to help with name servers that give big delays or otherwise do
24751 not work for the AAAA record type. In due course, when the world&#x2019;s name
24752 servers have all been upgraded, there should be no need for this option.
24753 </para>
24754 <para>
24755 <indexterm role="option">
24756 <primary><option>dns_retrans</option></primary>
24757 </indexterm>
24758 </para>
24759 <informaltable frame="all">
24760 <tgroup cols="4" colsep="0" rowsep="0">
24761 <colspec colwidth="8*" align="left"/>
24762 <colspec colwidth="6*" align="center"/>
24763 <colspec colwidth="6*" align="center"/>
24764 <colspec colwidth="6*" align="right"/>
24765 <tbody>
24766 <row>
24767 <entry><option>dns_retrans</option></entry>
24768 <entry>Use: <emphasis>main</emphasis></entry>
24769 <entry>Type: <emphasis>time</emphasis></entry>
24770 <entry>Default: <emphasis>0s</emphasis></entry>
24771 </row>
24772 </tbody>
24773 </tgroup>
24774 </informaltable>
24775 <para>
24776 <indexterm role="concept">
24777 <primary>DNS</primary>
24778 <secondary>resolver options</secondary>
24779 </indexterm>
24780 <indexterm role="concept">
24781 <primary>timeout</primary>
24782 <secondary>dns lookup</secondary>
24783 </indexterm>
24784 <indexterm role="concept">
24785 <primary>DNS</primary>
24786 <secondary>timeout</secondary>
24787 </indexterm>
24788 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24789 retransmission and retry parameters for DNS lookups. Values of zero (the
24790 defaults) leave the system default settings unchanged. The first value is the
24791 time between retries, and the second is the number of retries. It isn&#x2019;t
24792 totally clear exactly how these settings affect the total time a DNS lookup may
24793 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24794 parameter values are available in the external resolver interface structure,
24795 but nowhere does it seem to describe how they are used or what you might want
24796 to set in them.
24797 See also the <option>slow_lookup_log</option> option.
24798 </para>
24799 <para>
24800 <indexterm role="option">
24801 <primary><option>dns_retry</option></primary>
24802 </indexterm>
24803 </para>
24804 <informaltable frame="all">
24805 <tgroup cols="4" colsep="0" rowsep="0">
24806 <colspec colwidth="8*" align="left"/>
24807 <colspec colwidth="6*" align="center"/>
24808 <colspec colwidth="6*" align="center"/>
24809 <colspec colwidth="6*" align="right"/>
24810 <tbody>
24811 <row>
24812 <entry><option>dns_retry</option></entry>
24813 <entry>Use: <emphasis>main</emphasis></entry>
24814 <entry>Type: <emphasis>integer</emphasis></entry>
24815 <entry>Default: <emphasis>0</emphasis></entry>
24816 </row>
24817 </tbody>
24818 </tgroup>
24819 </informaltable>
24820 <para>
24821 See <option>dns_retrans</option> above.
24822 </para>
24823 <para>
24824 <indexterm role="option">
24825 <primary><option>dns_trust_aa</option></primary>
24826 </indexterm>
24827 </para>
24828 <informaltable frame="all">
24829 <tgroup cols="4" colsep="0" rowsep="0">
24830 <colspec colwidth="8*" align="left"/>
24831 <colspec colwidth="6*" align="center"/>
24832 <colspec colwidth="6*" align="center"/>
24833 <colspec colwidth="6*" align="right"/>
24834 <tbody>
24835 <row>
24836 <entry><option>dns_trust_aa</option></entry>
24837 <entry>Use: <emphasis>main</emphasis></entry>
24838 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24839 <entry>Default: <emphasis>unset</emphasis></entry>
24840 </row>
24841 </tbody>
24842 </tgroup>
24843 </informaltable>
24844 <para>
24845 <indexterm role="concept">
24846 <primary>DNS</primary>
24847 <secondary>resolver options</secondary>
24848 </indexterm>
24849 <indexterm role="concept">
24850 <primary>DNS</primary>
24851 <secondary>DNSSEC</secondary>
24852 </indexterm>
24853 If this option is set then lookup results marked with the AA bit
24854 (Authoritative Answer) are trusted the same way as if they were
24855 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24856 match with this expanded domain list.
24857 </para>
24858 <para>
24859 Use this option only if you talk directly to a resolver that is
24860 authoritative for some zones and does not set the AD (Authentic Data)
24861 bit in the answer. Some DNS servers may have an configuration option to
24862 mark the answers from their own zones as verified (they set the AD bit).
24863 Others do not have this option. It is considered as poor practice using
24864 a resolver that is an authoritative server for some zones.
24865 </para>
24866 <para>
24867 Use this option only if you really have to (e.g. if you want
24868 to use DANE for remote delivery to a server that is listed in the DNS
24869 zones that your resolver is authoritative for).
24870 </para>
24871 <para>
24872 If the DNS answer packet has the AA bit set and contains resource record
24873 in the answer section, the name of the first NS record appearing in the
24874 authority section is compared against the list. If the answer packet is
24875 authoritative but the answer section is empty, the name of the first SOA
24876 record in the authoritative section is used instead.
24877 </para>
24878 <para>
24879 <indexterm role="concept">
24880 <primary>DNS</primary>
24881 <secondary>resolver options</secondary>
24882 </indexterm>
24883 <indexterm role="option">
24884 <primary><option>dns_use_edns0</option></primary>
24885 </indexterm>
24886 </para>
24887 <informaltable frame="all">
24888 <tgroup cols="4" colsep="0" rowsep="0">
24889 <colspec colwidth="8*" align="left"/>
24890 <colspec colwidth="6*" align="center"/>
24891 <colspec colwidth="6*" align="center"/>
24892 <colspec colwidth="6*" align="right"/>
24893 <tbody>
24894 <row>
24895 <entry><option>dns_use_edns0</option></entry>
24896 <entry>Use: <emphasis>main</emphasis></entry>
24897 <entry>Type: <emphasis>integer</emphasis></entry>
24898 <entry>Default: <emphasis>-1</emphasis></entry>
24899 </row>
24900 </tbody>
24901 </tgroup>
24902 </informaltable>
24903 <para>
24904 <indexterm role="concept">
24905 <primary>DNS</primary>
24906 <secondary>resolver options</secondary>
24907 </indexterm>
24908 <indexterm role="concept">
24909 <primary>DNS</primary>
24910 <secondary>EDNS0</secondary>
24911 </indexterm>
24912 <indexterm role="concept">
24913 <primary>DNS</primary>
24914 <secondary>OpenBSD</secondary>
24915 </indexterm>
24916 If this option is set to a non-negative number then Exim will initialise the
24917 DNS resolver library to either use or not use EDNS0 extensions, overriding
24918 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
24919 on.
24920 </para>
24921 <para>
24922 If the resolver library does not support EDNS0 then this option has no effect.
24923 </para>
24924 <para revisionflag="changed">
24925 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
24926 means that DNSSEC will not work with Exim on that platform either, unless Exim
24927 is linked against an alternative DNS client library.
24928 </para>
24929 <para>
24930 <indexterm role="option">
24931 <primary><option>drop_cr</option></primary>
24932 </indexterm>
24933 </para>
24934 <informaltable frame="all">
24935 <tgroup cols="4" colsep="0" rowsep="0">
24936 <colspec colwidth="8*" align="left"/>
24937 <colspec colwidth="6*" align="center"/>
24938 <colspec colwidth="6*" align="center"/>
24939 <colspec colwidth="6*" align="right"/>
24940 <tbody>
24941 <row>
24942 <entry><option>drop_cr</option></entry>
24943 <entry>Use: <emphasis>main</emphasis></entry>
24944 <entry>Type: <emphasis>boolean</emphasis></entry>
24945 <entry>Default: <emphasis>false</emphasis></entry>
24946 </row>
24947 </tbody>
24948 </tgroup>
24949 </informaltable>
24950 <para>
24951 This is an obsolete option that is now a no-op. It used to affect the way Exim
24952 handled CR and LF characters in incoming messages. What happens now is
24953 described in section <xref linkend="SECTlineendings"/>.
24954 </para>
24955 <para>
24956 <indexterm role="option">
24957 <primary><option>dsn_advertise_hosts</option></primary>
24958 </indexterm>
24959 </para>
24960 <informaltable frame="all">
24961 <tgroup cols="4" colsep="0" rowsep="0">
24962 <colspec colwidth="8*" align="left"/>
24963 <colspec colwidth="6*" align="center"/>
24964 <colspec colwidth="6*" align="center"/>
24965 <colspec colwidth="6*" align="right"/>
24966 <tbody>
24967 <row>
24968 <entry><option>dsn_advertise_hosts</option></entry>
24969 <entry>Use: <emphasis>main</emphasis></entry>
24970 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24971 <entry>Default: <emphasis>unset</emphasis></entry>
24972 </row>
24973 </tbody>
24974 </tgroup>
24975 </informaltable>
24976 <para>
24977 <indexterm role="concept">
24978 <primary>bounce messages</primary>
24979 <secondary>success</secondary>
24980 </indexterm>
24981 <indexterm role="concept">
24982 <primary>DSN</primary>
24983 <secondary>success</secondary>
24984 </indexterm>
24985 <indexterm role="concept">
24986 <primary>Delivery Status Notification</primary>
24987 <secondary>success</secondary>
24988 </indexterm>
24989 DSN extensions (RFC3461) will be advertised in the EHLO message to,
24990 and accepted from, these hosts.
24991 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
24992 and RET and ORCPT options on MAIL FROM commands.
24993 A NOTIFY=SUCCESS option requests success-DSN messages.
24994 A NOTIFY= option with no argument requests that no delay or failure DSNs
24995 are sent.
24996 </para>
24997 <para>
24998 <indexterm role="option">
24999 <primary><option>dsn_from</option></primary>
25000 </indexterm>
25001 </para>
25002 <informaltable frame="all">
25003 <tgroup cols="4" colsep="0" rowsep="0">
25004 <colspec colwidth="8*" align="left"/>
25005 <colspec colwidth="6*" align="center"/>
25006 <colspec colwidth="6*" align="center"/>
25007 <colspec colwidth="6*" align="right"/>
25008 <tbody>
25009 <row>
25010 <entry><option>dsn_from</option></entry>
25011 <entry>Use: <emphasis>main</emphasis></entry>
25012 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25013 <entry>Default: <emphasis>see below</emphasis></entry>
25014 </row>
25015 </tbody>
25016 </tgroup>
25017 </informaltable>
25018 <para>
25019 <indexterm role="concept">
25020 <primary><emphasis>From:</emphasis> header line</primary>
25021 <secondary>in bounces</secondary>
25022 </indexterm>
25023 <indexterm role="concept">
25024 <primary>bounce messages</primary>
25025 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
25026 </indexterm>
25027 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
25028 bounces and other automatically generated messages (<quote>Delivery Status
25029 Notifications</quote> &ndash; hence the name of the option). The default setting is:
25030 </para>
25031 <literallayout class="monospaced">
25032 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
25033 </literallayout>
25034 <para>
25035 The value is expanded every time it is needed. If the expansion fails, a
25036 panic is logged, and the default value is used.
25037 </para>
25038 <para>
25039 <indexterm role="option">
25040 <primary><option>envelope_to_remove</option></primary>
25041 </indexterm>
25042 </para>
25043 <informaltable frame="all">
25044 <tgroup cols="4" colsep="0" rowsep="0">
25045 <colspec colwidth="8*" align="left"/>
25046 <colspec colwidth="6*" align="center"/>
25047 <colspec colwidth="6*" align="center"/>
25048 <colspec colwidth="6*" align="right"/>
25049 <tbody>
25050 <row>
25051 <entry><option>envelope_to_remove</option></entry>
25052 <entry>Use: <emphasis>main</emphasis></entry>
25053 <entry>Type: <emphasis>boolean</emphasis></entry>
25054 <entry>Default: <emphasis>true</emphasis></entry>
25055 </row>
25056 </tbody>
25057 </tgroup>
25058 </informaltable>
25059 <para>
25060 <indexterm role="concept">
25061 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
25062 </indexterm>
25063 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
25064 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25065 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
25066 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
25067 be present in incoming messages, and this option causes them to be removed at
25068 the time the message is received, to avoid any problems that might occur when a
25069 delivered message is subsequently sent on to some other recipient.
25070 </para>
25071 <para>
25072 <indexterm role="option">
25073 <primary><option>errors_copy</option></primary>
25074 </indexterm>
25075 </para>
25076 <informaltable frame="all">
25077 <tgroup cols="4" colsep="0" rowsep="0">
25078 <colspec colwidth="8*" align="left"/>
25079 <colspec colwidth="6*" align="center"/>
25080 <colspec colwidth="6*" align="center"/>
25081 <colspec colwidth="6*" align="right"/>
25082 <tbody>
25083 <row>
25084 <entry><option>errors_copy</option></entry>
25085 <entry>Use: <emphasis>main</emphasis></entry>
25086 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25087 <entry>Default: <emphasis>unset</emphasis></entry>
25088 </row>
25089 </tbody>
25090 </tgroup>
25091 </informaltable>
25092 <para>
25093 <indexterm role="concept">
25094 <primary>bounce message</primary>
25095 <secondary>copy to other address</secondary>
25096 </indexterm>
25097 <indexterm role="concept">
25098 <primary>copy of bounce message</primary>
25099 </indexterm>
25100 Setting this option causes Exim to send bcc copies of bounce messages that it
25101 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
25102 coming from elsewhere. The value of the option is a colon-separated list of
25103 items. Each item consists of a pattern, terminated by white space, followed by
25104 a comma-separated list of email addresses. If a pattern contains spaces, it
25105 must be enclosed in double quotes.
25106 </para>
25107 <para>
25108 Each pattern is processed in the same way as a single item in an address list
25109 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
25110 the bounce message, the message is copied to the addresses on the list. The
25111 items are scanned in order, and once a matching one is found, no further items
25112 are examined. For example:
25113 </para>
25114 <literallayout class="monospaced">
25115 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
25116               rqps@mydomain   hostmaster@mydomain.example,\
25117                               postmaster@mydomain.example
25118 </literallayout>
25119 <para>
25120 <indexterm role="variable">
25121 <primary><varname>$domain</varname></primary>
25122 </indexterm>
25123 <indexterm role="variable">
25124 <primary><varname>$local_part</varname></primary>
25125 </indexterm>
25126 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
25127 and <varname>$domain</varname> are set from the original recipient of the error message, and if
25128 there was any wildcard matching in the pattern, the expansion
25129 <indexterm role="concept">
25130 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25131 <secondary>in <option>errors_copy</option></secondary>
25132 </indexterm>
25133 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
25134 </para>
25135 <para>
25136 <indexterm role="option">
25137 <primary><option>errors_reply_to</option></primary>
25138 </indexterm>
25139 </para>
25140 <informaltable frame="all">
25141 <tgroup cols="4" colsep="0" rowsep="0">
25142 <colspec colwidth="8*" align="left"/>
25143 <colspec colwidth="6*" align="center"/>
25144 <colspec colwidth="6*" align="center"/>
25145 <colspec colwidth="6*" align="right"/>
25146 <tbody>
25147 <row>
25148 <entry><option>errors_reply_to</option></entry>
25149 <entry>Use: <emphasis>main</emphasis></entry>
25150 <entry>Type: <emphasis>string</emphasis></entry>
25151 <entry>Default: <emphasis>unset</emphasis></entry>
25152 </row>
25153 </tbody>
25154 </tgroup>
25155 </informaltable>
25156 <para>
25157 <indexterm role="concept">
25158 <primary>bounce message</primary>
25159 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
25160 </indexterm>
25161 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
25162 </para>
25163 <literallayout>
25164 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
25165 </literallayout>
25166 <para>
25167 <indexterm role="option">
25168 <primary><option>quota_warn_message</option></primary>
25169 </indexterm>
25170 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
25171 A warning message that is generated by the <option>quota_warn_message</option> option in an
25172 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
25173 overrides the default.
25174 </para>
25175 <para>
25176 Experience shows that people reply to bounce messages. If the
25177 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
25178 and warning messages. For example:
25179 </para>
25180 <literallayout class="monospaced">
25181 errors_reply_to = postmaster@my.domain.example
25182 </literallayout>
25183 <para>
25184 The value of the option is not expanded. It must specify a valid RFC 2822
25185 address. However, if a warning message that is generated by the
25186 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
25187 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
25188 not used.
25189 </para>
25190 <para>
25191 <indexterm role="option">
25192 <primary><option>event_action</option></primary>
25193 </indexterm>
25194 </para>
25195 <informaltable frame="all">
25196 <tgroup cols="4" colsep="0" rowsep="0">
25197 <colspec colwidth="8*" align="left"/>
25198 <colspec colwidth="6*" align="center"/>
25199 <colspec colwidth="6*" align="center"/>
25200 <colspec colwidth="6*" align="right"/>
25201 <tbody>
25202 <row>
25203 <entry><option>event_action</option></entry>
25204 <entry>Use: <emphasis>main</emphasis></entry>
25205 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25206 <entry>Default: <emphasis>unset</emphasis></entry>
25207 </row>
25208 </tbody>
25209 </tgroup>
25210 </informaltable>
25211 <para>
25212 <indexterm role="concept">
25213 <primary>events</primary>
25214 </indexterm>
25215 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
25216 For details see chapter <xref linkend="CHAPevents"/>.
25217 </para>
25218 <para>
25219 <indexterm role="option">
25220 <primary><option>exim_group</option></primary>
25221 </indexterm>
25222 </para>
25223 <informaltable frame="all">
25224 <tgroup cols="4" colsep="0" rowsep="0">
25225 <colspec colwidth="8*" align="left"/>
25226 <colspec colwidth="6*" align="center"/>
25227 <colspec colwidth="6*" align="center"/>
25228 <colspec colwidth="6*" align="right"/>
25229 <tbody>
25230 <row>
25231 <entry><option>exim_group</option></entry>
25232 <entry>Use: <emphasis>main</emphasis></entry>
25233 <entry>Type: <emphasis>string</emphasis></entry>
25234 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25235 </row>
25236 </tbody>
25237 </tgroup>
25238 </informaltable>
25239 <para>
25240 <indexterm role="concept">
25241 <primary>gid (group id)</primary>
25242 <secondary>Exim&#x2019;s own</secondary>
25243 </indexterm>
25244 <indexterm role="concept">
25245 <primary>Exim group</primary>
25246 </indexterm>
25247 This option changes the gid under which Exim runs when it gives up root
25248 privilege. The default value is compiled into the binary. The value of this
25249 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
25250 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
25251 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
25252 security issues.
25253 </para>
25254 <para>
25255 <indexterm role="option">
25256 <primary><option>exim_path</option></primary>
25257 </indexterm>
25258 </para>
25259 <informaltable frame="all">
25260 <tgroup cols="4" colsep="0" rowsep="0">
25261 <colspec colwidth="8*" align="left"/>
25262 <colspec colwidth="6*" align="center"/>
25263 <colspec colwidth="6*" align="center"/>
25264 <colspec colwidth="6*" align="right"/>
25265 <tbody>
25266 <row>
25267 <entry><option>exim_path</option></entry>
25268 <entry>Use: <emphasis>main</emphasis></entry>
25269 <entry>Type: <emphasis>string</emphasis></entry>
25270 <entry>Default: <emphasis>see below</emphasis></entry>
25271 </row>
25272 </tbody>
25273 </tgroup>
25274 </informaltable>
25275 <para>
25276 <indexterm role="concept">
25277 <primary>Exim binary, path name</primary>
25278 </indexterm>
25279 This option specifies the path name of the Exim binary, which is used when Exim
25280 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
25281 the directory configured at compile time by the BIN_DIRECTORY setting. It
25282 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
25283 other place.
25284 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
25285 you will break those Exim utilities that scan the configuration file to find
25286 where the binary is. (They then use the <option>-bP</option> option to extract option
25287 settings such as the value of <option>spool_directory</option>.)
25288 </para>
25289 <para>
25290 <indexterm role="option">
25291 <primary><option>exim_user</option></primary>
25292 </indexterm>
25293 </para>
25294 <informaltable frame="all">
25295 <tgroup cols="4" colsep="0" rowsep="0">
25296 <colspec colwidth="8*" align="left"/>
25297 <colspec colwidth="6*" align="center"/>
25298 <colspec colwidth="6*" align="center"/>
25299 <colspec colwidth="6*" align="right"/>
25300 <tbody>
25301 <row>
25302 <entry><option>exim_user</option></entry>
25303 <entry>Use: <emphasis>main</emphasis></entry>
25304 <entry>Type: <emphasis>string</emphasis></entry>
25305 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25306 </row>
25307 </tbody>
25308 </tgroup>
25309 </informaltable>
25310 <para>
25311 <indexterm role="concept">
25312 <primary>uid (user id)</primary>
25313 <secondary>Exim&#x2019;s own</secondary>
25314 </indexterm>
25315 <indexterm role="concept">
25316 <primary>Exim user</primary>
25317 </indexterm>
25318 This option changes the uid under which Exim runs when it gives up root
25319 privilege. The default value is compiled into the binary. Ownership of the run
25320 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25321 options is checked against the values in the binary, not what is set here.
25322 </para>
25323 <para>
25324 Unless it consists entirely of digits, the string is looked up using
25325 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25326 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25327 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25328 </para>
25329 <para>
25330 <indexterm role="option">
25331 <primary><option>extra_local_interfaces</option></primary>
25332 </indexterm>
25333 </para>
25334 <informaltable frame="all">
25335 <tgroup cols="4" colsep="0" rowsep="0">
25336 <colspec colwidth="8*" align="left"/>
25337 <colspec colwidth="6*" align="center"/>
25338 <colspec colwidth="6*" align="center"/>
25339 <colspec colwidth="6*" align="right"/>
25340 <tbody>
25341 <row>
25342 <entry><option>extra_local_interfaces</option></entry>
25343 <entry>Use: <emphasis>main</emphasis></entry>
25344 <entry>Type: <emphasis>string list</emphasis></entry>
25345 <entry>Default: <emphasis>unset</emphasis></entry>
25346 </row>
25347 </tbody>
25348 </tgroup>
25349 </informaltable>
25350 <para>
25351 This option defines network interfaces that are to be considered local when
25352 routing, but which are not used for listening by the daemon. See section
25353 <xref linkend="SECTreclocipadd"/> for details.
25354 </para>
25355 <para>
25356 <indexterm role="option">
25357 <primary><option>extract_addresses_remove_arguments</option></primary>
25358 </indexterm>
25359 </para>
25360 <informaltable frame="all">
25361 <tgroup cols="4" colsep="0" rowsep="0">
25362 <colspec colwidth="8*" align="left"/>
25363 <colspec colwidth="6*" align="center"/>
25364 <colspec colwidth="6*" align="center"/>
25365 <colspec colwidth="6*" align="right"/>
25366 <tbody>
25367 <row>
25368 <entry><option>extract_addresses_remove_arguments</option></entry>
25369 <entry>Use: <emphasis>main</emphasis></entry>
25370 <entry>Type: <emphasis>boolean</emphasis></entry>
25371 <entry>Default: <emphasis>true</emphasis></entry>
25372 </row>
25373 </tbody>
25374 </tgroup>
25375 </informaltable>
25376 <para>
25377 <indexterm role="option">
25378 <primary><option>-t</option></primary>
25379 </indexterm>
25380 <indexterm role="concept">
25381 <primary>command line</primary>
25382 <secondary>addresses with <option>-t</option></secondary>
25383 </indexterm>
25384 <indexterm role="concept">
25385 <primary>Sendmail compatibility</primary>
25386 <secondary><option>-t</option> option</secondary>
25387 </indexterm>
25388 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
25389 are present on the command line when the <option>-t</option> option is used to build an
25390 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
25391 line addresses are removed from the recipients list. This is also how Smail
25392 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
25393 command line addresses are added to those obtained from the header lines. When
25394 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
25395 argument headers. If it is set false, Exim adds rather than removes argument
25396 addresses.
25397 </para>
25398 <para>
25399 <indexterm role="option">
25400 <primary><option>finduser_retries</option></primary>
25401 </indexterm>
25402 </para>
25403 <informaltable frame="all">
25404 <tgroup cols="4" colsep="0" rowsep="0">
25405 <colspec colwidth="8*" align="left"/>
25406 <colspec colwidth="6*" align="center"/>
25407 <colspec colwidth="6*" align="center"/>
25408 <colspec colwidth="6*" align="right"/>
25409 <tbody>
25410 <row>
25411 <entry><option>finduser_retries</option></entry>
25412 <entry>Use: <emphasis>main</emphasis></entry>
25413 <entry>Type: <emphasis>integer</emphasis></entry>
25414 <entry>Default: <emphasis>0</emphasis></entry>
25415 </row>
25416 </tbody>
25417 </tgroup>
25418 </informaltable>
25419 <para>
25420 <indexterm role="concept">
25421 <primary>NIS, retrying user lookups</primary>
25422 </indexterm>
25423 On systems running NIS or other schemes in which user and group information is
25424 distributed from a remote system, there can be times when <function>getpwnam()</function> and
25425 related functions fail, even when given valid data, because things time out.
25426 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
25427 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
25428 many extra times to find a user or a group, waiting for one second between
25429 retries.
25430 </para>
25431 <para>
25432 <indexterm role="concept">
25433 <primary><filename>/etc/passwd</filename></primary>
25434 <secondary>multiple reading of</secondary>
25435 </indexterm>
25436 You should not set this option greater than zero if your user information is in
25437 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
25438 search the file multiple times for non-existent users, and also cause delay.
25439 </para>
25440 <para>
25441 <indexterm role="option">
25442 <primary><option>freeze_tell</option></primary>
25443 </indexterm>
25444 </para>
25445 <informaltable frame="all">
25446 <tgroup cols="4" colsep="0" rowsep="0">
25447 <colspec colwidth="8*" align="left"/>
25448 <colspec colwidth="6*" align="center"/>
25449 <colspec colwidth="6*" align="center"/>
25450 <colspec colwidth="6*" align="right"/>
25451 <tbody>
25452 <row>
25453 <entry><option>freeze_tell</option></entry>
25454 <entry>Use: <emphasis>main</emphasis></entry>
25455 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
25456 <entry>Default: <emphasis>unset</emphasis></entry>
25457 </row>
25458 </tbody>
25459 </tgroup>
25460 </informaltable>
25461 <para>
25462 <indexterm role="concept">
25463 <primary>freezing messages</primary>
25464 <secondary>sending a message when freezing</secondary>
25465 </indexterm>
25466 On encountering certain errors, or when configured to do so in a system filter,
25467 ACL, or special router, Exim freezes a message. This means that no further
25468 delivery attempts take place until an administrator thaws the message, or the
25469 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
25470 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
25471 warning message whenever it freezes something, unless the message it is
25472 freezing is a locally-generated bounce message. (Without this exception there
25473 is the possibility of looping.) The warning message is sent to the addresses
25474 supplied as the comma-separated value of this option. If several of the
25475 message&#x2019;s addresses cause freezing, only a single message is sent. If the
25476 freezing was automatic, the reason(s) for freezing can be found in the message
25477 log. If you configure freezing in a filter or ACL, you must arrange for any
25478 logging that you require.
25479 </para>
25480 <para>
25481 <indexterm role="option">
25482 <primary><option>gecos_name</option></primary>
25483 </indexterm>
25484 </para>
25485 <informaltable frame="all">
25486 <tgroup cols="4" colsep="0" rowsep="0">
25487 <colspec colwidth="8*" align="left"/>
25488 <colspec colwidth="6*" align="center"/>
25489 <colspec colwidth="6*" align="center"/>
25490 <colspec colwidth="6*" align="right"/>
25491 <tbody>
25492 <row>
25493 <entry><option>gecos_name</option></entry>
25494 <entry>Use: <emphasis>main</emphasis></entry>
25495 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25496 <entry>Default: <emphasis>unset</emphasis></entry>
25497 </row>
25498 </tbody>
25499 </tgroup>
25500 </informaltable>
25501 <para>
25502 <indexterm role="concept">
25503 <primary>HP-UX</primary>
25504 </indexterm>
25505 <indexterm role="concept">
25506 <primary><quote>gecos</quote> field, parsing</primary>
25507 </indexterm>
25508 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
25509 password file to hold other information in addition to users&#x2019; real names. Exim
25510 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
25511 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
25512 of the field are used unchanged, except that, if an ampersand is encountered,
25513 it is replaced by the user&#x2019;s login name with the first character forced to
25514 upper case, since this is a convention that is observed on many systems.
25515 </para>
25516 <para>
25517 When these options are set, <option>gecos_pattern</option> is treated as a regular
25518 expression that is to be applied to the field (again with &amp; replaced by the
25519 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
25520 user&#x2019;s name.
25521 </para>
25522 <para>
25523 <indexterm role="concept">
25524 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25525 <secondary>in <option>gecos_name</option></secondary>
25526 </indexterm>
25527 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
25528 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
25529 name terminates at the first comma, the following can be used:
25530 </para>
25531 <literallayout class="monospaced">
25532 gecos_pattern = ([^,]*)
25533 gecos_name = $1
25534 </literallayout>
25535 <para>
25536 <indexterm role="option">
25537 <primary><option>gecos_pattern</option></primary>
25538 </indexterm>
25539 </para>
25540 <informaltable frame="all">
25541 <tgroup cols="4" colsep="0" rowsep="0">
25542 <colspec colwidth="8*" align="left"/>
25543 <colspec colwidth="6*" align="center"/>
25544 <colspec colwidth="6*" align="center"/>
25545 <colspec colwidth="6*" align="right"/>
25546 <tbody>
25547 <row>
25548 <entry><option>gecos_pattern</option></entry>
25549 <entry>Use: <emphasis>main</emphasis></entry>
25550 <entry>Type: <emphasis>string</emphasis></entry>
25551 <entry>Default: <emphasis>unset</emphasis></entry>
25552 </row>
25553 </tbody>
25554 </tgroup>
25555 </informaltable>
25556 <para>
25557 See <option>gecos_name</option> above.
25558 </para>
25559 <para>
25560 <indexterm role="option">
25561 <primary><option>gnutls_compat_mode</option></primary>
25562 </indexterm>
25563 </para>
25564 <informaltable frame="all">
25565 <tgroup cols="4" colsep="0" rowsep="0">
25566 <colspec colwidth="8*" align="left"/>
25567 <colspec colwidth="6*" align="center"/>
25568 <colspec colwidth="6*" align="center"/>
25569 <colspec colwidth="6*" align="right"/>
25570 <tbody>
25571 <row>
25572 <entry><option>gnutls_compat_mode</option></entry>
25573 <entry>Use: <emphasis>main</emphasis></entry>
25574 <entry>Type: <emphasis>boolean</emphasis></entry>
25575 <entry>Default: <emphasis>unset</emphasis></entry>
25576 </row>
25577 </tbody>
25578 </tgroup>
25579 </informaltable>
25580 <para>
25581 This option controls whether GnuTLS is used in compatibility mode in an Exim
25582 server. This reduces security slightly, but improves interworking with older
25583 implementations of TLS.
25584 </para>
25585 <para>
25586 option gnutls_allow_auto_pkcs11 main boolean unset
25587 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
25588 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
25589 </para>
25590 <para>
25591 See
25592 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs">http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs</ulink></emphasis>
25593 for documentation.
25594 </para>
25595 <para>
25596 <indexterm role="option">
25597 <primary><option>headers_charset</option></primary>
25598 </indexterm>
25599 </para>
25600 <informaltable frame="all">
25601 <tgroup cols="4" colsep="0" rowsep="0">
25602 <colspec colwidth="8*" align="left"/>
25603 <colspec colwidth="6*" align="center"/>
25604 <colspec colwidth="6*" align="center"/>
25605 <colspec colwidth="6*" align="right"/>
25606 <tbody>
25607 <row>
25608 <entry><option>headers_charset</option></entry>
25609 <entry>Use: <emphasis>main</emphasis></entry>
25610 <entry>Type: <emphasis>string</emphasis></entry>
25611 <entry>Default: <emphasis>see below</emphasis></entry>
25612 </row>
25613 </tbody>
25614 </tgroup>
25615 </informaltable>
25616 <para>
25617 This option sets a default character set for translating from encoded MIME
25618 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
25619 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
25620 ultimate default is ISO-8859-1. For more details see the description of header
25621 insertions in section <xref linkend="SECTexpansionitems"/>.
25622 </para>
25623 <para>
25624 <indexterm role="option">
25625 <primary><option>header_maxsize</option></primary>
25626 </indexterm>
25627 </para>
25628 <informaltable frame="all">
25629 <tgroup cols="4" colsep="0" rowsep="0">
25630 <colspec colwidth="8*" align="left"/>
25631 <colspec colwidth="6*" align="center"/>
25632 <colspec colwidth="6*" align="center"/>
25633 <colspec colwidth="6*" align="right"/>
25634 <tbody>
25635 <row>
25636 <entry><option>header_maxsize</option></entry>
25637 <entry>Use: <emphasis>main</emphasis></entry>
25638 <entry>Type: <emphasis>integer</emphasis></entry>
25639 <entry>Default: <emphasis>see below</emphasis></entry>
25640 </row>
25641 </tbody>
25642 </tgroup>
25643 </informaltable>
25644 <para>
25645 <indexterm role="concept">
25646 <primary>header section</primary>
25647 <secondary>maximum size of</secondary>
25648 </indexterm>
25649 <indexterm role="concept">
25650 <primary>limit</primary>
25651 <secondary>size of message header section</secondary>
25652 </indexterm>
25653 This option controls the overall maximum size of a message&#x2019;s header
25654 section. The default is the value of HEADER_MAXSIZE in
25655 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
25656 sections are rejected.
25657 </para>
25658 <para>
25659 <indexterm role="option">
25660 <primary><option>header_line_maxsize</option></primary>
25661 </indexterm>
25662 </para>
25663 <informaltable frame="all">
25664 <tgroup cols="4" colsep="0" rowsep="0">
25665 <colspec colwidth="8*" align="left"/>
25666 <colspec colwidth="6*" align="center"/>
25667 <colspec colwidth="6*" align="center"/>
25668 <colspec colwidth="6*" align="right"/>
25669 <tbody>
25670 <row>
25671 <entry><option>header_line_maxsize</option></entry>
25672 <entry>Use: <emphasis>main</emphasis></entry>
25673 <entry>Type: <emphasis>integer</emphasis></entry>
25674 <entry>Default: <emphasis>0</emphasis></entry>
25675 </row>
25676 </tbody>
25677 </tgroup>
25678 </informaltable>
25679 <para>
25680 <indexterm role="concept">
25681 <primary>header lines</primary>
25682 <secondary>maximum size of</secondary>
25683 </indexterm>
25684 <indexterm role="concept">
25685 <primary>limit</primary>
25686 <secondary>size of one header line</secondary>
25687 </indexterm>
25688 This option limits the length of any individual header line in a message, after
25689 all the continuations have been joined together. Messages with individual
25690 header lines that are longer than the limit are rejected. The default value of
25691 zero means <quote>no limit</quote>.
25692 </para>
25693 <para>
25694 <indexterm role="option">
25695 <primary><option>helo_accept_junk_hosts</option></primary>
25696 </indexterm>
25697 </para>
25698 <informaltable frame="all">
25699 <tgroup cols="4" colsep="0" rowsep="0">
25700 <colspec colwidth="8*" align="left"/>
25701 <colspec colwidth="6*" align="center"/>
25702 <colspec colwidth="6*" align="center"/>
25703 <colspec colwidth="6*" align="right"/>
25704 <tbody>
25705 <row>
25706 <entry><option>helo_accept_junk_hosts</option></entry>
25707 <entry>Use: <emphasis>main</emphasis></entry>
25708 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25709 <entry>Default: <emphasis>unset</emphasis></entry>
25710 </row>
25711 </tbody>
25712 </tgroup>
25713 </informaltable>
25714 <para>
25715 <indexterm role="concept">
25716 <primary>HELO</primary>
25717 <secondary>accepting junk data</secondary>
25718 </indexterm>
25719 <indexterm role="concept">
25720 <primary>EHLO</primary>
25721 <secondary>accepting junk data</secondary>
25722 </indexterm>
25723 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
25724 mail, and gives an error response for invalid data. Unfortunately, there are
25725 some SMTP clients that send syntactic junk. They can be accommodated by setting
25726 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
25727 if you want to do semantic checking.
25728 See also <option>helo_allow_chars</option> for a way of extending the permitted character
25729 set.
25730 </para>
25731 <para>
25732 <indexterm role="option">
25733 <primary><option>helo_allow_chars</option></primary>
25734 </indexterm>
25735 </para>
25736 <informaltable frame="all">
25737 <tgroup cols="4" colsep="0" rowsep="0">
25738 <colspec colwidth="8*" align="left"/>
25739 <colspec colwidth="6*" align="center"/>
25740 <colspec colwidth="6*" align="center"/>
25741 <colspec colwidth="6*" align="right"/>
25742 <tbody>
25743 <row>
25744 <entry><option>helo_allow_chars</option></entry>
25745 <entry>Use: <emphasis>main</emphasis></entry>
25746 <entry>Type: <emphasis>string</emphasis></entry>
25747 <entry>Default: <emphasis>unset</emphasis></entry>
25748 </row>
25749 </tbody>
25750 </tgroup>
25751 </informaltable>
25752 <para>
25753 <indexterm role="concept">
25754 <primary>HELO</primary>
25755 <secondary>underscores in</secondary>
25756 </indexterm>
25757 <indexterm role="concept">
25758 <primary>EHLO</primary>
25759 <secondary>underscores in</secondary>
25760 </indexterm>
25761 <indexterm role="concept">
25762 <primary>underscore in EHLO/HELO</primary>
25763 </indexterm>
25764 This option can be set to a string of rogue characters that are permitted in
25765 all EHLO and HELO names in addition to the standard letters, digits,
25766 hyphens, and dots. If you really must allow underscores, you can set
25767 </para>
25768 <literallayout class="monospaced">
25769 helo_allow_chars = _
25770 </literallayout>
25771 <para>
25772 Note that the value is one string, not a list.
25773 </para>
25774 <para>
25775 <indexterm role="option">
25776 <primary><option>helo_lookup_domains</option></primary>
25777 </indexterm>
25778 </para>
25779 <informaltable frame="all">
25780 <tgroup cols="4" colsep="0" rowsep="0">
25781 <colspec colwidth="8*" align="left"/>
25782 <colspec colwidth="6*" align="center"/>
25783 <colspec colwidth="6*" align="center"/>
25784 <colspec colwidth="6*" align="right"/>
25785 <tbody>
25786 <row>
25787 <entry><option>helo_lookup_domains</option></entry>
25788 <entry>Use: <emphasis>main</emphasis></entry>
25789 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25790 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
25791 </row>
25792 </tbody>
25793 </tgroup>
25794 </informaltable>
25795 <para>
25796 <indexterm role="concept">
25797 <primary>HELO</primary>
25798 <secondary>forcing reverse lookup</secondary>
25799 </indexterm>
25800 <indexterm role="concept">
25801 <primary>EHLO</primary>
25802 <secondary>forcing reverse lookup</secondary>
25803 </indexterm>
25804 If the domain given by a client in a HELO or EHLO command matches this
25805 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25806 default forces a lookup if the client host gives the server&#x2019;s name or any of
25807 its IP addresses (in brackets), something that broken clients have been seen to
25808 do.
25809 </para>
25810 <para>
25811 <indexterm role="option">
25812 <primary><option>helo_try_verify_hosts</option></primary>
25813 </indexterm>
25814 </para>
25815 <informaltable frame="all">
25816 <tgroup cols="4" colsep="0" rowsep="0">
25817 <colspec colwidth="8*" align="left"/>
25818 <colspec colwidth="6*" align="center"/>
25819 <colspec colwidth="6*" align="center"/>
25820 <colspec colwidth="6*" align="right"/>
25821 <tbody>
25822 <row>
25823 <entry><option>helo_try_verify_hosts</option></entry>
25824 <entry>Use: <emphasis>main</emphasis></entry>
25825 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25826 <entry>Default: <emphasis>unset</emphasis></entry>
25827 </row>
25828 </tbody>
25829 </tgroup>
25830 </informaltable>
25831 <para>
25832 <indexterm role="concept">
25833 <primary>HELO verifying</primary>
25834 <secondary>optional</secondary>
25835 </indexterm>
25836 <indexterm role="concept">
25837 <primary>EHLO</primary>
25838 <secondary>verifying, optional</secondary>
25839 </indexterm>
25840 By default, Exim just checks the syntax of HELO and EHLO commands (see
25841 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25842 to do more extensive checking of the data supplied by these commands. The ACL
25843 condition <literal>verify = helo</literal> is provided to make this possible.
25844 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25845 to force the check to occur. From release 4.53 onwards, this is no longer
25846 necessary. If the check has not been done before <literal>verify = helo</literal> is
25847 encountered, it is done at that time. Consequently, this option is obsolete.
25848 Its specification is retained here for backwards compatibility.
25849 </para>
25850 <para>
25851 When an EHLO or HELO command is received, if the calling host matches
25852 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25853 EHLO command either:
25854 </para>
25855 <itemizedlist>
25856 <listitem>
25857 <para>
25858 is an IP literal matching the calling address of the host, or
25859 </para>
25860 </listitem>
25861 <listitem>
25862 <para>
25863 <indexterm role="concept">
25864 <primary>DNS</primary>
25865 <secondary>reverse lookup</secondary>
25866 </indexterm>
25867 <indexterm role="concept">
25868 <primary>reverse DNS lookup</primary>
25869 </indexterm>
25870 matches the host name that Exim obtains by doing a reverse lookup of the
25871 calling host address, or
25872 </para>
25873 </listitem>
25874 <listitem>
25875 <para>
25876 when looked up in DNS yields the calling host address.
25877 </para>
25878 </listitem>
25879 </itemizedlist>
25880 <para>
25881 However, the EHLO or HELO command is not rejected if any of the checks
25882 fail. Processing continues, but the result of the check is remembered, and can
25883 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25884 </para>
25885 <para>
25886 If DNS was used for successful verification, the variable
25887 <indexterm role="concept">
25888 <primary>DNS</primary>
25889 <secondary>DNSSEC</secondary>
25890 </indexterm>
25891 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
25892 </para>
25893 <para>
25894 <indexterm role="option">
25895 <primary><option>helo_verify_hosts</option></primary>
25896 </indexterm>
25897 </para>
25898 <informaltable frame="all">
25899 <tgroup cols="4" colsep="0" rowsep="0">
25900 <colspec colwidth="8*" align="left"/>
25901 <colspec colwidth="6*" align="center"/>
25902 <colspec colwidth="6*" align="center"/>
25903 <colspec colwidth="6*" align="right"/>
25904 <tbody>
25905 <row>
25906 <entry><option>helo_verify_hosts</option></entry>
25907 <entry>Use: <emphasis>main</emphasis></entry>
25908 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25909 <entry>Default: <emphasis>unset</emphasis></entry>
25910 </row>
25911 </tbody>
25912 </tgroup>
25913 </informaltable>
25914 <para>
25915 <indexterm role="concept">
25916 <primary>HELO verifying</primary>
25917 <secondary>mandatory</secondary>
25918 </indexterm>
25919 <indexterm role="concept">
25920 <primary>EHLO</primary>
25921 <secondary>verifying, mandatory</secondary>
25922 </indexterm>
25923 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
25924 backwards compatibility. For hosts that match this option, Exim checks the host
25925 name given in the HELO or EHLO in the same way as for
25926 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
25927 rejected with a 550 error, and entries are written to the main and reject logs.
25928 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
25929 error.
25930 </para>
25931 <para>
25932 <indexterm role="option">
25933 <primary><option>hold_domains</option></primary>
25934 </indexterm>
25935 </para>
25936 <informaltable frame="all">
25937 <tgroup cols="4" colsep="0" rowsep="0">
25938 <colspec colwidth="8*" align="left"/>
25939 <colspec colwidth="6*" align="center"/>
25940 <colspec colwidth="6*" align="center"/>
25941 <colspec colwidth="6*" align="right"/>
25942 <tbody>
25943 <row>
25944 <entry><option>hold_domains</option></entry>
25945 <entry>Use: <emphasis>main</emphasis></entry>
25946 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25947 <entry>Default: <emphasis>unset</emphasis></entry>
25948 </row>
25949 </tbody>
25950 </tgroup>
25951 </informaltable>
25952 <para>
25953 <indexterm role="concept">
25954 <primary>domain</primary>
25955 <secondary>delaying delivery</secondary>
25956 </indexterm>
25957 <indexterm role="concept">
25958 <primary>delivery</primary>
25959 <secondary>delaying certain domains</secondary>
25960 </indexterm>
25961 This option allows mail for particular domains to be held on the queue
25962 manually. The option is overridden if a message delivery is forced with the
25963 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
25964 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
25965 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
25966 it is deferred every time the message is looked at.
25967 </para>
25968 <para>
25969 This option is intended as a temporary operational measure for delaying the
25970 delivery of mail while some problem is being sorted out, or some new
25971 configuration tested. If you just want to delay the processing of some
25972 domains until a queue run occurs, you should use <option>queue_domains</option> or
25973 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
25974 </para>
25975 <para>
25976 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
25977 messages from the queue if they have been there longer than the longest retry
25978 time in any retry rule. If you want to hold messages for longer than the normal
25979 retry times, insert a dummy retry rule with a long retry time.
25980 </para>
25981 <para>
25982 <indexterm role="option">
25983 <primary><option>host_lookup</option></primary>
25984 </indexterm>
25985 </para>
25986 <informaltable frame="all">
25987 <tgroup cols="4" colsep="0" rowsep="0">
25988 <colspec colwidth="8*" align="left"/>
25989 <colspec colwidth="6*" align="center"/>
25990 <colspec colwidth="6*" align="center"/>
25991 <colspec colwidth="6*" align="right"/>
25992 <tbody>
25993 <row>
25994 <entry><option>host_lookup</option></entry>
25995 <entry>Use: <emphasis>main</emphasis></entry>
25996 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25997 <entry>Default: <emphasis>unset</emphasis></entry>
25998 </row>
25999 </tbody>
26000 </tgroup>
26001 </informaltable>
26002 <para>
26003 <indexterm role="concept">
26004 <primary>host name</primary>
26005 <secondary>lookup, forcing</secondary>
26006 </indexterm>
26007 Exim does not look up the name of a calling host from its IP address unless it
26008 is required to compare against some host list, or the host matches
26009 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
26010 option (which normally contains IP addresses rather than host names). The
26011 default configuration file contains
26012 </para>
26013 <literallayout class="monospaced">
26014 host_lookup = *
26015 </literallayout>
26016 <para>
26017 which causes a lookup to happen for all hosts. If the expense of these lookups
26018 is felt to be too great, the setting can be changed or removed.
26019 </para>
26020 <para>
26021 After a successful reverse lookup, Exim does a forward lookup on the name it
26022 has obtained, to verify that it yields the IP address that it started with. If
26023 this check fails, Exim behaves as if the name lookup failed.
26024 </para>
26025 <para>
26026 <indexterm role="variable">
26027 <primary><varname>$host_lookup_failed</varname></primary>
26028 </indexterm>
26029 <indexterm role="variable">
26030 <primary><varname>$sender_host_name</varname></primary>
26031 </indexterm>
26032 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
26033 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
26034 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
26035 <literal>verify = reverse_host_lookup</literal> in ACLs.
26036 </para>
26037 <para>
26038 <indexterm role="option">
26039 <primary><option>host_lookup_order</option></primary>
26040 </indexterm>
26041 </para>
26042 <informaltable frame="all">
26043 <tgroup cols="4" colsep="0" rowsep="0">
26044 <colspec colwidth="8*" align="left"/>
26045 <colspec colwidth="6*" align="center"/>
26046 <colspec colwidth="6*" align="center"/>
26047 <colspec colwidth="6*" align="right"/>
26048 <tbody>
26049 <row>
26050 <entry><option>host_lookup_order</option></entry>
26051 <entry>Use: <emphasis>main</emphasis></entry>
26052 <entry>Type: <emphasis>string list</emphasis></entry>
26053 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
26054 </row>
26055 </tbody>
26056 </tgroup>
26057 </informaltable>
26058 <para>
26059 This option specifies the order of different lookup methods when Exim is trying
26060 to find a host name from an IP address. The default is to do a DNS lookup
26061 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
26062 if that fails. You can change the order of these lookups, or omit one entirely,
26063 if you want.
26064 </para>
26065 <para>
26066 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
26067 multiple PTR records in the DNS and the IP address is not listed in
26068 <filename>/etc/hosts</filename>. Different operating systems give different results in this
26069 case. That is why the default tries a DNS lookup first.
26070 </para>
26071 <para>
26072 <indexterm role="option">
26073 <primary><option>host_reject_connection</option></primary>
26074 </indexterm>
26075 </para>
26076 <informaltable frame="all">
26077 <tgroup cols="4" colsep="0" rowsep="0">
26078 <colspec colwidth="8*" align="left"/>
26079 <colspec colwidth="6*" align="center"/>
26080 <colspec colwidth="6*" align="center"/>
26081 <colspec colwidth="6*" align="right"/>
26082 <tbody>
26083 <row>
26084 <entry><option>host_reject_connection</option></entry>
26085 <entry>Use: <emphasis>main</emphasis></entry>
26086 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26087 <entry>Default: <emphasis>unset</emphasis></entry>
26088 </row>
26089 </tbody>
26090 </tgroup>
26091 </informaltable>
26092 <para>
26093 <indexterm role="concept">
26094 <primary>host</primary>
26095 <secondary>rejecting connections from</secondary>
26096 </indexterm>
26097 If this option is set, incoming SMTP calls from the hosts listed are rejected
26098 as soon as the connection is made.
26099 This option is obsolete, and retained only for backward compatibility, because
26100 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
26101 connections immediately.
26102 </para>
26103 <para>
26104 The ability to give an immediate rejection (either by this option or using an
26105 ACL) is provided for use in unusual cases. Many hosts will just try again,
26106 sometimes without much delay. Normally, it is better to use an ACL to reject
26107 incoming messages at a later stage, such as after RCPT commands. See
26108 chapter <xref linkend="CHAPACL"/>.
26109 </para>
26110 <para>
26111 <indexterm role="option">
26112 <primary><option>hosts_connection_nolog</option></primary>
26113 </indexterm>
26114 </para>
26115 <informaltable frame="all">
26116 <tgroup cols="4" colsep="0" rowsep="0">
26117 <colspec colwidth="8*" align="left"/>
26118 <colspec colwidth="6*" align="center"/>
26119 <colspec colwidth="6*" align="center"/>
26120 <colspec colwidth="6*" align="right"/>
26121 <tbody>
26122 <row>
26123 <entry><option>hosts_connection_nolog</option></entry>
26124 <entry>Use: <emphasis>main</emphasis></entry>
26125 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26126 <entry>Default: <emphasis>unset</emphasis></entry>
26127 </row>
26128 </tbody>
26129 </tgroup>
26130 </informaltable>
26131 <para>
26132 <indexterm role="concept">
26133 <primary>host</primary>
26134 <secondary>not logging connections from</secondary>
26135 </indexterm>
26136 This option defines a list of hosts for which connection logging does not
26137 happen, even though the <option>smtp_connection</option> log selector is set. For example,
26138 you might want not to log SMTP connections from local processes, or from
26139 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
26140 the daemon; you should therefore strive to restrict its value to a short inline
26141 list of IP addresses and networks. To disable logging SMTP connections from
26142 local processes, you must create a host list with an empty item. For example:
26143 </para>
26144 <literallayout class="monospaced">
26145 hosts_connection_nolog = :
26146 </literallayout>
26147 <para>
26148 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
26149 </para>
26150 <para>
26151 <indexterm role="option">
26152 <primary><option>hosts_proxy</option></primary>
26153 </indexterm>
26154 </para>
26155 <informaltable frame="all">
26156 <tgroup cols="4" colsep="0" rowsep="0">
26157 <colspec colwidth="8*" align="left"/>
26158 <colspec colwidth="6*" align="center"/>
26159 <colspec colwidth="6*" align="center"/>
26160 <colspec colwidth="6*" align="right"/>
26161 <tbody>
26162 <row>
26163 <entry><option>hosts_proxy</option></entry>
26164 <entry>Use: <emphasis>main</emphasis></entry>
26165 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26166 <entry>Default: <emphasis>unset</emphasis></entry>
26167 </row>
26168 </tbody>
26169 </tgroup>
26170 </informaltable>
26171 <para>
26172 <indexterm role="concept">
26173 <primary>proxy</primary>
26174 <secondary>proxy protocol</secondary>
26175 </indexterm>
26176 This option enables use of Proxy Protocol proxies for incoming
26177 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
26178 </para>
26179 <para>
26180 <indexterm role="option">
26181 <primary><option>hosts_treat_as_local</option></primary>
26182 </indexterm>
26183 </para>
26184 <informaltable frame="all">
26185 <tgroup cols="4" colsep="0" rowsep="0">
26186 <colspec colwidth="8*" align="left"/>
26187 <colspec colwidth="6*" align="center"/>
26188 <colspec colwidth="6*" align="center"/>
26189 <colspec colwidth="6*" align="right"/>
26190 <tbody>
26191 <row>
26192 <entry><option>hosts_treat_as_local</option></entry>
26193 <entry>Use: <emphasis>main</emphasis></entry>
26194 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26195 <entry>Default: <emphasis>unset</emphasis></entry>
26196 </row>
26197 </tbody>
26198 </tgroup>
26199 </informaltable>
26200 <para>
26201 <indexterm role="concept">
26202 <primary>local host</primary>
26203 <secondary>domains treated as</secondary>
26204 </indexterm>
26205 <indexterm role="concept">
26206 <primary>host</primary>
26207 <secondary>treated as local</secondary>
26208 </indexterm>
26209 If this option is set, any host names that match the domain list are treated as
26210 if they were the local host when Exim is scanning host lists obtained from MX
26211 records
26212 or other sources. Note that the value of this option is a domain list, not a
26213 host list, because it is always used to check host names, not IP addresses.
26214 </para>
26215 <para>
26216 This option also applies when Exim is matching the special items
26217 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
26218 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
26219 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
26220 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
26221 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
26222 interfaces and recognizing the local host.
26223 </para>
26224 <para>
26225 <indexterm role="option">
26226 <primary><option>ibase_servers</option></primary>
26227 </indexterm>
26228 </para>
26229 <informaltable frame="all">
26230 <tgroup cols="4" colsep="0" rowsep="0">
26231 <colspec colwidth="8*" align="left"/>
26232 <colspec colwidth="6*" align="center"/>
26233 <colspec colwidth="6*" align="center"/>
26234 <colspec colwidth="6*" align="right"/>
26235 <tbody>
26236 <row>
26237 <entry><option>ibase_servers</option></entry>
26238 <entry>Use: <emphasis>main</emphasis></entry>
26239 <entry>Type: <emphasis>string list</emphasis></entry>
26240 <entry>Default: <emphasis>unset</emphasis></entry>
26241 </row>
26242 </tbody>
26243 </tgroup>
26244 </informaltable>
26245 <para>
26246 <indexterm role="concept">
26247 <primary>InterBase</primary>
26248 <secondary>server list</secondary>
26249 </indexterm>
26250 This option provides a list of InterBase servers and associated connection data,
26251 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
26252 The option is available only if Exim has been built with InterBase support.
26253 </para>
26254 <para>
26255 <indexterm role="option">
26256 <primary><option>ignore_bounce_errors_after</option></primary>
26257 </indexterm>
26258 </para>
26259 <informaltable frame="all">
26260 <tgroup cols="4" colsep="0" rowsep="0">
26261 <colspec colwidth="8*" align="left"/>
26262 <colspec colwidth="6*" align="center"/>
26263 <colspec colwidth="6*" align="center"/>
26264 <colspec colwidth="6*" align="right"/>
26265 <tbody>
26266 <row>
26267 <entry><option>ignore_bounce_errors_after</option></entry>
26268 <entry>Use: <emphasis>main</emphasis></entry>
26269 <entry>Type: <emphasis>time</emphasis></entry>
26270 <entry>Default: <emphasis>10w</emphasis></entry>
26271 </row>
26272 </tbody>
26273 </tgroup>
26274 </informaltable>
26275 <para>
26276 <indexterm role="concept">
26277 <primary>bounce message</primary>
26278 <secondary>discarding</secondary>
26279 </indexterm>
26280 <indexterm role="concept">
26281 <primary>discarding bounce message</primary>
26282 </indexterm>
26283 This option affects the processing of bounce messages that cannot be delivered,
26284 that is, those that suffer a permanent delivery failure. (Bounce messages that
26285 suffer temporary delivery failures are of course retried in the usual way.)
26286 </para>
26287 <para>
26288 After a permanent delivery failure, bounce messages are frozen,
26289 because there is no sender to whom they can be returned. When a frozen bounce
26290 message has been on the queue for more than the given time, it is unfrozen at
26291 the next queue run, and a further delivery is attempted. If delivery fails
26292 again, the bounce message is discarded. This makes it possible to keep failed
26293 bounce messages around for a shorter time than the normal maximum retry time
26294 for frozen messages. For example,
26295 </para>
26296 <literallayout class="monospaced">
26297 ignore_bounce_errors_after = 12h
26298 </literallayout>
26299 <para>
26300 retries failed bounce message deliveries after 12 hours, discarding any further
26301 failures. If the value of this option is set to a zero time period, bounce
26302 failures are discarded immediately. Setting a very long time (as in the default
26303 value) has the effect of disabling this option. For ways of automatically
26304 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
26305 <option>timeout_frozen_after</option>.
26306 </para>
26307 <para>
26308 <indexterm role="option">
26309 <primary><option>ignore_fromline_hosts</option></primary>
26310 </indexterm>
26311 </para>
26312 <informaltable frame="all">
26313 <tgroup cols="4" colsep="0" rowsep="0">
26314 <colspec colwidth="8*" align="left"/>
26315 <colspec colwidth="6*" align="center"/>
26316 <colspec colwidth="6*" align="center"/>
26317 <colspec colwidth="6*" align="right"/>
26318 <tbody>
26319 <row>
26320 <entry><option>ignore_fromline_hosts</option></entry>
26321 <entry>Use: <emphasis>main</emphasis></entry>
26322 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26323 <entry>Default: <emphasis>unset</emphasis></entry>
26324 </row>
26325 </tbody>
26326 </tgroup>
26327 </informaltable>
26328 <para>
26329 <indexterm role="concept">
26330 <primary><quote>From</quote> line</primary>
26331 </indexterm>
26332 <indexterm role="concept">
26333 <primary>UUCP</primary>
26334 <secondary><quote>From</quote> line</secondary>
26335 </indexterm>
26336 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26337 the headers of a message. By default this is treated as the start of the
26338 message&#x2019;s body, which means that any following headers are not recognized as
26339 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26340 match those hosts that insist on sending it. If the sender is actually a local
26341 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
26342 <option>ignore_fromline_local</option> must be set to achieve this effect.
26343 </para>
26344 <para>
26345 <indexterm role="option">
26346 <primary><option>ignore_fromline_local</option></primary>
26347 </indexterm>
26348 </para>
26349 <informaltable frame="all">
26350 <tgroup cols="4" colsep="0" rowsep="0">
26351 <colspec colwidth="8*" align="left"/>
26352 <colspec colwidth="6*" align="center"/>
26353 <colspec colwidth="6*" align="center"/>
26354 <colspec colwidth="6*" align="right"/>
26355 <tbody>
26356 <row>
26357 <entry><option>ignore_fromline_local</option></entry>
26358 <entry>Use: <emphasis>main</emphasis></entry>
26359 <entry>Type: <emphasis>boolean</emphasis></entry>
26360 <entry>Default: <emphasis>false</emphasis></entry>
26361 </row>
26362 </tbody>
26363 </tgroup>
26364 </informaltable>
26365 <para>
26366 See <option>ignore_fromline_hosts</option> above.
26367 </para>
26368 <para>
26369 <indexterm role="option">
26370 <primary><option>keep_environment</option></primary>
26371 </indexterm>
26372 </para>
26373 <informaltable frame="all">
26374 <tgroup cols="4" colsep="0" rowsep="0">
26375 <colspec colwidth="8*" align="left"/>
26376 <colspec colwidth="6*" align="center"/>
26377 <colspec colwidth="6*" align="center"/>
26378 <colspec colwidth="6*" align="right"/>
26379 <tbody>
26380 <row>
26381 <entry><option>keep_environment</option></entry>
26382 <entry>Use: <emphasis>main</emphasis></entry>
26383 <entry>Type: <emphasis>string list</emphasis></entry>
26384 <entry>Default: <emphasis>unset</emphasis></entry>
26385 </row>
26386 </tbody>
26387 </tgroup>
26388 </informaltable>
26389 <para>
26390 <indexterm role="concept">
26391 <primary>environment</primary>
26392 <secondary>values from</secondary>
26393 </indexterm>
26394 This option contains a string list of environment variables to keep.
26395 You have to trust these variables or you have to be sure that
26396 these variables do not impose any security risk. Keep in mind that
26397 during the startup phase Exim is running with an effective UID 0 in most
26398 installations. As the default value is an empty list, the default
26399 environment for using libraries, running embedded Perl code, or running
26400 external binaries is empty, and does not not even contain PATH or HOME.
26401 </para>
26402 <para>
26403 Actually the list is interpreted as a list of patterns
26404 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
26405 </para>
26406 <para>
26407 WARNING: Macro substitution is still done first, so having a macro
26408 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
26409 unexpected results. You may work around this using a regular expression
26410 that does not match the macro name: ^[F]OO_HOME$.
26411 </para>
26412 <para>
26413 Current versions of Exim issue a warning during startup if you do not mention
26414 <option>keep_environment</option> in your runtime configuration file and if your
26415 current environment is not empty. Future versions may not issue that warning
26416 anymore.
26417 </para>
26418 <para>
26419 See the <option>add_environment</option> main config option for a way to set
26420 environment variables to a fixed value.  The environment for <command>pipe</command>
26421 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
26422 details.
26423 </para>
26424 <para>
26425 <indexterm role="option">
26426 <primary><option>keep_malformed</option></primary>
26427 </indexterm>
26428 </para>
26429 <informaltable frame="all">
26430 <tgroup cols="4" colsep="0" rowsep="0">
26431 <colspec colwidth="8*" align="left"/>
26432 <colspec colwidth="6*" align="center"/>
26433 <colspec colwidth="6*" align="center"/>
26434 <colspec colwidth="6*" align="right"/>
26435 <tbody>
26436 <row>
26437 <entry><option>keep_malformed</option></entry>
26438 <entry>Use: <emphasis>main</emphasis></entry>
26439 <entry>Type: <emphasis>time</emphasis></entry>
26440 <entry>Default: <emphasis>4d</emphasis></entry>
26441 </row>
26442 </tbody>
26443 </tgroup>
26444 </informaltable>
26445 <para>
26446 This option specifies the length of time to keep messages whose spool files
26447 have been corrupted in some way. This should, of course, never happen. At the
26448 next attempt to deliver such a message, it gets removed. The incident is
26449 logged.
26450 </para>
26451 <para>
26452 <indexterm role="option">
26453 <primary><option>ldap_ca_cert_dir</option></primary>
26454 </indexterm>
26455 </para>
26456 <informaltable frame="all">
26457 <tgroup cols="4" colsep="0" rowsep="0">
26458 <colspec colwidth="8*" align="left"/>
26459 <colspec colwidth="6*" align="center"/>
26460 <colspec colwidth="6*" align="center"/>
26461 <colspec colwidth="6*" align="right"/>
26462 <tbody>
26463 <row>
26464 <entry><option>ldap_ca_cert_dir</option></entry>
26465 <entry>Use: <emphasis>main</emphasis></entry>
26466 <entry>Type: <emphasis>string</emphasis></entry>
26467 <entry>Default: <emphasis>unset</emphasis></entry>
26468 </row>
26469 </tbody>
26470 </tgroup>
26471 </informaltable>
26472 <para>
26473 <indexterm role="concept">
26474 <primary>LDAP</primary>
26475 <secondary>,</secondary>
26476 </indexterm>
26477 <indexterm role="concept">
26478 <primary>certificate</primary>
26479 <secondary>directory for LDAP</secondary>
26480 </indexterm>
26481 This option indicates which directory contains CA certificates for verifying
26482 a TLS certificate presented by an LDAP server.
26483 While Exim does not provide a default value, your SSL library may.
26484 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26485 and constrained to be a directory.
26486 </para>
26487 <para>
26488 <indexterm role="option">
26489 <primary><option>ldap_ca_cert_file</option></primary>
26490 </indexterm>
26491 </para>
26492 <informaltable frame="all">
26493 <tgroup cols="4" colsep="0" rowsep="0">
26494 <colspec colwidth="8*" align="left"/>
26495 <colspec colwidth="6*" align="center"/>
26496 <colspec colwidth="6*" align="center"/>
26497 <colspec colwidth="6*" align="right"/>
26498 <tbody>
26499 <row>
26500 <entry><option>ldap_ca_cert_file</option></entry>
26501 <entry>Use: <emphasis>main</emphasis></entry>
26502 <entry>Type: <emphasis>string</emphasis></entry>
26503 <entry>Default: <emphasis>unset</emphasis></entry>
26504 </row>
26505 </tbody>
26506 </tgroup>
26507 </informaltable>
26508 <para>
26509 <indexterm role="concept">
26510 <primary>LDAP</primary>
26511 <secondary>,</secondary>
26512 </indexterm>
26513 <indexterm role="concept">
26514 <primary>certificate</primary>
26515 <secondary>file for LDAP</secondary>
26516 </indexterm>
26517 This option indicates which file contains CA certificates for verifying
26518 a TLS certificate presented by an LDAP server.
26519 While Exim does not provide a default value, your SSL library may.
26520 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26521 and constrained to be a file.
26522 </para>
26523 <para>
26524 <indexterm role="option">
26525 <primary><option>ldap_cert_file</option></primary>
26526 </indexterm>
26527 </para>
26528 <informaltable frame="all">
26529 <tgroup cols="4" colsep="0" rowsep="0">
26530 <colspec colwidth="8*" align="left"/>
26531 <colspec colwidth="6*" align="center"/>
26532 <colspec colwidth="6*" align="center"/>
26533 <colspec colwidth="6*" align="right"/>
26534 <tbody>
26535 <row>
26536 <entry><option>ldap_cert_file</option></entry>
26537 <entry>Use: <emphasis>main</emphasis></entry>
26538 <entry>Type: <emphasis>string</emphasis></entry>
26539 <entry>Default: <emphasis>unset</emphasis></entry>
26540 </row>
26541 </tbody>
26542 </tgroup>
26543 </informaltable>
26544 <para>
26545 <indexterm role="concept">
26546 <primary>LDAP</primary>
26547 <secondary>TLS client certificate file</secondary>
26548 </indexterm>
26549 <indexterm role="concept">
26550 <primary>certificate</primary>
26551 <secondary>file for LDAP</secondary>
26552 </indexterm>
26553 This option indicates which file contains an TLS client certificate which
26554 Exim should present to the LDAP server during TLS negotiation.
26555 Should be used together with <option>ldap_cert_key</option>.
26556 </para>
26557 <para>
26558 <indexterm role="option">
26559 <primary><option>ldap_cert_key</option></primary>
26560 </indexterm>
26561 </para>
26562 <informaltable frame="all">
26563 <tgroup cols="4" colsep="0" rowsep="0">
26564 <colspec colwidth="8*" align="left"/>
26565 <colspec colwidth="6*" align="center"/>
26566 <colspec colwidth="6*" align="center"/>
26567 <colspec colwidth="6*" align="right"/>
26568 <tbody>
26569 <row>
26570 <entry><option>ldap_cert_key</option></entry>
26571 <entry>Use: <emphasis>main</emphasis></entry>
26572 <entry>Type: <emphasis>string</emphasis></entry>
26573 <entry>Default: <emphasis>unset</emphasis></entry>
26574 </row>
26575 </tbody>
26576 </tgroup>
26577 </informaltable>
26578 <para>
26579 <indexterm role="concept">
26580 <primary>LDAP</primary>
26581 <secondary>TLS client key file</secondary>
26582 </indexterm>
26583 <indexterm role="concept">
26584 <primary>certificate</primary>
26585 <secondary>key for LDAP</secondary>
26586 </indexterm>
26587 This option indicates which file contains the secret/private key to use
26588 to prove identity to the LDAP server during TLS negotiation.
26589 Should be used together with <option>ldap_cert_file</option>, which contains the
26590 identity to be proven.
26591 </para>
26592 <para>
26593 <indexterm role="option">
26594 <primary><option>ldap_cipher_suite</option></primary>
26595 </indexterm>
26596 </para>
26597 <informaltable frame="all">
26598 <tgroup cols="4" colsep="0" rowsep="0">
26599 <colspec colwidth="8*" align="left"/>
26600 <colspec colwidth="6*" align="center"/>
26601 <colspec colwidth="6*" align="center"/>
26602 <colspec colwidth="6*" align="right"/>
26603 <tbody>
26604 <row>
26605 <entry><option>ldap_cipher_suite</option></entry>
26606 <entry>Use: <emphasis>main</emphasis></entry>
26607 <entry>Type: <emphasis>string</emphasis></entry>
26608 <entry>Default: <emphasis>unset</emphasis></entry>
26609 </row>
26610 </tbody>
26611 </tgroup>
26612 </informaltable>
26613 <para>
26614 <indexterm role="concept">
26615 <primary>LDAP</primary>
26616 <secondary>TLS cipher suite</secondary>
26617 </indexterm>
26618 This controls the TLS cipher-suite negotiation during TLS negotiation with
26619 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
26620 cipher-suite options with OpenSSL (as used by LDAP client libraries).
26621 </para>
26622 <para>
26623 <indexterm role="option">
26624 <primary><option>ldap_default_servers</option></primary>
26625 </indexterm>
26626 </para>
26627 <informaltable frame="all">
26628 <tgroup cols="4" colsep="0" rowsep="0">
26629 <colspec colwidth="8*" align="left"/>
26630 <colspec colwidth="6*" align="center"/>
26631 <colspec colwidth="6*" align="center"/>
26632 <colspec colwidth="6*" align="right"/>
26633 <tbody>
26634 <row>
26635 <entry><option>ldap_default_servers</option></entry>
26636 <entry>Use: <emphasis>main</emphasis></entry>
26637 <entry>Type: <emphasis>string list</emphasis></entry>
26638 <entry>Default: <emphasis>unset</emphasis></entry>
26639 </row>
26640 </tbody>
26641 </tgroup>
26642 </informaltable>
26643 <para>
26644 <indexterm role="concept">
26645 <primary>LDAP</primary>
26646 <secondary>default servers</secondary>
26647 </indexterm>
26648 This option provides a list of LDAP servers which are tried in turn when an
26649 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
26650 details of LDAP queries. This option is available only when Exim has been built
26651 with LDAP support.
26652 </para>
26653 <para>
26654 <indexterm role="option">
26655 <primary><option>ldap_require_cert</option></primary>
26656 </indexterm>
26657 </para>
26658 <informaltable frame="all">
26659 <tgroup cols="4" colsep="0" rowsep="0">
26660 <colspec colwidth="8*" align="left"/>
26661 <colspec colwidth="6*" align="center"/>
26662 <colspec colwidth="6*" align="center"/>
26663 <colspec colwidth="6*" align="right"/>
26664 <tbody>
26665 <row>
26666 <entry><option>ldap_require_cert</option></entry>
26667 <entry>Use: <emphasis>main</emphasis></entry>
26668 <entry>Type: <emphasis>string</emphasis></entry>
26669 <entry>Default: <emphasis>unset.</emphasis></entry>
26670 </row>
26671 </tbody>
26672 </tgroup>
26673 </informaltable>
26674 <para>
26675 <indexterm role="concept">
26676 <primary>LDAP</primary>
26677 <secondary>policy for LDAP server TLS cert presentation</secondary>
26678 </indexterm>
26679 This should be one of the values "hard", "demand", "allow", "try" or "never".
26680 A value other than one of these is interpreted as "never".
26681 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
26682 Although Exim does not set a default, the LDAP library probably defaults
26683 to hard/demand.
26684 </para>
26685 <para>
26686 <indexterm role="option">
26687 <primary><option>ldap_start_tls</option></primary>
26688 </indexterm>
26689 </para>
26690 <informaltable frame="all">
26691 <tgroup cols="4" colsep="0" rowsep="0">
26692 <colspec colwidth="8*" align="left"/>
26693 <colspec colwidth="6*" align="center"/>
26694 <colspec colwidth="6*" align="center"/>
26695 <colspec colwidth="6*" align="right"/>
26696 <tbody>
26697 <row>
26698 <entry><option>ldap_start_tls</option></entry>
26699 <entry>Use: <emphasis>main</emphasis></entry>
26700 <entry>Type: <emphasis>boolean</emphasis></entry>
26701 <entry>Default: <emphasis>false</emphasis></entry>
26702 </row>
26703 </tbody>
26704 </tgroup>
26705 </informaltable>
26706 <para>
26707 <indexterm role="concept">
26708 <primary>LDAP</primary>
26709 <secondary>whether or not to negotiate TLS</secondary>
26710 </indexterm>
26711 If set, Exim will attempt to negotiate TLS with the LDAP server when
26712 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
26713 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
26714 of SSL-on-connect.
26715 In the event of failure to negotiate TLS, the action taken is controlled
26716 by <option>ldap_require_cert</option>.
26717 </para>
26718 <para revisionflag="changed">
26719 This option is ignored for <literal>ldapi</literal> connections.
26720 </para>
26721 <para>
26722 <indexterm role="option">
26723 <primary><option>ldap_version</option></primary>
26724 </indexterm>
26725 </para>
26726 <informaltable frame="all">
26727 <tgroup cols="4" colsep="0" rowsep="0">
26728 <colspec colwidth="8*" align="left"/>
26729 <colspec colwidth="6*" align="center"/>
26730 <colspec colwidth="6*" align="center"/>
26731 <colspec colwidth="6*" align="right"/>
26732 <tbody>
26733 <row>
26734 <entry><option>ldap_version</option></entry>
26735 <entry>Use: <emphasis>main</emphasis></entry>
26736 <entry>Type: <emphasis>integer</emphasis></entry>
26737 <entry>Default: <emphasis>unset</emphasis></entry>
26738 </row>
26739 </tbody>
26740 </tgroup>
26741 </informaltable>
26742 <para>
26743 <indexterm role="concept">
26744 <primary>LDAP</primary>
26745 <secondary>protocol version, forcing</secondary>
26746 </indexterm>
26747 This option can be used to force Exim to set a specific protocol version for
26748 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
26749 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
26750 the LDAP headers; otherwise it is 2. This option is available only when Exim
26751 has been built with LDAP support.
26752 </para>
26753 <para>
26754 <indexterm role="option">
26755 <primary><option>local_from_check</option></primary>
26756 </indexterm>
26757 </para>
26758 <informaltable frame="all">
26759 <tgroup cols="4" colsep="0" rowsep="0">
26760 <colspec colwidth="8*" align="left"/>
26761 <colspec colwidth="6*" align="center"/>
26762 <colspec colwidth="6*" align="center"/>
26763 <colspec colwidth="6*" align="right"/>
26764 <tbody>
26765 <row>
26766 <entry><option>local_from_check</option></entry>
26767 <entry>Use: <emphasis>main</emphasis></entry>
26768 <entry>Type: <emphasis>boolean</emphasis></entry>
26769 <entry>Default: <emphasis>true</emphasis></entry>
26770 </row>
26771 </tbody>
26772 </tgroup>
26773 </informaltable>
26774 <para>
26775 <indexterm role="concept">
26776 <primary><emphasis>Sender:</emphasis> header line</primary>
26777 <secondary>disabling addition of</secondary>
26778 </indexterm>
26779 <indexterm role="concept">
26780 <primary><emphasis>From:</emphasis> header line</primary>
26781 <secondary>disabling checking of</secondary>
26782 </indexterm>
26783 When a message is submitted locally (that is, not over a TCP/IP connection) by
26784 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
26785 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
26786 the domain specified by <option>qualify_domain</option>.
26787 </para>
26788 <para>
26789 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
26790 locally submitted message is automatically qualified by Exim, unless the
26791 <option>-bnq</option> command line option is used.
26792 </para>
26793 <para>
26794 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
26795 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
26796 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
26797 and the default qualify domain.
26798 </para>
26799 <para>
26800 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
26801 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
26802 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
26803 <option>local_sender_retain</option> to be true.
26804 </para>
26805 <para>
26806 <indexterm role="concept">
26807 <primary>envelope sender</primary>
26808 </indexterm>
26809 These options affect only the header lines in the message. The envelope sender
26810 is still forced to be the login id at the qualify domain unless
26811 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
26812 </para>
26813 <para>
26814 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
26815 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
26816 has more details about <emphasis>Sender:</emphasis> processing.
26817 </para>
26818 <para>
26819 <indexterm role="option">
26820 <primary><option>local_from_prefix</option></primary>
26821 </indexterm>
26822 </para>
26823 <informaltable frame="all">
26824 <tgroup cols="4" colsep="0" rowsep="0">
26825 <colspec colwidth="8*" align="left"/>
26826 <colspec colwidth="6*" align="center"/>
26827 <colspec colwidth="6*" align="center"/>
26828 <colspec colwidth="6*" align="right"/>
26829 <tbody>
26830 <row>
26831 <entry><option>local_from_prefix</option></entry>
26832 <entry>Use: <emphasis>main</emphasis></entry>
26833 <entry>Type: <emphasis>string</emphasis></entry>
26834 <entry>Default: <emphasis>unset</emphasis></entry>
26835 </row>
26836 </tbody>
26837 </tgroup>
26838 </informaltable>
26839 <para>
26840 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
26841 matching the login id (see <option>local_from_check</option> above), it can be configured to
26842 ignore certain prefixes and suffixes in the local part of the address. This is
26843 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
26844 appropriate lists, in the same form as the <option>local_part_prefix</option> and
26845 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
26846 example, if
26847 </para>
26848 <literallayout class="monospaced">
26849 local_from_prefix = *-
26850 </literallayout>
26851 <para>
26852 is set, a <emphasis>From:</emphasis> line containing
26853 </para>
26854 <literallayout class="monospaced">
26855 From: anything-user@your.domain.example
26856 </literallayout>
26857 <para>
26858 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
26859 matches the actual sender address that is constructed from the login name and
26860 qualify domain.
26861 </para>
26862 <para>
26863 <indexterm role="option">
26864 <primary><option>local_from_suffix</option></primary>
26865 </indexterm>
26866 </para>
26867 <informaltable frame="all">
26868 <tgroup cols="4" colsep="0" rowsep="0">
26869 <colspec colwidth="8*" align="left"/>
26870 <colspec colwidth="6*" align="center"/>
26871 <colspec colwidth="6*" align="center"/>
26872 <colspec colwidth="6*" align="right"/>
26873 <tbody>
26874 <row>
26875 <entry><option>local_from_suffix</option></entry>
26876 <entry>Use: <emphasis>main</emphasis></entry>
26877 <entry>Type: <emphasis>string</emphasis></entry>
26878 <entry>Default: <emphasis>unset</emphasis></entry>
26879 </row>
26880 </tbody>
26881 </tgroup>
26882 </informaltable>
26883 <para>
26884 See <option>local_from_prefix</option> above.
26885 </para>
26886 <para>
26887 <indexterm role="option">
26888 <primary><option>local_interfaces</option></primary>
26889 </indexterm>
26890 </para>
26891 <informaltable frame="all">
26892 <tgroup cols="4" colsep="0" rowsep="0">
26893 <colspec colwidth="8*" align="left"/>
26894 <colspec colwidth="6*" align="center"/>
26895 <colspec colwidth="6*" align="center"/>
26896 <colspec colwidth="6*" align="right"/>
26897 <tbody>
26898 <row>
26899 <entry><option>local_interfaces</option></entry>
26900 <entry>Use: <emphasis>main</emphasis></entry>
26901 <entry>Type: <emphasis>string list</emphasis></entry>
26902 <entry>Default: <emphasis>see below</emphasis></entry>
26903 </row>
26904 </tbody>
26905 </tgroup>
26906 </informaltable>
26907 <para>
26908 This option controls which network interfaces are used by the daemon for
26909 listening; they are also used to identify the local host when routing. Chapter
26910 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
26911 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
26912 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
26913 <option>local_interfaces</option> is
26914 </para>
26915 <literallayout class="monospaced">
26916 local_interfaces = 0.0.0.0
26917 </literallayout>
26918 <para>
26919 when Exim is built without IPv6 support; otherwise it is
26920 </para>
26921 <literallayout class="monospaced">
26922 local_interfaces = &lt;; ::0 ; 0.0.0.0
26923 </literallayout>
26924 <para>
26925 <indexterm role="option">
26926 <primary><option>local_scan_timeout</option></primary>
26927 </indexterm>
26928 </para>
26929 <informaltable frame="all">
26930 <tgroup cols="4" colsep="0" rowsep="0">
26931 <colspec colwidth="8*" align="left"/>
26932 <colspec colwidth="6*" align="center"/>
26933 <colspec colwidth="6*" align="center"/>
26934 <colspec colwidth="6*" align="right"/>
26935 <tbody>
26936 <row>
26937 <entry><option>local_scan_timeout</option></entry>
26938 <entry>Use: <emphasis>main</emphasis></entry>
26939 <entry>Type: <emphasis>time</emphasis></entry>
26940 <entry>Default: <emphasis>5m</emphasis></entry>
26941 </row>
26942 </tbody>
26943 </tgroup>
26944 </informaltable>
26945 <para>
26946 <indexterm role="concept">
26947 <primary>timeout</primary>
26948 <secondary>for <function>local_scan()</function> function</secondary>
26949 </indexterm>
26950 <indexterm role="concept">
26951 <primary><function>local_scan()</function> function</primary>
26952 <secondary>timeout</secondary>
26953 </indexterm>
26954 This timeout applies to the <function>local_scan()</function> function (see chapter
26955 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
26956 the incoming message is rejected with a temporary error if it is an SMTP
26957 message. For a non-SMTP message, the message is dropped and Exim ends with a
26958 non-zero code. The incident is logged on the main and reject logs.
26959 </para>
26960 <para>
26961 <indexterm role="option">
26962 <primary><option>local_sender_retain</option></primary>
26963 </indexterm>
26964 </para>
26965 <informaltable frame="all">
26966 <tgroup cols="4" colsep="0" rowsep="0">
26967 <colspec colwidth="8*" align="left"/>
26968 <colspec colwidth="6*" align="center"/>
26969 <colspec colwidth="6*" align="center"/>
26970 <colspec colwidth="6*" align="right"/>
26971 <tbody>
26972 <row>
26973 <entry><option>local_sender_retain</option></entry>
26974 <entry>Use: <emphasis>main</emphasis></entry>
26975 <entry>Type: <emphasis>boolean</emphasis></entry>
26976 <entry>Default: <emphasis>false</emphasis></entry>
26977 </row>
26978 </tbody>
26979 </tgroup>
26980 </informaltable>
26981 <para>
26982 <indexterm role="concept">
26983 <primary><emphasis>Sender:</emphasis> header line</primary>
26984 <secondary>retaining from local submission</secondary>
26985 </indexterm>
26986 When a message is submitted locally (that is, not over a TCP/IP connection) by
26987 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
26988 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
26989 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
26990 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
26991 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
26992 </para>
26993 <para>
26994 <indexterm role="option">
26995 <primary><option>localhost_number</option></primary>
26996 </indexterm>
26997 </para>
26998 <informaltable frame="all">
26999 <tgroup cols="4" colsep="0" rowsep="0">
27000 <colspec colwidth="8*" align="left"/>
27001 <colspec colwidth="6*" align="center"/>
27002 <colspec colwidth="6*" align="center"/>
27003 <colspec colwidth="6*" align="right"/>
27004 <tbody>
27005 <row>
27006 <entry><option>localhost_number</option></entry>
27007 <entry>Use: <emphasis>main</emphasis></entry>
27008 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27009 <entry>Default: <emphasis>unset</emphasis></entry>
27010 </row>
27011 </tbody>
27012 </tgroup>
27013 </informaltable>
27014 <para>
27015 <indexterm role="concept">
27016 <primary>host</primary>
27017 <secondary>locally unique number for</secondary>
27018 </indexterm>
27019 <indexterm role="concept">
27020 <primary>message ids</primary>
27021 <secondary>with multiple hosts</secondary>
27022 </indexterm>
27023 <indexterm role="variable">
27024 <primary><varname>$localhost_number</varname></primary>
27025 </indexterm>
27026 Exim&#x2019;s message ids are normally unique only within the local host. If
27027 uniqueness among a set of hosts is required, each host must set a different
27028 value for the <option>localhost_number</option> option. The string is expanded immediately
27029 after reading the configuration file (so that a number can be computed from the
27030 host name, for example) and the result of the expansion must be a number in the
27031 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
27032 systems). This is available in subsequent string expansions via the variable
27033 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
27034 characters of the message id, instead of just being a fractional part of the
27035 time, are computed from the time and the local host number as described in
27036 section <xref linkend="SECTmessiden"/>.
27037 </para>
27038 <para>
27039 <indexterm role="option">
27040 <primary><option>log_file_path</option></primary>
27041 </indexterm>
27042 </para>
27043 <informaltable frame="all">
27044 <tgroup cols="4" colsep="0" rowsep="0">
27045 <colspec colwidth="8*" align="left"/>
27046 <colspec colwidth="6*" align="center"/>
27047 <colspec colwidth="6*" align="center"/>
27048 <colspec colwidth="6*" align="right"/>
27049 <tbody>
27050 <row>
27051 <entry><option>log_file_path</option></entry>
27052 <entry>Use: <emphasis>main</emphasis></entry>
27053 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27054 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27055 </row>
27056 </tbody>
27057 </tgroup>
27058 </informaltable>
27059 <para>
27060 <indexterm role="concept">
27061 <primary>log</primary>
27062 <secondary>file path for</secondary>
27063 </indexterm>
27064 This option sets the path which is used to determine the names of Exim&#x2019;s log
27065 files, or indicates that logging is to be to syslog, or both. It is expanded
27066 when Exim is entered, so it can, for example, contain a reference to the host
27067 name. If no specific path is set for the log files at compile or run time,
27068 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
27069 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
27070 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
27071 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
27072 used. If this string is fixed at your installation (contains no expansion
27073 variables) it is recommended that you do not set this option in the
27074 configuration file, but instead supply the path using LOG_FILE_PATH in
27075 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
27076 early on &ndash; in particular, failure to read the configuration file.
27077 </para>
27078 <para>
27079 <indexterm role="option">
27080 <primary><option>log_selector</option></primary>
27081 </indexterm>
27082 </para>
27083 <informaltable frame="all">
27084 <tgroup cols="4" colsep="0" rowsep="0">
27085 <colspec colwidth="8*" align="left"/>
27086 <colspec colwidth="6*" align="center"/>
27087 <colspec colwidth="6*" align="center"/>
27088 <colspec colwidth="6*" align="right"/>
27089 <tbody>
27090 <row>
27091 <entry><option>log_selector</option></entry>
27092 <entry>Use: <emphasis>main</emphasis></entry>
27093 <entry>Type: <emphasis>string</emphasis></entry>
27094 <entry>Default: <emphasis>unset</emphasis></entry>
27095 </row>
27096 </tbody>
27097 </tgroup>
27098 </informaltable>
27099 <para>
27100 <indexterm role="concept">
27101 <primary>log</primary>
27102 <secondary>selectors</secondary>
27103 </indexterm>
27104 This option can be used to reduce or increase the number of things that Exim
27105 writes to its log files. Its argument is made up of names preceded by plus or
27106 minus characters. For example:
27107 </para>
27108 <literallayout class="monospaced">
27109 log_selector = +arguments -retry_defer
27110 </literallayout>
27111 <para>
27112 A list of possible names and what they control is given in the chapter on
27113 logging, in section <xref linkend="SECTlogselector"/>.
27114 </para>
27115 <para>
27116 <indexterm role="option">
27117 <primary><option>log_timezone</option></primary>
27118 </indexterm>
27119 </para>
27120 <informaltable frame="all">
27121 <tgroup cols="4" colsep="0" rowsep="0">
27122 <colspec colwidth="8*" align="left"/>
27123 <colspec colwidth="6*" align="center"/>
27124 <colspec colwidth="6*" align="center"/>
27125 <colspec colwidth="6*" align="right"/>
27126 <tbody>
27127 <row>
27128 <entry><option>log_timezone</option></entry>
27129 <entry>Use: <emphasis>main</emphasis></entry>
27130 <entry>Type: <emphasis>boolean</emphasis></entry>
27131 <entry>Default: <emphasis>false</emphasis></entry>
27132 </row>
27133 </tbody>
27134 </tgroup>
27135 </informaltable>
27136 <para>
27137 <indexterm role="concept">
27138 <primary>log</primary>
27139 <secondary>timezone for entries</secondary>
27140 </indexterm>
27141 <indexterm role="variable">
27142 <primary><varname>$tod_log</varname></primary>
27143 </indexterm>
27144 <indexterm role="variable">
27145 <primary><varname>$tod_zone</varname></primary>
27146 </indexterm>
27147 By default, the timestamps on log lines are in local time without the
27148 timezone. This means that if your timezone changes twice a year, the timestamps
27149 in log lines are ambiguous for an hour when the clocks go back. One way of
27150 avoiding this problem is to set the timezone to UTC. An alternative is to set
27151 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
27152 timestamps in log lines. Turning on this option can add quite a lot to the size
27153 of log files because each line is extended by 6 characters. Note that the
27154 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
27155 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
27156 </para>
27157 <para>
27158 <indexterm role="option">
27159 <primary><option>lookup_open_max</option></primary>
27160 </indexterm>
27161 </para>
27162 <informaltable frame="all">
27163 <tgroup cols="4" colsep="0" rowsep="0">
27164 <colspec colwidth="8*" align="left"/>
27165 <colspec colwidth="6*" align="center"/>
27166 <colspec colwidth="6*" align="center"/>
27167 <colspec colwidth="6*" align="right"/>
27168 <tbody>
27169 <row>
27170 <entry><option>lookup_open_max</option></entry>
27171 <entry>Use: <emphasis>main</emphasis></entry>
27172 <entry>Type: <emphasis>integer</emphasis></entry>
27173 <entry>Default: <emphasis>25</emphasis></entry>
27174 </row>
27175 </tbody>
27176 </tgroup>
27177 </informaltable>
27178 <para>
27179 <indexterm role="concept">
27180 <primary>too many open files</primary>
27181 </indexterm>
27182 <indexterm role="concept">
27183 <primary>open files, too many</primary>
27184 </indexterm>
27185 <indexterm role="concept">
27186 <primary>file</primary>
27187 <secondary>too many open</secondary>
27188 </indexterm>
27189 <indexterm role="concept">
27190 <primary>lookup</primary>
27191 <secondary>maximum open files</secondary>
27192 </indexterm>
27193 <indexterm role="concept">
27194 <primary>limit</primary>
27195 <secondary>open files for lookups</secondary>
27196 </indexterm>
27197 This option limits the number of simultaneously open files for single-key
27198 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
27199 Exim normally keeps these files open during routing, because often the same
27200 file is required several times. If the limit is reached, Exim closes the least
27201 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
27202 actually opens two files for each logical DBM database, though it still counts
27203 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
27204 open files</quote> errors with NDBM, you need to reduce the value of
27205 <option>lookup_open_max</option>.
27206 </para>
27207 <para>
27208 <indexterm role="option">
27209 <primary><option>max_username_length</option></primary>
27210 </indexterm>
27211 </para>
27212 <informaltable frame="all">
27213 <tgroup cols="4" colsep="0" rowsep="0">
27214 <colspec colwidth="8*" align="left"/>
27215 <colspec colwidth="6*" align="center"/>
27216 <colspec colwidth="6*" align="center"/>
27217 <colspec colwidth="6*" align="right"/>
27218 <tbody>
27219 <row>
27220 <entry><option>max_username_length</option></entry>
27221 <entry>Use: <emphasis>main</emphasis></entry>
27222 <entry>Type: <emphasis>integer</emphasis></entry>
27223 <entry>Default: <emphasis>0</emphasis></entry>
27224 </row>
27225 </tbody>
27226 </tgroup>
27227 </informaltable>
27228 <para>
27229 <indexterm role="concept">
27230 <primary>length of login name</primary>
27231 </indexterm>
27232 <indexterm role="concept">
27233 <primary>user name</primary>
27234 <secondary>maximum length</secondary>
27235 </indexterm>
27236 <indexterm role="concept">
27237 <primary>limit</primary>
27238 <secondary>user name length</secondary>
27239 </indexterm>
27240 Some operating systems are broken in that they truncate long arguments to
27241 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
27242 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
27243 an argument that is longer behaves as if <function>getpwnam()</function> failed.
27244 </para>
27245 <para>
27246 <indexterm role="option">
27247 <primary><option>message_body_newlines</option></primary>
27248 </indexterm>
27249 </para>
27250 <informaltable frame="all">
27251 <tgroup cols="4" colsep="0" rowsep="0">
27252 <colspec colwidth="8*" align="left"/>
27253 <colspec colwidth="6*" align="center"/>
27254 <colspec colwidth="6*" align="center"/>
27255 <colspec colwidth="6*" align="right"/>
27256 <tbody>
27257 <row>
27258 <entry><option>message_body_newlines</option></entry>
27259 <entry>Use: <emphasis>main</emphasis></entry>
27260 <entry>Type: <emphasis>bool</emphasis></entry>
27261 <entry>Default: <emphasis>false</emphasis></entry>
27262 </row>
27263 </tbody>
27264 </tgroup>
27265 </informaltable>
27266 <para>
27267 <indexterm role="concept">
27268 <primary>message body</primary>
27269 <secondary>newlines in variables</secondary>
27270 </indexterm>
27271 <indexterm role="concept">
27272 <primary>newline</primary>
27273 <secondary>in message body variables</secondary>
27274 </indexterm>
27275 <indexterm role="variable">
27276 <primary><varname>$message_body</varname></primary>
27277 </indexterm>
27278 <indexterm role="variable">
27279 <primary><varname>$message_body_end</varname></primary>
27280 </indexterm>
27281 By default, newlines in the message body are replaced by spaces when setting
27282 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
27283 option is set true, this no longer happens.
27284 </para>
27285 <para>
27286 <indexterm role="option">
27287 <primary><option>message_body_visible</option></primary>
27288 </indexterm>
27289 </para>
27290 <informaltable frame="all">
27291 <tgroup cols="4" colsep="0" rowsep="0">
27292 <colspec colwidth="8*" align="left"/>
27293 <colspec colwidth="6*" align="center"/>
27294 <colspec colwidth="6*" align="center"/>
27295 <colspec colwidth="6*" align="right"/>
27296 <tbody>
27297 <row>
27298 <entry><option>message_body_visible</option></entry>
27299 <entry>Use: <emphasis>main</emphasis></entry>
27300 <entry>Type: <emphasis>integer</emphasis></entry>
27301 <entry>Default: <emphasis>500</emphasis></entry>
27302 </row>
27303 </tbody>
27304 </tgroup>
27305 </informaltable>
27306 <para>
27307 <indexterm role="concept">
27308 <primary>body of message</primary>
27309 <secondary>visible size</secondary>
27310 </indexterm>
27311 <indexterm role="concept">
27312 <primary>message body</primary>
27313 <secondary>visible size</secondary>
27314 </indexterm>
27315 <indexterm role="variable">
27316 <primary><varname>$message_body</varname></primary>
27317 </indexterm>
27318 <indexterm role="variable">
27319 <primary><varname>$message_body_end</varname></primary>
27320 </indexterm>
27321 This option specifies how much of a message&#x2019;s body is to be included in the
27322 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27323 </para>
27324 <para>
27325 <indexterm role="option">
27326 <primary><option>message_id_header_domain</option></primary>
27327 </indexterm>
27328 </para>
27329 <informaltable frame="all">
27330 <tgroup cols="4" colsep="0" rowsep="0">
27331 <colspec colwidth="8*" align="left"/>
27332 <colspec colwidth="6*" align="center"/>
27333 <colspec colwidth="6*" align="center"/>
27334 <colspec colwidth="6*" align="right"/>
27335 <tbody>
27336 <row>
27337 <entry><option>message_id_header_domain</option></entry>
27338 <entry>Use: <emphasis>main</emphasis></entry>
27339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27340 <entry>Default: <emphasis>unset</emphasis></entry>
27341 </row>
27342 </tbody>
27343 </tgroup>
27344 </informaltable>
27345 <para>
27346 <indexterm role="concept">
27347 <primary><emphasis>Message-ID:</emphasis> header line</primary>
27348 </indexterm>
27349 If this option is set, the string is expanded and used as the right hand side
27350 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
27351 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
27352 means <quote>not received over TCP/IP.</quote>
27353 Otherwise, the primary host name is used.
27354 Only letters, digits, dot and hyphen are accepted; any other characters are
27355 replaced by hyphens. If the expansion is forced to fail, or if the result is an
27356 empty string, the option is ignored.
27357 </para>
27358 <para>
27359 <indexterm role="option">
27360 <primary><option>message_id_header_text</option></primary>
27361 </indexterm>
27362 </para>
27363 <informaltable frame="all">
27364 <tgroup cols="4" colsep="0" rowsep="0">
27365 <colspec colwidth="8*" align="left"/>
27366 <colspec colwidth="6*" align="center"/>
27367 <colspec colwidth="6*" align="center"/>
27368 <colspec colwidth="6*" align="right"/>
27369 <tbody>
27370 <row>
27371 <entry><option>message_id_header_text</option></entry>
27372 <entry>Use: <emphasis>main</emphasis></entry>
27373 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27374 <entry>Default: <emphasis>unset</emphasis></entry>
27375 </row>
27376 </tbody>
27377 </tgroup>
27378 </informaltable>
27379 <para>
27380 If this variable is set, the string is expanded and used to augment the text of
27381 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
27382 message does not have one. The text of this header is required by RFC 2822 to
27383 take the form of an address. By default, Exim uses its internal message id as
27384 the local part, and the primary host name as the domain. If this option is set,
27385 it is expanded, and provided the expansion is not forced to fail, and does not
27386 yield an empty string, the result is inserted into the header immediately
27387 before the @, separated from the internal message id by a dot. Any characters
27388 that are illegal in an address are automatically converted into hyphens. This
27389 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
27390 colons will become hyphens.
27391 </para>
27392 <para>
27393 <indexterm role="option">
27394 <primary><option>message_logs</option></primary>
27395 </indexterm>
27396 </para>
27397 <informaltable frame="all">
27398 <tgroup cols="4" colsep="0" rowsep="0">
27399 <colspec colwidth="8*" align="left"/>
27400 <colspec colwidth="6*" align="center"/>
27401 <colspec colwidth="6*" align="center"/>
27402 <colspec colwidth="6*" align="right"/>
27403 <tbody>
27404 <row>
27405 <entry><option>message_logs</option></entry>
27406 <entry>Use: <emphasis>main</emphasis></entry>
27407 <entry>Type: <emphasis>boolean</emphasis></entry>
27408 <entry>Default: <emphasis>true</emphasis></entry>
27409 </row>
27410 </tbody>
27411 </tgroup>
27412 </informaltable>
27413 <para>
27414 <indexterm role="concept">
27415 <primary>message logs</primary>
27416 <secondary>disabling</secondary>
27417 </indexterm>
27418 <indexterm role="concept">
27419 <primary>log</primary>
27420 <secondary>message log; disabling</secondary>
27421 </indexterm>
27422 If this option is turned off, per-message log files are not created in the
27423 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
27424 Exim, by reducing the number of files involved in handling a message from a
27425 minimum of four (header spool file, body spool file, delivery journal, and
27426 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
27427 which is not affected by this option.
27428 </para>
27429 <para>
27430 <indexterm role="option">
27431 <primary><option>message_size_limit</option></primary>
27432 </indexterm>
27433 </para>
27434 <informaltable frame="all">
27435 <tgroup cols="4" colsep="0" rowsep="0">
27436 <colspec colwidth="8*" align="left"/>
27437 <colspec colwidth="6*" align="center"/>
27438 <colspec colwidth="6*" align="center"/>
27439 <colspec colwidth="6*" align="right"/>
27440 <tbody>
27441 <row>
27442 <entry><option>message_size_limit</option></entry>
27443 <entry>Use: <emphasis>main</emphasis></entry>
27444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27445 <entry>Default: <emphasis>50M</emphasis></entry>
27446 </row>
27447 </tbody>
27448 </tgroup>
27449 </informaltable>
27450 <para>
27451 <indexterm role="concept">
27452 <primary>message</primary>
27453 <secondary>size limit</secondary>
27454 </indexterm>
27455 <indexterm role="concept">
27456 <primary>limit</primary>
27457 <secondary>message size</secondary>
27458 </indexterm>
27459 <indexterm role="concept">
27460 <primary>size</primary>
27461 <secondary>of message, limit</secondary>
27462 </indexterm>
27463 This option limits the maximum size of message that Exim will process. The
27464 value is expanded for each incoming connection so, for example, it can be made
27465 to depend on the IP address of the remote host for messages arriving via
27466 TCP/IP. After expansion, the value must be a sequence of decimal digits,
27467 optionally followed by K or M.
27468 </para>
27469 <para>
27470 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
27471 other properties of an individual message, because it has to be advertised in
27472 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
27473 error. A value of zero means no limit, but its use is not recommended. See also
27474 <option>bounce_return_size_limit</option>.
27475 </para>
27476 <para>
27477 Incoming SMTP messages are failed with a 552 error if the limit is
27478 exceeded; locally-generated messages either get a stderr message or a delivery
27479 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
27480 an oversized message is logged in both the main and the reject logs. See also
27481 the generic transport option <option>message_size_limit</option>, which limits the size of
27482 message that an individual transport can process.
27483 </para>
27484 <para>
27485 If you use a virus-scanner and set this option to to a value larger than the
27486 maximum size that your virus-scanner is configured to support, you may get
27487 failures triggered by large mails.  The right size to configure for the
27488 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
27489 probably safest to just set it to a little larger than this value.  E.g., with a
27490 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
27491 some problems may result.
27492 </para>
27493 <para>
27494 A value of 0 will disable size limit checking; Exim will still advertise the
27495 SIZE extension in an EHLO response, but without a limit, so as to permit
27496 SMTP clients to still indicate the message size along with the MAIL verb.
27497 </para>
27498 <para>
27499 <indexterm role="option">
27500 <primary><option>move_frozen_messages</option></primary>
27501 </indexterm>
27502 </para>
27503 <informaltable frame="all">
27504 <tgroup cols="4" colsep="0" rowsep="0">
27505 <colspec colwidth="8*" align="left"/>
27506 <colspec colwidth="6*" align="center"/>
27507 <colspec colwidth="6*" align="center"/>
27508 <colspec colwidth="6*" align="right"/>
27509 <tbody>
27510 <row>
27511 <entry><option>move_frozen_messages</option></entry>
27512 <entry>Use: <emphasis>main</emphasis></entry>
27513 <entry>Type: <emphasis>boolean</emphasis></entry>
27514 <entry>Default: <emphasis>false</emphasis></entry>
27515 </row>
27516 </tbody>
27517 </tgroup>
27518 </informaltable>
27519 <para>
27520 <indexterm role="concept">
27521 <primary>frozen messages</primary>
27522 <secondary>moving</secondary>
27523 </indexterm>
27524 This option, which is available only if Exim has been built with the setting
27525 </para>
27526 <literallayout class="monospaced">
27527 SUPPORT_MOVE_FROZEN_MESSAGES=yes
27528 </literallayout>
27529 <para>
27530 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
27531 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
27532 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
27533 standard utilities for handling such moved messages, and they do not show up in
27534 lists generated by <option>-bp</option> or by the Exim monitor.
27535 </para>
27536 <para>
27537 <indexterm role="option">
27538 <primary><option>mua_wrapper</option></primary>
27539 </indexterm>
27540 </para>
27541 <informaltable frame="all">
27542 <tgroup cols="4" colsep="0" rowsep="0">
27543 <colspec colwidth="8*" align="left"/>
27544 <colspec colwidth="6*" align="center"/>
27545 <colspec colwidth="6*" align="center"/>
27546 <colspec colwidth="6*" align="right"/>
27547 <tbody>
27548 <row>
27549 <entry><option>mua_wrapper</option></entry>
27550 <entry>Use: <emphasis>main</emphasis></entry>
27551 <entry>Type: <emphasis>boolean</emphasis></entry>
27552 <entry>Default: <emphasis>false</emphasis></entry>
27553 </row>
27554 </tbody>
27555 </tgroup>
27556 </informaltable>
27557 <para>
27558 Setting this option true causes Exim to run in a very restrictive mode in which
27559 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
27560 contains a full description of this facility.
27561 </para>
27562 <para>
27563 <indexterm role="option">
27564 <primary><option>mysql_servers</option></primary>
27565 </indexterm>
27566 </para>
27567 <informaltable frame="all">
27568 <tgroup cols="4" colsep="0" rowsep="0">
27569 <colspec colwidth="8*" align="left"/>
27570 <colspec colwidth="6*" align="center"/>
27571 <colspec colwidth="6*" align="center"/>
27572 <colspec colwidth="6*" align="right"/>
27573 <tbody>
27574 <row>
27575 <entry><option>mysql_servers</option></entry>
27576 <entry>Use: <emphasis>main</emphasis></entry>
27577 <entry>Type: <emphasis>string list</emphasis></entry>
27578 <entry>Default: <emphasis>unset</emphasis></entry>
27579 </row>
27580 </tbody>
27581 </tgroup>
27582 </informaltable>
27583 <para>
27584 <indexterm role="concept">
27585 <primary>MySQL</primary>
27586 <secondary>server list</secondary>
27587 </indexterm>
27588 This option provides a list of MySQL servers and associated connection data, to
27589 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
27590 option is available only if Exim has been built with MySQL support.
27591 </para>
27592 <para>
27593 <indexterm role="option">
27594 <primary><option>never_users</option></primary>
27595 </indexterm>
27596 </para>
27597 <informaltable frame="all">
27598 <tgroup cols="4" colsep="0" rowsep="0">
27599 <colspec colwidth="8*" align="left"/>
27600 <colspec colwidth="6*" align="center"/>
27601 <colspec colwidth="6*" align="center"/>
27602 <colspec colwidth="6*" align="right"/>
27603 <tbody>
27604 <row>
27605 <entry><option>never_users</option></entry>
27606 <entry>Use: <emphasis>main</emphasis></entry>
27607 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27608 <entry>Default: <emphasis>unset</emphasis></entry>
27609 </row>
27610 </tbody>
27611 </tgroup>
27612 </informaltable>
27613 <para>
27614 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
27615 message deliveries are normally run in processes that are setuid to the
27616 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
27617 It is usually desirable to prevent any deliveries from running as root, as a
27618 safety precaution.
27619 </para>
27620 <para>
27621 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
27622 list of users that must not be used for local deliveries. This list is fixed in
27623 the binary and cannot be overridden by the configuration file. By default, it
27624 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
27625 can be used to add more users to the fixed list.
27626 </para>
27627 <para>
27628 If a message is to be delivered as one of the users on the fixed list or the
27629 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
27630 example is
27631 </para>
27632 <literallayout class="monospaced">
27633 never_users = root:daemon:bin
27634 </literallayout>
27635 <para>
27636 Including root is redundant if it is also on the fixed list, but it does no
27637 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
27638 transport driver.
27639 </para>
27640 <para>
27641 <indexterm role="option">
27642 <primary><option>openssl_options</option></primary>
27643 </indexterm>
27644 </para>
27645 <informaltable frame="all">
27646 <tgroup cols="4" colsep="0" rowsep="0">
27647 <colspec colwidth="8*" align="left"/>
27648 <colspec colwidth="6*" align="center"/>
27649 <colspec colwidth="6*" align="center"/>
27650 <colspec colwidth="6*" align="right"/>
27651 <tbody>
27652 <row>
27653 <entry><option>openssl_options</option></entry>
27654 <entry>Use: <emphasis>main</emphasis></entry>
27655 <entry>Type: <emphasis>string list</emphasis></entry>
27656 <entry>Default: <emphasis>+no_sslv2 +single_dh_use</emphasis></entry>
27657 </row>
27658 </tbody>
27659 </tgroup>
27660 </informaltable>
27661 <para>
27662 <indexterm role="concept">
27663 <primary>OpenSSL </primary>
27664 <secondary>compatibility</secondary>
27665 </indexterm>
27666 This option allows an administrator to adjust the SSL options applied
27667 by OpenSSL to connections.  It is given as a space-separated list of items,
27668 each one to be +added or -subtracted from the current value.
27669 </para>
27670 <para>
27671 This option is only available if Exim is built against OpenSSL.  The values
27672 available for this option vary according to the age of your OpenSSL install.
27673 The <quote>all</quote> value controls a subset of flags which are available, typically
27674 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
27675 list the values known on your system and Exim should support all the
27676 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
27677 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
27678 </para>
27679 <para>
27680 Note that adjusting the options can have severe impact upon the security of
27681 SSL as used by Exim.  It is possible to disable safety checks and shoot
27682 yourself in the foot in various unpleasant ways.  This option should not be
27683 adjusted lightly.  An unrecognised item will be detected at startup, by
27684 invoking Exim with the <option>-bV</option> flag.
27685 </para>
27686 <para>
27687 The option affects Exim operating both as a server and as a client.
27688 </para>
27689 <para>
27690 Historical note: prior to release 4.80, Exim defaulted this value to
27691 "+dont_insert_empty_fragments", which may still be needed for compatibility
27692 with some clients, but which lowers security by increasing exposure to
27693 some now infamous attacks.
27694 </para>
27695 <para>
27696 Examples:
27697 </para>
27698 <literallayout class="monospaced">
27699 # Make both old MS and old Eudora happy:
27700 openssl_options = -all +microsoft_big_sslv3_buffer \
27701                        +dont_insert_empty_fragments
27702
27703 # Disable older protocol versions:
27704 openssl_options = +no_sslv2 +no_sslv3
27705 </literallayout>
27706 <para>
27707 Possible options may include:
27708 </para>
27709 <itemizedlist>
27710 <listitem>
27711 <para>
27712 <literal>all</literal>
27713 </para>
27714 </listitem>
27715 <listitem>
27716 <para>
27717 <literal>allow_unsafe_legacy_renegotiation</literal>
27718 </para>
27719 </listitem>
27720 <listitem>
27721 <para>
27722 <literal>cipher_server_preference</literal>
27723 </para>
27724 </listitem>
27725 <listitem>
27726 <para>
27727 <literal>dont_insert_empty_fragments</literal>
27728 </para>
27729 </listitem>
27730 <listitem>
27731 <para>
27732 <literal>ephemeral_rsa</literal>
27733 </para>
27734 </listitem>
27735 <listitem>
27736 <para>
27737 <literal>legacy_server_connect</literal>
27738 </para>
27739 </listitem>
27740 <listitem>
27741 <para>
27742 <literal>microsoft_big_sslv3_buffer</literal>
27743 </para>
27744 </listitem>
27745 <listitem>
27746 <para>
27747 <literal>microsoft_sess_id_bug</literal>
27748 </para>
27749 </listitem>
27750 <listitem>
27751 <para>
27752 <literal>msie_sslv2_rsa_padding</literal>
27753 </para>
27754 </listitem>
27755 <listitem>
27756 <para>
27757 <literal>netscape_challenge_bug</literal>
27758 </para>
27759 </listitem>
27760 <listitem>
27761 <para>
27762 <literal>netscape_reuse_cipher_change_bug</literal>
27763 </para>
27764 </listitem>
27765 <listitem>
27766 <para>
27767 <literal>no_compression</literal>
27768 </para>
27769 </listitem>
27770 <listitem>
27771 <para>
27772 <literal>no_session_resumption_on_renegotiation</literal>
27773 </para>
27774 </listitem>
27775 <listitem>
27776 <para>
27777 <literal>no_sslv2</literal>
27778 </para>
27779 </listitem>
27780 <listitem>
27781 <para>
27782 <literal>no_sslv3</literal>
27783 </para>
27784 </listitem>
27785 <listitem>
27786 <para>
27787 <literal>no_ticket</literal>
27788 </para>
27789 </listitem>
27790 <listitem>
27791 <para>
27792 <literal>no_tlsv1</literal>
27793 </para>
27794 </listitem>
27795 <listitem>
27796 <para>
27797 <literal>no_tlsv1_1</literal>
27798 </para>
27799 </listitem>
27800 <listitem>
27801 <para>
27802 <literal>no_tlsv1_2</literal>
27803 </para>
27804 </listitem>
27805 <listitem>
27806 <para>
27807 <literal>safari_ecdhe_ecdsa_bug</literal>
27808 </para>
27809 </listitem>
27810 <listitem>
27811 <para>
27812 <literal>single_dh_use</literal>
27813 </para>
27814 </listitem>
27815 <listitem>
27816 <para>
27817 <literal>single_ecdh_use</literal>
27818 </para>
27819 </listitem>
27820 <listitem>
27821 <para>
27822 <literal>ssleay_080_client_dh_bug</literal>
27823 </para>
27824 </listitem>
27825 <listitem>
27826 <para>
27827 <literal>sslref2_reuse_cert_type_bug</literal>
27828 </para>
27829 </listitem>
27830 <listitem>
27831 <para>
27832 <literal>tls_block_padding_bug</literal>
27833 </para>
27834 </listitem>
27835 <listitem>
27836 <para>
27837 <literal>tls_d5_bug</literal>
27838 </para>
27839 </listitem>
27840 <listitem>
27841 <para>
27842 <literal>tls_rollback_bug</literal>
27843 </para>
27844 </listitem>
27845 </itemizedlist>
27846 <para>
27847 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
27848 all clients connecting using the MacOS SecureTransport TLS facility prior
27849 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
27850 to negotiate TLS then this option value might help, provided that your OpenSSL
27851 release is new enough to contain this work-around.  This may be a situation
27852 where you have to upgrade OpenSSL to get buggy clients working.
27853 </para>
27854 <para>
27855 <indexterm role="option">
27856 <primary><option>oracle_servers</option></primary>
27857 </indexterm>
27858 </para>
27859 <informaltable frame="all">
27860 <tgroup cols="4" colsep="0" rowsep="0">
27861 <colspec colwidth="8*" align="left"/>
27862 <colspec colwidth="6*" align="center"/>
27863 <colspec colwidth="6*" align="center"/>
27864 <colspec colwidth="6*" align="right"/>
27865 <tbody>
27866 <row>
27867 <entry><option>oracle_servers</option></entry>
27868 <entry>Use: <emphasis>main</emphasis></entry>
27869 <entry>Type: <emphasis>string list</emphasis></entry>
27870 <entry>Default: <emphasis>unset</emphasis></entry>
27871 </row>
27872 </tbody>
27873 </tgroup>
27874 </informaltable>
27875 <para>
27876 <indexterm role="concept">
27877 <primary>Oracle</primary>
27878 <secondary>server list</secondary>
27879 </indexterm>
27880 This option provides a list of Oracle servers and associated connection data,
27881 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
27882 The option is available only if Exim has been built with Oracle support.
27883 </para>
27884 <para>
27885 <indexterm role="option">
27886 <primary><option>percent_hack_domains</option></primary>
27887 </indexterm>
27888 </para>
27889 <informaltable frame="all">
27890 <tgroup cols="4" colsep="0" rowsep="0">
27891 <colspec colwidth="8*" align="left"/>
27892 <colspec colwidth="6*" align="center"/>
27893 <colspec colwidth="6*" align="center"/>
27894 <colspec colwidth="6*" align="right"/>
27895 <tbody>
27896 <row>
27897 <entry><option>percent_hack_domains</option></entry>
27898 <entry>Use: <emphasis>main</emphasis></entry>
27899 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27900 <entry>Default: <emphasis>unset</emphasis></entry>
27901 </row>
27902 </tbody>
27903 </tgroup>
27904 </informaltable>
27905 <para>
27906 <indexterm role="concept">
27907 <primary><quote>percent hack</quote></primary>
27908 </indexterm>
27909 <indexterm role="concept">
27910 <primary>source routing</primary>
27911 <secondary>in email address</secondary>
27912 </indexterm>
27913 <indexterm role="concept">
27914 <primary>address</primary>
27915 <secondary>source-routed</secondary>
27916 </indexterm>
27917 The <quote>percent hack</quote> is the convention whereby a local part containing a
27918 percent sign is re-interpreted as a new email address, with the percent
27919 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
27920 also applied to RFC 2822 addresses that begin with an @ character. If this
27921 option is set, Exim implements the percent facility for those domains listed,
27922 but no others. This happens before an incoming SMTP address is tested against
27923 an ACL.
27924 </para>
27925 <para>
27926 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
27927 trying to get round relaying restrictions. For this reason, it is best avoided
27928 if at all possible. Unfortunately, a number of less security-conscious MTAs
27929 implement it unconditionally. If you are running Exim on a gateway host, and
27930 routing mail through to internal MTAs without processing the local parts, it is
27931 a good idea to reject recipient addresses with percent characters in their
27932 local parts. Exim&#x2019;s default configuration does this.
27933 </para>
27934 <para>
27935 <indexterm role="option">
27936 <primary><option>perl_at_start</option></primary>
27937 </indexterm>
27938 </para>
27939 <informaltable frame="all">
27940 <tgroup cols="4" colsep="0" rowsep="0">
27941 <colspec colwidth="8*" align="left"/>
27942 <colspec colwidth="6*" align="center"/>
27943 <colspec colwidth="6*" align="center"/>
27944 <colspec colwidth="6*" align="right"/>
27945 <tbody>
27946 <row>
27947 <entry><option>perl_at_start</option></entry>
27948 <entry>Use: <emphasis>main</emphasis></entry>
27949 <entry>Type: <emphasis>boolean</emphasis></entry>
27950 <entry>Default: <emphasis>false</emphasis></entry>
27951 </row>
27952 </tbody>
27953 </tgroup>
27954 </informaltable>
27955 <para>
27956 <indexterm role="concept">
27957 <primary>Perl</primary>
27958 </indexterm>
27959 This option is available only when Exim is built with an embedded Perl
27960 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27961 </para>
27962 <para>
27963 <indexterm role="option">
27964 <primary><option>perl_startup</option></primary>
27965 </indexterm>
27966 </para>
27967 <informaltable frame="all">
27968 <tgroup cols="4" colsep="0" rowsep="0">
27969 <colspec colwidth="8*" align="left"/>
27970 <colspec colwidth="6*" align="center"/>
27971 <colspec colwidth="6*" align="center"/>
27972 <colspec colwidth="6*" align="right"/>
27973 <tbody>
27974 <row>
27975 <entry><option>perl_startup</option></entry>
27976 <entry>Use: <emphasis>main</emphasis></entry>
27977 <entry>Type: <emphasis>string</emphasis></entry>
27978 <entry>Default: <emphasis>unset</emphasis></entry>
27979 </row>
27980 </tbody>
27981 </tgroup>
27982 </informaltable>
27983 <para>
27984 <indexterm role="concept">
27985 <primary>Perl</primary>
27986 </indexterm>
27987 This option is available only when Exim is built with an embedded Perl
27988 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27989 </para>
27990 <para>
27991 <indexterm role="option">
27992 <primary><option>perl_startup</option></primary>
27993 </indexterm>
27994 </para>
27995 <informaltable frame="all">
27996 <tgroup cols="4" colsep="0" rowsep="0">
27997 <colspec colwidth="8*" align="left"/>
27998 <colspec colwidth="6*" align="center"/>
27999 <colspec colwidth="6*" align="center"/>
28000 <colspec colwidth="6*" align="right"/>
28001 <tbody>
28002 <row>
28003 <entry><option>perl_startup</option></entry>
28004 <entry>Use: <emphasis>main</emphasis></entry>
28005 <entry>Type: <emphasis>boolean</emphasis></entry>
28006 <entry>Default: <emphasis>false</emphasis></entry>
28007 </row>
28008 </tbody>
28009 </tgroup>
28010 </informaltable>
28011 <para>
28012 <indexterm role="concept">
28013 <primary>Perl</primary>
28014 </indexterm>
28015 This Option enables the taint mode of the embedded Perl interpreter.
28016 </para>
28017 <para>
28018 <indexterm role="option">
28019 <primary><option>pgsql_servers</option></primary>
28020 </indexterm>
28021 </para>
28022 <informaltable frame="all">
28023 <tgroup cols="4" colsep="0" rowsep="0">
28024 <colspec colwidth="8*" align="left"/>
28025 <colspec colwidth="6*" align="center"/>
28026 <colspec colwidth="6*" align="center"/>
28027 <colspec colwidth="6*" align="right"/>
28028 <tbody>
28029 <row>
28030 <entry><option>pgsql_servers</option></entry>
28031 <entry>Use: <emphasis>main</emphasis></entry>
28032 <entry>Type: <emphasis>string list</emphasis></entry>
28033 <entry>Default: <emphasis>unset</emphasis></entry>
28034 </row>
28035 </tbody>
28036 </tgroup>
28037 </informaltable>
28038 <para>
28039 <indexterm role="concept">
28040 <primary>PostgreSQL lookup type</primary>
28041 <secondary>server list</secondary>
28042 </indexterm>
28043 This option provides a list of PostgreSQL servers and associated connection
28044 data, to be used in conjunction with <command>pgsql</command> lookups (see section
28045 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
28046 PostgreSQL support.
28047 </para>
28048 <para>
28049 <indexterm role="option">
28050 <primary><option>pid_file_path</option></primary>
28051 </indexterm>
28052 </para>
28053 <informaltable frame="all">
28054 <tgroup cols="4" colsep="0" rowsep="0">
28055 <colspec colwidth="8*" align="left"/>
28056 <colspec colwidth="6*" align="center"/>
28057 <colspec colwidth="6*" align="center"/>
28058 <colspec colwidth="6*" align="right"/>
28059 <tbody>
28060 <row>
28061 <entry><option>pid_file_path</option></entry>
28062 <entry>Use: <emphasis>main</emphasis></entry>
28063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28064 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28065 </row>
28066 </tbody>
28067 </tgroup>
28068 </informaltable>
28069 <para>
28070 <indexterm role="concept">
28071 <primary>daemon</primary>
28072 <secondary>pid file path</secondary>
28073 </indexterm>
28074 <indexterm role="concept">
28075 <primary>pid file, path for</primary>
28076 </indexterm>
28077 This option sets the name of the file to which the Exim daemon writes its
28078 process id. The string is expanded, so it can contain, for example, references
28079 to the host name:
28080 </para>
28081 <literallayout class="monospaced">
28082 pid_file_path = /var/log/$primary_hostname/exim.pid
28083 </literallayout>
28084 <para>
28085 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
28086 spool directory.
28087 The value set by the option can be overridden by the <option>-oP</option> command line
28088 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
28089 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
28090 </para>
28091 <para>
28092 <indexterm role="option">
28093 <primary><option>pipelining_advertise_hosts</option></primary>
28094 </indexterm>
28095 </para>
28096 <informaltable frame="all">
28097 <tgroup cols="4" colsep="0" rowsep="0">
28098 <colspec colwidth="8*" align="left"/>
28099 <colspec colwidth="6*" align="center"/>
28100 <colspec colwidth="6*" align="center"/>
28101 <colspec colwidth="6*" align="right"/>
28102 <tbody>
28103 <row>
28104 <entry><option>pipelining_advertise_hosts</option></entry>
28105 <entry>Use: <emphasis>main</emphasis></entry>
28106 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28107 <entry>Default: <emphasis>*</emphasis></entry>
28108 </row>
28109 </tbody>
28110 </tgroup>
28111 </informaltable>
28112 <para>
28113 <indexterm role="concept">
28114 <primary>PIPELINING</primary>
28115 <secondary>suppressing advertising</secondary>
28116 </indexterm>
28117 This option can be used to suppress the advertisement of the SMTP
28118 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
28119 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
28120 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
28121 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
28122 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
28123 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
28124 </para>
28125 <para>
28126 <indexterm role="option">
28127 <primary><option>prdr_enable</option></primary>
28128 </indexterm>
28129 </para>
28130 <informaltable frame="all">
28131 <tgroup cols="4" colsep="0" rowsep="0">
28132 <colspec colwidth="8*" align="left"/>
28133 <colspec colwidth="6*" align="center"/>
28134 <colspec colwidth="6*" align="center"/>
28135 <colspec colwidth="6*" align="right"/>
28136 <tbody>
28137 <row>
28138 <entry><option>prdr_enable</option></entry>
28139 <entry>Use: <emphasis>main</emphasis></entry>
28140 <entry>Type: <emphasis>boolean</emphasis></entry>
28141 <entry>Default: <emphasis>false</emphasis></entry>
28142 </row>
28143 </tbody>
28144 </tgroup>
28145 </informaltable>
28146 <para>
28147 <indexterm role="concept">
28148 <primary>PRDR</primary>
28149 <secondary>enabling on server</secondary>
28150 </indexterm>
28151 This option can be used to enable the Per-Recipient Data Response extension
28152 to SMTP, defined by Eric Hall.
28153 If the option is set, PRDR is advertised by Exim when operating as a server.
28154 If the client requests PRDR, and more than one recipient, for a message
28155 an additional ACL is called for each recipient after the message content
28156 is received.  See section <xref linkend="SECTPRDRACL"/>.
28157 </para>
28158 <para>
28159 <indexterm role="option">
28160 <primary><option>preserve_message_logs</option></primary>
28161 </indexterm>
28162 </para>
28163 <informaltable frame="all">
28164 <tgroup cols="4" colsep="0" rowsep="0">
28165 <colspec colwidth="8*" align="left"/>
28166 <colspec colwidth="6*" align="center"/>
28167 <colspec colwidth="6*" align="center"/>
28168 <colspec colwidth="6*" align="right"/>
28169 <tbody>
28170 <row>
28171 <entry><option>preserve_message_logs</option></entry>
28172 <entry>Use: <emphasis>main</emphasis></entry>
28173 <entry>Type: <emphasis>boolean</emphasis></entry>
28174 <entry>Default: <emphasis>false</emphasis></entry>
28175 </row>
28176 </tbody>
28177 </tgroup>
28178 </informaltable>
28179 <para>
28180 <indexterm role="concept">
28181 <primary>message logs</primary>
28182 <secondary>preserving</secondary>
28183 </indexterm>
28184 If this option is set, message log files are not deleted when messages are
28185 completed. Instead, they are moved to a sub-directory of the spool directory
28186 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
28187 purposes. This is a dangerous option to set on systems with any appreciable
28188 volume of mail. Use with care!
28189 </para>
28190 <para>
28191 <indexterm role="option">
28192 <primary><option>primary_hostname</option></primary>
28193 </indexterm>
28194 </para>
28195 <informaltable frame="all">
28196 <tgroup cols="4" colsep="0" rowsep="0">
28197 <colspec colwidth="8*" align="left"/>
28198 <colspec colwidth="6*" align="center"/>
28199 <colspec colwidth="6*" align="center"/>
28200 <colspec colwidth="6*" align="right"/>
28201 <tbody>
28202 <row>
28203 <entry><option>primary_hostname</option></entry>
28204 <entry>Use: <emphasis>main</emphasis></entry>
28205 <entry>Type: <emphasis>string</emphasis></entry>
28206 <entry>Default: <emphasis>see below</emphasis></entry>
28207 </row>
28208 </tbody>
28209 </tgroup>
28210 </informaltable>
28211 <para>
28212 <indexterm role="concept">
28213 <primary>name</primary>
28214 <secondary>of local host</secondary>
28215 </indexterm>
28216 <indexterm role="concept">
28217 <primary>host</primary>
28218 <secondary>name of local</secondary>
28219 </indexterm>
28220 <indexterm role="concept">
28221 <primary>local host</primary>
28222 <secondary>name of</secondary>
28223 </indexterm>
28224 <indexterm role="variable">
28225 <primary><varname>$primary_hostname</varname></primary>
28226 </indexterm>
28227 This specifies the name of the current host. It is used in the default EHLO or
28228 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
28229 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
28230 The value is also used by default in some SMTP response messages from an Exim
28231 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
28232 </para>
28233 <para>
28234 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
28235 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
28236 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
28237 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
28238 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
28239 explicitly by this option, or defaulted.
28240 </para>
28241 <para>
28242 <indexterm role="option">
28243 <primary><option>print_topbitchars</option></primary>
28244 </indexterm>
28245 </para>
28246 <informaltable frame="all">
28247 <tgroup cols="4" colsep="0" rowsep="0">
28248 <colspec colwidth="8*" align="left"/>
28249 <colspec colwidth="6*" align="center"/>
28250 <colspec colwidth="6*" align="center"/>
28251 <colspec colwidth="6*" align="right"/>
28252 <tbody>
28253 <row>
28254 <entry><option>print_topbitchars</option></entry>
28255 <entry>Use: <emphasis>main</emphasis></entry>
28256 <entry>Type: <emphasis>boolean</emphasis></entry>
28257 <entry>Default: <emphasis>false</emphasis></entry>
28258 </row>
28259 </tbody>
28260 </tgroup>
28261 </informaltable>
28262 <para>
28263 <indexterm role="concept">
28264 <primary>printing characters</primary>
28265 </indexterm>
28266 <indexterm role="concept">
28267 <primary>8-bit characters</primary>
28268 </indexterm>
28269 By default, Exim considers only those characters whose codes lie in the range
28270 32&ndash;126 to be printing characters. In a number of circumstances (for example,
28271 when writing log entries) non-printing characters are converted into escape
28272 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
28273 is set, code values of 128 and above are also considered to be printing
28274 characters.
28275 </para>
28276 <para>
28277 This option also affects the header syntax checks performed by the
28278 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
28279 the user&#x2019;s full name when constructing From: and Sender: addresses (as
28280 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
28281 Exim to generate eight bit message headers that do not conform to the
28282 standards.
28283 </para>
28284 <para>
28285 <indexterm role="option">
28286 <primary><option>process_log_path</option></primary>
28287 </indexterm>
28288 </para>
28289 <informaltable frame="all">
28290 <tgroup cols="4" colsep="0" rowsep="0">
28291 <colspec colwidth="8*" align="left"/>
28292 <colspec colwidth="6*" align="center"/>
28293 <colspec colwidth="6*" align="center"/>
28294 <colspec colwidth="6*" align="right"/>
28295 <tbody>
28296 <row>
28297 <entry><option>process_log_path</option></entry>
28298 <entry>Use: <emphasis>main</emphasis></entry>
28299 <entry>Type: <emphasis>string</emphasis></entry>
28300 <entry>Default: <emphasis>unset</emphasis></entry>
28301 </row>
28302 </tbody>
28303 </tgroup>
28304 </informaltable>
28305 <para>
28306 <indexterm role="concept">
28307 <primary>process log path</primary>
28308 </indexterm>
28309 <indexterm role="concept">
28310 <primary>log</primary>
28311 <secondary>process log</secondary>
28312 </indexterm>
28313 <indexterm role="concept">
28314 <primary><emphasis>exiwhat</emphasis></primary>
28315 </indexterm>
28316 This option sets the name of the file to which an Exim process writes its
28317 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
28318 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
28319 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
28320 can be useful in environments where two different Exims are running, using
28321 different spool directories.
28322 </para>
28323 <para>
28324 <indexterm role="option">
28325 <primary><option>prod_requires_admin</option></primary>
28326 </indexterm>
28327 </para>
28328 <informaltable frame="all">
28329 <tgroup cols="4" colsep="0" rowsep="0">
28330 <colspec colwidth="8*" align="left"/>
28331 <colspec colwidth="6*" align="center"/>
28332 <colspec colwidth="6*" align="center"/>
28333 <colspec colwidth="6*" align="right"/>
28334 <tbody>
28335 <row>
28336 <entry><option>prod_requires_admin</option></entry>
28337 <entry>Use: <emphasis>main</emphasis></entry>
28338 <entry>Type: <emphasis>boolean</emphasis></entry>
28339 <entry>Default: <emphasis>true</emphasis></entry>
28340 </row>
28341 </tbody>
28342 </tgroup>
28343 </informaltable>
28344 <para>
28345 <indexterm role="option">
28346 <primary><option>-M</option></primary>
28347 </indexterm>
28348 <indexterm role="option">
28349 <primary><option>-R</option></primary>
28350 </indexterm>
28351 <indexterm role="option">
28352 <primary><option>-q</option></primary>
28353 </indexterm>
28354 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
28355 admin user unless <option>prod_requires_admin</option> is set false. See also
28356 <option>queue_list_requires_admin</option>.
28357 </para>
28358 <para>
28359 <indexterm role="option">
28360 <primary><option>qualify_domain</option></primary>
28361 </indexterm>
28362 </para>
28363 <informaltable frame="all">
28364 <tgroup cols="4" colsep="0" rowsep="0">
28365 <colspec colwidth="8*" align="left"/>
28366 <colspec colwidth="6*" align="center"/>
28367 <colspec colwidth="6*" align="center"/>
28368 <colspec colwidth="6*" align="right"/>
28369 <tbody>
28370 <row>
28371 <entry><option>qualify_domain</option></entry>
28372 <entry>Use: <emphasis>main</emphasis></entry>
28373 <entry>Type: <emphasis>string</emphasis></entry>
28374 <entry>Default: <emphasis>see below</emphasis></entry>
28375 </row>
28376 </tbody>
28377 </tgroup>
28378 </informaltable>
28379 <para>
28380 <indexterm role="concept">
28381 <primary>domain</primary>
28382 <secondary>for qualifying addresses</secondary>
28383 </indexterm>
28384 <indexterm role="concept">
28385 <primary>address</primary>
28386 <secondary>qualification</secondary>
28387 </indexterm>
28388 This option specifies the domain name that is added to any envelope sender
28389 addresses that do not have a domain qualification. It also applies to
28390 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
28391 are accepted by default only for locally-generated messages. Qualification is
28392 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
28393 locally-generated messages, unless the <option>-bnq</option> command line option is used.
28394 </para>
28395 <para>
28396 Messages from external sources must always contain fully qualified addresses,
28397 unless the sending host matches <option>sender_unqualified_hosts</option> or
28398 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
28399 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
28400 necessary. Internally, Exim always works with fully qualified envelope
28401 addresses. If <option>qualify_domain</option> is not set, it defaults to the
28402 <option>primary_hostname</option> value.
28403 </para>
28404 <para>
28405 <indexterm role="option">
28406 <primary><option>qualify_recipient</option></primary>
28407 </indexterm>
28408 </para>
28409 <informaltable frame="all">
28410 <tgroup cols="4" colsep="0" rowsep="0">
28411 <colspec colwidth="8*" align="left"/>
28412 <colspec colwidth="6*" align="center"/>
28413 <colspec colwidth="6*" align="center"/>
28414 <colspec colwidth="6*" align="right"/>
28415 <tbody>
28416 <row>
28417 <entry><option>qualify_recipient</option></entry>
28418 <entry>Use: <emphasis>main</emphasis></entry>
28419 <entry>Type: <emphasis>string</emphasis></entry>
28420 <entry>Default: <emphasis>see below</emphasis></entry>
28421 </row>
28422 </tbody>
28423 </tgroup>
28424 </informaltable>
28425 <para>
28426 This option allows you to specify a different domain for qualifying recipient
28427 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
28428 </para>
28429 <para>
28430 <indexterm role="option">
28431 <primary><option>queue_domains</option></primary>
28432 </indexterm>
28433 </para>
28434 <informaltable frame="all">
28435 <tgroup cols="4" colsep="0" rowsep="0">
28436 <colspec colwidth="8*" align="left"/>
28437 <colspec colwidth="6*" align="center"/>
28438 <colspec colwidth="6*" align="center"/>
28439 <colspec colwidth="6*" align="right"/>
28440 <tbody>
28441 <row>
28442 <entry><option>queue_domains</option></entry>
28443 <entry>Use: <emphasis>main</emphasis></entry>
28444 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28445 <entry>Default: <emphasis>unset</emphasis></entry>
28446 </row>
28447 </tbody>
28448 </tgroup>
28449 </informaltable>
28450 <para>
28451 <indexterm role="concept">
28452 <primary>domain</primary>
28453 <secondary>specifying non-immediate delivery</secondary>
28454 </indexterm>
28455 <indexterm role="concept">
28456 <primary>queueing incoming messages</primary>
28457 </indexterm>
28458 <indexterm role="concept">
28459 <primary>message</primary>
28460 <secondary>queueing certain domains</secondary>
28461 </indexterm>
28462 This option lists domains for which immediate delivery is not required.
28463 A delivery process is started whenever a message is received, but only those
28464 domains that do not match are processed. All other deliveries wait until the
28465 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
28466 </para>
28467 <para>
28468 <indexterm role="option">
28469 <primary><option>queue_list_requires_admin</option></primary>
28470 </indexterm>
28471 </para>
28472 <informaltable frame="all">
28473 <tgroup cols="4" colsep="0" rowsep="0">
28474 <colspec colwidth="8*" align="left"/>
28475 <colspec colwidth="6*" align="center"/>
28476 <colspec colwidth="6*" align="center"/>
28477 <colspec colwidth="6*" align="right"/>
28478 <tbody>
28479 <row>
28480 <entry><option>queue_list_requires_admin</option></entry>
28481 <entry>Use: <emphasis>main</emphasis></entry>
28482 <entry>Type: <emphasis>boolean</emphasis></entry>
28483 <entry>Default: <emphasis>true</emphasis></entry>
28484 </row>
28485 </tbody>
28486 </tgroup>
28487 </informaltable>
28488 <para>
28489 <indexterm role="option">
28490 <primary><option>-bp</option></primary>
28491 </indexterm>
28492 The <option>-bp</option> command-line option, which lists the messages that are on the
28493 queue, requires the caller to be an admin user unless
28494 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
28495 </para>
28496 <para>
28497 <indexterm role="option">
28498 <primary><option>queue_only</option></primary>
28499 </indexterm>
28500 </para>
28501 <informaltable frame="all">
28502 <tgroup cols="4" colsep="0" rowsep="0">
28503 <colspec colwidth="8*" align="left"/>
28504 <colspec colwidth="6*" align="center"/>
28505 <colspec colwidth="6*" align="center"/>
28506 <colspec colwidth="6*" align="right"/>
28507 <tbody>
28508 <row>
28509 <entry><option>queue_only</option></entry>
28510 <entry>Use: <emphasis>main</emphasis></entry>
28511 <entry>Type: <emphasis>boolean</emphasis></entry>
28512 <entry>Default: <emphasis>false</emphasis></entry>
28513 </row>
28514 </tbody>
28515 </tgroup>
28516 </informaltable>
28517 <para>
28518 <indexterm role="concept">
28519 <primary>queueing incoming messages</primary>
28520 </indexterm>
28521 <indexterm role="concept">
28522 <primary>message</primary>
28523 <secondary>queueing unconditionally</secondary>
28524 </indexterm>
28525 If <option>queue_only</option> is set, a delivery process is not automatically started
28526 whenever a message is received. Instead, the message waits on the queue for the
28527 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
28528 delivered immediately when certain conditions (such as heavy load) occur.
28529 </para>
28530 <para>
28531 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
28532 and <option>-odi</option> command line options override <option>queue_only</option> unless
28533 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
28534 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
28535 </para>
28536 <para>
28537 <indexterm role="option">
28538 <primary><option>queue_only_file</option></primary>
28539 </indexterm>
28540 </para>
28541 <informaltable frame="all">
28542 <tgroup cols="4" colsep="0" rowsep="0">
28543 <colspec colwidth="8*" align="left"/>
28544 <colspec colwidth="6*" align="center"/>
28545 <colspec colwidth="6*" align="center"/>
28546 <colspec colwidth="6*" align="right"/>
28547 <tbody>
28548 <row>
28549 <entry><option>queue_only_file</option></entry>
28550 <entry>Use: <emphasis>main</emphasis></entry>
28551 <entry>Type: <emphasis>string</emphasis></entry>
28552 <entry>Default: <emphasis>unset</emphasis></entry>
28553 </row>
28554 </tbody>
28555 </tgroup>
28556 </informaltable>
28557 <para>
28558 <indexterm role="concept">
28559 <primary>queueing incoming messages</primary>
28560 </indexterm>
28561 <indexterm role="concept">
28562 <primary>message</primary>
28563 <secondary>queueing by file existence</secondary>
28564 </indexterm>
28565 This option can be set to a colon-separated list of absolute path names, each
28566 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
28567 it tests for the existence of each listed path using a call to <function>stat()</function>. For
28568 each path that exists, the corresponding queueing option is set.
28569 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
28570 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
28571 </para>
28572 <literallayout class="monospaced">
28573 queue_only_file = smtp/some/file
28574 </literallayout>
28575 <para>
28576 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
28577 <filename>/some/file</filename> exists.
28578 </para>
28579 <para>
28580 <indexterm role="option">
28581 <primary><option>queue_only_load</option></primary>
28582 </indexterm>
28583 </para>
28584 <informaltable frame="all">
28585 <tgroup cols="4" colsep="0" rowsep="0">
28586 <colspec colwidth="8*" align="left"/>
28587 <colspec colwidth="6*" align="center"/>
28588 <colspec colwidth="6*" align="center"/>
28589 <colspec colwidth="6*" align="right"/>
28590 <tbody>
28591 <row>
28592 <entry><option>queue_only_load</option></entry>
28593 <entry>Use: <emphasis>main</emphasis></entry>
28594 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28595 <entry>Default: <emphasis>unset</emphasis></entry>
28596 </row>
28597 </tbody>
28598 </tgroup>
28599 </informaltable>
28600 <para>
28601 <indexterm role="concept">
28602 <primary>load average</primary>
28603 </indexterm>
28604 <indexterm role="concept">
28605 <primary>queueing incoming messages</primary>
28606 </indexterm>
28607 <indexterm role="concept">
28608 <primary>message</primary>
28609 <secondary>queueing by load</secondary>
28610 </indexterm>
28611 If the system load average is higher than this value, incoming messages from
28612 all sources are queued, and no automatic deliveries are started. If this
28613 happens during local or remote SMTP input, all subsequent messages received on
28614 the same SMTP connection are queued by default, whatever happens to the load in
28615 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
28616 false.
28617 </para>
28618 <para>
28619 Deliveries will subsequently be performed by queue runner processes. This
28620 option has no effect on ancient operating systems on which Exim cannot
28621 determine the load average. See also <option>deliver_queue_load_max</option> and
28622 <option>smtp_load_reserve</option>.
28623 </para>
28624 <para>
28625 <indexterm role="option">
28626 <primary><option>queue_only_load_latch</option></primary>
28627 </indexterm>
28628 </para>
28629 <informaltable frame="all">
28630 <tgroup cols="4" colsep="0" rowsep="0">
28631 <colspec colwidth="8*" align="left"/>
28632 <colspec colwidth="6*" align="center"/>
28633 <colspec colwidth="6*" align="center"/>
28634 <colspec colwidth="6*" align="right"/>
28635 <tbody>
28636 <row>
28637 <entry><option>queue_only_load_latch</option></entry>
28638 <entry>Use: <emphasis>main</emphasis></entry>
28639 <entry>Type: <emphasis>boolean</emphasis></entry>
28640 <entry>Default: <emphasis>true</emphasis></entry>
28641 </row>
28642 </tbody>
28643 </tgroup>
28644 </informaltable>
28645 <para>
28646 <indexterm role="concept">
28647 <primary>load average</primary>
28648 <secondary>re-evaluating per message</secondary>
28649 </indexterm>
28650 When this option is true (the default), once one message has been queued
28651 because the load average is higher than the value set by <option>queue_only_load</option>,
28652 all subsequent messages received on the same SMTP connection are also queued.
28653 This is a deliberate choice; even though the load average may fall below the
28654 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
28655 connection when not delivering earlier ones. However, there are special
28656 circumstances such as very long-lived connections from scanning appliances
28657 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
28658 should be set false. This causes the value of the load average to be
28659 re-evaluated for each message.
28660 </para>
28661 <para>
28662 <indexterm role="option">
28663 <primary><option>queue_only_override</option></primary>
28664 </indexterm>
28665 </para>
28666 <informaltable frame="all">
28667 <tgroup cols="4" colsep="0" rowsep="0">
28668 <colspec colwidth="8*" align="left"/>
28669 <colspec colwidth="6*" align="center"/>
28670 <colspec colwidth="6*" align="center"/>
28671 <colspec colwidth="6*" align="right"/>
28672 <tbody>
28673 <row>
28674 <entry><option>queue_only_override</option></entry>
28675 <entry>Use: <emphasis>main</emphasis></entry>
28676 <entry>Type: <emphasis>boolean</emphasis></entry>
28677 <entry>Default: <emphasis>true</emphasis></entry>
28678 </row>
28679 </tbody>
28680 </tgroup>
28681 </informaltable>
28682 <para>
28683 <indexterm role="concept">
28684 <primary>queueing incoming messages</primary>
28685 </indexterm>
28686 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
28687 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
28688 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
28689 to override; they are accepted, but ignored.
28690 </para>
28691 <para>
28692 <indexterm role="option">
28693 <primary><option>queue_run_in_order</option></primary>
28694 </indexterm>
28695 </para>
28696 <informaltable frame="all">
28697 <tgroup cols="4" colsep="0" rowsep="0">
28698 <colspec colwidth="8*" align="left"/>
28699 <colspec colwidth="6*" align="center"/>
28700 <colspec colwidth="6*" align="center"/>
28701 <colspec colwidth="6*" align="right"/>
28702 <tbody>
28703 <row>
28704 <entry><option>queue_run_in_order</option></entry>
28705 <entry>Use: <emphasis>main</emphasis></entry>
28706 <entry>Type: <emphasis>boolean</emphasis></entry>
28707 <entry>Default: <emphasis>false</emphasis></entry>
28708 </row>
28709 </tbody>
28710 </tgroup>
28711 </informaltable>
28712 <para>
28713 <indexterm role="concept">
28714 <primary>queue runner</primary>
28715 <secondary>processing messages in order</secondary>
28716 </indexterm>
28717 If this option is set, queue runs happen in order of message arrival instead of
28718 in an arbitrary order. For this to happen, a complete list of the entire queue
28719 must be set up before the deliveries start. When the queue is all held in a
28720 single directory (the default), a single list is created for both the ordered
28721 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
28722 single list is not created when <option>queue_run_in_order</option> is false. In this case,
28723 the sub-directories are processed one at a time (in a random order), and this
28724 avoids setting up one huge list for the whole queue. Thus, setting
28725 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
28726 when the queue is large, because of the extra work in setting up the single,
28727 large list. In most situations, <option>queue_run_in_order</option> should not be set.
28728 </para>
28729 <para>
28730 <indexterm role="option">
28731 <primary><option>queue_run_max</option></primary>
28732 </indexterm>
28733 </para>
28734 <informaltable frame="all">
28735 <tgroup cols="4" colsep="0" rowsep="0">
28736 <colspec colwidth="8*" align="left"/>
28737 <colspec colwidth="6*" align="center"/>
28738 <colspec colwidth="6*" align="center"/>
28739 <colspec colwidth="6*" align="right"/>
28740 <tbody>
28741 <row>
28742 <entry><option>queue_run_max</option></entry>
28743 <entry>Use: <emphasis>main</emphasis></entry>
28744 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
28745 <entry>Default: <emphasis>5</emphasis></entry>
28746 </row>
28747 </tbody>
28748 </tgroup>
28749 </informaltable>
28750 <para>
28751 <indexterm role="concept">
28752 <primary>queue runner</primary>
28753 <secondary>maximum number of</secondary>
28754 </indexterm>
28755 This controls the maximum number of queue runner processes that an Exim daemon
28756 can run simultaneously. This does not mean that it starts them all at once,
28757 but rather that if the maximum number are still running when the time comes to
28758 start another one, it refrains from starting another one. This can happen with
28759 very large queues and/or very sluggish deliveries. This option does not,
28760 however, interlock with other processes, so additional queue runners can be
28761 started by other means, or by killing and restarting the daemon.
28762 </para>
28763 <para>
28764 Setting this option to zero does not suppress queue runs; rather, it disables
28765 the limit, allowing any number of simultaneous queue runner processes to be
28766 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
28767 the daemon&#x2019;s command line.
28768 </para>
28769 <para>
28770 <indexterm role="concept">
28771 <primary>queues</primary>
28772 <secondary>named</secondary>
28773 </indexterm>
28774 <indexterm role="concept">
28775 <primary>named queues</primary>
28776 </indexterm>
28777 To set limits for different named queues use
28778 an expansion depending on the <varname>$queue_name</varname> variable.
28779 </para>
28780 <para>
28781 <indexterm role="option">
28782 <primary><option>queue_smtp_domains</option></primary>
28783 </indexterm>
28784 </para>
28785 <informaltable frame="all">
28786 <tgroup cols="4" colsep="0" rowsep="0">
28787 <colspec colwidth="8*" align="left"/>
28788 <colspec colwidth="6*" align="center"/>
28789 <colspec colwidth="6*" align="center"/>
28790 <colspec colwidth="6*" align="right"/>
28791 <tbody>
28792 <row>
28793 <entry><option>queue_smtp_domains</option></entry>
28794 <entry>Use: <emphasis>main</emphasis></entry>
28795 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28796 <entry>Default: <emphasis>unset</emphasis></entry>
28797 </row>
28798 </tbody>
28799 </tgroup>
28800 </informaltable>
28801 <para>
28802 <indexterm role="concept">
28803 <primary>queueing incoming messages</primary>
28804 </indexterm>
28805 <indexterm role="concept">
28806 <primary>message</primary>
28807 <secondary>queueing remote deliveries</secondary>
28808 </indexterm>
28809 When this option is set, a delivery process is started whenever a message is
28810 received, routing is performed, and local deliveries take place.
28811 However, if any SMTP deliveries are required for domains that match
28812 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
28813 message waits on the queue for the next queue run. Since routing of the message
28814 has taken place, Exim knows to which remote hosts it must be delivered, and so
28815 when the queue run happens, multiple messages for the same host are delivered
28816 over a single SMTP connection. The <option>-odqs</option> command line option causes all
28817 SMTP deliveries to be queued in this way, and is equivalent to setting
28818 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
28819 <option>queue_domains</option>.
28820 </para>
28821 <para>
28822 <indexterm role="option">
28823 <primary><option>receive_timeout</option></primary>
28824 </indexterm>
28825 </para>
28826 <informaltable frame="all">
28827 <tgroup cols="4" colsep="0" rowsep="0">
28828 <colspec colwidth="8*" align="left"/>
28829 <colspec colwidth="6*" align="center"/>
28830 <colspec colwidth="6*" align="center"/>
28831 <colspec colwidth="6*" align="right"/>
28832 <tbody>
28833 <row>
28834 <entry><option>receive_timeout</option></entry>
28835 <entry>Use: <emphasis>main</emphasis></entry>
28836 <entry>Type: <emphasis>time</emphasis></entry>
28837 <entry>Default: <emphasis>0s</emphasis></entry>
28838 </row>
28839 </tbody>
28840 </tgroup>
28841 </informaltable>
28842 <para>
28843 <indexterm role="concept">
28844 <primary>timeout</primary>
28845 <secondary>for non-SMTP input</secondary>
28846 </indexterm>
28847 This option sets the timeout for accepting a non-SMTP message, that is, the
28848 maximum time that Exim waits when reading a message on the standard input. If
28849 the value is zero, it will wait for ever. This setting is overridden by the
28850 <option>-or</option> command line option. The timeout for incoming SMTP messages is
28851 controlled by <option>smtp_receive_timeout</option>.
28852 </para>
28853 <para>
28854 <indexterm role="option">
28855 <primary><option>received_header_text</option></primary>
28856 </indexterm>
28857 </para>
28858 <informaltable frame="all">
28859 <tgroup cols="4" colsep="0" rowsep="0">
28860 <colspec colwidth="8*" align="left"/>
28861 <colspec colwidth="6*" align="center"/>
28862 <colspec colwidth="6*" align="center"/>
28863 <colspec colwidth="6*" align="right"/>
28864 <tbody>
28865 <row>
28866 <entry><option>received_header_text</option></entry>
28867 <entry>Use: <emphasis>main</emphasis></entry>
28868 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28869 <entry>Default: <emphasis>see below</emphasis></entry>
28870 </row>
28871 </tbody>
28872 </tgroup>
28873 </informaltable>
28874 <para>
28875 <indexterm role="concept">
28876 <primary>customizing</primary>
28877 <secondary><emphasis>Received:</emphasis> header</secondary>
28878 </indexterm>
28879 <indexterm role="concept">
28880 <primary><emphasis>Received:</emphasis> header line</primary>
28881 <secondary>customizing</secondary>
28882 </indexterm>
28883 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
28884 added to each message, except for the timestamp, which is automatically added
28885 on at the end (preceded by a semicolon). The string is expanded each time it is
28886 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
28887 added to the message. Otherwise, the string should start with the text
28888 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
28889 header lines. The default setting is:
28890 </para>
28891 <literallayout class="monospaced">
28892 received_header_text = Received: \
28893   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
28894   {${if def:sender_ident \
28895   {from ${quote_local_part:$sender_ident} }}\
28896   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
28897   by $primary_hostname \
28898   ${if def:received_protocol {with $received_protocol}} \
28899   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
28900   (Exim $version_number)\n\t\
28901   ${if def:sender_address \
28902   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
28903   id $message_exim_id\
28904   ${if def:received_for {\n\tfor $received_for}}
28905 </literallayout>
28906 <para>
28907 The reference to the TLS cipher is omitted when Exim is built without TLS
28908 support. The use of conditional expansions ensures that this works for both
28909 locally generated messages and messages received from remote hosts, giving
28910 header lines such as the following:
28911 </para>
28912 <literallayout class="monospaced">
28913 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
28914 by marley.carol.example with esmtp (Exim 4.00)
28915 (envelope-from &lt;bob@carol.example&gt;)
28916 id 16IOWa-00019l-00
28917 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
28918 Received: by scrooge.carol.example with local (Exim 4.00)
28919 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
28920 </literallayout>
28921 <para>
28922 Until the body of the message has been received, the timestamp is the time when
28923 the message started to be received. Once the body has arrived, and all policy
28924 checks have taken place, the timestamp is updated to the time at which the
28925 message was accepted.
28926 </para>
28927 <para>
28928 <indexterm role="option">
28929 <primary><option>received_headers_max</option></primary>
28930 </indexterm>
28931 </para>
28932 <informaltable frame="all">
28933 <tgroup cols="4" colsep="0" rowsep="0">
28934 <colspec colwidth="8*" align="left"/>
28935 <colspec colwidth="6*" align="center"/>
28936 <colspec colwidth="6*" align="center"/>
28937 <colspec colwidth="6*" align="right"/>
28938 <tbody>
28939 <row>
28940 <entry><option>received_headers_max</option></entry>
28941 <entry>Use: <emphasis>main</emphasis></entry>
28942 <entry>Type: <emphasis>integer</emphasis></entry>
28943 <entry>Default: <emphasis>30</emphasis></entry>
28944 </row>
28945 </tbody>
28946 </tgroup>
28947 </informaltable>
28948 <para>
28949 <indexterm role="concept">
28950 <primary>loop</primary>
28951 <secondary>prevention</secondary>
28952 </indexterm>
28953 <indexterm role="concept">
28954 <primary>mail loop prevention</primary>
28955 </indexterm>
28956 <indexterm role="concept">
28957 <primary><emphasis>Received:</emphasis> header line</primary>
28958 <secondary>counting</secondary>
28959 </indexterm>
28960 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
28961 counted, and if it is greater than this parameter, a mail loop is assumed to
28962 have occurred, the delivery is abandoned, and an error message is generated.
28963 This applies to both local and remote deliveries.
28964 </para>
28965 <para>
28966 <indexterm role="option">
28967 <primary><option>recipient_unqualified_hosts</option></primary>
28968 </indexterm>
28969 </para>
28970 <informaltable frame="all">
28971 <tgroup cols="4" colsep="0" rowsep="0">
28972 <colspec colwidth="8*" align="left"/>
28973 <colspec colwidth="6*" align="center"/>
28974 <colspec colwidth="6*" align="center"/>
28975 <colspec colwidth="6*" align="right"/>
28976 <tbody>
28977 <row>
28978 <entry><option>recipient_unqualified_hosts</option></entry>
28979 <entry>Use: <emphasis>main</emphasis></entry>
28980 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28981 <entry>Default: <emphasis>unset</emphasis></entry>
28982 </row>
28983 </tbody>
28984 </tgroup>
28985 </informaltable>
28986 <para>
28987 <indexterm role="concept">
28988 <primary>unqualified addresses</primary>
28989 </indexterm>
28990 <indexterm role="concept">
28991 <primary>host</primary>
28992 <secondary>unqualified addresses from</secondary>
28993 </indexterm>
28994 This option lists those hosts from which Exim is prepared to accept unqualified
28995 recipient addresses in message envelopes. The addresses are made fully
28996 qualified by the addition of the <option>qualify_recipient</option> value. This option also
28997 affects message header lines. Exim does not reject unqualified recipient
28998 addresses in headers, but it qualifies them only if the message came from a
28999 host that matches <option>recipient_unqualified_hosts</option>,
29000 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
29001 option was not set.
29002 </para>
29003 <para>
29004 <indexterm role="option">
29005 <primary><option>recipients_max</option></primary>
29006 </indexterm>
29007 </para>
29008 <informaltable frame="all">
29009 <tgroup cols="4" colsep="0" rowsep="0">
29010 <colspec colwidth="8*" align="left"/>
29011 <colspec colwidth="6*" align="center"/>
29012 <colspec colwidth="6*" align="center"/>
29013 <colspec colwidth="6*" align="right"/>
29014 <tbody>
29015 <row>
29016 <entry><option>recipients_max</option></entry>
29017 <entry>Use: <emphasis>main</emphasis></entry>
29018 <entry>Type: <emphasis>integer</emphasis></entry>
29019 <entry>Default: <emphasis>0</emphasis></entry>
29020 </row>
29021 </tbody>
29022 </tgroup>
29023 </informaltable>
29024 <para>
29025 <indexterm role="concept">
29026 <primary>limit</primary>
29027 <secondary>number of recipients</secondary>
29028 </indexterm>
29029 <indexterm role="concept">
29030 <primary>recipient</primary>
29031 <secondary>maximum number</secondary>
29032 </indexterm>
29033 If this option is set greater than zero, it specifies the maximum number of
29034 original recipients for any message. Additional recipients that are generated
29035 by aliasing or forwarding do not count. SMTP messages get a 452 response for
29036 all recipients over the limit; earlier recipients are delivered as normal.
29037 Non-SMTP messages with too many recipients are failed, and no deliveries are
29038 done.
29039 </para>
29040 <para>
29041 <indexterm role="concept">
29042 <primary>RCPT</primary>
29043 <secondary>maximum number of incoming</secondary>
29044 </indexterm>
29045 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
29046 RCPT commands in a single message.
29047 </para>
29048 <para>
29049 <indexterm role="option">
29050 <primary><option>recipients_max_reject</option></primary>
29051 </indexterm>
29052 </para>
29053 <informaltable frame="all">
29054 <tgroup cols="4" colsep="0" rowsep="0">
29055 <colspec colwidth="8*" align="left"/>
29056 <colspec colwidth="6*" align="center"/>
29057 <colspec colwidth="6*" align="center"/>
29058 <colspec colwidth="6*" align="right"/>
29059 <tbody>
29060 <row>
29061 <entry><option>recipients_max_reject</option></entry>
29062 <entry>Use: <emphasis>main</emphasis></entry>
29063 <entry>Type: <emphasis>boolean</emphasis></entry>
29064 <entry>Default: <emphasis>false</emphasis></entry>
29065 </row>
29066 </tbody>
29067 </tgroup>
29068 </informaltable>
29069 <para>
29070 If this option is set true, Exim rejects SMTP messages containing too many
29071 recipients by giving 552 errors to the surplus RCPT commands, and a 554
29072 error to the eventual DATA command. Otherwise (the default) it gives a 452
29073 error to the surplus RCPT commands and accepts the message on behalf of the
29074 initial set of recipients. The remote server should then re-send the message
29075 for the remaining recipients at a later time.
29076 </para>
29077 <para>
29078 <indexterm role="option">
29079 <primary><option>remote_max_parallel</option></primary>
29080 </indexterm>
29081 </para>
29082 <informaltable frame="all">
29083 <tgroup cols="4" colsep="0" rowsep="0">
29084 <colspec colwidth="8*" align="left"/>
29085 <colspec colwidth="6*" align="center"/>
29086 <colspec colwidth="6*" align="center"/>
29087 <colspec colwidth="6*" align="right"/>
29088 <tbody>
29089 <row>
29090 <entry><option>remote_max_parallel</option></entry>
29091 <entry>Use: <emphasis>main</emphasis></entry>
29092 <entry>Type: <emphasis>integer</emphasis></entry>
29093 <entry>Default: <emphasis>2</emphasis></entry>
29094 </row>
29095 </tbody>
29096 </tgroup>
29097 </informaltable>
29098 <para>
29099 <indexterm role="concept">
29100 <primary>delivery</primary>
29101 <secondary>parallelism for remote</secondary>
29102 </indexterm>
29103 This option controls parallel delivery of one message to a number of remote
29104 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
29105 does all the remote deliveries for a message one by one. Otherwise, if a single
29106 message has to be delivered to more than one remote host, or if several copies
29107 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
29108 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
29109 deliveries are required, the maximum number of processes are started, and as
29110 each one finishes, another is begun. The order of starting processes is the
29111 same as if sequential delivery were being done, and can be controlled by the
29112 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
29113 with debugging turned on, the debugging output from each delivery process is
29114 tagged with its process id.
29115 </para>
29116 <para>
29117 This option controls only the maximum number of parallel deliveries for one
29118 message in one Exim delivery process. Because Exim has no central queue
29119 manager, there is no way of controlling the total number of simultaneous
29120 deliveries if the configuration allows a delivery attempt as soon as a message
29121 is received.
29122 </para>
29123 <para>
29124 <indexterm role="concept">
29125 <primary>number of deliveries</primary>
29126 </indexterm>
29127 <indexterm role="concept">
29128 <primary>delivery</primary>
29129 <secondary>maximum number of</secondary>
29130 </indexterm>
29131 If you want to control the total number of deliveries on the system, you
29132 need to set the <option>queue_only</option> option. This ensures that all incoming messages
29133 are added to the queue without starting a delivery process. Then set up an Exim
29134 daemon to start queue runner processes at appropriate intervals (probably
29135 fairly often, for example, every minute), and limit the total number of queue
29136 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
29137 delivers only one message at a time, the maximum number of deliveries that can
29138 then take place at once is <option>queue_run_max</option> multiplied by
29139 <option>remote_max_parallel</option>.
29140 </para>
29141 <para>
29142 If it is purely remote deliveries you want to control, use
29143 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
29144 doing the SMTP routing before queueing, so that several messages for the same
29145 host will eventually get delivered down the same connection.
29146 </para>
29147 <para>
29148 <indexterm role="option">
29149 <primary><option>remote_sort_domains</option></primary>
29150 </indexterm>
29151 </para>
29152 <informaltable frame="all">
29153 <tgroup cols="4" colsep="0" rowsep="0">
29154 <colspec colwidth="8*" align="left"/>
29155 <colspec colwidth="6*" align="center"/>
29156 <colspec colwidth="6*" align="center"/>
29157 <colspec colwidth="6*" align="right"/>
29158 <tbody>
29159 <row>
29160 <entry><option>remote_sort_domains</option></entry>
29161 <entry>Use: <emphasis>main</emphasis></entry>
29162 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29163 <entry>Default: <emphasis>unset</emphasis></entry>
29164 </row>
29165 </tbody>
29166 </tgroup>
29167 </informaltable>
29168 <para>
29169 <indexterm role="concept">
29170 <primary>sorting remote deliveries</primary>
29171 </indexterm>
29172 <indexterm role="concept">
29173 <primary>delivery</primary>
29174 <secondary>sorting remote</secondary>
29175 </indexterm>
29176 When there are a number of remote deliveries for a message, they are sorted by
29177 domain into the order given by this list. For example,
29178 </para>
29179 <literallayout class="monospaced">
29180 remote_sort_domains = *.cam.ac.uk:*.uk
29181 </literallayout>
29182 <para>
29183 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
29184 then to those in the <option>uk</option> domain, then to any others.
29185 </para>
29186 <para>
29187 <indexterm role="option">
29188 <primary><option>retry_data_expire</option></primary>
29189 </indexterm>
29190 </para>
29191 <informaltable frame="all">
29192 <tgroup cols="4" colsep="0" rowsep="0">
29193 <colspec colwidth="8*" align="left"/>
29194 <colspec colwidth="6*" align="center"/>
29195 <colspec colwidth="6*" align="center"/>
29196 <colspec colwidth="6*" align="right"/>
29197 <tbody>
29198 <row>
29199 <entry><option>retry_data_expire</option></entry>
29200 <entry>Use: <emphasis>main</emphasis></entry>
29201 <entry>Type: <emphasis>time</emphasis></entry>
29202 <entry>Default: <emphasis>7d</emphasis></entry>
29203 </row>
29204 </tbody>
29205 </tgroup>
29206 </informaltable>
29207 <para>
29208 <indexterm role="concept">
29209 <primary>hints database</primary>
29210 <secondary>data expiry</secondary>
29211 </indexterm>
29212 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
29213 database. Any older retry data is ignored. This means that, for example, once a
29214 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
29215 past failures.
29216 </para>
29217 <para>
29218 <indexterm role="option">
29219 <primary><option>retry_interval_max</option></primary>
29220 </indexterm>
29221 </para>
29222 <informaltable frame="all">
29223 <tgroup cols="4" colsep="0" rowsep="0">
29224 <colspec colwidth="8*" align="left"/>
29225 <colspec colwidth="6*" align="center"/>
29226 <colspec colwidth="6*" align="center"/>
29227 <colspec colwidth="6*" align="right"/>
29228 <tbody>
29229 <row>
29230 <entry><option>retry_interval_max</option></entry>
29231 <entry>Use: <emphasis>main</emphasis></entry>
29232 <entry>Type: <emphasis>time</emphasis></entry>
29233 <entry>Default: <emphasis>24h</emphasis></entry>
29234 </row>
29235 </tbody>
29236 </tgroup>
29237 </informaltable>
29238 <para>
29239 <indexterm role="concept">
29240 <primary>retry</primary>
29241 <secondary>limit on interval</secondary>
29242 </indexterm>
29243 <indexterm role="concept">
29244 <primary>limit</primary>
29245 <secondary>on retry interval</secondary>
29246 </indexterm>
29247 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
29248 intervals between delivery attempts for messages that cannot be delivered
29249 straight away. This option sets an overall limit to the length of time between
29250 retries. It cannot be set greater than 24 hours; any attempt to do so forces
29251 the default value.
29252 </para>
29253 <para>
29254 <indexterm role="option">
29255 <primary><option>return_path_remove</option></primary>
29256 </indexterm>
29257 </para>
29258 <informaltable frame="all">
29259 <tgroup cols="4" colsep="0" rowsep="0">
29260 <colspec colwidth="8*" align="left"/>
29261 <colspec colwidth="6*" align="center"/>
29262 <colspec colwidth="6*" align="center"/>
29263 <colspec colwidth="6*" align="right"/>
29264 <tbody>
29265 <row>
29266 <entry><option>return_path_remove</option></entry>
29267 <entry>Use: <emphasis>main</emphasis></entry>
29268 <entry>Type: <emphasis>boolean</emphasis></entry>
29269 <entry>Default: <emphasis>true</emphasis></entry>
29270 </row>
29271 </tbody>
29272 </tgroup>
29273 </informaltable>
29274 <para>
29275 <indexterm role="concept">
29276 <primary><emphasis>Return-path:</emphasis> header line</primary>
29277 <secondary>removing</secondary>
29278 </indexterm>
29279 RFC 2821, section 4.4, states that an SMTP server must insert a
29280 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
29281 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
29282 MAIL command. This description implies that this header should not be present
29283 in an incoming message. If <option>return_path_remove</option> is true, any existing
29284 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
29285 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
29286 the time of delivery. They are normally used only for final local deliveries.
29287 </para>
29288 <para>
29289 <indexterm role="option">
29290 <primary><option>return_size_limit</option></primary>
29291 </indexterm>
29292 </para>
29293 <informaltable frame="all">
29294 <tgroup cols="4" colsep="0" rowsep="0">
29295 <colspec colwidth="8*" align="left"/>
29296 <colspec colwidth="6*" align="center"/>
29297 <colspec colwidth="6*" align="center"/>
29298 <colspec colwidth="6*" align="right"/>
29299 <tbody>
29300 <row>
29301 <entry><option>return_size_limit</option></entry>
29302 <entry>Use: <emphasis>main</emphasis></entry>
29303 <entry>Type: <emphasis>integer</emphasis></entry>
29304 <entry>Default: <emphasis>100K</emphasis></entry>
29305 </row>
29306 </tbody>
29307 </tgroup>
29308 </informaltable>
29309 <para>
29310 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
29311 </para>
29312 <para>
29313 <indexterm role="option">
29314 <primary><option>rfc1413_hosts</option></primary>
29315 </indexterm>
29316 </para>
29317 <informaltable frame="all">
29318 <tgroup cols="4" colsep="0" rowsep="0">
29319 <colspec colwidth="8*" align="left"/>
29320 <colspec colwidth="6*" align="center"/>
29321 <colspec colwidth="6*" align="center"/>
29322 <colspec colwidth="6*" align="right"/>
29323 <tbody>
29324 <row>
29325 <entry><option>rfc1413_hosts</option></entry>
29326 <entry>Use: <emphasis>main</emphasis></entry>
29327 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29328 <entry>Default: <emphasis>@[]</emphasis></entry>
29329 </row>
29330 </tbody>
29331 </tgroup>
29332 </informaltable>
29333 <para>
29334 <indexterm role="concept">
29335 <primary>RFC 1413</primary>
29336 </indexterm>
29337 <indexterm role="concept">
29338 <primary>host</primary>
29339 <secondary>for RFC 1413 calls</secondary>
29340 </indexterm>
29341 RFC 1413 identification calls are made to any client host which matches
29342 an item in the list.
29343 The default value specifies just this host, being any local interface
29344 for the system.
29345 </para>
29346 <para>
29347 <indexterm role="option">
29348 <primary><option>rfc1413_query_timeout</option></primary>
29349 </indexterm>
29350 </para>
29351 <informaltable frame="all">
29352 <tgroup cols="4" colsep="0" rowsep="0">
29353 <colspec colwidth="8*" align="left"/>
29354 <colspec colwidth="6*" align="center"/>
29355 <colspec colwidth="6*" align="center"/>
29356 <colspec colwidth="6*" align="right"/>
29357 <tbody>
29358 <row>
29359 <entry><option>rfc1413_query_timeout</option></entry>
29360 <entry>Use: <emphasis>main</emphasis></entry>
29361 <entry>Type: <emphasis>time</emphasis></entry>
29362 <entry>Default: <emphasis>0s</emphasis></entry>
29363 </row>
29364 </tbody>
29365 </tgroup>
29366 </informaltable>
29367 <para>
29368 <indexterm role="concept">
29369 <primary>RFC 1413</primary>
29370 <secondary>query timeout</secondary>
29371 </indexterm>
29372 <indexterm role="concept">
29373 <primary>timeout</primary>
29374 <secondary>for RFC 1413 call</secondary>
29375 </indexterm>
29376 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
29377 no RFC 1413 calls are ever made.
29378 </para>
29379 <para>
29380 <indexterm role="option">
29381 <primary><option>sender_unqualified_hosts</option></primary>
29382 </indexterm>
29383 </para>
29384 <informaltable frame="all">
29385 <tgroup cols="4" colsep="0" rowsep="0">
29386 <colspec colwidth="8*" align="left"/>
29387 <colspec colwidth="6*" align="center"/>
29388 <colspec colwidth="6*" align="center"/>
29389 <colspec colwidth="6*" align="right"/>
29390 <tbody>
29391 <row>
29392 <entry><option>sender_unqualified_hosts</option></entry>
29393 <entry>Use: <emphasis>main</emphasis></entry>
29394 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29395 <entry>Default: <emphasis>unset</emphasis></entry>
29396 </row>
29397 </tbody>
29398 </tgroup>
29399 </informaltable>
29400 <para>
29401 <indexterm role="concept">
29402 <primary>unqualified addresses</primary>
29403 </indexterm>
29404 <indexterm role="concept">
29405 <primary>host</primary>
29406 <secondary>unqualified addresses from</secondary>
29407 </indexterm>
29408 This option lists those hosts from which Exim is prepared to accept unqualified
29409 sender addresses. The addresses are made fully qualified by the addition of
29410 <option>qualify_domain</option>. This option also affects message header lines. Exim does
29411 not reject unqualified addresses in headers that contain sender addresses, but
29412 it qualifies them only if the message came from a host that matches
29413 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
29414 using TCP/IP), and the <option>-bnq</option> option was not set.
29415 </para>
29416 <para>
29417 <indexterm role="option">
29418 <primary><option>set_environment</option></primary>
29419 </indexterm>
29420 </para>
29421 <informaltable frame="all">
29422 <tgroup cols="4" colsep="0" rowsep="0">
29423 <colspec colwidth="8*" align="left"/>
29424 <colspec colwidth="6*" align="center"/>
29425 <colspec colwidth="6*" align="center"/>
29426 <colspec colwidth="6*" align="right"/>
29427 <tbody>
29428 <row>
29429 <entry><option>set_environment</option></entry>
29430 <entry>Use: <emphasis>main</emphasis></entry>
29431 <entry>Type: <emphasis>string list</emphasis></entry>
29432 <entry>Default: <emphasis>empty</emphasis></entry>
29433 </row>
29434 </tbody>
29435 </tgroup>
29436 </informaltable>
29437 <para>
29438 <indexterm role="concept">
29439 <primary>environment</primary>
29440 </indexterm>
29441 This option allows to set individual environment variables that the
29442 currently linked libraries and programs in child processes use. The
29443 default list is empty,
29444 </para>
29445 <para>
29446 <indexterm role="option">
29447 <primary><option>slow_lookup_log</option></primary>
29448 </indexterm>
29449 </para>
29450 <informaltable frame="all">
29451 <tgroup cols="4" colsep="0" rowsep="0">
29452 <colspec colwidth="8*" align="left"/>
29453 <colspec colwidth="6*" align="center"/>
29454 <colspec colwidth="6*" align="center"/>
29455 <colspec colwidth="6*" align="right"/>
29456 <tbody>
29457 <row>
29458 <entry><option>slow_lookup_log</option></entry>
29459 <entry>Use: <emphasis>main</emphasis></entry>
29460 <entry>Type: <emphasis>integer</emphasis></entry>
29461 <entry>Default: <emphasis>0</emphasis></entry>
29462 </row>
29463 </tbody>
29464 </tgroup>
29465 </informaltable>
29466 <para>
29467 <indexterm role="concept">
29468 <primary>logging</primary>
29469 <secondary>slow lookups</secondary>
29470 </indexterm>
29471 <indexterm role="concept">
29472 <primary>dns</primary>
29473 <secondary>logging slow lookups</secondary>
29474 </indexterm>
29475 This option controls logging of slow lookups.
29476 If the value is nonzero it is taken as a number of milliseconds
29477 and lookups taking longer than this are logged.
29478 Currently this applies only to DNS lookups.
29479 </para>
29480 <para>
29481 <indexterm role="option">
29482 <primary><option>smtp_accept_keepalive</option></primary>
29483 </indexterm>
29484 </para>
29485 <informaltable frame="all">
29486 <tgroup cols="4" colsep="0" rowsep="0">
29487 <colspec colwidth="8*" align="left"/>
29488 <colspec colwidth="6*" align="center"/>
29489 <colspec colwidth="6*" align="center"/>
29490 <colspec colwidth="6*" align="right"/>
29491 <tbody>
29492 <row>
29493 <entry><option>smtp_accept_keepalive</option></entry>
29494 <entry>Use: <emphasis>main</emphasis></entry>
29495 <entry>Type: <emphasis>boolean</emphasis></entry>
29496 <entry>Default: <emphasis>true</emphasis></entry>
29497 </row>
29498 </tbody>
29499 </tgroup>
29500 </informaltable>
29501 <para>
29502 <indexterm role="concept">
29503 <primary>keepalive</primary>
29504 <secondary>on incoming connection</secondary>
29505 </indexterm>
29506 This option controls the setting of the SO_KEEPALIVE option on incoming
29507 TCP/IP socket connections. When set, it causes the kernel to probe idle
29508 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
29509 other end of the connection should send an acknowledgment if the connection is
29510 still okay or a reset if the connection has been aborted. The reason for doing
29511 this is that it has the beneficial effect of freeing up certain types of
29512 connection that can get stuck when the remote host is disconnected without
29513 tidying up the TCP/IP call properly. The keepalive mechanism takes several
29514 hours to detect unreachable hosts.
29515 </para>
29516 <para>
29517 <indexterm role="option">
29518 <primary><option>smtp_accept_max</option></primary>
29519 </indexterm>
29520 </para>
29521 <informaltable frame="all">
29522 <tgroup cols="4" colsep="0" rowsep="0">
29523 <colspec colwidth="8*" align="left"/>
29524 <colspec colwidth="6*" align="center"/>
29525 <colspec colwidth="6*" align="center"/>
29526 <colspec colwidth="6*" align="right"/>
29527 <tbody>
29528 <row>
29529 <entry><option>smtp_accept_max</option></entry>
29530 <entry>Use: <emphasis>main</emphasis></entry>
29531 <entry>Type: <emphasis>integer</emphasis></entry>
29532 <entry>Default: <emphasis>20</emphasis></entry>
29533 </row>
29534 </tbody>
29535 </tgroup>
29536 </informaltable>
29537 <para>
29538 <indexterm role="concept">
29539 <primary>limit</primary>
29540 <secondary>incoming SMTP connections</secondary>
29541 </indexterm>
29542 <indexterm role="concept">
29543 <primary>SMTP</primary>
29544 <secondary>incoming connection count</secondary>
29545 </indexterm>
29546 <indexterm role="concept">
29547 <primary>inetd</primary>
29548 </indexterm>
29549 This option specifies the maximum number of simultaneous incoming SMTP calls
29550 that Exim will accept. It applies only to the listening daemon; there is no
29551 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
29552 value is set to zero, no limit is applied. However, it is required to be
29553 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
29554 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
29555 </para>
29556 <para>
29557 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
29558 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
29559 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
29560 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
29561 </para>
29562 <para>
29563 <indexterm role="option">
29564 <primary><option>smtp_accept_max_nonmail</option></primary>
29565 </indexterm>
29566 </para>
29567 <informaltable frame="all">
29568 <tgroup cols="4" colsep="0" rowsep="0">
29569 <colspec colwidth="8*" align="left"/>
29570 <colspec colwidth="6*" align="center"/>
29571 <colspec colwidth="6*" align="center"/>
29572 <colspec colwidth="6*" align="right"/>
29573 <tbody>
29574 <row>
29575 <entry><option>smtp_accept_max_nonmail</option></entry>
29576 <entry>Use: <emphasis>main</emphasis></entry>
29577 <entry>Type: <emphasis>integer</emphasis></entry>
29578 <entry>Default: <emphasis>10</emphasis></entry>
29579 </row>
29580 </tbody>
29581 </tgroup>
29582 </informaltable>
29583 <para>
29584 <indexterm role="concept">
29585 <primary>limit</primary>
29586 <secondary>non-mail SMTP commands</secondary>
29587 </indexterm>
29588 <indexterm role="concept">
29589 <primary>SMTP</primary>
29590 <secondary>limiting non-mail commands</secondary>
29591 </indexterm>
29592 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
29593 the connection if there are too many. This option defines <quote>too many</quote>. The
29594 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
29595 client looping sending EHLO, for example. The check is applied only if the
29596 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
29597 </para>
29598 <para>
29599 When a new message is expected, one occurrence of RSET is not counted. This
29600 allows a client to send one RSET between messages (this is not necessary,
29601 but some clients do it). Exim also allows one uncounted occurrence of HELO
29602 or EHLO, and one occurrence of STARTTLS between messages. After
29603 starting up a TLS session, another EHLO is expected, and so it too is not
29604 counted. The first occurrence of AUTH in a connection, or immediately
29605 following STARTTLS is not counted. Otherwise, all commands other than
29606 MAIL, RCPT, DATA, and QUIT are counted.
29607 </para>
29608 <para>
29609 <indexterm role="option">
29610 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
29611 </indexterm>
29612 </para>
29613 <informaltable frame="all">
29614 <tgroup cols="4" colsep="0" rowsep="0">
29615 <colspec colwidth="8*" align="left"/>
29616 <colspec colwidth="6*" align="center"/>
29617 <colspec colwidth="6*" align="center"/>
29618 <colspec colwidth="6*" align="right"/>
29619 <tbody>
29620 <row>
29621 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
29622 <entry>Use: <emphasis>main</emphasis></entry>
29623 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29624 <entry>Default: <emphasis>*</emphasis></entry>
29625 </row>
29626 </tbody>
29627 </tgroup>
29628 </informaltable>
29629 <para>
29630 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
29631 check by setting this option. The default value makes it apply to all hosts. By
29632 changing the value, you can exclude any badly-behaved hosts that you have to
29633 live with.
29634 </para>
29635 <para>
29636 <indexterm role="option">
29637 <primary><option>smtp_accept_max_per_connection</option></primary>
29638 </indexterm>
29639 </para>
29640 <informaltable frame="all">
29641 <tgroup cols="4" colsep="0" rowsep="0">
29642 <colspec colwidth="8*" align="left"/>
29643 <colspec colwidth="6*" align="center"/>
29644 <colspec colwidth="6*" align="center"/>
29645 <colspec colwidth="6*" align="right"/>
29646 <tbody>
29647 <row>
29648 <entry><option>smtp_accept_max_per_connection</option></entry>
29649 <entry>Use: <emphasis>main</emphasis></entry>
29650 <entry>Type: <emphasis>integer</emphasis></entry>
29651 <entry>Default: <emphasis>1000</emphasis></entry>
29652 </row>
29653 </tbody>
29654 </tgroup>
29655 </informaltable>
29656 <para>
29657 <indexterm role="concept">
29658 <primary>SMTP</primary>
29659 <secondary>limiting incoming message count</secondary>
29660 </indexterm>
29661 <indexterm role="concept">
29662 <primary>limit</primary>
29663 <secondary>messages per SMTP connection</secondary>
29664 </indexterm>
29665 The value of this option limits the number of MAIL commands that Exim is
29666 prepared to accept over a single SMTP connection, whether or not each command
29667 results in the transfer of a message. After the limit is reached, a 421
29668 response is given to subsequent MAIL commands. This limit is a safety
29669 precaution against a client that goes mad (incidents of this type have been
29670 seen).
29671 </para>
29672 <para>
29673 <indexterm role="option">
29674 <primary><option>smtp_accept_max_per_host</option></primary>
29675 </indexterm>
29676 </para>
29677 <informaltable frame="all">
29678 <tgroup cols="4" colsep="0" rowsep="0">
29679 <colspec colwidth="8*" align="left"/>
29680 <colspec colwidth="6*" align="center"/>
29681 <colspec colwidth="6*" align="center"/>
29682 <colspec colwidth="6*" align="right"/>
29683 <tbody>
29684 <row>
29685 <entry><option>smtp_accept_max_per_host</option></entry>
29686 <entry>Use: <emphasis>main</emphasis></entry>
29687 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29688 <entry>Default: <emphasis>unset</emphasis></entry>
29689 </row>
29690 </tbody>
29691 </tgroup>
29692 </informaltable>
29693 <para>
29694 <indexterm role="concept">
29695 <primary>limit</primary>
29696 <secondary>SMTP connections from one host</secondary>
29697 </indexterm>
29698 <indexterm role="concept">
29699 <primary>host</primary>
29700 <secondary>limiting SMTP connections from</secondary>
29701 </indexterm>
29702 This option restricts the number of simultaneous IP connections from a single
29703 host (strictly, from a single IP address) to the Exim daemon. The option is
29704 expanded, to enable different limits to be applied to different hosts by
29705 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
29706 connection attempts from the same host are rejected with error code 421. This
29707 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
29708 of zero imposes no limit. If this option is set greater than zero, it is
29709 required that <option>smtp_accept_max</option> be non-zero.
29710 </para>
29711 <para>
29712 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
29713 constructions that take an appreciable amount of time. The expansion and test
29714 happen in the main daemon loop, in order to reject additional connections
29715 without forking additional processes (otherwise a denial-of-service attack
29716 could cause a vast number or processes to be created). While the daemon is
29717 doing this processing, it cannot accept any other incoming connections.
29718 </para>
29719 <para>
29720 <indexterm role="option">
29721 <primary><option>smtp_accept_queue</option></primary>
29722 </indexterm>
29723 </para>
29724 <informaltable frame="all">
29725 <tgroup cols="4" colsep="0" rowsep="0">
29726 <colspec colwidth="8*" align="left"/>
29727 <colspec colwidth="6*" align="center"/>
29728 <colspec colwidth="6*" align="center"/>
29729 <colspec colwidth="6*" align="right"/>
29730 <tbody>
29731 <row>
29732 <entry><option>smtp_accept_queue</option></entry>
29733 <entry>Use: <emphasis>main</emphasis></entry>
29734 <entry>Type: <emphasis>integer</emphasis></entry>
29735 <entry>Default: <emphasis>0</emphasis></entry>
29736 </row>
29737 </tbody>
29738 </tgroup>
29739 </informaltable>
29740 <para>
29741 <indexterm role="concept">
29742 <primary>SMTP</primary>
29743 <secondary>incoming connection count</secondary>
29744 </indexterm>
29745 <indexterm role="concept">
29746 <primary>queueing incoming messages</primary>
29747 </indexterm>
29748 <indexterm role="concept">
29749 <primary>message</primary>
29750 <secondary>queueing by SMTP connection count</secondary>
29751 </indexterm>
29752 If the number of simultaneous incoming SMTP connections being handled via the
29753 listening daemon exceeds this value, messages received by SMTP are just placed
29754 on the queue; no delivery processes are started automatically. The count is
29755 fixed at the start of an SMTP connection. It cannot be updated in the
29756 subprocess that receives messages, and so the queueing or not queueing applies
29757 to all messages received in the same connection.
29758 </para>
29759 <para>
29760 A value of zero implies no limit, and clearly any non-zero value is useful only
29761 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
29762 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
29763 various <option>-od</option><emphasis>x</emphasis> command line options.
29764 </para>
29765 <para>
29766 <indexterm role="option">
29767 <primary><option>smtp_accept_queue_per_connection</option></primary>
29768 </indexterm>
29769 </para>
29770 <informaltable frame="all">
29771 <tgroup cols="4" colsep="0" rowsep="0">
29772 <colspec colwidth="8*" align="left"/>
29773 <colspec colwidth="6*" align="center"/>
29774 <colspec colwidth="6*" align="center"/>
29775 <colspec colwidth="6*" align="right"/>
29776 <tbody>
29777 <row>
29778 <entry><option>smtp_accept_queue_per_connection</option></entry>
29779 <entry>Use: <emphasis>main</emphasis></entry>
29780 <entry>Type: <emphasis>integer</emphasis></entry>
29781 <entry>Default: <emphasis>10</emphasis></entry>
29782 </row>
29783 </tbody>
29784 </tgroup>
29785 </informaltable>
29786 <para>
29787 <indexterm role="concept">
29788 <primary>queueing incoming messages</primary>
29789 </indexterm>
29790 <indexterm role="concept">
29791 <primary>message</primary>
29792 <secondary>queueing by message count</secondary>
29793 </indexterm>
29794 This option limits the number of delivery processes that Exim starts
29795 automatically when receiving messages via SMTP, whether via the daemon or by
29796 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
29797 and the number of messages received in a single SMTP session exceeds this
29798 number, subsequent messages are placed on the queue, but no delivery processes
29799 are started. This helps to limit the number of Exim processes when a server
29800 restarts after downtime and there is a lot of mail waiting for it on other
29801 systems. On large systems, the default should probably be increased, and on
29802 dial-in client systems it should probably be set to zero (that is, disabled).
29803 </para>
29804 <para>
29805 <indexterm role="option">
29806 <primary><option>smtp_accept_reserve</option></primary>
29807 </indexterm>
29808 </para>
29809 <informaltable frame="all">
29810 <tgroup cols="4" colsep="0" rowsep="0">
29811 <colspec colwidth="8*" align="left"/>
29812 <colspec colwidth="6*" align="center"/>
29813 <colspec colwidth="6*" align="center"/>
29814 <colspec colwidth="6*" align="right"/>
29815 <tbody>
29816 <row>
29817 <entry><option>smtp_accept_reserve</option></entry>
29818 <entry>Use: <emphasis>main</emphasis></entry>
29819 <entry>Type: <emphasis>integer</emphasis></entry>
29820 <entry>Default: <emphasis>0</emphasis></entry>
29821 </row>
29822 </tbody>
29823 </tgroup>
29824 </informaltable>
29825 <para>
29826 <indexterm role="concept">
29827 <primary>SMTP</primary>
29828 <secondary>incoming call count</secondary>
29829 </indexterm>
29830 <indexterm role="concept">
29831 <primary>host</primary>
29832 <secondary>reserved</secondary>
29833 </indexterm>
29834 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
29835 number of SMTP connections that are reserved for connections from the hosts
29836 that are specified in <option>smtp_reserve_hosts</option>. The value set in
29837 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
29838 restricted to this number of connections; the option specifies a minimum number
29839 of connection slots for them, not a maximum. It is a guarantee that this group
29840 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
29841 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
29842 individual host.
29843 </para>
29844 <para>
29845 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
29846 set to 5, once there are 45 active connections (from any hosts), new
29847 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
29848 provided the other criteria for acceptance are met.
29849 </para>
29850 <para>
29851 <indexterm role="option">
29852 <primary><option>smtp_active_hostname</option></primary>
29853 </indexterm>
29854 </para>
29855 <informaltable frame="all">
29856 <tgroup cols="4" colsep="0" rowsep="0">
29857 <colspec colwidth="8*" align="left"/>
29858 <colspec colwidth="6*" align="center"/>
29859 <colspec colwidth="6*" align="center"/>
29860 <colspec colwidth="6*" align="right"/>
29861 <tbody>
29862 <row>
29863 <entry><option>smtp_active_hostname</option></entry>
29864 <entry>Use: <emphasis>main</emphasis></entry>
29865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29866 <entry>Default: <emphasis>unset</emphasis></entry>
29867 </row>
29868 </tbody>
29869 </tgroup>
29870 </informaltable>
29871 <para>
29872 <indexterm role="concept">
29873 <primary>host</primary>
29874 <secondary>name in SMTP responses</secondary>
29875 </indexterm>
29876 <indexterm role="concept">
29877 <primary>SMTP</primary>
29878 <secondary>host name in responses</secondary>
29879 </indexterm>
29880 <indexterm role="variable">
29881 <primary><varname>$primary_hostname</varname></primary>
29882 </indexterm>
29883 This option is provided for multi-homed servers that want to masquerade as
29884 several different hosts. At the start of an incoming SMTP connection, its value
29885 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
29886 responses. For example, it is used as domain name in the response to an
29887 incoming HELO or EHLO command.
29888 </para>
29889 <para>
29890 <indexterm role="variable">
29891 <primary><varname>$smtp_active_hostname</varname></primary>
29892 </indexterm>
29893 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
29894 is saved with any messages that are received. It is therefore available for use
29895 in routers and transports when the message is later delivered.
29896 </para>
29897 <para>
29898 If this option is unset, or if its expansion is forced to fail, or if the
29899 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
29900 used. Other expansion failures cause a message to be written to the main and
29901 panic logs, and the SMTP command receives a temporary error. Typically, the
29902 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
29903 For example:
29904 </para>
29905 <literallayout class="monospaced">
29906 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
29907   {cox.mydomain}{box.mydomain}}
29908 </literallayout>
29909 <para>
29910 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
29911 messages, it is also used as the default for HELO commands in callout
29912 verification if there is no remote transport from which to obtain a
29913 <option>helo_data</option> value.
29914 </para>
29915 <para>
29916 <indexterm role="option">
29917 <primary><option>smtp_banner</option></primary>
29918 </indexterm>
29919 </para>
29920 <informaltable frame="all">
29921 <tgroup cols="4" colsep="0" rowsep="0">
29922 <colspec colwidth="8*" align="left"/>
29923 <colspec colwidth="6*" align="center"/>
29924 <colspec colwidth="6*" align="center"/>
29925 <colspec colwidth="6*" align="right"/>
29926 <tbody>
29927 <row>
29928 <entry><option>smtp_banner</option></entry>
29929 <entry>Use: <emphasis>main</emphasis></entry>
29930 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29931 <entry>Default: <emphasis>see below</emphasis></entry>
29932 </row>
29933 </tbody>
29934 </tgroup>
29935 </informaltable>
29936 <para>
29937 <indexterm role="concept">
29938 <primary>SMTP</primary>
29939 <secondary>welcome banner</secondary>
29940 </indexterm>
29941 <indexterm role="concept">
29942 <primary>banner for SMTP</primary>
29943 </indexterm>
29944 <indexterm role="concept">
29945 <primary>welcome banner for SMTP</primary>
29946 </indexterm>
29947 <indexterm role="concept">
29948 <primary>customizing</primary>
29949 <secondary>SMTP banner</secondary>
29950 </indexterm>
29951 This string, which is expanded every time it is used, is output as the initial
29952 positive response to an SMTP connection. The default setting is:
29953 </para>
29954 <literallayout class="monospaced">
29955 smtp_banner = $smtp_active_hostname ESMTP Exim \
29956   $version_number $tod_full
29957 </literallayout>
29958 <para>
29959 Failure to expand the string causes a panic error. If you want to create a
29960 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
29961 appropriate points, but not at the end. Note that the 220 code is not included
29962 in this string. Exim adds it automatically (several times in the case of a
29963 multiline response).
29964 </para>
29965 <para>
29966 <indexterm role="option">
29967 <primary><option>smtp_check_spool_space</option></primary>
29968 </indexterm>
29969 </para>
29970 <informaltable frame="all">
29971 <tgroup cols="4" colsep="0" rowsep="0">
29972 <colspec colwidth="8*" align="left"/>
29973 <colspec colwidth="6*" align="center"/>
29974 <colspec colwidth="6*" align="center"/>
29975 <colspec colwidth="6*" align="right"/>
29976 <tbody>
29977 <row>
29978 <entry><option>smtp_check_spool_space</option></entry>
29979 <entry>Use: <emphasis>main</emphasis></entry>
29980 <entry>Type: <emphasis>boolean</emphasis></entry>
29981 <entry>Default: <emphasis>true</emphasis></entry>
29982 </row>
29983 </tbody>
29984 </tgroup>
29985 </informaltable>
29986 <para>
29987 <indexterm role="concept">
29988 <primary>checking disk space</primary>
29989 </indexterm>
29990 <indexterm role="concept">
29991 <primary>disk space, checking</primary>
29992 </indexterm>
29993 <indexterm role="concept">
29994 <primary>spool directory</primary>
29995 <secondary>checking space</secondary>
29996 </indexterm>
29997 When this option is set, if an incoming SMTP session encounters the SIZE
29998 option on a MAIL command, it checks that there is enough space in the
29999 spool directory&#x2019;s partition to accept a message of that size, while still
30000 leaving free the amount specified by <option>check_spool_space</option> (even if that value
30001 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
30002 </para>
30003 <para>
30004 <indexterm role="option">
30005 <primary><option>smtp_connect_backlog</option></primary>
30006 </indexterm>
30007 </para>
30008 <informaltable frame="all">
30009 <tgroup cols="4" colsep="0" rowsep="0">
30010 <colspec colwidth="8*" align="left"/>
30011 <colspec colwidth="6*" align="center"/>
30012 <colspec colwidth="6*" align="center"/>
30013 <colspec colwidth="6*" align="right"/>
30014 <tbody>
30015 <row>
30016 <entry><option>smtp_connect_backlog</option></entry>
30017 <entry>Use: <emphasis>main</emphasis></entry>
30018 <entry>Type: <emphasis>integer</emphasis></entry>
30019 <entry>Default: <emphasis>20</emphasis></entry>
30020 </row>
30021 </tbody>
30022 </tgroup>
30023 </informaltable>
30024 <para>
30025 <indexterm role="concept">
30026 <primary>connection backlog</primary>
30027 </indexterm>
30028 <indexterm role="concept">
30029 <primary>SMTP</primary>
30030 <secondary>connection backlog</secondary>
30031 </indexterm>
30032 <indexterm role="concept">
30033 <primary>backlog of connections</primary>
30034 </indexterm>
30035 This option specifies a maximum number of waiting SMTP connections. Exim passes
30036 this value to the TCP/IP system when it sets up its listener. Once this number
30037 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
30038 attempts are refused at the TCP/IP level. At least, that is what the manuals
30039 say; in some circumstances such connection attempts have been observed to time
30040 out instead. For large systems it is probably a good idea to increase the
30041 value (to 50, say). It also gives some protection against denial-of-service
30042 attacks by SYN flooding.
30043 </para>
30044 <para>
30045 <indexterm role="option">
30046 <primary><option>smtp_enforce_sync</option></primary>
30047 </indexterm>
30048 </para>
30049 <informaltable frame="all">
30050 <tgroup cols="4" colsep="0" rowsep="0">
30051 <colspec colwidth="8*" align="left"/>
30052 <colspec colwidth="6*" align="center"/>
30053 <colspec colwidth="6*" align="center"/>
30054 <colspec colwidth="6*" align="right"/>
30055 <tbody>
30056 <row>
30057 <entry><option>smtp_enforce_sync</option></entry>
30058 <entry>Use: <emphasis>main</emphasis></entry>
30059 <entry>Type: <emphasis>boolean</emphasis></entry>
30060 <entry>Default: <emphasis>true</emphasis></entry>
30061 </row>
30062 </tbody>
30063 </tgroup>
30064 </informaltable>
30065 <para>
30066 <indexterm role="concept">
30067 <primary>SMTP</primary>
30068 <secondary>synchronization checking</secondary>
30069 </indexterm>
30070 <indexterm role="concept">
30071 <primary>synchronization checking in SMTP</primary>
30072 </indexterm>
30073 The SMTP protocol specification requires the client to wait for a response from
30074 the server at certain points in the dialogue. Without PIPELINING these
30075 synchronization points are after every command; with PIPELINING they are
30076 fewer, but they still exist.
30077 </para>
30078 <para>
30079 Some spamming sites send out a complete set of SMTP commands without waiting
30080 for any response. Exim protects against this by rejecting a message if the
30081 client has sent further input when it should not have. The error response <quote>554
30082 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
30083 for this error cannot be perfect because of transmission delays (unexpected
30084 input may be on its way but not yet received when Exim checks). However, it
30085 does detect many instances.
30086 </para>
30087 <para>
30088 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
30089 If you want to disable the check selectively (for example, only for certain
30090 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
30091 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
30092 </para>
30093 <para>
30094 <indexterm role="option">
30095 <primary><option>smtp_etrn_command</option></primary>
30096 </indexterm>
30097 </para>
30098 <informaltable frame="all">
30099 <tgroup cols="4" colsep="0" rowsep="0">
30100 <colspec colwidth="8*" align="left"/>
30101 <colspec colwidth="6*" align="center"/>
30102 <colspec colwidth="6*" align="center"/>
30103 <colspec colwidth="6*" align="right"/>
30104 <tbody>
30105 <row>
30106 <entry><option>smtp_etrn_command</option></entry>
30107 <entry>Use: <emphasis>main</emphasis></entry>
30108 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30109 <entry>Default: <emphasis>unset</emphasis></entry>
30110 </row>
30111 </tbody>
30112 </tgroup>
30113 </informaltable>
30114 <para>
30115 <indexterm role="concept">
30116 <primary>ETRN</primary>
30117 <secondary>command to be run</secondary>
30118 </indexterm>
30119 <indexterm role="variable">
30120 <primary><varname>$domain</varname></primary>
30121 </indexterm>
30122 If this option is set, the given command is run whenever an SMTP ETRN
30123 command is received from a host that is permitted to issue such commands (see
30124 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
30125 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
30126 argument of the ETRN command, and no syntax checking is done on it. For
30127 example:
30128 </para>
30129 <literallayout class="monospaced">
30130 smtp_etrn_command = /etc/etrn_command $domain \
30131                     $sender_host_address
30132 </literallayout>
30133 <para>
30134 A new process is created to run the command, but Exim does not wait for it to
30135 complete. Consequently, its status cannot be checked. If the command cannot be
30136 run, a line is written to the panic log, but the ETRN caller still receives
30137 a 250 success response. Exim is normally running under its own uid when
30138 receiving SMTP, so it is not possible for it to change the uid before running
30139 the command.
30140 </para>
30141 <para>
30142 <indexterm role="option">
30143 <primary><option>smtp_etrn_serialize</option></primary>
30144 </indexterm>
30145 </para>
30146 <informaltable frame="all">
30147 <tgroup cols="4" colsep="0" rowsep="0">
30148 <colspec colwidth="8*" align="left"/>
30149 <colspec colwidth="6*" align="center"/>
30150 <colspec colwidth="6*" align="center"/>
30151 <colspec colwidth="6*" align="right"/>
30152 <tbody>
30153 <row>
30154 <entry><option>smtp_etrn_serialize</option></entry>
30155 <entry>Use: <emphasis>main</emphasis></entry>
30156 <entry>Type: <emphasis>boolean</emphasis></entry>
30157 <entry>Default: <emphasis>true</emphasis></entry>
30158 </row>
30159 </tbody>
30160 </tgroup>
30161 </informaltable>
30162 <para>
30163 <indexterm role="concept">
30164 <primary>ETRN</primary>
30165 <secondary>serializing</secondary>
30166 </indexterm>
30167 When this option is set, it prevents the simultaneous execution of more than
30168 one identical command as a result of ETRN in an SMTP connection. See
30169 section <xref linkend="SECTETRN"/> for details.
30170 </para>
30171 <para>
30172 <indexterm role="option">
30173 <primary><option>smtp_load_reserve</option></primary>
30174 </indexterm>
30175 </para>
30176 <informaltable frame="all">
30177 <tgroup cols="4" colsep="0" rowsep="0">
30178 <colspec colwidth="8*" align="left"/>
30179 <colspec colwidth="6*" align="center"/>
30180 <colspec colwidth="6*" align="center"/>
30181 <colspec colwidth="6*" align="right"/>
30182 <tbody>
30183 <row>
30184 <entry><option>smtp_load_reserve</option></entry>
30185 <entry>Use: <emphasis>main</emphasis></entry>
30186 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30187 <entry>Default: <emphasis>unset</emphasis></entry>
30188 </row>
30189 </tbody>
30190 </tgroup>
30191 </informaltable>
30192 <para>
30193 <indexterm role="concept">
30194 <primary>load average</primary>
30195 </indexterm>
30196 If the system load average ever gets higher than this, incoming SMTP calls are
30197 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
30198 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
30199 the load is over the limit. The option has no effect on ancient operating
30200 systems on which Exim cannot determine the load average. See also
30201 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
30202 </para>
30203 <para>
30204 <indexterm role="option">
30205 <primary><option>smtp_max_synprot_errors</option></primary>
30206 </indexterm>
30207 </para>
30208 <informaltable frame="all">
30209 <tgroup cols="4" colsep="0" rowsep="0">
30210 <colspec colwidth="8*" align="left"/>
30211 <colspec colwidth="6*" align="center"/>
30212 <colspec colwidth="6*" align="center"/>
30213 <colspec colwidth="6*" align="right"/>
30214 <tbody>
30215 <row>
30216 <entry><option>smtp_max_synprot_errors</option></entry>
30217 <entry>Use: <emphasis>main</emphasis></entry>
30218 <entry>Type: <emphasis>integer</emphasis></entry>
30219 <entry>Default: <emphasis>3</emphasis></entry>
30220 </row>
30221 </tbody>
30222 </tgroup>
30223 </informaltable>
30224 <para>
30225 <indexterm role="concept">
30226 <primary>SMTP</primary>
30227 <secondary>limiting syntax and protocol errors</secondary>
30228 </indexterm>
30229 <indexterm role="concept">
30230 <primary>limit</primary>
30231 <secondary>SMTP syntax and protocol errors</secondary>
30232 </indexterm>
30233 Exim rejects SMTP commands that contain syntax or protocol errors. In
30234 particular, a syntactically invalid email address, as in this command:
30235 </para>
30236 <literallayout class="monospaced">
30237 RCPT TO:&lt;abc xyz@a.b.c&gt;
30238 </literallayout>
30239 <para>
30240 causes immediate rejection of the command, before any other tests are done.
30241 (The ACL cannot be run if there is no valid address to set up for it.) An
30242 example of a protocol error is receiving RCPT before MAIL. If there are
30243 too many syntax or protocol errors in one SMTP session, the connection is
30244 dropped. The limit is set by this option.
30245 </para>
30246 <para>
30247 <indexterm role="concept">
30248 <primary>PIPELINING</primary>
30249 <secondary>expected errors</secondary>
30250 </indexterm>
30251 When the PIPELINING extension to SMTP is in use, some protocol errors are
30252 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
30253 Exim assumes that PIPELINING will be used if it advertises it (see
30254 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
30255 not count towards the limit.
30256 </para>
30257 <para>
30258 <indexterm role="option">
30259 <primary><option>smtp_max_unknown_commands</option></primary>
30260 </indexterm>
30261 </para>
30262 <informaltable frame="all">
30263 <tgroup cols="4" colsep="0" rowsep="0">
30264 <colspec colwidth="8*" align="left"/>
30265 <colspec colwidth="6*" align="center"/>
30266 <colspec colwidth="6*" align="center"/>
30267 <colspec colwidth="6*" align="right"/>
30268 <tbody>
30269 <row>
30270 <entry><option>smtp_max_unknown_commands</option></entry>
30271 <entry>Use: <emphasis>main</emphasis></entry>
30272 <entry>Type: <emphasis>integer</emphasis></entry>
30273 <entry>Default: <emphasis>3</emphasis></entry>
30274 </row>
30275 </tbody>
30276 </tgroup>
30277 </informaltable>
30278 <para>
30279 <indexterm role="concept">
30280 <primary>SMTP</primary>
30281 <secondary>limiting unknown commands</secondary>
30282 </indexterm>
30283 <indexterm role="concept">
30284 <primary>limit</primary>
30285 <secondary>unknown SMTP commands</secondary>
30286 </indexterm>
30287 If there are too many unrecognized commands in an incoming SMTP session, an
30288 Exim server drops the connection. This is a defence against some kinds of abuse
30289 that subvert web
30290 clients
30291 into making connections to SMTP ports; in these circumstances, a number of
30292 non-SMTP command lines are sent first.
30293 </para>
30294 <para>
30295 <indexterm role="option">
30296 <primary><option>smtp_ratelimit_hosts</option></primary>
30297 </indexterm>
30298 </para>
30299 <informaltable frame="all">
30300 <tgroup cols="4" colsep="0" rowsep="0">
30301 <colspec colwidth="8*" align="left"/>
30302 <colspec colwidth="6*" align="center"/>
30303 <colspec colwidth="6*" align="center"/>
30304 <colspec colwidth="6*" align="right"/>
30305 <tbody>
30306 <row>
30307 <entry><option>smtp_ratelimit_hosts</option></entry>
30308 <entry>Use: <emphasis>main</emphasis></entry>
30309 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30310 <entry>Default: <emphasis>unset</emphasis></entry>
30311 </row>
30312 </tbody>
30313 </tgroup>
30314 </informaltable>
30315 <para>
30316 <indexterm role="concept">
30317 <primary>SMTP</primary>
30318 <secondary>rate limiting</secondary>
30319 </indexterm>
30320 <indexterm role="concept">
30321 <primary>limit</primary>
30322 <secondary>rate of message arrival</secondary>
30323 </indexterm>
30324 <indexterm role="concept">
30325 <primary>RCPT</primary>
30326 <secondary>rate limiting</secondary>
30327 </indexterm>
30328 Some sites find it helpful to be able to limit the rate at which certain hosts
30329 can send them messages, and the rate at which an individual message can specify
30330 recipients.
30331 </para>
30332 <para>
30333 Exim has two rate-limiting facilities. This section describes the older
30334 facility, which can limit rates within a single connection. The newer
30335 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
30336 <xref linkend="SECTratelimiting"/> for details of the newer facility.
30337 </para>
30338 <para>
30339 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
30340 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
30341 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
30342 respectively. Each option, if set, must contain a set of four comma-separated
30343 values:
30344 </para>
30345 <itemizedlist>
30346 <listitem>
30347 <para>
30348 A threshold, before which there is no rate limiting.
30349 </para>
30350 </listitem>
30351 <listitem>
30352 <para>
30353 An initial time delay. Unlike other times in Exim, numbers with decimal
30354 fractional parts are allowed here.
30355 </para>
30356 </listitem>
30357 <listitem>
30358 <para>
30359 A factor by which to increase the delay each time.
30360 </para>
30361 </listitem>
30362 <listitem>
30363 <para>
30364 A maximum value for the delay. This should normally be less than 5 minutes,
30365 because after that time, the client is liable to timeout the SMTP command.
30366 </para>
30367 </listitem>
30368 </itemizedlist>
30369 <para>
30370 For example, these settings have been used successfully at the site which
30371 first suggested this feature, for controlling mail from their customers:
30372 </para>
30373 <literallayout class="monospaced">
30374 smtp_ratelimit_mail = 2,0.5s,1.05,4m
30375 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
30376 </literallayout>
30377 <para>
30378 The first setting specifies delays that are applied to MAIL commands after
30379 two have been received over a single connection. The initial delay is 0.5
30380 seconds, increasing by a factor of 1.05 each time. The second setting applies
30381 delays to RCPT commands when more than four occur in a single message.
30382 </para>
30383 <para>
30384 <indexterm role="option">
30385 <primary><option>smtp_ratelimit_mail</option></primary>
30386 </indexterm>
30387 </para>
30388 <informaltable frame="all">
30389 <tgroup cols="4" colsep="0" rowsep="0">
30390 <colspec colwidth="8*" align="left"/>
30391 <colspec colwidth="6*" align="center"/>
30392 <colspec colwidth="6*" align="center"/>
30393 <colspec colwidth="6*" align="right"/>
30394 <tbody>
30395 <row>
30396 <entry><option>smtp_ratelimit_mail</option></entry>
30397 <entry>Use: <emphasis>main</emphasis></entry>
30398 <entry>Type: <emphasis>string</emphasis></entry>
30399 <entry>Default: <emphasis>unset</emphasis></entry>
30400 </row>
30401 </tbody>
30402 </tgroup>
30403 </informaltable>
30404 <para>
30405 See <option>smtp_ratelimit_hosts</option> above.
30406 </para>
30407 <para>
30408 <indexterm role="option">
30409 <primary><option>smtp_ratelimit_rcpt</option></primary>
30410 </indexterm>
30411 </para>
30412 <informaltable frame="all">
30413 <tgroup cols="4" colsep="0" rowsep="0">
30414 <colspec colwidth="8*" align="left"/>
30415 <colspec colwidth="6*" align="center"/>
30416 <colspec colwidth="6*" align="center"/>
30417 <colspec colwidth="6*" align="right"/>
30418 <tbody>
30419 <row>
30420 <entry><option>smtp_ratelimit_rcpt</option></entry>
30421 <entry>Use: <emphasis>main</emphasis></entry>
30422 <entry>Type: <emphasis>string</emphasis></entry>
30423 <entry>Default: <emphasis>unset</emphasis></entry>
30424 </row>
30425 </tbody>
30426 </tgroup>
30427 </informaltable>
30428 <para>
30429 See <option>smtp_ratelimit_hosts</option> above.
30430 </para>
30431 <para>
30432 <indexterm role="option">
30433 <primary><option>smtp_receive_timeout</option></primary>
30434 </indexterm>
30435 </para>
30436 <informaltable frame="all">
30437 <tgroup cols="4" colsep="0" rowsep="0">
30438 <colspec colwidth="8*" align="left"/>
30439 <colspec colwidth="6*" align="center"/>
30440 <colspec colwidth="6*" align="center"/>
30441 <colspec colwidth="6*" align="right"/>
30442 <tbody>
30443 <row>
30444 <entry><option>smtp_receive_timeout</option></entry>
30445 <entry>Use: <emphasis>main</emphasis></entry>
30446 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
30447 <entry>Default: <emphasis>5m</emphasis></entry>
30448 </row>
30449 </tbody>
30450 </tgroup>
30451 </informaltable>
30452 <para>
30453 <indexterm role="concept">
30454 <primary>timeout</primary>
30455 <secondary>for SMTP input</secondary>
30456 </indexterm>
30457 <indexterm role="concept">
30458 <primary>SMTP</primary>
30459 <secondary>input timeout</secondary>
30460 </indexterm>
30461 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
30462 input, including batch SMTP. If a line of input (either an SMTP command or a
30463 data line) is not received within this time, the SMTP connection is dropped and
30464 the message is abandoned.
30465 A line is written to the log containing one of the following messages:
30466 </para>
30467 <literallayout class="monospaced">
30468 SMTP command timeout on connection from...
30469 SMTP data timeout on connection from...
30470 </literallayout>
30471 <para>
30472 The former means that Exim was expecting to read an SMTP command; the latter
30473 means that it was in the DATA phase, reading the contents of a message.
30474 </para>
30475 <para>
30476 If the first character of the option is a <quote>$</quote> the option is
30477 expanded before use and may depend on
30478 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
30479 </para>
30480 <para>
30481 <indexterm role="option">
30482 <primary><option>-os</option></primary>
30483 </indexterm>
30484 The value set by this option can be overridden by the
30485 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
30486 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
30487 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
30488 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
30489 </para>
30490 <para>
30491 <indexterm role="option">
30492 <primary><option>smtp_reserve_hosts</option></primary>
30493 </indexterm>
30494 </para>
30495 <informaltable frame="all">
30496 <tgroup cols="4" colsep="0" rowsep="0">
30497 <colspec colwidth="8*" align="left"/>
30498 <colspec colwidth="6*" align="center"/>
30499 <colspec colwidth="6*" align="center"/>
30500 <colspec colwidth="6*" align="right"/>
30501 <tbody>
30502 <row>
30503 <entry><option>smtp_reserve_hosts</option></entry>
30504 <entry>Use: <emphasis>main</emphasis></entry>
30505 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30506 <entry>Default: <emphasis>unset</emphasis></entry>
30507 </row>
30508 </tbody>
30509 </tgroup>
30510 </informaltable>
30511 <para>
30512 This option defines hosts for which SMTP connections are reserved; see
30513 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
30514 </para>
30515 <para>
30516 <indexterm role="option">
30517 <primary><option>smtp_return_error_details</option></primary>
30518 </indexterm>
30519 </para>
30520 <informaltable frame="all">
30521 <tgroup cols="4" colsep="0" rowsep="0">
30522 <colspec colwidth="8*" align="left"/>
30523 <colspec colwidth="6*" align="center"/>
30524 <colspec colwidth="6*" align="center"/>
30525 <colspec colwidth="6*" align="right"/>
30526 <tbody>
30527 <row>
30528 <entry><option>smtp_return_error_details</option></entry>
30529 <entry>Use: <emphasis>main</emphasis></entry>
30530 <entry>Type: <emphasis>boolean</emphasis></entry>
30531 <entry>Default: <emphasis>false</emphasis></entry>
30532 </row>
30533 </tbody>
30534 </tgroup>
30535 </informaltable>
30536 <para>
30537 <indexterm role="concept">
30538 <primary>SMTP</primary>
30539 <secondary>details policy failures</secondary>
30540 </indexterm>
30541 <indexterm role="concept">
30542 <primary>policy control</primary>
30543 <secondary>rejection, returning details</secondary>
30544 </indexterm>
30545 In the default state, Exim uses bland messages such as
30546 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
30547 reasons. Many sysadmins like this because it gives away little information
30548 to spammers. However, some other sysadmins who are applying strict checking
30549 policies want to give out much fuller information about failures. Setting
30550 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
30551 example, instead of <quote>Administrative prohibition</quote>, it might give:
30552 </para>
30553 <literallayout class="monospaced">
30554 550-Rejected after DATA: '&gt;' missing at end of address:
30555 550 failing address in "From" header is: &lt;user@dom.ain
30556 </literallayout>
30557 <para>
30558 <indexterm role="option">
30559 <primary><option>smtputf8_advertise_hosts</option></primary>
30560 </indexterm>
30561 </para>
30562 <informaltable frame="all">
30563 <tgroup cols="4" colsep="0" rowsep="0">
30564 <colspec colwidth="8*" align="left"/>
30565 <colspec colwidth="6*" align="center"/>
30566 <colspec colwidth="6*" align="center"/>
30567 <colspec colwidth="6*" align="right"/>
30568 <tbody>
30569 <row>
30570 <entry><option>smtputf8_advertise_hosts</option></entry>
30571 <entry>Use: <emphasis>main</emphasis></entry>
30572 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30573 <entry>Default: <emphasis>*</emphasis></entry>
30574 </row>
30575 </tbody>
30576 </tgroup>
30577 </informaltable>
30578 <para>
30579 <indexterm role="concept">
30580 <primary>SMTPUTF8</primary>
30581 <secondary>advertising</secondary>
30582 </indexterm>
30583 When Exim is built with support for internationalised mail names,
30584 the availability thereof is advertised in
30585 response to EHLO only to those client hosts that match this option. See
30586 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
30587 </para>
30588 <para>
30589 <indexterm role="option">
30590 <primary><option>spamd_address</option></primary>
30591 </indexterm>
30592 </para>
30593 <informaltable frame="all">
30594 <tgroup cols="4" colsep="0" rowsep="0">
30595 <colspec colwidth="8*" align="left"/>
30596 <colspec colwidth="6*" align="center"/>
30597 <colspec colwidth="6*" align="center"/>
30598 <colspec colwidth="6*" align="right"/>
30599 <tbody>
30600 <row>
30601 <entry><option>spamd_address</option></entry>
30602 <entry>Use: <emphasis>main</emphasis></entry>
30603 <entry>Type: <emphasis>string</emphasis></entry>
30604 <entry>Default: <emphasis>see below</emphasis></entry>
30605 </row>
30606 </tbody>
30607 </tgroup>
30608 </informaltable>
30609 <para>
30610 This option is available when Exim is compiled with the content-scanning
30611 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
30612 The default value is
30613 </para>
30614 <literallayout class="monospaced">
30615 127.0.0.1 783
30616 </literallayout>
30617 <para>
30618 See section <xref linkend="SECTscanspamass"/> for more details.
30619 </para>
30620 <para>
30621 <indexterm role="option">
30622 <primary><option>split_spool_directory</option></primary>
30623 </indexterm>
30624 </para>
30625 <informaltable frame="all">
30626 <tgroup cols="4" colsep="0" rowsep="0">
30627 <colspec colwidth="8*" align="left"/>
30628 <colspec colwidth="6*" align="center"/>
30629 <colspec colwidth="6*" align="center"/>
30630 <colspec colwidth="6*" align="right"/>
30631 <tbody>
30632 <row>
30633 <entry><option>split_spool_directory</option></entry>
30634 <entry>Use: <emphasis>main</emphasis></entry>
30635 <entry>Type: <emphasis>boolean</emphasis></entry>
30636 <entry>Default: <emphasis>false</emphasis></entry>
30637 </row>
30638 </tbody>
30639 </tgroup>
30640 </informaltable>
30641 <para>
30642 <indexterm role="concept">
30643 <primary>multiple spool directories</primary>
30644 </indexterm>
30645 <indexterm role="concept">
30646 <primary>spool directory</primary>
30647 <secondary>split</secondary>
30648 </indexterm>
30649 <indexterm role="concept">
30650 <primary>directories, multiple</primary>
30651 </indexterm>
30652 If this option is set, it causes Exim to split its input directory into 62
30653 subdirectories, each with a single alphanumeric character as its name. The
30654 sixth character of the message id is used to allocate messages to
30655 subdirectories; this is the least significant base-62 digit of the time of
30656 arrival of the message.
30657 </para>
30658 <para>
30659 Splitting up the spool in this way may provide better performance on systems
30660 where there are long mail queues, by reducing the number of files in any one
30661 directory. The msglog directory is also split up in a similar way to the input
30662 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
30663 are still placed in the single directory <filename>msglog.OLD</filename>.
30664 </para>
30665 <para>
30666 It is not necessary to take any special action for existing messages when
30667 changing <option>split_spool_directory</option>. Exim notices messages that are in the
30668 <quote>wrong</quote> place, and continues to process them. If the option is turned off
30669 after a period of being on, the subdirectories will eventually empty and be
30670 automatically deleted.
30671 </para>
30672 <para>
30673 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
30674 changes. Instead of creating a list of all messages in the queue, and then
30675 trying to deliver each one in turn, it constructs a list of those in one
30676 sub-directory and tries to deliver them, before moving on to the next
30677 sub-directory. The sub-directories are processed in a random order. This
30678 spreads out the scanning of the input directories, and uses less memory. It is
30679 particularly beneficial when there are lots of messages on the queue. However,
30680 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
30681 entire queue has to be scanned and sorted before any deliveries can start.
30682 </para>
30683 <para>
30684 <indexterm role="option">
30685 <primary><option>spool_directory</option></primary>
30686 </indexterm>
30687 </para>
30688 <informaltable frame="all">
30689 <tgroup cols="4" colsep="0" rowsep="0">
30690 <colspec colwidth="8*" align="left"/>
30691 <colspec colwidth="6*" align="center"/>
30692 <colspec colwidth="6*" align="center"/>
30693 <colspec colwidth="6*" align="right"/>
30694 <tbody>
30695 <row>
30696 <entry><option>spool_directory</option></entry>
30697 <entry>Use: <emphasis>main</emphasis></entry>
30698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30699 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30700 </row>
30701 </tbody>
30702 </tgroup>
30703 </informaltable>
30704 <para>
30705 <indexterm role="concept">
30706 <primary>spool directory</primary>
30707 <secondary>path to</secondary>
30708 </indexterm>
30709 This defines the directory in which Exim keeps its spool, that is, the messages
30710 it is waiting to deliver. The default value is taken from the compile-time
30711 configuration setting, if there is one. If not, this option must be set. The
30712 string is expanded, so it can contain, for example, a reference to
30713 <varname>$primary_hostname</varname>.
30714 </para>
30715 <para>
30716 If the spool directory name is fixed on your installation, it is recommended
30717 that you set it at build time rather than from this option, particularly if the
30718 log files are being written to the spool directory (see <option>log_file_path</option>).
30719 Otherwise log files cannot be used for errors that are detected early on, such
30720 as failures in the configuration file.
30721 </para>
30722 <para>
30723 By using this option to override the compiled-in path, it is possible to run
30724 tests of Exim without using the standard spool.
30725 </para>
30726 <para>
30727 <indexterm role="option">
30728 <primary><option>sqlite_lock_timeout</option></primary>
30729 </indexterm>
30730 </para>
30731 <informaltable frame="all">
30732 <tgroup cols="4" colsep="0" rowsep="0">
30733 <colspec colwidth="8*" align="left"/>
30734 <colspec colwidth="6*" align="center"/>
30735 <colspec colwidth="6*" align="center"/>
30736 <colspec colwidth="6*" align="right"/>
30737 <tbody>
30738 <row>
30739 <entry><option>sqlite_lock_timeout</option></entry>
30740 <entry>Use: <emphasis>main</emphasis></entry>
30741 <entry>Type: <emphasis>time</emphasis></entry>
30742 <entry>Default: <emphasis>5s</emphasis></entry>
30743 </row>
30744 </tbody>
30745 </tgroup>
30746 </informaltable>
30747 <para>
30748 <indexterm role="concept">
30749 <primary>sqlite lookup type</primary>
30750 <secondary>lock timeout</secondary>
30751 </indexterm>
30752 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
30753 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
30754 </para>
30755 <para>
30756 <indexterm role="option">
30757 <primary><option>strict_acl_vars</option></primary>
30758 </indexterm>
30759 </para>
30760 <informaltable frame="all">
30761 <tgroup cols="4" colsep="0" rowsep="0">
30762 <colspec colwidth="8*" align="left"/>
30763 <colspec colwidth="6*" align="center"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="right"/>
30766 <tbody>
30767 <row>
30768 <entry><option>strict_acl_vars</option></entry>
30769 <entry>Use: <emphasis>main</emphasis></entry>
30770 <entry>Type: <emphasis>boolean</emphasis></entry>
30771 <entry>Default: <emphasis>false</emphasis></entry>
30772 </row>
30773 </tbody>
30774 </tgroup>
30775 </informaltable>
30776 <para>
30777 <indexterm role="concept">
30778 <primary>access control lists (ACLs)</primary>
30779 <secondary>variables, handling unset</secondary>
30780 </indexterm>
30781 This option controls what happens if a syntactically valid but undefined ACL
30782 variable is referenced. If it is false (the default), an empty string
30783 is substituted; if it is true, an error is generated. See section
30784 <xref linkend="SECTaclvariables"/> for details of ACL variables.
30785 </para>
30786 <para>
30787 <indexterm role="option">
30788 <primary><option>strip_excess_angle_brackets</option></primary>
30789 </indexterm>
30790 </para>
30791 <informaltable frame="all">
30792 <tgroup cols="4" colsep="0" rowsep="0">
30793 <colspec colwidth="8*" align="left"/>
30794 <colspec colwidth="6*" align="center"/>
30795 <colspec colwidth="6*" align="center"/>
30796 <colspec colwidth="6*" align="right"/>
30797 <tbody>
30798 <row>
30799 <entry><option>strip_excess_angle_brackets</option></entry>
30800 <entry>Use: <emphasis>main</emphasis></entry>
30801 <entry>Type: <emphasis>boolean</emphasis></entry>
30802 <entry>Default: <emphasis>false</emphasis></entry>
30803 </row>
30804 </tbody>
30805 </tgroup>
30806 </informaltable>
30807 <para>
30808 <indexterm role="concept">
30809 <primary>angle brackets, excess</primary>
30810 </indexterm>
30811 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
30812 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
30813 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
30814 passed on to another MTA, the excess angle brackets are not passed on. If this
30815 option is not set, multiple pairs of angle brackets cause a syntax error.
30816 </para>
30817 <para>
30818 <indexterm role="option">
30819 <primary><option>strip_trailing_dot</option></primary>
30820 </indexterm>
30821 </para>
30822 <informaltable frame="all">
30823 <tgroup cols="4" colsep="0" rowsep="0">
30824 <colspec colwidth="8*" align="left"/>
30825 <colspec colwidth="6*" align="center"/>
30826 <colspec colwidth="6*" align="center"/>
30827 <colspec colwidth="6*" align="right"/>
30828 <tbody>
30829 <row>
30830 <entry><option>strip_trailing_dot</option></entry>
30831 <entry>Use: <emphasis>main</emphasis></entry>
30832 <entry>Type: <emphasis>boolean</emphasis></entry>
30833 <entry>Default: <emphasis>false</emphasis></entry>
30834 </row>
30835 </tbody>
30836 </tgroup>
30837 </informaltable>
30838 <para>
30839 <indexterm role="concept">
30840 <primary>trailing dot on domain</primary>
30841 </indexterm>
30842 <indexterm role="concept">
30843 <primary>dot</primary>
30844 <secondary>trailing on domain</secondary>
30845 </indexterm>
30846 If this option is set, a trailing dot at the end of a domain in an address is
30847 ignored. If this is in the envelope and the message is passed on to another
30848 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
30849 domain causes a syntax error.
30850 However, addresses in header lines are checked only when an ACL requests header
30851 syntax checking.
30852 </para>
30853 <para>
30854 <indexterm role="option">
30855 <primary><option>syslog_duplication</option></primary>
30856 </indexterm>
30857 </para>
30858 <informaltable frame="all">
30859 <tgroup cols="4" colsep="0" rowsep="0">
30860 <colspec colwidth="8*" align="left"/>
30861 <colspec colwidth="6*" align="center"/>
30862 <colspec colwidth="6*" align="center"/>
30863 <colspec colwidth="6*" align="right"/>
30864 <tbody>
30865 <row>
30866 <entry><option>syslog_duplication</option></entry>
30867 <entry>Use: <emphasis>main</emphasis></entry>
30868 <entry>Type: <emphasis>boolean</emphasis></entry>
30869 <entry>Default: <emphasis>true</emphasis></entry>
30870 </row>
30871 </tbody>
30872 </tgroup>
30873 </informaltable>
30874 <para>
30875 <indexterm role="concept">
30876 <primary>syslog</primary>
30877 <secondary>duplicate log lines; suppressing</secondary>
30878 </indexterm>
30879 When Exim is logging to syslog, it writes the log lines for its three
30880 separate logs at different syslog priorities so that they can in principle
30881 be separated on the logging hosts. Some installations do not require this
30882 separation, and in those cases, the duplication of certain log lines is a
30883 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
30884 particular log line is written to syslog. For lines that normally go to
30885 both the main log and the reject log, the reject log version (possibly
30886 containing message header lines) is written, at LOG_NOTICE priority.
30887 Lines that normally go to both the main and the panic log are written at
30888 the LOG_ALERT priority.
30889 </para>
30890 <para>
30891 <indexterm role="option">
30892 <primary><option>syslog_facility</option></primary>
30893 </indexterm>
30894 </para>
30895 <informaltable frame="all">
30896 <tgroup cols="4" colsep="0" rowsep="0">
30897 <colspec colwidth="8*" align="left"/>
30898 <colspec colwidth="6*" align="center"/>
30899 <colspec colwidth="6*" align="center"/>
30900 <colspec colwidth="6*" align="right"/>
30901 <tbody>
30902 <row>
30903 <entry><option>syslog_facility</option></entry>
30904 <entry>Use: <emphasis>main</emphasis></entry>
30905 <entry>Type: <emphasis>string</emphasis></entry>
30906 <entry>Default: <emphasis>unset</emphasis></entry>
30907 </row>
30908 </tbody>
30909 </tgroup>
30910 </informaltable>
30911 <para>
30912 <indexterm role="concept">
30913 <primary>syslog</primary>
30914 <secondary>facility; setting</secondary>
30915 </indexterm>
30916 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
30917 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
30918 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
30919 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
30920 details of Exim&#x2019;s logging.
30921 </para>
30922 <para>
30923 <indexterm role="option">
30924 <primary><option>syslog_pid</option></primary>
30925 </indexterm>
30926 </para>
30927 <informaltable frame="all">
30928 <tgroup cols="4" colsep="0" rowsep="0">
30929 <colspec colwidth="8*" align="left"/>
30930 <colspec colwidth="6*" align="center"/>
30931 <colspec colwidth="6*" align="center"/>
30932 <colspec colwidth="6*" align="right"/>
30933 <tbody>
30934 <row>
30935 <entry><option>syslog_pid</option></entry>
30936 <entry>Use: <emphasis>main</emphasis></entry>
30937 <entry>Type: <emphasis>boolean</emphasis></entry>
30938 <entry>Default: <emphasis>true</emphasis></entry>
30939 </row>
30940 </tbody>
30941 </tgroup>
30942 </informaltable>
30943 <para>
30944 <indexterm role="concept">
30945 <primary>syslog</primary>
30946 <secondary>pid</secondary>
30947 </indexterm>
30948 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
30949 omitted when these lines are sent to syslog. (Syslog normally prefixes
30950 the log lines with the PID of the logging process automatically.) You need
30951 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
30952 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30953 </para>
30954 <para>
30955 <indexterm role="option">
30956 <primary><option>syslog_processname</option></primary>
30957 </indexterm>
30958 </para>
30959 <informaltable frame="all">
30960 <tgroup cols="4" colsep="0" rowsep="0">
30961 <colspec colwidth="8*" align="left"/>
30962 <colspec colwidth="6*" align="center"/>
30963 <colspec colwidth="6*" align="center"/>
30964 <colspec colwidth="6*" align="right"/>
30965 <tbody>
30966 <row>
30967 <entry><option>syslog_processname</option></entry>
30968 <entry>Use: <emphasis>main</emphasis></entry>
30969 <entry>Type: <emphasis>string</emphasis></entry>
30970 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
30971 </row>
30972 </tbody>
30973 </tgroup>
30974 </informaltable>
30975 <para>
30976 <indexterm role="concept">
30977 <primary>syslog</primary>
30978 <secondary>process name; setting</secondary>
30979 </indexterm>
30980 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
30981 syslog. The value must be no longer than 32 characters. See chapter
30982 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30983 </para>
30984 <para>
30985 <indexterm role="option">
30986 <primary><option>syslog_timestamp</option></primary>
30987 </indexterm>
30988 </para>
30989 <informaltable frame="all">
30990 <tgroup cols="4" colsep="0" rowsep="0">
30991 <colspec colwidth="8*" align="left"/>
30992 <colspec colwidth="6*" align="center"/>
30993 <colspec colwidth="6*" align="center"/>
30994 <colspec colwidth="6*" align="right"/>
30995 <tbody>
30996 <row>
30997 <entry><option>syslog_timestamp</option></entry>
30998 <entry>Use: <emphasis>main</emphasis></entry>
30999 <entry>Type: <emphasis>boolean</emphasis></entry>
31000 <entry>Default: <emphasis>true</emphasis></entry>
31001 </row>
31002 </tbody>
31003 </tgroup>
31004 </informaltable>
31005 <para>
31006 <indexterm role="concept">
31007 <primary>syslog</primary>
31008 <secondary>timestamps</secondary>
31009 </indexterm>
31010 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
31011 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
31012 details of Exim&#x2019;s logging.
31013 </para>
31014 <para>
31015 <indexterm role="option">
31016 <primary><option>system_filter</option></primary>
31017 </indexterm>
31018 </para>
31019 <informaltable frame="all">
31020 <tgroup cols="4" colsep="0" rowsep="0">
31021 <colspec colwidth="8*" align="left"/>
31022 <colspec colwidth="6*" align="center"/>
31023 <colspec colwidth="6*" align="center"/>
31024 <colspec colwidth="6*" align="right"/>
31025 <tbody>
31026 <row>
31027 <entry><option>system_filter</option></entry>
31028 <entry>Use: <emphasis>main</emphasis></entry>
31029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31030 <entry>Default: <emphasis>unset</emphasis></entry>
31031 </row>
31032 </tbody>
31033 </tgroup>
31034 </informaltable>
31035 <para>
31036 <indexterm role="concept">
31037 <primary>filter</primary>
31038 <secondary>system filter</secondary>
31039 </indexterm>
31040 <indexterm role="concept">
31041 <primary>system filter</primary>
31042 <secondary>specifying</secondary>
31043 </indexterm>
31044 <indexterm role="concept">
31045 <primary>Sieve filter</primary>
31046 <secondary>not available for system filter</secondary>
31047 </indexterm>
31048 This option specifies an Exim filter file that is applied to all messages at
31049 the start of each delivery attempt, before any routing is done. System filters
31050 must be Exim filters; they cannot be Sieve filters. If the system filter
31051 generates any deliveries to files or pipes, or any new mail messages, the
31052 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
31053 which transports are to be used. Details of this facility are given in chapter
31054 <xref linkend="CHAPsystemfilter"/>.
31055 </para>
31056 <para revisionflag="changed">
31057 A forced expansion failure results in no filter operation.
31058 </para>
31059 <para>
31060 <indexterm role="option">
31061 <primary><option>system_filter_directory_transport</option></primary>
31062 </indexterm>
31063 </para>
31064 <informaltable frame="all">
31065 <tgroup cols="4" colsep="0" rowsep="0">
31066 <colspec colwidth="8*" align="left"/>
31067 <colspec colwidth="6*" align="center"/>
31068 <colspec colwidth="6*" align="center"/>
31069 <colspec colwidth="6*" align="right"/>
31070 <tbody>
31071 <row>
31072 <entry><option>system_filter_directory_transport</option></entry>
31073 <entry>Use: <emphasis>main</emphasis></entry>
31074 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31075 <entry>Default: <emphasis>unset</emphasis></entry>
31076 </row>
31077 </tbody>
31078 </tgroup>
31079 </informaltable>
31080 <para>
31081 <indexterm role="variable">
31082 <primary><varname>$address_file</varname></primary>
31083 </indexterm>
31084 This sets the name of the transport driver that is to be used when the
31085 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
31086 implying delivery of each message into a separate file in some directory.
31087 During the delivery, the variable <varname>$address_file</varname> contains the path name.
31088 </para>
31089 <para>
31090 <indexterm role="option">
31091 <primary><option>system_filter_file_transport</option></primary>
31092 </indexterm>
31093 </para>
31094 <informaltable frame="all">
31095 <tgroup cols="4" colsep="0" rowsep="0">
31096 <colspec colwidth="8*" align="left"/>
31097 <colspec colwidth="6*" align="center"/>
31098 <colspec colwidth="6*" align="center"/>
31099 <colspec colwidth="6*" align="right"/>
31100 <tbody>
31101 <row>
31102 <entry><option>system_filter_file_transport</option></entry>
31103 <entry>Use: <emphasis>main</emphasis></entry>
31104 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31105 <entry>Default: <emphasis>unset</emphasis></entry>
31106 </row>
31107 </tbody>
31108 </tgroup>
31109 </informaltable>
31110 <para>
31111 <indexterm role="concept">
31112 <primary>file</primary>
31113 <secondary>transport for system filter</secondary>
31114 </indexterm>
31115 This sets the name of the transport driver that is to be used when the <option>save</option>
31116 command in a system message filter specifies a path not ending in <quote>/</quote>. During
31117 the delivery, the variable <varname>$address_file</varname> contains the path name.
31118 </para>
31119 <para>
31120 <indexterm role="option">
31121 <primary><option>system_filter_group</option></primary>
31122 </indexterm>
31123 </para>
31124 <informaltable frame="all">
31125 <tgroup cols="4" colsep="0" rowsep="0">
31126 <colspec colwidth="8*" align="left"/>
31127 <colspec colwidth="6*" align="center"/>
31128 <colspec colwidth="6*" align="center"/>
31129 <colspec colwidth="6*" align="right"/>
31130 <tbody>
31131 <row>
31132 <entry><option>system_filter_group</option></entry>
31133 <entry>Use: <emphasis>main</emphasis></entry>
31134 <entry>Type: <emphasis>string</emphasis></entry>
31135 <entry>Default: <emphasis>unset</emphasis></entry>
31136 </row>
31137 </tbody>
31138 </tgroup>
31139 </informaltable>
31140 <para>
31141 <indexterm role="concept">
31142 <primary>gid (group id)</primary>
31143 <secondary>system filter</secondary>
31144 </indexterm>
31145 This option is used only when <option>system_filter_user</option> is also set. It sets the
31146 gid under which the system filter is run, overriding any gid that is associated
31147 with the user. The value may be numerical or symbolic.
31148 </para>
31149 <para>
31150 <indexterm role="option">
31151 <primary><option>system_filter_pipe_transport</option></primary>
31152 </indexterm>
31153 </para>
31154 <informaltable frame="all">
31155 <tgroup cols="4" colsep="0" rowsep="0">
31156 <colspec colwidth="8*" align="left"/>
31157 <colspec colwidth="6*" align="center"/>
31158 <colspec colwidth="6*" align="center"/>
31159 <colspec colwidth="6*" align="right"/>
31160 <tbody>
31161 <row>
31162 <entry><option>system_filter_pipe_transport</option></entry>
31163 <entry>Use: <emphasis>main</emphasis></entry>
31164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31165 <entry>Default: <emphasis>unset</emphasis></entry>
31166 </row>
31167 </tbody>
31168 </tgroup>
31169 </informaltable>
31170 <para>
31171 <indexterm role="concept">
31172 <primary><command>pipe</command> transport</primary>
31173 <secondary>for system filter</secondary>
31174 </indexterm>
31175 <indexterm role="variable">
31176 <primary><varname>$address_pipe</varname></primary>
31177 </indexterm>
31178 This specifies the transport driver that is to be used when a <option>pipe</option> command
31179 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
31180 contains the pipe command.
31181 </para>
31182 <para>
31183 <indexterm role="option">
31184 <primary><option>system_filter_reply_transport</option></primary>
31185 </indexterm>
31186 </para>
31187 <informaltable frame="all">
31188 <tgroup cols="4" colsep="0" rowsep="0">
31189 <colspec colwidth="8*" align="left"/>
31190 <colspec colwidth="6*" align="center"/>
31191 <colspec colwidth="6*" align="center"/>
31192 <colspec colwidth="6*" align="right"/>
31193 <tbody>
31194 <row>
31195 <entry><option>system_filter_reply_transport</option></entry>
31196 <entry>Use: <emphasis>main</emphasis></entry>
31197 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31198 <entry>Default: <emphasis>unset</emphasis></entry>
31199 </row>
31200 </tbody>
31201 </tgroup>
31202 </informaltable>
31203 <para>
31204 <indexterm role="concept">
31205 <primary><command>autoreply</command> transport</primary>
31206 <secondary>for system filter</secondary>
31207 </indexterm>
31208 This specifies the transport driver that is to be used when a <option>mail</option> command
31209 is used in a system filter.
31210 </para>
31211 <para>
31212 <indexterm role="option">
31213 <primary><option>system_filter_user</option></primary>
31214 </indexterm>
31215 </para>
31216 <informaltable frame="all">
31217 <tgroup cols="4" colsep="0" rowsep="0">
31218 <colspec colwidth="8*" align="left"/>
31219 <colspec colwidth="6*" align="center"/>
31220 <colspec colwidth="6*" align="center"/>
31221 <colspec colwidth="6*" align="right"/>
31222 <tbody>
31223 <row>
31224 <entry><option>system_filter_user</option></entry>
31225 <entry>Use: <emphasis>main</emphasis></entry>
31226 <entry>Type: <emphasis>string</emphasis></entry>
31227 <entry>Default: <emphasis>unset</emphasis></entry>
31228 </row>
31229 </tbody>
31230 </tgroup>
31231 </informaltable>
31232 <para>
31233 <indexterm role="concept">
31234 <primary>uid (user id)</primary>
31235 <secondary>system filter</secondary>
31236 </indexterm>
31237 If this option is set to root, the system filter is run in the main Exim
31238 delivery process, as root.  Otherwise, the system filter runs in a separate
31239 process, as the given user, defaulting to the Exim run-time user.
31240 Unless the string consists entirely of digits, it
31241 is looked up in the password data. Failure to find the named user causes a
31242 configuration error. The gid is either taken from the password data, or
31243 specified by <option>system_filter_group</option>. When the uid is specified numerically,
31244 <option>system_filter_group</option> is required to be set.
31245 </para>
31246 <para>
31247 If the system filter generates any pipe, file, or reply deliveries, the uid
31248 under which the filter is run is used when transporting them, unless a
31249 transport option overrides.
31250 </para>
31251 <para>
31252 <indexterm role="option">
31253 <primary><option>tcp_nodelay</option></primary>
31254 </indexterm>
31255 </para>
31256 <informaltable frame="all">
31257 <tgroup cols="4" colsep="0" rowsep="0">
31258 <colspec colwidth="8*" align="left"/>
31259 <colspec colwidth="6*" align="center"/>
31260 <colspec colwidth="6*" align="center"/>
31261 <colspec colwidth="6*" align="right"/>
31262 <tbody>
31263 <row>
31264 <entry><option>tcp_nodelay</option></entry>
31265 <entry>Use: <emphasis>main</emphasis></entry>
31266 <entry>Type: <emphasis>boolean</emphasis></entry>
31267 <entry>Default: <emphasis>true</emphasis></entry>
31268 </row>
31269 </tbody>
31270 </tgroup>
31271 </informaltable>
31272 <para>
31273 <indexterm role="concept">
31274 <primary>daemon</primary>
31275 <secondary>TCP_NODELAY on sockets</secondary>
31276 </indexterm>
31277 <indexterm role="concept">
31278 <primary>Nagle algorithm</primary>
31279 </indexterm>
31280 <indexterm role="concept">
31281 <primary>TCP_NODELAY on listening sockets</primary>
31282 </indexterm>
31283 If this option is set false, it stops the Exim daemon setting the
31284 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
31285 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
31286 performance in interactive (character-by-character) situations. Turning it off
31287 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
31288 However, it appears that some broken clients cannot cope, and time out. Hence
31289 this option. It affects only those sockets that are set up for listening by the
31290 daemon. Sockets created by the smtp transport for delivering mail always set
31291 TCP_NODELAY.
31292 </para>
31293 <para>
31294 <indexterm role="option">
31295 <primary><option>timeout_frozen_after</option></primary>
31296 </indexterm>
31297 </para>
31298 <informaltable frame="all">
31299 <tgroup cols="4" colsep="0" rowsep="0">
31300 <colspec colwidth="8*" align="left"/>
31301 <colspec colwidth="6*" align="center"/>
31302 <colspec colwidth="6*" align="center"/>
31303 <colspec colwidth="6*" align="right"/>
31304 <tbody>
31305 <row>
31306 <entry><option>timeout_frozen_after</option></entry>
31307 <entry>Use: <emphasis>main</emphasis></entry>
31308 <entry>Type: <emphasis>time</emphasis></entry>
31309 <entry>Default: <emphasis>0s</emphasis></entry>
31310 </row>
31311 </tbody>
31312 </tgroup>
31313 </informaltable>
31314 <para>
31315 <indexterm role="concept">
31316 <primary>frozen messages</primary>
31317 <secondary>timing out</secondary>
31318 </indexterm>
31319 <indexterm role="concept">
31320 <primary>timeout</primary>
31321 <secondary>frozen messages</secondary>
31322 </indexterm>
31323 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
31324 message of any kind that has been on the queue for longer than the given time
31325 is automatically cancelled at the next queue run. If the frozen message is a
31326 bounce message, it is just discarded; otherwise, a bounce is sent to the
31327 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
31328 If you want to timeout frozen bounce messages earlier than other kinds of
31329 frozen message, see <option>ignore_bounce_errors_after</option>.
31330 </para>
31331 <para>
31332 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
31333 frozen messages remain on the queue forever (except for any frozen bounce
31334 messages that are released by <option>ignore_bounce_errors_after</option>).
31335 </para>
31336 <para>
31337 <indexterm role="option">
31338 <primary><option>timezone</option></primary>
31339 </indexterm>
31340 </para>
31341 <informaltable frame="all">
31342 <tgroup cols="4" colsep="0" rowsep="0">
31343 <colspec colwidth="8*" align="left"/>
31344 <colspec colwidth="6*" align="center"/>
31345 <colspec colwidth="6*" align="center"/>
31346 <colspec colwidth="6*" align="right"/>
31347 <tbody>
31348 <row>
31349 <entry><option>timezone</option></entry>
31350 <entry>Use: <emphasis>main</emphasis></entry>
31351 <entry>Type: <emphasis>string</emphasis></entry>
31352 <entry>Default: <emphasis>unset</emphasis></entry>
31353 </row>
31354 </tbody>
31355 </tgroup>
31356 </informaltable>
31357 <para>
31358 <indexterm role="concept">
31359 <primary>timezone, setting</primary>
31360 </indexterm>
31361 <indexterm role="concept">
31362 <primary>environment</primary>
31363 <secondary>values from</secondary>
31364 </indexterm>
31365 The value of <option>timezone</option> is used to set the environment variable TZ while
31366 running Exim (if it is different on entry). This ensures that all timestamps
31367 created by Exim are in the required timezone. If you want all your timestamps
31368 to be in UTC (aka GMT) you should set
31369 </para>
31370 <literallayout class="monospaced">
31371 timezone = UTC
31372 </literallayout>
31373 <para>
31374 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
31375 or, if that is not set, from the value of the TZ environment variable when Exim
31376 is built. If <option>timezone</option> is set to the empty string, either at build or run
31377 time, any existing TZ variable is removed from the environment when Exim
31378 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
31379 unfortunately not all, operating systems.
31380 </para>
31381 <para>
31382 <indexterm role="option">
31383 <primary><option>tls_advertise_hosts</option></primary>
31384 </indexterm>
31385 </para>
31386 <informaltable frame="all">
31387 <tgroup cols="4" colsep="0" rowsep="0">
31388 <colspec colwidth="8*" align="left"/>
31389 <colspec colwidth="6*" align="center"/>
31390 <colspec colwidth="6*" align="center"/>
31391 <colspec colwidth="6*" align="right"/>
31392 <tbody>
31393 <row>
31394 <entry><option>tls_advertise_hosts</option></entry>
31395 <entry>Use: <emphasis>main</emphasis></entry>
31396 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31397 <entry>Default: <emphasis>*</emphasis></entry>
31398 </row>
31399 </tbody>
31400 </tgroup>
31401 </informaltable>
31402 <para>
31403 <indexterm role="concept">
31404 <primary>TLS</primary>
31405 <secondary>advertising</secondary>
31406 </indexterm>
31407 <indexterm role="concept">
31408 <primary>encryption</primary>
31409 <secondary>on SMTP connection</secondary>
31410 </indexterm>
31411 <indexterm role="concept">
31412 <primary>SMTP</primary>
31413 <secondary>encrypted connection</secondary>
31414 </indexterm>
31415 When Exim is built with support for TLS encrypted connections, the availability
31416 of the STARTTLS command to set up an encrypted session is advertised in
31417 response to EHLO only to those client hosts that match this option. See
31418 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
31419 Note that the default value requires that a certificate be supplied
31420 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
31421 is not required the <option>tls_advertise_hosts</option> option should be set empty.
31422 </para>
31423 <para>
31424 <indexterm role="option">
31425 <primary><option>tls_certificate</option></primary>
31426 </indexterm>
31427 </para>
31428 <informaltable frame="all">
31429 <tgroup cols="4" colsep="0" rowsep="0">
31430 <colspec colwidth="8*" align="left"/>
31431 <colspec colwidth="6*" align="center"/>
31432 <colspec colwidth="6*" align="center"/>
31433 <colspec colwidth="6*" align="right"/>
31434 <tbody>
31435 <row>
31436 <entry><option>tls_certificate</option></entry>
31437 <entry>Use: <emphasis>main</emphasis></entry>
31438 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31439 <entry>Default: <emphasis>unset</emphasis></entry>
31440 </row>
31441 </tbody>
31442 </tgroup>
31443 </informaltable>
31444 <para>
31445 <indexterm role="concept">
31446 <primary>TLS</primary>
31447 <secondary>server certificate; location of</secondary>
31448 </indexterm>
31449 <indexterm role="concept">
31450 <primary>certificate</primary>
31451 <secondary>server, location of</secondary>
31452 </indexterm>
31453 The value of this option is expanded, and must then be the absolute path to a
31454 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
31455 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
31456 <xref linkend="CHAPTLS"/> for further details.
31457 </para>
31458 <para>
31459 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
31460 receiving incoming messages as a server. If you want to supply certificates for
31461 use when sending messages as a client, you must set the <option>tls_certificate</option>
31462 option in the relevant <command>smtp</command> transport.
31463 </para>
31464 <para>
31465 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
31466 if the OpenSSL build supports TLS extensions and the TLS client sends the
31467 Server Name Indication extension, then this option and others documented in
31468 <xref linkend="SECTtlssni"/> will be re-expanded.
31469 </para>
31470 <para>
31471 If this option is unset or empty a fresh self-signed certificate will be
31472 generated for every connection.
31473 </para>
31474 <para>
31475 <indexterm role="option">
31476 <primary><option>tls_crl</option></primary>
31477 </indexterm>
31478 </para>
31479 <informaltable frame="all">
31480 <tgroup cols="4" colsep="0" rowsep="0">
31481 <colspec colwidth="8*" align="left"/>
31482 <colspec colwidth="6*" align="center"/>
31483 <colspec colwidth="6*" align="center"/>
31484 <colspec colwidth="6*" align="right"/>
31485 <tbody>
31486 <row>
31487 <entry><option>tls_crl</option></entry>
31488 <entry>Use: <emphasis>main</emphasis></entry>
31489 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31490 <entry>Default: <emphasis>unset</emphasis></entry>
31491 </row>
31492 </tbody>
31493 </tgroup>
31494 </informaltable>
31495 <para>
31496 <indexterm role="concept">
31497 <primary>TLS</primary>
31498 <secondary>server certificate revocation list</secondary>
31499 </indexterm>
31500 <indexterm role="concept">
31501 <primary>certificate</primary>
31502 <secondary>revocation list for server</secondary>
31503 </indexterm>
31504 This option specifies a certificate revocation list. The expanded value must
31505 be the name of a file that contains a CRL in PEM format.
31506 </para>
31507 <para>
31508 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31509 </para>
31510 <para>
31511 <indexterm role="option">
31512 <primary><option>tls_dh_max_bits</option></primary>
31513 </indexterm>
31514 </para>
31515 <informaltable frame="all">
31516 <tgroup cols="4" colsep="0" rowsep="0">
31517 <colspec colwidth="8*" align="left"/>
31518 <colspec colwidth="6*" align="center"/>
31519 <colspec colwidth="6*" align="center"/>
31520 <colspec colwidth="6*" align="right"/>
31521 <tbody>
31522 <row>
31523 <entry><option>tls_dh_max_bits</option></entry>
31524 <entry>Use: <emphasis>main</emphasis></entry>
31525 <entry>Type: <emphasis>integer</emphasis></entry>
31526 <entry>Default: <emphasis>2236</emphasis></entry>
31527 </row>
31528 </tbody>
31529 </tgroup>
31530 </informaltable>
31531 <para>
31532 <indexterm role="concept">
31533 <primary>TLS</primary>
31534 <secondary>D-H bit count</secondary>
31535 </indexterm>
31536 The number of bits used for Diffie-Hellman key-exchange may be suggested by
31537 the chosen TLS library.  That value might prove to be too high for
31538 interoperability.  This option provides a maximum clamp on the value
31539 suggested, trading off security for interoperability.
31540 </para>
31541 <para>
31542 The value must be at least 1024.
31543 </para>
31544 <para>
31545 The value 2236 was chosen because, at time of adding the option, it was the
31546 hard-coded maximum value supported by the NSS cryptographic library, as used
31547 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
31548 </para>
31549 <para>
31550 If you prefer more security and are willing to break some clients, raise this
31551 number.
31552 </para>
31553 <para>
31554 Note that the value passed to GnuTLS for *generating* a new prime may be a
31555 little less than this figure, because GnuTLS is inexact and may produce a
31556 larger prime than requested.
31557 </para>
31558 <para>
31559 <indexterm role="option">
31560 <primary><option>tls_dhparam</option></primary>
31561 </indexterm>
31562 </para>
31563 <informaltable frame="all">
31564 <tgroup cols="4" colsep="0" rowsep="0">
31565 <colspec colwidth="8*" align="left"/>
31566 <colspec colwidth="6*" align="center"/>
31567 <colspec colwidth="6*" align="center"/>
31568 <colspec colwidth="6*" align="right"/>
31569 <tbody>
31570 <row>
31571 <entry><option>tls_dhparam</option></entry>
31572 <entry>Use: <emphasis>main</emphasis></entry>
31573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31574 <entry>Default: <emphasis>unset</emphasis></entry>
31575 </row>
31576 </tbody>
31577 </tgroup>
31578 </informaltable>
31579 <para>
31580 <indexterm role="concept">
31581 <primary>TLS</primary>
31582 <secondary>D-H parameters for server</secondary>
31583 </indexterm>
31584 The value of this option is expanded and indicates the source of DH parameters
31585 to be used by Exim.
31586 </para>
31587 <para>
31588 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
31589 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
31590 other specific constants available are a fallback so that even when
31591 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
31592 </para>
31593 <para>
31594 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
31595 then it names a file from which DH
31596 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
31597 PKCS#3 representation of the DH prime.  If the file does not exist, for
31598 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
31599 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
31600 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
31601 and treated as though the <option>tls_dhparam</option> were set to "none".
31602 </para>
31603 <para>
31604 If this option expands to the string "none", then no DH parameters will be
31605 loaded by Exim.
31606 </para>
31607 <para>
31608 If this option expands to the string "historic" and Exim is using GnuTLS, then
31609 Exim will attempt to load a file from inside the spool directory.  If the file
31610 does not exist, Exim will attempt to create it.
31611 See section <xref linkend="SECTgnutlsparam"/> for further details.
31612 </para>
31613 <para>
31614 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
31615 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
31616 </para>
31617 <para>
31618 In older versions of Exim the default was the 2048 bit prime described in section
31619 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
31620 in IKE is assigned number 23.
31621 </para>
31622 <para>
31623 Otherwise, the option must expand to the name used by Exim for any of a number
31624 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
31625 sources.  As names, Exim uses a standard specified name, else "ike" followed by
31626 the number used by IKE, or "default" which corresponds to
31627 <literal>exim.dev.20160529.3</literal>.
31628 </para>
31629 <para>
31630 The available standard primes are:
31631 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
31632 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
31633 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
31634 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
31635 </para>
31636 <para>
31637 The available additional primes are:
31638 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
31639 </para>
31640 <para>
31641 Some of these will be too small to be accepted by clients.
31642 Some may be too large to be accepted by clients.
31643 The open cryptographic community has suspicions about the integrity of some
31644 of the later IKE values, which led into RFC7919 providing new fixed constants
31645 (the "ffdhe" identifiers).
31646 </para>
31647 <para>
31648 At this point, all of the "ike" values should be considered obsolete;
31649 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
31650 candidates for removal the next time we have backwards-incompatible changes.
31651 </para>
31652 <para>
31653 The TLS protocol does not negotiate an acceptable size for this; clients tend
31654 to hard-drop connections if what is offered by the server is unacceptable,
31655 whether too large or too small, and there&#x2019;s no provision for the client to
31656 tell the server what these constraints are.  Thus, as a server operator, you
31657 need to make an educated guess as to what is most likely to work for your
31658 userbase.
31659 </para>
31660 <para>
31661 Some known size constraints suggest that a bit-size in the range 2048 to 2236
31662 is most likely to maximise interoperability.  The upper bound comes from
31663 applications using the Mozilla Network Security Services (NSS) library, which
31664 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
31665 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
31666 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
31667 acceptable bound from 1024 to 2048.
31668 </para>
31669 <para>
31670 <indexterm role="option">
31671 <primary><option>tls_eccurve</option></primary>
31672 </indexterm>
31673 </para>
31674 <informaltable frame="all">
31675 <tgroup cols="4" colsep="0" rowsep="0">
31676 <colspec colwidth="8*" align="left"/>
31677 <colspec colwidth="6*" align="center"/>
31678 <colspec colwidth="6*" align="center"/>
31679 <colspec colwidth="6*" align="right"/>
31680 <tbody>
31681 <row>
31682 <entry><option>tls_eccurve</option></entry>
31683 <entry>Use: <emphasis>main</emphasis></entry>
31684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31685 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
31686 </row>
31687 </tbody>
31688 </tgroup>
31689 </informaltable>
31690 <para>
31691 <indexterm role="concept">
31692 <primary>TLS</primary>
31693 <secondary>EC cryptography</secondary>
31694 </indexterm>
31695 This option selects a EC curve for use by Exim.
31696 </para>
31697 <para>
31698 After expansion it must contain a valid EC curve parameter, such as
31699 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
31700 for valid selections.
31701 </para>
31702 <para>
31703 For OpenSSL versions before (and not including) 1.0.2, the string
31704 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
31705 <literal>auto</literal> tells the library to choose.
31706 </para>
31707 <para>
31708 If the option expands to an empty string, no EC curves will be enabled.
31709 </para>
31710 <para>
31711 <indexterm role="option">
31712 <primary><option>tls_ocsp_file</option></primary>
31713 </indexterm>
31714 </para>
31715 <informaltable frame="all">
31716 <tgroup cols="4" colsep="0" rowsep="0">
31717 <colspec colwidth="8*" align="left"/>
31718 <colspec colwidth="6*" align="center"/>
31719 <colspec colwidth="6*" align="center"/>
31720 <colspec colwidth="6*" align="right"/>
31721 <tbody>
31722 <row>
31723 <entry><option>tls_ocsp_file</option></entry>
31724 <entry>Use: <emphasis>main</emphasis></entry>
31725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31726 <entry>Default: <emphasis>unset</emphasis></entry>
31727 </row>
31728 </tbody>
31729 </tgroup>
31730 </informaltable>
31731 <para>
31732 <indexterm role="concept">
31733 <primary>TLS</primary>
31734 <secondary>certificate status</secondary>
31735 </indexterm>
31736 <indexterm role="concept">
31737 <primary>TLS</primary>
31738 <secondary>OCSP proof file</secondary>
31739 </indexterm>
31740 This option
31741 must if set expand to the absolute path to a file which contains a current
31742 status proof for the server&#x2019;s certificate, as obtained from the
31743 Certificate Authority.
31744 </para>
31745 <para>
31746 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
31747 </para>
31748 <para>
31749 <indexterm role="option">
31750 <primary><option>tls_on_connect_ports</option></primary>
31751 </indexterm>
31752 </para>
31753 <informaltable frame="all">
31754 <tgroup cols="4" colsep="0" rowsep="0">
31755 <colspec colwidth="8*" align="left"/>
31756 <colspec colwidth="6*" align="center"/>
31757 <colspec colwidth="6*" align="center"/>
31758 <colspec colwidth="6*" align="right"/>
31759 <tbody>
31760 <row>
31761 <entry><option>tls_on_connect_ports</option></entry>
31762 <entry>Use: <emphasis>main</emphasis></entry>
31763 <entry>Type: <emphasis>string list</emphasis></entry>
31764 <entry>Default: <emphasis>unset</emphasis></entry>
31765 </row>
31766 </tbody>
31767 </tgroup>
31768 </informaltable>
31769 <para>
31770 <indexterm role="concept">
31771 <primary>SSMTP</primary>
31772 </indexterm>
31773 <indexterm role="concept">
31774 <primary>SMTPS</primary>
31775 </indexterm>
31776 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
31777 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
31778 set up without waiting for the client to issue a STARTTLS command. For
31779 further details, see section <xref linkend="SECTsupobssmt"/>.
31780 </para>
31781 <para>
31782 <indexterm role="option">
31783 <primary><option>tls_privatekey</option></primary>
31784 </indexterm>
31785 </para>
31786 <informaltable frame="all">
31787 <tgroup cols="4" colsep="0" rowsep="0">
31788 <colspec colwidth="8*" align="left"/>
31789 <colspec colwidth="6*" align="center"/>
31790 <colspec colwidth="6*" align="center"/>
31791 <colspec colwidth="6*" align="right"/>
31792 <tbody>
31793 <row>
31794 <entry><option>tls_privatekey</option></entry>
31795 <entry>Use: <emphasis>main</emphasis></entry>
31796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31797 <entry>Default: <emphasis>unset</emphasis></entry>
31798 </row>
31799 </tbody>
31800 </tgroup>
31801 </informaltable>
31802 <para>
31803 <indexterm role="concept">
31804 <primary>TLS</primary>
31805 <secondary>server private key; location of</secondary>
31806 </indexterm>
31807 The value of this option is expanded, and must then be the absolute path to a
31808 file which contains the server&#x2019;s private key. If this option is unset, or if
31809 the expansion is forced to fail, or the result is an empty string, the private
31810 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
31811 <xref linkend="CHAPTLS"/> for further details.
31812 </para>
31813 <para>
31814 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31815 </para>
31816 <para>
31817 <indexterm role="option">
31818 <primary><option>tls_remember_esmtp</option></primary>
31819 </indexterm>
31820 </para>
31821 <informaltable frame="all">
31822 <tgroup cols="4" colsep="0" rowsep="0">
31823 <colspec colwidth="8*" align="left"/>
31824 <colspec colwidth="6*" align="center"/>
31825 <colspec colwidth="6*" align="center"/>
31826 <colspec colwidth="6*" align="right"/>
31827 <tbody>
31828 <row>
31829 <entry><option>tls_remember_esmtp</option></entry>
31830 <entry>Use: <emphasis>main</emphasis></entry>
31831 <entry>Type: <emphasis>boolean</emphasis></entry>
31832 <entry>Default: <emphasis>false</emphasis></entry>
31833 </row>
31834 </tbody>
31835 </tgroup>
31836 </informaltable>
31837 <para>
31838 <indexterm role="concept">
31839 <primary>TLS</primary>
31840 <secondary>esmtp state; remembering</secondary>
31841 </indexterm>
31842 <indexterm role="concept">
31843 <primary>TLS</primary>
31844 <secondary>broken clients</secondary>
31845 </indexterm>
31846 If this option is set true, Exim violates the RFCs by remembering that it is in
31847 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
31848 support for broken clients that fail to send a new EHLO after starting a
31849 TLS session.
31850 </para>
31851 <para>
31852 <indexterm role="option">
31853 <primary><option>tls_require_ciphers</option></primary>
31854 </indexterm>
31855 </para>
31856 <informaltable frame="all">
31857 <tgroup cols="4" colsep="0" rowsep="0">
31858 <colspec colwidth="8*" align="left"/>
31859 <colspec colwidth="6*" align="center"/>
31860 <colspec colwidth="6*" align="center"/>
31861 <colspec colwidth="6*" align="right"/>
31862 <tbody>
31863 <row>
31864 <entry><option>tls_require_ciphers</option></entry>
31865 <entry>Use: <emphasis>main</emphasis></entry>
31866 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31867 <entry>Default: <emphasis>unset</emphasis></entry>
31868 </row>
31869 </tbody>
31870 </tgroup>
31871 </informaltable>
31872 <para>
31873 <indexterm role="concept">
31874 <primary>TLS</primary>
31875 <secondary>requiring specific ciphers</secondary>
31876 </indexterm>
31877 <indexterm role="concept">
31878 <primary>cipher</primary>
31879 <secondary>requiring specific</secondary>
31880 </indexterm>
31881 This option controls which ciphers can be used for incoming TLS connections.
31882 The <command>smtp</command> transport has an option of the same name for controlling outgoing
31883 connections. This option is expanded for each connection, so can be varied for
31884 different clients if required. The value of this option must be a list of
31885 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
31886 in somewhat different ways. If GnuTLS is being used, the client controls the
31887 preference order of the available ciphers. Details are given in sections
31888 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
31889 </para>
31890 <para>
31891 <indexterm role="option">
31892 <primary><option>tls_try_verify_hosts</option></primary>
31893 </indexterm>
31894 </para>
31895 <informaltable frame="all">
31896 <tgroup cols="4" colsep="0" rowsep="0">
31897 <colspec colwidth="8*" align="left"/>
31898 <colspec colwidth="6*" align="center"/>
31899 <colspec colwidth="6*" align="center"/>
31900 <colspec colwidth="6*" align="right"/>
31901 <tbody>
31902 <row>
31903 <entry><option>tls_try_verify_hosts</option></entry>
31904 <entry>Use: <emphasis>main</emphasis></entry>
31905 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31906 <entry>Default: <emphasis>unset</emphasis></entry>
31907 </row>
31908 </tbody>
31909 </tgroup>
31910 </informaltable>
31911 <para>
31912 <indexterm role="concept">
31913 <primary>TLS</primary>
31914 <secondary>client certificate verification</secondary>
31915 </indexterm>
31916 <indexterm role="concept">
31917 <primary>certificate</primary>
31918 <secondary>verification of client</secondary>
31919 </indexterm>
31920 See <option>tls_verify_hosts</option> below.
31921 </para>
31922 <para>
31923 <indexterm role="option">
31924 <primary><option>tls_verify_certificates</option></primary>
31925 </indexterm>
31926 </para>
31927 <informaltable frame="all">
31928 <tgroup cols="4" colsep="0" rowsep="0">
31929 <colspec colwidth="8*" align="left"/>
31930 <colspec colwidth="6*" align="center"/>
31931 <colspec colwidth="6*" align="center"/>
31932 <colspec colwidth="6*" align="right"/>
31933 <tbody>
31934 <row>
31935 <entry><option>tls_verify_certificates</option></entry>
31936 <entry>Use: <emphasis>main</emphasis></entry>
31937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31938 <entry>Default: <emphasis>system</emphasis></entry>
31939 </row>
31940 </tbody>
31941 </tgroup>
31942 </informaltable>
31943 <para>
31944 <indexterm role="concept">
31945 <primary>TLS</primary>
31946 <secondary>client certificate verification</secondary>
31947 </indexterm>
31948 <indexterm role="concept">
31949 <primary>certificate</primary>
31950 <secondary>verification of client</secondary>
31951 </indexterm>
31952 The value of this option is expanded, and must then be either the
31953 word "system"
31954 or the absolute path to
31955 a file or directory containing permitted certificates for clients that
31956 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
31957 </para>
31958 <para>
31959 The "system" value for the option will use a
31960 system default location compiled into the SSL library.
31961 This is not available for GnuTLS versions preceding 3.0.20,
31962 and will be taken as empty; an explicit location
31963 must be specified.
31964 </para>
31965 <para>
31966 The use of a directory for the option value is not available for GnuTLS versions
31967 preceding 3.3.6 and a single file must be used.
31968 </para>
31969 <para>
31970 With OpenSSL the certificates specified
31971 explicitly
31972 either by file or directory
31973 are added to those given by the system default location.
31974 </para>
31975 <para>
31976 These certificates should be for the certificate authorities trusted, rather
31977 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
31978 the value is a file then the certificates are sent by Exim as a server to
31979 connecting clients, defining the list of accepted certificate authorities.
31980 Thus the values defined should be considered public data.  To avoid this,
31981 use the explicit directory version.
31982 </para>
31983 <para>
31984 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31985 </para>
31986 <para>
31987 A forced expansion failure or setting to an empty string is equivalent to
31988 being unset.
31989 </para>
31990 <para>
31991 <indexterm role="option">
31992 <primary><option>tls_verify_hosts</option></primary>
31993 </indexterm>
31994 </para>
31995 <informaltable frame="all">
31996 <tgroup cols="4" colsep="0" rowsep="0">
31997 <colspec colwidth="8*" align="left"/>
31998 <colspec colwidth="6*" align="center"/>
31999 <colspec colwidth="6*" align="center"/>
32000 <colspec colwidth="6*" align="right"/>
32001 <tbody>
32002 <row>
32003 <entry><option>tls_verify_hosts</option></entry>
32004 <entry>Use: <emphasis>main</emphasis></entry>
32005 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32006 <entry>Default: <emphasis>unset</emphasis></entry>
32007 </row>
32008 </tbody>
32009 </tgroup>
32010 </informaltable>
32011 <para>
32012 <indexterm role="concept">
32013 <primary>TLS</primary>
32014 <secondary>client certificate verification</secondary>
32015 </indexterm>
32016 <indexterm role="concept">
32017 <primary>certificate</primary>
32018 <secondary>verification of client</secondary>
32019 </indexterm>
32020 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
32021 certificates from clients. The expected certificates are defined by
32022 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
32023 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
32024 <option>tls_verify_certificates</option> is not set.
32025 </para>
32026 <para>
32027 Any client that matches <option>tls_verify_hosts</option> is constrained by
32028 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
32029 present one of the listed certificates. If it does not, the connection is
32030 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
32031 the host to use TLS. It can still send SMTP commands through unencrypted
32032 connections. Forcing a client to use TLS has to be done separately using an
32033 ACL to reject inappropriate commands when the connection is not encrypted.
32034 </para>
32035 <para>
32036 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
32037 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
32038 certificate and checks it against <option>tls_verify_certificates</option>, but does not
32039 abort the connection if there is no certificate or if it does not match. This
32040 state can be detected in an ACL, which makes it possible to implement policies
32041 such as <quote>accept for relay only if a verified certificate has been received,
32042 but accept for local delivery if encrypted, even without a verified
32043 certificate</quote>.
32044 </para>
32045 <para>
32046 Client hosts that match neither of these lists are not asked to present
32047 certificates.
32048 </para>
32049 <para>
32050 <indexterm role="option">
32051 <primary><option>trusted_groups</option></primary>
32052 </indexterm>
32053 </para>
32054 <informaltable frame="all">
32055 <tgroup cols="4" colsep="0" rowsep="0">
32056 <colspec colwidth="8*" align="left"/>
32057 <colspec colwidth="6*" align="center"/>
32058 <colspec colwidth="6*" align="center"/>
32059 <colspec colwidth="6*" align="right"/>
32060 <tbody>
32061 <row>
32062 <entry><option>trusted_groups</option></entry>
32063 <entry>Use: <emphasis>main</emphasis></entry>
32064 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32065 <entry>Default: <emphasis>unset</emphasis></entry>
32066 </row>
32067 </tbody>
32068 </tgroup>
32069 </informaltable>
32070 <para>
32071 <indexterm role="concept">
32072 <primary>trusted groups</primary>
32073 </indexterm>
32074 <indexterm role="concept">
32075 <primary>groups</primary>
32076 <secondary>trusted</secondary>
32077 </indexterm>
32078 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32079 option is set, any process that is running in one of the listed groups, or
32080 which has one of them as a supplementary group, is trusted. The groups can be
32081 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
32082 details of what trusted callers are permitted to do. If neither
32083 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
32084 are trusted.
32085 </para>
32086 <para>
32087 <indexterm role="option">
32088 <primary><option>trusted_users</option></primary>
32089 </indexterm>
32090 </para>
32091 <informaltable frame="all">
32092 <tgroup cols="4" colsep="0" rowsep="0">
32093 <colspec colwidth="8*" align="left"/>
32094 <colspec colwidth="6*" align="center"/>
32095 <colspec colwidth="6*" align="center"/>
32096 <colspec colwidth="6*" align="right"/>
32097 <tbody>
32098 <row>
32099 <entry><option>trusted_users</option></entry>
32100 <entry>Use: <emphasis>main</emphasis></entry>
32101 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32102 <entry>Default: <emphasis>unset</emphasis></entry>
32103 </row>
32104 </tbody>
32105 </tgroup>
32106 </informaltable>
32107 <para>
32108 <indexterm role="concept">
32109 <primary>trusted users</primary>
32110 </indexterm>
32111 <indexterm role="concept">
32112 <primary>user</primary>
32113 <secondary>trusted</secondary>
32114 </indexterm>
32115 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32116 option is set, any process that is running as one of the listed users is
32117 trusted. The users can be specified numerically or by name. See section
32118 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
32119 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
32120 Exim user are trusted.
32121 </para>
32122 <para>
32123 <indexterm role="option">
32124 <primary><option>unknown_login</option></primary>
32125 </indexterm>
32126 </para>
32127 <informaltable frame="all">
32128 <tgroup cols="4" colsep="0" rowsep="0">
32129 <colspec colwidth="8*" align="left"/>
32130 <colspec colwidth="6*" align="center"/>
32131 <colspec colwidth="6*" align="center"/>
32132 <colspec colwidth="6*" align="right"/>
32133 <tbody>
32134 <row>
32135 <entry><option>unknown_login</option></entry>
32136 <entry>Use: <emphasis>main</emphasis></entry>
32137 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32138 <entry>Default: <emphasis>unset</emphasis></entry>
32139 </row>
32140 </tbody>
32141 </tgroup>
32142 </informaltable>
32143 <para>
32144 <indexterm role="concept">
32145 <primary>uid (user id)</primary>
32146 <secondary>unknown caller</secondary>
32147 </indexterm>
32148 <indexterm role="variable">
32149 <primary><varname>$caller_uid</varname></primary>
32150 </indexterm>
32151 This is a specialized feature for use in unusual configurations. By default, if
32152 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
32153 gives up. The <option>unknown_login</option> option can be used to set a login name to be
32154 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
32155 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
32156 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
32157 <option>-F</option> option.
32158 </para>
32159 <para>
32160 <indexterm role="option">
32161 <primary><option>unknown_username</option></primary>
32162 </indexterm>
32163 </para>
32164 <informaltable frame="all">
32165 <tgroup cols="4" colsep="0" rowsep="0">
32166 <colspec colwidth="8*" align="left"/>
32167 <colspec colwidth="6*" align="center"/>
32168 <colspec colwidth="6*" align="center"/>
32169 <colspec colwidth="6*" align="right"/>
32170 <tbody>
32171 <row>
32172 <entry><option>unknown_username</option></entry>
32173 <entry>Use: <emphasis>main</emphasis></entry>
32174 <entry>Type: <emphasis>string</emphasis></entry>
32175 <entry>Default: <emphasis>unset</emphasis></entry>
32176 </row>
32177 </tbody>
32178 </tgroup>
32179 </informaltable>
32180 <para>
32181 See <option>unknown_login</option>.
32182 </para>
32183 <para>
32184 <indexterm role="option">
32185 <primary><option>untrusted_set_sender</option></primary>
32186 </indexterm>
32187 </para>
32188 <informaltable frame="all">
32189 <tgroup cols="4" colsep="0" rowsep="0">
32190 <colspec colwidth="8*" align="left"/>
32191 <colspec colwidth="6*" align="center"/>
32192 <colspec colwidth="6*" align="center"/>
32193 <colspec colwidth="6*" align="right"/>
32194 <tbody>
32195 <row>
32196 <entry><option>untrusted_set_sender</option></entry>
32197 <entry>Use: <emphasis>main</emphasis></entry>
32198 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32199 <entry>Default: <emphasis>unset</emphasis></entry>
32200 </row>
32201 </tbody>
32202 </tgroup>
32203 </informaltable>
32204 <para>
32205 <indexterm role="concept">
32206 <primary>trusted users</primary>
32207 </indexterm>
32208 <indexterm role="concept">
32209 <primary>sender</primary>
32210 <secondary>setting by untrusted user</secondary>
32211 </indexterm>
32212 <indexterm role="concept">
32213 <primary>untrusted user setting sender</primary>
32214 </indexterm>
32215 <indexterm role="concept">
32216 <primary>user</primary>
32217 <secondary>untrusted setting sender</secondary>
32218 </indexterm>
32219 <indexterm role="concept">
32220 <primary>envelope sender</primary>
32221 </indexterm>
32222 When an untrusted user submits a message to Exim using the standard input, Exim
32223 normally creates an envelope sender address from the user&#x2019;s login and the
32224 default qualification domain. Data from the <option>-f</option> option (for setting envelope
32225 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
32226 is used) is ignored.
32227 </para>
32228 <para>
32229 However, untrusted users are permitted to set an empty envelope sender address,
32230 to declare that a message should never generate any bounces. For example:
32231 </para>
32232 <literallayout class="monospaced">
32233 exim -f '&lt;&gt;' user@domain.example
32234 </literallayout>
32235 <para>
32236 <indexterm role="variable">
32237 <primary><varname>$sender_ident</varname></primary>
32238 </indexterm>
32239 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
32240 other envelope sender addresses in a controlled way. When it is set, untrusted
32241 users are allowed to set envelope sender addresses that match any of the
32242 patterns in the list. Like all address lists, the string is expanded. The
32243 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
32244 users to setting senders that start with their login ids
32245 followed by a hyphen
32246 by a setting like this:
32247 </para>
32248 <literallayout class="monospaced">
32249 untrusted_set_sender = ^$sender_ident-
32250 </literallayout>
32251 <para>
32252 If you want to allow untrusted users to set envelope sender addresses without
32253 restriction, you can use
32254 </para>
32255 <literallayout class="monospaced">
32256 untrusted_set_sender = *
32257 </literallayout>
32258 <para>
32259 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
32260 only to the setting of the envelope sender. It does not permit untrusted users
32261 to use the other options which trusted user can use to override message
32262 parameters. Furthermore, it does not stop Exim from removing an existing
32263 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
32264 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
32265 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
32266 described in section <xref linkend="SECTthesenhea"/>.
32267 </para>
32268 <para>
32269 The log line for a message&#x2019;s arrival shows the envelope sender following
32270 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
32271 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
32272 envelope sender address, the user&#x2019;s login is shown in parentheses after the
32273 sender address.
32274 </para>
32275 <para>
32276 <indexterm role="option">
32277 <primary><option>uucp_from_pattern</option></primary>
32278 </indexterm>
32279 </para>
32280 <informaltable frame="all">
32281 <tgroup cols="4" colsep="0" rowsep="0">
32282 <colspec colwidth="8*" align="left"/>
32283 <colspec colwidth="6*" align="center"/>
32284 <colspec colwidth="6*" align="center"/>
32285 <colspec colwidth="6*" align="right"/>
32286 <tbody>
32287 <row>
32288 <entry><option>uucp_from_pattern</option></entry>
32289 <entry>Use: <emphasis>main</emphasis></entry>
32290 <entry>Type: <emphasis>string</emphasis></entry>
32291 <entry>Default: <emphasis>see below</emphasis></entry>
32292 </row>
32293 </tbody>
32294 </tgroup>
32295 </informaltable>
32296 <para>
32297 <indexterm role="concept">
32298 <primary><quote>From</quote> line</primary>
32299 </indexterm>
32300 <indexterm role="concept">
32301 <primary>UUCP</primary>
32302 <secondary><quote>From</quote> line</secondary>
32303 </indexterm>
32304 Some applications that pass messages to an MTA via a command line interface use
32305 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
32306 particular, this is used by UUCP software. Exim recognizes such a line by means
32307 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
32308 matches, the sender address is constructed by expanding the contents of
32309 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
32310 default pattern recognizes lines in the following two forms:
32311 </para>
32312 <literallayout class="monospaced">
32313 From ph10 Fri Jan  5 12:35 GMT 1996
32314 From ph10 Fri, 7 Jan 97 14:00:00 GMT
32315 </literallayout>
32316 <para>
32317 The pattern can be seen by running
32318 </para>
32319 <literallayout class="monospaced">
32320 exim -bP uucp_from_pattern
32321 </literallayout>
32322 <para>
32323 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
32324 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
32325 regular expression by a parenthesized subpattern. The default value for
32326 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
32327 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
32328 <option>ignore_fromline_hosts</option>.
32329 </para>
32330 <para>
32331 <indexterm role="option">
32332 <primary><option>uucp_from_sender</option></primary>
32333 </indexterm>
32334 </para>
32335 <informaltable frame="all">
32336 <tgroup cols="4" colsep="0" rowsep="0">
32337 <colspec colwidth="8*" align="left"/>
32338 <colspec colwidth="6*" align="center"/>
32339 <colspec colwidth="6*" align="center"/>
32340 <colspec colwidth="6*" align="right"/>
32341 <tbody>
32342 <row>
32343 <entry><option>uucp_from_sender</option></entry>
32344 <entry>Use: <emphasis>main</emphasis></entry>
32345 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32346 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
32347 </row>
32348 </tbody>
32349 </tgroup>
32350 </informaltable>
32351 <para>
32352 See <option>uucp_from_pattern</option> above.
32353 </para>
32354 <para>
32355 <indexterm role="option">
32356 <primary><option>warn_message_file</option></primary>
32357 </indexterm>
32358 </para>
32359 <informaltable frame="all">
32360 <tgroup cols="4" colsep="0" rowsep="0">
32361 <colspec colwidth="8*" align="left"/>
32362 <colspec colwidth="6*" align="center"/>
32363 <colspec colwidth="6*" align="center"/>
32364 <colspec colwidth="6*" align="right"/>
32365 <tbody>
32366 <row>
32367 <entry><option>warn_message_file</option></entry>
32368 <entry>Use: <emphasis>main</emphasis></entry>
32369 <entry>Type: <emphasis>string</emphasis></entry>
32370 <entry>Default: <emphasis>unset</emphasis></entry>
32371 </row>
32372 </tbody>
32373 </tgroup>
32374 </informaltable>
32375 <para>
32376 <indexterm role="concept">
32377 <primary>warning of delay</primary>
32378 <secondary>customizing the message</secondary>
32379 </indexterm>
32380 <indexterm role="concept">
32381 <primary>customizing</primary>
32382 <secondary>warning message</secondary>
32383 </indexterm>
32384 This option defines a template file containing paragraphs of text to be used
32385 for constructing the warning message which is sent by Exim when a message has
32386 been on the queue for a specified amount of time, as specified by
32387 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
32388 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
32389 </para>
32390 <para>
32391 <indexterm role="option">
32392 <primary><option>write_rejectlog</option></primary>
32393 </indexterm>
32394 </para>
32395 <informaltable frame="all">
32396 <tgroup cols="4" colsep="0" rowsep="0">
32397 <colspec colwidth="8*" align="left"/>
32398 <colspec colwidth="6*" align="center"/>
32399 <colspec colwidth="6*" align="center"/>
32400 <colspec colwidth="6*" align="right"/>
32401 <tbody>
32402 <row>
32403 <entry><option>write_rejectlog</option></entry>
32404 <entry>Use: <emphasis>main</emphasis></entry>
32405 <entry>Type: <emphasis>boolean</emphasis></entry>
32406 <entry>Default: <emphasis>true</emphasis></entry>
32407 </row>
32408 </tbody>
32409 </tgroup>
32410 </informaltable>
32411 <para>
32412 <indexterm role="concept">
32413 <primary>reject log</primary>
32414 <secondary>disabling</secondary>
32415 </indexterm>
32416 If this option is set false, Exim no longer writes anything to the reject log.
32417 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
32418 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
32419 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
32420 </para>
32421 </section>
32422 </chapter>
32423
32424 <chapter id="CHAProutergeneric">
32425 <title>Generic options for routers</title>
32426 <para>
32427 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
32428 <primary>options</primary>
32429 <secondary>generic; for routers</secondary>
32430 </indexterm>
32431 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
32432 <primary>generic options</primary>
32433 <secondary>router</secondary>
32434 </indexterm>
32435 This chapter describes the generic options that apply to all routers.
32436 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
32437 </para>
32438 <para>
32439 For a general description of how a router operates, see sections
32440 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
32441 which the preconditions are tested. The order of expansion of the options that
32442 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
32443 <option>headers_remove</option>, <option>transport</option>.
32444 </para>
32445 <para>
32446 <indexterm role="option">
32447 <primary><option>address_data</option></primary>
32448 </indexterm>
32449 </para>
32450 <informaltable frame="all">
32451 <tgroup cols="4" colsep="0" rowsep="0">
32452 <colspec colwidth="8*" align="left"/>
32453 <colspec colwidth="6*" align="center"/>
32454 <colspec colwidth="6*" align="center"/>
32455 <colspec colwidth="6*" align="right"/>
32456 <tbody>
32457 <row>
32458 <entry><option>address_data</option></entry>
32459 <entry>Use: <emphasis>routers</emphasis></entry>
32460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32461 <entry>Default: <emphasis>unset</emphasis></entry>
32462 </row>
32463 </tbody>
32464 </tgroup>
32465 </informaltable>
32466 <para>
32467 <indexterm role="concept">
32468 <primary>router</primary>
32469 <secondary>data attached to address</secondary>
32470 </indexterm>
32471 The string is expanded just before the router is run, that is, after all the
32472 precondition tests have succeeded. If the expansion is forced to fail, the
32473 router declines, the value of <option>address_data</option> remains unchanged, and the
32474 <option>more</option> option controls what happens next. Other expansion failures cause
32475 delivery of the address to be deferred.
32476 </para>
32477 <para>
32478 <indexterm role="variable">
32479 <primary><varname>$address_data</varname></primary>
32480 </indexterm>
32481 When the expansion succeeds, the value is retained with the address, and can be
32482 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
32483 routers, and the eventual transport.
32484 </para>
32485 <para>
32486 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
32487 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
32488 in the filter. This is not normally a problem, because such data is usually
32489 either not confidential or it <quote>belongs</quote> to the current user, but if you do
32490 put confidential data into <varname>$address_data</varname> you need to remember this point.
32491 </para>
32492 <para>
32493 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
32494 with the address, though it can be changed by another <option>address_data</option> setting
32495 on a subsequent router. If a router generates child addresses, the value of
32496 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
32497 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
32498 </para>
32499 <para>
32500 The idea of <option>address_data</option> is that you can use it to look up a lot of data
32501 for the address once, and then pick out parts of the data later. For example,
32502 you could use a single LDAP lookup to return a string of the form
32503 </para>
32504 <literallayout class="monospaced">
32505 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
32506 </literallayout>
32507 <para>
32508 In the transport you could pick out the mailbox by a setting such as
32509 </para>
32510 <literallayout class="monospaced">
32511 file = ${extract{mailbox}{$address_data}}
32512 </literallayout>
32513 <para>
32514 This makes the configuration file less messy, and also reduces the number of
32515 lookups (though Exim does cache lookups).
32516 </para>
32517 <para>
32518 <indexterm role="variable">
32519 <primary><varname>$sender_address_data</varname></primary>
32520 </indexterm>
32521 <indexterm role="variable">
32522 <primary><varname>$address_data</varname></primary>
32523 </indexterm>
32524 The <option>address_data</option> facility is also useful as a means of passing information
32525 from one router to another, and from a router to a transport. In addition, if
32526 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
32527 ACL, it remains available for use in the rest of the ACL statement. After
32528 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
32529 </para>
32530 <para>
32531 <indexterm role="option">
32532 <primary><option>address_test</option></primary>
32533 </indexterm>
32534 </para>
32535 <informaltable frame="all">
32536 <tgroup cols="4" colsep="0" rowsep="0">
32537 <colspec colwidth="8*" align="left"/>
32538 <colspec colwidth="6*" align="center"/>
32539 <colspec colwidth="6*" align="center"/>
32540 <colspec colwidth="6*" align="right"/>
32541 <tbody>
32542 <row>
32543 <entry><option>address_test</option></entry>
32544 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32545 <entry>Type: <emphasis>boolean</emphasis></entry>
32546 <entry>Default: <emphasis>true</emphasis></entry>
32547 </row>
32548 </tbody>
32549 </tgroup>
32550 </informaltable>
32551 <para>
32552 <indexterm role="option">
32553 <primary><option>-bt</option></primary>
32554 </indexterm>
32555 <indexterm role="concept">
32556 <primary>router</primary>
32557 <secondary>skipping when address testing</secondary>
32558 </indexterm>
32559 If this option is set false, the router is skipped when routing is being tested
32560 by means of the <option>-bt</option> command line option. This can be a convenience when
32561 your first router sends messages to an external scanner, because it saves you
32562 having to set the <quote>already scanned</quote> indicator when testing real address
32563 routing.
32564 </para>
32565 <para>
32566 <indexterm role="option">
32567 <primary><option>cannot_route_message</option></primary>
32568 </indexterm>
32569 </para>
32570 <informaltable frame="all">
32571 <tgroup cols="4" colsep="0" rowsep="0">
32572 <colspec colwidth="8*" align="left"/>
32573 <colspec colwidth="6*" align="center"/>
32574 <colspec colwidth="6*" align="center"/>
32575 <colspec colwidth="6*" align="right"/>
32576 <tbody>
32577 <row>
32578 <entry><option>cannot_route_message</option></entry>
32579 <entry>Use: <emphasis>routers</emphasis></entry>
32580 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32581 <entry>Default: <emphasis>unset</emphasis></entry>
32582 </row>
32583 </tbody>
32584 </tgroup>
32585 </informaltable>
32586 <para>
32587 <indexterm role="concept">
32588 <primary>router</primary>
32589 <secondary>customizing <quote>cannot route</quote> message</secondary>
32590 </indexterm>
32591 <indexterm role="concept">
32592 <primary>customizing</primary>
32593 <secondary><quote>cannot route</quote> message</secondary>
32594 </indexterm>
32595 This option specifies a text message that is used when an address cannot be
32596 routed because Exim has run out of routers. The default message is
32597 <quote>Unrouteable address</quote>. This option is useful only on routers that have
32598 <option>more</option> set false, or on the very last router in a configuration, because the
32599 value that is used is taken from the last router that is considered. This
32600 includes a router that is skipped because its preconditions are not met, as
32601 well as a router that declines. For example, using the default configuration,
32602 you could put:
32603 </para>
32604 <literallayout class="monospaced">
32605 cannot_route_message = Remote domain not found in DNS
32606 </literallayout>
32607 <para>
32608 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
32609 and
32610 </para>
32611 <literallayout class="monospaced">
32612 cannot_route_message = Unknown local user
32613 </literallayout>
32614 <para>
32615 on the final router that checks for local users. If string expansion fails for
32616 this option, the default message is used. Unless the expansion failure was
32617 explicitly forced, a message about the failure is written to the main and panic
32618 logs, in addition to the normal message about the routing failure.
32619 </para>
32620 <para>
32621 <indexterm role="option">
32622 <primary><option>caseful_local_part</option></primary>
32623 </indexterm>
32624 </para>
32625 <informaltable frame="all">
32626 <tgroup cols="4" colsep="0" rowsep="0">
32627 <colspec colwidth="8*" align="left"/>
32628 <colspec colwidth="6*" align="center"/>
32629 <colspec colwidth="6*" align="center"/>
32630 <colspec colwidth="6*" align="right"/>
32631 <tbody>
32632 <row>
32633 <entry><option>caseful_local_part</option></entry>
32634 <entry>Use: <emphasis>routers</emphasis></entry>
32635 <entry>Type: <emphasis>boolean</emphasis></entry>
32636 <entry>Default: <emphasis>false</emphasis></entry>
32637 </row>
32638 </tbody>
32639 </tgroup>
32640 </informaltable>
32641 <para>
32642 <indexterm role="concept">
32643 <primary>case of local parts</primary>
32644 </indexterm>
32645 <indexterm role="concept">
32646 <primary>router</primary>
32647 <secondary>case of local parts</secondary>
32648 </indexterm>
32649 By default, routers handle the local parts of addresses in a case-insensitive
32650 manner, though the actual case is preserved for transmission with the message.
32651 If you want the case of letters to be significant in a router, you must set
32652 this option true. For individual router options that contain address or local
32653 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
32654 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
32655 more details.
32656 </para>
32657 <para>
32658 <indexterm role="variable">
32659 <primary><varname>$local_part</varname></primary>
32660 </indexterm>
32661 <indexterm role="variable">
32662 <primary><varname>$original_local_part</varname></primary>
32663 </indexterm>
32664 <indexterm role="variable">
32665 <primary><varname>$parent_local_part</varname></primary>
32666 </indexterm>
32667 The value of the <varname>$local_part</varname> variable is forced to lower case while a
32668 router is running unless <option>caseful_local_part</option> is set. When a router assigns
32669 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
32670 is the same as it was in the router. Similarly, when a router generates child
32671 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
32672 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
32673 </para>
32674 <para>
32675 This option applies to the processing of an address by a router. When a
32676 recipient address is being processed in an ACL, there is a separate <option>control</option>
32677 modifier that can be used to specify case-sensitive processing within the ACL
32678 (see section <xref linkend="SECTcontrols"/>).
32679 </para>
32680 <para>
32681 <indexterm role="option">
32682 <primary><option>check_local_user</option></primary>
32683 </indexterm>
32684 </para>
32685 <informaltable frame="all">
32686 <tgroup cols="4" colsep="0" rowsep="0">
32687 <colspec colwidth="8*" align="left"/>
32688 <colspec colwidth="6*" align="center"/>
32689 <colspec colwidth="6*" align="center"/>
32690 <colspec colwidth="6*" align="right"/>
32691 <tbody>
32692 <row>
32693 <entry><option>check_local_user</option></entry>
32694 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32695 <entry>Type: <emphasis>boolean</emphasis></entry>
32696 <entry>Default: <emphasis>false</emphasis></entry>
32697 </row>
32698 </tbody>
32699 </tgroup>
32700 </informaltable>
32701 <para>
32702 <indexterm role="concept">
32703 <primary>local user, checking in router</primary>
32704 </indexterm>
32705 <indexterm role="concept">
32706 <primary>router</primary>
32707 <secondary>checking for local user</secondary>
32708 </indexterm>
32709 <indexterm role="concept">
32710 <primary><filename>/etc/passwd</filename></primary>
32711 </indexterm>
32712 <indexterm role="variable">
32713 <primary><varname>$home</varname></primary>
32714 </indexterm>
32715 When this option is true, Exim checks that the local part of the recipient
32716 address (with affixes removed if relevant) is the name of an account on the
32717 local system. The check is done by calling the <function>getpwnam()</function> function rather
32718 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
32719 holding password data (such as NIS) are supported. If the local part is a local
32720 user, <varname>$home</varname> is set from the password data, and can be tested in other
32721 preconditions that are evaluated after this one (the order of evaluation is
32722 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
32723 overridden by <option>router_home_directory</option>. If the local part is not a local user,
32724 the router is skipped.
32725 </para>
32726 <para>
32727 If you want to check that the local part is either the name of a local user
32728 or matches something else, you cannot combine <option>check_local_user</option> with a
32729 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
32730 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
32731 setting to achieve this. For example:
32732 </para>
32733 <literallayout class="monospaced">
32734 local_parts = passwd;$local_part : lsearch;/etc/other/users
32735 </literallayout>
32736 <para>
32737 Note, however, that the side effects of <option>check_local_user</option> (such as setting
32738 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
32739 <option>local_parts</option> (or any other) precondition.
32740 </para>
32741 <para>
32742 <indexterm role="option">
32743 <primary><option>condition</option></primary>
32744 </indexterm>
32745 </para>
32746 <informaltable frame="all">
32747 <tgroup cols="4" colsep="0" rowsep="0">
32748 <colspec colwidth="8*" align="left"/>
32749 <colspec colwidth="6*" align="center"/>
32750 <colspec colwidth="6*" align="center"/>
32751 <colspec colwidth="6*" align="right"/>
32752 <tbody>
32753 <row>
32754 <entry><option>condition</option></entry>
32755 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32756 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32757 <entry>Default: <emphasis>unset</emphasis></entry>
32758 </row>
32759 </tbody>
32760 </tgroup>
32761 </informaltable>
32762 <para>
32763 <indexterm role="concept">
32764 <primary>router</primary>
32765 <secondary>customized precondition</secondary>
32766 </indexterm>
32767 This option specifies a general precondition test that has to succeed for the
32768 router to be called. The <option>condition</option> option is the last precondition to be
32769 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
32770 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
32771 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
32772 router is skipped, and the address is offered to the next one.
32773 </para>
32774 <para>
32775 If the result is any other value, the router is run (as this is the last
32776 precondition to be evaluated, all the other preconditions must be true).
32777 </para>
32778 <para>
32779 This option is unusual in that multiple <option>condition</option> options may be present.
32780 All <option>condition</option> options must succeed.
32781 </para>
32782 <para>
32783 The <option>condition</option> option provides a means of applying custom conditions to the
32784 running of routers. Note that in the case of a simple conditional expansion,
32785 the default expansion values are exactly what is wanted. For example:
32786 </para>
32787 <literallayout class="monospaced">
32788 condition = ${if &gt;{$message_age}{600}}
32789 </literallayout>
32790 <para>
32791 Because of the default behaviour of the string expansion, this is equivalent to
32792 </para>
32793 <literallayout class="monospaced">
32794 condition = ${if &gt;{$message_age}{600}{true}{}}
32795 </literallayout>
32796 <para>
32797 A multiple condition example, which succeeds:
32798 </para>
32799 <literallayout class="monospaced">
32800 condition = ${if &gt;{$message_age}{600}}
32801 condition = ${if !eq{${lc:$local_part}}{postmaster}}
32802 condition = foobar
32803 </literallayout>
32804 <para>
32805 If the expansion fails (other than forced failure) delivery is deferred. Some
32806 of the other precondition options are common special cases that could in fact
32807 be specified using <option>condition</option>.
32808 </para>
32809 <para>
32810 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
32811 are far older, and use one set of semantics.  ACLs are newer and when
32812 they were created, the ACL <option>condition</option> process was given far stricter
32813 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
32814 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
32815 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
32816 Router rules processing behavior.
32817 </para>
32818 <para>
32819 This is best illustrated in an example:
32820 </para>
32821 <literallayout class="monospaced">
32822 # If used in an ACL condition will fail with a syntax error, but
32823 # in a router condition any extra characters are treated as a string
32824
32825 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
32826 true {yes} {no}}
32827
32828 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
32829  {yes} {no}}
32830 </literallayout>
32831 <para>
32832 In each example above, the <option>if</option> statement actually ends after
32833 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
32834 default <option>if</option> behavior is to return a boolean true or a null answer
32835 (which evaluates to false). The rest of the line is then treated as a
32836 string. So the first example resulted in the boolean answer <quote>true</quote>
32837 with the string <quote> {yes} {no}}</quote> appended to it. The second example
32838 resulted in the null output (indicating false) with the string
32839 <quote> {yes} {no}}</quote> appended to it.
32840 </para>
32841 <para>
32842 In fact you can put excess forward braces in too.  In the router
32843 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
32844 mean something, like after a <quote>$</quote> or when required as part of a
32845 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
32846 string characters.
32847 </para>
32848 <para>
32849 Thus, in a Router, the above expansion strings will both always evaluate
32850 true, as the result of expansion is a non-empty string which doesn&#x2019;t
32851 match an explicit false value.  This can be tricky to debug.  By
32852 contrast, in an ACL either of those strings will always result in an
32853 expansion error because the result doesn&#x2019;t look sufficiently boolean.
32854 </para>
32855 <para>
32856 <indexterm role="option">
32857 <primary><option>debug_print</option></primary>
32858 </indexterm>
32859 </para>
32860 <informaltable frame="all">
32861 <tgroup cols="4" colsep="0" rowsep="0">
32862 <colspec colwidth="8*" align="left"/>
32863 <colspec colwidth="6*" align="center"/>
32864 <colspec colwidth="6*" align="center"/>
32865 <colspec colwidth="6*" align="right"/>
32866 <tbody>
32867 <row>
32868 <entry><option>debug_print</option></entry>
32869 <entry>Use: <emphasis>routers</emphasis></entry>
32870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32871 <entry>Default: <emphasis>unset</emphasis></entry>
32872 </row>
32873 </tbody>
32874 </tgroup>
32875 </informaltable>
32876 <para>
32877 <indexterm role="concept">
32878 <primary>testing</primary>
32879 <secondary>variables in drivers</secondary>
32880 </indexterm>
32881 If this option is set and debugging is enabled (see the <option>-d</option> command line
32882 option) or in address-testing mode (see the <option>-bt</option> command line option),
32883 the string is expanded and included in the debugging output.
32884 If expansion of the string fails, the error message is written to the debugging
32885 output, and Exim carries on processing.
32886 This option is provided to help with checking out the values of variables and
32887 so on when debugging router configurations. For example, if a <option>condition</option>
32888 option appears not to be working, <option>debug_print</option> can be used to output the
32889 variables it references. The output happens after checks for <option>domains</option>,
32890 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
32891 are tested. A newline is added to the text if it does not end with one.
32892 The variable <varname>$router_name</varname> contains the name of the router.
32893 </para>
32894 <para>
32895 <indexterm role="option">
32896 <primary><option>disable_logging</option></primary>
32897 </indexterm>
32898 </para>
32899 <informaltable frame="all">
32900 <tgroup cols="4" colsep="0" rowsep="0">
32901 <colspec colwidth="8*" align="left"/>
32902 <colspec colwidth="6*" align="center"/>
32903 <colspec colwidth="6*" align="center"/>
32904 <colspec colwidth="6*" align="right"/>
32905 <tbody>
32906 <row>
32907 <entry><option>disable_logging</option></entry>
32908 <entry>Use: <emphasis>routers</emphasis></entry>
32909 <entry>Type: <emphasis>boolean</emphasis></entry>
32910 <entry>Default: <emphasis>false</emphasis></entry>
32911 </row>
32912 </tbody>
32913 </tgroup>
32914 </informaltable>
32915 <para>
32916 If this option is set true, nothing is logged for any routing errors
32917 or for any deliveries caused by this router. You should not set this option
32918 unless you really, really know what you are doing. See also the generic
32919 transport option of the same name.
32920 </para>
32921 <para>
32922 <indexterm role="option">
32923 <primary><option>dnssec_request_domains</option></primary>
32924 </indexterm>
32925 </para>
32926 <informaltable frame="all">
32927 <tgroup cols="4" colsep="0" rowsep="0">
32928 <colspec colwidth="8*" align="left"/>
32929 <colspec colwidth="6*" align="center"/>
32930 <colspec colwidth="6*" align="center"/>
32931 <colspec colwidth="6*" align="right"/>
32932 <tbody>
32933 <row>
32934 <entry><option>dnssec_request_domains</option></entry>
32935 <entry>Use: <emphasis>routers</emphasis></entry>
32936 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32937 <entry>Default: <emphasis>unset</emphasis></entry>
32938 </row>
32939 </tbody>
32940 </tgroup>
32941 </informaltable>
32942 <para>
32943 <indexterm role="concept">
32944 <primary>MX record</primary>
32945 <secondary>security</secondary>
32946 </indexterm>
32947 <indexterm role="concept">
32948 <primary>DNSSEC</primary>
32949 <secondary>MX lookup</secondary>
32950 </indexterm>
32951 <indexterm role="concept">
32952 <primary>security</primary>
32953 <secondary>MX lookup</secondary>
32954 </indexterm>
32955 <indexterm role="concept">
32956 <primary>DNS</primary>
32957 <secondary>DNSSEC</secondary>
32958 </indexterm>
32959 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32960 the dnssec request bit set.
32961 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32962 </para>
32963 <para>
32964 <indexterm role="option">
32965 <primary><option>dnssec_require_domains</option></primary>
32966 </indexterm>
32967 </para>
32968 <informaltable frame="all">
32969 <tgroup cols="4" colsep="0" rowsep="0">
32970 <colspec colwidth="8*" align="left"/>
32971 <colspec colwidth="6*" align="center"/>
32972 <colspec colwidth="6*" align="center"/>
32973 <colspec colwidth="6*" align="right"/>
32974 <tbody>
32975 <row>
32976 <entry><option>dnssec_require_domains</option></entry>
32977 <entry>Use: <emphasis>routers</emphasis></entry>
32978 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32979 <entry>Default: <emphasis>unset</emphasis></entry>
32980 </row>
32981 </tbody>
32982 </tgroup>
32983 </informaltable>
32984 <para>
32985 <indexterm role="concept">
32986 <primary>MX record</primary>
32987 <secondary>security</secondary>
32988 </indexterm>
32989 <indexterm role="concept">
32990 <primary>DNSSEC</primary>
32991 <secondary>MX lookup</secondary>
32992 </indexterm>
32993 <indexterm role="concept">
32994 <primary>security</primary>
32995 <secondary>MX lookup</secondary>
32996 </indexterm>
32997 <indexterm role="concept">
32998 <primary>DNS</primary>
32999 <secondary>DNSSEC</secondary>
33000 </indexterm>
33001 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
33002 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33003 (AD bit) set will be ignored and logged as a host-lookup failure.
33004 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33005 </para>
33006 <para>
33007 <indexterm role="option">
33008 <primary><option>domains</option></primary>
33009 </indexterm>
33010 </para>
33011 <informaltable frame="all">
33012 <tgroup cols="4" colsep="0" rowsep="0">
33013 <colspec colwidth="8*" align="left"/>
33014 <colspec colwidth="6*" align="center"/>
33015 <colspec colwidth="6*" align="center"/>
33016 <colspec colwidth="6*" align="right"/>
33017 <tbody>
33018 <row>
33019 <entry><option>domains</option></entry>
33020 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33021 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33022 <entry>Default: <emphasis>unset</emphasis></entry>
33023 </row>
33024 </tbody>
33025 </tgroup>
33026 </informaltable>
33027 <para>
33028 <indexterm role="concept">
33029 <primary>router</primary>
33030 <secondary>restricting to specific domains</secondary>
33031 </indexterm>
33032 <indexterm role="variable">
33033 <primary><varname>$domain_data</varname></primary>
33034 </indexterm>
33035 If this option is set, the router is skipped unless the current domain matches
33036 the list. If the match is achieved by means of a file lookup, the data that the
33037 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
33038 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
33039 a list of the order in which preconditions are evaluated.
33040 </para>
33041 <para>
33042 <indexterm role="option">
33043 <primary><option>driver</option></primary>
33044 </indexterm>
33045 </para>
33046 <informaltable frame="all">
33047 <tgroup cols="4" colsep="0" rowsep="0">
33048 <colspec colwidth="8*" align="left"/>
33049 <colspec colwidth="6*" align="center"/>
33050 <colspec colwidth="6*" align="center"/>
33051 <colspec colwidth="6*" align="right"/>
33052 <tbody>
33053 <row>
33054 <entry><option>driver</option></entry>
33055 <entry>Use: <emphasis>routers</emphasis></entry>
33056 <entry>Type: <emphasis>string</emphasis></entry>
33057 <entry>Default: <emphasis>unset</emphasis></entry>
33058 </row>
33059 </tbody>
33060 </tgroup>
33061 </informaltable>
33062 <para>
33063 This option must always be set. It specifies which of the available routers is
33064 to be used.
33065 </para>
33066 <para>
33067 <indexterm role="option">
33068 <primary><option>dsn_lasthop</option></primary>
33069 </indexterm>
33070 </para>
33071 <informaltable frame="all">
33072 <tgroup cols="4" colsep="0" rowsep="0">
33073 <colspec colwidth="8*" align="left"/>
33074 <colspec colwidth="6*" align="center"/>
33075 <colspec colwidth="6*" align="center"/>
33076 <colspec colwidth="6*" align="right"/>
33077 <tbody>
33078 <row>
33079 <entry><option>dsn_lasthop</option></entry>
33080 <entry>Use: <emphasis>routers</emphasis></entry>
33081 <entry>Type: <emphasis>boolean</emphasis></entry>
33082 <entry>Default: <emphasis>false</emphasis></entry>
33083 </row>
33084 </tbody>
33085 </tgroup>
33086 </informaltable>
33087 <para>
33088 <indexterm role="concept">
33089 <primary>DSN</primary>
33090 <secondary>success</secondary>
33091 </indexterm>
33092 <indexterm role="concept">
33093 <primary>Delivery Status Notification</primary>
33094 <secondary>success</secondary>
33095 </indexterm>
33096 If this option is set true, and extended DSN (RFC3461) processing is in effect,
33097 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
33098 instead send a success DSN as if the next hop does not support DSN.
33099 Not effective on redirect routers.
33100 </para>
33101 <para>
33102 <indexterm role="option">
33103 <primary><option>errors_to</option></primary>
33104 </indexterm>
33105 </para>
33106 <informaltable frame="all">
33107 <tgroup cols="4" colsep="0" rowsep="0">
33108 <colspec colwidth="8*" align="left"/>
33109 <colspec colwidth="6*" align="center"/>
33110 <colspec colwidth="6*" align="center"/>
33111 <colspec colwidth="6*" align="right"/>
33112 <tbody>
33113 <row>
33114 <entry><option>errors_to</option></entry>
33115 <entry>Use: <emphasis>routers</emphasis></entry>
33116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33117 <entry>Default: <emphasis>unset</emphasis></entry>
33118 </row>
33119 </tbody>
33120 </tgroup>
33121 </informaltable>
33122 <para>
33123 <indexterm role="concept">
33124 <primary>envelope sender</primary>
33125 </indexterm>
33126 <indexterm role="concept">
33127 <primary>router</primary>
33128 <secondary>changing address for errors</secondary>
33129 </indexterm>
33130 If a router successfully handles an address, it may assign the address to a
33131 transport for delivery or it may generate child addresses. In both cases, if
33132 there is a delivery problem during later processing, the resulting bounce
33133 message is sent to the address that results from expanding this string,
33134 provided that the address verifies successfully. The <option>errors_to</option> option is
33135 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
33136 </para>
33137 <para>
33138 The <option>errors_to</option> setting associated with an address can be overridden if it
33139 subsequently passes through other routers that have their own <option>errors_to</option>
33140 settings, or if the message is delivered by a transport with a <option>return_path</option>
33141 setting.
33142 </para>
33143 <para>
33144 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
33145 the expansion fails to verify, the errors address associated with the incoming
33146 address is used. At top level, this is the envelope sender. A non-forced
33147 expansion failure causes delivery to be deferred.
33148 </para>
33149 <para>
33150 If an address for which <option>errors_to</option> has been set ends up being delivered over
33151 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
33152 any bounces that are generated by other MTAs on the delivery route are also
33153 sent there. You can set <option>errors_to</option> to the empty string by either of these
33154 settings:
33155 </para>
33156 <literallayout class="monospaced">
33157 errors_to =
33158 errors_to = ""
33159 </literallayout>
33160 <para>
33161 An expansion item that yields an empty string has the same effect. If you do
33162 this, a locally detected delivery error for addresses processed by this router
33163 no longer gives rise to a bounce message; the error is discarded. If the
33164 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
33165 overridden by the <option>return_path</option> option on the transport.
33166 </para>
33167 <para>
33168 <indexterm role="variable">
33169 <primary><varname>$address_data</varname></primary>
33170 </indexterm>
33171 If for some reason you want to discard local errors, but use a non-empty
33172 MAIL command for remote delivery, you can preserve the original return
33173 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
33174 setting <option>return_path</option>.
33175 </para>
33176 <para>
33177 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
33178 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
33179 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
33180 </para>
33181 <para>
33182 <indexterm role="option">
33183 <primary><option>expn</option></primary>
33184 </indexterm>
33185 </para>
33186 <informaltable frame="all">
33187 <tgroup cols="4" colsep="0" rowsep="0">
33188 <colspec colwidth="8*" align="left"/>
33189 <colspec colwidth="6*" align="center"/>
33190 <colspec colwidth="6*" align="center"/>
33191 <colspec colwidth="6*" align="right"/>
33192 <tbody>
33193 <row>
33194 <entry><option>expn</option></entry>
33195 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33196 <entry>Type: <emphasis>boolean</emphasis></entry>
33197 <entry>Default: <emphasis>true</emphasis></entry>
33198 </row>
33199 </tbody>
33200 </tgroup>
33201 </informaltable>
33202 <para>
33203 <indexterm role="concept">
33204 <primary>address</primary>
33205 <secondary>testing</secondary>
33206 </indexterm>
33207 <indexterm role="concept">
33208 <primary>testing</primary>
33209 <secondary>addresses</secondary>
33210 </indexterm>
33211 <indexterm role="concept">
33212 <primary>EXPN</primary>
33213 <secondary>router skipping</secondary>
33214 </indexterm>
33215 <indexterm role="concept">
33216 <primary>router</primary>
33217 <secondary>skipping for EXPN</secondary>
33218 </indexterm>
33219 If this option is turned off, the router is skipped when testing an address
33220 as a result of processing an SMTP EXPN command. You might, for example,
33221 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
33222 on for the system alias file.
33223 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33224 are evaluated.
33225 </para>
33226 <para>
33227 The use of the SMTP EXPN command is controlled by an ACL (see chapter
33228 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
33229 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
33230 </para>
33231 <para>
33232 <indexterm role="option">
33233 <primary><option>fail_verify</option></primary>
33234 </indexterm>
33235 </para>
33236 <informaltable frame="all">
33237 <tgroup cols="4" colsep="0" rowsep="0">
33238 <colspec colwidth="8*" align="left"/>
33239 <colspec colwidth="6*" align="center"/>
33240 <colspec colwidth="6*" align="center"/>
33241 <colspec colwidth="6*" align="right"/>
33242 <tbody>
33243 <row>
33244 <entry><option>fail_verify</option></entry>
33245 <entry>Use: <emphasis>routers</emphasis></entry>
33246 <entry>Type: <emphasis>boolean</emphasis></entry>
33247 <entry>Default: <emphasis>false</emphasis></entry>
33248 </row>
33249 </tbody>
33250 </tgroup>
33251 </informaltable>
33252 <para>
33253 <indexterm role="concept">
33254 <primary>router</primary>
33255 <secondary>forcing verification failure</secondary>
33256 </indexterm>
33257 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
33258 <option>fail_verify_recipient</option> to the same value.
33259 </para>
33260 <para>
33261 <indexterm role="option">
33262 <primary><option>fail_verify_recipient</option></primary>
33263 </indexterm>
33264 </para>
33265 <informaltable frame="all">
33266 <tgroup cols="4" colsep="0" rowsep="0">
33267 <colspec colwidth="8*" align="left"/>
33268 <colspec colwidth="6*" align="center"/>
33269 <colspec colwidth="6*" align="center"/>
33270 <colspec colwidth="6*" align="right"/>
33271 <tbody>
33272 <row>
33273 <entry><option>fail_verify_recipient</option></entry>
33274 <entry>Use: <emphasis>routers</emphasis></entry>
33275 <entry>Type: <emphasis>boolean</emphasis></entry>
33276 <entry>Default: <emphasis>false</emphasis></entry>
33277 </row>
33278 </tbody>
33279 </tgroup>
33280 </informaltable>
33281 <para>
33282 If this option is true and an address is accepted by this router when
33283 verifying a recipient, verification fails.
33284 </para>
33285 <para>
33286 <indexterm role="option">
33287 <primary><option>fail_verify_sender</option></primary>
33288 </indexterm>
33289 </para>
33290 <informaltable frame="all">
33291 <tgroup cols="4" colsep="0" rowsep="0">
33292 <colspec colwidth="8*" align="left"/>
33293 <colspec colwidth="6*" align="center"/>
33294 <colspec colwidth="6*" align="center"/>
33295 <colspec colwidth="6*" align="right"/>
33296 <tbody>
33297 <row>
33298 <entry><option>fail_verify_sender</option></entry>
33299 <entry>Use: <emphasis>routers</emphasis></entry>
33300 <entry>Type: <emphasis>boolean</emphasis></entry>
33301 <entry>Default: <emphasis>false</emphasis></entry>
33302 </row>
33303 </tbody>
33304 </tgroup>
33305 </informaltable>
33306 <para>
33307 If this option is true and an address is accepted by this router when
33308 verifying a sender, verification fails.
33309 </para>
33310 <para>
33311 <indexterm role="option">
33312 <primary><option>fallback_hosts</option></primary>
33313 </indexterm>
33314 </para>
33315 <informaltable frame="all">
33316 <tgroup cols="4" colsep="0" rowsep="0">
33317 <colspec colwidth="8*" align="left"/>
33318 <colspec colwidth="6*" align="center"/>
33319 <colspec colwidth="6*" align="center"/>
33320 <colspec colwidth="6*" align="right"/>
33321 <tbody>
33322 <row>
33323 <entry><option>fallback_hosts</option></entry>
33324 <entry>Use: <emphasis>routers</emphasis></entry>
33325 <entry>Type: <emphasis>string list</emphasis></entry>
33326 <entry>Default: <emphasis>unset</emphasis></entry>
33327 </row>
33328 </tbody>
33329 </tgroup>
33330 </informaltable>
33331 <para>
33332 <indexterm role="concept">
33333 <primary>router</primary>
33334 <secondary>fallback hosts</secondary>
33335 </indexterm>
33336 <indexterm role="concept">
33337 <primary>fallback</primary>
33338 <secondary>hosts specified on router</secondary>
33339 </indexterm>
33340 String expansion is not applied to this option. The argument must be a
33341 colon-separated list of host names or IP addresses. The list separator can be
33342 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
33343 each name or address. In fact, the format of each item is exactly the same as
33344 defined for the list of hosts in a <command>manualroute</command> router (see section
33345 <xref linkend="SECTformatonehostitem"/>).
33346 </para>
33347 <para>
33348 If a router queues an address for a remote transport, this host list is
33349 associated with the address, and used instead of the transport&#x2019;s fallback host
33350 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
33351 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
33352 transport for further details.
33353 </para>
33354 <para>
33355 <indexterm role="option">
33356 <primary><option>group</option></primary>
33357 </indexterm>
33358 </para>
33359 <informaltable frame="all">
33360 <tgroup cols="4" colsep="0" rowsep="0">
33361 <colspec colwidth="8*" align="left"/>
33362 <colspec colwidth="6*" align="center"/>
33363 <colspec colwidth="6*" align="center"/>
33364 <colspec colwidth="6*" align="right"/>
33365 <tbody>
33366 <row>
33367 <entry><option>group</option></entry>
33368 <entry>Use: <emphasis>routers</emphasis></entry>
33369 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33370 <entry>Default: <emphasis>see below</emphasis></entry>
33371 </row>
33372 </tbody>
33373 </tgroup>
33374 </informaltable>
33375 <para>
33376 <indexterm role="concept">
33377 <primary>gid (group id)</primary>
33378 <secondary>local delivery</secondary>
33379 </indexterm>
33380 <indexterm role="concept">
33381 <primary>local transports</primary>
33382 <secondary>uid and gid</secondary>
33383 </indexterm>
33384 <indexterm role="concept">
33385 <primary>transport</primary>
33386 <secondary>local</secondary>
33387 </indexterm>
33388 <indexterm role="concept">
33389 <primary>router</primary>
33390 <secondary>setting group</secondary>
33391 </indexterm>
33392 When a router queues an address for a transport, and the transport does not
33393 specify a group, the group given here is used when running the delivery
33394 process.
33395 The group may be specified numerically or by name. If expansion fails, the
33396 error is logged and delivery is deferred.
33397 The default is unset, unless <option>check_local_user</option> is set, when the default
33398 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
33399 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33400 </para>
33401 <para>
33402 <indexterm role="option">
33403 <primary><option>headers_add</option></primary>
33404 </indexterm>
33405 </para>
33406 <informaltable frame="all">
33407 <tgroup cols="4" colsep="0" rowsep="0">
33408 <colspec colwidth="8*" align="left"/>
33409 <colspec colwidth="6*" align="center"/>
33410 <colspec colwidth="6*" align="center"/>
33411 <colspec colwidth="6*" align="right"/>
33412 <tbody>
33413 <row>
33414 <entry><option>headers_add</option></entry>
33415 <entry>Use: <emphasis>routers</emphasis></entry>
33416 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33417 <entry>Default: <emphasis>unset</emphasis></entry>
33418 </row>
33419 </tbody>
33420 </tgroup>
33421 </informaltable>
33422 <para>
33423 <indexterm role="concept">
33424 <primary>header lines</primary>
33425 <secondary>adding</secondary>
33426 </indexterm>
33427 <indexterm role="concept">
33428 <primary>router</primary>
33429 <secondary>adding header lines</secondary>
33430 </indexterm>
33431 This option specifies a list of text headers,
33432 newline-separated (by default, changeable in the usual way),
33433 that is associated with any addresses that are accepted by the router.
33434 Each item is separately expanded, at routing time.  However, this
33435 option has no effect when an address is just being verified. The way in which
33436 the text is used to add header lines at transport time is described in section
33437 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
33438 message is in the process of being transported. This means that references to
33439 header lines in string expansions in the transport&#x2019;s configuration do not
33440 <quote>see</quote> the added header lines.
33441 </para>
33442 <para>
33443 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
33444 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
33445 an item expansion is forced to fail, the item has no effect. Other expansion
33446 failures are treated as configuration errors.
33447 </para>
33448 <para>
33449 Unlike most options, <option>headers_add</option> can be specified multiple times
33450 for a router; all listed headers are added.
33451 </para>
33452 <para>
33453 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
33454 router that has the <option>one_time</option> option set.
33455 </para>
33456 <para>
33457 <indexterm role="concept">
33458 <primary>duplicate addresses</primary>
33459 </indexterm>
33460 <indexterm role="option">
33461 <primary><option>unseen</option></primary>
33462 </indexterm>
33463 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33464 additions are deleted when the address is passed on to subsequent routers.
33465 For a <option>redirect</option> router, if a generated address is the same as the incoming
33466 address, this can lead to duplicate addresses with different header
33467 modifications. Exim does not do duplicate deliveries (except, in certain
33468 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
33469 which of the duplicates is discarded, so this ambiguous situation should be
33470 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
33471 </para>
33472 <para>
33473 <indexterm role="option">
33474 <primary><option>headers_remove</option></primary>
33475 </indexterm>
33476 </para>
33477 <informaltable frame="all">
33478 <tgroup cols="4" colsep="0" rowsep="0">
33479 <colspec colwidth="8*" align="left"/>
33480 <colspec colwidth="6*" align="center"/>
33481 <colspec colwidth="6*" align="center"/>
33482 <colspec colwidth="6*" align="right"/>
33483 <tbody>
33484 <row>
33485 <entry><option>headers_remove</option></entry>
33486 <entry>Use: <emphasis>routers</emphasis></entry>
33487 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33488 <entry>Default: <emphasis>unset</emphasis></entry>
33489 </row>
33490 </tbody>
33491 </tgroup>
33492 </informaltable>
33493 <para>
33494 <indexterm role="concept">
33495 <primary>header lines</primary>
33496 <secondary>removing</secondary>
33497 </indexterm>
33498 <indexterm role="concept">
33499 <primary>router</primary>
33500 <secondary>removing header lines</secondary>
33501 </indexterm>
33502 This option specifies a list of text headers,
33503 colon-separated (by default, changeable in the usual way),
33504 that is associated with any addresses that are accepted by the router.
33505 Each item is separately expanded, at routing time.  However, this
33506 option has no effect when an address is just being verified. The way in which
33507 the text is used to remove header lines at transport time is described in
33508 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
33509 the message is in the process of being transported. This means that references
33510 to header lines in string expansions in the transport&#x2019;s configuration still
33511 <quote>see</quote> the original header lines.
33512 </para>
33513 <para>
33514 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
33515 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
33516 the item has no effect. Other expansion failures are treated as configuration
33517 errors.
33518 </para>
33519 <para>
33520 Unlike most options, <option>headers_remove</option> can be specified multiple times
33521 for a router; all listed headers are removed.
33522 </para>
33523 <para>
33524 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
33525 router that has the <option>one_time</option> option set.
33526 </para>
33527 <para>
33528 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33529 removal requests are deleted when the address is passed on to subsequent
33530 routers, and this can lead to problems with duplicates -- see the similar
33531 warning for <option>headers_add</option> above.
33532 </para>
33533 <para>
33534 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
33535 items that contain a list separator must have it doubled.
33536 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
33537 </para>
33538 <para>
33539 <indexterm role="option">
33540 <primary><option>ignore_target_hosts</option></primary>
33541 </indexterm>
33542 </para>
33543 <informaltable frame="all">
33544 <tgroup cols="4" colsep="0" rowsep="0">
33545 <colspec colwidth="8*" align="left"/>
33546 <colspec colwidth="6*" align="center"/>
33547 <colspec colwidth="6*" align="center"/>
33548 <colspec colwidth="6*" align="right"/>
33549 <tbody>
33550 <row>
33551 <entry><option>ignore_target_hosts</option></entry>
33552 <entry>Use: <emphasis>routers</emphasis></entry>
33553 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33554 <entry>Default: <emphasis>unset</emphasis></entry>
33555 </row>
33556 </tbody>
33557 </tgroup>
33558 </informaltable>
33559 <para>
33560 <indexterm role="concept">
33561 <primary>IP address</primary>
33562 <secondary>discarding</secondary>
33563 </indexterm>
33564 <indexterm role="concept">
33565 <primary>router</primary>
33566 <secondary>discarding IP addresses</secondary>
33567 </indexterm>
33568 Although this option is a host list, it should normally contain IP address
33569 entries rather than names. If any host that is looked up by the router has an
33570 IP address that matches an item in this list, Exim behaves as if that IP
33571 address did not exist. This option allows you to cope with rogue DNS entries
33572 like
33573 </para>
33574 <literallayout class="monospaced">
33575 remote.domain.example.  A  127.0.0.1
33576 </literallayout>
33577 <para>
33578 by setting
33579 </para>
33580 <literallayout class="monospaced">
33581 ignore_target_hosts = 127.0.0.1
33582 </literallayout>
33583 <para>
33584 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
33585 discarded in this way, the router declines. In a conventional configuration, an
33586 attempt to mail to such a domain would normally provoke the <quote>unrouteable
33587 domain</quote> error, and an attempt to verify an address in the domain would fail.
33588 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
33589 router declines if presented with one of the listed addresses.
33590 </para>
33591 <para>
33592 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
33593 means of the first or the second of the following settings, respectively:
33594 </para>
33595 <literallayout class="monospaced">
33596 ignore_target_hosts = 0.0.0.0/0
33597 ignore_target_hosts = &lt;; 0::0/0
33598 </literallayout>
33599 <para>
33600 The pattern in the first line matches all IPv4 addresses, whereas the pattern
33601 in the second line matches all IPv6 addresses.
33602 </para>
33603 <para>
33604 This option may also be useful for ignoring link-local and site-local IPv6
33605 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
33606 is expanded before use as a list, it is possible to make it dependent on the
33607 domain that is being routed.
33608 </para>
33609 <para>
33610 <indexterm role="variable">
33611 <primary><varname>$host_address</varname></primary>
33612 </indexterm>
33613 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
33614 checked.
33615 </para>
33616 <para>
33617 <indexterm role="option">
33618 <primary><option>initgroups</option></primary>
33619 </indexterm>
33620 </para>
33621 <informaltable frame="all">
33622 <tgroup cols="4" colsep="0" rowsep="0">
33623 <colspec colwidth="8*" align="left"/>
33624 <colspec colwidth="6*" align="center"/>
33625 <colspec colwidth="6*" align="center"/>
33626 <colspec colwidth="6*" align="right"/>
33627 <tbody>
33628 <row>
33629 <entry><option>initgroups</option></entry>
33630 <entry>Use: <emphasis>routers</emphasis></entry>
33631 <entry>Type: <emphasis>boolean</emphasis></entry>
33632 <entry>Default: <emphasis>false</emphasis></entry>
33633 </row>
33634 </tbody>
33635 </tgroup>
33636 </informaltable>
33637 <para>
33638 <indexterm role="concept">
33639 <primary>additional groups</primary>
33640 </indexterm>
33641 <indexterm role="concept">
33642 <primary>groups</primary>
33643 <secondary>additional</secondary>
33644 </indexterm>
33645 <indexterm role="concept">
33646 <primary>local transports</primary>
33647 <secondary>uid and gid</secondary>
33648 </indexterm>
33649 <indexterm role="concept">
33650 <primary>transport</primary>
33651 <secondary>local</secondary>
33652 </indexterm>
33653 If the router queues an address for a transport, and this option is true, and
33654 the uid supplied by the router is not overridden by the transport, the
33655 <function>initgroups()</function> function is called when running the transport to ensure that
33656 any additional groups associated with the uid are set up. See also <option>group</option>
33657 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33658 </para>
33659 <para>
33660 <indexterm role="option">
33661 <primary><option>local_part_prefix</option></primary>
33662 </indexterm>
33663 </para>
33664 <informaltable frame="all">
33665 <tgroup cols="4" colsep="0" rowsep="0">
33666 <colspec colwidth="8*" align="left"/>
33667 <colspec colwidth="6*" align="center"/>
33668 <colspec colwidth="6*" align="center"/>
33669 <colspec colwidth="6*" align="right"/>
33670 <tbody>
33671 <row>
33672 <entry><option>local_part_prefix</option></entry>
33673 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33674 <entry>Type: <emphasis>string list</emphasis></entry>
33675 <entry>Default: <emphasis>unset</emphasis></entry>
33676 </row>
33677 </tbody>
33678 </tgroup>
33679 </informaltable>
33680 <para>
33681 <indexterm role="concept">
33682 <primary>router</primary>
33683 <secondary>prefix for local part</secondary>
33684 </indexterm>
33685 <indexterm role="concept">
33686 <primary>prefix</primary>
33687 <secondary>for local part, used in router</secondary>
33688 </indexterm>
33689 If this option is set, the router is skipped unless the local part starts with
33690 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
33691 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
33692 evaluated.
33693 </para>
33694 <para>
33695 The list is scanned from left to right, and the first prefix that matches is
33696 used. A limited form of wildcard is available; if the prefix begins with an
33697 asterisk, it matches the longest possible sequence of arbitrary characters at
33698 the start of the local part. An asterisk should therefore always be followed by
33699 some character that does not occur in normal local parts.
33700 <indexterm role="concept">
33701 <primary>multiple mailboxes</primary>
33702 </indexterm>
33703 <indexterm role="concept">
33704 <primary>mailbox</primary>
33705 <secondary>multiple</secondary>
33706 </indexterm>
33707 Wildcarding can be used to set up multiple user mailboxes, as described in
33708 section <xref linkend="SECTmulbox"/>.
33709 </para>
33710 <para>
33711 <indexterm role="variable">
33712 <primary><varname>$local_part</varname></primary>
33713 </indexterm>
33714 <indexterm role="variable">
33715 <primary><varname>$local_part_prefix</varname></primary>
33716 </indexterm>
33717 During the testing of the <option>local_parts</option> option, and while the router is
33718 running, the prefix is removed from the local part, and is available in the
33719 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
33720 the router accepts the address, this remains true during subsequent delivery by
33721 a transport. In particular, the local part that is transmitted in the RCPT
33722 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
33723 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
33724 the relevant transport.
33725 </para>
33726 <para>
33727 When an address is being verified, <option>local_part_prefix</option> affects only the
33728 behaviour of the router. If the callout feature of verification is in use, this
33729 means that the full address, including the prefix, will be used during the
33730 callout.
33731 </para>
33732 <para>
33733 The prefix facility is commonly used to handle local parts of the form
33734 <option>owner-something</option>. Another common use is to support local parts of the form
33735 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
33736 to tell a user their forwarding is broken &ndash; by placing a router like this one
33737 immediately before the router that handles <filename>.forward</filename> files:
33738 </para>
33739 <literallayout class="monospaced">
33740 real_localuser:
33741   driver = accept
33742   local_part_prefix = real-
33743   check_local_user
33744   transport = local_delivery
33745 </literallayout>
33746 <para>
33747 For security, it would probably be a good idea to restrict the use of this
33748 router to locally-generated messages, using a condition such as this:
33749 </para>
33750 <literallayout class="monospaced">
33751   condition = ${if match {$sender_host_address}\
33752                          {\N^(|127\.0\.0\.1)$\N}}
33753 </literallayout>
33754 <para>
33755 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
33756 both conditions must be met if not optional. Care must be taken if wildcards
33757 are used in both a prefix and a suffix on the same router. Different
33758 separator characters must be used to avoid ambiguity.
33759 </para>
33760 <para>
33761 <indexterm role="option">
33762 <primary><option>local_part_prefix_optional</option></primary>
33763 </indexterm>
33764 </para>
33765 <informaltable frame="all">
33766 <tgroup cols="4" colsep="0" rowsep="0">
33767 <colspec colwidth="8*" align="left"/>
33768 <colspec colwidth="6*" align="center"/>
33769 <colspec colwidth="6*" align="center"/>
33770 <colspec colwidth="6*" align="right"/>
33771 <tbody>
33772 <row>
33773 <entry><option>local_part_prefix_optional</option></entry>
33774 <entry>Use: <emphasis>routers</emphasis></entry>
33775 <entry>Type: <emphasis>boolean</emphasis></entry>
33776 <entry>Default: <emphasis>false</emphasis></entry>
33777 </row>
33778 </tbody>
33779 </tgroup>
33780 </informaltable>
33781 <para>
33782 See <option>local_part_prefix</option> above.
33783 </para>
33784 <para>
33785 <indexterm role="option">
33786 <primary><option>local_part_suffix</option></primary>
33787 </indexterm>
33788 </para>
33789 <informaltable frame="all">
33790 <tgroup cols="4" colsep="0" rowsep="0">
33791 <colspec colwidth="8*" align="left"/>
33792 <colspec colwidth="6*" align="center"/>
33793 <colspec colwidth="6*" align="center"/>
33794 <colspec colwidth="6*" align="right"/>
33795 <tbody>
33796 <row>
33797 <entry><option>local_part_suffix</option></entry>
33798 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33799 <entry>Type: <emphasis>string list</emphasis></entry>
33800 <entry>Default: <emphasis>unset</emphasis></entry>
33801 </row>
33802 </tbody>
33803 </tgroup>
33804 </informaltable>
33805 <para>
33806 <indexterm role="concept">
33807 <primary>router</primary>
33808 <secondary>suffix for local part</secondary>
33809 </indexterm>
33810 <indexterm role="concept">
33811 <primary>suffix for local part</primary>
33812 <secondary>used in router</secondary>
33813 </indexterm>
33814 This option operates in the same way as <option>local_part_prefix</option>, except that the
33815 local part must end (rather than start) with the given string, the
33816 <option>local_part_suffix_optional</option> option determines whether the suffix is
33817 mandatory, and the wildcard * character, if present, must be the last
33818 character of the suffix. This option facility is commonly used to handle local
33819 parts of the form <option>something-request</option> and multiple user mailboxes of the form
33820 <option>username-foo</option>.
33821 </para>
33822 <para>
33823 <indexterm role="option">
33824 <primary><option>local_part_suffix_optional</option></primary>
33825 </indexterm>
33826 </para>
33827 <informaltable frame="all">
33828 <tgroup cols="4" colsep="0" rowsep="0">
33829 <colspec colwidth="8*" align="left"/>
33830 <colspec colwidth="6*" align="center"/>
33831 <colspec colwidth="6*" align="center"/>
33832 <colspec colwidth="6*" align="right"/>
33833 <tbody>
33834 <row>
33835 <entry><option>local_part_suffix_optional</option></entry>
33836 <entry>Use: <emphasis>routers</emphasis></entry>
33837 <entry>Type: <emphasis>boolean</emphasis></entry>
33838 <entry>Default: <emphasis>false</emphasis></entry>
33839 </row>
33840 </tbody>
33841 </tgroup>
33842 </informaltable>
33843 <para>
33844 See <option>local_part_suffix</option> above.
33845 </para>
33846 <para>
33847 <indexterm role="option">
33848 <primary><option>local_parts</option></primary>
33849 </indexterm>
33850 </para>
33851 <informaltable frame="all">
33852 <tgroup cols="4" colsep="0" rowsep="0">
33853 <colspec colwidth="8*" align="left"/>
33854 <colspec colwidth="6*" align="center"/>
33855 <colspec colwidth="6*" align="center"/>
33856 <colspec colwidth="6*" align="right"/>
33857 <tbody>
33858 <row>
33859 <entry><option>local_parts</option></entry>
33860 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33861 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
33862 <entry>Default: <emphasis>unset</emphasis></entry>
33863 </row>
33864 </tbody>
33865 </tgroup>
33866 </informaltable>
33867 <para>
33868 <indexterm role="concept">
33869 <primary>router</primary>
33870 <secondary>restricting to specific local parts</secondary>
33871 </indexterm>
33872 <indexterm role="concept">
33873 <primary>local part</primary>
33874 <secondary>checking in router</secondary>
33875 </indexterm>
33876 The router is run only if the local part of the address matches the list.
33877 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33878 are evaluated, and
33879 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
33880 string is expanded, it is possible to make it depend on the domain, for
33881 example:
33882 </para>
33883 <literallayout class="monospaced">
33884 local_parts = dbm;/usr/local/specials/$domain
33885 </literallayout>
33886 <para>
33887 <indexterm role="variable">
33888 <primary><varname>$local_part_data</varname></primary>
33889 </indexterm>
33890 If the match is achieved by a lookup, the data that the lookup returned
33891 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
33892 expansions of the router&#x2019;s private options. You might use this option, for
33893 example, if you have a large number of local virtual domains, and you want to
33894 send all postmaster mail to the same place without having to set up an alias in
33895 each virtual domain:
33896 </para>
33897 <literallayout class="monospaced">
33898 postmaster:
33899   driver = redirect
33900   local_parts = postmaster
33901   data = postmaster@real.domain.example
33902 </literallayout>
33903 <para>
33904 <indexterm role="option">
33905 <primary><option>log_as_local</option></primary>
33906 </indexterm>
33907 </para>
33908 <informaltable frame="all">
33909 <tgroup cols="4" colsep="0" rowsep="0">
33910 <colspec colwidth="8*" align="left"/>
33911 <colspec colwidth="6*" align="center"/>
33912 <colspec colwidth="6*" align="center"/>
33913 <colspec colwidth="6*" align="right"/>
33914 <tbody>
33915 <row>
33916 <entry><option>log_as_local</option></entry>
33917 <entry>Use: <emphasis>routers</emphasis></entry>
33918 <entry>Type: <emphasis>boolean</emphasis></entry>
33919 <entry>Default: <emphasis>see below</emphasis></entry>
33920 </row>
33921 </tbody>
33922 </tgroup>
33923 </informaltable>
33924 <para>
33925 <indexterm role="concept">
33926 <primary>log</primary>
33927 <secondary>delivery line</secondary>
33928 </indexterm>
33929 <indexterm role="concept">
33930 <primary>delivery</primary>
33931 <secondary>log line format</secondary>
33932 </indexterm>
33933 Exim has two logging styles for delivery, the idea being to make local
33934 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
33935 recipient address is given just as the local part, without a domain. The use of
33936 this style is controlled by this option. It defaults to true for the <command>accept</command>
33937 router, and false for all the others. This option applies only when a
33938 router assigns an address to a transport. It has no effect on routers that
33939 redirect addresses.
33940 </para>
33941 <para>
33942 <indexterm role="option">
33943 <primary><option>more</option></primary>
33944 </indexterm>
33945 </para>
33946 <informaltable frame="all">
33947 <tgroup cols="4" colsep="0" rowsep="0">
33948 <colspec colwidth="8*" align="left"/>
33949 <colspec colwidth="6*" align="center"/>
33950 <colspec colwidth="6*" align="center"/>
33951 <colspec colwidth="6*" align="right"/>
33952 <tbody>
33953 <row>
33954 <entry><option>more</option></entry>
33955 <entry>Use: <emphasis>routers</emphasis></entry>
33956 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33957 <entry>Default: <emphasis>true</emphasis></entry>
33958 </row>
33959 </tbody>
33960 </tgroup>
33961 </informaltable>
33962 <para>
33963 The result of string expansion for this option must be a valid boolean value,
33964 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33965 result causes an error, and delivery is deferred. If the expansion is forced to
33966 fail, the default value for the option (true) is used. Other failures cause
33967 delivery to be deferred.
33968 </para>
33969 <para>
33970 If this option is set false, and the router declines to handle the address, no
33971 further routers are tried, routing fails, and the address is bounced.
33972 <indexterm role="option">
33973 <primary><option>self</option></primary>
33974 </indexterm>
33975 However, if the router explicitly passes an address to the following router by
33976 means of the setting
33977 </para>
33978 <literallayout class="monospaced">
33979 self = pass
33980 </literallayout>
33981 <para>
33982 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
33983 does not affect the behaviour if one of the precondition tests fails. In that
33984 case, the address is always passed to the next router.
33985 </para>
33986 <para>
33987 Note that <option>address_data</option> is not considered to be a precondition. If its
33988 expansion is forced to fail, the router declines, and the value of <option>more</option>
33989 controls what happens next.
33990 </para>
33991 <para>
33992 <indexterm role="option">
33993 <primary><option>pass_on_timeout</option></primary>
33994 </indexterm>
33995 </para>
33996 <informaltable frame="all">
33997 <tgroup cols="4" colsep="0" rowsep="0">
33998 <colspec colwidth="8*" align="left"/>
33999 <colspec colwidth="6*" align="center"/>
34000 <colspec colwidth="6*" align="center"/>
34001 <colspec colwidth="6*" align="right"/>
34002 <tbody>
34003 <row>
34004 <entry><option>pass_on_timeout</option></entry>
34005 <entry>Use: <emphasis>routers</emphasis></entry>
34006 <entry>Type: <emphasis>boolean</emphasis></entry>
34007 <entry>Default: <emphasis>false</emphasis></entry>
34008 </row>
34009 </tbody>
34010 </tgroup>
34011 </informaltable>
34012 <para>
34013 <indexterm role="concept">
34014 <primary>timeout</primary>
34015 <secondary>of router</secondary>
34016 </indexterm>
34017 <indexterm role="concept">
34018 <primary>router</primary>
34019 <secondary>timeout</secondary>
34020 </indexterm>
34021 If a router times out during a host lookup, it normally causes deferral of the
34022 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
34023 router, overriding <option>no_more</option>. This may be helpful for systems that are
34024 intermittently connected to the Internet, or those that want to pass to a smart
34025 host any messages that cannot immediately be delivered.
34026 </para>
34027 <para>
34028 There are occasional other temporary errors that can occur while doing DNS
34029 lookups. They are treated in the same way as a timeout, and this option
34030 applies to all of them.
34031 </para>
34032 <para>
34033 <indexterm role="option">
34034 <primary><option>pass_router</option></primary>
34035 </indexterm>
34036 </para>
34037 <informaltable frame="all">
34038 <tgroup cols="4" colsep="0" rowsep="0">
34039 <colspec colwidth="8*" align="left"/>
34040 <colspec colwidth="6*" align="center"/>
34041 <colspec colwidth="6*" align="center"/>
34042 <colspec colwidth="6*" align="right"/>
34043 <tbody>
34044 <row>
34045 <entry><option>pass_router</option></entry>
34046 <entry>Use: <emphasis>routers</emphasis></entry>
34047 <entry>Type: <emphasis>string</emphasis></entry>
34048 <entry>Default: <emphasis>unset</emphasis></entry>
34049 </row>
34050 </tbody>
34051 </tgroup>
34052 </informaltable>
34053 <para>
34054 <indexterm role="concept">
34055 <primary>router</primary>
34056 <secondary>go to after <quote>pass</quote></secondary>
34057 </indexterm>
34058 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
34059 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
34060 routing to continue, and overriding a false setting of <option>more</option>. When one of
34061 these routers returns <quote>pass</quote>, the address is normally handed on to the next
34062 router in sequence. This can be changed by setting <option>pass_router</option> to the name
34063 of another router. However (unlike <option>redirect_router</option>) the named router must
34064 be below the current router, to avoid loops. Note that this option applies only
34065 to the special case of <quote>pass</quote>. It does not apply when a router returns
34066 <quote>decline</quote> because it cannot handle an address.
34067 </para>
34068 <para>
34069 <indexterm role="option">
34070 <primary><option>redirect_router</option></primary>
34071 </indexterm>
34072 </para>
34073 <informaltable frame="all">
34074 <tgroup cols="4" colsep="0" rowsep="0">
34075 <colspec colwidth="8*" align="left"/>
34076 <colspec colwidth="6*" align="center"/>
34077 <colspec colwidth="6*" align="center"/>
34078 <colspec colwidth="6*" align="right"/>
34079 <tbody>
34080 <row>
34081 <entry><option>redirect_router</option></entry>
34082 <entry>Use: <emphasis>routers</emphasis></entry>
34083 <entry>Type: <emphasis>string</emphasis></entry>
34084 <entry>Default: <emphasis>unset</emphasis></entry>
34085 </row>
34086 </tbody>
34087 </tgroup>
34088 </informaltable>
34089 <para>
34090 <indexterm role="concept">
34091 <primary>router</primary>
34092 <secondary>start at after redirection</secondary>
34093 </indexterm>
34094 Sometimes an administrator knows that it is pointless to reprocess addresses
34095 generated from alias or forward files with the same router again. For
34096 example, if an alias file translates real names into login ids there is no
34097 point searching the alias file a second time, especially if it is a large file.
34098 </para>
34099 <para>
34100 The <option>redirect_router</option> option can be set to the name of any router instance.
34101 It causes the routing of any generated addresses to start at the named router
34102 instead of at the first router. This option has no effect if the router in
34103 which it is set does not generate new addresses.
34104 </para>
34105 <para>
34106 <indexterm role="option">
34107 <primary><option>require_files</option></primary>
34108 </indexterm>
34109 </para>
34110 <informaltable frame="all">
34111 <tgroup cols="4" colsep="0" rowsep="0">
34112 <colspec colwidth="8*" align="left"/>
34113 <colspec colwidth="6*" align="center"/>
34114 <colspec colwidth="6*" align="center"/>
34115 <colspec colwidth="6*" align="right"/>
34116 <tbody>
34117 <row>
34118 <entry><option>require_files</option></entry>
34119 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34120 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34121 <entry>Default: <emphasis>unset</emphasis></entry>
34122 </row>
34123 </tbody>
34124 </tgroup>
34125 </informaltable>
34126 <para>
34127 <indexterm role="concept">
34128 <primary>file</primary>
34129 <secondary>requiring for router</secondary>
34130 </indexterm>
34131 <indexterm role="concept">
34132 <primary>router</primary>
34133 <secondary>requiring file existence</secondary>
34134 </indexterm>
34135 This option provides a general mechanism for predicating the running of a
34136 router on the existence or non-existence of certain files or directories.
34137 Before running a router, as one of its precondition tests, Exim works its way
34138 through the <option>require_files</option> list, expanding each item separately.
34139 </para>
34140 <para>
34141 Because the list is split before expansion, any colons in expansion items must
34142 be doubled, or the facility for using a different list separator must be used.
34143 If any expansion is forced to fail, the item is ignored. Other expansion
34144 failures cause routing of the address to be deferred.
34145 </para>
34146 <para>
34147 If any expanded string is empty, it is ignored. Otherwise, except as described
34148 below, each string must be a fully qualified file path, optionally preceded by
34149 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
34150 existence of the files or directories. The router is skipped if any paths not
34151 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
34152 </para>
34153 <para>
34154 <indexterm role="concept">
34155 <primary>NFS</primary>
34156 </indexterm>
34157 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
34158 the message is deferred. This can happen when NFS-mounted filesystems are
34159 unavailable.
34160 </para>
34161 <para>
34162 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
34163 options, so you cannot use it to check for the existence of a file in which to
34164 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
34165 full list of the order in which preconditions are evaluated.) However, as
34166 these options are all expanded, you can use the <option>exists</option> expansion condition
34167 to make such tests. The <option>require_files</option> option is intended for checking files
34168 that the router may be going to use internally, or which are needed by a
34169 transport (for example <filename>.procmailrc</filename>).
34170 </para>
34171 <para>
34172 During delivery, the <function>stat()</function> function is run as root, but there is a
34173 facility for some checking of the accessibility of a file by another user.
34174 This is not a proper permissions check, but just a <quote>rough</quote> check that
34175 operates as follows:
34176 </para>
34177 <para>
34178 If an item in a <option>require_files</option> list does not contain any forward slash
34179 characters, it is taken to be the user (and optional group, separated by a
34180 comma) to be checked for subsequent files in the list. If no group is specified
34181 but the user is specified symbolically, the gid associated with the uid is
34182 used. For example:
34183 </para>
34184 <literallayout class="monospaced">
34185 require_files = mail:/some/file
34186 require_files = $local_part:$home/.procmailrc
34187 </literallayout>
34188 <para>
34189 If a user or group name in a <option>require_files</option> list does not exist, the
34190 <option>require_files</option> condition fails.
34191 </para>
34192 <para>
34193 Exim performs the check by scanning along the components of the file path, and
34194 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
34195 directories, and <quote>r</quote> access on the final file. Note that this means that file
34196 access control lists, if the operating system has them, are ignored.
34197 </para>
34198 <para>
34199 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
34200 incoming SMTP message, Exim is not running as root, but under its own uid. This
34201 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
34202 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
34203 user is not permitted to read one of the directories on the file&#x2019;s path.
34204 </para>
34205 <para>
34206 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
34207 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
34208 without root access. In this case, if a check for access by a particular user
34209 is requested, Exim creates a subprocess that runs as that user, and tries the
34210 check again in that process.
34211 </para>
34212 <para>
34213 The default action for handling an unresolved EACCES is to consider it to
34214 be caused by a configuration error, and routing is deferred because the
34215 existence or non-existence of the file cannot be determined. However, in some
34216 circumstances it may be desirable to treat this condition as if the file did
34217 not exist. If the file name (or the exclamation mark that precedes the file
34218 name for non-existence) is preceded by a plus sign, the EACCES error is treated
34219 as if the file did not exist. For example:
34220 </para>
34221 <literallayout class="monospaced">
34222 require_files = +/some/file
34223 </literallayout>
34224 <para>
34225 If the router is not an essential part of verification (for example, it
34226 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
34227 option false so that the router is skipped when verifying.
34228 </para>
34229 <para>
34230 <indexterm role="option">
34231 <primary><option>retry_use_local_part</option></primary>
34232 </indexterm>
34233 </para>
34234 <informaltable frame="all">
34235 <tgroup cols="4" colsep="0" rowsep="0">
34236 <colspec colwidth="8*" align="left"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="center"/>
34239 <colspec colwidth="6*" align="right"/>
34240 <tbody>
34241 <row>
34242 <entry><option>retry_use_local_part</option></entry>
34243 <entry>Use: <emphasis>routers</emphasis></entry>
34244 <entry>Type: <emphasis>boolean</emphasis></entry>
34245 <entry>Default: <emphasis>see below</emphasis></entry>
34246 </row>
34247 </tbody>
34248 </tgroup>
34249 </informaltable>
34250 <para>
34251 <indexterm role="concept">
34252 <primary>hints database</primary>
34253 <secondary>retry keys</secondary>
34254 </indexterm>
34255 <indexterm role="concept">
34256 <primary>local part</primary>
34257 <secondary>in retry keys</secondary>
34258 </indexterm>
34259 When a delivery suffers a temporary routing failure, a retry record is created
34260 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
34261 domain, the key for the retry record should not involve the local part, but for
34262 other addresses, both the domain and the local part should be included.
34263 Usually, remote routing is of the former kind, and local routing is of the
34264 latter kind.
34265 </para>
34266 <para>
34267 This option controls whether the local part is used to form the key for retry
34268 hints for addresses that suffer temporary errors while being handled by this
34269 router. The default value is true for any router that has <option>check_local_user</option>
34270 set, and false otherwise. Note that this option does not apply to hints keys
34271 for transport delays; they are controlled by a generic transport option of the
34272 same name.
34273 </para>
34274 <para>
34275 The setting of <option>retry_use_local_part</option> applies only to the router on which it
34276 appears. If the router generates child addresses, they are routed
34277 independently; this setting does not become attached to them.
34278 </para>
34279 <para>
34280 <indexterm role="option">
34281 <primary><option>router_home_directory</option></primary>
34282 </indexterm>
34283 </para>
34284 <informaltable frame="all">
34285 <tgroup cols="4" colsep="0" rowsep="0">
34286 <colspec colwidth="8*" align="left"/>
34287 <colspec colwidth="6*" align="center"/>
34288 <colspec colwidth="6*" align="center"/>
34289 <colspec colwidth="6*" align="right"/>
34290 <tbody>
34291 <row>
34292 <entry><option>router_home_directory</option></entry>
34293 <entry>Use: <emphasis>routers</emphasis></entry>
34294 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34295 <entry>Default: <emphasis>unset</emphasis></entry>
34296 </row>
34297 </tbody>
34298 </tgroup>
34299 </informaltable>
34300 <para>
34301 <indexterm role="concept">
34302 <primary>router</primary>
34303 <secondary>home directory for</secondary>
34304 </indexterm>
34305 <indexterm role="concept">
34306 <primary>home directory</primary>
34307 <secondary>for router</secondary>
34308 </indexterm>
34309 <indexterm role="variable">
34310 <primary><varname>$home</varname></primary>
34311 </indexterm>
34312 This option sets a home directory for use while the router is running. (Compare
34313 <option>transport_home_directory</option>, which sets a home directory for later
34314 transporting.) In particular, if used on a <command>redirect</command> router, this option
34315 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
34316 forced expansion failure causes the option to be ignored &ndash; other failures
34317 cause the router to defer.
34318 </para>
34319 <para>
34320 Expansion of <option>router_home_directory</option> happens immediately after the
34321 <option>check_local_user</option> test (if configured), before any further expansions take
34322 place.
34323 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34324 are evaluated.)
34325 While the router is running, <option>router_home_directory</option> overrides the value of
34326 <varname>$home</varname> that came from <option>check_local_user</option>.
34327 </para>
34328 <para>
34329 When a router accepts an address and assigns it to a local transport (including
34330 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
34331 delivery), the home directory setting for the transport is taken from the first
34332 of these values that is set:
34333 </para>
34334 <itemizedlist>
34335 <listitem>
34336 <para>
34337 The <option>home_directory</option> option on the transport;
34338 </para>
34339 </listitem>
34340 <listitem>
34341 <para>
34342 The <option>transport_home_directory</option> option on the router;
34343 </para>
34344 </listitem>
34345 <listitem>
34346 <para>
34347 The password data if <option>check_local_user</option> is set on the router;
34348 </para>
34349 </listitem>
34350 <listitem>
34351 <para>
34352 The <option>router_home_directory</option> option on the router.
34353 </para>
34354 </listitem>
34355 </itemizedlist>
34356 <para>
34357 In other words, <option>router_home_directory</option> overrides the password data for the
34358 router, but not for the transport.
34359 </para>
34360 <para>
34361 <indexterm role="option">
34362 <primary><option>self</option></primary>
34363 </indexterm>
34364 </para>
34365 <informaltable frame="all">
34366 <tgroup cols="4" colsep="0" rowsep="0">
34367 <colspec colwidth="8*" align="left"/>
34368 <colspec colwidth="6*" align="center"/>
34369 <colspec colwidth="6*" align="center"/>
34370 <colspec colwidth="6*" align="right"/>
34371 <tbody>
34372 <row>
34373 <entry><option>self</option></entry>
34374 <entry>Use: <emphasis>routers</emphasis></entry>
34375 <entry>Type: <emphasis>string</emphasis></entry>
34376 <entry>Default: <emphasis>freeze</emphasis></entry>
34377 </row>
34378 </tbody>
34379 </tgroup>
34380 </informaltable>
34381 <para>
34382 <indexterm role="concept">
34383 <primary>MX record</primary>
34384 <secondary>pointing to local host</secondary>
34385 </indexterm>
34386 <indexterm role="concept">
34387 <primary>local host</primary>
34388 <secondary>MX pointing to</secondary>
34389 </indexterm>
34390 This option applies to those routers that use a recipient address to find a
34391 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
34392 and <command>manualroute</command> routers.
34393 Certain configurations of the <command>queryprogram</command> router can also specify a list
34394 of remote hosts.
34395 Usually such routers are configured to send the message to a remote host via an
34396 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
34397 host on the list turns out to be the local host.
34398 The way in which Exim checks for the local host is described in section
34399 <xref linkend="SECTreclocipadd"/>.
34400 </para>
34401 <para>
34402 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
34403 example, the router should be configured not to process this domain), or an
34404 error in the DNS (for example, the MX should not point to this host). For this
34405 reason, the default action is to log the incident, defer the address, and
34406 freeze the message. The following alternatives are provided for use in special
34407 cases:
34408 </para>
34409 <variablelist>
34410 <varlistentry>
34411 <term><option>defer</option></term>
34412 <listitem>
34413 <para>
34414 Delivery of the message is tried again later, but the message is not frozen.
34415 </para>
34416 </listitem></varlistentry>
34417 <varlistentry>
34418 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
34419 <listitem>
34420 <para>
34421 The domain is changed to the given domain, and the address is passed back to
34422 be reprocessed by the routers. No rewriting of headers takes place. This
34423 behaviour is essentially a redirection.
34424 </para>
34425 </listitem></varlistentry>
34426 <varlistentry>
34427 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
34428 <listitem>
34429 <para>
34430 The domain is changed to the given domain, and the address is passed back to be
34431 reprocessed by the routers. Any headers that contain the original domain are
34432 rewritten.
34433 </para>
34434 </listitem></varlistentry>
34435 <varlistentry>
34436 <term><option>pass</option></term>
34437 <listitem>
34438 <para>
34439 <indexterm role="option">
34440 <primary><option>more</option></primary>
34441 </indexterm>
34442 <indexterm role="variable">
34443 <primary><varname>$self_hostname</varname></primary>
34444 </indexterm>
34445 The router passes the address to the next router, or to the router named in the
34446 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
34447 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
34448 name of the local host that the router encountered. This can be used to
34449 distinguish between different cases for hosts with multiple names. The
34450 combination
34451 </para>
34452 <literallayout class="monospaced">
34453 self = pass
34454 no_more
34455 </literallayout>
34456 <para>
34457 ensures that only those addresses that routed to the local host are passed on.
34458 Without <option>no_more</option>, addresses that were declined for other reasons would also
34459 be passed to the next router.
34460 </para>
34461 </listitem></varlistentry>
34462 <varlistentry>
34463 <term><option>fail</option></term>
34464 <listitem>
34465 <para>
34466 Delivery fails and an error report is generated.
34467 </para>
34468 </listitem></varlistentry>
34469 <varlistentry>
34470 <term><option>send</option></term>
34471 <listitem>
34472 <para>
34473 <indexterm role="concept">
34474 <primary>local host</primary>
34475 <secondary>sending to</secondary>
34476 </indexterm>
34477 The anomaly is ignored and the address is queued for the transport. This
34478 setting should be used with extreme caution. For an <command>smtp</command> transport, it
34479 makes sense only in cases where the program that is listening on the SMTP port
34480 is not this version of Exim. That is, it must be some other MTA, or Exim with a
34481 different configuration file that handles the domain in another way.
34482 </para>
34483 </listitem></varlistentry>
34484 </variablelist>
34485 <para>
34486 <indexterm role="option">
34487 <primary><option>senders</option></primary>
34488 </indexterm>
34489 </para>
34490 <informaltable frame="all">
34491 <tgroup cols="4" colsep="0" rowsep="0">
34492 <colspec colwidth="8*" align="left"/>
34493 <colspec colwidth="6*" align="center"/>
34494 <colspec colwidth="6*" align="center"/>
34495 <colspec colwidth="6*" align="right"/>
34496 <tbody>
34497 <row>
34498 <entry><option>senders</option></entry>
34499 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34500 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34501 <entry>Default: <emphasis>unset</emphasis></entry>
34502 </row>
34503 </tbody>
34504 </tgroup>
34505 </informaltable>
34506 <para>
34507 <indexterm role="concept">
34508 <primary>router</primary>
34509 <secondary>checking senders</secondary>
34510 </indexterm>
34511 If this option is set, the router is skipped unless the message&#x2019;s sender
34512 address matches something on the list.
34513 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34514 are evaluated.
34515 </para>
34516 <para>
34517 There are issues concerning verification when the running of routers is
34518 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
34519 setting, it sets the sender to the null string. When using the <option>-bt</option> option
34520 to check a configuration file, it is necessary also to use the <option>-f</option> option to
34521 set an appropriate sender. For incoming mail, the sender is unset when
34522 verifying the sender, but is available when verifying any recipients. If the
34523 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
34524 matters.
34525 </para>
34526 <para>
34527 <indexterm role="option">
34528 <primary><option>translate_ip_address</option></primary>
34529 </indexterm>
34530 </para>
34531 <informaltable frame="all">
34532 <tgroup cols="4" colsep="0" rowsep="0">
34533 <colspec colwidth="8*" align="left"/>
34534 <colspec colwidth="6*" align="center"/>
34535 <colspec colwidth="6*" align="center"/>
34536 <colspec colwidth="6*" align="right"/>
34537 <tbody>
34538 <row>
34539 <entry><option>translate_ip_address</option></entry>
34540 <entry>Use: <emphasis>routers</emphasis></entry>
34541 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34542 <entry>Default: <emphasis>unset</emphasis></entry>
34543 </row>
34544 </tbody>
34545 </tgroup>
34546 </informaltable>
34547 <para>
34548 <indexterm role="concept">
34549 <primary>IP address</primary>
34550 <secondary>translating</secondary>
34551 </indexterm>
34552 <indexterm role="concept">
34553 <primary>packet radio</primary>
34554 </indexterm>
34555 <indexterm role="concept">
34556 <primary>router</primary>
34557 <secondary>IP address translation</secondary>
34558 </indexterm>
34559 There exist some rare networking situations (for example, packet radio) where
34560 it is helpful to be able to translate IP addresses generated by normal routing
34561 mechanisms into other IP addresses, thus performing a kind of manual IP
34562 routing. This should be done only if the normal IP routing of the TCP/IP stack
34563 is inadequate or broken. Because this is an extremely uncommon requirement, the
34564 code to support this option is not included in the Exim binary unless
34565 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
34566 </para>
34567 <para>
34568 <indexterm role="variable">
34569 <primary><varname>$host_address</varname></primary>
34570 </indexterm>
34571 The <option>translate_ip_address</option> string is expanded for every IP address generated
34572 by the router, with the generated address set in <varname>$host_address</varname>. If the
34573 expansion is forced to fail, no action is taken.
34574 For any other expansion error, delivery of the message is deferred.
34575 If the result of the expansion is an IP address, that replaces the original
34576 address; otherwise the result is assumed to be a host name &ndash; this is looked
34577 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
34578 produce one or more replacement IP addresses. For example, to subvert all IP
34579 addresses in some specific networks, this could be added to a router:
34580 </para>
34581 <literallayout class="monospaced">
34582 translate_ip_address = \
34583   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
34584     {$value}fail}}
34585 </literallayout>
34586 <para>
34587 The file would contain lines like
34588 </para>
34589 <literallayout class="monospaced">
34590 10.2.3.128/26    some.host
34591 10.8.4.34/26     10.44.8.15
34592 </literallayout>
34593 <para>
34594 You should not make use of this facility unless you really understand what you
34595 are doing.
34596 </para>
34597 <para>
34598 <indexterm role="option">
34599 <primary><option>transport</option></primary>
34600 </indexterm>
34601 </para>
34602 <informaltable frame="all">
34603 <tgroup cols="4" colsep="0" rowsep="0">
34604 <colspec colwidth="8*" align="left"/>
34605 <colspec colwidth="6*" align="center"/>
34606 <colspec colwidth="6*" align="center"/>
34607 <colspec colwidth="6*" align="right"/>
34608 <tbody>
34609 <row>
34610 <entry><option>transport</option></entry>
34611 <entry>Use: <emphasis>routers</emphasis></entry>
34612 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34613 <entry>Default: <emphasis>unset</emphasis></entry>
34614 </row>
34615 </tbody>
34616 </tgroup>
34617 </informaltable>
34618 <para>
34619 This option specifies the transport to be used when a router accepts an address
34620 and sets it up for delivery. A transport is never needed if a router is used
34621 only for verification. The value of the option is expanded at routing time,
34622 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
34623 and result must be the name of one of the configured transports. If it is not,
34624 delivery is deferred.
34625 </para>
34626 <para>
34627 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
34628 have some private options that set up transports for pipe and file deliveries
34629 (see chapter <xref linkend="CHAPredirect"/>).
34630 </para>
34631 <para>
34632 <indexterm role="option">
34633 <primary><option>transport_current_directory</option></primary>
34634 </indexterm>
34635 </para>
34636 <informaltable frame="all">
34637 <tgroup cols="4" colsep="0" rowsep="0">
34638 <colspec colwidth="8*" align="left"/>
34639 <colspec colwidth="6*" align="center"/>
34640 <colspec colwidth="6*" align="center"/>
34641 <colspec colwidth="6*" align="right"/>
34642 <tbody>
34643 <row>
34644 <entry><option>transport_current_directory</option></entry>
34645 <entry>Use: <emphasis>routers</emphasis></entry>
34646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34647 <entry>Default: <emphasis>unset</emphasis></entry>
34648 </row>
34649 </tbody>
34650 </tgroup>
34651 </informaltable>
34652 <para>
34653 <indexterm role="concept">
34654 <primary>current directory for local transport</primary>
34655 </indexterm>
34656 This option associates a current directory with any address that is routed
34657 to a local transport. This can happen either because a transport is
34658 explicitly configured for the router, or because it generates a delivery to a
34659 file or a pipe. During the delivery process (that is, at transport time), this
34660 option string is expanded and is set as the current directory, unless
34661 overridden by a setting on the transport.
34662 If the expansion fails for any reason, including forced failure, an error is
34663 logged, and delivery is deferred.
34664 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
34665 environment.
34666 </para>
34667 <para>
34668 <indexterm role="option">
34669 <primary><option>transport_home_directory</option></primary>
34670 </indexterm>
34671 </para>
34672 <informaltable frame="all">
34673 <tgroup cols="4" colsep="0" rowsep="0">
34674 <colspec colwidth="8*" align="left"/>
34675 <colspec colwidth="6*" align="center"/>
34676 <colspec colwidth="6*" align="center"/>
34677 <colspec colwidth="6*" align="right"/>
34678 <tbody>
34679 <row>
34680 <entry><option>transport_home_directory</option></entry>
34681 <entry>Use: <emphasis>routers</emphasis></entry>
34682 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34683 <entry>Default: <emphasis>see below</emphasis></entry>
34684 </row>
34685 </tbody>
34686 </tgroup>
34687 </informaltable>
34688 <para>
34689 <indexterm role="concept">
34690 <primary>home directory</primary>
34691 <secondary>for local transport</secondary>
34692 </indexterm>
34693 This option associates a home directory with any address that is routed to a
34694 local transport. This can happen either because a transport is explicitly
34695 configured for the router, or because it generates a delivery to a file or a
34696 pipe. During the delivery process (that is, at transport time), the option
34697 string is expanded and is set as the home directory, unless overridden by a
34698 setting of <option>home_directory</option> on the transport.
34699 If the expansion fails for any reason, including forced failure, an error is
34700 logged, and delivery is deferred.
34701 </para>
34702 <para>
34703 If the transport does not specify a home directory, and
34704 <option>transport_home_directory</option> is not set for the router, the home directory for
34705 the transport is taken from the password data if <option>check_local_user</option> is set for
34706 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
34707 is set; if not, no home directory is set for the transport.
34708 </para>
34709 <para>
34710 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
34711 environment.
34712 </para>
34713 <para>
34714 <indexterm role="option">
34715 <primary><option>unseen</option></primary>
34716 </indexterm>
34717 </para>
34718 <informaltable frame="all">
34719 <tgroup cols="4" colsep="0" rowsep="0">
34720 <colspec colwidth="8*" align="left"/>
34721 <colspec colwidth="6*" align="center"/>
34722 <colspec colwidth="6*" align="center"/>
34723 <colspec colwidth="6*" align="right"/>
34724 <tbody>
34725 <row>
34726 <entry><option>unseen</option></entry>
34727 <entry>Use: <emphasis>routers</emphasis></entry>
34728 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34729 <entry>Default: <emphasis>false</emphasis></entry>
34730 </row>
34731 </tbody>
34732 </tgroup>
34733 </informaltable>
34734 <para>
34735 <indexterm role="concept">
34736 <primary>router</primary>
34737 <secondary>carrying on after success</secondary>
34738 </indexterm>
34739 The result of string expansion for this option must be a valid boolean value,
34740 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34741 result causes an error, and delivery is deferred. If the expansion is forced to
34742 fail, the default value for the option (false) is used. Other failures cause
34743 delivery to be deferred.
34744 </para>
34745 <para>
34746 When this option is set true, routing does not cease if the router accepts the
34747 address. Instead, a copy of the incoming address is passed to the next router,
34748 overriding a false setting of <option>more</option>. There is little point in setting
34749 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
34750 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
34751 sometimes true and sometimes false).
34752 </para>
34753 <para>
34754 <indexterm role="concept">
34755 <primary>copy of message (<option>unseen</option> option)</primary>
34756 </indexterm>
34757 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
34758 qualifier in filter files. It can be used to cause copies of messages to be
34759 delivered to some other destination, while also carrying out a normal delivery.
34760 In effect, the current address is made into a <quote>parent</quote> that has two children
34761 &ndash; one that is delivered as specified by this router, and a clone that goes on
34762 to be routed further. For this reason, <option>unseen</option> may not be combined with the
34763 <option>one_time</option> option in a <command>redirect</command> router.
34764 </para>
34765 <para>
34766 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
34767 this router or by previous routers affect the <quote>unseen</quote> copy of the message
34768 only. The clone that continues to be processed by further routers starts with
34769 no added headers and none specified for removal. For a <option>redirect</option> router, if
34770 a generated address is the same as the incoming address, this can lead to
34771 duplicate addresses with different header modifications. Exim does not do
34772 duplicate deliveries (except, in certain circumstances, to pipes -- see section
34773 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
34774 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
34775 <option>redirect</option> router may be of help.
34776 </para>
34777 <para>
34778 Unlike the handling of header modifications, any data that was set by the
34779 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
34780 subsequent routers.
34781 </para>
34782 <para>
34783 <indexterm role="option">
34784 <primary><option>user</option></primary>
34785 </indexterm>
34786 </para>
34787 <informaltable frame="all">
34788 <tgroup cols="4" colsep="0" rowsep="0">
34789 <colspec colwidth="8*" align="left"/>
34790 <colspec colwidth="6*" align="center"/>
34791 <colspec colwidth="6*" align="center"/>
34792 <colspec colwidth="6*" align="right"/>
34793 <tbody>
34794 <row>
34795 <entry><option>user</option></entry>
34796 <entry>Use: <emphasis>routers</emphasis></entry>
34797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34798 <entry>Default: <emphasis>see below</emphasis></entry>
34799 </row>
34800 </tbody>
34801 </tgroup>
34802 </informaltable>
34803 <para>
34804 <indexterm role="concept">
34805 <primary>uid (user id)</primary>
34806 <secondary>local delivery</secondary>
34807 </indexterm>
34808 <indexterm role="concept">
34809 <primary>local transports</primary>
34810 <secondary>uid and gid</secondary>
34811 </indexterm>
34812 <indexterm role="concept">
34813 <primary>transport</primary>
34814 <secondary>local</secondary>
34815 </indexterm>
34816 <indexterm role="concept">
34817 <primary>router</primary>
34818 <secondary>user for filter processing</secondary>
34819 </indexterm>
34820 <indexterm role="concept">
34821 <primary>filter</primary>
34822 <secondary>user for processing</secondary>
34823 </indexterm>
34824 When a router queues an address for a transport, and the transport does not
34825 specify a user, the user given here is used when running the delivery process.
34826 The user may be specified numerically or by name. If expansion fails, the
34827 error is logged and delivery is deferred.
34828 This user is also used by the <command>redirect</command> router when running a filter file.
34829 The default is unset, except when <option>check_local_user</option> is set. In this case,
34830 the default is taken from the password information. If the user is specified as
34831 a name, and <option>group</option> is not set, the group associated with the user is used.
34832 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
34833 <xref linkend="CHAPenvironment"/>.
34834 </para>
34835 <para>
34836 <indexterm role="option">
34837 <primary><option>verify</option></primary>
34838 </indexterm>
34839 </para>
34840 <informaltable frame="all">
34841 <tgroup cols="4" colsep="0" rowsep="0">
34842 <colspec colwidth="8*" align="left"/>
34843 <colspec colwidth="6*" align="center"/>
34844 <colspec colwidth="6*" align="center"/>
34845 <colspec colwidth="6*" align="right"/>
34846 <tbody>
34847 <row>
34848 <entry><option>verify</option></entry>
34849 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34850 <entry>Type: <emphasis>boolean</emphasis></entry>
34851 <entry>Default: <emphasis>true</emphasis></entry>
34852 </row>
34853 </tbody>
34854 </tgroup>
34855 </informaltable>
34856 <para>
34857 Setting this option has the effect of setting <option>verify_sender</option> and
34858 <option>verify_recipient</option> to the same value.
34859 </para>
34860 <para>
34861 <indexterm role="option">
34862 <primary><option>verify_only</option></primary>
34863 </indexterm>
34864 </para>
34865 <informaltable frame="all">
34866 <tgroup cols="4" colsep="0" rowsep="0">
34867 <colspec colwidth="8*" align="left"/>
34868 <colspec colwidth="6*" align="center"/>
34869 <colspec colwidth="6*" align="center"/>
34870 <colspec colwidth="6*" align="right"/>
34871 <tbody>
34872 <row>
34873 <entry><option>verify_only</option></entry>
34874 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34875 <entry>Type: <emphasis>boolean</emphasis></entry>
34876 <entry>Default: <emphasis>false</emphasis></entry>
34877 </row>
34878 </tbody>
34879 </tgroup>
34880 </informaltable>
34881 <para>
34882 <indexterm role="concept">
34883 <primary>EXPN</primary>
34884 <secondary>with <option>verify_only</option></secondary>
34885 </indexterm>
34886 <indexterm role="option">
34887 <primary><option>-bv</option></primary>
34888 </indexterm>
34889 <indexterm role="concept">
34890 <primary>router</primary>
34891 <secondary>used only when verifying</secondary>
34892 </indexterm>
34893 If this option is set, the router is used only when verifying an address,
34894 delivering in cutthrough mode or
34895 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
34896 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
34897 restricted to verifying only senders or recipients by means of
34898 <option>verify_sender</option> and <option>verify_recipient</option>.
34899 </para>
34900 <para>
34901 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
34902 SMTP message, Exim is not running as root, but under its own uid. If the router
34903 accesses any files, you need to make sure that they are accessible to the Exim
34904 user or group.
34905 </para>
34906 <para>
34907 <indexterm role="option">
34908 <primary><option>verify_recipient</option></primary>
34909 </indexterm>
34910 </para>
34911 <informaltable frame="all">
34912 <tgroup cols="4" colsep="0" rowsep="0">
34913 <colspec colwidth="8*" align="left"/>
34914 <colspec colwidth="6*" align="center"/>
34915 <colspec colwidth="6*" align="center"/>
34916 <colspec colwidth="6*" align="right"/>
34917 <tbody>
34918 <row>
34919 <entry><option>verify_recipient</option></entry>
34920 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34921 <entry>Type: <emphasis>boolean</emphasis></entry>
34922 <entry>Default: <emphasis>true</emphasis></entry>
34923 </row>
34924 </tbody>
34925 </tgroup>
34926 </informaltable>
34927 <para>
34928 If this option is false, the router is skipped when verifying recipient
34929 addresses,
34930 delivering in cutthrough mode
34931 or testing recipient verification using <option>-bv</option>.
34932 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34933 are evaluated.
34934 See also the <varname>$verify_mode</varname> variable.
34935 </para>
34936 <para>
34937 <indexterm role="option">
34938 <primary><option>verify_sender</option></primary>
34939 </indexterm>
34940 </para>
34941 <informaltable frame="all">
34942 <tgroup cols="4" colsep="0" rowsep="0">
34943 <colspec colwidth="8*" align="left"/>
34944 <colspec colwidth="6*" align="center"/>
34945 <colspec colwidth="6*" align="center"/>
34946 <colspec colwidth="6*" align="right"/>
34947 <tbody>
34948 <row>
34949 <entry><option>verify_sender</option></entry>
34950 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34951 <entry>Type: <emphasis>boolean</emphasis></entry>
34952 <entry>Default: <emphasis>true</emphasis></entry>
34953 </row>
34954 </tbody>
34955 </tgroup>
34956 </informaltable>
34957 <para>
34958 If this option is false, the router is skipped when verifying sender addresses
34959 or testing sender verification using <option>-bvs</option>.
34960 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34961 are evaluated.
34962 See also the <varname>$verify_mode</varname> variable.
34963 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
34964 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
34965 </para>
34966 </chapter>
34967
34968 <chapter id="CHID4">
34969 <title>The accept router</title>
34970 <para>
34971 <indexterm role="concept">
34972 <primary><command>accept</command> router</primary>
34973 </indexterm>
34974 <indexterm role="concept">
34975 <primary>routers</primary>
34976 <secondary><command>accept</command></secondary>
34977 </indexterm>
34978 The <command>accept</command> router has no private options of its own. Unless it is being
34979 used purely for verification (see <option>verify_only</option>) a transport is required to
34980 be defined by the generic <option>transport</option> option. If the preconditions that are
34981 specified by generic options are met, the router accepts the address and queues
34982 it for the given transport. The most common use of this router is for setting
34983 up deliveries to local mailboxes. For example:
34984 </para>
34985 <literallayout class="monospaced">
34986 localusers:
34987   driver = accept
34988   domains = mydomain.example
34989   check_local_user
34990   transport = local_delivery
34991 </literallayout>
34992 <para>
34993 The <option>domains</option> condition in this example checks the domain of the address, and
34994 <option>check_local_user</option> checks that the local part is the login of a local user.
34995 When both preconditions are met, the <command>accept</command> router runs, and queues the
34996 address for the <command>local_delivery</command> transport.
34997 </para>
34998 </chapter>
34999
35000 <chapter id="CHAPdnslookup">
35001 <title>The dnslookup router</title>
35002 <para>
35003 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
35004 <primary><command>dnslookup</command> router</primary>
35005 </indexterm>
35006 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
35007 <primary>routers</primary>
35008 <secondary><command>dnslookup</command></secondary>
35009 </indexterm>
35010 The <command>dnslookup</command> router looks up the hosts that handle mail for the
35011 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
35012 unless <option>verify_only</option> is set.
35013 </para>
35014 <para>
35015 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
35016 SRV records. If none are found, or if SRV support is not configured,
35017 MX records are looked up. If no MX records exist, address records are sought.
35018 However, <option>mx_domains</option> can be set to disable the direct use of address
35019 records.
35020 </para>
35021 <para>
35022 MX records of equal priority are sorted by Exim into a random order. Exim then
35023 looks for address records for the host names obtained from MX or SRV records.
35024 When a host has more than one IP address, they are sorted into a random order,
35025 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
35026 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
35027 generic option, the router declines.
35028 </para>
35029 <para>
35030 Unless they have the highest priority (lowest MX value), MX records that point
35031 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
35032 are discarded, together with any other MX records of equal or lower priority.
35033 </para>
35034 <para>
35035 <indexterm role="concept">
35036 <primary>MX record</primary>
35037 <secondary>pointing to local host</secondary>
35038 </indexterm>
35039 <indexterm role="concept">
35040 <primary>local host</primary>
35041 <secondary>MX pointing to</secondary>
35042 </indexterm>
35043 <indexterm role="option">
35044 <primary><option>self</option></primary>
35045 <secondary>in <command>dnslookup</command> router</secondary>
35046 </indexterm>
35047 If the host pointed to by the highest priority MX record, or looked up as an
35048 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
35049 happens is controlled by the generic <option>self</option> option.
35050 </para>
35051 <section id="SECTprowitdnsloo">
35052 <title>Problems with DNS lookups</title>
35053 <para>
35054 There have been problems with DNS servers when SRV records are looked up.
35055 Some misbehaving servers return a DNS error or timeout when a non-existent
35056 SRV record is sought. Similar problems have in the past been reported for
35057 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
35058 problem, but it is heavy-handed because it is a global option.
35059 </para>
35060 <para>
35061 For this reason, there are two options, <option>srv_fail_domains</option> and
35062 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
35063 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
35064 an attempt to look up an SRV or MX record causes one of these results, and the
35065 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
35066 such record</quote>. In the case of an SRV lookup, this means that the router
35067 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
35068 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
35069 case routing fails.
35070 </para>
35071 </section>
35072 <section id="SECTdnslookupdecline">
35073 <title>Declining addresses by dnslookup</title>
35074 <para>
35075 <indexterm role="concept">
35076 <primary><command>dnslookup</command> router</primary>
35077 <secondary>declines</secondary>
35078 </indexterm>
35079 There are a few cases where a <command>dnslookup</command> router will decline to accept
35080 an address; if such a router is expected to handle "all remaining non-local
35081 domains", then it is important to set <option>no_more</option>.
35082 </para>
35083 <para>
35084 The router will defer rather than decline if the domain
35085 is found in the <option>fail_defer_domains</option> router option.
35086 </para>
35087 <para>
35088 Reasons for a <command>dnslookup</command> router to decline currently include:
35089 </para>
35090 <itemizedlist>
35091 <listitem>
35092 <para>
35093 The domain does not exist in DNS
35094 </para>
35095 </listitem>
35096 <listitem>
35097 <para>
35098 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
35099 convention (borrowed from SRV) used to indicate that there is no such service
35100 for this domain and to not fall back to trying A/AAAA records.
35101 </para>
35102 </listitem>
35103 <listitem>
35104 <para>
35105 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
35106 </para>
35107 </listitem>
35108 <listitem>
35109 <para>
35110 MX record points to a non-existent host.
35111 </para>
35112 </listitem>
35113 <listitem>
35114 <para>
35115 MX record points to an IP address and the main section option
35116 <option>allow_mx_to_ip</option> is not set.
35117 </para>
35118 </listitem>
35119 <listitem>
35120 <para>
35121 MX records exist and point to valid hosts, but all hosts resolve only to
35122 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
35123 </para>
35124 </listitem>
35125 <listitem>
35126 <para>
35127 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
35128 <option>dns_check_names_pattern</option> for handling one variant of this)
35129 </para>
35130 </listitem>
35131 <listitem>
35132 <para>
35133 <option>check_secondary_mx</option> is set on this router but the local host can
35134 not be found in the MX records (see below)
35135 </para>
35136 </listitem>
35137 </itemizedlist>
35138 </section>
35139 <section id="SECID118">
35140 <title>Private options for dnslookup</title>
35141 <para>
35142 <indexterm role="concept">
35143 <primary>options</primary>
35144 <secondary><command>dnslookup</command> router</secondary>
35145 </indexterm>
35146 The private options for the <command>dnslookup</command> router are as follows:
35147 </para>
35148 <para>
35149 <indexterm role="option">
35150 <primary><option>check_secondary_mx</option></primary>
35151 </indexterm>
35152 </para>
35153 <informaltable frame="all">
35154 <tgroup cols="4" colsep="0" rowsep="0">
35155 <colspec colwidth="8*" align="left"/>
35156 <colspec colwidth="6*" align="center"/>
35157 <colspec colwidth="6*" align="center"/>
35158 <colspec colwidth="6*" align="right"/>
35159 <tbody>
35160 <row>
35161 <entry><option>check_secondary_mx</option></entry>
35162 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35163 <entry>Type: <emphasis>boolean</emphasis></entry>
35164 <entry>Default: <emphasis>false</emphasis></entry>
35165 </row>
35166 </tbody>
35167 </tgroup>
35168 </informaltable>
35169 <para>
35170 <indexterm role="concept">
35171 <primary>MX record</primary>
35172 <secondary>checking for secondary</secondary>
35173 </indexterm>
35174 If this option is set, the router declines unless the local host is found in
35175 (and removed from) the list of hosts obtained by MX lookup. This can be used to
35176 process domains for which the local host is a secondary mail exchanger
35177 differently to other domains. The way in which Exim decides whether a host is
35178 the local host is described in section <xref linkend="SECTreclocipadd"/>.
35179 </para>
35180 <para>
35181 <indexterm role="option">
35182 <primary><option>check_srv</option></primary>
35183 </indexterm>
35184 </para>
35185 <informaltable frame="all">
35186 <tgroup cols="4" colsep="0" rowsep="0">
35187 <colspec colwidth="8*" align="left"/>
35188 <colspec colwidth="6*" align="center"/>
35189 <colspec colwidth="6*" align="center"/>
35190 <colspec colwidth="6*" align="right"/>
35191 <tbody>
35192 <row>
35193 <entry><option>check_srv</option></entry>
35194 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35195 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35196 <entry>Default: <emphasis>unset</emphasis></entry>
35197 </row>
35198 </tbody>
35199 </tgroup>
35200 </informaltable>
35201 <para>
35202 <indexterm role="concept">
35203 <primary>SRV record</primary>
35204 <secondary>enabling use of</secondary>
35205 </indexterm>
35206 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
35207 addition to MX and address records. The support is disabled by default. To
35208 enable SRV support, set the <option>check_srv</option> option to the name of the service
35209 required. For example,
35210 </para>
35211 <literallayout class="monospaced">
35212 check_srv = smtp
35213 </literallayout>
35214 <para>
35215 looks for SRV records that refer to the normal smtp service. The option is
35216 expanded, so the service name can vary from message to message or address
35217 to address. This might be helpful if SRV records are being used for a
35218 submission service. If the expansion is forced to fail, the <option>check_srv</option>
35219 option is ignored, and the router proceeds to look for MX records in the
35220 normal way.
35221 </para>
35222 <para>
35223 When the expansion succeeds, the router searches first for SRV records for
35224 the given service (it assumes TCP protocol). A single SRV record with a
35225 host name that consists of just a single dot indicates <quote>no such service for
35226 this domain</quote>; if this is encountered, the router declines. If other kinds of
35227 SRV record are found, they are used to construct a host list for delivery
35228 according to the rules of RFC 2782. MX records are not sought in this case.
35229 </para>
35230 <para>
35231 When no SRV records are found, MX records (and address records) are sought in
35232 the traditional way. In other words, SRV records take precedence over MX
35233 records, just as MX records take precedence over address records. Note that
35234 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
35235 defined it. It is apparently believed that MX records are sufficient for email
35236 and that SRV records should not be used for this purpose. However, SRV records
35237 have an additional <quote>weight</quote> feature which some people might find useful when
35238 trying to split an SMTP load between hosts of different power.
35239 </para>
35240 <para>
35241 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
35242 when there is a DNS lookup error.
35243 </para>
35244 <para>
35245 <indexterm role="option">
35246 <primary><option>fail_defer_domains</option></primary>
35247 </indexterm>
35248 </para>
35249 <informaltable frame="all">
35250 <tgroup cols="4" colsep="0" rowsep="0">
35251 <colspec colwidth="8*" align="left"/>
35252 <colspec colwidth="6*" align="center"/>
35253 <colspec colwidth="6*" align="center"/>
35254 <colspec colwidth="6*" align="right"/>
35255 <tbody>
35256 <row>
35257 <entry><option>fail_defer_domains</option></entry>
35258 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35259 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35260 <entry>Default: <emphasis>unset</emphasis></entry>
35261 </row>
35262 </tbody>
35263 </tgroup>
35264 </informaltable>
35265 <para>
35266 <indexterm role="concept">
35267 <primary>MX record</primary>
35268 <secondary>not found</secondary>
35269 </indexterm>
35270 DNS lookups for domains matching <option>fail_defer_domains</option>
35271 which find no matching record will cause the router to defer
35272 rather than the default behaviour of decline.
35273 This maybe be useful for queueing messages for a newly created
35274 domain while the DNS configuration is not ready.
35275 However, it will result in any message with mistyped domains
35276 also being queued.
35277 </para>
35278 <para>
35279 <indexterm role="option">
35280 <primary><option>mx_domains</option></primary>
35281 </indexterm>
35282 </para>
35283 <informaltable frame="all">
35284 <tgroup cols="4" colsep="0" rowsep="0">
35285 <colspec colwidth="8*" align="left"/>
35286 <colspec colwidth="6*" align="center"/>
35287 <colspec colwidth="6*" align="center"/>
35288 <colspec colwidth="6*" align="right"/>
35289 <tbody>
35290 <row>
35291 <entry><option>mx_domains</option></entry>
35292 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35293 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35294 <entry>Default: <emphasis>unset</emphasis></entry>
35295 </row>
35296 </tbody>
35297 </tgroup>
35298 </informaltable>
35299 <para>
35300 <indexterm role="concept">
35301 <primary>MX record</primary>
35302 <secondary>required to exist</secondary>
35303 </indexterm>
35304 <indexterm role="concept">
35305 <primary>SRV record</primary>
35306 <secondary>required to exist</secondary>
35307 </indexterm>
35308 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
35309 record in order to be recognized. (The name of this option could be improved.)
35310 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
35311 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
35312 setting:
35313 </para>
35314 <literallayout class="monospaced">
35315 mx_domains = ! *.discworld.fict.example : *.fict.example
35316 </literallayout>
35317 <para>
35318 This specifies that messages addressed to a domain that matches the list but
35319 has no MX record should be bounced immediately instead of being routed using
35320 the address record.
35321 </para>
35322 <para>
35323 <indexterm role="option">
35324 <primary><option>mx_fail_domains</option></primary>
35325 </indexterm>
35326 </para>
35327 <informaltable frame="all">
35328 <tgroup cols="4" colsep="0" rowsep="0">
35329 <colspec colwidth="8*" align="left"/>
35330 <colspec colwidth="6*" align="center"/>
35331 <colspec colwidth="6*" align="center"/>
35332 <colspec colwidth="6*" align="right"/>
35333 <tbody>
35334 <row>
35335 <entry><option>mx_fail_domains</option></entry>
35336 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35337 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35338 <entry>Default: <emphasis>unset</emphasis></entry>
35339 </row>
35340 </tbody>
35341 </tgroup>
35342 </informaltable>
35343 <para>
35344 If the DNS lookup for MX records for one of the domains in this list causes a
35345 DNS lookup error, Exim behaves as if no MX records were found. See section
35346 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35347 </para>
35348 <para>
35349 <indexterm role="option">
35350 <primary><option>qualify_single</option></primary>
35351 </indexterm>
35352 </para>
35353 <informaltable frame="all">
35354 <tgroup cols="4" colsep="0" rowsep="0">
35355 <colspec colwidth="8*" align="left"/>
35356 <colspec colwidth="6*" align="center"/>
35357 <colspec colwidth="6*" align="center"/>
35358 <colspec colwidth="6*" align="right"/>
35359 <tbody>
35360 <row>
35361 <entry><option>qualify_single</option></entry>
35362 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35363 <entry>Type: <emphasis>boolean</emphasis></entry>
35364 <entry>Default: <emphasis>true</emphasis></entry>
35365 </row>
35366 </tbody>
35367 </tgroup>
35368 </informaltable>
35369 <para>
35370 <indexterm role="concept">
35371 <primary>DNS</primary>
35372 <secondary>resolver options</secondary>
35373 </indexterm>
35374 <indexterm role="concept">
35375 <primary>DNS</primary>
35376 <secondary>qualifying single-component names</secondary>
35377 </indexterm>
35378 When this option is true, the resolver option RES_DEFNAMES is set for DNS
35379 lookups. Typically, but not standardly, this causes the resolver to qualify
35380 single-component names with the default domain. For example, on a machine
35381 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
35382 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
35383 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
35384 <emphasis>resolv.conf</emphasis>.
35385 </para>
35386 <para>
35387 <indexterm role="option">
35388 <primary><option>rewrite_headers</option></primary>
35389 </indexterm>
35390 </para>
35391 <informaltable frame="all">
35392 <tgroup cols="4" colsep="0" rowsep="0">
35393 <colspec colwidth="8*" align="left"/>
35394 <colspec colwidth="6*" align="center"/>
35395 <colspec colwidth="6*" align="center"/>
35396 <colspec colwidth="6*" align="right"/>
35397 <tbody>
35398 <row>
35399 <entry><option>rewrite_headers</option></entry>
35400 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35401 <entry>Type: <emphasis>boolean</emphasis></entry>
35402 <entry>Default: <emphasis>true</emphasis></entry>
35403 </row>
35404 </tbody>
35405 </tgroup>
35406 </informaltable>
35407 <para>
35408 <indexterm role="concept">
35409 <primary>rewriting</primary>
35410 <secondary>header lines</secondary>
35411 </indexterm>
35412 <indexterm role="concept">
35413 <primary>header lines</primary>
35414 <secondary>rewriting</secondary>
35415 </indexterm>
35416 If the domain name in the address that is being processed is not fully
35417 qualified, it may be expanded to its full form by a DNS lookup. For example, if
35418 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
35419 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
35420 occur as a result of setting the <option>widen_domains</option> option. If
35421 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
35422 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
35423 header lines of the message are rewritten with the full domain name.
35424 </para>
35425 <para>
35426 This option should be turned off only when it is known that no message is
35427 ever going to be sent outside an environment where the abbreviation makes
35428 sense.
35429 </para>
35430 <para>
35431 When an MX record is looked up in the DNS and matches a wildcard record, name
35432 servers normally return a record containing the name that has been looked up,
35433 making it impossible to detect whether a wildcard was present or not. However,
35434 some name servers have recently been seen to return the wildcard entry. If the
35435 name returned by a DNS lookup begins with an asterisk, it is not used for
35436 header rewriting.
35437 </para>
35438 <para>
35439 <indexterm role="option">
35440 <primary><option>same_domain_copy_routing</option></primary>
35441 </indexterm>
35442 </para>
35443 <informaltable frame="all">
35444 <tgroup cols="4" colsep="0" rowsep="0">
35445 <colspec colwidth="8*" align="left"/>
35446 <colspec colwidth="6*" align="center"/>
35447 <colspec colwidth="6*" align="center"/>
35448 <colspec colwidth="6*" align="right"/>
35449 <tbody>
35450 <row>
35451 <entry><option>same_domain_copy_routing</option></entry>
35452 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35453 <entry>Type: <emphasis>boolean</emphasis></entry>
35454 <entry>Default: <emphasis>false</emphasis></entry>
35455 </row>
35456 </tbody>
35457 </tgroup>
35458 </informaltable>
35459 <para>
35460 <indexterm role="concept">
35461 <primary>address</primary>
35462 <secondary>copying routing</secondary>
35463 </indexterm>
35464 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
35465 to the same list of hosts. However, this cannot be presumed, because the router
35466 options and preconditions may refer to the local part of the address. By
35467 default, therefore, Exim routes each address in a message independently. DNS
35468 servers run caches, so repeated DNS lookups are not normally expensive, and in
35469 any case, personal messages rarely have more than a few recipients.
35470 </para>
35471 <para>
35472 If you are running mailing lists with large numbers of subscribers at the same
35473 domain, and you are using a <command>dnslookup</command> router which is independent of the
35474 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35475 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
35476 routes an address to a remote transport, any other unrouted addresses in the
35477 message that have the same domain are automatically given the same routing
35478 without processing them independently,
35479 provided the following conditions are met:
35480 </para>
35481 <itemizedlist>
35482 <listitem>
35483 <para>
35484 No router that processed the address specified <option>headers_add</option> or
35485 <option>headers_remove</option>.
35486 </para>
35487 </listitem>
35488 <listitem>
35489 <para>
35490 The router did not change the address in any way, for example, by <quote>widening</quote>
35491 the domain.
35492 </para>
35493 </listitem>
35494 </itemizedlist>
35495 <para>
35496 <indexterm role="option">
35497 <primary><option>search_parents</option></primary>
35498 </indexterm>
35499 </para>
35500 <informaltable frame="all">
35501 <tgroup cols="4" colsep="0" rowsep="0">
35502 <colspec colwidth="8*" align="left"/>
35503 <colspec colwidth="6*" align="center"/>
35504 <colspec colwidth="6*" align="center"/>
35505 <colspec colwidth="6*" align="right"/>
35506 <tbody>
35507 <row>
35508 <entry><option>search_parents</option></entry>
35509 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35510 <entry>Type: <emphasis>boolean</emphasis></entry>
35511 <entry>Default: <emphasis>false</emphasis></entry>
35512 </row>
35513 </tbody>
35514 </tgroup>
35515 </informaltable>
35516 <para>
35517 <indexterm role="concept">
35518 <primary>DNS</primary>
35519 <secondary>resolver options</secondary>
35520 </indexterm>
35521 When this option is true, the resolver option RES_DNSRCH is set for DNS
35522 lookups. This is different from the <option>qualify_single</option> option in that it
35523 applies to domains containing dots. Typically, but not standardly, it causes
35524 the resolver to search for the name in the current domain and in parent
35525 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
35526 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
35527 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
35528 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
35529 </para>
35530 <para>
35531 Setting this option true can cause problems in domains that have a wildcard MX
35532 record, because any domain that does not have its own MX record matches the
35533 local wildcard.
35534 </para>
35535 <para>
35536 <indexterm role="option">
35537 <primary><option>srv_fail_domains</option></primary>
35538 </indexterm>
35539 </para>
35540 <informaltable frame="all">
35541 <tgroup cols="4" colsep="0" rowsep="0">
35542 <colspec colwidth="8*" align="left"/>
35543 <colspec colwidth="6*" align="center"/>
35544 <colspec colwidth="6*" align="center"/>
35545 <colspec colwidth="6*" align="right"/>
35546 <tbody>
35547 <row>
35548 <entry><option>srv_fail_domains</option></entry>
35549 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35550 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35551 <entry>Default: <emphasis>unset</emphasis></entry>
35552 </row>
35553 </tbody>
35554 </tgroup>
35555 </informaltable>
35556 <para>
35557 If the DNS lookup for SRV records for one of the domains in this list causes a
35558 DNS lookup error, Exim behaves as if no SRV records were found. See section
35559 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35560 </para>
35561 <para>
35562 <indexterm role="option">
35563 <primary><option>widen_domains</option></primary>
35564 </indexterm>
35565 </para>
35566 <informaltable frame="all">
35567 <tgroup cols="4" colsep="0" rowsep="0">
35568 <colspec colwidth="8*" align="left"/>
35569 <colspec colwidth="6*" align="center"/>
35570 <colspec colwidth="6*" align="center"/>
35571 <colspec colwidth="6*" align="right"/>
35572 <tbody>
35573 <row>
35574 <entry><option>widen_domains</option></entry>
35575 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35576 <entry>Type: <emphasis>string list</emphasis></entry>
35577 <entry>Default: <emphasis>unset</emphasis></entry>
35578 </row>
35579 </tbody>
35580 </tgroup>
35581 </informaltable>
35582 <para>
35583 <indexterm role="concept">
35584 <primary>domain</primary>
35585 <secondary>partial; widening</secondary>
35586 </indexterm>
35587 If a DNS lookup fails and this option is set, each of its strings in turn is
35588 added onto the end of the domain, and the lookup is tried again. For example,
35589 if
35590 </para>
35591 <literallayout class="monospaced">
35592 widen_domains = fict.example:ref.example
35593 </literallayout>
35594 <para>
35595 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
35596 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
35597 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
35598 and <option>search_parents</option> options can cause some widening to be undertaken inside
35599 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
35600 when verifying, unless <option>rewrite_headers</option> is false (not the default).
35601 </para>
35602 </section>
35603 <section id="SECID119">
35604 <title>Effect of qualify_single and search_parents</title>
35605 <para>
35606 When a domain from an envelope recipient is changed by the resolver as a result
35607 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
35608 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
35609 is set false. Exim then re-routes the address, using the full domain.
35610 </para>
35611 <para>
35612 These two options affect only the DNS lookup that takes place inside the router
35613 for the domain of the address that is being routed. They do not affect lookups
35614 such as that implied by
35615 </para>
35616 <literallayout class="monospaced">
35617 domains = @mx_any
35618 </literallayout>
35619 <para>
35620 that may happen while processing a router precondition before the router is
35621 entered. No widening ever takes place for these lookups.
35622 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
35623 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
35624 </para>
35625 </section>
35626 </chapter>
35627
35628 <chapter id="CHID5">
35629 <title>The ipliteral router</title>
35630 <para>
35631 <indexterm role="concept">
35632 <primary><command>ipliteral</command> router</primary>
35633 </indexterm>
35634 <indexterm role="concept">
35635 <primary>domain literal</primary>
35636 <secondary>routing</secondary>
35637 </indexterm>
35638 <indexterm role="concept">
35639 <primary>routers</primary>
35640 <secondary><command>ipliteral</command></secondary>
35641 </indexterm>
35642 This router has no private options. Unless it is being used purely for
35643 verification (see <option>verify_only</option>) a transport is required to be defined by the
35644 generic <option>transport</option> option. The router accepts the address if its domain part
35645 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
35646 router handles the address
35647 </para>
35648 <literallayout class="monospaced">
35649 root@[192.168.1.1]
35650 </literallayout>
35651 <para>
35652 by setting up delivery to the host with that IP address. IPv4 domain literals
35653 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
35654 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
35655 </para>
35656 <literallayout class="monospaced">
35657 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
35658 </literallayout>
35659 <para>
35660 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
35661 grounds that sooner or later somebody will try it.
35662 </para>
35663 <para>
35664 <indexterm role="option">
35665 <primary><option>self</option></primary>
35666 <secondary>in <command>ipliteral</command> router</secondary>
35667 </indexterm>
35668 If the IP address matches something in <option>ignore_target_hosts</option>, the router
35669 declines. If an IP literal turns out to refer to the local host, the generic
35670 <option>self</option> option determines what happens.
35671 </para>
35672 <para>
35673 The RFCs require support for domain literals; however, their use is
35674 controversial in today&#x2019;s Internet. If you want to use this router, you must
35675 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
35676 Exim will not recognize the domain literal syntax in addresses.
35677 </para>
35678 </chapter>
35679
35680 <chapter id="CHID6">
35681 <title>The iplookup router</title>
35682 <para>
35683 <indexterm role="concept">
35684 <primary><command>iplookup</command> router</primary>
35685 </indexterm>
35686 <indexterm role="concept">
35687 <primary>routers</primary>
35688 <secondary><command>iplookup</command></secondary>
35689 </indexterm>
35690 The <command>iplookup</command> router was written to fulfil a specific requirement in
35691 Cambridge University (which in fact no longer exists). For this reason, it is
35692 not included in the binary of Exim by default. If you want to include it, you
35693 must set
35694 </para>
35695 <literallayout class="monospaced">
35696 ROUTER_IPLOOKUP=yes
35697 </literallayout>
35698 <para>
35699 in your <filename>Local/Makefile</filename> configuration file.
35700 </para>
35701 <para>
35702 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
35703 connection to one or more specific hosts. The host can then return the same or
35704 a different address &ndash; in effect rewriting the recipient address in the
35705 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
35706 this process fails, the address can be passed on to other routers, or delivery
35707 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
35708 must not be specified for it.
35709 </para>
35710 <para>
35711 <indexterm role="concept">
35712 <primary>options</primary>
35713 <secondary><command>iplookup</command> router</secondary>
35714 </indexterm>
35715 <indexterm role="option">
35716 <primary><option>hosts</option></primary>
35717 </indexterm>
35718 </para>
35719 <informaltable frame="all">
35720 <tgroup cols="4" colsep="0" rowsep="0">
35721 <colspec colwidth="8*" align="left"/>
35722 <colspec colwidth="6*" align="center"/>
35723 <colspec colwidth="6*" align="center"/>
35724 <colspec colwidth="6*" align="right"/>
35725 <tbody>
35726 <row>
35727 <entry><option>hosts</option></entry>
35728 <entry>Use: <emphasis>iplookup</emphasis></entry>
35729 <entry>Type: <emphasis>string</emphasis></entry>
35730 <entry>Default: <emphasis>unset</emphasis></entry>
35731 </row>
35732 </tbody>
35733 </tgroup>
35734 </informaltable>
35735 <para>
35736 This option must be supplied. Its value is a colon-separated list of host
35737 names. The hosts are looked up using <function>gethostbyname()</function>
35738 (or <function>getipnodebyname()</function> when available)
35739 and are tried in order until one responds to the query. If none respond, what
35740 happens is controlled by <option>optional</option>.
35741 </para>
35742 <para>
35743 <indexterm role="option">
35744 <primary><option>optional</option></primary>
35745 </indexterm>
35746 </para>
35747 <informaltable frame="all">
35748 <tgroup cols="4" colsep="0" rowsep="0">
35749 <colspec colwidth="8*" align="left"/>
35750 <colspec colwidth="6*" align="center"/>
35751 <colspec colwidth="6*" align="center"/>
35752 <colspec colwidth="6*" align="right"/>
35753 <tbody>
35754 <row>
35755 <entry><option>optional</option></entry>
35756 <entry>Use: <emphasis>iplookup</emphasis></entry>
35757 <entry>Type: <emphasis>boolean</emphasis></entry>
35758 <entry>Default: <emphasis>false</emphasis></entry>
35759 </row>
35760 </tbody>
35761 </tgroup>
35762 </informaltable>
35763 <para>
35764 If <option>optional</option> is true, if no response is obtained from any host, the address
35765 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
35766 delivery to the address is deferred.
35767 </para>
35768 <para>
35769 <indexterm role="option">
35770 <primary><option>port</option></primary>
35771 </indexterm>
35772 </para>
35773 <informaltable frame="all">
35774 <tgroup cols="4" colsep="0" rowsep="0">
35775 <colspec colwidth="8*" align="left"/>
35776 <colspec colwidth="6*" align="center"/>
35777 <colspec colwidth="6*" align="center"/>
35778 <colspec colwidth="6*" align="right"/>
35779 <tbody>
35780 <row>
35781 <entry><option>port</option></entry>
35782 <entry>Use: <emphasis>iplookup</emphasis></entry>
35783 <entry>Type: <emphasis>integer</emphasis></entry>
35784 <entry>Default: <emphasis>0</emphasis></entry>
35785 </row>
35786 </tbody>
35787 </tgroup>
35788 </informaltable>
35789 <para>
35790 <indexterm role="concept">
35791 <primary>port</primary>
35792 <secondary><command>iplookup</command> router</secondary>
35793 </indexterm>
35794 This option must be supplied. It specifies the port number for the TCP or UDP
35795 call.
35796 </para>
35797 <para>
35798 <indexterm role="option">
35799 <primary><option>protocol</option></primary>
35800 </indexterm>
35801 </para>
35802 <informaltable frame="all">
35803 <tgroup cols="4" colsep="0" rowsep="0">
35804 <colspec colwidth="8*" align="left"/>
35805 <colspec colwidth="6*" align="center"/>
35806 <colspec colwidth="6*" align="center"/>
35807 <colspec colwidth="6*" align="right"/>
35808 <tbody>
35809 <row>
35810 <entry><option>protocol</option></entry>
35811 <entry>Use: <emphasis>iplookup</emphasis></entry>
35812 <entry>Type: <emphasis>string</emphasis></entry>
35813 <entry>Default: <emphasis>udp</emphasis></entry>
35814 </row>
35815 </tbody>
35816 </tgroup>
35817 </informaltable>
35818 <para>
35819 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
35820 protocols is to be used.
35821 </para>
35822 <para>
35823 <indexterm role="option">
35824 <primary><option>query</option></primary>
35825 </indexterm>
35826 </para>
35827 <informaltable frame="all">
35828 <tgroup cols="4" colsep="0" rowsep="0">
35829 <colspec colwidth="8*" align="left"/>
35830 <colspec colwidth="6*" align="center"/>
35831 <colspec colwidth="6*" align="center"/>
35832 <colspec colwidth="6*" align="right"/>
35833 <tbody>
35834 <row>
35835 <entry><option>query</option></entry>
35836 <entry>Use: <emphasis>iplookup</emphasis></entry>
35837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35838 <entry>Default: <emphasis>see below</emphasis></entry>
35839 </row>
35840 </tbody>
35841 </tgroup>
35842 </informaltable>
35843 <para>
35844 This defines the content of the query that is sent to the remote hosts. The
35845 default value is:
35846 </para>
35847 <literallayout class="monospaced">
35848 $local_part@$domain $local_part@$domain
35849 </literallayout>
35850 <para>
35851 The repetition serves as a way of checking that a response is to the correct
35852 query in the default case (see <option>response_pattern</option> below).
35853 </para>
35854 <para>
35855 <indexterm role="option">
35856 <primary><option>reroute</option></primary>
35857 </indexterm>
35858 </para>
35859 <informaltable frame="all">
35860 <tgroup cols="4" colsep="0" rowsep="0">
35861 <colspec colwidth="8*" align="left"/>
35862 <colspec colwidth="6*" align="center"/>
35863 <colspec colwidth="6*" align="center"/>
35864 <colspec colwidth="6*" align="right"/>
35865 <tbody>
35866 <row>
35867 <entry><option>reroute</option></entry>
35868 <entry>Use: <emphasis>iplookup</emphasis></entry>
35869 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35870 <entry>Default: <emphasis>unset</emphasis></entry>
35871 </row>
35872 </tbody>
35873 </tgroup>
35874 </informaltable>
35875 <para>
35876 If this option is not set, the rerouted address is precisely the byte string
35877 returned by the remote host, up to the first white space, if any. If set, the
35878 string is expanded to form the rerouted address. It can include parts matched
35879 in the response by <option>response_pattern</option> by means of numeric variables such as
35880 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
35881 whether or not a pattern is in use. In all cases, the rerouted address must end
35882 up in the form <emphasis>local_part@domain</emphasis>.
35883 </para>
35884 <para>
35885 <indexterm role="option">
35886 <primary><option>response_pattern</option></primary>
35887 </indexterm>
35888 </para>
35889 <informaltable frame="all">
35890 <tgroup cols="4" colsep="0" rowsep="0">
35891 <colspec colwidth="8*" align="left"/>
35892 <colspec colwidth="6*" align="center"/>
35893 <colspec colwidth="6*" align="center"/>
35894 <colspec colwidth="6*" align="right"/>
35895 <tbody>
35896 <row>
35897 <entry><option>response_pattern</option></entry>
35898 <entry>Use: <emphasis>iplookup</emphasis></entry>
35899 <entry>Type: <emphasis>string</emphasis></entry>
35900 <entry>Default: <emphasis>unset</emphasis></entry>
35901 </row>
35902 </tbody>
35903 </tgroup>
35904 </informaltable>
35905 <para>
35906 This option can be set to a regular expression that is applied to the string
35907 returned from the remote host. If the pattern does not match the response, the
35908 router declines. If <option>response_pattern</option> is not set, no checking of the
35909 response is done, unless the query was defaulted, in which case there is a
35910 check that the text returned after the first white space is the original
35911 address. This checks that the answer that has been received is in response to
35912 the correct question. For example, if the response is just a new domain, the
35913 following could be used:
35914 </para>
35915 <literallayout class="monospaced">
35916 response_pattern = ^([^@]+)$
35917 reroute = $local_part@$1
35918 </literallayout>
35919 <para>
35920 <indexterm role="option">
35921 <primary><option>timeout</option></primary>
35922 </indexterm>
35923 </para>
35924 <informaltable frame="all">
35925 <tgroup cols="4" colsep="0" rowsep="0">
35926 <colspec colwidth="8*" align="left"/>
35927 <colspec colwidth="6*" align="center"/>
35928 <colspec colwidth="6*" align="center"/>
35929 <colspec colwidth="6*" align="right"/>
35930 <tbody>
35931 <row>
35932 <entry><option>timeout</option></entry>
35933 <entry>Use: <emphasis>iplookup</emphasis></entry>
35934 <entry>Type: <emphasis>time</emphasis></entry>
35935 <entry>Default: <emphasis>5s</emphasis></entry>
35936 </row>
35937 </tbody>
35938 </tgroup>
35939 </informaltable>
35940 <para>
35941 This specifies the amount of time to wait for a response from the remote
35942 machine. The same timeout is used for the <function>connect()</function> function for a TCP
35943 call. It does not apply to UDP.
35944 </para>
35945 </chapter>
35946
35947 <chapter id="CHID7">
35948 <title>The manualroute router</title>
35949 <para>
35950 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
35951 <primary><command>manualroute</command> router</primary>
35952 </indexterm>
35953 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
35954 <primary>routers</primary>
35955 <secondary><command>manualroute</command></secondary>
35956 </indexterm>
35957 <indexterm role="concept">
35958 <primary>domain</primary>
35959 <secondary>manually routing</secondary>
35960 </indexterm>
35961 The <command>manualroute</command> router is so-called because it provides a way of manually
35962 routing an address according to its domain. It is mainly used when you want to
35963 route addresses to remote hosts according to your own rules, bypassing the
35964 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
35965 route to local transports, a facility that may be useful if you want to save
35966 messages for dial-in hosts in local files.
35967 </para>
35968 <para>
35969 The <command>manualroute</command> router compares a list of domain patterns with the domain
35970 it is trying to route. If there is no match, the router declines. Each pattern
35971 has associated with it a list of hosts and some other optional data, which may
35972 include a transport. The combination of a pattern and its data is called a
35973 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
35974 generic <option>transport</option> option must specify a transport, unless the router is
35975 being used purely for verification (see <option>verify_only</option>).
35976 </para>
35977 <para>
35978 <indexterm role="variable">
35979 <primary><varname>$host</varname></primary>
35980 </indexterm>
35981 In the case of verification, matching the domain pattern is sufficient for the
35982 router to accept the address. When actually routing an address for delivery,
35983 an address that matches a domain pattern is queued for the associated
35984 transport. If the transport is not a local one, a host list must be associated
35985 with the pattern; IP addresses are looked up for the hosts, and these are
35986 passed to the transport along with the mail address. For local transports, a
35987 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
35988 text string.
35989 </para>
35990 <para>
35991 The list of routing rules can be provided as an inline string in
35992 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
35993 or database by setting <option>route_data</option>. Only one of these settings may appear in
35994 any one instance of <command>manualroute</command>. The format of routing rules is described
35995 below, following the list of private options.
35996 </para>
35997 <section id="SECTprioptman">
35998 <title>Private options for manualroute</title>
35999 <para>
36000 <indexterm role="concept">
36001 <primary>options</primary>
36002 <secondary><command>manualroute</command> router</secondary>
36003 </indexterm>
36004 The private options for the <command>manualroute</command> router are as follows:
36005 </para>
36006 <para>
36007 <indexterm role="option">
36008 <primary><option>host_all_ignored</option></primary>
36009 </indexterm>
36010 </para>
36011 <informaltable frame="all">
36012 <tgroup cols="4" colsep="0" rowsep="0">
36013 <colspec colwidth="8*" align="left"/>
36014 <colspec colwidth="6*" align="center"/>
36015 <colspec colwidth="6*" align="center"/>
36016 <colspec colwidth="6*" align="right"/>
36017 <tbody>
36018 <row>
36019 <entry><option>host_all_ignored</option></entry>
36020 <entry>Use: <emphasis>manualroute</emphasis></entry>
36021 <entry>Type: <emphasis>string</emphasis></entry>
36022 <entry>Default: <emphasis>defer</emphasis></entry>
36023 </row>
36024 </tbody>
36025 </tgroup>
36026 </informaltable>
36027 <para>
36028 See <option>host_find_failed</option>.
36029 </para>
36030 <para>
36031 <indexterm role="option">
36032 <primary><option>host_find_failed</option></primary>
36033 </indexterm>
36034 </para>
36035 <informaltable frame="all">
36036 <tgroup cols="4" colsep="0" rowsep="0">
36037 <colspec colwidth="8*" align="left"/>
36038 <colspec colwidth="6*" align="center"/>
36039 <colspec colwidth="6*" align="center"/>
36040 <colspec colwidth="6*" align="right"/>
36041 <tbody>
36042 <row>
36043 <entry><option>host_find_failed</option></entry>
36044 <entry>Use: <emphasis>manualroute</emphasis></entry>
36045 <entry>Type: <emphasis>string</emphasis></entry>
36046 <entry>Default: <emphasis>freeze</emphasis></entry>
36047 </row>
36048 </tbody>
36049 </tgroup>
36050 </informaltable>
36051 <para>
36052 This option controls what happens when <command>manualroute</command> tries to find an IP
36053 address for a host, and the host does not exist. The option can be set to one
36054 of the following values:
36055 </para>
36056 <literallayout class="monospaced">
36057 decline
36058 defer
36059 fail
36060 freeze
36061 ignore
36062 pass
36063 </literallayout>
36064 <para>
36065 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
36066 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
36067 forces the address to be passed to the next router (or the router defined by
36068 <option>pass_router</option>),
36069 <indexterm role="option">
36070 <primary><option>more</option></primary>
36071 </indexterm>
36072 overriding <option>no_more</option>, whereas the latter passes the address to the next
36073 router only if <option>more</option> is true.
36074 </para>
36075 <para>
36076 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
36077 cannot be found. If all the hosts in the list are ignored, the behaviour is
36078 controlled by the <option>host_all_ignored</option> option. This takes the same values
36079 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
36080 </para>
36081 <para>
36082 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
36083 state; if a host lookup gets a temporary error, delivery is deferred unless the
36084 generic <option>pass_on_timeout</option> option is set.
36085 </para>
36086 <para>
36087 <indexterm role="option">
36088 <primary><option>hosts_randomize</option></primary>
36089 </indexterm>
36090 </para>
36091 <informaltable frame="all">
36092 <tgroup cols="4" colsep="0" rowsep="0">
36093 <colspec colwidth="8*" align="left"/>
36094 <colspec colwidth="6*" align="center"/>
36095 <colspec colwidth="6*" align="center"/>
36096 <colspec colwidth="6*" align="right"/>
36097 <tbody>
36098 <row>
36099 <entry><option>hosts_randomize</option></entry>
36100 <entry>Use: <emphasis>manualroute</emphasis></entry>
36101 <entry>Type: <emphasis>boolean</emphasis></entry>
36102 <entry>Default: <emphasis>false</emphasis></entry>
36103 </row>
36104 </tbody>
36105 </tgroup>
36106 </informaltable>
36107 <para>
36108 <indexterm role="concept">
36109 <primary>randomized host list</primary>
36110 </indexterm>
36111 <indexterm role="concept">
36112 <primary>host</primary>
36113 <secondary>list of; randomized</secondary>
36114 </indexterm>
36115 If this option is set, the order of the items in a host list in a routing rule
36116 is randomized each time the list is used, unless an option in the routing rule
36117 overrides (see below). Randomizing the order of a host list can be used to do
36118 crude load sharing. However, if more than one mail address is routed by the
36119 same router to the same host list, the host lists are considered to be the same
36120 (even though they may be randomized into different orders) for the purpose of
36121 deciding whether to batch the deliveries into a single SMTP transaction.
36122 </para>
36123 <para>
36124 When <option>hosts_randomize</option> is true, a host list may be split
36125 into groups whose order is separately randomized. This makes it possible to
36126 set up MX-like behaviour. The boundaries between groups are indicated by an
36127 item that is just <literal>+</literal> in the host list. For example:
36128 </para>
36129 <literallayout class="monospaced">
36130 route_list = * host1:host2:host3:+:host4:host5
36131 </literallayout>
36132 <para>
36133 The order of the first three hosts and the order of the last two hosts is
36134 randomized for each use, but the first three always end up before the last two.
36135 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
36136 randomized host list is passed to an <command>smtp</command> transport that also has
36137 <option>hosts_randomize set</option>, the list is not re-randomized.
36138 </para>
36139 <para>
36140 <indexterm role="option">
36141 <primary><option>route_data</option></primary>
36142 </indexterm>
36143 </para>
36144 <informaltable frame="all">
36145 <tgroup cols="4" colsep="0" rowsep="0">
36146 <colspec colwidth="8*" align="left"/>
36147 <colspec colwidth="6*" align="center"/>
36148 <colspec colwidth="6*" align="center"/>
36149 <colspec colwidth="6*" align="right"/>
36150 <tbody>
36151 <row>
36152 <entry><option>route_data</option></entry>
36153 <entry>Use: <emphasis>manualroute</emphasis></entry>
36154 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36155 <entry>Default: <emphasis>unset</emphasis></entry>
36156 </row>
36157 </tbody>
36158 </tgroup>
36159 </informaltable>
36160 <para>
36161 If this option is set, it must expand to yield the data part of a routing rule.
36162 Typically, the expansion string includes a lookup based on the domain. For
36163 example:
36164 </para>
36165 <literallayout class="monospaced">
36166 route_data = ${lookup{$domain}dbm{/etc/routes}}
36167 </literallayout>
36168 <para>
36169 If the expansion is forced to fail, or the result is an empty string, the
36170 router declines. Other kinds of expansion failure cause delivery to be
36171 deferred.
36172 </para>
36173 <para>
36174 <indexterm role="option">
36175 <primary><option>route_list</option></primary>
36176 </indexterm>
36177 </para>
36178 <informaltable frame="all">
36179 <tgroup cols="4" colsep="0" rowsep="0">
36180 <colspec colwidth="8*" align="left"/>
36181 <colspec colwidth="6*" align="center"/>
36182 <colspec colwidth="6*" align="center"/>
36183 <colspec colwidth="6*" align="right"/>
36184 <tbody>
36185 <row>
36186 <entry><option>route_list</option></entry>
36187 <entry>Use: <emphasis>manualroute</emphasis></entry>
36188 <entry>Type: <emphasis>string list</emphasis></entry>
36189 <entry>Default: <emphasis>unset</emphasis></entry>
36190 </row>
36191 </tbody>
36192 </tgroup>
36193 </informaltable>
36194 <para>
36195 This string is a list of routing rules, in the form defined below. Note that,
36196 unlike most string lists, the items are separated by semicolons. This is so
36197 that they may contain colon-separated host lists.
36198 </para>
36199 <para>
36200 <indexterm role="option">
36201 <primary><option>same_domain_copy_routing</option></primary>
36202 </indexterm>
36203 </para>
36204 <informaltable frame="all">
36205 <tgroup cols="4" colsep="0" rowsep="0">
36206 <colspec colwidth="8*" align="left"/>
36207 <colspec colwidth="6*" align="center"/>
36208 <colspec colwidth="6*" align="center"/>
36209 <colspec colwidth="6*" align="right"/>
36210 <tbody>
36211 <row>
36212 <entry><option>same_domain_copy_routing</option></entry>
36213 <entry>Use: <emphasis>manualroute</emphasis></entry>
36214 <entry>Type: <emphasis>boolean</emphasis></entry>
36215 <entry>Default: <emphasis>false</emphasis></entry>
36216 </row>
36217 </tbody>
36218 </tgroup>
36219 </informaltable>
36220 <para>
36221 <indexterm role="concept">
36222 <primary>address</primary>
36223 <secondary>copying routing</secondary>
36224 </indexterm>
36225 Addresses with the same domain are normally routed by the <command>manualroute</command>
36226 router to the same list of hosts. However, this cannot be presumed, because the
36227 router options and preconditions may refer to the local part of the address. By
36228 default, therefore, Exim routes each address in a message independently. DNS
36229 servers run caches, so repeated DNS lookups are not normally expensive, and in
36230 any case, personal messages rarely have more than a few recipients.
36231 </para>
36232 <para>
36233 If you are running mailing lists with large numbers of subscribers at the same
36234 domain, and you are using a <command>manualroute</command> router which is independent of the
36235 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
36236 lookups for identical domains in one message. In this case, when
36237 <command>manualroute</command> routes an address to a remote transport, any other unrouted
36238 addresses in the message that have the same domain are automatically given the
36239 same routing without processing them independently. However, this is only done
36240 if <option>headers_add</option> and <option>headers_remove</option> are unset.
36241 </para>
36242 </section>
36243 <section id="SECID120">
36244 <title>Routing rules in route_list</title>
36245 <para>
36246 The value of <option>route_list</option> is a string consisting of a sequence of routing
36247 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
36248 entered as two semicolons. Alternatively, the list separator can be changed as
36249 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
36250 Empty rules are ignored. The format of each rule is
36251 </para>
36252 <literallayout>
36253 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
36254 </literallayout>
36255 <para>
36256 The following example contains two rules, each with a simple domain pattern and
36257 no options:
36258 </para>
36259 <literallayout class="monospaced">
36260 route_list = \
36261   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
36262   thes.ref.example  mail-3.ref.example:mail-4.ref.example
36263 </literallayout>
36264 <para>
36265 The three parts of a rule are separated by white space. The pattern and the
36266 list of hosts can be enclosed in quotes if necessary, and if they are, the
36267 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
36268 single domain pattern, which is the only mandatory item in the rule. The
36269 pattern is in the same format as one item in a domain list (see section
36270 <xref linkend="SECTdomainlist"/>),
36271 except that it may not be the name of an interpolated file.
36272 That is, it may be wildcarded, or a regular expression, or a file or database
36273 lookup (with semicolons doubled, because of the use of semicolon as a separator
36274 in a <option>route_list</option>).
36275 </para>
36276 <para>
36277 The rules in <option>route_list</option> are searched in order until one of the patterns
36278 matches the domain that is being routed. The list of hosts and then options are
36279 then used as described below. If there is no match, the router declines. When
36280 <option>route_list</option> is set, <option>route_data</option> must not be set.
36281 </para>
36282 </section>
36283 <section id="SECID121">
36284 <title>Routing rules in route_data</title>
36285 <para>
36286 The use of <option>route_list</option> is convenient when there are only a small number of
36287 routing rules. For larger numbers, it is easier to use a file or database to
36288 hold the routing information, and use the <option>route_data</option> option instead.
36289 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
36290 Most commonly, <option>route_data</option> is set as a string that contains an
36291 expansion lookup. For example, suppose we place two routing rules in a file
36292 like this:
36293 </para>
36294 <literallayout class="monospaced">
36295 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
36296 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
36297 </literallayout>
36298 <para>
36299 This data can be accessed by setting
36300 </para>
36301 <literallayout class="monospaced">
36302 route_data = ${lookup{$domain}lsearch{/the/file/name}}
36303 </literallayout>
36304 <para>
36305 Failure of the lookup results in an empty string, causing the router to
36306 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
36307 requirement is that the result of expanding the string is a list of hosts,
36308 possibly followed by options, separated by white space. The list of hosts must
36309 be enclosed in quotes if it contains white space.
36310 </para>
36311 </section>
36312 <section id="SECID122">
36313 <title>Format of the list of hosts</title>
36314 <para>
36315 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
36316 always separately expanded before use. If the expansion fails, the router
36317 declines. The result of the expansion must be a colon-separated list of names
36318 and/or IP addresses, optionally also including ports. The format of each item
36319 in the list is described in the next section. The list separator can be changed
36320 as described in section <xref linkend="SECTlistconstruct"/>.
36321 </para>
36322 <para>
36323 If the list of hosts was obtained from a <option>route_list</option> item, the following
36324 variables are set during its expansion:
36325 </para>
36326 <itemizedlist>
36327 <listitem>
36328 <para>
36329 <indexterm role="concept">
36330 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
36331 <secondary>in <command>manualroute</command> router</secondary>
36332 </indexterm>
36333 If the domain was matched against a regular expression, the numeric variables
36334 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
36335 </para>
36336 <literallayout class="monospaced">
36337 route_list = ^domain(\d+)   host-$1.text.example
36338 </literallayout>
36339 </listitem>
36340 <listitem>
36341 <para>
36342 <varname>$0</varname> is always set to the entire domain.
36343 </para>
36344 </listitem>
36345 <listitem>
36346 <para>
36347 <varname>$1</varname> is also set when partial matching is done in a file lookup.
36348 </para>
36349 </listitem>
36350 <listitem>
36351 <para>
36352 <indexterm role="variable">
36353 <primary><varname>$value</varname></primary>
36354 </indexterm>
36355 If the pattern that matched the domain was a lookup item, the data that was
36356 looked up is available in the expansion variable <varname>$value</varname>. For example:
36357 </para>
36358 <literallayout class="monospaced">
36359 route_list = lsearch;;/some/file.routes  $value
36360 </literallayout>
36361 </listitem>
36362 </itemizedlist>
36363 <para>
36364 Note the doubling of the semicolon in the pattern that is necessary because
36365 semicolon is the default route list separator.
36366 </para>
36367 </section>
36368 <section id="SECTformatonehostitem">
36369 <title>Format of one host item</title>
36370 <para>
36371 Each item in the list of hosts is either a host name or an IP address,
36372 optionally with an attached port number. When no port is given, an IP address
36373 is not enclosed in brackets. When a port is specified, it overrides the port
36374 specification on the transport. The port is separated from the name or address
36375 by a colon. This leads to some complications:
36376 </para>
36377 <itemizedlist>
36378 <listitem>
36379 <para>
36380 Because colon is the default separator for the list of hosts, either
36381 the colon that specifies a port must be doubled, or the list separator must
36382 be changed. The following two examples have the same effect:
36383 </para>
36384 <literallayout class="monospaced">
36385 route_list = * "host1.tld::1225 : host2.tld::1226"
36386 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
36387 </literallayout>
36388 </listitem>
36389 <listitem>
36390 <para>
36391 When IPv6 addresses are involved, it gets worse, because they contain
36392 colons of their own. To make this case easier, it is permitted to
36393 enclose an IP address (either v4 or v6) in square brackets if a port
36394 number follows. For example:
36395 </para>
36396 <literallayout class="monospaced">
36397 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
36398 </literallayout>
36399 </listitem>
36400 </itemizedlist>
36401 </section>
36402 <section id="SECThostshowused">
36403 <title>How the list of hosts is used</title>
36404 <para>
36405 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
36406 the hosts is tried, in the order specified, when carrying out the SMTP
36407 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
36408 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
36409 transport.
36410 </para>
36411 <para>
36412 Hosts may be listed by name or by IP address. An unadorned name in the list of
36413 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
36414 interpreted as an indirection to a sublist of hosts obtained by looking up MX
36415 records in the DNS. For example:
36416 </para>
36417 <literallayout class="monospaced">
36418 route_list = *  x.y.z:p.q.r/MX:e.f.g
36419 </literallayout>
36420 <para>
36421 If this feature is used with a port specifier, the port must come last. For
36422 example:
36423 </para>
36424 <literallayout class="monospaced">
36425 route_list = *  dom1.tld/mx::1225
36426 </literallayout>
36427 <para>
36428 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
36429 randomized before any lookups are done. Exim then scans the list; for any name
36430 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
36431 be an interface on the local host and the item is not the first in the list,
36432 Exim discards it and any subsequent items. If it is the first item, what
36433 happens is controlled by the
36434 <indexterm role="option">
36435 <primary><option>self</option></primary>
36436 <secondary>in <command>manualroute</command> router</secondary>
36437 </indexterm>
36438 <option>self</option> option of the router.
36439 </para>
36440 <para>
36441 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
36442 hosts obtained by looking up MX records for the name. This is always a DNS
36443 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
36444 below) are not relevant here. The order of these hosts is determined by the
36445 preference values in the MX records, according to the usual rules. Because
36446 randomizing happens before the MX lookup, it does not affect the order that is
36447 defined by MX preferences.
36448 </para>
36449 <para>
36450 If the local host is present in the sublist obtained from MX records, but is
36451 not the most preferred host in that list, it and any equally or less
36452 preferred hosts are removed before the sublist is inserted into the main list.
36453 </para>
36454 <para>
36455 If the local host is the most preferred host in the MX list, what happens
36456 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
36457 is not the first item (that is, there are previous hosts in the main list),
36458 Exim discards this name and any subsequent items in the main list.
36459 </para>
36460 <para>
36461 If the MX item is first in the list of hosts, and the local host is the
36462 most preferred host, what happens is controlled by the <option>self</option> option of the
36463 router.
36464 </para>
36465 <para>
36466 DNS failures when lookup up the MX records are treated in the same way as DNS
36467 failures when looking up IP addresses: <option>pass_on_timeout</option> and
36468 <option>host_find_failed</option> are used when relevant.
36469 </para>
36470 <para>
36471 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
36472 whether obtained from an MX lookup or not.
36473 </para>
36474 </section>
36475 <section id="SECThowoptused">
36476 <title>How the options are used</title>
36477 <para>
36478 The options are a sequence of words; in practice no more than three are ever
36479 present. One of the words can be the name of a transport; this overrides the
36480 <option>transport</option> option on the router for this particular routing rule only. The
36481 other words (if present) control randomization of the list of hosts on a
36482 per-rule basis, and how the IP addresses of the hosts are to be found when
36483 routing to a remote transport. These options are as follows:
36484 </para>
36485 <itemizedlist>
36486 <listitem>
36487 <para>
36488 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
36489 setting of <option>hosts_randomize</option> for this routing rule only.
36490 </para>
36491 </listitem>
36492 <listitem>
36493 <para>
36494 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
36495 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
36496 </para>
36497 </listitem>
36498 <listitem>
36499 <para>
36500 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
36501 find IP addresses. This function may ultimately cause a DNS lookup, but it may
36502 also look in <filename>/etc/hosts</filename> or other sources of information.
36503 </para>
36504 </listitem>
36505 <listitem>
36506 <para>
36507 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
36508 no address records are found. If there is a temporary DNS error (such as a
36509 timeout), delivery is deferred.
36510 </para>
36511 </listitem>
36512 </itemizedlist>
36513 <para>
36514 For example:
36515 </para>
36516 <literallayout class="monospaced">
36517 route_list = domain1  host1:host2:host3  randomize bydns;\
36518              domain2  host4:host5
36519 </literallayout>
36520 <para>
36521 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
36522 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
36523 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
36524 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
36525 call.
36526 </para>
36527 <para>
36528 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
36529 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
36530 instead of TRY_AGAIN. That is why the default action is to try a DNS
36531 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
36532 function called.
36533 </para>
36534 <para>
36535 If no IP address for a host can be found, what happens is controlled by the
36536 <option>host_find_failed</option> option.
36537 </para>
36538 <para>
36539 <indexterm role="variable">
36540 <primary><varname>$host</varname></primary>
36541 </indexterm>
36542 When an address is routed to a local transport, IP addresses are not looked up.
36543 The host list is passed to the transport in the <varname>$host</varname> variable.
36544 </para>
36545 </section>
36546 <section id="SECID123">
36547 <title>Manualroute examples</title>
36548 <para>
36549 In some of the examples that follow, the presence of the <option>remote_smtp</option>
36550 transport, as defined in the default configuration file, is assumed:
36551 </para>
36552 <itemizedlist>
36553 <listitem>
36554 <para>
36555 <indexterm role="concept">
36556 <primary>smart host</primary>
36557 <secondary>example router</secondary>
36558 </indexterm>
36559 The <command>manualroute</command> router can be used to forward all external mail to a
36560 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
36561 named domain list that contains your local domains, for example:
36562 </para>
36563 <literallayout class="monospaced">
36564 domainlist local_domains = my.domain.example
36565 </literallayout>
36566 <para>
36567 You can arrange for all other domains to be routed to a smart host by making
36568 your first router something like this:
36569 </para>
36570 <literallayout class="monospaced">
36571 smart_route:
36572   driver = manualroute
36573   domains = !+local_domains
36574   transport = remote_smtp
36575   route_list = * smarthost.ref.example
36576 </literallayout>
36577 <para>
36578 This causes all non-local addresses to be sent to the single host
36579 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
36580 they are tried in order
36581 (but you can use <option>hosts_randomize</option> to vary the order each time).
36582 Another way of configuring the same thing is this:
36583 </para>
36584 <literallayout class="monospaced">
36585 smart_route:
36586   driver = manualroute
36587   transport = remote_smtp
36588   route_list = !+local_domains  smarthost.ref.example
36589 </literallayout>
36590 <para>
36591 There is no difference in behaviour between these two routers as they stand.
36592 However, they behave differently if <option>no_more</option> is added to them. In the first
36593 example, the router is skipped if the domain does not match the <option>domains</option>
36594 precondition; the following router is always tried. If the router runs, it
36595 always matches the domain and so can never decline. Therefore, <option>no_more</option>
36596 would have no effect. In the second case, the router is never skipped; it
36597 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
36598 <option>no_more</option> would prevent subsequent routers from running.
36599 </para>
36600 </listitem>
36601 <listitem>
36602 <para>
36603 <indexterm role="concept">
36604 <primary>mail hub example</primary>
36605 </indexterm>
36606 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
36607 records in the DNS and delivers it via its own private routing mechanism. Often
36608 the final destinations are behind a firewall, with the mail hub being the one
36609 machine that can connect to machines both inside and outside the firewall. The
36610 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
36611 to the correct hosts. For a small number of domains, the routing can be inline,
36612 using the <option>route_list</option> option, but for a larger number a file or database
36613 lookup is easier to manage.
36614 </para>
36615 <para>
36616 If the domain names are in fact the names of the machines to which the mail is
36617 to be sent by the mail hub, the configuration can be quite simple. For
36618 example:
36619 </para>
36620 <literallayout class="monospaced">
36621 hub_route:
36622   driver = manualroute
36623   transport = remote_smtp
36624   route_list = *.rhodes.tvs.example  $domain
36625 </literallayout>
36626 <para>
36627 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
36628 whose names are the same as the mail domains. A similar approach can be taken
36629 if the host name can be obtained from the domain name by a string manipulation
36630 that the expansion facilities can handle. Otherwise, a lookup based on the
36631 domain can be used to find the host:
36632 </para>
36633 <literallayout class="monospaced">
36634 through_firewall:
36635   driver = manualroute
36636   transport = remote_smtp
36637   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
36638 </literallayout>
36639 <para>
36640 The result of the lookup must be the name or IP address of the host (or
36641 hosts) to which the address is to be routed. If the lookup fails, the route
36642 data is empty, causing the router to decline. The address then passes to the
36643 next router.
36644 </para>
36645 </listitem>
36646 <listitem>
36647 <para>
36648 <indexterm role="concept">
36649 <primary>batched SMTP output example</primary>
36650 </indexterm>
36651 <indexterm role="concept">
36652 <primary>SMTP</primary>
36653 <secondary>batched outgoing; example</secondary>
36654 </indexterm>
36655 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
36656 SMTP format for onward transportation by some other means. This is one way of
36657 storing mail for a dial-up host when it is not connected. The route list entry
36658 can be as simple as a single domain name in a configuration like this:
36659 </para>
36660 <literallayout class="monospaced">
36661 save_in_file:
36662   driver = manualroute
36663   transport = batchsmtp_appendfile
36664   route_list = saved.domain.example
36665 </literallayout>
36666 <para>
36667 though often a pattern is used to pick up more than one domain. If there are
36668 several domains or groups of domains with different transport requirements,
36669 different transports can be listed in the routing information:
36670 </para>
36671 <literallayout class="monospaced">
36672 save_in_file:
36673   driver = manualroute
36674   route_list = \
36675     *.saved.domain1.example  $domain  batch_appendfile; \
36676     *.saved.domain2.example  \
36677       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
36678       batch_pipe
36679 </literallayout>
36680 <para>
36681 <indexterm role="variable">
36682 <primary><varname>$domain</varname></primary>
36683 </indexterm>
36684 <indexterm role="variable">
36685 <primary><varname>$host</varname></primary>
36686 </indexterm>
36687 The first of these just passes the domain in the <varname>$host</varname> variable, which
36688 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
36689 file lookup to find a value to pass, causing the router to decline to handle
36690 the address if the lookup fails.
36691 </para>
36692 </listitem>
36693 <listitem>
36694 <para>
36695 <indexterm role="concept">
36696 <primary>UUCP</primary>
36697 <secondary>example of router for</secondary>
36698 </indexterm>
36699 Routing mail directly to UUCP software is a specific case of the use of
36700 <command>manualroute</command> in a gateway to another mail environment. This is an example of
36701 one way it can be done:
36702 </para>
36703 <literallayout class="monospaced">
36704 # Transport
36705 uucp:
36706   driver = pipe
36707   user = nobody
36708   command = /usr/local/bin/uux -r - \
36709     ${substr_-5:$host}!rmail ${local_part}
36710   return_fail_output = true
36711
36712 # Router
36713 uucphost:
36714   transport = uucp
36715   driver = manualroute
36716   route_data = \
36717     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
36718 </literallayout>
36719 <para>
36720 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
36721 </para>
36722 <literallayout class="monospaced">
36723 darksite.ethereal.example:           darksite.UUCP
36724 </literallayout>
36725 <para>
36726 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
36727 makes clear the distinction between the domain name
36728 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
36729 </para>
36730 </listitem>
36731 </itemizedlist>
36732 <para>
36733 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
36734 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
36735 </para>
36736 </section>
36737 </chapter>
36738
36739 <chapter id="CHAPdriverlast">
36740 <title>The queryprogram router</title>
36741 <para>
36742 <indexterm role="concept" id="IIDquerou1" class="startofrange">
36743 <primary><command>queryprogram</command> router</primary>
36744 </indexterm>
36745 <indexterm role="concept" id="IIDquerou2" class="startofrange">
36746 <primary>routers</primary>
36747 <secondary><command>queryprogram</command></secondary>
36748 </indexterm>
36749 <indexterm role="concept">
36750 <primary>routing</primary>
36751 <secondary>by external program</secondary>
36752 </indexterm>
36753 The <command>queryprogram</command> router routes an address by running an external command
36754 and acting on its output. This is an expensive way to route, and is intended
36755 mainly for use in lightly-loaded systems, or for performing experiments.
36756 However, if it is possible to use the precondition options (<option>domains</option>,
36757 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
36758 be used in special cases, even on a busy host. There are the following private
36759 options:
36760 <indexterm role="concept">
36761 <primary>options</primary>
36762 <secondary><command>queryprogram</command> router</secondary>
36763 </indexterm>
36764 </para>
36765 <para>
36766 <indexterm role="option">
36767 <primary><option>command</option></primary>
36768 </indexterm>
36769 </para>
36770 <informaltable frame="all">
36771 <tgroup cols="4" colsep="0" rowsep="0">
36772 <colspec colwidth="8*" align="left"/>
36773 <colspec colwidth="6*" align="center"/>
36774 <colspec colwidth="6*" align="center"/>
36775 <colspec colwidth="6*" align="right"/>
36776 <tbody>
36777 <row>
36778 <entry><option>command</option></entry>
36779 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36781 <entry>Default: <emphasis>unset</emphasis></entry>
36782 </row>
36783 </tbody>
36784 </tgroup>
36785 </informaltable>
36786 <para>
36787 This option must be set. It specifies the command that is to be run. The
36788 command is split up into a command name and arguments, and then each is
36789 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
36790 <xref linkend="CHAPpipetransport"/>).
36791 </para>
36792 <para>
36793 <indexterm role="option">
36794 <primary><option>command_group</option></primary>
36795 </indexterm>
36796 </para>
36797 <informaltable frame="all">
36798 <tgroup cols="4" colsep="0" rowsep="0">
36799 <colspec colwidth="8*" align="left"/>
36800 <colspec colwidth="6*" align="center"/>
36801 <colspec colwidth="6*" align="center"/>
36802 <colspec colwidth="6*" align="right"/>
36803 <tbody>
36804 <row>
36805 <entry><option>command_group</option></entry>
36806 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36807 <entry>Type: <emphasis>string</emphasis></entry>
36808 <entry>Default: <emphasis>unset</emphasis></entry>
36809 </row>
36810 </tbody>
36811 </tgroup>
36812 </informaltable>
36813 <para>
36814 <indexterm role="concept">
36815 <primary>gid (group id)</primary>
36816 <secondary>in <command>queryprogram</command> router</secondary>
36817 </indexterm>
36818 This option specifies a gid to be set when running the command while routing an
36819 address for deliver. It must be set if <option>command_user</option> specifies a numerical
36820 uid. If it begins with a digit, it is interpreted as the numerical value of the
36821 gid. Otherwise it is looked up using <function>getgrnam()</function>.
36822 </para>
36823 <para>
36824 <indexterm role="option">
36825 <primary><option>command_user</option></primary>
36826 </indexterm>
36827 </para>
36828 <informaltable frame="all">
36829 <tgroup cols="4" colsep="0" rowsep="0">
36830 <colspec colwidth="8*" align="left"/>
36831 <colspec colwidth="6*" align="center"/>
36832 <colspec colwidth="6*" align="center"/>
36833 <colspec colwidth="6*" align="right"/>
36834 <tbody>
36835 <row>
36836 <entry><option>command_user</option></entry>
36837 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36838 <entry>Type: <emphasis>string</emphasis></entry>
36839 <entry>Default: <emphasis>unset</emphasis></entry>
36840 </row>
36841 </tbody>
36842 </tgroup>
36843 </informaltable>
36844 <para>
36845 <indexterm role="concept">
36846 <primary>uid (user id)</primary>
36847 <secondary>for <command>queryprogram</command></secondary>
36848 </indexterm>
36849 This option must be set. It specifies the uid which is set when running the
36850 command while routing an address for delivery. If the value begins with a digit,
36851 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
36852 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
36853 not set, a value for the gid also.
36854 </para>
36855 <para>
36856 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
36857 root, which it does during a normal delivery in a conventional configuration.
36858 However, when an address is being verified during message reception, Exim is
36859 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
36860 is called from a non-root process, Exim cannot change uid or gid before running
36861 the command. In this circumstance the command runs under the current uid and
36862 gid.
36863 </para>
36864 <para>
36865 <indexterm role="option">
36866 <primary><option>current_directory</option></primary>
36867 </indexterm>
36868 </para>
36869 <informaltable frame="all">
36870 <tgroup cols="4" colsep="0" rowsep="0">
36871 <colspec colwidth="8*" align="left"/>
36872 <colspec colwidth="6*" align="center"/>
36873 <colspec colwidth="6*" align="center"/>
36874 <colspec colwidth="6*" align="right"/>
36875 <tbody>
36876 <row>
36877 <entry><option>current_directory</option></entry>
36878 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36879 <entry>Type: <emphasis>string</emphasis></entry>
36880 <entry>Default: <emphasis>/</emphasis></entry>
36881 </row>
36882 </tbody>
36883 </tgroup>
36884 </informaltable>
36885 <para>
36886 This option specifies an absolute path which is made the current directory
36887 before running the command.
36888 </para>
36889 <para>
36890 <indexterm role="option">
36891 <primary><option>timeout</option></primary>
36892 </indexterm>
36893 </para>
36894 <informaltable frame="all">
36895 <tgroup cols="4" colsep="0" rowsep="0">
36896 <colspec colwidth="8*" align="left"/>
36897 <colspec colwidth="6*" align="center"/>
36898 <colspec colwidth="6*" align="center"/>
36899 <colspec colwidth="6*" align="right"/>
36900 <tbody>
36901 <row>
36902 <entry><option>timeout</option></entry>
36903 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36904 <entry>Type: <emphasis>time</emphasis></entry>
36905 <entry>Default: <emphasis>1h</emphasis></entry>
36906 </row>
36907 </tbody>
36908 </tgroup>
36909 </informaltable>
36910 <para>
36911 If the command does not complete within the timeout period, its process group
36912 is killed and the message is frozen. A value of zero time specifies no
36913 timeout.
36914 </para>
36915 <para>
36916 The standard output of the command is connected to a pipe, which is read when
36917 the command terminates. It should consist of a single line of output,
36918 containing up to five fields, separated by white space. The maximum length of
36919 the line is 1023 characters. Longer lines are silently truncated. The first
36920 field is one of the following words (case-insensitive):
36921 </para>
36922 <itemizedlist>
36923 <listitem>
36924 <para>
36925 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
36926 below).
36927 </para>
36928 </listitem>
36929 <listitem>
36930 <para>
36931 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
36932 <option>no_more</option> is set.
36933 </para>
36934 </listitem>
36935 <listitem>
36936 <para>
36937 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
36938 subsequent text on the line is an error message. If the router is run as part
36939 of address verification during an incoming SMTP message, the message is
36940 included in the SMTP response.
36941 </para>
36942 </listitem>
36943 <listitem>
36944 <para>
36945 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
36946 subsequent text on the line is an error message which is logged. It is not
36947 included in any SMTP response.
36948 </para>
36949 </listitem>
36950 <listitem>
36951 <para>
36952 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
36953 </para>
36954 </listitem>
36955 <listitem>
36956 <para>
36957 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
36958 <option>pass_router</option>), overriding <option>no_more</option>.
36959 </para>
36960 </listitem>
36961 <listitem>
36962 <para>
36963 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
36964 new addresses, which are routed independently, starting with the first router,
36965 or the router specified by <option>redirect_router</option>, if set.
36966 </para>
36967 </listitem>
36968 </itemizedlist>
36969 <para>
36970 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
36971 number of keyed data values, as follows (split into two lines here, to fit on
36972 the page):
36973 </para>
36974 <literallayout class="monospaced">
36975 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
36976 LOOKUP=byname|bydns DATA=&lt;text&gt;
36977 </literallayout>
36978 <para>
36979 The data items can be given in any order, and all are optional. If no transport
36980 is included, the transport specified by the generic <option>transport</option> option is
36981 used. The list of hosts and the lookup type are needed only if the transport is
36982 an <command>smtp</command> transport that does not itself supply a list of hosts.
36983 </para>
36984 <para>
36985 The format of the list of hosts is the same as for the <command>manualroute</command> router.
36986 As well as host names and IP addresses with optional port numbers, as described
36987 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
36988 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
36989 (see section <xref linkend="SECThostshowused"/>).
36990 </para>
36991 <para>
36992 If the lookup type is not specified, Exim behaves as follows when trying to
36993 find an IP address for each host: First, a DNS lookup is done. If this yields
36994 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
36995 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
36996 result of the lookup is the result of that call.
36997 </para>
36998 <para>
36999 <indexterm role="variable">
37000 <primary><varname>$address_data</varname></primary>
37001 </indexterm>
37002 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
37003 variable. For example, this return line
37004 </para>
37005 <literallayout class="monospaced">
37006 accept hosts=x1.y.example:x2.y.example data="rule1"
37007 </literallayout>
37008 <para>
37009 routes the address to the default transport, passing a list of two hosts. When
37010 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
37011 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
37012 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
37013 </para>
37014 </chapter>
37015
37016 <chapter id="CHAPredirect">
37017 <title>The redirect router</title>
37018 <para>
37019 <indexterm role="concept" id="IIDredrou1" class="startofrange">
37020 <primary><command>redirect</command> router</primary>
37021 </indexterm>
37022 <indexterm role="concept" id="IIDredrou2" class="startofrange">
37023 <primary>routers</primary>
37024 <secondary><command>redirect</command></secondary>
37025 </indexterm>
37026 <indexterm role="concept">
37027 <primary>alias file</primary>
37028 <secondary>in a <command>redirect</command> router</secondary>
37029 </indexterm>
37030 <indexterm role="concept">
37031 <primary>address redirection</primary>
37032 <secondary><command>redirect</command> router</secondary>
37033 </indexterm>
37034 The <command>redirect</command> router handles several kinds of address redirection. Its most
37035 common uses are for resolving local part aliases from a central alias file
37036 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
37037 files, but it has many other potential uses. The incoming address can be
37038 redirected in several different ways:
37039 </para>
37040 <itemizedlist>
37041 <listitem>
37042 <para>
37043 It can be replaced by one or more new addresses which are themselves routed
37044 independently.
37045 </para>
37046 </listitem>
37047 <listitem>
37048 <para>
37049 It can be routed to be delivered to a given file or directory.
37050 </para>
37051 </listitem>
37052 <listitem>
37053 <para>
37054 It can be routed to be delivered to a specified pipe command.
37055 </para>
37056 </listitem>
37057 <listitem>
37058 <para>
37059 It can cause an automatic reply to be generated.
37060 </para>
37061 </listitem>
37062 <listitem>
37063 <para>
37064 It can be forced to fail, optionally with a custom error message.
37065 </para>
37066 </listitem>
37067 <listitem>
37068 <para>
37069 It can be temporarily deferred, optionally with a custom message.
37070 </para>
37071 </listitem>
37072 <listitem>
37073 <para>
37074 It can be discarded.
37075 </para>
37076 </listitem>
37077 </itemizedlist>
37078 <para>
37079 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
37080 However, there are some private options which define transports for delivery to
37081 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
37082 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
37083 </para>
37084 <para>
37085 If success DSNs have been requested
37086 <indexterm role="concept">
37087 <primary>DSN</primary>
37088 <secondary>success</secondary>
37089 </indexterm>
37090 <indexterm role="concept">
37091 <primary>Delivery Status Notification</primary>
37092 <secondary>success</secondary>
37093 </indexterm>
37094 redirection triggers one and the DSN options are not passed any further.
37095 </para>
37096 <section id="SECID124">
37097 <title>Redirection data</title>
37098 <para>
37099 The router operates by interpreting a text string which it obtains either by
37100 expanding the contents of the <option>data</option> option, or by reading the entire
37101 contents of a file whose name is given in the <option>file</option> option. These two
37102 options are mutually exclusive. The first is commonly used for handling system
37103 aliases, in a configuration like this:
37104 </para>
37105 <literallayout class="monospaced">
37106 system_aliases:
37107   driver = redirect
37108   data = ${lookup{$local_part}lsearch{/etc/aliases}}
37109 </literallayout>
37110 <para>
37111 If the lookup fails, the expanded string in this example is empty. When the
37112 expansion of <option>data</option> results in an empty string, the router declines. A forced
37113 expansion failure also causes the router to decline; other expansion failures
37114 cause delivery to be deferred.
37115 </para>
37116 <para>
37117 A configuration using <option>file</option> is commonly used for handling users&#x2019;
37118 <filename>.forward</filename> files, like this:
37119 </para>
37120 <literallayout class="monospaced">
37121 userforward:
37122   driver = redirect
37123   check_local_user
37124   file = $home/.forward
37125   no_verify
37126 </literallayout>
37127 <para>
37128 If the file does not exist, or causes no action to be taken (for example, it is
37129 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
37130 is not the case when the file contains syntactically valid items that happen to
37131 yield empty addresses, for example, items containing only RFC 2822 address
37132 comments.
37133 </para>
37134 </section>
37135 <section id="SECID125">
37136 <title>Forward files and address verification</title>
37137 <para>
37138 <indexterm role="concept">
37139 <primary>address redirection</primary>
37140 <secondary>while verifying</secondary>
37141 </indexterm>
37142 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
37143 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
37144 </para>
37145 <itemizedlist>
37146 <listitem>
37147 <para>
37148 When Exim is receiving an incoming SMTP message from a remote host, it is
37149 running under the Exim uid, not as root. Exim is unable to change uid to read
37150 the file as the user, and it may not be able to read it as the Exim user. So in
37151 practice the router may not be able to operate.
37152 </para>
37153 </listitem>
37154 <listitem>
37155 <para>
37156 However, even when the router can operate, the existence of a <filename>.forward</filename> file
37157 is unimportant when verifying an address. What should be checked is whether the
37158 local part is a valid user name or not. Cutting out the redirection processing
37159 saves some resources.
37160 </para>
37161 </listitem>
37162 </itemizedlist>
37163 </section>
37164 <section id="SECID126">
37165 <title>Interpreting redirection data</title>
37166 <para>
37167 <indexterm role="concept">
37168 <primary>Sieve filter</primary>
37169 <secondary>specifying in redirection data</secondary>
37170 </indexterm>
37171 <indexterm role="concept">
37172 <primary>filter</primary>
37173 <secondary>specifying in redirection data</secondary>
37174 </indexterm>
37175 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
37176 can be interpreted in two different ways:
37177 </para>
37178 <itemizedlist>
37179 <listitem>
37180 <para>
37181 If the <option>allow_filter</option> option is set true, and the data begins with the text
37182 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
37183 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
37184 respectively. Details of the syntax and semantics of filter files are described
37185 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
37186 document is intended for use by end users.
37187 </para>
37188 </listitem>
37189 <listitem>
37190 <para>
37191 Otherwise, the data must be a comma-separated list of redirection items, as
37192 described in the next section.
37193 </para>
37194 </listitem>
37195 </itemizedlist>
37196 <para>
37197 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
37198 in a non-filter redirection list must always be an absolute path. A filter may
37199 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
37200 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
37201 for the <command>appendfile</command> transport.
37202 </para>
37203 </section>
37204 <section id="SECTitenonfilred">
37205 <title>Items in a non-filter redirection list</title>
37206 <para>
37207 <indexterm role="concept">
37208 <primary>address redirection</primary>
37209 <secondary>non-filter list items</secondary>
37210 </indexterm>
37211 When the redirection data is not an Exim or Sieve filter, for example, if it
37212 comes from a conventional alias or forward file, it consists of a list of
37213 addresses, file names, pipe commands, or certain special items (see section
37214 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
37215 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
37216 depending on their default values. The items in the list are separated by
37217 commas or newlines.
37218 If a comma is required in an item, the entire item must be enclosed in double
37219 quotes.
37220 </para>
37221 <para>
37222 Lines starting with a # character are comments, and are ignored, and # may
37223 also appear following a comma, in which case everything between the # and the
37224 next newline character is ignored.
37225 </para>
37226 <para>
37227 If an item is entirely enclosed in double quotes, these are removed. Otherwise
37228 double quotes are retained because some forms of mail address require their use
37229 (but never to enclose the entire address). In the following description,
37230 <quote>item</quote> refers to what remains after any surrounding double quotes have been
37231 removed.
37232 </para>
37233 <para>
37234 <indexterm role="variable">
37235 <primary><varname>$local_part</varname></primary>
37236 </indexterm>
37237 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
37238 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
37239 of the <option>quote_local_part</option> expansion operator, in case the local part contains
37240 special characters. For example, to redirect all mail for the domain
37241 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
37242 setting:
37243 </para>
37244 <literallayout class="monospaced">
37245 data = ${quote_local_part:$local_part}@newdomain.example
37246 </literallayout>
37247 </section>
37248 <section id="SECTredlocmai">
37249 <title>Redirecting to a local mailbox</title>
37250 <para>
37251 <indexterm role="concept">
37252 <primary>routing</primary>
37253 <secondary>loops in</secondary>
37254 </indexterm>
37255 <indexterm role="concept">
37256 <primary>loop</primary>
37257 <secondary>while routing, avoidance of</secondary>
37258 </indexterm>
37259 <indexterm role="concept">
37260 <primary>address redirection</primary>
37261 <secondary>to local mailbox</secondary>
37262 </indexterm>
37263 A redirection item may safely be the same as the address currently under
37264 consideration. This does not cause a routing loop, because a router is
37265 automatically skipped if any ancestor of the address that is being processed
37266 is the same as the current address and was processed by the current router.
37267 Such an address is therefore passed to the following routers, so it is handled
37268 as if there were no redirection. When making this loop-avoidance test, the
37269 complete local part, including any prefix or suffix, is used.
37270 </para>
37271 <para>
37272 <indexterm role="concept">
37273 <primary>address redirection</primary>
37274 <secondary>local part without domain</secondary>
37275 </indexterm>
37276 Specifying the same local part without a domain is a common usage in personal
37277 filter files when the user wants to have messages delivered to the local
37278 mailbox and also forwarded elsewhere. For example, the user whose login is
37279 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
37280 </para>
37281 <literallayout class="monospaced">
37282 cleo, cleopatra@egypt.example
37283 </literallayout>
37284 <para>
37285 <indexterm role="concept">
37286 <primary>backslash in alias file</primary>
37287 </indexterm>
37288 <indexterm role="concept">
37289 <primary>alias file</primary>
37290 <secondary>backslash in</secondary>
37291 </indexterm>
37292 For compatibility with other MTAs, such unqualified local parts may be
37293 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
37294 it does make a difference if more than one domain is being handled
37295 synonymously.
37296 </para>
37297 <para>
37298 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
37299 2822 address that does not include a domain, the item is qualified using the
37300 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
37301 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
37302 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
37303 </para>
37304 <para>
37305 Care must be taken if there are alias names for local users.
37306 Consider an MTA handling a single local domain where the system alias file
37307 contains:
37308 </para>
37309 <literallayout class="monospaced">
37310 Sam.Reman: spqr
37311 </literallayout>
37312 <para>
37313 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
37314 messages in the local mailbox, and also forward copies elsewhere. He creates
37315 this forward file:
37316 </para>
37317 <literallayout class="monospaced">
37318 Sam.Reman, spqr@reme.elsewhere.example
37319 </literallayout>
37320 <para>
37321 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
37322 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
37323 second time round, because it has previously routed it,
37324 and the following routers presumably cannot handle the alias. The forward file
37325 should really contain
37326 </para>
37327 <literallayout class="monospaced">
37328 spqr, spqr@reme.elsewhere.example
37329 </literallayout>
37330 <para>
37331 but because this is such a common error, the <option>check_ancestor</option> option (see
37332 below) exists to provide a way to get round it. This is normally set on a
37333 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
37334 </para>
37335 </section>
37336 <section id="SECTspecitredli">
37337 <title>Special items in redirection lists</title>
37338 <para>
37339 In addition to addresses, the following types of item may appear in redirection
37340 lists (that is, in non-filter redirection data):
37341 </para>
37342 <itemizedlist>
37343 <listitem>
37344 <para>
37345 <indexterm role="concept">
37346 <primary>pipe</primary>
37347 <secondary>in redirection list</secondary>
37348 </indexterm>
37349 <indexterm role="concept">
37350 <primary>address redirection</primary>
37351 <secondary>to pipe</secondary>
37352 </indexterm>
37353 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
37354 as a valid RFC 2822 address that includes a domain. A transport for running the
37355 command must be specified by the <option>pipe_transport</option> option.
37356 Normally, either the router or the transport specifies a user and a group under
37357 which to run the delivery. The default is to use the Exim user and group.
37358 </para>
37359 <para>
37360 Single or double quotes can be used for enclosing the individual arguments of
37361 the pipe command; no interpretation of escapes is done for single quotes. If
37362 the command contains a comma character, it is necessary to put the whole item
37363 in double quotes, for example:
37364 </para>
37365 <literallayout class="monospaced">
37366 "|/some/command ready,steady,go"
37367 </literallayout>
37368 <para>
37369 since items in redirection lists are terminated by commas. Do not, however,
37370 quote just the command. An item such as
37371 </para>
37372 <literallayout class="monospaced">
37373 |"/some/command ready,steady,go"
37374 </literallayout>
37375 <para>
37376 is interpreted as a pipe with a rather strange command name, and no arguments.
37377 </para>
37378 <para>
37379 Note that the above example assumes that the text comes from a lookup source
37380 of some sort, so that the quotes are part of the data.  If composing a
37381 redirect router with a <option>data</option> option directly specifying this command, the
37382 quotes will be used by the configuration parser to define the extent of one
37383 string, but will not be passed down into the redirect router itself.  There
37384 are two main approaches to get around this: escape quotes to be part of the
37385 data itself, or avoid using this mechanism and instead create a custom
37386 transport with the <option>command</option> option set and reference that transport from
37387 an <option>accept</option> router.
37388 </para>
37389 </listitem>
37390 <listitem>
37391 <para>
37392 <indexterm role="concept">
37393 <primary>file</primary>
37394 <secondary>in redirection list</secondary>
37395 </indexterm>
37396 <indexterm role="concept">
37397 <primary>address redirection</primary>
37398 <secondary>to file</secondary>
37399 </indexterm>
37400 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
37401 parse as a valid RFC 2822 address that includes a domain. For example,
37402 </para>
37403 <literallayout class="monospaced">
37404 /home/world/minbari
37405 </literallayout>
37406 <para>
37407 is treated as a file name, but
37408 </para>
37409 <literallayout class="monospaced">
37410 /s=molari/o=babylon/@x400gate.way
37411 </literallayout>
37412 <para>
37413 is treated as an address. For a file name, a transport must be specified using
37414 the <option>file_transport</option> option. However, if the generated path name ends with a
37415 forward slash character, it is interpreted as a directory name rather than a
37416 file name, and <option>directory_transport</option> is used instead.
37417 </para>
37418 <para>
37419 Normally, either the router or the transport specifies a user and a group under
37420 which to run the delivery. The default is to use the Exim user and group.
37421 </para>
37422 <para>
37423 <indexterm role="concept">
37424 <primary><filename>/dev/null</filename></primary>
37425 </indexterm>
37426 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
37427 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
37428 instead of a transport name. In this case the user and group are not used.
37429 </para>
37430 </listitem>
37431 <listitem>
37432 <para>
37433 <indexterm role="concept">
37434 <primary>included address list</primary>
37435 </indexterm>
37436 <indexterm role="concept">
37437 <primary>address redirection</primary>
37438 <secondary>included external list</secondary>
37439 </indexterm>
37440 If an item is of the form
37441 </para>
37442 <literallayout class="monospaced">
37443 :include:&lt;path name&gt;
37444 </literallayout>
37445 <para>
37446 a list of further items is taken from the given file and included at that
37447 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
37448 out-of-line addition to the list. The items in the included list are separated
37449 by commas or newlines and are not subject to expansion. If this is the first
37450 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
37451 the alias name. This example is incorrect:
37452 </para>
37453 <literallayout class="monospaced">
37454 list1    :include:/opt/lists/list1
37455 </literallayout>
37456 <para>
37457 It must be given as
37458 </para>
37459 <literallayout class="monospaced">
37460 list1:   :include:/opt/lists/list1
37461 </literallayout>
37462 </listitem>
37463 <listitem>
37464 <para>
37465 <indexterm role="concept">
37466 <primary>address redirection</primary>
37467 <secondary>to black hole</secondary>
37468 </indexterm>
37469 <indexterm role="concept">
37470 <primary>delivery</primary>
37471 <secondary>discard</secondary>
37472 </indexterm>
37473 <indexterm role="concept">
37474 <primary>delivery</primary>
37475 <secondary>blackhole</secondary>
37476 </indexterm>
37477 <indexterm role="concept">
37478 <primary>black hole</primary>
37479 </indexterm>
37480 <indexterm role="concept">
37481 <primary>abandoning mail</primary>
37482 </indexterm>
37483 Sometimes you want to throw away mail to a particular local part.  Making the
37484 <option>data</option> option expand to an empty string does not work, because that causes
37485 the router to decline. Instead, the alias item
37486 </para>
37487 <literallayout class="monospaced">
37488 :blackhole:
37489 </literallayout>
37490 <para>
37491 can be used. It does what its name implies. No delivery is
37492 done, and no error message is generated. This has the same effect as specifying
37493 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
37494 </para>
37495 <para>
37496 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
37497 delivery is done for the original local part, even if other redirection items
37498 are present. If you are generating a multi-item list (for example, by reading a
37499 database) and need the ability to provide a no-op item, you must use
37500 <filename>/dev/null</filename>.
37501 </para>
37502 </listitem>
37503 <listitem>
37504 <para>
37505 <indexterm role="concept">
37506 <primary>delivery</primary>
37507 <secondary>forcing failure</secondary>
37508 </indexterm>
37509 <indexterm role="concept">
37510 <primary>delivery</primary>
37511 <secondary>forcing deferral</secondary>
37512 </indexterm>
37513 <indexterm role="concept">
37514 <primary>failing delivery</primary>
37515 <secondary>forcing</secondary>
37516 </indexterm>
37517 <indexterm role="concept">
37518 <primary>deferred delivery, forcing</primary>
37519 </indexterm>
37520 <indexterm role="concept">
37521 <primary>customizing</primary>
37522 <secondary>failure message</secondary>
37523 </indexterm>
37524 An attempt to deliver a particular address can be deferred or forced to fail by
37525 redirection items of the form
37526 </para>
37527 <literallayout class="monospaced">
37528 :defer:
37529 :fail:
37530 </literallayout>
37531 <para>
37532 respectively. When a redirection list contains such an item, it applies
37533 to the entire redirection; any other items in the list are ignored. Any
37534 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
37535 associated with the failure. For example, an alias file might contain:
37536 </para>
37537 <literallayout class="monospaced">
37538 X.Employee:  :fail: Gone away, no forwarding address
37539 </literallayout>
37540 <para>
37541 In the case of an address that is being verified from an ACL or as the subject
37542 of a
37543 <indexterm role="concept">
37544 <primary>VRFY</primary>
37545 <secondary>error text, display of</secondary>
37546 </indexterm>
37547 VRFY command, the text is included in the SMTP error response by
37548 default.
37549 <indexterm role="concept">
37550 <primary>EXPN</primary>
37551 <secondary>error text, display of</secondary>
37552 </indexterm>
37553 The text is not included in the response to an EXPN command. In non-SMTP cases
37554 the text is included in the error message that Exim generates.
37555 </para>
37556 <para>
37557 <indexterm role="concept">
37558 <primary>SMTP</primary>
37559 <secondary>error codes</secondary>
37560 </indexterm>
37561 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
37562 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
37563 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
37564 followed by a space, and the very first digit is the same as the default error
37565 code, the code from the message is used instead. If the very first digit is
37566 incorrect, a panic error is logged, and the default code is used. You can
37567 suppress the use of the supplied code in a redirect router by setting the
37568 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
37569 ignored.
37570 </para>
37571 <para>
37572 <indexterm role="variable">
37573 <primary><varname>$acl_verify_message</varname></primary>
37574 </indexterm>
37575 In an ACL, an explicitly provided message overrides the default, but the
37576 default message is available in the variable <varname>$acl_verify_message</varname> and can
37577 therefore be included in a custom message if this is desired.
37578 </para>
37579 <para>
37580 Normally the error text is the rest of the redirection list &ndash; a comma does
37581 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
37582 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
37583 as part of the continuation process, but they may exist in other kinds of
37584 lookup and in <emphasis>:include:</emphasis> files.
37585 </para>
37586 <para>
37587 During routing for message delivery (as opposed to verification), a redirection
37588 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
37589 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
37590 subsequent delivery attempt can happen at a later time. If an address is
37591 deferred for too long, it will ultimately fail, because the normal retry
37592 rules still apply.
37593 </para>
37594 </listitem>
37595 <listitem>
37596 <para>
37597 <indexterm role="concept">
37598 <primary>alias file</primary>
37599 <secondary>exception to default</secondary>
37600 </indexterm>
37601 Sometimes it is useful to use a single-key search type with a default (see
37602 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
37603 for exceptions to the default. These can be handled by aliasing them to
37604 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
37605 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
37606 results in an empty redirection list has the same effect.
37607 </para>
37608 </listitem>
37609 </itemizedlist>
37610 </section>
37611 <section id="SECTdupaddr">
37612 <title>Duplicate addresses</title>
37613 <para>
37614 <indexterm role="concept">
37615 <primary>duplicate addresses</primary>
37616 </indexterm>
37617 <indexterm role="concept">
37618 <primary>address duplicate, discarding</primary>
37619 </indexterm>
37620 <indexterm role="concept">
37621 <primary>pipe</primary>
37622 <secondary>duplicated</secondary>
37623 </indexterm>
37624 Exim removes duplicate addresses from the list to which it is delivering, so as
37625 to deliver just one copy to each address. This does not apply to deliveries
37626 routed to pipes by different immediate parent addresses, but an indirect
37627 aliasing scheme of the type
37628 </para>
37629 <literallayout class="monospaced">
37630 pipe:       |/some/command $local_part
37631 localpart1: pipe
37632 localpart2: pipe
37633 </literallayout>
37634 <para>
37635 does not work with a message that is addressed to both local parts, because
37636 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
37637 discarded as being the same as a previously handled address. However, a scheme
37638 such as
37639 </para>
37640 <literallayout class="monospaced">
37641 localpart1: |/some/command $local_part
37642 localpart2: |/some/command $local_part
37643 </literallayout>
37644 <para>
37645 does result in two different pipe deliveries, because the immediate parents of
37646 the pipes are distinct.
37647 </para>
37648 </section>
37649 <section id="SECID128">
37650 <title>Repeated redirection expansion</title>
37651 <para>
37652 <indexterm role="concept">
37653 <primary>repeated redirection expansion</primary>
37654 </indexterm>
37655 <indexterm role="concept">
37656 <primary>address redirection</primary>
37657 <secondary>repeated for each delivery attempt</secondary>
37658 </indexterm>
37659 When a message cannot be delivered to all of its recipients immediately,
37660 leading to two or more delivery attempts, redirection expansion is carried out
37661 afresh each time for those addresses whose children were not all previously
37662 delivered. If redirection is being used as a mailing list, this can lead to new
37663 members of the list receiving copies of old messages. The <option>one_time</option> option
37664 can be used to avoid this.
37665 </para>
37666 </section>
37667 <section id="SECID129">
37668 <title>Errors in redirection lists</title>
37669 <para>
37670 <indexterm role="concept">
37671 <primary>address redirection</primary>
37672 <secondary>errors</secondary>
37673 </indexterm>
37674 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
37675 error is skipped, and an entry is written to the main log. This may be useful
37676 for mailing lists that are automatically managed. Otherwise, if an error is
37677 detected while generating the list of new addresses, the original address is
37678 deferred. See also <option>syntax_errors_to</option>.
37679 </para>
37680 </section>
37681 <section id="SECID130">
37682 <title>Private options for the redirect router</title>
37683 <para>
37684 <indexterm role="concept">
37685 <primary>options</primary>
37686 <secondary><command>redirect</command> router</secondary>
37687 </indexterm>
37688 The private options for the <command>redirect</command> router are as follows:
37689 </para>
37690 <para>
37691 <indexterm role="option">
37692 <primary><option>allow_defer</option></primary>
37693 </indexterm>
37694 </para>
37695 <informaltable frame="all">
37696 <tgroup cols="4" colsep="0" rowsep="0">
37697 <colspec colwidth="8*" align="left"/>
37698 <colspec colwidth="6*" align="center"/>
37699 <colspec colwidth="6*" align="center"/>
37700 <colspec colwidth="6*" align="right"/>
37701 <tbody>
37702 <row>
37703 <entry><option>allow_defer</option></entry>
37704 <entry>Use: <emphasis>redirect</emphasis></entry>
37705 <entry>Type: <emphasis>boolean</emphasis></entry>
37706 <entry>Default: <emphasis>false</emphasis></entry>
37707 </row>
37708 </tbody>
37709 </tgroup>
37710 </informaltable>
37711 <para>
37712 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
37713 data, or the <option>defer</option> command in an Exim filter file.
37714 </para>
37715 <para>
37716 <indexterm role="option">
37717 <primary><option>allow_fail</option></primary>
37718 </indexterm>
37719 </para>
37720 <informaltable frame="all">
37721 <tgroup cols="4" colsep="0" rowsep="0">
37722 <colspec colwidth="8*" align="left"/>
37723 <colspec colwidth="6*" align="center"/>
37724 <colspec colwidth="6*" align="center"/>
37725 <colspec colwidth="6*" align="right"/>
37726 <tbody>
37727 <row>
37728 <entry><option>allow_fail</option></entry>
37729 <entry>Use: <emphasis>redirect</emphasis></entry>
37730 <entry>Type: <emphasis>boolean</emphasis></entry>
37731 <entry>Default: <emphasis>false</emphasis></entry>
37732 </row>
37733 </tbody>
37734 </tgroup>
37735 </informaltable>
37736 <para>
37737 <indexterm role="concept">
37738 <primary>failing delivery</primary>
37739 <secondary>from filter</secondary>
37740 </indexterm>
37741 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
37742 and the <option>fail</option> command may be used in an Exim filter file.
37743 </para>
37744 <para>
37745 <indexterm role="option">
37746 <primary><option>allow_filter</option></primary>
37747 </indexterm>
37748 </para>
37749 <informaltable frame="all">
37750 <tgroup cols="4" colsep="0" rowsep="0">
37751 <colspec colwidth="8*" align="left"/>
37752 <colspec colwidth="6*" align="center"/>
37753 <colspec colwidth="6*" align="center"/>
37754 <colspec colwidth="6*" align="right"/>
37755 <tbody>
37756 <row>
37757 <entry><option>allow_filter</option></entry>
37758 <entry>Use: <emphasis>redirect</emphasis></entry>
37759 <entry>Type: <emphasis>boolean</emphasis></entry>
37760 <entry>Default: <emphasis>false</emphasis></entry>
37761 </row>
37762 </tbody>
37763 </tgroup>
37764 </informaltable>
37765 <para>
37766 <indexterm role="concept">
37767 <primary>filter</primary>
37768 <secondary>enabling use of</secondary>
37769 </indexterm>
37770 <indexterm role="concept">
37771 <primary>Sieve filter</primary>
37772 <secondary>enabling use of</secondary>
37773 </indexterm>
37774 Setting this option allows Exim to interpret redirection data that starts with
37775 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
37776 are some features of Exim filter files that some administrators may wish to
37777 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
37778 </para>
37779 <para>
37780 It is also possible to lock out Exim filters or Sieve filters while allowing
37781 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
37782 </para>
37783 <para>
37784 The filter is run using the uid and gid set by the generic <option>user</option> and
37785 <option>group</option> options. These take their defaults from the password data if
37786 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
37787 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
37788 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
37789 </para>
37790 <para>
37791 <indexterm role="option">
37792 <primary><option>allow_freeze</option></primary>
37793 </indexterm>
37794 </para>
37795 <informaltable frame="all">
37796 <tgroup cols="4" colsep="0" rowsep="0">
37797 <colspec colwidth="8*" align="left"/>
37798 <colspec colwidth="6*" align="center"/>
37799 <colspec colwidth="6*" align="center"/>
37800 <colspec colwidth="6*" align="right"/>
37801 <tbody>
37802 <row>
37803 <entry><option>allow_freeze</option></entry>
37804 <entry>Use: <emphasis>redirect</emphasis></entry>
37805 <entry>Type: <emphasis>boolean</emphasis></entry>
37806 <entry>Default: <emphasis>false</emphasis></entry>
37807 </row>
37808 </tbody>
37809 </tgroup>
37810 </informaltable>
37811 <para>
37812 <indexterm role="concept">
37813 <primary>freezing messages</primary>
37814 <secondary>allowing in filter</secondary>
37815 </indexterm>
37816 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
37817 This command is more normally encountered in system filters, and is disabled by
37818 default for redirection filters because it isn&#x2019;t something you usually want to
37819 let ordinary users do.
37820 </para>
37821 <para>
37822 <indexterm role="option">
37823 <primary><option>check_ancestor</option></primary>
37824 </indexterm>
37825 </para>
37826 <informaltable frame="all">
37827 <tgroup cols="4" colsep="0" rowsep="0">
37828 <colspec colwidth="8*" align="left"/>
37829 <colspec colwidth="6*" align="center"/>
37830 <colspec colwidth="6*" align="center"/>
37831 <colspec colwidth="6*" align="right"/>
37832 <tbody>
37833 <row>
37834 <entry><option>check_ancestor</option></entry>
37835 <entry>Use: <emphasis>redirect</emphasis></entry>
37836 <entry>Type: <emphasis>boolean</emphasis></entry>
37837 <entry>Default: <emphasis>false</emphasis></entry>
37838 </row>
37839 </tbody>
37840 </tgroup>
37841 </informaltable>
37842 <para>
37843 This option is concerned with handling generated addresses that are the same
37844 as some address in the list of redirection ancestors of the current address.
37845 Although it is turned off by default in the code, it is set in the default
37846 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
37847 for this use of the <command>redirect</command> router.
37848 </para>
37849 <para>
37850 When <option>check_ancestor</option> is set, if a generated address (including the domain)
37851 is the same as any ancestor of the current address, it is replaced by a copy of
37852 the current address. This helps in the case where local part A is aliased to B,
37853 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
37854 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
37855 <filename>&nbsp;jb/.forward</filename> contains:
37856 </para>
37857 <literallayout class="monospaced">
37858 \Joe.Bloggs, &lt;other item(s)&gt;
37859 </literallayout>
37860 <para>
37861 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
37862 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
37863 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
37864 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
37865 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
37866 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
37867 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
37868 original address. See also the <option>repeat_use</option> option below.
37869 </para>
37870 <para>
37871 <indexterm role="option">
37872 <primary><option>check_group</option></primary>
37873 </indexterm>
37874 </para>
37875 <informaltable frame="all">
37876 <tgroup cols="4" colsep="0" rowsep="0">
37877 <colspec colwidth="8*" align="left"/>
37878 <colspec colwidth="6*" align="center"/>
37879 <colspec colwidth="6*" align="center"/>
37880 <colspec colwidth="6*" align="right"/>
37881 <tbody>
37882 <row>
37883 <entry><option>check_group</option></entry>
37884 <entry>Use: <emphasis>redirect</emphasis></entry>
37885 <entry>Type: <emphasis>boolean</emphasis></entry>
37886 <entry>Default: <emphasis>see below</emphasis></entry>
37887 </row>
37888 </tbody>
37889 </tgroup>
37890 </informaltable>
37891 <para>
37892 When the <option>file</option> option is used, the group owner of the file is checked only
37893 when this option is set. The permitted groups are those listed in the
37894 <option>owngroups</option> option, together with the user&#x2019;s default group if
37895 <option>check_local_user</option> is set. If the file has the wrong group, routing is
37896 deferred. The default setting for this option is true if <option>check_local_user</option>
37897 is set and the <option>modemask</option> option permits the group write bit, or if the
37898 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
37899 </para>
37900 <para>
37901 <indexterm role="option">
37902 <primary><option>check_owner</option></primary>
37903 </indexterm>
37904 </para>
37905 <informaltable frame="all">
37906 <tgroup cols="4" colsep="0" rowsep="0">
37907 <colspec colwidth="8*" align="left"/>
37908 <colspec colwidth="6*" align="center"/>
37909 <colspec colwidth="6*" align="center"/>
37910 <colspec colwidth="6*" align="right"/>
37911 <tbody>
37912 <row>
37913 <entry><option>check_owner</option></entry>
37914 <entry>Use: <emphasis>redirect</emphasis></entry>
37915 <entry>Type: <emphasis>boolean</emphasis></entry>
37916 <entry>Default: <emphasis>see below</emphasis></entry>
37917 </row>
37918 </tbody>
37919 </tgroup>
37920 </informaltable>
37921 <para>
37922 When the <option>file</option> option is used, the owner of the file is checked only when
37923 this option is set. If <option>check_local_user</option> is set, the local user is
37924 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
37925 option. The default value for this option is true if <option>check_local_user</option> or
37926 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
37927 </para>
37928 <para>
37929 <indexterm role="option">
37930 <primary><option>data</option></primary>
37931 </indexterm>
37932 </para>
37933 <informaltable frame="all">
37934 <tgroup cols="4" colsep="0" rowsep="0">
37935 <colspec colwidth="8*" align="left"/>
37936 <colspec colwidth="6*" align="center"/>
37937 <colspec colwidth="6*" align="center"/>
37938 <colspec colwidth="6*" align="right"/>
37939 <tbody>
37940 <row>
37941 <entry><option>data</option></entry>
37942 <entry>Use: <emphasis>redirect</emphasis></entry>
37943 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37944 <entry>Default: <emphasis>unset</emphasis></entry>
37945 </row>
37946 </tbody>
37947 </tgroup>
37948 </informaltable>
37949 <para>
37950 This option is mutually exclusive with <option>file</option>. One or other of them must be
37951 set, but not both. The contents of <option>data</option> are expanded, and then used as the
37952 list of forwarding items, or as a set of filtering instructions. If the
37953 expansion is forced to fail, or the result is an empty string or a string that
37954 has no effect (consists entirely of comments), the router declines.
37955 </para>
37956 <para>
37957 When filtering instructions are used, the string must begin with <quote>#Exim
37958 filter</quote>, and all comments in the string, including this initial one, must be
37959 terminated with newline characters. For example:
37960 </para>
37961 <literallayout class="monospaced">
37962 data = #Exim filter\n\
37963        if $h_to: contains Exim then save $home/mail/exim endif
37964 </literallayout>
37965 <para>
37966 If you are reading the data from a database where newlines cannot be included,
37967 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
37968 choice into a newline.
37969 </para>
37970 <para>
37971 <indexterm role="option">
37972 <primary><option>directory_transport</option></primary>
37973 </indexterm>
37974 </para>
37975 <informaltable frame="all">
37976 <tgroup cols="4" colsep="0" rowsep="0">
37977 <colspec colwidth="8*" align="left"/>
37978 <colspec colwidth="6*" align="center"/>
37979 <colspec colwidth="6*" align="center"/>
37980 <colspec colwidth="6*" align="right"/>
37981 <tbody>
37982 <row>
37983 <entry><option>directory_transport</option></entry>
37984 <entry>Use: <emphasis>redirect</emphasis></entry>
37985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37986 <entry>Default: <emphasis>unset</emphasis></entry>
37987 </row>
37988 </tbody>
37989 </tgroup>
37990 </informaltable>
37991 <para>
37992 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
37993 ending with a slash is specified as a new <quote>address</quote>. The transport used is
37994 specified by this option, which, after expansion, must be the name of a
37995 configured transport. This should normally be an <command>appendfile</command> transport.
37996 </para>
37997 <para>
37998 <indexterm role="option">
37999 <primary><option>file</option></primary>
38000 </indexterm>
38001 </para>
38002 <informaltable frame="all">
38003 <tgroup cols="4" colsep="0" rowsep="0">
38004 <colspec colwidth="8*" align="left"/>
38005 <colspec colwidth="6*" align="center"/>
38006 <colspec colwidth="6*" align="center"/>
38007 <colspec colwidth="6*" align="right"/>
38008 <tbody>
38009 <row>
38010 <entry><option>file</option></entry>
38011 <entry>Use: <emphasis>redirect</emphasis></entry>
38012 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38013 <entry>Default: <emphasis>unset</emphasis></entry>
38014 </row>
38015 </tbody>
38016 </tgroup>
38017 </informaltable>
38018 <para>
38019 This option specifies the name of a file that contains the redirection data. It
38020 is mutually exclusive with the <option>data</option> option. The string is expanded before
38021 use; if the expansion is forced to fail, the router declines. Other expansion
38022 failures cause delivery to be deferred. The result of a successful expansion
38023 must be an absolute path. The entire file is read and used as the redirection
38024 data. If the data is an empty string or a string that has no effect (consists
38025 entirely of comments), the router declines.
38026 </para>
38027 <para>
38028 <indexterm role="concept">
38029 <primary>NFS</primary>
38030 <secondary>checking for file existence</secondary>
38031 </indexterm>
38032 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
38033 runs a check on the containing directory,
38034 unless <option>ignore_enotdir</option> is true (see below).
38035 If the directory does not appear to exist, delivery is deferred. This can
38036 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
38037 is a mount problem. If the containing directory does exist, but the file does
38038 not, the router declines.
38039 </para>
38040 <para>
38041 <indexterm role="option">
38042 <primary><option>file_transport</option></primary>
38043 </indexterm>
38044 </para>
38045 <informaltable frame="all">
38046 <tgroup cols="4" colsep="0" rowsep="0">
38047 <colspec colwidth="8*" align="left"/>
38048 <colspec colwidth="6*" align="center"/>
38049 <colspec colwidth="6*" align="center"/>
38050 <colspec colwidth="6*" align="right"/>
38051 <tbody>
38052 <row>
38053 <entry><option>file_transport</option></entry>
38054 <entry>Use: <emphasis>redirect</emphasis></entry>
38055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38056 <entry>Default: <emphasis>unset</emphasis></entry>
38057 </row>
38058 </tbody>
38059 </tgroup>
38060 </informaltable>
38061 <para>
38062 <indexterm role="variable">
38063 <primary><varname>$address_file</varname></primary>
38064 </indexterm>
38065 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
38066 ending in a slash is specified as a new <quote>address</quote>. The transport used is
38067 specified by this option, which, after expansion, must be the name of a
38068 configured transport. This should normally be an <command>appendfile</command> transport. When
38069 it is running, the file name is in <varname>$address_file</varname>.
38070 </para>
38071 <para>
38072 <indexterm role="option">
38073 <primary><option>filter_prepend_home</option></primary>
38074 </indexterm>
38075 </para>
38076 <informaltable frame="all">
38077 <tgroup cols="4" colsep="0" rowsep="0">
38078 <colspec colwidth="8*" align="left"/>
38079 <colspec colwidth="6*" align="center"/>
38080 <colspec colwidth="6*" align="center"/>
38081 <colspec colwidth="6*" align="right"/>
38082 <tbody>
38083 <row>
38084 <entry><option>filter_prepend_home</option></entry>
38085 <entry>Use: <emphasis>redirect</emphasis></entry>
38086 <entry>Type: <emphasis>boolean</emphasis></entry>
38087 <entry>Default: <emphasis>true</emphasis></entry>
38088 </row>
38089 </tbody>
38090 </tgroup>
38091 </informaltable>
38092 <para>
38093 When this option is true, if a <command>save</command> command in an Exim filter specifies a
38094 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
38095 relative path. If this option is set false, this action does not happen. The
38096 relative path is then passed to the transport unmodified.
38097 </para>
38098 <para>
38099 <indexterm role="option">
38100 <primary><option>forbid_blackhole</option></primary>
38101 </indexterm>
38102 </para>
38103 <informaltable frame="all">
38104 <tgroup cols="4" colsep="0" rowsep="0">
38105 <colspec colwidth="8*" align="left"/>
38106 <colspec colwidth="6*" align="center"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="right"/>
38109 <tbody>
38110 <row>
38111 <entry><option>forbid_blackhole</option></entry>
38112 <entry>Use: <emphasis>redirect</emphasis></entry>
38113 <entry>Type: <emphasis>boolean</emphasis></entry>
38114 <entry>Default: <emphasis>false</emphasis></entry>
38115 </row>
38116 </tbody>
38117 </tgroup>
38118 </informaltable>
38119 <para>
38120 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
38121 redirection list.
38122 </para>
38123 <para>
38124 <indexterm role="option">
38125 <primary><option>forbid_exim_filter</option></primary>
38126 </indexterm>
38127 </para>
38128 <informaltable frame="all">
38129 <tgroup cols="4" colsep="0" rowsep="0">
38130 <colspec colwidth="8*" align="left"/>
38131 <colspec colwidth="6*" align="center"/>
38132 <colspec colwidth="6*" align="center"/>
38133 <colspec colwidth="6*" align="right"/>
38134 <tbody>
38135 <row>
38136 <entry><option>forbid_exim_filter</option></entry>
38137 <entry>Use: <emphasis>redirect</emphasis></entry>
38138 <entry>Type: <emphasis>boolean</emphasis></entry>
38139 <entry>Default: <emphasis>false</emphasis></entry>
38140 </row>
38141 </tbody>
38142 </tgroup>
38143 </informaltable>
38144 <para>
38145 If this option is set true, only Sieve filters are permitted when
38146 <option>allow_filter</option> is true.
38147 </para>
38148 <para>
38149 <indexterm role="option">
38150 <primary><option>forbid_file</option></primary>
38151 </indexterm>
38152 </para>
38153 <informaltable frame="all">
38154 <tgroup cols="4" colsep="0" rowsep="0">
38155 <colspec colwidth="8*" align="left"/>
38156 <colspec colwidth="6*" align="center"/>
38157 <colspec colwidth="6*" align="center"/>
38158 <colspec colwidth="6*" align="right"/>
38159 <tbody>
38160 <row>
38161 <entry><option>forbid_file</option></entry>
38162 <entry>Use: <emphasis>redirect</emphasis></entry>
38163 <entry>Type: <emphasis>boolean</emphasis></entry>
38164 <entry>Default: <emphasis>false</emphasis></entry>
38165 </row>
38166 </tbody>
38167 </tgroup>
38168 </informaltable>
38169 <para>
38170 <indexterm role="concept">
38171 <primary>delivery</primary>
38172 <secondary>to file; forbidding</secondary>
38173 </indexterm>
38174 <indexterm role="concept">
38175 <primary>Sieve filter</primary>
38176 <secondary>forbidding delivery to a file</secondary>
38177 </indexterm>
38178 <indexterm role="concept">
38179 <primary>Sieve filter</primary>
38180 <secondary><quote>keep</quote> facility; disabling</secondary>
38181 </indexterm>
38182 If this option is true, this router may not generate a new address that
38183 specifies delivery to a local file or directory, either from a filter or from a
38184 conventional forward file. This option is forced to be true if <option>one_time</option> is
38185 set. It applies to Sieve filters as well as to Exim filters, but if true, it
38186 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
38187 </para>
38188 <para>
38189 <indexterm role="option">
38190 <primary><option>forbid_filter_dlfunc</option></primary>
38191 </indexterm>
38192 </para>
38193 <informaltable frame="all">
38194 <tgroup cols="4" colsep="0" rowsep="0">
38195 <colspec colwidth="8*" align="left"/>
38196 <colspec colwidth="6*" align="center"/>
38197 <colspec colwidth="6*" align="center"/>
38198 <colspec colwidth="6*" align="right"/>
38199 <tbody>
38200 <row>
38201 <entry><option>forbid_filter_dlfunc</option></entry>
38202 <entry>Use: <emphasis>redirect</emphasis></entry>
38203 <entry>Type: <emphasis>boolean</emphasis></entry>
38204 <entry>Default: <emphasis>false</emphasis></entry>
38205 </row>
38206 </tbody>
38207 </tgroup>
38208 </informaltable>
38209 <para>
38210 <indexterm role="concept">
38211 <primary>filter</primary>
38212 <secondary>locking out certain features</secondary>
38213 </indexterm>
38214 If this option is true, string expansions in Exim filters are not allowed to
38215 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
38216 functions.
38217 </para>
38218 <para>
38219 <indexterm role="option">
38220 <primary><option>forbid_filter_existstest</option></primary>
38221 </indexterm>
38222 </para>
38223 <informaltable frame="all">
38224 <tgroup cols="4" colsep="0" rowsep="0">
38225 <colspec colwidth="8*" align="left"/>
38226 <colspec colwidth="6*" align="center"/>
38227 <colspec colwidth="6*" align="center"/>
38228 <colspec colwidth="6*" align="right"/>
38229 <tbody>
38230 <row>
38231 <entry><option>forbid_filter_existstest</option></entry>
38232 <entry>Use: <emphasis>redirect</emphasis></entry>
38233 <entry>Type: <emphasis>boolean</emphasis></entry>
38234 <entry>Default: <emphasis>false</emphasis></entry>
38235 </row>
38236 </tbody>
38237 </tgroup>
38238 </informaltable>
38239 <para>
38240 <indexterm role="concept">
38241 <primary>expansion</primary>
38242 <secondary>statting a file</secondary>
38243 </indexterm>
38244 If this option is true, string expansions in Exim filters are not allowed to
38245 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
38246 </para>
38247 <para>
38248 <indexterm role="option">
38249 <primary><option>forbid_filter_logwrite</option></primary>
38250 </indexterm>
38251 </para>
38252 <informaltable frame="all">
38253 <tgroup cols="4" colsep="0" rowsep="0">
38254 <colspec colwidth="8*" align="left"/>
38255 <colspec colwidth="6*" align="center"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="right"/>
38258 <tbody>
38259 <row>
38260 <entry><option>forbid_filter_logwrite</option></entry>
38261 <entry>Use: <emphasis>redirect</emphasis></entry>
38262 <entry>Type: <emphasis>boolean</emphasis></entry>
38263 <entry>Default: <emphasis>false</emphasis></entry>
38264 </row>
38265 </tbody>
38266 </tgroup>
38267 </informaltable>
38268 <para>
38269 If this option is true, use of the logging facility in Exim filters is not
38270 permitted. Logging is in any case available only if the filter is being run
38271 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
38272 <filename>.forward</filename> files).
38273 </para>
38274 <para>
38275 <indexterm role="option">
38276 <primary><option>forbid_filter_lookup</option></primary>
38277 </indexterm>
38278 </para>
38279 <informaltable frame="all">
38280 <tgroup cols="4" colsep="0" rowsep="0">
38281 <colspec colwidth="8*" align="left"/>
38282 <colspec colwidth="6*" align="center"/>
38283 <colspec colwidth="6*" align="center"/>
38284 <colspec colwidth="6*" align="right"/>
38285 <tbody>
38286 <row>
38287 <entry><option>forbid_filter_lookup</option></entry>
38288 <entry>Use: <emphasis>redirect</emphasis></entry>
38289 <entry>Type: <emphasis>boolean</emphasis></entry>
38290 <entry>Default: <emphasis>false</emphasis></entry>
38291 </row>
38292 </tbody>
38293 </tgroup>
38294 </informaltable>
38295 <para>
38296 If this option is true, string expansions in Exim filter files are not allowed
38297 to make use of <option>lookup</option> items.
38298 </para>
38299 <para>
38300 <indexterm role="option">
38301 <primary><option>forbid_filter_perl</option></primary>
38302 </indexterm>
38303 </para>
38304 <informaltable frame="all">
38305 <tgroup cols="4" colsep="0" rowsep="0">
38306 <colspec colwidth="8*" align="left"/>
38307 <colspec colwidth="6*" align="center"/>
38308 <colspec colwidth="6*" align="center"/>
38309 <colspec colwidth="6*" align="right"/>
38310 <tbody>
38311 <row>
38312 <entry><option>forbid_filter_perl</option></entry>
38313 <entry>Use: <emphasis>redirect</emphasis></entry>
38314 <entry>Type: <emphasis>boolean</emphasis></entry>
38315 <entry>Default: <emphasis>false</emphasis></entry>
38316 </row>
38317 </tbody>
38318 </tgroup>
38319 </informaltable>
38320 <para>
38321 This option has an effect only if Exim is built with embedded Perl support. If
38322 it is true, string expansions in Exim filter files are not allowed to make use
38323 of the embedded Perl support.
38324 </para>
38325 <para>
38326 <indexterm role="option">
38327 <primary><option>forbid_filter_readfile</option></primary>
38328 </indexterm>
38329 </para>
38330 <informaltable frame="all">
38331 <tgroup cols="4" colsep="0" rowsep="0">
38332 <colspec colwidth="8*" align="left"/>
38333 <colspec colwidth="6*" align="center"/>
38334 <colspec colwidth="6*" align="center"/>
38335 <colspec colwidth="6*" align="right"/>
38336 <tbody>
38337 <row>
38338 <entry><option>forbid_filter_readfile</option></entry>
38339 <entry>Use: <emphasis>redirect</emphasis></entry>
38340 <entry>Type: <emphasis>boolean</emphasis></entry>
38341 <entry>Default: <emphasis>false</emphasis></entry>
38342 </row>
38343 </tbody>
38344 </tgroup>
38345 </informaltable>
38346 <para>
38347 If this option is true, string expansions in Exim filter files are not allowed
38348 to make use of <option>readfile</option> items.
38349 </para>
38350 <para>
38351 <indexterm role="option">
38352 <primary><option>forbid_filter_readsocket</option></primary>
38353 </indexterm>
38354 </para>
38355 <informaltable frame="all">
38356 <tgroup cols="4" colsep="0" rowsep="0">
38357 <colspec colwidth="8*" align="left"/>
38358 <colspec colwidth="6*" align="center"/>
38359 <colspec colwidth="6*" align="center"/>
38360 <colspec colwidth="6*" align="right"/>
38361 <tbody>
38362 <row>
38363 <entry><option>forbid_filter_readsocket</option></entry>
38364 <entry>Use: <emphasis>redirect</emphasis></entry>
38365 <entry>Type: <emphasis>boolean</emphasis></entry>
38366 <entry>Default: <emphasis>false</emphasis></entry>
38367 </row>
38368 </tbody>
38369 </tgroup>
38370 </informaltable>
38371 <para>
38372 If this option is true, string expansions in Exim filter files are not allowed
38373 to make use of <option>readsocket</option> items.
38374 </para>
38375 <para>
38376 <indexterm role="option">
38377 <primary><option>forbid_filter_reply</option></primary>
38378 </indexterm>
38379 </para>
38380 <informaltable frame="all">
38381 <tgroup cols="4" colsep="0" rowsep="0">
38382 <colspec colwidth="8*" align="left"/>
38383 <colspec colwidth="6*" align="center"/>
38384 <colspec colwidth="6*" align="center"/>
38385 <colspec colwidth="6*" align="right"/>
38386 <tbody>
38387 <row>
38388 <entry><option>forbid_filter_reply</option></entry>
38389 <entry>Use: <emphasis>redirect</emphasis></entry>
38390 <entry>Type: <emphasis>boolean</emphasis></entry>
38391 <entry>Default: <emphasis>false</emphasis></entry>
38392 </row>
38393 </tbody>
38394 </tgroup>
38395 </informaltable>
38396 <para>
38397 If this option is true, this router may not generate an automatic reply
38398 message. Automatic replies can be generated only from Exim or Sieve filter
38399 files, not from traditional forward files. This option is forced to be true if
38400 <option>one_time</option> is set.
38401 </para>
38402 <para>
38403 <indexterm role="option">
38404 <primary><option>forbid_filter_run</option></primary>
38405 </indexterm>
38406 </para>
38407 <informaltable frame="all">
38408 <tgroup cols="4" colsep="0" rowsep="0">
38409 <colspec colwidth="8*" align="left"/>
38410 <colspec colwidth="6*" align="center"/>
38411 <colspec colwidth="6*" align="center"/>
38412 <colspec colwidth="6*" align="right"/>
38413 <tbody>
38414 <row>
38415 <entry><option>forbid_filter_run</option></entry>
38416 <entry>Use: <emphasis>redirect</emphasis></entry>
38417 <entry>Type: <emphasis>boolean</emphasis></entry>
38418 <entry>Default: <emphasis>false</emphasis></entry>
38419 </row>
38420 </tbody>
38421 </tgroup>
38422 </informaltable>
38423 <para>
38424 If this option is true, string expansions in Exim filter files are not allowed
38425 to make use of <option>run</option> items.
38426 </para>
38427 <para>
38428 <indexterm role="option">
38429 <primary><option>forbid_include</option></primary>
38430 </indexterm>
38431 </para>
38432 <informaltable frame="all">
38433 <tgroup cols="4" colsep="0" rowsep="0">
38434 <colspec colwidth="8*" align="left"/>
38435 <colspec colwidth="6*" align="center"/>
38436 <colspec colwidth="6*" align="center"/>
38437 <colspec colwidth="6*" align="right"/>
38438 <tbody>
38439 <row>
38440 <entry><option>forbid_include</option></entry>
38441 <entry>Use: <emphasis>redirect</emphasis></entry>
38442 <entry>Type: <emphasis>boolean</emphasis></entry>
38443 <entry>Default: <emphasis>false</emphasis></entry>
38444 </row>
38445 </tbody>
38446 </tgroup>
38447 </informaltable>
38448 <para>
38449 If this option is true, items of the form
38450 </para>
38451 <literallayout class="monospaced">
38452 :include:&lt;path name&gt;
38453 </literallayout>
38454 <para>
38455 are not permitted in non-filter redirection lists.
38456 </para>
38457 <para>
38458 <indexterm role="option">
38459 <primary><option>forbid_pipe</option></primary>
38460 </indexterm>
38461 </para>
38462 <informaltable frame="all">
38463 <tgroup cols="4" colsep="0" rowsep="0">
38464 <colspec colwidth="8*" align="left"/>
38465 <colspec colwidth="6*" align="center"/>
38466 <colspec colwidth="6*" align="center"/>
38467 <colspec colwidth="6*" align="right"/>
38468 <tbody>
38469 <row>
38470 <entry><option>forbid_pipe</option></entry>
38471 <entry>Use: <emphasis>redirect</emphasis></entry>
38472 <entry>Type: <emphasis>boolean</emphasis></entry>
38473 <entry>Default: <emphasis>false</emphasis></entry>
38474 </row>
38475 </tbody>
38476 </tgroup>
38477 </informaltable>
38478 <para>
38479 <indexterm role="concept">
38480 <primary>delivery</primary>
38481 <secondary>to pipe; forbidding</secondary>
38482 </indexterm>
38483 If this option is true, this router may not generate a new address which
38484 specifies delivery to a pipe, either from an Exim filter or from a conventional
38485 forward file. This option is forced to be true if <option>one_time</option> is set.
38486 </para>
38487 <para>
38488 <indexterm role="option">
38489 <primary><option>forbid_sieve_filter</option></primary>
38490 </indexterm>
38491 </para>
38492 <informaltable frame="all">
38493 <tgroup cols="4" colsep="0" rowsep="0">
38494 <colspec colwidth="8*" align="left"/>
38495 <colspec colwidth="6*" align="center"/>
38496 <colspec colwidth="6*" align="center"/>
38497 <colspec colwidth="6*" align="right"/>
38498 <tbody>
38499 <row>
38500 <entry><option>forbid_sieve_filter</option></entry>
38501 <entry>Use: <emphasis>redirect</emphasis></entry>
38502 <entry>Type: <emphasis>boolean</emphasis></entry>
38503 <entry>Default: <emphasis>false</emphasis></entry>
38504 </row>
38505 </tbody>
38506 </tgroup>
38507 </informaltable>
38508 <para>
38509 If this option is set true, only Exim filters are permitted when
38510 <option>allow_filter</option> is true.
38511 </para>
38512 <para>
38513 <indexterm role="concept">
38514 <primary>SMTP</primary>
38515 <secondary>error codes</secondary>
38516 </indexterm>
38517 <indexterm role="option">
38518 <primary><option>forbid_smtp_code</option></primary>
38519 </indexterm>
38520 </para>
38521 <informaltable frame="all">
38522 <tgroup cols="4" colsep="0" rowsep="0">
38523 <colspec colwidth="8*" align="left"/>
38524 <colspec colwidth="6*" align="center"/>
38525 <colspec colwidth="6*" align="center"/>
38526 <colspec colwidth="6*" align="right"/>
38527 <tbody>
38528 <row>
38529 <entry><option>forbid_smtp_code</option></entry>
38530 <entry>Use: <emphasis>redirect</emphasis></entry>
38531 <entry>Type: <emphasis>boolean</emphasis></entry>
38532 <entry>Default: <emphasis>false</emphasis></entry>
38533 </row>
38534 </tbody>
38535 </tgroup>
38536 </informaltable>
38537 <para>
38538 If this option is set true, any SMTP error codes that are present at the start
38539 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
38540 the default codes (451 and 550, respectively) are always used.
38541 </para>
38542 <para>
38543 <indexterm role="option">
38544 <primary><option>hide_child_in_errmsg</option></primary>
38545 </indexterm>
38546 </para>
38547 <informaltable frame="all">
38548 <tgroup cols="4" colsep="0" rowsep="0">
38549 <colspec colwidth="8*" align="left"/>
38550 <colspec colwidth="6*" align="center"/>
38551 <colspec colwidth="6*" align="center"/>
38552 <colspec colwidth="6*" align="right"/>
38553 <tbody>
38554 <row>
38555 <entry><option>hide_child_in_errmsg</option></entry>
38556 <entry>Use: <emphasis>redirect</emphasis></entry>
38557 <entry>Type: <emphasis>boolean</emphasis></entry>
38558 <entry>Default: <emphasis>false</emphasis></entry>
38559 </row>
38560 </tbody>
38561 </tgroup>
38562 </informaltable>
38563 <para>
38564 <indexterm role="concept">
38565 <primary>bounce message</primary>
38566 <secondary>redirection details; suppressing</secondary>
38567 </indexterm>
38568 If this option is true, it prevents Exim from quoting a child address if it
38569 generates a bounce or delay message for it. Instead it says <quote>an address
38570 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
38571 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
38572 bounce may well quote the generated address.
38573 </para>
38574 <para>
38575 <indexterm role="option">
38576 <primary><option>ignore_eacces</option></primary>
38577 </indexterm>
38578 </para>
38579 <informaltable frame="all">
38580 <tgroup cols="4" colsep="0" rowsep="0">
38581 <colspec colwidth="8*" align="left"/>
38582 <colspec colwidth="6*" align="center"/>
38583 <colspec colwidth="6*" align="center"/>
38584 <colspec colwidth="6*" align="right"/>
38585 <tbody>
38586 <row>
38587 <entry><option>ignore_eacces</option></entry>
38588 <entry>Use: <emphasis>redirect</emphasis></entry>
38589 <entry>Type: <emphasis>boolean</emphasis></entry>
38590 <entry>Default: <emphasis>false</emphasis></entry>
38591 </row>
38592 </tbody>
38593 </tgroup>
38594 </informaltable>
38595 <para>
38596 <indexterm role="concept">
38597 <primary>EACCES</primary>
38598 </indexterm>
38599 If this option is set and an attempt to open a redirection file yields the
38600 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
38601 file did not exist.
38602 </para>
38603 <para>
38604 <indexterm role="option">
38605 <primary><option>ignore_enotdir</option></primary>
38606 </indexterm>
38607 </para>
38608 <informaltable frame="all">
38609 <tgroup cols="4" colsep="0" rowsep="0">
38610 <colspec colwidth="8*" align="left"/>
38611 <colspec colwidth="6*" align="center"/>
38612 <colspec colwidth="6*" align="center"/>
38613 <colspec colwidth="6*" align="right"/>
38614 <tbody>
38615 <row>
38616 <entry><option>ignore_enotdir</option></entry>
38617 <entry>Use: <emphasis>redirect</emphasis></entry>
38618 <entry>Type: <emphasis>boolean</emphasis></entry>
38619 <entry>Default: <emphasis>false</emphasis></entry>
38620 </row>
38621 </tbody>
38622 </tgroup>
38623 </informaltable>
38624 <para>
38625 <indexterm role="concept">
38626 <primary>ENOTDIR</primary>
38627 </indexterm>
38628 If this option is set and an attempt to open a redirection file yields the
38629 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
38630 router behaves as if the file did not exist.
38631 </para>
38632 <para>
38633 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
38634 router that has the <option>file</option> option set discovers that the file does not exist
38635 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
38636 against unmounted NFS directories. If the parent can not be statted, delivery
38637 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
38638 is set, because that option tells Exim to ignore <quote>something on the path is not
38639 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
38640 that some operating systems give ENOENT where others give ENOTDIR.
38641 </para>
38642 <para>
38643 <indexterm role="option">
38644 <primary><option>include_directory</option></primary>
38645 </indexterm>
38646 </para>
38647 <informaltable frame="all">
38648 <tgroup cols="4" colsep="0" rowsep="0">
38649 <colspec colwidth="8*" align="left"/>
38650 <colspec colwidth="6*" align="center"/>
38651 <colspec colwidth="6*" align="center"/>
38652 <colspec colwidth="6*" align="right"/>
38653 <tbody>
38654 <row>
38655 <entry><option>include_directory</option></entry>
38656 <entry>Use: <emphasis>redirect</emphasis></entry>
38657 <entry>Type: <emphasis>string</emphasis></entry>
38658 <entry>Default: <emphasis>unset</emphasis></entry>
38659 </row>
38660 </tbody>
38661 </tgroup>
38662 </informaltable>
38663 <para>
38664 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
38665 redirection list must start with this directory.
38666 </para>
38667 <para>
38668 <indexterm role="option">
38669 <primary><option>modemask</option></primary>
38670 </indexterm>
38671 </para>
38672 <informaltable frame="all">
38673 <tgroup cols="4" colsep="0" rowsep="0">
38674 <colspec colwidth="8*" align="left"/>
38675 <colspec colwidth="6*" align="center"/>
38676 <colspec colwidth="6*" align="center"/>
38677 <colspec colwidth="6*" align="right"/>
38678 <tbody>
38679 <row>
38680 <entry><option>modemask</option></entry>
38681 <entry>Use: <emphasis>redirect</emphasis></entry>
38682 <entry>Type: <emphasis>octal integer</emphasis></entry>
38683 <entry>Default: <emphasis>022</emphasis></entry>
38684 </row>
38685 </tbody>
38686 </tgroup>
38687 </informaltable>
38688 <para>
38689 This specifies mode bits which must not be set for a file specified by the
38690 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
38691 </para>
38692 <para>
38693 <indexterm role="option">
38694 <primary><option>one_time</option></primary>
38695 </indexterm>
38696 </para>
38697 <informaltable frame="all">
38698 <tgroup cols="4" colsep="0" rowsep="0">
38699 <colspec colwidth="8*" align="left"/>
38700 <colspec colwidth="6*" align="center"/>
38701 <colspec colwidth="6*" align="center"/>
38702 <colspec colwidth="6*" align="right"/>
38703 <tbody>
38704 <row>
38705 <entry><option>one_time</option></entry>
38706 <entry>Use: <emphasis>redirect</emphasis></entry>
38707 <entry>Type: <emphasis>boolean</emphasis></entry>
38708 <entry>Default: <emphasis>false</emphasis></entry>
38709 </row>
38710 </tbody>
38711 </tgroup>
38712 </informaltable>
38713 <para>
38714 <indexterm role="concept">
38715 <primary>one-time aliasing/forwarding expansion</primary>
38716 </indexterm>
38717 <indexterm role="concept">
38718 <primary>alias file</primary>
38719 <secondary>one-time expansion</secondary>
38720 </indexterm>
38721 <indexterm role="concept">
38722 <primary>forward file</primary>
38723 <secondary>one-time expansion</secondary>
38724 </indexterm>
38725 <indexterm role="concept">
38726 <primary>mailing lists</primary>
38727 <secondary>one-time expansion</secondary>
38728 </indexterm>
38729 <indexterm role="concept">
38730 <primary>address redirection</primary>
38731 <secondary>one-time expansion</secondary>
38732 </indexterm>
38733 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
38734 files each time it tries to deliver a message causes a problem when one or more
38735 of the generated addresses fails be delivered at the first attempt. The problem
38736 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
38737 but of what happens when the redirection list changes during the time that the
38738 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
38739 lists, where new subscribers might receive copies of messages that were posted
38740 before they subscribed.
38741 </para>
38742 <para>
38743 If <option>one_time</option> is set and any addresses generated by the router fail to
38744 deliver at the first attempt, the failing addresses are added to the message as
38745 <quote>top level</quote> addresses, and the parent address that generated them is marked
38746 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
38747 attempt.
38748 </para>
38749 <para>
38750 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
38751 router would be lost if delivery did not succeed at the first attempt. For this
38752 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
38753 permitted when <option>one_time</option> is set.
38754 </para>
38755 <para>
38756 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
38757 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
38758 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
38759 </para>
38760 <para>
38761 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
38762 <option>one_time</option>.
38763 </para>
38764 <para>
38765 The original top-level address is remembered with each of the generated
38766 addresses, and is output in any log messages. However, any intermediate parent
38767 addresses are not recorded. This makes a difference to the log only if
38768 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
38769 typically be used for mailing lists, where there is normally just one level of
38770 expansion.
38771 </para>
38772 <para>
38773 <indexterm role="option">
38774 <primary><option>owners</option></primary>
38775 </indexterm>
38776 </para>
38777 <informaltable frame="all">
38778 <tgroup cols="4" colsep="0" rowsep="0">
38779 <colspec colwidth="8*" align="left"/>
38780 <colspec colwidth="6*" align="center"/>
38781 <colspec colwidth="6*" align="center"/>
38782 <colspec colwidth="6*" align="right"/>
38783 <tbody>
38784 <row>
38785 <entry><option>owners</option></entry>
38786 <entry>Use: <emphasis>redirect</emphasis></entry>
38787 <entry>Type: <emphasis>string list</emphasis></entry>
38788 <entry>Default: <emphasis>unset</emphasis></entry>
38789 </row>
38790 </tbody>
38791 </tgroup>
38792 </informaltable>
38793 <para>
38794 <indexterm role="concept">
38795 <primary>ownership</primary>
38796 <secondary>alias file</secondary>
38797 </indexterm>
38798 <indexterm role="concept">
38799 <primary>ownership</primary>
38800 <secondary>forward file</secondary>
38801 </indexterm>
38802 <indexterm role="concept">
38803 <primary>alias file</primary>
38804 <secondary>ownership</secondary>
38805 </indexterm>
38806 <indexterm role="concept">
38807 <primary>forward file</primary>
38808 <secondary>ownership</secondary>
38809 </indexterm>
38810 This specifies a list of permitted owners for the file specified by <option>file</option>.
38811 This list is in addition to the local user when <option>check_local_user</option> is set.
38812 See <option>check_owner</option> above.
38813 </para>
38814 <para>
38815 <indexterm role="option">
38816 <primary><option>owngroups</option></primary>
38817 </indexterm>
38818 </para>
38819 <informaltable frame="all">
38820 <tgroup cols="4" colsep="0" rowsep="0">
38821 <colspec colwidth="8*" align="left"/>
38822 <colspec colwidth="6*" align="center"/>
38823 <colspec colwidth="6*" align="center"/>
38824 <colspec colwidth="6*" align="right"/>
38825 <tbody>
38826 <row>
38827 <entry><option>owngroups</option></entry>
38828 <entry>Use: <emphasis>redirect</emphasis></entry>
38829 <entry>Type: <emphasis>string list</emphasis></entry>
38830 <entry>Default: <emphasis>unset</emphasis></entry>
38831 </row>
38832 </tbody>
38833 </tgroup>
38834 </informaltable>
38835 <para>
38836 This specifies a list of permitted groups for the file specified by <option>file</option>.
38837 The list is in addition to the local user&#x2019;s primary group when
38838 <option>check_local_user</option> is set. See <option>check_group</option> above.
38839 </para>
38840 <para>
38841 <indexterm role="option">
38842 <primary><option>pipe_transport</option></primary>
38843 </indexterm>
38844 </para>
38845 <informaltable frame="all">
38846 <tgroup cols="4" colsep="0" rowsep="0">
38847 <colspec colwidth="8*" align="left"/>
38848 <colspec colwidth="6*" align="center"/>
38849 <colspec colwidth="6*" align="center"/>
38850 <colspec colwidth="6*" align="right"/>
38851 <tbody>
38852 <row>
38853 <entry><option>pipe_transport</option></entry>
38854 <entry>Use: <emphasis>redirect</emphasis></entry>
38855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38856 <entry>Default: <emphasis>unset</emphasis></entry>
38857 </row>
38858 </tbody>
38859 </tgroup>
38860 </informaltable>
38861 <para>
38862 <indexterm role="variable">
38863 <primary><varname>$address_pipe</varname></primary>
38864 </indexterm>
38865 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
38866 starting with a vertical bar character is specified as a new <quote>address</quote>. The
38867 transport used is specified by this option, which, after expansion, must be the
38868 name of a configured transport. This should normally be a <command>pipe</command> transport.
38869 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
38870 </para>
38871 <para>
38872 <indexterm role="option">
38873 <primary><option>qualify_domain</option></primary>
38874 </indexterm>
38875 </para>
38876 <informaltable frame="all">
38877 <tgroup cols="4" colsep="0" rowsep="0">
38878 <colspec colwidth="8*" align="left"/>
38879 <colspec colwidth="6*" align="center"/>
38880 <colspec colwidth="6*" align="center"/>
38881 <colspec colwidth="6*" align="right"/>
38882 <tbody>
38883 <row>
38884 <entry><option>qualify_domain</option></entry>
38885 <entry>Use: <emphasis>redirect</emphasis></entry>
38886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38887 <entry>Default: <emphasis>unset</emphasis></entry>
38888 </row>
38889 </tbody>
38890 </tgroup>
38891 </informaltable>
38892 <para>
38893 <indexterm role="variable">
38894 <primary><varname>$qualify_recipient</varname></primary>
38895 </indexterm>
38896 If this option is set, and an unqualified address (one without a domain) is
38897 generated, and that address would normally be qualified by the global setting
38898 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
38899 expanding this string. If the expansion fails, the router declines. If you want
38900 to revert to the default, you can have the expansion generate
38901 <varname>$qualify_recipient</varname>.
38902 </para>
38903 <para>
38904 This option applies to all unqualified addresses generated by Exim filters,
38905 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
38906 not preceded by a backslash. Sieve filters cannot generate unqualified
38907 addresses.
38908 </para>
38909 <para>
38910 <indexterm role="option">
38911 <primary><option>qualify_preserve_domain</option></primary>
38912 </indexterm>
38913 </para>
38914 <informaltable frame="all">
38915 <tgroup cols="4" colsep="0" rowsep="0">
38916 <colspec colwidth="8*" align="left"/>
38917 <colspec colwidth="6*" align="center"/>
38918 <colspec colwidth="6*" align="center"/>
38919 <colspec colwidth="6*" align="right"/>
38920 <tbody>
38921 <row>
38922 <entry><option>qualify_preserve_domain</option></entry>
38923 <entry>Use: <emphasis>redirect</emphasis></entry>
38924 <entry>Type: <emphasis>boolean</emphasis></entry>
38925 <entry>Default: <emphasis>false</emphasis></entry>
38926 </row>
38927 </tbody>
38928 </tgroup>
38929 </informaltable>
38930 <para>
38931 <indexterm role="concept">
38932 <primary>domain</primary>
38933 <secondary>in redirection; preserving</secondary>
38934 </indexterm>
38935 <indexterm role="concept">
38936 <primary>preserving domain in redirection</primary>
38937 </indexterm>
38938 <indexterm role="concept">
38939 <primary>address redirection</primary>
38940 <secondary>domain; preserving</secondary>
38941 </indexterm>
38942 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
38943 set (a configuration error occurs if it is). If an unqualified address (one
38944 without a domain) is generated, it is qualified with the domain of the parent
38945 address (the immediately preceding ancestor) instead of the global
38946 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
38947 this applies whether or not the address is preceded by a backslash.
38948 </para>
38949 <para>
38950 <indexterm role="option">
38951 <primary><option>repeat_use</option></primary>
38952 </indexterm>
38953 </para>
38954 <informaltable frame="all">
38955 <tgroup cols="4" colsep="0" rowsep="0">
38956 <colspec colwidth="8*" align="left"/>
38957 <colspec colwidth="6*" align="center"/>
38958 <colspec colwidth="6*" align="center"/>
38959 <colspec colwidth="6*" align="right"/>
38960 <tbody>
38961 <row>
38962 <entry><option>repeat_use</option></entry>
38963 <entry>Use: <emphasis>redirect</emphasis></entry>
38964 <entry>Type: <emphasis>boolean</emphasis></entry>
38965 <entry>Default: <emphasis>true</emphasis></entry>
38966 </row>
38967 </tbody>
38968 </tgroup>
38969 </informaltable>
38970 <para>
38971 If this option is set false, the router is skipped for a child address that has
38972 any ancestor that was routed by this router. This test happens before any of
38973 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
38974 only when the ancestor is the same as the current address. See also
38975 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
38976 </para>
38977 <para>
38978 <indexterm role="option">
38979 <primary><option>reply_transport</option></primary>
38980 </indexterm>
38981 </para>
38982 <informaltable frame="all">
38983 <tgroup cols="4" colsep="0" rowsep="0">
38984 <colspec colwidth="8*" align="left"/>
38985 <colspec colwidth="6*" align="center"/>
38986 <colspec colwidth="6*" align="center"/>
38987 <colspec colwidth="6*" align="right"/>
38988 <tbody>
38989 <row>
38990 <entry><option>reply_transport</option></entry>
38991 <entry>Use: <emphasis>redirect</emphasis></entry>
38992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38993 <entry>Default: <emphasis>unset</emphasis></entry>
38994 </row>
38995 </tbody>
38996 </tgroup>
38997 </informaltable>
38998 <para>
38999 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
39000 <option>vacation</option> command is used in a filter file. The transport used is specified
39001 by this option, which, after expansion, must be the name of a configured
39002 transport. This should normally be an <command>autoreply</command> transport. Other transports
39003 are unlikely to do anything sensible or useful.
39004 </para>
39005 <para>
39006 <indexterm role="option">
39007 <primary><option>rewrite</option></primary>
39008 </indexterm>
39009 </para>
39010 <informaltable frame="all">
39011 <tgroup cols="4" colsep="0" rowsep="0">
39012 <colspec colwidth="8*" align="left"/>
39013 <colspec colwidth="6*" align="center"/>
39014 <colspec colwidth="6*" align="center"/>
39015 <colspec colwidth="6*" align="right"/>
39016 <tbody>
39017 <row>
39018 <entry><option>rewrite</option></entry>
39019 <entry>Use: <emphasis>redirect</emphasis></entry>
39020 <entry>Type: <emphasis>boolean</emphasis></entry>
39021 <entry>Default: <emphasis>true</emphasis></entry>
39022 </row>
39023 </tbody>
39024 </tgroup>
39025 </informaltable>
39026 <para>
39027 <indexterm role="concept">
39028 <primary>address redirection</primary>
39029 <secondary>disabling rewriting</secondary>
39030 </indexterm>
39031 If this option is set false, addresses generated by the router are not
39032 subject to address rewriting. Otherwise, they are treated like new addresses
39033 and are rewritten according to the global rewriting rules.
39034 </para>
39035 <para>
39036 <indexterm role="option">
39037 <primary><option>sieve_subaddress</option></primary>
39038 </indexterm>
39039 </para>
39040 <informaltable frame="all">
39041 <tgroup cols="4" colsep="0" rowsep="0">
39042 <colspec colwidth="8*" align="left"/>
39043 <colspec colwidth="6*" align="center"/>
39044 <colspec colwidth="6*" align="center"/>
39045 <colspec colwidth="6*" align="right"/>
39046 <tbody>
39047 <row>
39048 <entry><option>sieve_subaddress</option></entry>
39049 <entry>Use: <emphasis>redirect</emphasis></entry>
39050 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39051 <entry>Default: <emphasis>unset</emphasis></entry>
39052 </row>
39053 </tbody>
39054 </tgroup>
39055 </informaltable>
39056 <para>
39057 The value of this option is passed to a Sieve filter to specify the
39058 :subaddress part of an address.
39059 </para>
39060 <para>
39061 <indexterm role="option">
39062 <primary><option>sieve_useraddress</option></primary>
39063 </indexterm>
39064 </para>
39065 <informaltable frame="all">
39066 <tgroup cols="4" colsep="0" rowsep="0">
39067 <colspec colwidth="8*" align="left"/>
39068 <colspec colwidth="6*" align="center"/>
39069 <colspec colwidth="6*" align="center"/>
39070 <colspec colwidth="6*" align="right"/>
39071 <tbody>
39072 <row>
39073 <entry><option>sieve_useraddress</option></entry>
39074 <entry>Use: <emphasis>redirect</emphasis></entry>
39075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39076 <entry>Default: <emphasis>unset</emphasis></entry>
39077 </row>
39078 </tbody>
39079 </tgroup>
39080 </informaltable>
39081 <para>
39082 The value of this option is passed to a Sieve filter to specify the :user part
39083 of an address. However, if it is unset, the entire original local part
39084 (including any prefix or suffix) is used for :user.
39085 </para>
39086 <para>
39087 <indexterm role="option">
39088 <primary><option>sieve_vacation_directory</option></primary>
39089 </indexterm>
39090 </para>
39091 <informaltable frame="all">
39092 <tgroup cols="4" colsep="0" rowsep="0">
39093 <colspec colwidth="8*" align="left"/>
39094 <colspec colwidth="6*" align="center"/>
39095 <colspec colwidth="6*" align="center"/>
39096 <colspec colwidth="6*" align="right"/>
39097 <tbody>
39098 <row>
39099 <entry><option>sieve_vacation_directory</option></entry>
39100 <entry>Use: <emphasis>redirect</emphasis></entry>
39101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39102 <entry>Default: <emphasis>unset</emphasis></entry>
39103 </row>
39104 </tbody>
39105 </tgroup>
39106 </informaltable>
39107 <para>
39108 <indexterm role="concept">
39109 <primary>Sieve filter</primary>
39110 <secondary>vacation directory</secondary>
39111 </indexterm>
39112 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
39113 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
39114 (do not put anything else in that directory), and ensure that the
39115 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
39116 needs their own directory; Exim will create it if necessary.
39117 </para>
39118 <para>
39119 <indexterm role="option">
39120 <primary><option>skip_syntax_errors</option></primary>
39121 </indexterm>
39122 </para>
39123 <informaltable frame="all">
39124 <tgroup cols="4" colsep="0" rowsep="0">
39125 <colspec colwidth="8*" align="left"/>
39126 <colspec colwidth="6*" align="center"/>
39127 <colspec colwidth="6*" align="center"/>
39128 <colspec colwidth="6*" align="right"/>
39129 <tbody>
39130 <row>
39131 <entry><option>skip_syntax_errors</option></entry>
39132 <entry>Use: <emphasis>redirect</emphasis></entry>
39133 <entry>Type: <emphasis>boolean</emphasis></entry>
39134 <entry>Default: <emphasis>false</emphasis></entry>
39135 </row>
39136 </tbody>
39137 </tgroup>
39138 </informaltable>
39139 <para>
39140 <indexterm role="concept">
39141 <primary>forward file</primary>
39142 <secondary>broken</secondary>
39143 </indexterm>
39144 <indexterm role="concept">
39145 <primary>address redirection</primary>
39146 <secondary>broken files</secondary>
39147 </indexterm>
39148 <indexterm role="concept">
39149 <primary>alias file</primary>
39150 <secondary>broken</secondary>
39151 </indexterm>
39152 <indexterm role="concept">
39153 <primary>broken alias or forward files</primary>
39154 </indexterm>
39155 <indexterm role="concept">
39156 <primary>ignoring faulty addresses</primary>
39157 </indexterm>
39158 <indexterm role="concept">
39159 <primary>skipping faulty addresses</primary>
39160 </indexterm>
39161 <indexterm role="concept">
39162 <primary>error</primary>
39163 <secondary>skipping bad syntax</secondary>
39164 </indexterm>
39165 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
39166 non-filter redirection data are skipped, and each failing address is logged. If
39167 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
39168 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
39169 are expanded and placed at the head of the error message generated by
39170 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
39171 be the same address as the generic <option>errors_to</option> option. The
39172 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
39173 </para>
39174 <para>
39175 If all the addresses in a redirection list are skipped because of syntax
39176 errors, the router declines to handle the original address, and it is passed to
39177 the following routers.
39178 </para>
39179 <para>
39180 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
39181 error in the filter causes filtering to be abandoned without any action being
39182 taken. The incident is logged, and the router declines to handle the address,
39183 so it is passed to the following routers.
39184 </para>
39185 <para>
39186 <indexterm role="concept">
39187 <primary>Sieve filter</primary>
39188 <secondary>syntax errors in</secondary>
39189 </indexterm>
39190 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
39191 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
39192 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
39193 </para>
39194 <para>
39195 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
39196 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
39197 option, used with an address that does not get redirected, can be used to
39198 notify users of these errors, by means of a router like this:
39199 </para>
39200 <literallayout class="monospaced">
39201 userforward:
39202   driver = redirect
39203   allow_filter
39204   check_local_user
39205   file = $home/.forward
39206   file_transport = address_file
39207   pipe_transport = address_pipe
39208   reply_transport = address_reply
39209   no_verify
39210   skip_syntax_errors
39211   syntax_errors_to = real-$local_part@$domain
39212   syntax_errors_text = \
39213    This is an automatically generated message. An error has\n\
39214    been found in your .forward file. Details of the error are\n\
39215    reported below. While this error persists, you will receive\n\
39216    a copy of this message for every message that is addressed\n\
39217    to you. If your .forward file is a filter file, or if it is\n\
39218    a non-filter file containing no valid forwarding addresses,\n\
39219    a copy of each incoming message will be put in your normal\n\
39220    mailbox. If a non-filter file contains at least one valid\n\
39221    forwarding address, forwarding to the valid addresses will\n\
39222    happen, and those will be the only deliveries that occur.
39223 </literallayout>
39224 <para>
39225 You also need a router to ensure that local addresses that are prefixed by
39226 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
39227 put this immediately before the <command>userforward</command> router:
39228 </para>
39229 <literallayout class="monospaced">
39230 real_localuser:
39231   driver = accept
39232   check_local_user
39233   local_part_prefix = real-
39234   transport = local_delivery
39235 </literallayout>
39236 <para>
39237 For security, it would probably be a good idea to restrict the use of this
39238 router to locally-generated messages, using a condition such as this:
39239 </para>
39240 <literallayout class="monospaced">
39241   condition = ${if match {$sender_host_address}\
39242                          {\N^(|127\.0\.0\.1)$\N}}
39243 </literallayout>
39244 <para>
39245 <indexterm role="option">
39246 <primary><option>syntax_errors_text</option></primary>
39247 </indexterm>
39248 </para>
39249 <informaltable frame="all">
39250 <tgroup cols="4" colsep="0" rowsep="0">
39251 <colspec colwidth="8*" align="left"/>
39252 <colspec colwidth="6*" align="center"/>
39253 <colspec colwidth="6*" align="center"/>
39254 <colspec colwidth="6*" align="right"/>
39255 <tbody>
39256 <row>
39257 <entry><option>syntax_errors_text</option></entry>
39258 <entry>Use: <emphasis>redirect</emphasis></entry>
39259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39260 <entry>Default: <emphasis>unset</emphasis></entry>
39261 </row>
39262 </tbody>
39263 </tgroup>
39264 </informaltable>
39265 <para>
39266 See <option>skip_syntax_errors</option> above.
39267 </para>
39268 <para>
39269 <indexterm role="option">
39270 <primary><option>syntax_errors_to</option></primary>
39271 </indexterm>
39272 </para>
39273 <informaltable frame="all">
39274 <tgroup cols="4" colsep="0" rowsep="0">
39275 <colspec colwidth="8*" align="left"/>
39276 <colspec colwidth="6*" align="center"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="right"/>
39279 <tbody>
39280 <row>
39281 <entry><option>syntax_errors_to</option></entry>
39282 <entry>Use: <emphasis>redirect</emphasis></entry>
39283 <entry>Type: <emphasis>string</emphasis></entry>
39284 <entry>Default: <emphasis>unset</emphasis></entry>
39285 </row>
39286 </tbody>
39287 </tgroup>
39288 </informaltable>
39289 <para>
39290 See <option>skip_syntax_errors</option> above.
39291 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
39292 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
39293 </para>
39294 </section>
39295 </chapter>
39296
39297 <chapter id="CHAPenvironment">
39298 <title>Environment for running local transports</title>
39299 <titleabbrev>Environment for local transports</titleabbrev>
39300 <para>
39301 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
39302 <primary>local transports</primary>
39303 <secondary>environment for</secondary>
39304 </indexterm>
39305 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
39306 <primary>environment</primary>
39307 <secondary>local transports</secondary>
39308 </indexterm>
39309 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
39310 <primary>transport</primary>
39311 <secondary>local; environment for</secondary>
39312 </indexterm>
39313 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
39314 transport can be thought of as similar to a pipe.) Exim always runs transports
39315 in subprocesses, under specified uids and gids. Typical deliveries to local
39316 mailboxes run under the uid and gid of the local user.
39317 </para>
39318 <para>
39319 Exim also sets a specific current directory while running the transport; for
39320 some transports a home directory setting is also relevant. The <command>pipe</command>
39321 transport is the only one that sets up environment variables; see section
39322 <xref linkend="SECTpipeenv"/> for details.
39323 </para>
39324 <para>
39325 The values used for the uid, gid, and the directories may come from several
39326 different places. In many cases, the router that handles the address associates
39327 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
39328 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
39329 configuration, and these override anything that comes from the router.
39330 </para>
39331 <section id="SECID131">
39332 <title>Concurrent deliveries</title>
39333 <para>
39334 <indexterm role="concept">
39335 <primary>concurrent deliveries</primary>
39336 </indexterm>
39337 <indexterm role="concept">
39338 <primary>simultaneous deliveries</primary>
39339 </indexterm>
39340 If two different messages for the same local recipient arrive more or less
39341 simultaneously, the two delivery processes are likely to run concurrently. When
39342 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
39343 rules to stop concurrent processes from writing to the same file at the same
39344 time.
39345 </para>
39346 <para>
39347 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
39348 locking that is needed. Here is a silly example:
39349 </para>
39350 <literallayout class="monospaced">
39351 my_transport:
39352   driver = pipe
39353   command = /bin/sh -c 'cat &gt;&gt;/some/file'
39354 </literallayout>
39355 <para>
39356 This is supposed to write the message at the end of the file. However, if two
39357 messages arrive at the same time, the file will be scrambled. You can use the
39358 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
39359 file using the same algorithm that Exim itself uses.
39360 </para>
39361 </section>
39362 <section id="SECTenvuidgid">
39363 <title>Uids and gids</title>
39364 <para>
39365 <indexterm role="concept">
39366 <primary>local transports</primary>
39367 <secondary>uid and gid</secondary>
39368 </indexterm>
39369 <indexterm role="concept">
39370 <primary>transport</primary>
39371 <secondary>local; uid and gid</secondary>
39372 </indexterm>
39373 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
39374 overrides any group that the router set in the address, even if <option>user</option> is not
39375 set for the transport. This makes it possible, for example, to run local mail
39376 delivery under the uid of the recipient (set by the router), but in a special
39377 group (set by the transport). For example:
39378 </para>
39379 <literallayout class="monospaced">
39380 # Routers ...
39381 # User/group are set by check_local_user in this router
39382 local_users:
39383   driver = accept
39384   check_local_user
39385   transport = group_delivery
39386
39387 # Transports ...
39388 # This transport overrides the group
39389 group_delivery:
39390   driver = appendfile
39391   file = /var/spool/mail/$local_part
39392   group = mail
39393 </literallayout>
39394 <para>
39395 If <option>user</option> is set for a transport, its value overrides what is set in the
39396 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
39397 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
39398 set.
39399 </para>
39400 <para>
39401 <indexterm role="option">
39402 <primary><option>initgroups</option></primary>
39403 </indexterm>
39404 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
39405 function is called for the groups associated with that uid if the
39406 <option>initgroups</option> option is set for the transport. When the uid is not specified
39407 by the transport, but is associated with the address by a router, the option
39408 for calling <function>initgroups()</function> is taken from the router configuration.
39409 </para>
39410 <para>
39411 <indexterm role="concept">
39412 <primary><command>pipe</command> transport</primary>
39413 <secondary>uid for</secondary>
39414 </indexterm>
39415 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
39416 is set and <option>user</option> is not set, the uid of the process that called Exim to
39417 receive the message is used, and if <option>group</option> is not set, the corresponding
39418 original gid is also used.
39419 </para>
39420 <para>
39421 This is the detailed preference order for obtaining a gid; the first of the
39422 following that is set is used:
39423 </para>
39424 <itemizedlist>
39425 <listitem>
39426 <para>
39427 A <option>group</option> setting of the transport;
39428 </para>
39429 </listitem>
39430 <listitem>
39431 <para>
39432 A <option>group</option> setting of the router;
39433 </para>
39434 </listitem>
39435 <listitem>
39436 <para>
39437 A gid associated with a user setting of the router, either as a result of
39438 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
39439 </para>
39440 </listitem>
39441 <listitem>
39442 <para>
39443 The group associated with a non-numeric <option>user</option> setting of the transport;
39444 </para>
39445 </listitem>
39446 <listitem>
39447 <para>
39448 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
39449 the uid is the creator&#x2019;s uid;
39450 </para>
39451 </listitem>
39452 <listitem>
39453 <para>
39454 The Exim gid if the Exim uid is being used as a default.
39455 </para>
39456 </listitem>
39457 </itemizedlist>
39458 <para>
39459 If, for example, the user is specified numerically on the router and there are
39460 no group settings, no gid is available. In this situation, an error occurs.
39461 This is different for the uid, for which there always is an ultimate default.
39462 The first of the following that is set is used:
39463 </para>
39464 <itemizedlist>
39465 <listitem>
39466 <para>
39467 A <option>user</option> setting of the transport;
39468 </para>
39469 </listitem>
39470 <listitem>
39471 <para>
39472 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
39473 </para>
39474 </listitem>
39475 <listitem>
39476 <para>
39477 A <option>user</option> setting of the router;
39478 </para>
39479 </listitem>
39480 <listitem>
39481 <para>
39482 A <option>check_local_user</option> setting of the router;
39483 </para>
39484 </listitem>
39485 <listitem>
39486 <para>
39487 The Exim uid.
39488 </para>
39489 </listitem>
39490 </itemizedlist>
39491 <para>
39492 Of course, an error will still occur if the uid that is chosen is on the
39493 <option>never_users</option> list.
39494 </para>
39495 </section>
39496 <section id="SECID132">
39497 <title>Current and home directories</title>
39498 <para>
39499 <indexterm role="concept">
39500 <primary>current directory for local transport</primary>
39501 </indexterm>
39502 <indexterm role="concept">
39503 <primary>home directory</primary>
39504 <secondary>for local transport</secondary>
39505 </indexterm>
39506 <indexterm role="concept">
39507 <primary>transport</primary>
39508 <secondary>local; home directory for</secondary>
39509 </indexterm>
39510 <indexterm role="concept">
39511 <primary>transport</primary>
39512 <secondary>local; current directory for</secondary>
39513 </indexterm>
39514 Routers may set current and home directories for local transports by means of
39515 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
39516 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
39517 are set, they override the router&#x2019;s values. In detail, the home directory
39518 for a local transport is taken from the first of these values that is set:
39519 </para>
39520 <itemizedlist>
39521 <listitem>
39522 <para>
39523 The <option>home_directory</option> option on the transport;
39524 </para>
39525 </listitem>
39526 <listitem>
39527 <para>
39528 The <option>transport_home_directory</option> option on the router;
39529 </para>
39530 </listitem>
39531 <listitem>
39532 <para>
39533 The password data if <option>check_local_user</option> is set on the router;
39534 </para>
39535 </listitem>
39536 <listitem>
39537 <para>
39538 The <option>router_home_directory</option> option on the router.
39539 </para>
39540 </listitem>
39541 </itemizedlist>
39542 <para>
39543 The current directory is taken from the first of these values that is set:
39544 </para>
39545 <itemizedlist>
39546 <listitem>
39547 <para>
39548 The <option>current_directory</option> option on the transport;
39549 </para>
39550 </listitem>
39551 <listitem>
39552 <para>
39553 The <option>transport_current_directory</option> option on the router.
39554 </para>
39555 </listitem>
39556 </itemizedlist>
39557 <para>
39558 If neither the router nor the transport sets a current directory, Exim uses the
39559 value of the home directory, if it is set. Otherwise it sets the current
39560 directory to <filename>/</filename> before running a local transport.
39561 </para>
39562 </section>
39563 <section id="SECID133">
39564 <title>Expansion variables derived from the address</title>
39565 <para>
39566 <indexterm role="variable">
39567 <primary><varname>$domain</varname></primary>
39568 </indexterm>
39569 <indexterm role="variable">
39570 <primary><varname>$local_part</varname></primary>
39571 </indexterm>
39572 <indexterm role="variable">
39573 <primary><varname>$original_domain</varname></primary>
39574 </indexterm>
39575 Normally a local delivery is handling a single address, and in that case the
39576 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
39577 deliveries. However, in some circumstances more than one address may be handled
39578 at once (for example, while writing batch SMTP for onward transmission by some
39579 other means). In this case, the variables associated with the local part are
39580 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
39581 and <varname>$original_domain</varname> is never set.
39582 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
39583 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
39584 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
39585 </para>
39586 </section>
39587 </chapter>
39588
39589 <chapter id="CHAPtransportgeneric">
39590 <title>Generic options for transports</title>
39591 <para>
39592 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
39593 <primary>generic options</primary>
39594 <secondary>transport</secondary>
39595 </indexterm>
39596 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
39597 <primary>options</primary>
39598 <secondary>generic; for transports</secondary>
39599 </indexterm>
39600 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
39601 <primary>transport</primary>
39602 <secondary>generic options for</secondary>
39603 </indexterm>
39604 The following generic options apply to all transports:
39605 </para>
39606 <para>
39607 <indexterm role="option">
39608 <primary><option>body_only</option></primary>
39609 </indexterm>
39610 </para>
39611 <informaltable frame="all">
39612 <tgroup cols="4" colsep="0" rowsep="0">
39613 <colspec colwidth="8*" align="left"/>
39614 <colspec colwidth="6*" align="center"/>
39615 <colspec colwidth="6*" align="center"/>
39616 <colspec colwidth="6*" align="right"/>
39617 <tbody>
39618 <row>
39619 <entry><option>body_only</option></entry>
39620 <entry>Use: <emphasis>transports</emphasis></entry>
39621 <entry>Type: <emphasis>boolean</emphasis></entry>
39622 <entry>Default: <emphasis>false</emphasis></entry>
39623 </row>
39624 </tbody>
39625 </tgroup>
39626 </informaltable>
39627 <para>
39628 <indexterm role="concept">
39629 <primary>transport</primary>
39630 <secondary>body only</secondary>
39631 </indexterm>
39632 <indexterm role="concept">
39633 <primary>message</primary>
39634 <secondary>transporting body only</secondary>
39635 </indexterm>
39636 <indexterm role="concept">
39637 <primary>body of message</primary>
39638 <secondary>transporting</secondary>
39639 </indexterm>
39640 If this option is set, the message&#x2019;s headers are not transported. It is
39641 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
39642 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
39643 <option>message_suffix</option> should be checked, because this option does not
39644 automatically suppress them.
39645 </para>
39646 <para>
39647 <indexterm role="option">
39648 <primary><option>current_directory</option></primary>
39649 </indexterm>
39650 </para>
39651 <informaltable frame="all">
39652 <tgroup cols="4" colsep="0" rowsep="0">
39653 <colspec colwidth="8*" align="left"/>
39654 <colspec colwidth="6*" align="center"/>
39655 <colspec colwidth="6*" align="center"/>
39656 <colspec colwidth="6*" align="right"/>
39657 <tbody>
39658 <row>
39659 <entry><option>current_directory</option></entry>
39660 <entry>Use: <emphasis>transports</emphasis></entry>
39661 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39662 <entry>Default: <emphasis>unset</emphasis></entry>
39663 </row>
39664 </tbody>
39665 </tgroup>
39666 </informaltable>
39667 <para>
39668 <indexterm role="concept">
39669 <primary>transport</primary>
39670 <secondary>current directory for</secondary>
39671 </indexterm>
39672 This specifies the current directory that is to be set while running the
39673 transport, overriding any value that may have been set by the router.
39674 If the expansion fails for any reason, including forced failure, an error is
39675 logged, and delivery is deferred.
39676 </para>
39677 <para>
39678 <indexterm role="option">
39679 <primary><option>disable_logging</option></primary>
39680 </indexterm>
39681 </para>
39682 <informaltable frame="all">
39683 <tgroup cols="4" colsep="0" rowsep="0">
39684 <colspec colwidth="8*" align="left"/>
39685 <colspec colwidth="6*" align="center"/>
39686 <colspec colwidth="6*" align="center"/>
39687 <colspec colwidth="6*" align="right"/>
39688 <tbody>
39689 <row>
39690 <entry><option>disable_logging</option></entry>
39691 <entry>Use: <emphasis>transports</emphasis></entry>
39692 <entry>Type: <emphasis>boolean</emphasis></entry>
39693 <entry>Default: <emphasis>false</emphasis></entry>
39694 </row>
39695 </tbody>
39696 </tgroup>
39697 </informaltable>
39698 <para>
39699 If this option is set true, nothing is logged for any
39700 deliveries by the transport or for any
39701 transport errors. You should not set this option unless you really, really know
39702 what you are doing.
39703 </para>
39704 <para>
39705 <indexterm role="option">
39706 <primary><option>debug_print</option></primary>
39707 </indexterm>
39708 </para>
39709 <informaltable frame="all">
39710 <tgroup cols="4" colsep="0" rowsep="0">
39711 <colspec colwidth="8*" align="left"/>
39712 <colspec colwidth="6*" align="center"/>
39713 <colspec colwidth="6*" align="center"/>
39714 <colspec colwidth="6*" align="right"/>
39715 <tbody>
39716 <row>
39717 <entry><option>debug_print</option></entry>
39718 <entry>Use: <emphasis>transports</emphasis></entry>
39719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39720 <entry>Default: <emphasis>unset</emphasis></entry>
39721 </row>
39722 </tbody>
39723 </tgroup>
39724 </informaltable>
39725 <para>
39726 <indexterm role="concept">
39727 <primary>testing</primary>
39728 <secondary>variables in drivers</secondary>
39729 </indexterm>
39730 If this option is set and debugging is enabled (see the <option>-d</option> command line
39731 option), the string is expanded and included in the debugging output when the
39732 transport is run.
39733 If expansion of the string fails, the error message is written to the debugging
39734 output, and Exim carries on processing.
39735 This facility is provided to help with checking out the values of variables and
39736 so on when debugging driver configurations. For example, if a <option>headers_add</option>
39737 option is not working properly, <option>debug_print</option> could be used to output the
39738 variables it references. A newline is added to the text if it does not end with
39739 one.
39740 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
39741 transport and the router that called it.
39742 </para>
39743 <para>
39744 <indexterm role="option">
39745 <primary><option>delivery_date_add</option></primary>
39746 </indexterm>
39747 </para>
39748 <informaltable frame="all">
39749 <tgroup cols="4" colsep="0" rowsep="0">
39750 <colspec colwidth="8*" align="left"/>
39751 <colspec colwidth="6*" align="center"/>
39752 <colspec colwidth="6*" align="center"/>
39753 <colspec colwidth="6*" align="right"/>
39754 <tbody>
39755 <row>
39756 <entry><option>delivery_date_add</option></entry>
39757 <entry>Use: <emphasis>transports</emphasis></entry>
39758 <entry>Type: <emphasis>boolean</emphasis></entry>
39759 <entry>Default: <emphasis>false</emphasis></entry>
39760 </row>
39761 </tbody>
39762 </tgroup>
39763 </informaltable>
39764 <para>
39765 <indexterm role="concept">
39766 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
39767 </indexterm>
39768 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
39769 This gives the actual time the delivery was made. As this is not a standard
39770 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
39771 requests its removal from incoming messages, so that delivered messages can
39772 safely be resent to other recipients.
39773 </para>
39774 <para>
39775 <indexterm role="option">
39776 <primary><option>driver</option></primary>
39777 </indexterm>
39778 </para>
39779 <informaltable frame="all">
39780 <tgroup cols="4" colsep="0" rowsep="0">
39781 <colspec colwidth="8*" align="left"/>
39782 <colspec colwidth="6*" align="center"/>
39783 <colspec colwidth="6*" align="center"/>
39784 <colspec colwidth="6*" align="right"/>
39785 <tbody>
39786 <row>
39787 <entry><option>driver</option></entry>
39788 <entry>Use: <emphasis>transports</emphasis></entry>
39789 <entry>Type: <emphasis>string</emphasis></entry>
39790 <entry>Default: <emphasis>unset</emphasis></entry>
39791 </row>
39792 </tbody>
39793 </tgroup>
39794 </informaltable>
39795 <para>
39796 This specifies which of the available transport drivers is to be used.
39797 There is no default, and this option must be set for every transport.
39798 </para>
39799 <para>
39800 <indexterm role="option">
39801 <primary><option>envelope_to_add</option></primary>
39802 </indexterm>
39803 </para>
39804 <informaltable frame="all">
39805 <tgroup cols="4" colsep="0" rowsep="0">
39806 <colspec colwidth="8*" align="left"/>
39807 <colspec colwidth="6*" align="center"/>
39808 <colspec colwidth="6*" align="center"/>
39809 <colspec colwidth="6*" align="right"/>
39810 <tbody>
39811 <row>
39812 <entry><option>envelope_to_add</option></entry>
39813 <entry>Use: <emphasis>transports</emphasis></entry>
39814 <entry>Type: <emphasis>boolean</emphasis></entry>
39815 <entry>Default: <emphasis>false</emphasis></entry>
39816 </row>
39817 </tbody>
39818 </tgroup>
39819 </informaltable>
39820 <para>
39821 <indexterm role="concept">
39822 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39823 </indexterm>
39824 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
39825 This gives the original address(es) in the incoming envelope that caused this
39826 delivery to happen. More than one address may be present if the transport is
39827 configured to handle several addresses at once, or if more than one original
39828 address was redirected to the same final address. As this is not a standard
39829 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
39830 its removal from incoming messages, so that delivered messages can safely be
39831 resent to other recipients.
39832 </para>
39833 <para>
39834 <indexterm role="option">
39835 <primary><option>event_action</option></primary>
39836 </indexterm>
39837 </para>
39838 <informaltable frame="all">
39839 <tgroup cols="4" colsep="0" rowsep="0">
39840 <colspec colwidth="8*" align="left"/>
39841 <colspec colwidth="6*" align="center"/>
39842 <colspec colwidth="6*" align="center"/>
39843 <colspec colwidth="6*" align="right"/>
39844 <tbody>
39845 <row>
39846 <entry><option>event_action</option></entry>
39847 <entry>Use: <emphasis>transports</emphasis></entry>
39848 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39849 <entry>Default: <emphasis>unset</emphasis></entry>
39850 </row>
39851 </tbody>
39852 </tgroup>
39853 </informaltable>
39854 <para>
39855 <indexterm role="concept">
39856 <primary>events</primary>
39857 </indexterm>
39858 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
39859 For details see chapter <xref linkend="CHAPevents"/>.
39860 </para>
39861 <para>
39862 <indexterm role="option">
39863 <primary><option>group</option></primary>
39864 </indexterm>
39865 </para>
39866 <informaltable frame="all">
39867 <tgroup cols="4" colsep="0" rowsep="0">
39868 <colspec colwidth="8*" align="left"/>
39869 <colspec colwidth="6*" align="center"/>
39870 <colspec colwidth="6*" align="center"/>
39871 <colspec colwidth="6*" align="right"/>
39872 <tbody>
39873 <row>
39874 <entry><option>group</option></entry>
39875 <entry>Use: <emphasis>transports</emphasis></entry>
39876 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39877 <entry>Default: <emphasis>Exim group</emphasis></entry>
39878 </row>
39879 </tbody>
39880 </tgroup>
39881 </informaltable>
39882 <para>
39883 <indexterm role="concept">
39884 <primary>transport</primary>
39885 <secondary>group; specifying</secondary>
39886 </indexterm>
39887 This option specifies a gid for running the transport process, overriding any
39888 value that the router supplies, and also overriding any value associated with
39889 <option>user</option> (see below).
39890 </para>
39891 <para>
39892 <indexterm role="option">
39893 <primary><option>headers_add</option></primary>
39894 </indexterm>
39895 </para>
39896 <informaltable frame="all">
39897 <tgroup cols="4" colsep="0" rowsep="0">
39898 <colspec colwidth="8*" align="left"/>
39899 <colspec colwidth="6*" align="center"/>
39900 <colspec colwidth="6*" align="center"/>
39901 <colspec colwidth="6*" align="right"/>
39902 <tbody>
39903 <row>
39904 <entry><option>headers_add</option></entry>
39905 <entry>Use: <emphasis>transports</emphasis></entry>
39906 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39907 <entry>Default: <emphasis>unset</emphasis></entry>
39908 </row>
39909 </tbody>
39910 </tgroup>
39911 </informaltable>
39912 <para>
39913 <indexterm role="concept">
39914 <primary>header lines</primary>
39915 <secondary>adding in transport</secondary>
39916 </indexterm>
39917 <indexterm role="concept">
39918 <primary>transport</primary>
39919 <secondary>header lines; adding</secondary>
39920 </indexterm>
39921 This option specifies a list of text headers,
39922 newline-separated (by default, changeable in the usual way),
39923 which are (separately) expanded and added to the header
39924 portion of a message as it is transported, as described in section
39925 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
39926 routers. If the result of the expansion is an empty string, or if the expansion
39927 is forced to fail, no action is taken. Other expansion failures are treated as
39928 errors and cause the delivery to be deferred.
39929 </para>
39930 <para>
39931 Unlike most options, <option>headers_add</option> can be specified multiple times
39932 for a transport; all listed headers are added.
39933 </para>
39934 <para>
39935 <indexterm role="option">
39936 <primary><option>headers_only</option></primary>
39937 </indexterm>
39938 </para>
39939 <informaltable frame="all">
39940 <tgroup cols="4" colsep="0" rowsep="0">
39941 <colspec colwidth="8*" align="left"/>
39942 <colspec colwidth="6*" align="center"/>
39943 <colspec colwidth="6*" align="center"/>
39944 <colspec colwidth="6*" align="right"/>
39945 <tbody>
39946 <row>
39947 <entry><option>headers_only</option></entry>
39948 <entry>Use: <emphasis>transports</emphasis></entry>
39949 <entry>Type: <emphasis>boolean</emphasis></entry>
39950 <entry>Default: <emphasis>false</emphasis></entry>
39951 </row>
39952 </tbody>
39953 </tgroup>
39954 </informaltable>
39955 <para>
39956 <indexterm role="concept">
39957 <primary>transport</primary>
39958 <secondary>header lines only</secondary>
39959 </indexterm>
39960 <indexterm role="concept">
39961 <primary>message</primary>
39962 <secondary>transporting headers only</secondary>
39963 </indexterm>
39964 <indexterm role="concept">
39965 <primary>header lines</primary>
39966 <secondary>transporting</secondary>
39967 </indexterm>
39968 If this option is set, the message&#x2019;s body is not transported. It is mutually
39969 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
39970 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
39971 checked, since this option does not automatically suppress them.
39972 </para>
39973 <para>
39974 <indexterm role="option">
39975 <primary><option>headers_remove</option></primary>
39976 </indexterm>
39977 </para>
39978 <informaltable frame="all">
39979 <tgroup cols="4" colsep="0" rowsep="0">
39980 <colspec colwidth="8*" align="left"/>
39981 <colspec colwidth="6*" align="center"/>
39982 <colspec colwidth="6*" align="center"/>
39983 <colspec colwidth="6*" align="right"/>
39984 <tbody>
39985 <row>
39986 <entry><option>headers_remove</option></entry>
39987 <entry>Use: <emphasis>transports</emphasis></entry>
39988 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39989 <entry>Default: <emphasis>unset</emphasis></entry>
39990 </row>
39991 </tbody>
39992 </tgroup>
39993 </informaltable>
39994 <para>
39995 <indexterm role="concept">
39996 <primary>header lines</primary>
39997 <secondary>removing</secondary>
39998 </indexterm>
39999 <indexterm role="concept">
40000 <primary>transport</primary>
40001 <secondary>header lines; removing</secondary>
40002 </indexterm>
40003 This option specifies a list of header names,
40004 colon-separated (by default, changeable in the usual way);
40005 these headers are omitted from the message as it is transported, as described
40006 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
40007 routers.
40008 Each list item is separately expanded.
40009 If the result of the expansion is an empty string, or if the expansion
40010 is forced to fail, no action is taken. Other expansion failures are treated as
40011 errors and cause the delivery to be deferred.
40012 </para>
40013 <para>
40014 Unlike most options, <option>headers_remove</option> can be specified multiple times
40015 for a transport; all listed headers are removed.
40016 </para>
40017 <para>
40018 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
40019 items that contain a list separator must have it doubled.
40020 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
40021 </para>
40022 <para>
40023 <indexterm role="option">
40024 <primary><option>headers_rewrite</option></primary>
40025 </indexterm>
40026 </para>
40027 <informaltable frame="all">
40028 <tgroup cols="4" colsep="0" rowsep="0">
40029 <colspec colwidth="8*" align="left"/>
40030 <colspec colwidth="6*" align="center"/>
40031 <colspec colwidth="6*" align="center"/>
40032 <colspec colwidth="6*" align="right"/>
40033 <tbody>
40034 <row>
40035 <entry><option>headers_rewrite</option></entry>
40036 <entry>Use: <emphasis>transports</emphasis></entry>
40037 <entry>Type: <emphasis>string</emphasis></entry>
40038 <entry>Default: <emphasis>unset</emphasis></entry>
40039 </row>
40040 </tbody>
40041 </tgroup>
40042 </informaltable>
40043 <para>
40044 <indexterm role="concept">
40045 <primary>transport</primary>
40046 <secondary>header lines; rewriting</secondary>
40047 </indexterm>
40048 <indexterm role="concept">
40049 <primary>rewriting</primary>
40050 <secondary>at transport time</secondary>
40051 </indexterm>
40052 This option allows addresses in header lines to be rewritten at transport time,
40053 that is, as the message is being copied to its destination. The contents of the
40054 option are a colon-separated list of rewriting rules. Each rule is in exactly
40055 the same form as one of the general rewriting rules that are applied when a
40056 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
40057 example,
40058 </para>
40059 <literallayout class="monospaced">
40060 headers_rewrite = a@b c@d f : \
40061                   x@y w@z
40062 </literallayout>
40063 <para>
40064 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
40065 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
40066 header lines just before they are written out at transport time, so they affect
40067 only those copies of the message that pass through the transport. However, only
40068 the message&#x2019;s original header lines, and any that were added by a system
40069 filter, are rewritten. If a router or transport adds header lines, they are not
40070 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
40071 envelope. You can change the return path using <option>return_path</option>, but you cannot
40072 change envelope recipients at this time.
40073 </para>
40074 <para>
40075 <indexterm role="option">
40076 <primary><option>home_directory</option></primary>
40077 </indexterm>
40078 </para>
40079 <informaltable frame="all">
40080 <tgroup cols="4" colsep="0" rowsep="0">
40081 <colspec colwidth="8*" align="left"/>
40082 <colspec colwidth="6*" align="center"/>
40083 <colspec colwidth="6*" align="center"/>
40084 <colspec colwidth="6*" align="right"/>
40085 <tbody>
40086 <row>
40087 <entry><option>home_directory</option></entry>
40088 <entry>Use: <emphasis>transports</emphasis></entry>
40089 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40090 <entry>Default: <emphasis>unset</emphasis></entry>
40091 </row>
40092 </tbody>
40093 </tgroup>
40094 </informaltable>
40095 <para>
40096 <indexterm role="concept">
40097 <primary>transport</primary>
40098 <secondary>home directory for</secondary>
40099 </indexterm>
40100 <indexterm role="variable">
40101 <primary><varname>$home</varname></primary>
40102 </indexterm>
40103 This option specifies a home directory setting for a local transport,
40104 overriding any value that may be set by the router. The home directory is
40105 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
40106 used as the current directory if no current directory is set by the
40107 <option>current_directory</option> option on the transport or the
40108 <option>transport_current_directory</option> option on the router. If the expansion fails
40109 for any reason, including forced failure, an error is logged, and delivery is
40110 deferred.
40111 </para>
40112 <para>
40113 <indexterm role="option">
40114 <primary><option>initgroups</option></primary>
40115 </indexterm>
40116 </para>
40117 <informaltable frame="all">
40118 <tgroup cols="4" colsep="0" rowsep="0">
40119 <colspec colwidth="8*" align="left"/>
40120 <colspec colwidth="6*" align="center"/>
40121 <colspec colwidth="6*" align="center"/>
40122 <colspec colwidth="6*" align="right"/>
40123 <tbody>
40124 <row>
40125 <entry><option>initgroups</option></entry>
40126 <entry>Use: <emphasis>transports</emphasis></entry>
40127 <entry>Type: <emphasis>boolean</emphasis></entry>
40128 <entry>Default: <emphasis>false</emphasis></entry>
40129 </row>
40130 </tbody>
40131 </tgroup>
40132 </informaltable>
40133 <para>
40134 <indexterm role="concept">
40135 <primary>additional groups</primary>
40136 </indexterm>
40137 <indexterm role="concept">
40138 <primary>groups</primary>
40139 <secondary>additional</secondary>
40140 </indexterm>
40141 <indexterm role="concept">
40142 <primary>transport</primary>
40143 <secondary>group; additional</secondary>
40144 </indexterm>
40145 If this option is true and the uid for the delivery process is provided by the
40146 transport, the <function>initgroups()</function> function is called when running the transport
40147 to ensure that any additional groups associated with the uid are set up.
40148 </para>
40149 <para>
40150 <indexterm role="option">
40151 <primary><option>max_parallel</option></primary>
40152 </indexterm>
40153 </para>
40154 <informaltable frame="all">
40155 <tgroup cols="4" colsep="0" rowsep="0">
40156 <colspec colwidth="8*" align="left"/>
40157 <colspec colwidth="6*" align="center"/>
40158 <colspec colwidth="6*" align="center"/>
40159 <colspec colwidth="6*" align="right"/>
40160 <tbody>
40161 <row>
40162 <entry><option>max_parallel</option></entry>
40163 <entry>Use: <emphasis>transports</emphasis></entry>
40164 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
40165 <entry>Default: <emphasis>unset</emphasis></entry>
40166 </row>
40167 </tbody>
40168 </tgroup>
40169 </informaltable>
40170 <para>
40171 <indexterm role="concept">
40172 <primary>limit</primary>
40173 <secondary>transport parallelism</secondary>
40174 </indexterm>
40175 <indexterm role="concept">
40176 <primary>transport</primary>
40177 <secondary>parallel processes</secondary>
40178 </indexterm>
40179 <indexterm role="concept">
40180 <primary>transport</primary>
40181 <secondary>concurrency limit</secondary>
40182 </indexterm>
40183 <indexterm role="concept">
40184 <primary>delivery</primary>
40185 <secondary>parallelism for transport</secondary>
40186 </indexterm>
40187 If this option is set and expands to an integer greater than zero
40188 it limits the number of concurrent runs of the transport.
40189 The control does not apply to shadow transports.
40190 </para>
40191 <para>
40192 <indexterm role="concept">
40193 <primary>hints database</primary>
40194 <secondary>transport concurrency control</secondary>
40195 </indexterm>
40196 Exim implements this control by means of a hints database in which a record is
40197 incremented whenever a transport process is being created. The record
40198 is decremented and possibly removed when the process terminates.
40199 Obviously there is scope for
40200 records to get left lying around if there is a system or program crash. To
40201 guard against this, Exim ignores any records that are more than six hours old.
40202 </para>
40203 <para>
40204 If you use this option, you should also arrange to delete the
40205 relevant hints database whenever your system reboots. The names of the files
40206 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
40207 may be one or two files, depending on the type of DBM in use. The same files
40208 are used for ETRN and smtp transport serialization.
40209 </para>
40210 <para>
40211 <indexterm role="option">
40212 <primary><option>message_size_limit</option></primary>
40213 </indexterm>
40214 </para>
40215 <informaltable frame="all">
40216 <tgroup cols="4" colsep="0" rowsep="0">
40217 <colspec colwidth="8*" align="left"/>
40218 <colspec colwidth="6*" align="center"/>
40219 <colspec colwidth="6*" align="center"/>
40220 <colspec colwidth="6*" align="right"/>
40221 <tbody>
40222 <row>
40223 <entry><option>message_size_limit</option></entry>
40224 <entry>Use: <emphasis>transports</emphasis></entry>
40225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40226 <entry>Default: <emphasis>0</emphasis></entry>
40227 </row>
40228 </tbody>
40229 </tgroup>
40230 </informaltable>
40231 <para>
40232 <indexterm role="concept">
40233 <primary>limit</primary>
40234 <secondary>message size per transport</secondary>
40235 </indexterm>
40236 <indexterm role="concept">
40237 <primary>size</primary>
40238 <secondary>of message, limit</secondary>
40239 </indexterm>
40240 <indexterm role="concept">
40241 <primary>transport</primary>
40242 <secondary>message size; limiting</secondary>
40243 </indexterm>
40244 This option controls the size of messages passed through the transport. It is
40245 expanded before use; the result of the expansion must be a sequence of decimal
40246 digits, optionally followed by K or M. If the expansion fails for any reason,
40247 including forced failure, or if the result is not of the required form,
40248 delivery is deferred. If the value is greater than zero and the size of a
40249 message exceeds this limit, the address is failed. If there is any chance that
40250 the resulting bounce message could be routed to the same transport, you should
40251 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
40252 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
40253 delivered.
40254 </para>
40255 <para>
40256 <indexterm role="option">
40257 <primary><option>rcpt_include_affixes</option></primary>
40258 </indexterm>
40259 </para>
40260 <informaltable frame="all">
40261 <tgroup cols="4" colsep="0" rowsep="0">
40262 <colspec colwidth="8*" align="left"/>
40263 <colspec colwidth="6*" align="center"/>
40264 <colspec colwidth="6*" align="center"/>
40265 <colspec colwidth="6*" align="right"/>
40266 <tbody>
40267 <row>
40268 <entry><option>rcpt_include_affixes</option></entry>
40269 <entry>Use: <emphasis>transports</emphasis></entry>
40270 <entry>Type: <emphasis>boolean</emphasis></entry>
40271 <entry>Default: <emphasis>false</emphasis></entry>
40272 </row>
40273 </tbody>
40274 </tgroup>
40275 </informaltable>
40276 <para>
40277 <indexterm role="concept">
40278 <primary>prefix</primary>
40279 <secondary>for local part, including in envelope</secondary>
40280 </indexterm>
40281 <indexterm role="concept">
40282 <primary>suffix for local part</primary>
40283 <secondary>including in envelope</secondary>
40284 </indexterm>
40285 <indexterm role="concept">
40286 <primary>local part</primary>
40287 <secondary>prefix</secondary>
40288 </indexterm>
40289 <indexterm role="concept">
40290 <primary>local part</primary>
40291 <secondary>suffix</secondary>
40292 </indexterm>
40293 When this option is false (the default), and an address that has had any
40294 affixes (prefixes or suffixes) removed from the local part is delivered by any
40295 form of SMTP or LMTP, the affixes are not included. For example, if a router
40296 that contains
40297 </para>
40298 <literallayout class="monospaced">
40299 local_part_prefix = *-
40300 </literallayout>
40301 <para>
40302 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
40303 is delivered with
40304 </para>
40305 <literallayout class="monospaced">
40306 RCPT TO:&lt;xyz@some.domain&gt;
40307 </literallayout>
40308 <para>
40309 This is also the case when an ACL-time callout is being used to verify a
40310 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
40311 whole local part is included in the RCPT command. This option applies to BSMTP
40312 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
40313 <command>lmtp</command> and <command>smtp</command> transports.
40314 </para>
40315 <para>
40316 <indexterm role="option">
40317 <primary><option>retry_use_local_part</option></primary>
40318 </indexterm>
40319 </para>
40320 <informaltable frame="all">
40321 <tgroup cols="4" colsep="0" rowsep="0">
40322 <colspec colwidth="8*" align="left"/>
40323 <colspec colwidth="6*" align="center"/>
40324 <colspec colwidth="6*" align="center"/>
40325 <colspec colwidth="6*" align="right"/>
40326 <tbody>
40327 <row>
40328 <entry><option>retry_use_local_part</option></entry>
40329 <entry>Use: <emphasis>transports</emphasis></entry>
40330 <entry>Type: <emphasis>boolean</emphasis></entry>
40331 <entry>Default: <emphasis>see below</emphasis></entry>
40332 </row>
40333 </tbody>
40334 </tgroup>
40335 </informaltable>
40336 <para>
40337 <indexterm role="concept">
40338 <primary>hints database</primary>
40339 <secondary>retry keys</secondary>
40340 </indexterm>
40341 When a delivery suffers a temporary failure, a retry record is created
40342 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
40343 is based on the name and/or IP address of the failing remote host. For local
40344 deliveries, the key is normally the entire address, including both the local
40345 part and the domain. This is suitable for most common cases of local delivery
40346 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
40347 deliveries to that mailbox, not to the whole domain.
40348 </para>
40349 <para>
40350 However, in some special cases you may want to treat a temporary local delivery
40351 as a failure associated with the domain, and not with a particular local part.
40352 (For example, if you are storing all mail for some domain in files.) You can do
40353 this by setting <option>retry_use_local_part</option> false.
40354 </para>
40355 <para>
40356 For all the local transports, its default value is true. For remote transports,
40357 the default value is false for tidiness, but changing the value has no effect
40358 on a remote transport in the current implementation.
40359 </para>
40360 <para>
40361 <indexterm role="option">
40362 <primary><option>return_path</option></primary>
40363 </indexterm>
40364 </para>
40365 <informaltable frame="all">
40366 <tgroup cols="4" colsep="0" rowsep="0">
40367 <colspec colwidth="8*" align="left"/>
40368 <colspec colwidth="6*" align="center"/>
40369 <colspec colwidth="6*" align="center"/>
40370 <colspec colwidth="6*" align="right"/>
40371 <tbody>
40372 <row>
40373 <entry><option>return_path</option></entry>
40374 <entry>Use: <emphasis>transports</emphasis></entry>
40375 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40376 <entry>Default: <emphasis>unset</emphasis></entry>
40377 </row>
40378 </tbody>
40379 </tgroup>
40380 </informaltable>
40381 <para>
40382 <indexterm role="concept">
40383 <primary>envelope sender</primary>
40384 </indexterm>
40385 <indexterm role="concept">
40386 <primary>transport</primary>
40387 <secondary>return path; changing</secondary>
40388 </indexterm>
40389 <indexterm role="concept">
40390 <primary>return path</primary>
40391 <secondary>changing in transport</secondary>
40392 </indexterm>
40393 If this option is set, the string is expanded at transport time and replaces
40394 the existing return path (envelope sender) value in the copy of the message
40395 that is being delivered. An empty return path is permitted. This feature is
40396 designed for remote deliveries, where the value of this option is used in the
40397 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
40398 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
40399 header line, if one is added to the message (see the next option).
40400 </para>
40401 <para>
40402 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
40403 <option>return_path_on_delivery</option> to the log selector.
40404 </para>
40405 <para>
40406 <indexterm role="variable">
40407 <primary><varname>$return_path</varname></primary>
40408 </indexterm>
40409 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
40410 either the message&#x2019;s envelope sender, or an address set by the
40411 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
40412 replacement occurs; if it fails for another reason, delivery is deferred. This
40413 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
40414 section <xref linkend="SECTverp"/>.
40415 </para>
40416 <para>
40417 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
40418 remote server rejects a message at SMTP time, the bounce message is not sent to
40419 the value of this option. It is sent to the previously set errors address.
40420 This defaults to the incoming sender address, but can be changed by setting
40421 <option>errors_to</option> in a router.
40422 </para>
40423 <para>
40424 <indexterm role="option">
40425 <primary><option>return_path_add</option></primary>
40426 </indexterm>
40427 </para>
40428 <informaltable frame="all">
40429 <tgroup cols="4" colsep="0" rowsep="0">
40430 <colspec colwidth="8*" align="left"/>
40431 <colspec colwidth="6*" align="center"/>
40432 <colspec colwidth="6*" align="center"/>
40433 <colspec colwidth="6*" align="right"/>
40434 <tbody>
40435 <row>
40436 <entry><option>return_path_add</option></entry>
40437 <entry>Use: <emphasis>transports</emphasis></entry>
40438 <entry>Type: <emphasis>boolean</emphasis></entry>
40439 <entry>Default: <emphasis>false</emphasis></entry>
40440 </row>
40441 </tbody>
40442 </tgroup>
40443 </informaltable>
40444 <para>
40445 <indexterm role="concept">
40446 <primary><emphasis>Return-path:</emphasis> header line</primary>
40447 </indexterm>
40448 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
40449 Although the return path is normally available in the prefix line of BSD
40450 mailboxes, this is commonly not displayed by MUAs, and so the user does not
40451 have easy access to it.
40452 </para>
40453 <para>
40454 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
40455 the delivery SMTP server makes the final delivery</quote>. This implies that this
40456 header should not be present in incoming messages. Exim has a configuration
40457 option, <option>return_path_remove</option>, which requests removal of this header from
40458 incoming messages, so that delivered messages can safely be resent to other
40459 recipients.
40460 </para>
40461 <para>
40462 <indexterm role="option">
40463 <primary><option>shadow_condition</option></primary>
40464 </indexterm>
40465 </para>
40466 <informaltable frame="all">
40467 <tgroup cols="4" colsep="0" rowsep="0">
40468 <colspec colwidth="8*" align="left"/>
40469 <colspec colwidth="6*" align="center"/>
40470 <colspec colwidth="6*" align="center"/>
40471 <colspec colwidth="6*" align="right"/>
40472 <tbody>
40473 <row>
40474 <entry><option>shadow_condition</option></entry>
40475 <entry>Use: <emphasis>transports</emphasis></entry>
40476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40477 <entry>Default: <emphasis>unset</emphasis></entry>
40478 </row>
40479 </tbody>
40480 </tgroup>
40481 </informaltable>
40482 <para>
40483 See <option>shadow_transport</option> below.
40484 </para>
40485 <para>
40486 <indexterm role="option">
40487 <primary><option>shadow_transport</option></primary>
40488 </indexterm>
40489 </para>
40490 <informaltable frame="all">
40491 <tgroup cols="4" colsep="0" rowsep="0">
40492 <colspec colwidth="8*" align="left"/>
40493 <colspec colwidth="6*" align="center"/>
40494 <colspec colwidth="6*" align="center"/>
40495 <colspec colwidth="6*" align="right"/>
40496 <tbody>
40497 <row>
40498 <entry><option>shadow_transport</option></entry>
40499 <entry>Use: <emphasis>transports</emphasis></entry>
40500 <entry>Type: <emphasis>string</emphasis></entry>
40501 <entry>Default: <emphasis>unset</emphasis></entry>
40502 </row>
40503 </tbody>
40504 </tgroup>
40505 </informaltable>
40506 <para>
40507 <indexterm role="concept">
40508 <primary>shadow transport</primary>
40509 </indexterm>
40510 <indexterm role="concept">
40511 <primary>transport</primary>
40512 <secondary>shadow</secondary>
40513 </indexterm>
40514 A local transport may set the <option>shadow_transport</option> option to the name of
40515 another local transport. Shadow remote transports are not supported.
40516 </para>
40517 <para>
40518 Whenever a delivery to the main transport succeeds, and either
40519 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
40520 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
40521 passed to the shadow transport, with the same delivery address or addresses. If
40522 expansion fails, no action is taken except that non-forced expansion failures
40523 cause a log line to be written.
40524 </para>
40525 <para>
40526 The result of the shadow transport is discarded and does not affect the
40527 subsequent processing of the message. Only a single level of shadowing is
40528 provided; the <option>shadow_transport</option> option is ignored on any transport when it
40529 is running as a shadow. Options concerned with output from pipes are also
40530 ignored. The log line for the successful delivery has an item added on the end,
40531 of the form
40532 </para>
40533 <literallayout class="monospaced">
40534 ST=&lt;shadow transport name&gt;
40535 </literallayout>
40536 <para>
40537 If the shadow transport did not succeed, the error message is put in
40538 parentheses afterwards. Shadow transports can be used for a number of different
40539 purposes, including keeping more detailed log information than Exim normally
40540 provides, and implementing automatic acknowledgment policies based on message
40541 headers that some sites insist on.
40542 </para>
40543 <para>
40544 <indexterm role="option">
40545 <primary><option>transport_filter</option></primary>
40546 </indexterm>
40547 </para>
40548 <informaltable frame="all">
40549 <tgroup cols="4" colsep="0" rowsep="0">
40550 <colspec colwidth="8*" align="left"/>
40551 <colspec colwidth="6*" align="center"/>
40552 <colspec colwidth="6*" align="center"/>
40553 <colspec colwidth="6*" align="right"/>
40554 <tbody>
40555 <row>
40556 <entry><option>transport_filter</option></entry>
40557 <entry>Use: <emphasis>transports</emphasis></entry>
40558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40559 <entry>Default: <emphasis>unset</emphasis></entry>
40560 </row>
40561 </tbody>
40562 </tgroup>
40563 </informaltable>
40564 <para>
40565 <indexterm role="concept">
40566 <primary>transport</primary>
40567 <secondary>filter</secondary>
40568 </indexterm>
40569 <indexterm role="concept">
40570 <primary>filter</primary>
40571 <secondary>transport filter</secondary>
40572 </indexterm>
40573 This option sets up a filtering (in the Unix shell sense) process for messages
40574 at transport time. It should not be confused with mail filtering as set up by
40575 individual users or via a system filter.
40576 If unset, or expanding to an empty string, no filtering is done.
40577 </para>
40578 <para>
40579 When the message is about to be written out, the command specified by
40580 <option>transport_filter</option> is started up in a separate, parallel process, and
40581 the entire message, including the header lines, is passed to it on its standard
40582 input (this in fact is done from a third process, to avoid deadlock). The
40583 command must be specified as an absolute path.
40584 </para>
40585 <para>
40586 The lines of the message that are written to the transport filter are
40587 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
40588 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
40589 lines beginning with a dot, and also before any processing implied by the
40590 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
40591 <command>pipe</command> transports.
40592 </para>
40593 <para>
40594 The standard error for the filter process is set to the same destination as its
40595 standard output; this is read and written to the message&#x2019;s ultimate
40596 destination. The process that writes the message to the filter, the
40597 filter itself, and the original process that reads the result and delivers it
40598 are all run in parallel, like a shell pipeline.
40599 </para>
40600 <para>
40601 The filter can perform any transformations it likes, but of course should take
40602 care not to break RFC 2822 syntax. Exim does not check the result, except to
40603 test for a final newline when SMTP is in use. All messages transmitted over
40604 SMTP must end with a newline, so Exim supplies one if it is missing.
40605 </para>
40606 <para>
40607 <indexterm role="concept">
40608 <primary>content scanning</primary>
40609 <secondary>per user</secondary>
40610 </indexterm>
40611 A transport filter can be used to provide content-scanning on a per-user basis
40612 at delivery time if the only required effect of the scan is to modify the
40613 message. For example, a content scan could insert a new header line containing
40614 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
40615 not possible to discard a message at this stage.
40616 </para>
40617 <para>
40618 <indexterm role="concept">
40619 <primary>SMTP</primary>
40620 <secondary>SIZE</secondary>
40621 </indexterm>
40622 A problem might arise if the filter increases the size of a message that is
40623 being sent down an SMTP connection. If the receiving SMTP server has indicated
40624 support for the SIZE parameter, Exim will have sent the size of the message
40625 at the start of the SMTP session. If what is actually sent is substantially
40626 more, the server might reject the message. This can be worked round by setting
40627 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
40628 additions to the message, or to disable the use of SIZE altogether.
40629 </para>
40630 <para>
40631 <indexterm role="variable">
40632 <primary><varname>$pipe_addresses</varname></primary>
40633 </indexterm>
40634 The value of the <option>transport_filter</option> option is the command string for starting
40635 the filter, which is run directly from Exim, not under a shell. The string is
40636 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
40637 Exim breaks it up into arguments and then expands each argument separately (see
40638 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
40639 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
40640 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
40641 an ideal name for this feature here, but as it was already implemented for the
40642 <command>pipe</command> transport, it seemed sensible not to change it.)
40643 </para>
40644 <para>
40645 <indexterm role="variable">
40646 <primary><varname>$host</varname></primary>
40647 </indexterm>
40648 <indexterm role="variable">
40649 <primary><varname>$host_address</varname></primary>
40650 </indexterm>
40651 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
40652 transport is a remote one. They contain the name and IP address of the host to
40653 which the message is being sent. For example:
40654 </para>
40655 <literallayout class="monospaced">
40656 transport_filter = /some/directory/transport-filter.pl \
40657   $host $host_address $sender_address $pipe_addresses
40658 </literallayout>
40659 <para>
40660 Two problems arise if you want to use more complicated expansion items to
40661 generate transport filter commands, both of which due to the fact that the
40662 command is split up <emphasis>before</emphasis> expansion.
40663 </para>
40664 <itemizedlist>
40665 <listitem>
40666 <para>
40667 If an expansion item contains white space, you must quote it, so that it is all
40668 part of the same command item. If the entire option setting is one such
40669 expansion item, you have to take care what kind of quoting you use. For
40670 example:
40671 </para>
40672 <literallayout class="monospaced">
40673 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
40674 </literallayout>
40675 <para>
40676 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
40677 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
40678 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
40679 the single quotes were missing, the line would be split into two items,
40680 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
40681 Exim tried to expand the first one.
40682 </para>
40683 </listitem>
40684 <listitem>
40685 <para>
40686 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
40687 expansion cannot generate multiple arguments, or a command name followed by
40688 arguments. Consider this example:
40689 </para>
40690 <literallayout class="monospaced">
40691 transport_filter = ${lookup{$host}lsearch{/a/file}\
40692                     {$value}{/bin/cat}}
40693 </literallayout>
40694 <para>
40695 The result of the lookup is interpreted as the name of the command, even
40696 if it contains white space. The simplest way round this is to use a shell:
40697 </para>
40698 <literallayout class="monospaced">
40699 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
40700                                {$value}{/bin/cat}}
40701 </literallayout>
40702 </listitem>
40703 </itemizedlist>
40704 <para>
40705 The filter process is run under the same uid and gid as the normal delivery.
40706 For remote deliveries this is the Exim uid/gid by default. The command should
40707 normally yield a zero return code. Transport filters are not supposed to fail.
40708 A non-zero code is taken to mean that the transport filter encountered some
40709 serious problem. Delivery of the message is deferred; the message remains on
40710 the queue and is tried again later. It is not possible to cause a message to be
40711 bounced from a transport filter.
40712 </para>
40713 <para>
40714 If a transport filter is set on an autoreply transport, the original message is
40715 passed through the filter as it is being copied into the newly generated
40716 message, which happens if the <option>return_message</option> option is set.
40717 </para>
40718 <para>
40719 <indexterm role="option">
40720 <primary><option>transport_filter_timeout</option></primary>
40721 </indexterm>
40722 </para>
40723 <informaltable frame="all">
40724 <tgroup cols="4" colsep="0" rowsep="0">
40725 <colspec colwidth="8*" align="left"/>
40726 <colspec colwidth="6*" align="center"/>
40727 <colspec colwidth="6*" align="center"/>
40728 <colspec colwidth="6*" align="right"/>
40729 <tbody>
40730 <row>
40731 <entry><option>transport_filter_timeout</option></entry>
40732 <entry>Use: <emphasis>transports</emphasis></entry>
40733 <entry>Type: <emphasis>time</emphasis></entry>
40734 <entry>Default: <emphasis>5m</emphasis></entry>
40735 </row>
40736 </tbody>
40737 </tgroup>
40738 </informaltable>
40739 <para>
40740 <indexterm role="concept">
40741 <primary>transport</primary>
40742 <secondary>filter, timeout</secondary>
40743 </indexterm>
40744 When Exim is reading the output of a transport filter, it applies a timeout
40745 that can be set by this option. Exceeding the timeout is normally treated as a
40746 temporary delivery failure. However, if a transport filter is used with a
40747 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
40748 way as a timeout in the pipe command itself. By default, a timeout is a hard
40749 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
40750 becomes a temporary error.
40751 </para>
40752 <para>
40753 <indexterm role="option">
40754 <primary><option>user</option></primary>
40755 </indexterm>
40756 </para>
40757 <informaltable frame="all">
40758 <tgroup cols="4" colsep="0" rowsep="0">
40759 <colspec colwidth="8*" align="left"/>
40760 <colspec colwidth="6*" align="center"/>
40761 <colspec colwidth="6*" align="center"/>
40762 <colspec colwidth="6*" align="right"/>
40763 <tbody>
40764 <row>
40765 <entry><option>user</option></entry>
40766 <entry>Use: <emphasis>transports</emphasis></entry>
40767 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40768 <entry>Default: <emphasis>Exim user</emphasis></entry>
40769 </row>
40770 </tbody>
40771 </tgroup>
40772 </informaltable>
40773 <para>
40774 <indexterm role="concept">
40775 <primary>uid (user id)</primary>
40776 <secondary>local delivery</secondary>
40777 </indexterm>
40778 <indexterm role="concept">
40779 <primary>transport</primary>
40780 <secondary>user, specifying</secondary>
40781 </indexterm>
40782 This option specifies the user under whose uid the delivery process is to be
40783 run, overriding any uid that may have been set by the router. If the user is
40784 given as a name, the uid is looked up from the password data, and the
40785 associated group is taken as the value of the gid to be used if the <option>group</option>
40786 option is not set.
40787 </para>
40788 <para>
40789 For deliveries that use local transports, a user and group are normally
40790 specified explicitly or implicitly (for example, as a result of
40791 <option>check_local_user</option>) by the router or transport.
40792 </para>
40793 <para>
40794 <indexterm role="concept">
40795 <primary>hints database</primary>
40796 <secondary>access by remote transport</secondary>
40797 </indexterm>
40798 For remote transports, you should leave this option unset unless you really are
40799 sure you know what you are doing. When a remote transport is running, it needs
40800 to be able to access Exim&#x2019;s hints databases, because each host may have its own
40801 retry data.
40802 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
40803 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
40804 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
40805 </para>
40806 </chapter>
40807
40808 <chapter id="CHAPbatching">
40809 <title>Address batching in local transports</title>
40810 <titleabbrev>Address batching</titleabbrev>
40811 <para>
40812 <indexterm role="concept">
40813 <primary>transport</primary>
40814 <secondary>local; address batching in</secondary>
40815 </indexterm>
40816 The only remote transport (<command>smtp</command>) is normally configured to handle more than
40817 one address at a time, so that when several addresses are routed to the same
40818 remote host, just one copy of the message is sent. Local transports, however,
40819 normally handle one address at a time. That is, a separate instance of the
40820 transport is run for each address that is routed to the transport. A separate
40821 copy of the message is delivered each time.
40822 </para>
40823 <para>
40824 <indexterm role="concept">
40825 <primary>batched local delivery</primary>
40826 </indexterm>
40827 <indexterm role="option">
40828 <primary><option>batch_max</option></primary>
40829 </indexterm>
40830 <indexterm role="option">
40831 <primary><option>batch_id</option></primary>
40832 </indexterm>
40833 In special cases, it may be desirable to handle several addresses at once in a
40834 local transport, for example:
40835 </para>
40836 <itemizedlist>
40837 <listitem>
40838 <para>
40839 In an <command>appendfile</command> transport, when storing messages in files for later
40840 delivery by some other means, a single copy of the message with multiple
40841 recipients saves space.
40842 </para>
40843 </listitem>
40844 <listitem>
40845 <para>
40846 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
40847 a single copy saves time, and is the normal way LMTP is expected to work.
40848 </para>
40849 </listitem>
40850 <listitem>
40851 <para>
40852 In a <command>pipe</command> transport, when passing the message
40853 to a scanner program or
40854 to some other delivery mechanism such as UUCP, multiple recipients may be
40855 acceptable.
40856 </para>
40857 </listitem>
40858 </itemizedlist>
40859 <para>
40860 These three local transports all have the same options for controlling multiple
40861 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
40862 repeating the information for each transport, these options are described here.
40863 </para>
40864 <para>
40865 The <option>batch_max</option> option specifies the maximum number of addresses that can be
40866 delivered together in a single run of the transport. Its default value is one
40867 (no batching). When more than one address is routed to a transport that has a
40868 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
40869 (that is, in a single run of the transport with multiple recipients), subject
40870 to certain conditions:
40871 </para>
40872 <itemizedlist>
40873 <listitem>
40874 <para>
40875 <indexterm role="variable">
40876 <primary><varname>$local_part</varname></primary>
40877 </indexterm>
40878 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
40879 batching is possible.
40880 </para>
40881 </listitem>
40882 <listitem>
40883 <para>
40884 <indexterm role="variable">
40885 <primary><varname>$domain</varname></primary>
40886 </indexterm>
40887 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
40888 addresses with the same domain are batched.
40889 </para>
40890 </listitem>
40891 <listitem>
40892 <para>
40893 <indexterm role="concept">
40894 <primary>customizing</primary>
40895 <secondary>batching condition</secondary>
40896 </indexterm>
40897 If <option>batch_id</option> is set, it is expanded for each address, and only those
40898 addresses with the same expanded value are batched. This allows you to specify
40899 customized batching conditions. Failure of the expansion for any reason,
40900 including forced failure, disables batching, but it does not stop the delivery
40901 from taking place.
40902 </para>
40903 </listitem>
40904 <listitem>
40905 <para>
40906 Batched addresses must also have the same errors address (where to send
40907 delivery errors), the same header additions and removals, the same user and
40908 group for the transport, and if a host list is present, the first host must
40909 be the same.
40910 </para>
40911 </listitem>
40912 </itemizedlist>
40913 <para>
40914 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
40915 both when the file or pipe command is specified in the transport, and when it
40916 is specified by a <command>redirect</command> router, but all the batched addresses must of
40917 course be routed to the same file or pipe command. These two transports have an
40918 option called <option>use_bsmtp</option>, which causes them to deliver the message in
40919 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
40920 <option>check_string</option> and <option>escape_string</option> options are forced to the values
40921 </para>
40922 <literallayout class="monospaced">
40923 check_string = "."
40924 escape_string = ".."
40925 </literallayout>
40926 <para>
40927 when batched SMTP is in use. A full description of the batch SMTP mechanism is
40928 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
40929 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
40930 </para>
40931 <para>
40932 <indexterm role="concept">
40933 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40934 </indexterm>
40935 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
40936 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
40937 that are being processed together. If you are using a batching <command>appendfile</command>
40938 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
40939 addresses is to set the <option>envelope_to_add</option> option.
40940 </para>
40941 <para>
40942 <indexterm role="concept">
40943 <primary><command>pipe</command> transport</primary>
40944 <secondary>with multiple addresses</secondary>
40945 </indexterm>
40946 <indexterm role="variable">
40947 <primary><varname>$pipe_addresses</varname></primary>
40948 </indexterm>
40949 If you are using a <command>pipe</command> transport without BSMTP, and setting the
40950 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
40951 the command. This is not a true variable; it is a bit of magic that causes each
40952 of the recipient addresses to be inserted into the command as a separate
40953 argument. This provides a way of accessing all the addresses that are being
40954 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
40955 are specified by a <command>redirect</command> router.
40956 </para>
40957 </chapter>
40958
40959 <chapter id="CHAPappendfile">
40960 <title>The appendfile transport</title>
40961 <para>
40962 <indexterm role="concept" id="IIDapptra1" class="startofrange">
40963 <primary><command>appendfile</command> transport</primary>
40964 </indexterm>
40965 <indexterm role="concept" id="IIDapptra2" class="startofrange">
40966 <primary>transports</primary>
40967 <secondary><command>appendfile</command></secondary>
40968 </indexterm>
40969 <indexterm role="concept">
40970 <primary>directory creation</primary>
40971 </indexterm>
40972 <indexterm role="concept">
40973 <primary>creating directories</primary>
40974 </indexterm>
40975 The <command>appendfile</command> transport delivers a message by appending it to an existing
40976 file, or by creating an entirely new file in a specified directory. Single
40977 files to which messages are appended can be in the traditional Unix mailbox
40978 format, or optionally in the MBX format supported by the Pine MUA and
40979 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
40980 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
40981 to give added protection against failures that happen part-way through the
40982 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
40983 supported. For all file formats, Exim attempts to create as many levels of
40984 directory as necessary, provided that <option>create_directory</option> is set.
40985 </para>
40986 <para>
40987 The code for the optional formats is not included in the Exim binary by
40988 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
40989 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
40990 included.
40991 </para>
40992 <para>
40993 <indexterm role="concept">
40994 <primary>quota</primary>
40995 <secondary>system</secondary>
40996 </indexterm>
40997 Exim recognizes system quota errors, and generates an appropriate message. Exim
40998 also supports its own quota control within the transport, for use when the
40999 system facility is unavailable or cannot be used for some reason.
41000 </para>
41001 <para>
41002 If there is an error while appending to a file (for example, quota exceeded or
41003 partition filled), Exim attempts to reset the file&#x2019;s length and last
41004 modification time back to what they were before. If there is an error while
41005 creating an entirely new file, the new file is removed.
41006 </para>
41007 <para>
41008 Before appending to a file, a number of security checks are made, and the
41009 file is locked. A detailed description is given below, after the list of
41010 private options.
41011 </para>
41012 <para>
41013 The <command>appendfile</command> transport is most commonly used for local deliveries to
41014 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
41015 putting messages into files for remote delivery by some means other than Exim.
41016 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
41017 option).
41018 </para>
41019 <section id="SECTfildiropt">
41020 <title>The file and directory options</title>
41021 <para>
41022 The <option>file</option> option specifies a single file, to which the message is appended;
41023 the <option>directory</option> option specifies a directory, in which a new file containing
41024 the message is created. Only one of these two options can be set, and for
41025 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
41026 </para>
41027 <para>
41028 <indexterm role="variable">
41029 <primary><varname>$address_file</varname></primary>
41030 </indexterm>
41031 <indexterm role="variable">
41032 <primary><varname>$local_part</varname></primary>
41033 </indexterm>
41034 However, <command>appendfile</command> is also used for delivering messages to files or
41035 directories whose names (or parts of names) are obtained from alias,
41036 forwarding, or filtering operations (for example, a <option>save</option> command in a
41037 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
41038 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
41039 name (or partial name) of the file or directory generated by the redirection
41040 operation. There are two cases:
41041 </para>
41042 <itemizedlist>
41043 <listitem>
41044 <para>
41045 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
41046 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
41047 common case when users with local accounts use filtering to sort mail into
41048 different folders. See for example, the <command>address_file</command> transport in the
41049 default configuration. If the path ends with a slash, it is assumed to be the
41050 name of a directory. A delivery to a directory can also be forced by setting
41051 <option>maildir_format</option> or <option>mailstore_format</option>.
41052 </para>
41053 </listitem>
41054 <listitem>
41055 <para>
41056 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
41057 used to determine the file or directory name for the delivery. Normally, the
41058 contents of <varname>$address_file</varname> are used in some way in the string expansion.
41059 </para>
41060 </listitem>
41061 </itemizedlist>
41062 <para>
41063 <indexterm role="concept">
41064 <primary>Sieve filter</primary>
41065 <secondary>configuring <command>appendfile</command></secondary>
41066 </indexterm>
41067 <indexterm role="concept">
41068 <primary>Sieve filter</primary>
41069 <secondary>relative mailbox path handling</secondary>
41070 </indexterm>
41071 As an example of the second case, consider an environment where users do not
41072 have home directories. They may be permitted to use Exim filter commands of the
41073 form:
41074 </para>
41075 <literallayout class="monospaced">
41076 save folder23
41077 </literallayout>
41078 <para>
41079 or Sieve filter commands of the form:
41080 </para>
41081 <literallayout class="monospaced">
41082 require "fileinto";
41083 fileinto "folder23";
41084 </literallayout>
41085 <para>
41086 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
41087 must transform the relative path into an appropriate absolute file name. In the
41088 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
41089 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
41090 way of handling this requirement:
41091 </para>
41092 <literallayout class="monospaced">
41093 file = ${if eq{$address_file}{inbox} \
41094             {/var/mail/$local_part} \
41095             {${if eq{${substr_0_1:$address_file}}{/} \
41096                   {$address_file} \
41097                   {$home/mail/$address_file} \
41098             }} \
41099        }
41100 </literallayout>
41101 <para>
41102 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
41103 location, absolute paths are used without change, and other folders are in the
41104 <filename>mail</filename> directory within the home directory.
41105 </para>
41106 <para>
41107 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
41108 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
41109 the router. In particular, this is the case if <option>check_local_user</option> is set. If
41110 you want to prevent this happening at routing time, you can set
41111 <option>router_home_directory</option> empty. This forces the router to pass the relative
41112 path to the transport.
41113 </para>
41114 <para>
41115 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
41116 the <option>file</option> or <option>directory</option> option is still used if it is set.
41117 </para>
41118 </section>
41119 <section id="SECID134">
41120 <title>Private options for appendfile</title>
41121 <para>
41122 <indexterm role="concept">
41123 <primary>options</primary>
41124 <secondary><command>appendfile</command> transport</secondary>
41125 </indexterm>
41126 </para>
41127 <para>
41128 <indexterm role="option">
41129 <primary><option>allow_fifo</option></primary>
41130 </indexterm>
41131 </para>
41132 <informaltable frame="all">
41133 <tgroup cols="4" colsep="0" rowsep="0">
41134 <colspec colwidth="8*" align="left"/>
41135 <colspec colwidth="6*" align="center"/>
41136 <colspec colwidth="6*" align="center"/>
41137 <colspec colwidth="6*" align="right"/>
41138 <tbody>
41139 <row>
41140 <entry><option>allow_fifo</option></entry>
41141 <entry>Use: <emphasis>appendfile</emphasis></entry>
41142 <entry>Type: <emphasis>boolean</emphasis></entry>
41143 <entry>Default: <emphasis>false</emphasis></entry>
41144 </row>
41145 </tbody>
41146 </tgroup>
41147 </informaltable>
41148 <para>
41149 <indexterm role="concept">
41150 <primary>fifo (named pipe)</primary>
41151 </indexterm>
41152 <indexterm role="concept">
41153 <primary>named pipe (fifo)</primary>
41154 </indexterm>
41155 <indexterm role="concept">
41156 <primary>pipe</primary>
41157 <secondary>named (fifo)</secondary>
41158 </indexterm>
41159 Setting this option permits delivery to named pipes (FIFOs) as well as to
41160 regular files. If no process is reading the named pipe at delivery time, the
41161 delivery is deferred.
41162 </para>
41163 <para>
41164 <indexterm role="option">
41165 <primary><option>allow_symlink</option></primary>
41166 </indexterm>
41167 </para>
41168 <informaltable frame="all">
41169 <tgroup cols="4" colsep="0" rowsep="0">
41170 <colspec colwidth="8*" align="left"/>
41171 <colspec colwidth="6*" align="center"/>
41172 <colspec colwidth="6*" align="center"/>
41173 <colspec colwidth="6*" align="right"/>
41174 <tbody>
41175 <row>
41176 <entry><option>allow_symlink</option></entry>
41177 <entry>Use: <emphasis>appendfile</emphasis></entry>
41178 <entry>Type: <emphasis>boolean</emphasis></entry>
41179 <entry>Default: <emphasis>false</emphasis></entry>
41180 </row>
41181 </tbody>
41182 </tgroup>
41183 </informaltable>
41184 <para>
41185 <indexterm role="concept">
41186 <primary>symbolic link</primary>
41187 <secondary>to mailbox</secondary>
41188 </indexterm>
41189 <indexterm role="concept">
41190 <primary>mailbox</primary>
41191 <secondary>symbolic link</secondary>
41192 </indexterm>
41193 By default, <command>appendfile</command> will not deliver if the path name for the file is
41194 that of a symbolic link. Setting this option relaxes that constraint, but there
41195 are security issues involved in the use of symbolic links. Be sure you know
41196 what you are doing if you set this. Details of exactly what this option affects
41197 are included in the discussion which follows this list of options.
41198 </para>
41199 <para>
41200 <indexterm role="option">
41201 <primary><option>batch_id</option></primary>
41202 </indexterm>
41203 </para>
41204 <informaltable frame="all">
41205 <tgroup cols="4" colsep="0" rowsep="0">
41206 <colspec colwidth="8*" align="left"/>
41207 <colspec colwidth="6*" align="center"/>
41208 <colspec colwidth="6*" align="center"/>
41209 <colspec colwidth="6*" align="right"/>
41210 <tbody>
41211 <row>
41212 <entry><option>batch_id</option></entry>
41213 <entry>Use: <emphasis>appendfile</emphasis></entry>
41214 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41215 <entry>Default: <emphasis>unset</emphasis></entry>
41216 </row>
41217 </tbody>
41218 </tgroup>
41219 </informaltable>
41220 <para>
41221 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41222 However, batching is automatically disabled for <command>appendfile</command> deliveries that
41223 happen as a result of forwarding or aliasing or other redirection directly to a
41224 file.
41225 </para>
41226 <para>
41227 <indexterm role="option">
41228 <primary><option>batch_max</option></primary>
41229 </indexterm>
41230 </para>
41231 <informaltable frame="all">
41232 <tgroup cols="4" colsep="0" rowsep="0">
41233 <colspec colwidth="8*" align="left"/>
41234 <colspec colwidth="6*" align="center"/>
41235 <colspec colwidth="6*" align="center"/>
41236 <colspec colwidth="6*" align="right"/>
41237 <tbody>
41238 <row>
41239 <entry><option>batch_max</option></entry>
41240 <entry>Use: <emphasis>appendfile</emphasis></entry>
41241 <entry>Type: <emphasis>integer</emphasis></entry>
41242 <entry>Default: <emphasis>1</emphasis></entry>
41243 </row>
41244 </tbody>
41245 </tgroup>
41246 </informaltable>
41247 <para>
41248 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41249 </para>
41250 <para>
41251 <indexterm role="option">
41252 <primary><option>check_group</option></primary>
41253 </indexterm>
41254 </para>
41255 <informaltable frame="all">
41256 <tgroup cols="4" colsep="0" rowsep="0">
41257 <colspec colwidth="8*" align="left"/>
41258 <colspec colwidth="6*" align="center"/>
41259 <colspec colwidth="6*" align="center"/>
41260 <colspec colwidth="6*" align="right"/>
41261 <tbody>
41262 <row>
41263 <entry><option>check_group</option></entry>
41264 <entry>Use: <emphasis>appendfile</emphasis></entry>
41265 <entry>Type: <emphasis>boolean</emphasis></entry>
41266 <entry>Default: <emphasis>false</emphasis></entry>
41267 </row>
41268 </tbody>
41269 </tgroup>
41270 </informaltable>
41271 <para>
41272 When this option is set, the group owner of the file defined by the <option>file</option>
41273 option is checked to see that it is the same as the group under which the
41274 delivery process is running. The default setting is false because the default
41275 file mode is 0600, which means that the group is irrelevant.
41276 </para>
41277 <para>
41278 <indexterm role="option">
41279 <primary><option>check_owner</option></primary>
41280 </indexterm>
41281 </para>
41282 <informaltable frame="all">
41283 <tgroup cols="4" colsep="0" rowsep="0">
41284 <colspec colwidth="8*" align="left"/>
41285 <colspec colwidth="6*" align="center"/>
41286 <colspec colwidth="6*" align="center"/>
41287 <colspec colwidth="6*" align="right"/>
41288 <tbody>
41289 <row>
41290 <entry><option>check_owner</option></entry>
41291 <entry>Use: <emphasis>appendfile</emphasis></entry>
41292 <entry>Type: <emphasis>boolean</emphasis></entry>
41293 <entry>Default: <emphasis>true</emphasis></entry>
41294 </row>
41295 </tbody>
41296 </tgroup>
41297 </informaltable>
41298 <para>
41299 When this option is set, the owner of the file defined by the <option>file</option> option
41300 is checked to ensure that it is the same as the user under which the delivery
41301 process is running.
41302 </para>
41303 <para>
41304 <indexterm role="option">
41305 <primary><option>check_string</option></primary>
41306 </indexterm>
41307 </para>
41308 <informaltable frame="all">
41309 <tgroup cols="4" colsep="0" rowsep="0">
41310 <colspec colwidth="8*" align="left"/>
41311 <colspec colwidth="6*" align="center"/>
41312 <colspec colwidth="6*" align="center"/>
41313 <colspec colwidth="6*" align="right"/>
41314 <tbody>
41315 <row>
41316 <entry><option>check_string</option></entry>
41317 <entry>Use: <emphasis>appendfile</emphasis></entry>
41318 <entry>Type: <emphasis>string</emphasis></entry>
41319 <entry>Default: <emphasis>see below</emphasis></entry>
41320 </row>
41321 </tbody>
41322 </tgroup>
41323 </informaltable>
41324 <para>
41325 <indexterm role="concept">
41326 <primary><quote>From</quote> line</primary>
41327 </indexterm>
41328 As <command>appendfile</command> writes the message, the start of each line is tested for
41329 matching <option>check_string</option>, and if it does, the initial matching characters are
41330 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
41331 a literal string, not a regular expression, and the case of any letters it
41332 contains is significant.
41333 </para>
41334 <para>
41335 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
41336 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
41337 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
41338 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
41339 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
41340 </para>
41341 <para>
41342 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
41343 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
41344 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
41345 if another format is used. For example, to deliver to mailboxes in MMDF format:
41346 <indexterm role="concept">
41347 <primary>MMDF format mailbox</primary>
41348 </indexterm>
41349 <indexterm role="concept">
41350 <primary>mailbox</primary>
41351 <secondary>MMDF format</secondary>
41352 </indexterm>
41353 </para>
41354 <literallayout class="monospaced">
41355 check_string = "\1\1\1\1\n"
41356 escape_string = "\1\1\1\1 \n"
41357 message_prefix = "\1\1\1\1\n"
41358 message_suffix = "\1\1\1\1\n"
41359 </literallayout>
41360 <para>
41361 <indexterm role="option">
41362 <primary><option>create_directory</option></primary>
41363 </indexterm>
41364 </para>
41365 <informaltable frame="all">
41366 <tgroup cols="4" colsep="0" rowsep="0">
41367 <colspec colwidth="8*" align="left"/>
41368 <colspec colwidth="6*" align="center"/>
41369 <colspec colwidth="6*" align="center"/>
41370 <colspec colwidth="6*" align="right"/>
41371 <tbody>
41372 <row>
41373 <entry><option>create_directory</option></entry>
41374 <entry>Use: <emphasis>appendfile</emphasis></entry>
41375 <entry>Type: <emphasis>boolean</emphasis></entry>
41376 <entry>Default: <emphasis>true</emphasis></entry>
41377 </row>
41378 </tbody>
41379 </tgroup>
41380 </informaltable>
41381 <para>
41382 <indexterm role="concept">
41383 <primary>directory creation</primary>
41384 </indexterm>
41385 When this option is true, Exim attempts to create any missing superior
41386 directories for the file that it is about to write. A created directory&#x2019;s mode
41387 is given by the <option>directory_mode</option> option.
41388 </para>
41389 <para>
41390 The group ownership of a newly created directory is highly dependent on the
41391 operating system (and possibly the file system) that is being used. For
41392 example, in Solaris, if the parent directory has the setgid bit set, its group
41393 is propagated to the child; if not, the currently set group is used. However,
41394 in FreeBSD, the parent&#x2019;s group is always used.
41395 </para>
41396 <para>
41397 <indexterm role="option">
41398 <primary><option>create_file</option></primary>
41399 </indexterm>
41400 </para>
41401 <informaltable frame="all">
41402 <tgroup cols="4" colsep="0" rowsep="0">
41403 <colspec colwidth="8*" align="left"/>
41404 <colspec colwidth="6*" align="center"/>
41405 <colspec colwidth="6*" align="center"/>
41406 <colspec colwidth="6*" align="right"/>
41407 <tbody>
41408 <row>
41409 <entry><option>create_file</option></entry>
41410 <entry>Use: <emphasis>appendfile</emphasis></entry>
41411 <entry>Type: <emphasis>string</emphasis></entry>
41412 <entry>Default: <emphasis>anywhere</emphasis></entry>
41413 </row>
41414 </tbody>
41415 </tgroup>
41416 </informaltable>
41417 <para>
41418 This option constrains the location of files and directories that are created
41419 by this transport. It applies to files defined by the <option>file</option> option and
41420 directories defined by the <option>directory</option> option. In the case of maildir
41421 delivery, it applies to the top level directory, not the maildir directories
41422 beneath.
41423 </para>
41424 <para>
41425 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
41426 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
41427 set for the transport. This option is not useful when an explicit file name is
41428 given for normal mailbox deliveries. It is intended for the case when file
41429 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
41430 by an <command>appendfile</command> transport called <option>address_file</option>. See also
41431 <option>file_must_exist</option>.
41432 </para>
41433 <para>
41434 <indexterm role="option">
41435 <primary><option>directory</option></primary>
41436 </indexterm>
41437 </para>
41438 <informaltable frame="all">
41439 <tgroup cols="4" colsep="0" rowsep="0">
41440 <colspec colwidth="8*" align="left"/>
41441 <colspec colwidth="6*" align="center"/>
41442 <colspec colwidth="6*" align="center"/>
41443 <colspec colwidth="6*" align="right"/>
41444 <tbody>
41445 <row>
41446 <entry><option>directory</option></entry>
41447 <entry>Use: <emphasis>appendfile</emphasis></entry>
41448 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41449 <entry>Default: <emphasis>unset</emphasis></entry>
41450 </row>
41451 </tbody>
41452 </tgroup>
41453 </informaltable>
41454 <para>
41455 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
41456 or <option>directory</option> must be set, unless the delivery is the direct result of a
41457 redirection (see section <xref linkend="SECTfildiropt"/>).
41458 </para>
41459 <para>
41460 When <option>directory</option> is set, the string is expanded, and the message is delivered
41461 into a new file or files in or below the given directory, instead of being
41462 appended to a single mailbox file. A number of different formats are provided
41463 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
41464 <xref linkend="SECTopdir"/> for further details of this form of delivery.
41465 </para>
41466 <para>
41467 <indexterm role="option">
41468 <primary><option>directory_file</option></primary>
41469 </indexterm>
41470 </para>
41471 <informaltable frame="all">
41472 <tgroup cols="4" colsep="0" rowsep="0">
41473 <colspec colwidth="8*" align="left"/>
41474 <colspec colwidth="6*" align="center"/>
41475 <colspec colwidth="6*" align="center"/>
41476 <colspec colwidth="6*" align="right"/>
41477 <tbody>
41478 <row>
41479 <entry><option>directory_file</option></entry>
41480 <entry>Use: <emphasis>appendfile</emphasis></entry>
41481 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41482 <entry>Default: <emphasis>see below</emphasis></entry>
41483 </row>
41484 </tbody>
41485 </tgroup>
41486 </informaltable>
41487 <para>
41488 <indexterm role="concept">
41489 <primary>base62</primary>
41490 </indexterm>
41491 <indexterm role="variable">
41492 <primary><varname>$inode</varname></primary>
41493 </indexterm>
41494 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
41495 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
41496 whose name is obtained by expanding this string. The default value is:
41497 </para>
41498 <literallayout class="monospaced">
41499 q${base62:$tod_epoch}-$inode
41500 </literallayout>
41501 <para>
41502 This generates a unique name from the current time, in base 62 form, and the
41503 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
41504 option.
41505 </para>
41506 <para>
41507 <indexterm role="option">
41508 <primary><option>directory_mode</option></primary>
41509 </indexterm>
41510 </para>
41511 <informaltable frame="all">
41512 <tgroup cols="4" colsep="0" rowsep="0">
41513 <colspec colwidth="8*" align="left"/>
41514 <colspec colwidth="6*" align="center"/>
41515 <colspec colwidth="6*" align="center"/>
41516 <colspec colwidth="6*" align="right"/>
41517 <tbody>
41518 <row>
41519 <entry><option>directory_mode</option></entry>
41520 <entry>Use: <emphasis>appendfile</emphasis></entry>
41521 <entry>Type: <emphasis>octal integer</emphasis></entry>
41522 <entry>Default: <emphasis>0700</emphasis></entry>
41523 </row>
41524 </tbody>
41525 </tgroup>
41526 </informaltable>
41527 <para>
41528 If <command>appendfile</command> creates any directories as a result of the
41529 <option>create_directory</option> option, their mode is specified by this option.
41530 </para>
41531 <para>
41532 <indexterm role="option">
41533 <primary><option>escape_string</option></primary>
41534 </indexterm>
41535 </para>
41536 <informaltable frame="all">
41537 <tgroup cols="4" colsep="0" rowsep="0">
41538 <colspec colwidth="8*" align="left"/>
41539 <colspec colwidth="6*" align="center"/>
41540 <colspec colwidth="6*" align="center"/>
41541 <colspec colwidth="6*" align="right"/>
41542 <tbody>
41543 <row>
41544 <entry><option>escape_string</option></entry>
41545 <entry>Use: <emphasis>appendfile</emphasis></entry>
41546 <entry>Type: <emphasis>string</emphasis></entry>
41547 <entry>Default: <emphasis>see description</emphasis></entry>
41548 </row>
41549 </tbody>
41550 </tgroup>
41551 </informaltable>
41552 <para>
41553 See <option>check_string</option> above.
41554 </para>
41555 <para>
41556 <indexterm role="option">
41557 <primary><option>file</option></primary>
41558 </indexterm>
41559 </para>
41560 <informaltable frame="all">
41561 <tgroup cols="4" colsep="0" rowsep="0">
41562 <colspec colwidth="8*" align="left"/>
41563 <colspec colwidth="6*" align="center"/>
41564 <colspec colwidth="6*" align="center"/>
41565 <colspec colwidth="6*" align="right"/>
41566 <tbody>
41567 <row>
41568 <entry><option>file</option></entry>
41569 <entry>Use: <emphasis>appendfile</emphasis></entry>
41570 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41571 <entry>Default: <emphasis>unset</emphasis></entry>
41572 </row>
41573 </tbody>
41574 </tgroup>
41575 </informaltable>
41576 <para>
41577 This option is mutually exclusive with the <option>directory</option> option, but one of
41578 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
41579 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
41580 specifies a single file, to which the message is appended. One or more of
41581 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
41582 <option>file</option>.
41583 </para>
41584 <para>
41585 <indexterm role="concept">
41586 <primary>NFS</primary>
41587 <secondary>lock file</secondary>
41588 </indexterm>
41589 <indexterm role="concept">
41590 <primary>locking files</primary>
41591 </indexterm>
41592 <indexterm role="concept">
41593 <primary>lock files</primary>
41594 </indexterm>
41595 If you are using more than one host to deliver over NFS into the same
41596 mailboxes, you should always use lock files.
41597 </para>
41598 <para>
41599 The string value is expanded for each delivery, and must yield an absolute
41600 path. The most common settings of this option are variations on one of these
41601 examples:
41602 </para>
41603 <literallayout class="monospaced">
41604 file = /var/spool/mail/$local_part
41605 file = /home/$local_part/inbox
41606 file = $home/inbox
41607 </literallayout>
41608 <para>
41609 <indexterm role="concept">
41610 <primary><quote>sticky</quote> bit</primary>
41611 </indexterm>
41612 In the first example, all deliveries are done into the same directory. If Exim
41613 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
41614 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
41615 deliveries to be possible, or alternatively the <option>group</option> option can be used to
41616 run the delivery under a group id which has write access to the directory.
41617 </para>
41618 <para>
41619 <indexterm role="option">
41620 <primary><option>file_format</option></primary>
41621 </indexterm>
41622 </para>
41623 <informaltable frame="all">
41624 <tgroup cols="4" colsep="0" rowsep="0">
41625 <colspec colwidth="8*" align="left"/>
41626 <colspec colwidth="6*" align="center"/>
41627 <colspec colwidth="6*" align="center"/>
41628 <colspec colwidth="6*" align="right"/>
41629 <tbody>
41630 <row>
41631 <entry><option>file_format</option></entry>
41632 <entry>Use: <emphasis>appendfile</emphasis></entry>
41633 <entry>Type: <emphasis>string</emphasis></entry>
41634 <entry>Default: <emphasis>unset</emphasis></entry>
41635 </row>
41636 </tbody>
41637 </tgroup>
41638 </informaltable>
41639 <para>
41640 <indexterm role="concept">
41641 <primary>file</primary>
41642 <secondary>mailbox; checking existing format</secondary>
41643 </indexterm>
41644 This option requests the transport to check the format of an existing file
41645 before adding to it. The check consists of matching a specific string at the
41646 start of the file. The value of the option consists of an even number of
41647 colon-separated strings. The first of each pair is the test string, and the
41648 second is the name of a transport. If the transport associated with a matched
41649 string is not the current transport, control is passed over to the other
41650 transport. For example, suppose the standard <command>local_delivery</command> transport has
41651 this added to it:
41652 </para>
41653 <literallayout class="monospaced">
41654 file_format = "From       : local_delivery :\
41655                \1\1\1\1\n : local_mmdf_delivery"
41656 </literallayout>
41657 <para>
41658 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
41659 a mailbox begins with four binary ones followed by a newline, control is passed
41660 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
41661 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
41662 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
41663 match any string, or if the transport named for a given string is not defined,
41664 delivery is deferred.
41665 </para>
41666 <para>
41667 <indexterm role="option">
41668 <primary><option>file_must_exist</option></primary>
41669 </indexterm>
41670 </para>
41671 <informaltable frame="all">
41672 <tgroup cols="4" colsep="0" rowsep="0">
41673 <colspec colwidth="8*" align="left"/>
41674 <colspec colwidth="6*" align="center"/>
41675 <colspec colwidth="6*" align="center"/>
41676 <colspec colwidth="6*" align="right"/>
41677 <tbody>
41678 <row>
41679 <entry><option>file_must_exist</option></entry>
41680 <entry>Use: <emphasis>appendfile</emphasis></entry>
41681 <entry>Type: <emphasis>boolean</emphasis></entry>
41682 <entry>Default: <emphasis>false</emphasis></entry>
41683 </row>
41684 </tbody>
41685 </tgroup>
41686 </informaltable>
41687 <para>
41688 If this option is true, the file specified by the <option>file</option> option must exist.
41689 A temporary error occurs if it does not, causing delivery to be deferred.
41690 If this option is false, the file is created if it does not exist.
41691 </para>
41692 <para>
41693 <indexterm role="option">
41694 <primary><option>lock_fcntl_timeout</option></primary>
41695 </indexterm>
41696 </para>
41697 <informaltable frame="all">
41698 <tgroup cols="4" colsep="0" rowsep="0">
41699 <colspec colwidth="8*" align="left"/>
41700 <colspec colwidth="6*" align="center"/>
41701 <colspec colwidth="6*" align="center"/>
41702 <colspec colwidth="6*" align="right"/>
41703 <tbody>
41704 <row>
41705 <entry><option>lock_fcntl_timeout</option></entry>
41706 <entry>Use: <emphasis>appendfile</emphasis></entry>
41707 <entry>Type: <emphasis>time</emphasis></entry>
41708 <entry>Default: <emphasis>0s</emphasis></entry>
41709 </row>
41710 </tbody>
41711 </tgroup>
41712 </informaltable>
41713 <para>
41714 <indexterm role="concept">
41715 <primary>timeout</primary>
41716 <secondary>mailbox locking</secondary>
41717 </indexterm>
41718 <indexterm role="concept">
41719 <primary>mailbox</primary>
41720 <secondary>locking, blocking and non-blocking</secondary>
41721 </indexterm>
41722 <indexterm role="concept">
41723 <primary>locking files</primary>
41724 </indexterm>
41725 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
41726 when locking an open mailbox file. If the call fails, the delivery process
41727 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
41728 Non-blocking calls are used so that the file is not kept open during the wait
41729 for the lock; the reason for this is to make it as safe as possible for
41730 deliveries over NFS in the case when processes might be accessing an NFS
41731 mailbox without using a lock file. This should not be done, but
41732 misunderstandings and hence misconfigurations are not unknown.
41733 </para>
41734 <para>
41735 On a busy system, however, the performance of a non-blocking lock approach is
41736 not as good as using a blocking lock with a timeout. In this case, the waiting
41737 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
41738 and can proceed as soon as the previous lock holder releases it.
41739 </para>
41740 <para>
41741 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
41742 timeout, are used. There may still be some retrying: the maximum number of
41743 retries is
41744 </para>
41745 <literallayout class="monospaced">
41746 (lock_retries * lock_interval) / lock_fcntl_timeout
41747 </literallayout>
41748 <para>
41749 rounded up to the next whole number. In other words, the total time during
41750 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
41751 <option>lock_fcntl_timeout</option> is set very large.
41752 </para>
41753 <para>
41754 You should consider setting this option if you are getting a lot of delayed
41755 local deliveries because of errors of the form
41756 </para>
41757 <literallayout class="monospaced">
41758 failed to lock mailbox /some/file (fcntl)
41759 </literallayout>
41760 <para>
41761 <indexterm role="option">
41762 <primary><option>lock_flock_timeout</option></primary>
41763 </indexterm>
41764 </para>
41765 <informaltable frame="all">
41766 <tgroup cols="4" colsep="0" rowsep="0">
41767 <colspec colwidth="8*" align="left"/>
41768 <colspec colwidth="6*" align="center"/>
41769 <colspec colwidth="6*" align="center"/>
41770 <colspec colwidth="6*" align="right"/>
41771 <tbody>
41772 <row>
41773 <entry><option>lock_flock_timeout</option></entry>
41774 <entry>Use: <emphasis>appendfile</emphasis></entry>
41775 <entry>Type: <emphasis>time</emphasis></entry>
41776 <entry>Default: <emphasis>0s</emphasis></entry>
41777 </row>
41778 </tbody>
41779 </tgroup>
41780 </informaltable>
41781 <para>
41782 This timeout applies to file locking when using <function>flock()</function> (see
41783 <option>use_flock</option>); the timeout operates in a similar manner to
41784 <option>lock_fcntl_timeout</option>.
41785 </para>
41786 <para>
41787 <indexterm role="option">
41788 <primary><option>lock_interval</option></primary>
41789 </indexterm>
41790 </para>
41791 <informaltable frame="all">
41792 <tgroup cols="4" colsep="0" rowsep="0">
41793 <colspec colwidth="8*" align="left"/>
41794 <colspec colwidth="6*" align="center"/>
41795 <colspec colwidth="6*" align="center"/>
41796 <colspec colwidth="6*" align="right"/>
41797 <tbody>
41798 <row>
41799 <entry><option>lock_interval</option></entry>
41800 <entry>Use: <emphasis>appendfile</emphasis></entry>
41801 <entry>Type: <emphasis>time</emphasis></entry>
41802 <entry>Default: <emphasis>3s</emphasis></entry>
41803 </row>
41804 </tbody>
41805 </tgroup>
41806 </informaltable>
41807 <para>
41808 This specifies the time to wait between attempts to lock the file. See below
41809 for details of locking.
41810 </para>
41811 <para>
41812 <indexterm role="option">
41813 <primary><option>lock_retries</option></primary>
41814 </indexterm>
41815 </para>
41816 <informaltable frame="all">
41817 <tgroup cols="4" colsep="0" rowsep="0">
41818 <colspec colwidth="8*" align="left"/>
41819 <colspec colwidth="6*" align="center"/>
41820 <colspec colwidth="6*" align="center"/>
41821 <colspec colwidth="6*" align="right"/>
41822 <tbody>
41823 <row>
41824 <entry><option>lock_retries</option></entry>
41825 <entry>Use: <emphasis>appendfile</emphasis></entry>
41826 <entry>Type: <emphasis>integer</emphasis></entry>
41827 <entry>Default: <emphasis>10</emphasis></entry>
41828 </row>
41829 </tbody>
41830 </tgroup>
41831 </informaltable>
41832 <para>
41833 This specifies the maximum number of attempts to lock the file. A value of zero
41834 is treated as 1. See below for details of locking.
41835 </para>
41836 <para>
41837 <indexterm role="option">
41838 <primary><option>lockfile_mode</option></primary>
41839 </indexterm>
41840 </para>
41841 <informaltable frame="all">
41842 <tgroup cols="4" colsep="0" rowsep="0">
41843 <colspec colwidth="8*" align="left"/>
41844 <colspec colwidth="6*" align="center"/>
41845 <colspec colwidth="6*" align="center"/>
41846 <colspec colwidth="6*" align="right"/>
41847 <tbody>
41848 <row>
41849 <entry><option>lockfile_mode</option></entry>
41850 <entry>Use: <emphasis>appendfile</emphasis></entry>
41851 <entry>Type: <emphasis>octal integer</emphasis></entry>
41852 <entry>Default: <emphasis>0600</emphasis></entry>
41853 </row>
41854 </tbody>
41855 </tgroup>
41856 </informaltable>
41857 <para>
41858 This specifies the mode of the created lock file, when a lock file is being
41859 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
41860 </para>
41861 <para>
41862 <indexterm role="option">
41863 <primary><option>lockfile_timeout</option></primary>
41864 </indexterm>
41865 </para>
41866 <informaltable frame="all">
41867 <tgroup cols="4" colsep="0" rowsep="0">
41868 <colspec colwidth="8*" align="left"/>
41869 <colspec colwidth="6*" align="center"/>
41870 <colspec colwidth="6*" align="center"/>
41871 <colspec colwidth="6*" align="right"/>
41872 <tbody>
41873 <row>
41874 <entry><option>lockfile_timeout</option></entry>
41875 <entry>Use: <emphasis>appendfile</emphasis></entry>
41876 <entry>Type: <emphasis>time</emphasis></entry>
41877 <entry>Default: <emphasis>30m</emphasis></entry>
41878 </row>
41879 </tbody>
41880 </tgroup>
41881 </informaltable>
41882 <para>
41883 <indexterm role="concept">
41884 <primary>timeout</primary>
41885 <secondary>mailbox locking</secondary>
41886 </indexterm>
41887 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
41888 exists and is older than this value, it is assumed to have been left behind by
41889 accident, and Exim attempts to remove it.
41890 </para>
41891 <para>
41892 <indexterm role="option">
41893 <primary><option>mailbox_filecount</option></primary>
41894 </indexterm>
41895 </para>
41896 <informaltable frame="all">
41897 <tgroup cols="4" colsep="0" rowsep="0">
41898 <colspec colwidth="8*" align="left"/>
41899 <colspec colwidth="6*" align="center"/>
41900 <colspec colwidth="6*" align="center"/>
41901 <colspec colwidth="6*" align="right"/>
41902 <tbody>
41903 <row>
41904 <entry><option>mailbox_filecount</option></entry>
41905 <entry>Use: <emphasis>appendfile</emphasis></entry>
41906 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41907 <entry>Default: <emphasis>unset</emphasis></entry>
41908 </row>
41909 </tbody>
41910 </tgroup>
41911 </informaltable>
41912 <para>
41913 <indexterm role="concept">
41914 <primary>mailbox</primary>
41915 <secondary>specifying size of</secondary>
41916 </indexterm>
41917 <indexterm role="concept">
41918 <primary>size</primary>
41919 <secondary>of mailbox</secondary>
41920 </indexterm>
41921 If this option is set, it is expanded, and the result is taken as the current
41922 number of files in the mailbox. It must be a decimal number, optionally
41923 followed by K or M. This provides a way of obtaining this information from an
41924 external source that maintains the data.
41925 </para>
41926 <para>
41927 <indexterm role="option">
41928 <primary><option>mailbox_size</option></primary>
41929 </indexterm>
41930 </para>
41931 <informaltable frame="all">
41932 <tgroup cols="4" colsep="0" rowsep="0">
41933 <colspec colwidth="8*" align="left"/>
41934 <colspec colwidth="6*" align="center"/>
41935 <colspec colwidth="6*" align="center"/>
41936 <colspec colwidth="6*" align="right"/>
41937 <tbody>
41938 <row>
41939 <entry><option>mailbox_size</option></entry>
41940 <entry>Use: <emphasis>appendfile</emphasis></entry>
41941 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41942 <entry>Default: <emphasis>unset</emphasis></entry>
41943 </row>
41944 </tbody>
41945 </tgroup>
41946 </informaltable>
41947 <para>
41948 <indexterm role="concept">
41949 <primary>mailbox</primary>
41950 <secondary>specifying size of</secondary>
41951 </indexterm>
41952 <indexterm role="concept">
41953 <primary>size</primary>
41954 <secondary>of mailbox</secondary>
41955 </indexterm>
41956 If this option is set, it is expanded, and the result is taken as the current
41957 size the mailbox. It must be a decimal number, optionally followed by K or M.
41958 This provides a way of obtaining this information from an external source that
41959 maintains the data. This is likely to be helpful for maildir deliveries where
41960 it is computationally expensive to compute the size of a mailbox.
41961 </para>
41962 <para>
41963 <indexterm role="option">
41964 <primary><option>maildir_format</option></primary>
41965 </indexterm>
41966 </para>
41967 <informaltable frame="all">
41968 <tgroup cols="4" colsep="0" rowsep="0">
41969 <colspec colwidth="8*" align="left"/>
41970 <colspec colwidth="6*" align="center"/>
41971 <colspec colwidth="6*" align="center"/>
41972 <colspec colwidth="6*" align="right"/>
41973 <tbody>
41974 <row>
41975 <entry><option>maildir_format</option></entry>
41976 <entry>Use: <emphasis>appendfile</emphasis></entry>
41977 <entry>Type: <emphasis>boolean</emphasis></entry>
41978 <entry>Default: <emphasis>false</emphasis></entry>
41979 </row>
41980 </tbody>
41981 </tgroup>
41982 </informaltable>
41983 <para>
41984 <indexterm role="concept">
41985 <primary>maildir format</primary>
41986 <secondary>specifying</secondary>
41987 </indexterm>
41988 If this option is set with the <option>directory</option> option, the delivery is into a new
41989 file, in the <quote>maildir</quote> format that is used by other mail software. When the
41990 transport is activated directly from a <command>redirect</command> router (for example, the
41991 <command>address_file</command> transport in the default configuration), setting
41992 <option>maildir_format</option> causes the path received from the router to be treated as a
41993 directory, whether or not it ends with <literal>/</literal>. This option is available only if
41994 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
41995 <xref linkend="SECTmaildirdelivery"/> below for further details.
41996 </para>
41997 <para>
41998 <indexterm role="option">
41999 <primary><option>maildir_quota_directory_regex</option></primary>
42000 </indexterm>
42001 </para>
42002 <informaltable frame="all">
42003 <tgroup cols="4" colsep="0" rowsep="0">
42004 <colspec colwidth="8*" align="left"/>
42005 <colspec colwidth="6*" align="center"/>
42006 <colspec colwidth="6*" align="center"/>
42007 <colspec colwidth="6*" align="right"/>
42008 <tbody>
42009 <row>
42010 <entry><option>maildir_quota_directory_regex</option></entry>
42011 <entry>Use: <emphasis>appendfile</emphasis></entry>
42012 <entry>Type: <emphasis>string</emphasis></entry>
42013 <entry>Default: <emphasis>See below</emphasis></entry>
42014 </row>
42015 </tbody>
42016 </tgroup>
42017 </informaltable>
42018 <para>
42019 <indexterm role="concept">
42020 <primary>maildir format</primary>
42021 <secondary>quota; directories included in</secondary>
42022 </indexterm>
42023 <indexterm role="concept">
42024 <primary>quota</primary>
42025 <secondary>maildir; directories included in</secondary>
42026 </indexterm>
42027 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
42028 a regular expression for specifying directories, relative to the quota
42029 directory (see <option>quota_directory</option>), that should be included in the quota
42030 calculation. The default value is:
42031 </para>
42032 <literallayout class="monospaced">
42033 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
42034 </literallayout>
42035 <para>
42036 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
42037 (directories whose names begin with a dot). If you want to exclude the
42038 <filename>Trash</filename>
42039 folder from the count (as some sites do), you need to change this setting to
42040 </para>
42041 <literallayout class="monospaced">
42042 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
42043 </literallayout>
42044 <para>
42045 This uses a negative lookahead in the regular expression to exclude the
42046 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
42047 calculations, quota processing is bypassed for any messages that are delivered
42048 directly into that directory.
42049 </para>
42050 <para>
42051 <indexterm role="option">
42052 <primary><option>maildir_retries</option></primary>
42053 </indexterm>
42054 </para>
42055 <informaltable frame="all">
42056 <tgroup cols="4" colsep="0" rowsep="0">
42057 <colspec colwidth="8*" align="left"/>
42058 <colspec colwidth="6*" align="center"/>
42059 <colspec colwidth="6*" align="center"/>
42060 <colspec colwidth="6*" align="right"/>
42061 <tbody>
42062 <row>
42063 <entry><option>maildir_retries</option></entry>
42064 <entry>Use: <emphasis>appendfile</emphasis></entry>
42065 <entry>Type: <emphasis>integer</emphasis></entry>
42066 <entry>Default: <emphasis>10</emphasis></entry>
42067 </row>
42068 </tbody>
42069 </tgroup>
42070 </informaltable>
42071 <para>
42072 This option specifies the number of times to retry when writing a file in
42073 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
42074 </para>
42075 <para>
42076 <indexterm role="option">
42077 <primary><option>maildir_tag</option></primary>
42078 </indexterm>
42079 </para>
42080 <informaltable frame="all">
42081 <tgroup cols="4" colsep="0" rowsep="0">
42082 <colspec colwidth="8*" align="left"/>
42083 <colspec colwidth="6*" align="center"/>
42084 <colspec colwidth="6*" align="center"/>
42085 <colspec colwidth="6*" align="right"/>
42086 <tbody>
42087 <row>
42088 <entry><option>maildir_tag</option></entry>
42089 <entry>Use: <emphasis>appendfile</emphasis></entry>
42090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42091 <entry>Default: <emphasis>unset</emphasis></entry>
42092 </row>
42093 </tbody>
42094 </tgroup>
42095 </informaltable>
42096 <para>
42097 This option applies only to deliveries in maildir format, and is described in
42098 section <xref linkend="SECTmaildirdelivery"/> below.
42099 </para>
42100 <para>
42101 <indexterm role="option">
42102 <primary><option>maildir_use_size_file</option></primary>
42103 </indexterm>
42104 </para>
42105 <informaltable frame="all">
42106 <tgroup cols="4" colsep="0" rowsep="0">
42107 <colspec colwidth="8*" align="left"/>
42108 <colspec colwidth="6*" align="center"/>
42109 <colspec colwidth="6*" align="center"/>
42110 <colspec colwidth="6*" align="right"/>
42111 <tbody>
42112 <row>
42113 <entry><option>maildir_use_size_file</option></entry>
42114 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
42115 <entry>Type: <emphasis>boolean</emphasis></entry>
42116 <entry>Default: <emphasis>false</emphasis></entry>
42117 </row>
42118 </tbody>
42119 </tgroup>
42120 </informaltable>
42121 <para>
42122 <indexterm role="concept">
42123 <primary>maildir format</primary>
42124 <secondary><filename>maildirsize</filename> file</secondary>
42125 </indexterm>
42126 The result of string expansion for this option must be a valid boolean value.
42127 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
42128 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
42129 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
42130 value is zero. See <option>maildir_quota_directory_regex</option> above and section
42131 <xref linkend="SECTmaildirdelivery"/> below for further details.
42132 </para>
42133 <para>
42134 <indexterm role="option">
42135 <primary><option>maildirfolder_create_regex</option></primary>
42136 </indexterm>
42137 </para>
42138 <informaltable frame="all">
42139 <tgroup cols="4" colsep="0" rowsep="0">
42140 <colspec colwidth="8*" align="left"/>
42141 <colspec colwidth="6*" align="center"/>
42142 <colspec colwidth="6*" align="center"/>
42143 <colspec colwidth="6*" align="right"/>
42144 <tbody>
42145 <row>
42146 <entry><option>maildirfolder_create_regex</option></entry>
42147 <entry>Use: <emphasis>appendfile</emphasis></entry>
42148 <entry>Type: <emphasis>string</emphasis></entry>
42149 <entry>Default: <emphasis>unset</emphasis></entry>
42150 </row>
42151 </tbody>
42152 </tgroup>
42153 </informaltable>
42154 <para>
42155 <indexterm role="concept">
42156 <primary>maildir format</primary>
42157 <secondary><filename>maildirfolder</filename> file</secondary>
42158 </indexterm>
42159 <indexterm role="concept">
42160 <primary><filename>maildirfolder</filename>, creating</primary>
42161 </indexterm>
42162 The value of this option is a regular expression. If it is unset, it has no
42163 effect. Otherwise, before a maildir delivery takes place, the pattern is
42164 matched against the name of the maildir directory, that is, the directory
42165 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
42166 delivery. If there is a match, Exim checks for the existence of a file called
42167 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
42168 See section <xref linkend="SECTmaildirdelivery"/> for more details.
42169 </para>
42170 <para>
42171 <indexterm role="option">
42172 <primary><option>mailstore_format</option></primary>
42173 </indexterm>
42174 </para>
42175 <informaltable frame="all">
42176 <tgroup cols="4" colsep="0" rowsep="0">
42177 <colspec colwidth="8*" align="left"/>
42178 <colspec colwidth="6*" align="center"/>
42179 <colspec colwidth="6*" align="center"/>
42180 <colspec colwidth="6*" align="right"/>
42181 <tbody>
42182 <row>
42183 <entry><option>mailstore_format</option></entry>
42184 <entry>Use: <emphasis>appendfile</emphasis></entry>
42185 <entry>Type: <emphasis>boolean</emphasis></entry>
42186 <entry>Default: <emphasis>false</emphasis></entry>
42187 </row>
42188 </tbody>
42189 </tgroup>
42190 </informaltable>
42191 <para>
42192 <indexterm role="concept">
42193 <primary>mailstore format</primary>
42194 <secondary>specifying</secondary>
42195 </indexterm>
42196 If this option is set with the <option>directory</option> option, the delivery is into two
42197 new files in  <quote>mailstore</quote> format. The option is available only if
42198 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
42199 below for further details.
42200 </para>
42201 <para>
42202 <indexterm role="option">
42203 <primary><option>mailstore_prefix</option></primary>
42204 </indexterm>
42205 </para>
42206 <informaltable frame="all">
42207 <tgroup cols="4" colsep="0" rowsep="0">
42208 <colspec colwidth="8*" align="left"/>
42209 <colspec colwidth="6*" align="center"/>
42210 <colspec colwidth="6*" align="center"/>
42211 <colspec colwidth="6*" align="right"/>
42212 <tbody>
42213 <row>
42214 <entry><option>mailstore_prefix</option></entry>
42215 <entry>Use: <emphasis>appendfile</emphasis></entry>
42216 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42217 <entry>Default: <emphasis>unset</emphasis></entry>
42218 </row>
42219 </tbody>
42220 </tgroup>
42221 </informaltable>
42222 <para>
42223 This option applies only to deliveries in mailstore format, and is described in
42224 section <xref linkend="SECTopdir"/> below.
42225 </para>
42226 <para>
42227 <indexterm role="option">
42228 <primary><option>mailstore_suffix</option></primary>
42229 </indexterm>
42230 </para>
42231 <informaltable frame="all">
42232 <tgroup cols="4" colsep="0" rowsep="0">
42233 <colspec colwidth="8*" align="left"/>
42234 <colspec colwidth="6*" align="center"/>
42235 <colspec colwidth="6*" align="center"/>
42236 <colspec colwidth="6*" align="right"/>
42237 <tbody>
42238 <row>
42239 <entry><option>mailstore_suffix</option></entry>
42240 <entry>Use: <emphasis>appendfile</emphasis></entry>
42241 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42242 <entry>Default: <emphasis>unset</emphasis></entry>
42243 </row>
42244 </tbody>
42245 </tgroup>
42246 </informaltable>
42247 <para>
42248 This option applies only to deliveries in mailstore format, and is described in
42249 section <xref linkend="SECTopdir"/> below.
42250 </para>
42251 <para>
42252 <indexterm role="option">
42253 <primary><option>mbx_format</option></primary>
42254 </indexterm>
42255 </para>
42256 <informaltable frame="all">
42257 <tgroup cols="4" colsep="0" rowsep="0">
42258 <colspec colwidth="8*" align="left"/>
42259 <colspec colwidth="6*" align="center"/>
42260 <colspec colwidth="6*" align="center"/>
42261 <colspec colwidth="6*" align="right"/>
42262 <tbody>
42263 <row>
42264 <entry><option>mbx_format</option></entry>
42265 <entry>Use: <emphasis>appendfile</emphasis></entry>
42266 <entry>Type: <emphasis>boolean</emphasis></entry>
42267 <entry>Default: <emphasis>false</emphasis></entry>
42268 </row>
42269 </tbody>
42270 </tgroup>
42271 </informaltable>
42272 <para>
42273 <indexterm role="concept">
42274 <primary>locking files</primary>
42275 </indexterm>
42276 <indexterm role="concept">
42277 <primary>file</primary>
42278 <secondary>locking</secondary>
42279 </indexterm>
42280 <indexterm role="concept">
42281 <primary>file</primary>
42282 <secondary>MBX format</secondary>
42283 </indexterm>
42284 <indexterm role="concept">
42285 <primary>MBX format, specifying</primary>
42286 </indexterm>
42287 This option is available only if Exim has been compiled with SUPPORT_MBX
42288 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
42289 the message is appended to the mailbox file in MBX format instead of
42290 traditional Unix format. This format is supported by Pine4 and its associated
42291 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
42292 </para>
42293 <para>
42294 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
42295 automatically changed by the use of <option>mbx_format</option>. They should normally be set
42296 empty when using MBX format, so this option almost always appears in this
42297 combination:
42298 </para>
42299 <literallayout class="monospaced">
42300 mbx_format = true
42301 message_prefix =
42302 message_suffix =
42303 </literallayout>
42304 <para>
42305 If none of the locking options are mentioned in the configuration,
42306 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
42307 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
42308 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
42309 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
42310 should not be used if any program that does not use this form of locking is
42311 going to access the mailbox, nor should it be used if the mailbox file is NFS
42312 mounted, because it works only when the mailbox is accessed from a single host.
42313 </para>
42314 <para>
42315 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
42316 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
42317 (this means for the whole of a Pine or IMAP session), Exim will not be able to
42318 append messages to it.
42319 </para>
42320 <para>
42321 <indexterm role="option">
42322 <primary><option>message_prefix</option></primary>
42323 </indexterm>
42324 </para>
42325 <informaltable frame="all">
42326 <tgroup cols="4" colsep="0" rowsep="0">
42327 <colspec colwidth="8*" align="left"/>
42328 <colspec colwidth="6*" align="center"/>
42329 <colspec colwidth="6*" align="center"/>
42330 <colspec colwidth="6*" align="right"/>
42331 <tbody>
42332 <row>
42333 <entry><option>message_prefix</option></entry>
42334 <entry>Use: <emphasis>appendfile</emphasis></entry>
42335 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42336 <entry>Default: <emphasis>see below</emphasis></entry>
42337 </row>
42338 </tbody>
42339 </tgroup>
42340 </informaltable>
42341 <para>
42342 <indexterm role="concept">
42343 <primary><quote>From</quote> line</primary>
42344 </indexterm>
42345 The string specified here is expanded and output at the start of every message.
42346 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42347 in which case it is:
42348 </para>
42349 <literallayout class="monospaced">
42350 message_prefix = "From ${if def:return_path{$return_path}\
42351   {MAILER-DAEMON}} $tod_bsdinbox\n"
42352 </literallayout>
42353 <para>
42354 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42355 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
42356 </para>
42357 <para>
42358 <indexterm role="option">
42359 <primary><option>message_suffix</option></primary>
42360 </indexterm>
42361 </para>
42362 <informaltable frame="all">
42363 <tgroup cols="4" colsep="0" rowsep="0">
42364 <colspec colwidth="8*" align="left"/>
42365 <colspec colwidth="6*" align="center"/>
42366 <colspec colwidth="6*" align="center"/>
42367 <colspec colwidth="6*" align="right"/>
42368 <tbody>
42369 <row>
42370 <entry><option>message_suffix</option></entry>
42371 <entry>Use: <emphasis>appendfile</emphasis></entry>
42372 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42373 <entry>Default: <emphasis>see below</emphasis></entry>
42374 </row>
42375 </tbody>
42376 </tgroup>
42377 </informaltable>
42378 <para>
42379 The string specified here is expanded and output at the end of every message.
42380 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42381 in which case it is a single newline character. The suffix can be suppressed by
42382 setting
42383 </para>
42384 <literallayout class="monospaced">
42385 message_suffix =
42386 </literallayout>
42387 <para>
42388 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42389 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
42390 </para>
42391 <para>
42392 <indexterm role="option">
42393 <primary><option>mode</option></primary>
42394 </indexterm>
42395 </para>
42396 <informaltable frame="all">
42397 <tgroup cols="4" colsep="0" rowsep="0">
42398 <colspec colwidth="8*" align="left"/>
42399 <colspec colwidth="6*" align="center"/>
42400 <colspec colwidth="6*" align="center"/>
42401 <colspec colwidth="6*" align="right"/>
42402 <tbody>
42403 <row>
42404 <entry><option>mode</option></entry>
42405 <entry>Use: <emphasis>appendfile</emphasis></entry>
42406 <entry>Type: <emphasis>octal integer</emphasis></entry>
42407 <entry>Default: <emphasis>0600</emphasis></entry>
42408 </row>
42409 </tbody>
42410 </tgroup>
42411 </informaltable>
42412 <para>
42413 If the output file is created, it is given this mode. If it already exists and
42414 has wider permissions, they are reduced to this mode. If it has narrower
42415 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
42416 if the delivery is the result of a <option>save</option> command in a filter file specifying
42417 a particular mode, the mode of the output file is always forced to take that
42418 value, and this option is ignored.
42419 </para>
42420 <para>
42421 <indexterm role="option">
42422 <primary><option>mode_fail_narrower</option></primary>
42423 </indexterm>
42424 </para>
42425 <informaltable frame="all">
42426 <tgroup cols="4" colsep="0" rowsep="0">
42427 <colspec colwidth="8*" align="left"/>
42428 <colspec colwidth="6*" align="center"/>
42429 <colspec colwidth="6*" align="center"/>
42430 <colspec colwidth="6*" align="right"/>
42431 <tbody>
42432 <row>
42433 <entry><option>mode_fail_narrower</option></entry>
42434 <entry>Use: <emphasis>appendfile</emphasis></entry>
42435 <entry>Type: <emphasis>boolean</emphasis></entry>
42436 <entry>Default: <emphasis>true</emphasis></entry>
42437 </row>
42438 </tbody>
42439 </tgroup>
42440 </informaltable>
42441 <para>
42442 This option applies in the case when an existing mailbox file has a narrower
42443 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
42444 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
42445 continues with the delivery attempt, using the existing mode of the file.
42446 </para>
42447 <para>
42448 <indexterm role="option">
42449 <primary><option>notify_comsat</option></primary>
42450 </indexterm>
42451 </para>
42452 <informaltable frame="all">
42453 <tgroup cols="4" colsep="0" rowsep="0">
42454 <colspec colwidth="8*" align="left"/>
42455 <colspec colwidth="6*" align="center"/>
42456 <colspec colwidth="6*" align="center"/>
42457 <colspec colwidth="6*" align="right"/>
42458 <tbody>
42459 <row>
42460 <entry><option>notify_comsat</option></entry>
42461 <entry>Use: <emphasis>appendfile</emphasis></entry>
42462 <entry>Type: <emphasis>boolean</emphasis></entry>
42463 <entry>Default: <emphasis>false</emphasis></entry>
42464 </row>
42465 </tbody>
42466 </tgroup>
42467 </informaltable>
42468 <para>
42469 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
42470 successful delivery to a user mailbox. This is the daemon that notifies logged
42471 on users about incoming mail.
42472 </para>
42473 <para>
42474 <indexterm role="option">
42475 <primary><option>quota</option></primary>
42476 </indexterm>
42477 </para>
42478 <informaltable frame="all">
42479 <tgroup cols="4" colsep="0" rowsep="0">
42480 <colspec colwidth="8*" align="left"/>
42481 <colspec colwidth="6*" align="center"/>
42482 <colspec colwidth="6*" align="center"/>
42483 <colspec colwidth="6*" align="right"/>
42484 <tbody>
42485 <row>
42486 <entry><option>quota</option></entry>
42487 <entry>Use: <emphasis>appendfile</emphasis></entry>
42488 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42489 <entry>Default: <emphasis>unset</emphasis></entry>
42490 </row>
42491 </tbody>
42492 </tgroup>
42493 </informaltable>
42494 <para>
42495 <indexterm role="concept">
42496 <primary>quota</primary>
42497 <secondary>imposed by Exim</secondary>
42498 </indexterm>
42499 This option imposes a limit on the size of the file to which Exim is appending,
42500 or to the total space used in the directory tree when the <option>directory</option> option
42501 is set. In the latter case, computation of the space used is expensive, because
42502 all the files in the directory (and any sub-directories) have to be
42503 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
42504 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
42505 have no shell access to their mailboxes).
42506 </para>
42507 <para>
42508 As there is no interlock against two simultaneous deliveries into a
42509 multi-file mailbox, it is possible for the quota to be overrun in this case.
42510 For single-file mailboxes, of course, an interlock is a necessity.
42511 </para>
42512 <para>
42513 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
42514 may be a lot less than the actual amount of disk space allocated to the file.
42515 If the sizes of a number of files are being added up, the rounding effect can
42516 become quite noticeable, especially on systems that have large block sizes.
42517 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
42518 the obvious value which users understand most easily.
42519 </para>
42520 <para>
42521 The value of the option is expanded, and must then be a numerical value
42522 (decimal point allowed), optionally followed by one of the letters K, M, or G,
42523 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
42524 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
42525 be handled.
42526 </para>
42527 <para>
42528 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
42529 </para>
42530 <para>
42531 The expansion happens while Exim is running as root, before it changes uid for
42532 the delivery. This means that files that are inaccessible to the end user can
42533 be used to hold quota values that are looked up in the expansion. When delivery
42534 fails because this quota is exceeded, the handling of the error is as for
42535 system quota failures.
42536 </para>
42537 <para>
42538 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
42539 mailbox to the specified maximum size, though the value is not accurate to the
42540 last byte, owing to separator lines and additional headers that may get added
42541 during message delivery. When a mailbox is nearly full, large messages may get
42542 refused even though small ones are accepted, because the size of the current
42543 message is added to the quota when the check is made. This behaviour can be
42544 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
42545 for exceeding the quota does not include the current message. Thus, deliveries
42546 continue until the quota has been exceeded; thereafter, no further messages are
42547 delivered. See also <option>quota_warn_threshold</option>.
42548 </para>
42549 <para>
42550 <indexterm role="option">
42551 <primary><option>quota_directory</option></primary>
42552 </indexterm>
42553 </para>
42554 <informaltable frame="all">
42555 <tgroup cols="4" colsep="0" rowsep="0">
42556 <colspec colwidth="8*" align="left"/>
42557 <colspec colwidth="6*" align="center"/>
42558 <colspec colwidth="6*" align="center"/>
42559 <colspec colwidth="6*" align="right"/>
42560 <tbody>
42561 <row>
42562 <entry><option>quota_directory</option></entry>
42563 <entry>Use: <emphasis>appendfile</emphasis></entry>
42564 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42565 <entry>Default: <emphasis>unset</emphasis></entry>
42566 </row>
42567 </tbody>
42568 </tgroup>
42569 </informaltable>
42570 <para>
42571 This option defines the directory to check for quota purposes when delivering
42572 into individual files. The default is the delivery directory, or, if a file
42573 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
42574 delivery directory.
42575 </para>
42576 <para>
42577 <indexterm role="option">
42578 <primary><option>quota_filecount</option></primary>
42579 </indexterm>
42580 </para>
42581 <informaltable frame="all">
42582 <tgroup cols="4" colsep="0" rowsep="0">
42583 <colspec colwidth="8*" align="left"/>
42584 <colspec colwidth="6*" align="center"/>
42585 <colspec colwidth="6*" align="center"/>
42586 <colspec colwidth="6*" align="right"/>
42587 <tbody>
42588 <row>
42589 <entry><option>quota_filecount</option></entry>
42590 <entry>Use: <emphasis>appendfile</emphasis></entry>
42591 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42592 <entry>Default: <emphasis>0</emphasis></entry>
42593 </row>
42594 </tbody>
42595 </tgroup>
42596 </informaltable>
42597 <para>
42598 This option applies when the <option>directory</option> option is set. It limits the total
42599 number of files in the directory (compare the inode limit in system quotas). It
42600 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
42601 failure causes delivery to be deferred. A value of zero is interpreted as
42602 <quote>no quota</quote>.
42603 </para>
42604 <para>
42605 <indexterm role="option">
42606 <primary><option>quota_is_inclusive</option></primary>
42607 </indexterm>
42608 </para>
42609 <informaltable frame="all">
42610 <tgroup cols="4" colsep="0" rowsep="0">
42611 <colspec colwidth="8*" align="left"/>
42612 <colspec colwidth="6*" align="center"/>
42613 <colspec colwidth="6*" align="center"/>
42614 <colspec colwidth="6*" align="right"/>
42615 <tbody>
42616 <row>
42617 <entry><option>quota_is_inclusive</option></entry>
42618 <entry>Use: <emphasis>appendfile</emphasis></entry>
42619 <entry>Type: <emphasis>boolean</emphasis></entry>
42620 <entry>Default: <emphasis>true</emphasis></entry>
42621 </row>
42622 </tbody>
42623 </tgroup>
42624 </informaltable>
42625 <para>
42626 See <option>quota</option> above.
42627 </para>
42628 <para>
42629 <indexterm role="option">
42630 <primary><option>quota_size_regex</option></primary>
42631 </indexterm>
42632 </para>
42633 <informaltable frame="all">
42634 <tgroup cols="4" colsep="0" rowsep="0">
42635 <colspec colwidth="8*" align="left"/>
42636 <colspec colwidth="6*" align="center"/>
42637 <colspec colwidth="6*" align="center"/>
42638 <colspec colwidth="6*" align="right"/>
42639 <tbody>
42640 <row>
42641 <entry><option>quota_size_regex</option></entry>
42642 <entry>Use: <emphasis>appendfile</emphasis></entry>
42643 <entry>Type: <emphasis>string</emphasis></entry>
42644 <entry>Default: <emphasis>unset</emphasis></entry>
42645 </row>
42646 </tbody>
42647 </tgroup>
42648 </informaltable>
42649 <para>
42650 This option applies when one of the delivery modes that writes a separate file
42651 for each message is being used. When Exim wants to find the size of one of
42652 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
42653 If this is set to a regular expression that matches the file name, and it
42654 captures one string, that string is interpreted as a representation of the
42655 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
42656 </para>
42657 <para>
42658 This feature is useful only when users have no shell access to their mailboxes
42659 &ndash; otherwise they could defeat the quota simply by renaming the files. This
42660 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
42661 the file length to the file name. For example:
42662 </para>
42663 <literallayout class="monospaced">
42664 maildir_tag = ,S=$message_size
42665 quota_size_regex = ,S=(\d+)
42666 </literallayout>
42667 <para>
42668 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
42669 number of lines in the message.
42670 </para>
42671 <para>
42672 The regular expression should not assume that the length is at the end of the
42673 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
42674 sometimes add other information onto the ends of message file names.
42675 </para>
42676 <para>
42677 Section <xref linkend="SECID136"/> contains further information.
42678 </para>
42679 <para>
42680 <indexterm role="option">
42681 <primary><option>quota_warn_message</option></primary>
42682 </indexterm>
42683 </para>
42684 <informaltable frame="all">
42685 <tgroup cols="4" colsep="0" rowsep="0">
42686 <colspec colwidth="8*" align="left"/>
42687 <colspec colwidth="6*" align="center"/>
42688 <colspec colwidth="6*" align="center"/>
42689 <colspec colwidth="6*" align="right"/>
42690 <tbody>
42691 <row>
42692 <entry><option>quota_warn_message</option></entry>
42693 <entry>Use: <emphasis>appendfile</emphasis></entry>
42694 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42695 <entry>Default: <emphasis>see below</emphasis></entry>
42696 </row>
42697 </tbody>
42698 </tgroup>
42699 </informaltable>
42700 <para>
42701 See below for the use of this option. If it is not set when
42702 <option>quota_warn_threshold</option> is set, it defaults to
42703 </para>
42704 <literallayout class="monospaced">
42705 quota_warn_message = "\
42706   To: $local_part@$domain\n\
42707   Subject: Your mailbox\n\n\
42708   This message is automatically created \
42709   by mail delivery software.\n\n\
42710   The size of your mailbox has exceeded \
42711   a warning threshold that is\n\
42712   set by the system administrator.\n"
42713 </literallayout>
42714 <para>
42715 <indexterm role="option">
42716 <primary><option>quota_warn_threshold</option></primary>
42717 </indexterm>
42718 </para>
42719 <informaltable frame="all">
42720 <tgroup cols="4" colsep="0" rowsep="0">
42721 <colspec colwidth="8*" align="left"/>
42722 <colspec colwidth="6*" align="center"/>
42723 <colspec colwidth="6*" align="center"/>
42724 <colspec colwidth="6*" align="right"/>
42725 <tbody>
42726 <row>
42727 <entry><option>quota_warn_threshold</option></entry>
42728 <entry>Use: <emphasis>appendfile</emphasis></entry>
42729 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42730 <entry>Default: <emphasis>0</emphasis></entry>
42731 </row>
42732 </tbody>
42733 </tgroup>
42734 </informaltable>
42735 <para>
42736 <indexterm role="concept">
42737 <primary>quota</primary>
42738 <secondary>warning threshold</secondary>
42739 </indexterm>
42740 <indexterm role="concept">
42741 <primary>mailbox</primary>
42742 <secondary>size warning</secondary>
42743 </indexterm>
42744 <indexterm role="concept">
42745 <primary>size</primary>
42746 <secondary>of mailbox</secondary>
42747 </indexterm>
42748 This option is expanded in the same way as <option>quota</option> (see above). If the
42749 resulting value is greater than zero, and delivery of the message causes the
42750 size of the file or total space in the directory tree to cross the given
42751 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
42752 may be specified as a percentage of it by following the value with a percent
42753 sign. For example:
42754 </para>
42755 <literallayout class="monospaced">
42756 quota = 10M
42757 quota_warn_threshold = 75%
42758 </literallayout>
42759 <para>
42760 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
42761 percent sign is ignored.
42762 </para>
42763 <para>
42764 The warning message itself is specified by the <option>quota_warn_message</option> option,
42765 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
42766 warning message. These do not necessarily have to include the recipient(s) of
42767 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
42768 can include any other header lines that you want. If you do not include a
42769 <emphasis>From:</emphasis> line, the default is:
42770 </para>
42771 <literallayout class="monospaced">
42772 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
42773 </literallayout>
42774 <para>
42775 <indexterm role="option">
42776 <primary><option>errors_reply_to</option></primary>
42777 </indexterm>
42778 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
42779 option.
42780 </para>
42781 <para>
42782 The <option>quota</option> option does not have to be set in order to use this option; they
42783 are independent of one another except when the threshold is specified as a
42784 percentage.
42785 </para>
42786 <para>
42787 <indexterm role="option">
42788 <primary><option>use_bsmtp</option></primary>
42789 </indexterm>
42790 </para>
42791 <informaltable frame="all">
42792 <tgroup cols="4" colsep="0" rowsep="0">
42793 <colspec colwidth="8*" align="left"/>
42794 <colspec colwidth="6*" align="center"/>
42795 <colspec colwidth="6*" align="center"/>
42796 <colspec colwidth="6*" align="right"/>
42797 <tbody>
42798 <row>
42799 <entry><option>use_bsmtp</option></entry>
42800 <entry>Use: <emphasis>appendfile</emphasis></entry>
42801 <entry>Type: <emphasis>boolean</emphasis></entry>
42802 <entry>Default: <emphasis>false</emphasis></entry>
42803 </row>
42804 </tbody>
42805 </tgroup>
42806 </informaltable>
42807 <para>
42808 <indexterm role="concept">
42809 <primary>envelope sender</primary>
42810 </indexterm>
42811 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
42812 format, with the envelope sender and recipient(s) included as SMTP commands. If
42813 you want to include a leading HELO command with such messages, you can do
42814 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
42815 for details of batch SMTP.
42816 </para>
42817 <para>
42818 <indexterm role="option">
42819 <primary><option>use_crlf</option></primary>
42820 </indexterm>
42821 </para>
42822 <informaltable frame="all">
42823 <tgroup cols="4" colsep="0" rowsep="0">
42824 <colspec colwidth="8*" align="left"/>
42825 <colspec colwidth="6*" align="center"/>
42826 <colspec colwidth="6*" align="center"/>
42827 <colspec colwidth="6*" align="right"/>
42828 <tbody>
42829 <row>
42830 <entry><option>use_crlf</option></entry>
42831 <entry>Use: <emphasis>appendfile</emphasis></entry>
42832 <entry>Type: <emphasis>boolean</emphasis></entry>
42833 <entry>Default: <emphasis>false</emphasis></entry>
42834 </row>
42835 </tbody>
42836 </tgroup>
42837 </informaltable>
42838 <para>
42839 <indexterm role="concept">
42840 <primary>carriage return</primary>
42841 </indexterm>
42842 <indexterm role="concept">
42843 <primary>linefeed</primary>
42844 </indexterm>
42845 This option causes lines to be terminated with the two-character CRLF sequence
42846 (carriage return, linefeed) instead of just a linefeed character. In the case
42847 of batched SMTP, the byte sequence written to the file is then an exact image
42848 of what would be sent down a real SMTP connection.
42849 </para>
42850 <para>
42851 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
42852 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
42853 in Berkeley-style mailboxes) are written verbatim, so must contain their own
42854 carriage return characters if these are needed. In cases where these options
42855 have non-empty defaults, the values end with a single linefeed, so they must be
42856 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
42857 </para>
42858 <para>
42859 <indexterm role="option">
42860 <primary><option>use_fcntl_lock</option></primary>
42861 </indexterm>
42862 </para>
42863 <informaltable frame="all">
42864 <tgroup cols="4" colsep="0" rowsep="0">
42865 <colspec colwidth="8*" align="left"/>
42866 <colspec colwidth="6*" align="center"/>
42867 <colspec colwidth="6*" align="center"/>
42868 <colspec colwidth="6*" align="right"/>
42869 <tbody>
42870 <row>
42871 <entry><option>use_fcntl_lock</option></entry>
42872 <entry>Use: <emphasis>appendfile</emphasis></entry>
42873 <entry>Type: <emphasis>boolean</emphasis></entry>
42874 <entry>Default: <emphasis>see below</emphasis></entry>
42875 </row>
42876 </tbody>
42877 </tgroup>
42878 </informaltable>
42879 <para>
42880 This option controls the use of the <function>fcntl()</function> function to lock a file for
42881 exclusive use when a message is being appended. It is set by default unless
42882 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
42883 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
42884 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
42885 </para>
42886 <para>
42887 <indexterm role="option">
42888 <primary><option>use_flock_lock</option></primary>
42889 </indexterm>
42890 </para>
42891 <informaltable frame="all">
42892 <tgroup cols="4" colsep="0" rowsep="0">
42893 <colspec colwidth="8*" align="left"/>
42894 <colspec colwidth="6*" align="center"/>
42895 <colspec colwidth="6*" align="center"/>
42896 <colspec colwidth="6*" align="right"/>
42897 <tbody>
42898 <row>
42899 <entry><option>use_flock_lock</option></entry>
42900 <entry>Use: <emphasis>appendfile</emphasis></entry>
42901 <entry>Type: <emphasis>boolean</emphasis></entry>
42902 <entry>Default: <emphasis>false</emphasis></entry>
42903 </row>
42904 </tbody>
42905 </tgroup>
42906 </informaltable>
42907 <para>
42908 This option is provided to support the use of <function>flock()</function> for file locking, for
42909 the few situations where it is needed. Most modern operating systems support
42910 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
42911 each other. Exim uses <function>fcntl()</function> locking by default.
42912 </para>
42913 <para>
42914 This option is required only if you are using an operating system where
42915 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
42916 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
42917 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
42918 </para>
42919 <para>
42920 <indexterm role="concept">
42921 <primary>Solaris</primary>
42922 <secondary><function>flock()</function> support</secondary>
42923 </indexterm>
42924 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
42925 have it (and some, I think, provide a not quite right version built on top of
42926 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
42927 the ability to use it, and any attempt to do so will cause a configuration
42928 error.
42929 </para>
42930 <para>
42931 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
42932 is just being mapped onto <function>fcntl()</function> by the OS).
42933 </para>
42934 <para>
42935 <indexterm role="option">
42936 <primary><option>use_lockfile</option></primary>
42937 </indexterm>
42938 </para>
42939 <informaltable frame="all">
42940 <tgroup cols="4" colsep="0" rowsep="0">
42941 <colspec colwidth="8*" align="left"/>
42942 <colspec colwidth="6*" align="center"/>
42943 <colspec colwidth="6*" align="center"/>
42944 <colspec colwidth="6*" align="right"/>
42945 <tbody>
42946 <row>
42947 <entry><option>use_lockfile</option></entry>
42948 <entry>Use: <emphasis>appendfile</emphasis></entry>
42949 <entry>Type: <emphasis>boolean</emphasis></entry>
42950 <entry>Default: <emphasis>see below</emphasis></entry>
42951 </row>
42952 </tbody>
42953 </tgroup>
42954 </informaltable>
42955 <para>
42956 If this option is turned off, Exim does not attempt to create a lock file when
42957 appending to a mailbox file. In this situation, the only locking is by
42958 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
42959 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
42960 <function>fcntl()</function> rather than a lock file, and even then only when you are not
42961 delivering over NFS from more than one host.
42962 </para>
42963 <para>
42964 <indexterm role="concept">
42965 <primary>NFS</primary>
42966 <secondary>lock file</secondary>
42967 </indexterm>
42968 In order to append to an NFS file safely from more than one host, it is
42969 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
42970 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
42971 file corruption.
42972 </para>
42973 <para>
42974 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
42975 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
42976 except when <option>mbx_format</option> is set.
42977 </para>
42978 <para>
42979 <indexterm role="option">
42980 <primary><option>use_mbx_lock</option></primary>
42981 </indexterm>
42982 </para>
42983 <informaltable frame="all">
42984 <tgroup cols="4" colsep="0" rowsep="0">
42985 <colspec colwidth="8*" align="left"/>
42986 <colspec colwidth="6*" align="center"/>
42987 <colspec colwidth="6*" align="center"/>
42988 <colspec colwidth="6*" align="right"/>
42989 <tbody>
42990 <row>
42991 <entry><option>use_mbx_lock</option></entry>
42992 <entry>Use: <emphasis>appendfile</emphasis></entry>
42993 <entry>Type: <emphasis>boolean</emphasis></entry>
42994 <entry>Default: <emphasis>see below</emphasis></entry>
42995 </row>
42996 </tbody>
42997 </tgroup>
42998 </informaltable>
42999 <para>
43000 This option is available only if Exim has been compiled with SUPPORT_MBX
43001 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
43002 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
43003 of the locking options are mentioned in the configuration. The locking rules
43004 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
43005 the IMAP4 and POP daemons that come with it (see the discussion below). The
43006 rules allow for shared access to the mailbox. However, this kind of locking
43007 does not work when the mailbox is NFS mounted.
43008 </para>
43009 <para>
43010 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
43011 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
43012 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
43013 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
43014 </para>
43015 </section>
43016 <section id="SECTopappend">
43017 <title>Operational details for appending</title>
43018 <para>
43019 <indexterm role="concept">
43020 <primary>appending to a file</primary>
43021 </indexterm>
43022 <indexterm role="concept">
43023 <primary>file</primary>
43024 <secondary>appending</secondary>
43025 </indexterm>
43026 Before appending to a file, the following preparations are made:
43027 </para>
43028 <itemizedlist>
43029 <listitem>
43030 <para>
43031 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
43032 return is given.
43033 </para>
43034 </listitem>
43035 <listitem>
43036 <para>
43037 <indexterm role="concept">
43038 <primary>directory creation</primary>
43039 </indexterm>
43040 If any directories on the file&#x2019;s path are missing, Exim creates them if the
43041 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
43042 <option>directory_mode</option> option.
43043 </para>
43044 </listitem>
43045 <listitem>
43046 <para>
43047 If <option>file_format</option> is set, the format of an existing file is checked. If this
43048 indicates that a different transport should be used, control is passed to that
43049 transport.
43050 </para>
43051 </listitem>
43052 <listitem>
43053 <para>
43054 <indexterm role="concept">
43055 <primary>file</primary>
43056 <secondary>locking</secondary>
43057 </indexterm>
43058 <indexterm role="concept">
43059 <primary>locking files</primary>
43060 </indexterm>
43061 <indexterm role="concept">
43062 <primary>NFS</primary>
43063 <secondary>lock file</secondary>
43064 </indexterm>
43065 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
43066 reliably over NFS, as follows:
43067 </para>
43068 <orderedlist numeration="arabic">
43069 <listitem>
43070 <para>
43071 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
43072 current time, primary host name, and process id added, by opening for writing
43073 as a new file. If this fails with an access error, delivery is deferred.
43074 </para>
43075 </listitem>
43076 <listitem>
43077 <para>
43078 Close the hitching post file, and hard link it to the lock file name.
43079 </para>
43080 </listitem>
43081 <listitem>
43082 <para>
43083 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
43084 Unlink the hitching post name.
43085 </para>
43086 </listitem>
43087 <listitem>
43088 <para>
43089 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
43090 then unlink hitching post name. If the number of links is exactly two, creation
43091 of the lock file succeeded but something (for example, an NFS server crash and
43092 restart) caused this fact not to be communicated to the <function>link()</function> call.
43093 </para>
43094 </listitem>
43095 <listitem>
43096 <para>
43097 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
43098 up to <option>lock_retries</option> times. However, since any program that writes to a
43099 mailbox should complete its task very quickly, it is reasonable to time out old
43100 lock files that are normally the result of user agent and system crashes. If an
43101 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
43102 it before trying again.
43103 </para>
43104 </listitem>
43105 </orderedlist>
43106 </listitem>
43107 <listitem>
43108 <para>
43109 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
43110 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
43111 than non-existence, delivery is deferred.
43112 </para>
43113 </listitem>
43114 <listitem>
43115 <para>
43116 <indexterm role="concept">
43117 <primary>symbolic link</primary>
43118 <secondary>to mailbox</secondary>
43119 </indexterm>
43120 <indexterm role="concept">
43121 <primary>mailbox</primary>
43122 <secondary>symbolic link</secondary>
43123 </indexterm>
43124 If the file does exist and is a symbolic link, delivery is deferred, unless the
43125 <option>allow_symlink</option> option is set, in which case the ownership of the link is
43126 checked, and then <function>stat()</function> is called to find out about the real file, which
43127 is then subjected to the checks below. The check on the top-level link
43128 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
43129 directory, though allowing symbolic links in this case is definitely not a good
43130 idea. If there is a chain of symbolic links, the intermediate ones are not
43131 checked.
43132 </para>
43133 </listitem>
43134 <listitem>
43135 <para>
43136 If the file already exists but is not a regular file, or if the file&#x2019;s owner
43137 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
43138 different from the user and group under which the delivery is running,
43139 delivery is deferred.
43140 </para>
43141 </listitem>
43142 <listitem>
43143 <para>
43144 If the file&#x2019;s permissions are more generous than specified, they are reduced.
43145 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
43146 is set false, in which case the delivery is tried using the existing
43147 permissions.
43148 </para>
43149 </listitem>
43150 <listitem>
43151 <para>
43152 The file&#x2019;s inode number is saved, and the file is then opened for appending.
43153 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
43154 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
43155 </para>
43156 </listitem>
43157 <listitem>
43158 <para>
43159 If the file is opened successfully, check that the inode number hasn&#x2019;t
43160 changed, that it is still a regular file, and that the owner and permissions
43161 have not changed. If anything is wrong, defer delivery and freeze the message.
43162 </para>
43163 </listitem>
43164 <listitem>
43165 <para>
43166 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
43167 option is set. Otherwise, check that the file is being created in a permitted
43168 directory if the <option>create_file</option> option is set (deferring on failure), and then
43169 open for writing as a new file, with the O_EXCL and O_CREAT options,
43170 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
43171 set). In this case, which can happen if the link points to a non-existent file,
43172 the file is opened for writing using O_CREAT but not O_EXCL, because
43173 that prevents link following.
43174 </para>
43175 </listitem>
43176 <listitem>
43177 <para>
43178 <indexterm role="concept">
43179 <primary>loop</primary>
43180 <secondary>while file testing</secondary>
43181 </indexterm>
43182 If opening fails because the file exists, obey the tests given above for
43183 existing files. However, to avoid looping in a situation where the file is
43184 being continuously created and destroyed, the exists/not-exists loop is broken
43185 after 10 repetitions, and the message is then frozen.
43186 </para>
43187 </listitem>
43188 <listitem>
43189 <para>
43190 If opening fails with any other error, defer delivery.
43191 </para>
43192 </listitem>
43193 <listitem>
43194 <para>
43195 <indexterm role="concept">
43196 <primary>file</primary>
43197 <secondary>locking</secondary>
43198 </indexterm>
43199 <indexterm role="concept">
43200 <primary>locking files</primary>
43201 </indexterm>
43202 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
43203 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
43204 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
43205 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
43206 file, and an exclusive lock on the file whose name is
43207 </para>
43208 <literallayout class="monospaced">
43209 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
43210 </literallayout>
43211 <para>
43212 using the device and inode numbers of the open mailbox file, in accordance with
43213 the MBX locking rules. This file is created with a mode that is specified by
43214 the <option>lockfile_mode</option> option.
43215 </para>
43216 <para>
43217 If Exim fails to lock the file, there are two possible courses of action,
43218 depending on the value of the locking timeout. This is obtained from
43219 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
43220 </para>
43221 <para>
43222 If the timeout value is zero, the file is closed, Exim waits for
43223 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
43224 to lock it again. This happens up to <option>lock_retries</option> times, after which the
43225 delivery is deferred.
43226 </para>
43227 <para>
43228 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
43229 <function>flock()</function> are used (with the given timeout), so there has already been some
43230 waiting involved by the time locking fails. Nevertheless, Exim does not give up
43231 immediately. It retries up to
43232 </para>
43233 <literallayout class="monospaced">
43234 (lock_retries * lock_interval) / &lt;timeout&gt;
43235 </literallayout>
43236 <para>
43237 times (rounded up).
43238 </para>
43239 </listitem>
43240 </itemizedlist>
43241 <para>
43242 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
43243 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
43244 </para>
43245 </section>
43246 <section id="SECTopdir">
43247 <title>Operational details for delivery to a new file</title>
43248 <para>
43249 <indexterm role="concept">
43250 <primary>delivery</primary>
43251 <secondary>to single file</secondary>
43252 </indexterm>
43253 <indexterm role="concept">
43254 <primary><quote>From</quote> line</primary>
43255 </indexterm>
43256 When the <option>directory</option> option is set instead of <option>file</option>, each message is
43257 delivered into a newly-created file or set of files. When <command>appendfile</command> is
43258 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
43259 <option>directory</option> is normally set, because the path for delivery is supplied by the
43260 router. (See for example, the <command>address_file</command> transport in the default
43261 configuration.) In this case, delivery is to a new file if either the path name
43262 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
43263 </para>
43264 <para>
43265 No locking is required while writing the message to a new file, so the various
43266 locking options of the transport are ignored. The <quote>From</quote> line that by default
43267 separates messages in a single file is not normally needed, nor is the escaping
43268 of message lines that start with <quote>From</quote>, and there is no need to ensure a
43269 newline at the end of each message. Consequently, the default values for
43270 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
43271 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
43272 </para>
43273 <para>
43274 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
43275 the files in the delivery directory by default. However, you can specify a
43276 different directory by setting <option>quota_directory</option>. Also, for maildir
43277 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
43278 </para>
43279 <para>
43280 <indexterm role="concept">
43281 <primary>maildir format</primary>
43282 </indexterm>
43283 <indexterm role="concept">
43284 <primary>mailstore format</primary>
43285 </indexterm>
43286 There are three different ways in which delivery to individual files can be
43287 done, controlled by the settings of the <option>maildir_format</option> and
43288 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
43289 formats is not included in the binary unless SUPPORT_MAILDIR or
43290 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
43291 </para>
43292 <para>
43293 <indexterm role="concept">
43294 <primary>directory creation</primary>
43295 </indexterm>
43296 In all three cases an attempt is made to create the directory and any necessary
43297 sub-directories if they do not exist, provided that the <option>create_directory</option>
43298 option is set (the default). The location of a created directory can be
43299 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
43300 the <option>directory_mode</option> option. If creation fails, or if the
43301 <option>create_directory</option> option is not set when creation is required, delivery is
43302 deferred.
43303 </para>
43304 </section>
43305 <section id="SECTmaildirdelivery">
43306 <title>Maildir delivery</title>
43307 <para>
43308 <indexterm role="concept">
43309 <primary>maildir format</primary>
43310 <secondary>description of</secondary>
43311 </indexterm>
43312 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
43313 it to a file whose name is <filename>tmp/&lt;stime&gt;.H&lt;mtime&gt;P&lt;pid&gt;.&lt;host&gt;</filename> in the
43314 directory that is defined by the <option>directory</option> option (the <quote>delivery
43315 directory</quote>). If the delivery is successful, the file is renamed into the
43316 <filename>new</filename> subdirectory.
43317 </para>
43318 <para>
43319 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
43320 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
43321 Exim checks that the time-of-day clock has moved on by at least one microsecond
43322 before terminating the delivery process. This guarantees uniqueness for the
43323 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
43324 opening it. If any response other than ENOENT (does not exist) is given,
43325 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
43326 </para>
43327 <para>
43328 Before Exim carries out a maildir delivery, it ensures that subdirectories
43329 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
43330 do not exist, Exim tries to create them and any superior directories in their
43331 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
43332 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
43333 contains matches the delivery directory, Exim also ensures that a file called
43334 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
43335 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
43336 </para>
43337 <para>
43338 These features make it possible to use Exim to create all the necessary files
43339 and directories in a maildir mailbox, including subdirectories for maildir++
43340 folders. Consider this example:
43341 </para>
43342 <literallayout class="monospaced">
43343 maildir_format = true
43344 directory = /var/mail/$local_part\
43345            ${if eq{$local_part_suffix}{}{}\
43346            {/.${substr_1:$local_part_suffix}}}
43347 maildirfolder_create_regex = /\.[^/]+$
43348 </literallayout>
43349 <para>
43350 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
43351 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
43352 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
43353 not match this name, so Exim will not look for or create the file
43354 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
43355 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
43356 </para>
43357 <para>
43358 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
43359 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
43360 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
43361 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
43362 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
43363 </para>
43364 <para>
43365 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
43366 not inadvertently match the toplevel maildir directory, because a
43367 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
43368 </para>
43369 <para>
43370 <indexterm role="concept">
43371 <primary>quota</primary>
43372 <secondary>in maildir delivery</secondary>
43373 </indexterm>
43374 <indexterm role="concept">
43375 <primary>maildir++</primary>
43376 </indexterm>
43377 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
43378 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
43379 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
43380 Exim assumes the directory is a maildir++ folder directory, which is one level
43381 down from the user&#x2019;s top level mailbox directory. This causes it to start at
43382 the parent directory instead of the current directory when calculating the
43383 amount of space used.
43384 </para>
43385 <para>
43386 One problem with delivering into a multi-file mailbox is that it is
43387 computationally expensive to compute the size of the mailbox for quota
43388 checking. Various approaches have been taken to reduce the amount of work
43389 needed. The next two sections describe two of them. A third alternative is to
43390 use some external process for maintaining the size data, and use the expansion
43391 of the <option>mailbox_size</option> option as a way of importing it into Exim.
43392 </para>
43393 </section>
43394 <section id="SECID135">
43395 <title>Using tags to record message sizes</title>
43396 <para>
43397 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
43398 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
43399 tag is added to its name. However, if adding the tag takes the length of the
43400 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
43401 the tag is dropped and the maildir file is created with no tag.
43402 </para>
43403 <para>
43404 <indexterm role="variable">
43405 <primary><varname>$message_size</varname></primary>
43406 </indexterm>
43407 Tags can be used to encode the size of files in their names; see
43408 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
43409 happens after the message has been written. The value of the <varname>$message_size</varname>
43410 variable is set to the number of bytes actually written. If the expansion is
43411 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
43412 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
43413 Non-printing characters in the string are ignored; if the resulting string is
43414 empty, it is ignored. If it starts with an alphanumeric character, a leading
43415 colon is inserted; this default has not proven to be the path that popular
43416 maildir implementations have chosen (but changing it in Exim would break
43417 backwards compatibility).
43418 </para>
43419 <para>
43420 For one common implementation, you might set:
43421 </para>
43422 <literallayout class="monospaced">
43423 maildir_tag = ,S=${message_size}
43424 </literallayout>
43425 <para>
43426 but you should check the documentation of the other software to be sure.
43427 </para>
43428 <para>
43429 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
43430 as this allows Exim to extract the size from your tag, instead of having to
43431 <function>stat()</function> each message file.
43432 </para>
43433 </section>
43434 <section id="SECID136">
43435 <title>Using a maildirsize file</title>
43436 <para>
43437 <indexterm role="concept">
43438 <primary>quota</primary>
43439 <secondary>in maildir delivery</secondary>
43440 </indexterm>
43441 <indexterm role="concept">
43442 <primary>maildir format</primary>
43443 <secondary><filename>maildirsize</filename> file</secondary>
43444 </indexterm>
43445 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
43446 storing quota and message size information in a file called <filename>maildirsize</filename>
43447 within the toplevel maildir directory. If this file does not exist, Exim
43448 creates it, setting the quota from the <option>quota</option> option of the transport. If
43449 the maildir directory itself does not exist, it is created before any attempt
43450 to write a <filename>maildirsize</filename> file.
43451 </para>
43452 <para>
43453 The <filename>maildirsize</filename> file is used to hold information about the sizes of
43454 messages in the maildir, thus speeding up quota calculations. The quota value
43455 in the file is just a cache; if the quota is changed in the transport, the new
43456 value overrides the cached value when the next message is delivered. The cache
43457 is maintained for the benefit of other programs that access the maildir and
43458 need to know the quota.
43459 </para>
43460 <para>
43461 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
43462 file is maintained (with a zero quota setting), but no quota is imposed.
43463 </para>
43464 <para>
43465 A regular expression is available for controlling which directories in the
43466 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
43467 See the description of the <option>maildir_quota_directory_regex</option> option above for
43468 details.
43469 </para>
43470 </section>
43471 <section id="SECID137">
43472 <title>Mailstore delivery</title>
43473 <para>
43474 <indexterm role="concept">
43475 <primary>mailstore format</primary>
43476 <secondary>description of</secondary>
43477 </indexterm>
43478 If the <option>mailstore_format</option> option is true, each message is written as two
43479 files in the given directory. A unique base name is constructed from the
43480 message id and the current delivery process, and the files that are written use
43481 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
43482 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
43483 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
43484 </para>
43485 <para>
43486 During delivery, the envelope is first written to a file with the suffix
43487 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
43488 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
43489 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
43490 file before accessing either of them. An alternative approach is to wait for
43491 the absence of a <filename>.tmp</filename> file.
43492 </para>
43493 <para>
43494 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
43495 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
43496 the sender address on one line, then all the recipient addresses, one per line.
43497 There can be more than one recipient only if the <option>batch_max</option> option is set
43498 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
43499 appended to the file, followed by a newline if it does not end with one.
43500 </para>
43501 <para>
43502 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
43503 failure, it is ignored. Other expansion errors are treated as serious
43504 configuration errors, and delivery is deferred. The variable
43505 <varname>$mailstore_basename</varname> is available for use during these expansions.
43506 </para>
43507 </section>
43508 <section id="SECID138">
43509 <title>Non-special new file delivery</title>
43510 <para>
43511 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
43512 file is created directly in the named directory. For example, when delivering
43513 messages into files in batched SMTP format for later delivery to some host (see
43514 section <xref linkend="SECTbatchSMTP"/>), a setting such as
43515 </para>
43516 <literallayout class="monospaced">
43517 directory = /var/bsmtp/$host
43518 </literallayout>
43519 <para>
43520 might be used. A message is written to a file with a temporary name, which is
43521 then renamed when the delivery is complete. The final name is obtained by
43522 expanding the contents of the <option>directory_file</option> option.
43523 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
43524 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
43525 </para>
43526 </section>
43527 </chapter>
43528
43529 <chapter id="CHID8">
43530 <title>The autoreply transport</title>
43531 <para>
43532 <indexterm role="concept" id="IIDauttra1" class="startofrange">
43533 <primary>transports</primary>
43534 <secondary><command>autoreply</command></secondary>
43535 </indexterm>
43536 <indexterm role="concept" id="IIDauttra2" class="startofrange">
43537 <primary><command>autoreply</command> transport</primary>
43538 </indexterm>
43539 The <command>autoreply</command> transport is not a true transport in that it does not cause
43540 the message to be transmitted. Instead, it generates a new mail message as an
43541 automatic reply to the incoming message. <emphasis>References:</emphasis> and
43542 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
43543 to the rules in RFCs 2822 and 3834, respectively.
43544 </para>
43545 <para>
43546 If the router that passes the message to this transport does not have the
43547 <option>unseen</option> option set, the original message (for the current recipient) is not
43548 delivered anywhere. However, when the <option>unseen</option> option is set on the router
43549 that passes the message to this transport, routing of the address continues, so
43550 another router can set up a normal message delivery.
43551 </para>
43552 <para>
43553 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
43554 <quote>vacation</quote> message being the standard example. However, it can also be run
43555 directly from a router like any other transport. To reduce the possibility of
43556 message cascades, messages created by the <command>autoreply</command> transport always have
43557 empty envelope sender addresses, like bounce messages.
43558 </para>
43559 <para>
43560 The parameters of the message to be sent can be specified in the configuration
43561 by options described below. However, these are used only when the address
43562 passed to the transport does not contain its own reply information. When the
43563 transport is run as a consequence of a
43564 <option>mail</option>
43565 or <option>vacation</option> command in a filter file, the parameters of the message are
43566 supplied by the filter, and passed with the address. The transport&#x2019;s options
43567 that define the message are then ignored (so they are not usually set in this
43568 case). The message is specified entirely by the filter or by the transport; it
43569 is never built from a mixture of options. However, the <option>file_optional</option>,
43570 <option>mode</option>, and <option>return_message</option> options apply in all cases.
43571 </para>
43572 <para>
43573 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
43574 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
43575 gid of the user, and with appropriate current and home directories (see chapter
43576 <xref linkend="CHAPenvironment"/>).
43577 </para>
43578 <para>
43579 There is a subtle difference between routing a message to a <command>pipe</command> transport
43580 that generates some text to be returned to the sender, and routing it to an
43581 <command>autoreply</command> transport. This difference is noticeable only if more than one
43582 address from the same message is so handled. In the case of a pipe, the
43583 separate outputs from the different addresses are gathered up and returned to
43584 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
43585 message is generated for each address that is passed to it.
43586 </para>
43587 <para>
43588 Non-printing characters are not permitted in the header lines generated for the
43589 message that <command>autoreply</command> creates, with the exception of newlines that are
43590 immediately followed by white space. If any non-printing characters are found,
43591 the transport defers.
43592 Whether characters with the top bit set count as printing characters or not is
43593 controlled by the <option>print_topbitchars</option> global option.
43594 </para>
43595 <para>
43596 If any of the generic options for manipulating headers (for example,
43597 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
43598 of the original message that is included in the generated message when
43599 <option>return_message</option> is set. They do not apply to the generated message itself.
43600 </para>
43601 <para>
43602 <indexterm role="variable">
43603 <primary><varname>$sender_address</varname></primary>
43604 </indexterm>
43605 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
43606 the message, indicating that there were no recipients, it does not treat this
43607 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
43608 is empty (because the incoming message is a bounce message) do not cause
43609 problems. They are just discarded.
43610 </para>
43611 <section id="SECID139">
43612 <title>Private options for autoreply</title>
43613 <para>
43614 <indexterm role="concept">
43615 <primary>options</primary>
43616 <secondary><command>autoreply</command> transport</secondary>
43617 </indexterm>
43618 </para>
43619 <para>
43620 <indexterm role="option">
43621 <primary><option>bcc</option></primary>
43622 </indexterm>
43623 </para>
43624 <informaltable frame="all">
43625 <tgroup cols="4" colsep="0" rowsep="0">
43626 <colspec colwidth="8*" align="left"/>
43627 <colspec colwidth="6*" align="center"/>
43628 <colspec colwidth="6*" align="center"/>
43629 <colspec colwidth="6*" align="right"/>
43630 <tbody>
43631 <row>
43632 <entry><option>bcc</option></entry>
43633 <entry>Use: <emphasis>autoreply</emphasis></entry>
43634 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43635 <entry>Default: <emphasis>unset</emphasis></entry>
43636 </row>
43637 </tbody>
43638 </tgroup>
43639 </informaltable>
43640 <para>
43641 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
43642 message when the message is specified by the transport.
43643 </para>
43644 <para>
43645 <indexterm role="option">
43646 <primary><option>cc</option></primary>
43647 </indexterm>
43648 </para>
43649 <informaltable frame="all">
43650 <tgroup cols="4" colsep="0" rowsep="0">
43651 <colspec colwidth="8*" align="left"/>
43652 <colspec colwidth="6*" align="center"/>
43653 <colspec colwidth="6*" align="center"/>
43654 <colspec colwidth="6*" align="right"/>
43655 <tbody>
43656 <row>
43657 <entry><option>cc</option></entry>
43658 <entry>Use: <emphasis>autoreply</emphasis></entry>
43659 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43660 <entry>Default: <emphasis>unset</emphasis></entry>
43661 </row>
43662 </tbody>
43663 </tgroup>
43664 </informaltable>
43665 <para>
43666 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
43667 when the message is specified by the transport.
43668 </para>
43669 <para>
43670 <indexterm role="option">
43671 <primary><option>file</option></primary>
43672 </indexterm>
43673 </para>
43674 <informaltable frame="all">
43675 <tgroup cols="4" colsep="0" rowsep="0">
43676 <colspec colwidth="8*" align="left"/>
43677 <colspec colwidth="6*" align="center"/>
43678 <colspec colwidth="6*" align="center"/>
43679 <colspec colwidth="6*" align="right"/>
43680 <tbody>
43681 <row>
43682 <entry><option>file</option></entry>
43683 <entry>Use: <emphasis>autoreply</emphasis></entry>
43684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43685 <entry>Default: <emphasis>unset</emphasis></entry>
43686 </row>
43687 </tbody>
43688 </tgroup>
43689 </informaltable>
43690 <para>
43691 The contents of the file are sent as the body of the message when the message
43692 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
43693 string comes first.
43694 </para>
43695 <para>
43696 <indexterm role="option">
43697 <primary><option>file_expand</option></primary>
43698 </indexterm>
43699 </para>
43700 <informaltable frame="all">
43701 <tgroup cols="4" colsep="0" rowsep="0">
43702 <colspec colwidth="8*" align="left"/>
43703 <colspec colwidth="6*" align="center"/>
43704 <colspec colwidth="6*" align="center"/>
43705 <colspec colwidth="6*" align="right"/>
43706 <tbody>
43707 <row>
43708 <entry><option>file_expand</option></entry>
43709 <entry>Use: <emphasis>autoreply</emphasis></entry>
43710 <entry>Type: <emphasis>boolean</emphasis></entry>
43711 <entry>Default: <emphasis>false</emphasis></entry>
43712 </row>
43713 </tbody>
43714 </tgroup>
43715 </informaltable>
43716 <para>
43717 If this is set, the contents of the file named by the <option>file</option> option are
43718 subjected to string expansion as they are added to the message.
43719 </para>
43720 <para>
43721 <indexterm role="option">
43722 <primary><option>file_optional</option></primary>
43723 </indexterm>
43724 </para>
43725 <informaltable frame="all">
43726 <tgroup cols="4" colsep="0" rowsep="0">
43727 <colspec colwidth="8*" align="left"/>
43728 <colspec colwidth="6*" align="center"/>
43729 <colspec colwidth="6*" align="center"/>
43730 <colspec colwidth="6*" align="right"/>
43731 <tbody>
43732 <row>
43733 <entry><option>file_optional</option></entry>
43734 <entry>Use: <emphasis>autoreply</emphasis></entry>
43735 <entry>Type: <emphasis>boolean</emphasis></entry>
43736 <entry>Default: <emphasis>false</emphasis></entry>
43737 </row>
43738 </tbody>
43739 </tgroup>
43740 </informaltable>
43741 <para>
43742 If this option is true, no error is generated if the file named by the <option>file</option>
43743 option or passed with the address does not exist or cannot be read.
43744 </para>
43745 <para>
43746 <indexterm role="option">
43747 <primary><option>from</option></primary>
43748 </indexterm>
43749 </para>
43750 <informaltable frame="all">
43751 <tgroup cols="4" colsep="0" rowsep="0">
43752 <colspec colwidth="8*" align="left"/>
43753 <colspec colwidth="6*" align="center"/>
43754 <colspec colwidth="6*" align="center"/>
43755 <colspec colwidth="6*" align="right"/>
43756 <tbody>
43757 <row>
43758 <entry><option>from</option></entry>
43759 <entry>Use: <emphasis>autoreply</emphasis></entry>
43760 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43761 <entry>Default: <emphasis>unset</emphasis></entry>
43762 </row>
43763 </tbody>
43764 </tgroup>
43765 </informaltable>
43766 <para>
43767 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
43768 specified by the transport.
43769 </para>
43770 <para>
43771 <indexterm role="option">
43772 <primary><option>headers</option></primary>
43773 </indexterm>
43774 </para>
43775 <informaltable frame="all">
43776 <tgroup cols="4" colsep="0" rowsep="0">
43777 <colspec colwidth="8*" align="left"/>
43778 <colspec colwidth="6*" align="center"/>
43779 <colspec colwidth="6*" align="center"/>
43780 <colspec colwidth="6*" align="right"/>
43781 <tbody>
43782 <row>
43783 <entry><option>headers</option></entry>
43784 <entry>Use: <emphasis>autoreply</emphasis></entry>
43785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43786 <entry>Default: <emphasis>unset</emphasis></entry>
43787 </row>
43788 </tbody>
43789 </tgroup>
43790 </informaltable>
43791 <para>
43792 This specifies additional RFC 2822 headers that are to be added to the message
43793 when the message is specified by the transport. Several can be given by using
43794 <quote>\n</quote> to separate them. There is no check on the format.
43795 </para>
43796 <para>
43797 <indexterm role="option">
43798 <primary><option>log</option></primary>
43799 </indexterm>
43800 </para>
43801 <informaltable frame="all">
43802 <tgroup cols="4" colsep="0" rowsep="0">
43803 <colspec colwidth="8*" align="left"/>
43804 <colspec colwidth="6*" align="center"/>
43805 <colspec colwidth="6*" align="center"/>
43806 <colspec colwidth="6*" align="right"/>
43807 <tbody>
43808 <row>
43809 <entry><option>log</option></entry>
43810 <entry>Use: <emphasis>autoreply</emphasis></entry>
43811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43812 <entry>Default: <emphasis>unset</emphasis></entry>
43813 </row>
43814 </tbody>
43815 </tgroup>
43816 </informaltable>
43817 <para>
43818 This option names a file in which a record of every message sent is logged when
43819 the message is specified by the transport.
43820 </para>
43821 <para>
43822 <indexterm role="option">
43823 <primary><option>mode</option></primary>
43824 </indexterm>
43825 </para>
43826 <informaltable frame="all">
43827 <tgroup cols="4" colsep="0" rowsep="0">
43828 <colspec colwidth="8*" align="left"/>
43829 <colspec colwidth="6*" align="center"/>
43830 <colspec colwidth="6*" align="center"/>
43831 <colspec colwidth="6*" align="right"/>
43832 <tbody>
43833 <row>
43834 <entry><option>mode</option></entry>
43835 <entry>Use: <emphasis>autoreply</emphasis></entry>
43836 <entry>Type: <emphasis>octal integer</emphasis></entry>
43837 <entry>Default: <emphasis>0600</emphasis></entry>
43838 </row>
43839 </tbody>
43840 </tgroup>
43841 </informaltable>
43842 <para>
43843 If either the log file or the <quote>once</quote> file has to be created, this mode is
43844 used.
43845 </para>
43846 <para>
43847 <indexterm role="option">
43848 <primary><option>never_mail</option></primary>
43849 </indexterm>
43850 </para>
43851 <informaltable frame="all">
43852 <tgroup cols="4" colsep="0" rowsep="0">
43853 <colspec colwidth="8*" align="left"/>
43854 <colspec colwidth="6*" align="center"/>
43855 <colspec colwidth="6*" align="center"/>
43856 <colspec colwidth="6*" align="right"/>
43857 <tbody>
43858 <row>
43859 <entry><option>never_mail</option></entry>
43860 <entry>Use: <emphasis>autoreply</emphasis></entry>
43861 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
43862 <entry>Default: <emphasis>unset</emphasis></entry>
43863 </row>
43864 </tbody>
43865 </tgroup>
43866 </informaltable>
43867 <para>
43868 If any run of the transport creates a message with a recipient that matches any
43869 item in the list, that recipient is quietly discarded. If all recipients are
43870 discarded, no message is created. This applies both when the recipients are
43871 generated by a filter and when they are specified in the transport.
43872 </para>
43873 <para>
43874 <indexterm role="option">
43875 <primary><option>once</option></primary>
43876 </indexterm>
43877 </para>
43878 <informaltable frame="all">
43879 <tgroup cols="4" colsep="0" rowsep="0">
43880 <colspec colwidth="8*" align="left"/>
43881 <colspec colwidth="6*" align="center"/>
43882 <colspec colwidth="6*" align="center"/>
43883 <colspec colwidth="6*" align="right"/>
43884 <tbody>
43885 <row>
43886 <entry><option>once</option></entry>
43887 <entry>Use: <emphasis>autoreply</emphasis></entry>
43888 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43889 <entry>Default: <emphasis>unset</emphasis></entry>
43890 </row>
43891 </tbody>
43892 </tgroup>
43893 </informaltable>
43894 <para>
43895 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
43896 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
43897 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
43898 </para>
43899 <para>
43900 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
43901 By default, if <option>once</option> is set to a non-empty file name, the message
43902 is not sent if a potential recipient is already listed in the database.
43903 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
43904 message is sent if that much time has elapsed since a message was last sent to
43905 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
43906 prevents a message from being sent a second time &ndash; in this case, zero means
43907 infinity.
43908 </para>
43909 <para>
43910 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
43911 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
43912 greater than zero, it changes the way Exim implements the <option>once</option> option.
43913 Instead of using a DBM file to record every recipient it sends to, it uses a
43914 regular file, whose size will never get larger than the given value.
43915 </para>
43916 <para>
43917 In the file, Exim keeps a linear list of recipient addresses and the times at
43918 which they were sent messages. If the file is full when a new address needs to
43919 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
43920 means that a given recipient may receive multiple messages, but at
43921 unpredictable intervals that depend on the rate of turnover of addresses in the
43922 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
43923 </para>
43924 <para>
43925 <indexterm role="option">
43926 <primary><option>once_file_size</option></primary>
43927 </indexterm>
43928 </para>
43929 <informaltable frame="all">
43930 <tgroup cols="4" colsep="0" rowsep="0">
43931 <colspec colwidth="8*" align="left"/>
43932 <colspec colwidth="6*" align="center"/>
43933 <colspec colwidth="6*" align="center"/>
43934 <colspec colwidth="6*" align="right"/>
43935 <tbody>
43936 <row>
43937 <entry><option>once_file_size</option></entry>
43938 <entry>Use: <emphasis>autoreply</emphasis></entry>
43939 <entry>Type: <emphasis>integer</emphasis></entry>
43940 <entry>Default: <emphasis>0</emphasis></entry>
43941 </row>
43942 </tbody>
43943 </tgroup>
43944 </informaltable>
43945 <para>
43946 See <option>once</option> above.
43947 </para>
43948 <para>
43949 <indexterm role="option">
43950 <primary><option>once_repeat</option></primary>
43951 </indexterm>
43952 </para>
43953 <informaltable frame="all">
43954 <tgroup cols="4" colsep="0" rowsep="0">
43955 <colspec colwidth="8*" align="left"/>
43956 <colspec colwidth="6*" align="center"/>
43957 <colspec colwidth="6*" align="center"/>
43958 <colspec colwidth="6*" align="right"/>
43959 <tbody>
43960 <row>
43961 <entry><option>once_repeat</option></entry>
43962 <entry>Use: <emphasis>autoreply</emphasis></entry>
43963 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
43964 <entry>Default: <emphasis>0s</emphasis></entry>
43965 </row>
43966 </tbody>
43967 </tgroup>
43968 </informaltable>
43969 <para>
43970 See <option>once</option> above.
43971 After expansion, the value of this option must be a valid time value.
43972 </para>
43973 <para>
43974 <indexterm role="option">
43975 <primary><option>reply_to</option></primary>
43976 </indexterm>
43977 </para>
43978 <informaltable frame="all">
43979 <tgroup cols="4" colsep="0" rowsep="0">
43980 <colspec colwidth="8*" align="left"/>
43981 <colspec colwidth="6*" align="center"/>
43982 <colspec colwidth="6*" align="center"/>
43983 <colspec colwidth="6*" align="right"/>
43984 <tbody>
43985 <row>
43986 <entry><option>reply_to</option></entry>
43987 <entry>Use: <emphasis>autoreply</emphasis></entry>
43988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43989 <entry>Default: <emphasis>unset</emphasis></entry>
43990 </row>
43991 </tbody>
43992 </tgroup>
43993 </informaltable>
43994 <para>
43995 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
43996 specified by the transport.
43997 </para>
43998 <para>
43999 <indexterm role="option">
44000 <primary><option>return_message</option></primary>
44001 </indexterm>
44002 </para>
44003 <informaltable frame="all">
44004 <tgroup cols="4" colsep="0" rowsep="0">
44005 <colspec colwidth="8*" align="left"/>
44006 <colspec colwidth="6*" align="center"/>
44007 <colspec colwidth="6*" align="center"/>
44008 <colspec colwidth="6*" align="right"/>
44009 <tbody>
44010 <row>
44011 <entry><option>return_message</option></entry>
44012 <entry>Use: <emphasis>autoreply</emphasis></entry>
44013 <entry>Type: <emphasis>boolean</emphasis></entry>
44014 <entry>Default: <emphasis>false</emphasis></entry>
44015 </row>
44016 </tbody>
44017 </tgroup>
44018 </informaltable>
44019 <para>
44020 If this is set, a copy of the original message is returned with the new
44021 message, subject to the maximum size set in the <option>return_size_limit</option> global
44022 configuration option.
44023 </para>
44024 <para>
44025 <indexterm role="option">
44026 <primary><option>subject</option></primary>
44027 </indexterm>
44028 </para>
44029 <informaltable frame="all">
44030 <tgroup cols="4" colsep="0" rowsep="0">
44031 <colspec colwidth="8*" align="left"/>
44032 <colspec colwidth="6*" align="center"/>
44033 <colspec colwidth="6*" align="center"/>
44034 <colspec colwidth="6*" align="right"/>
44035 <tbody>
44036 <row>
44037 <entry><option>subject</option></entry>
44038 <entry>Use: <emphasis>autoreply</emphasis></entry>
44039 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44040 <entry>Default: <emphasis>unset</emphasis></entry>
44041 </row>
44042 </tbody>
44043 </tgroup>
44044 </informaltable>
44045 <para>
44046 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
44047 specified by the transport. It is tempting to quote the original subject in
44048 automatic responses. For example:
44049 </para>
44050 <literallayout class="monospaced">
44051 subject = Re: $h_subject:
44052 </literallayout>
44053 <para>
44054 There is a danger in doing this, however. It may allow a third party to
44055 subscribe your users to an opt-in mailing list, provided that the list accepts
44056 bounce messages as subscription confirmations. Well-managed lists require a
44057 non-bounce message to confirm a subscription, so the danger is relatively
44058 small.
44059 </para>
44060 <para>
44061 <indexterm role="option">
44062 <primary><option>text</option></primary>
44063 </indexterm>
44064 </para>
44065 <informaltable frame="all">
44066 <tgroup cols="4" colsep="0" rowsep="0">
44067 <colspec colwidth="8*" align="left"/>
44068 <colspec colwidth="6*" align="center"/>
44069 <colspec colwidth="6*" align="center"/>
44070 <colspec colwidth="6*" align="right"/>
44071 <tbody>
44072 <row>
44073 <entry><option>text</option></entry>
44074 <entry>Use: <emphasis>autoreply</emphasis></entry>
44075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44076 <entry>Default: <emphasis>unset</emphasis></entry>
44077 </row>
44078 </tbody>
44079 </tgroup>
44080 </informaltable>
44081 <para>
44082 This specifies a single string to be used as the body of the message when the
44083 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
44084 the text comes first.
44085 </para>
44086 <para>
44087 <indexterm role="option">
44088 <primary><option>to</option></primary>
44089 </indexterm>
44090 </para>
44091 <informaltable frame="all">
44092 <tgroup cols="4" colsep="0" rowsep="0">
44093 <colspec colwidth="8*" align="left"/>
44094 <colspec colwidth="6*" align="center"/>
44095 <colspec colwidth="6*" align="center"/>
44096 <colspec colwidth="6*" align="right"/>
44097 <tbody>
44098 <row>
44099 <entry><option>to</option></entry>
44100 <entry>Use: <emphasis>autoreply</emphasis></entry>
44101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44102 <entry>Default: <emphasis>unset</emphasis></entry>
44103 </row>
44104 </tbody>
44105 </tgroup>
44106 </informaltable>
44107 <para>
44108 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
44109 when the message is specified by the transport.
44110 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
44111 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
44112 </para>
44113 </section>
44114 </chapter>
44115
44116 <chapter id="CHAPLMTP">
44117 <title>The lmtp transport</title>
44118 <para>
44119 <indexterm role="concept">
44120 <primary>transports</primary>
44121 <secondary><command>lmtp</command></secondary>
44122 </indexterm>
44123 <indexterm role="concept">
44124 <primary><command>lmtp</command> transport</primary>
44125 </indexterm>
44126 <indexterm role="concept">
44127 <primary>LMTP</primary>
44128 <secondary>over a pipe</secondary>
44129 </indexterm>
44130 <indexterm role="concept">
44131 <primary>LMTP</primary>
44132 <secondary>over a socket</secondary>
44133 </indexterm>
44134 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
44135 specified command
44136 or by interacting with a Unix domain socket.
44137 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
44138 transports. Exim also has support for using LMTP over TCP/IP; this is
44139 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
44140 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
44141 has it commented out. You need to ensure that
44142 </para>
44143 <literallayout class="monospaced">
44144 TRANSPORT_LMTP=yes
44145 </literallayout>
44146 <para>
44147 <indexterm role="concept">
44148 <primary>options</primary>
44149 <secondary><command>lmtp</command> transport</secondary>
44150 </indexterm>
44151 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
44152 included in the Exim binary. The private options of the <command>lmtp</command> transport are
44153 as follows:
44154 </para>
44155 <para>
44156 <indexterm role="option">
44157 <primary><option>batch_id</option></primary>
44158 </indexterm>
44159 </para>
44160 <informaltable frame="all">
44161 <tgroup cols="4" colsep="0" rowsep="0">
44162 <colspec colwidth="8*" align="left"/>
44163 <colspec colwidth="6*" align="center"/>
44164 <colspec colwidth="6*" align="center"/>
44165 <colspec colwidth="6*" align="right"/>
44166 <tbody>
44167 <row>
44168 <entry><option>batch_id</option></entry>
44169 <entry>Use: <emphasis>lmtp</emphasis></entry>
44170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44171 <entry>Default: <emphasis>unset</emphasis></entry>
44172 </row>
44173 </tbody>
44174 </tgroup>
44175 </informaltable>
44176 <para>
44177 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44178 </para>
44179 <para>
44180 <indexterm role="option">
44181 <primary><option>batch_max</option></primary>
44182 </indexterm>
44183 </para>
44184 <informaltable frame="all">
44185 <tgroup cols="4" colsep="0" rowsep="0">
44186 <colspec colwidth="8*" align="left"/>
44187 <colspec colwidth="6*" align="center"/>
44188 <colspec colwidth="6*" align="center"/>
44189 <colspec colwidth="6*" align="right"/>
44190 <tbody>
44191 <row>
44192 <entry><option>batch_max</option></entry>
44193 <entry>Use: <emphasis>lmtp</emphasis></entry>
44194 <entry>Type: <emphasis>integer</emphasis></entry>
44195 <entry>Default: <emphasis>1</emphasis></entry>
44196 </row>
44197 </tbody>
44198 </tgroup>
44199 </informaltable>
44200 <para>
44201 This limits the number of addresses that can be handled in a single delivery.
44202 Most LMTP servers can handle several addresses at once, so it is normally a
44203 good idea to increase this value. See the description of local delivery
44204 batching in chapter <xref linkend="CHAPbatching"/>.
44205 </para>
44206 <para>
44207 <indexterm role="option">
44208 <primary><option>command</option></primary>
44209 </indexterm>
44210 </para>
44211 <informaltable frame="all">
44212 <tgroup cols="4" colsep="0" rowsep="0">
44213 <colspec colwidth="8*" align="left"/>
44214 <colspec colwidth="6*" align="center"/>
44215 <colspec colwidth="6*" align="center"/>
44216 <colspec colwidth="6*" align="right"/>
44217 <tbody>
44218 <row>
44219 <entry><option>command</option></entry>
44220 <entry>Use: <emphasis>lmtp</emphasis></entry>
44221 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44222 <entry>Default: <emphasis>unset</emphasis></entry>
44223 </row>
44224 </tbody>
44225 </tgroup>
44226 </informaltable>
44227 <para>
44228 This option must be set if <option>socket</option> is not set. The string is a command which
44229 is run in a separate process. It is split up into a command name and list of
44230 arguments, each of which is separately expanded (so expansion cannot change the
44231 number of arguments). The command is run directly, not via a shell. The message
44232 is passed to the new process using the standard input and output to operate the
44233 LMTP protocol.
44234 </para>
44235 <para>
44236 <indexterm role="option">
44237 <primary><option>ignore_quota</option></primary>
44238 </indexterm>
44239 </para>
44240 <informaltable frame="all">
44241 <tgroup cols="4" colsep="0" rowsep="0">
44242 <colspec colwidth="8*" align="left"/>
44243 <colspec colwidth="6*" align="center"/>
44244 <colspec colwidth="6*" align="center"/>
44245 <colspec colwidth="6*" align="right"/>
44246 <tbody>
44247 <row>
44248 <entry><option>ignore_quota</option></entry>
44249 <entry>Use: <emphasis>lmtp</emphasis></entry>
44250 <entry>Type: <emphasis>boolean</emphasis></entry>
44251 <entry>Default: <emphasis>false</emphasis></entry>
44252 </row>
44253 </tbody>
44254 </tgroup>
44255 </informaltable>
44256 <para>
44257 <indexterm role="concept">
44258 <primary>LMTP</primary>
44259 <secondary>ignoring quota errors</secondary>
44260 </indexterm>
44261 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
44262 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
44263 in its response to the LHLO command.
44264 </para>
44265 <para>
44266 <indexterm role="option">
44267 <primary><option>socket</option></primary>
44268 </indexterm>
44269 </para>
44270 <informaltable frame="all">
44271 <tgroup cols="4" colsep="0" rowsep="0">
44272 <colspec colwidth="8*" align="left"/>
44273 <colspec colwidth="6*" align="center"/>
44274 <colspec colwidth="6*" align="center"/>
44275 <colspec colwidth="6*" align="right"/>
44276 <tbody>
44277 <row>
44278 <entry><option>socket</option></entry>
44279 <entry>Use: <emphasis>lmtp</emphasis></entry>
44280 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44281 <entry>Default: <emphasis>unset</emphasis></entry>
44282 </row>
44283 </tbody>
44284 </tgroup>
44285 </informaltable>
44286 <para>
44287 This option must be set if <option>command</option> is not set. The result of expansion must
44288 be the name of a Unix domain socket. The transport connects to the socket and
44289 delivers the message to it using the LMTP protocol.
44290 </para>
44291 <para>
44292 <indexterm role="option">
44293 <primary><option>timeout</option></primary>
44294 </indexterm>
44295 </para>
44296 <informaltable frame="all">
44297 <tgroup cols="4" colsep="0" rowsep="0">
44298 <colspec colwidth="8*" align="left"/>
44299 <colspec colwidth="6*" align="center"/>
44300 <colspec colwidth="6*" align="center"/>
44301 <colspec colwidth="6*" align="right"/>
44302 <tbody>
44303 <row>
44304 <entry><option>timeout</option></entry>
44305 <entry>Use: <emphasis>lmtp</emphasis></entry>
44306 <entry>Type: <emphasis>time</emphasis></entry>
44307 <entry>Default: <emphasis>5m</emphasis></entry>
44308 </row>
44309 </tbody>
44310 </tgroup>
44311 </informaltable>
44312 <para>
44313 The transport is aborted if the created process or Unix domain socket does not
44314 respond to LMTP commands or message input within this timeout. Delivery
44315 is deferred, and will be tried again later. Here is an example of a typical
44316 LMTP transport:
44317 </para>
44318 <literallayout class="monospaced">
44319 lmtp:
44320   driver = lmtp
44321   command = /some/local/lmtp/delivery/program
44322   batch_max = 20
44323   user = exim
44324 </literallayout>
44325 <para>
44326 This delivers up to 20 addresses at a time, in a mixture of domains if
44327 necessary, running as the user <emphasis>exim</emphasis>.
44328 </para>
44329 </chapter>
44330
44331 <chapter id="CHAPpipetransport">
44332 <title>The pipe transport</title>
44333 <para>
44334 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
44335 <primary>transports</primary>
44336 <secondary><command>pipe</command></secondary>
44337 </indexterm>
44338 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
44339 <primary><command>pipe</command> transport</primary>
44340 </indexterm>
44341 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
44342 running in another process. One example is the use of <command>pipe</command> as a
44343 pseudo-remote transport for passing messages to some other delivery mechanism
44344 (such as UUCP). Another is the use by individual users to automatically process
44345 their incoming messages. The <command>pipe</command> transport can be used in one of the
44346 following ways:
44347 </para>
44348 <itemizedlist>
44349 <listitem>
44350 <para>
44351 <indexterm role="variable">
44352 <primary><varname>$local_part</varname></primary>
44353 </indexterm>
44354 A router routes one address to a transport in the normal way, and the
44355 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
44356 contains the local part of the address (as usual), and the command that is run
44357 is specified by the <option>command</option> option on the transport.
44358 </para>
44359 </listitem>
44360 <listitem>
44361 <para>
44362 <indexterm role="variable">
44363 <primary><varname>$pipe_addresses</varname></primary>
44364 </indexterm>
44365 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
44366 transport can handle more than one address in a single run. In this case, when
44367 more than one address is routed to the transport, <varname>$local_part</varname> is not set
44368 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
44369 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
44370 that are routed to the transport.
44371 </para>
44372 </listitem>
44373 <listitem>
44374 <para>
44375 <indexterm role="variable">
44376 <primary><varname>$address_pipe</varname></primary>
44377 </indexterm>
44378 A router redirects an address directly to a pipe command (for example, from an
44379 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
44380 pipe command, and the <option>command</option> option on the transport is ignored unless
44381 <option>force_command</option> is set. If only one address is being transported
44382 (<option>batch_max</option> is not greater than one, or only one address was redirected to
44383 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
44384 </para>
44385 </listitem>
44386 </itemizedlist>
44387 <para>
44388 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
44389 deliver messages over pipes using the LMTP interactive protocol. This is
44390 implemented by the <command>lmtp</command> transport.
44391 </para>
44392 <para>
44393 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
44394 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
44395 other cases, the uid and gid have to be specified explicitly, either on the
44396 transport or on the router that handles the address. Current and <quote>home</quote>
44397 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
44398 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
44399 for a discussion of local delivery batching.
44400 </para>
44401 <section id="SECID140">
44402 <title>Concurrent delivery</title>
44403 <para>
44404 If two messages arrive at almost the same time, and both are routed to a pipe
44405 delivery, the two pipe transports may be run concurrently. You must ensure that
44406 any pipe commands you set up are robust against this happening. If the commands
44407 write to a file, the <option>exim_lock</option> utility might be of use.
44408 Alternatively the <option>max_parallel</option> option could be used with a value
44409 of "1" to enforce serialization.
44410 </para>
44411 </section>
44412 <section id="SECID141">
44413 <title>Returned status and data</title>
44414 <para>
44415 <indexterm role="concept">
44416 <primary><command>pipe</command> transport</primary>
44417 <secondary>returned data</secondary>
44418 </indexterm>
44419 If the command exits with a non-zero return code, the delivery is deemed to
44420 have failed, unless either the <option>ignore_status</option> option is set (in which case
44421 the return code is treated as zero), or the return code is one of those listed
44422 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
44423 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
44424 logged, but are not included in the bounce message, which merely contains
44425 <quote>local delivery failed</quote>.
44426 </para>
44427 <para>
44428 If the command exits on a signal and the <option>freeze_signal</option> option is set then
44429 the message will be frozen in the queue. If that option is not set, a bounce
44430 will be sent as normal.
44431 </para>
44432 <para>
44433 If the return code is greater than 128 and the command being run is a shell
44434 script, it normally means that the script was terminated by a signal whose
44435 value is the return code minus 128. The <option>freeze_signal</option> option does not
44436 apply in this case.
44437 </para>
44438 <para>
44439 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
44440 return code is set to 127. This is the value that a shell returns if it is
44441 asked to run a non-existent command. The wording for the log line suggests that
44442 a non-existent command may be the problem.
44443 </para>
44444 <para>
44445 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
44446 set and the command produces any output on its standard output or standard
44447 error streams, the command is considered to have failed, even if it gave a zero
44448 return code or if <option>ignore_status</option> is set. The output from the command is
44449 included as part of the bounce message. The <option>return_fail_output</option> option is
44450 similar, except that output is returned only when the command exits with a
44451 failure return code, that is, a value other than zero or a code that matches
44452 <option>temp_errors</option>.
44453 </para>
44454 </section>
44455 <section id="SECThowcommandrun">
44456 <title>How the command is run</title>
44457 <para>
44458 <indexterm role="concept">
44459 <primary><command>pipe</command> transport</primary>
44460 <secondary>path for command</secondary>
44461 </indexterm>
44462 The command line is (by default) broken down into a command name and arguments
44463 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
44464 <option>restrict_to_path</option> options can be used to restrict the commands that may be
44465 run.
44466 </para>
44467 <para>
44468 <indexterm role="concept">
44469 <primary>quoting</primary>
44470 <secondary>in pipe command</secondary>
44471 </indexterm>
44472 Unquoted arguments are delimited by white space. If an argument appears in
44473 double quotes, backslash is interpreted as an escape character in the usual
44474 way. If an argument appears in single quotes, no escaping is done.
44475 </para>
44476 <para>
44477 String expansion is applied to the command line except when it comes from a
44478 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
44479 expansion is applied to each argument in turn rather than to the whole line.
44480 For this reason, any string expansion item that contains white space must be
44481 quoted so as to be contained within a single argument. A setting such as
44482 </para>
44483 <literallayout class="monospaced">
44484 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
44485 </literallayout>
44486 <para>
44487 will not work, because the expansion item gets split between several
44488 arguments. You have to write
44489 </para>
44490 <literallayout class="monospaced">
44491 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
44492 </literallayout>
44493 <para>
44494 to ensure that it is all in one argument. The expansion is done in this way,
44495 argument by argument, so that the number of arguments cannot be changed as a
44496 result of expansion, and quotes or backslashes in inserted variables do not
44497 interact with external quoting. However, this leads to problems if you want to
44498 generate multiple arguments (or the command name plus arguments) from a single
44499 expansion. In this situation, the simplest solution is to use a shell. For
44500 example:
44501 </para>
44502 <literallayout class="monospaced">
44503 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
44504 </literallayout>
44505 <para>
44506 <indexterm role="concept">
44507 <primary>transport</primary>
44508 <secondary>filter</secondary>
44509 </indexterm>
44510 <indexterm role="concept">
44511 <primary>filter</primary>
44512 <secondary>transport filter</secondary>
44513 </indexterm>
44514 <indexterm role="variable">
44515 <primary><varname>$pipe_addresses</varname></primary>
44516 </indexterm>
44517 Special handling takes place when an argument consists of precisely the text
44518 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
44519 place this string is recognized is when it appears as an argument for a pipe or
44520 transport filter command. It causes each address that is being handled to be
44521 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
44522 avoids any problems with spaces or shell metacharacters, and is of use when a
44523 <command>pipe</command> transport is handling groups of addresses in a batch.
44524 </para>
44525 <para>
44526 If <option>force_command</option> is enabled on the transport, Special handling takes place
44527 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
44528 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
44529 argument is inserted in the argument list at that point
44530 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
44531 the only item in the argument; in fact, if it were then <option>force_command</option>
44532 should behave as a no-op.  Rather, it should be used to adjust the command
44533 run while preserving the argument vector separation.
44534 </para>
44535 <para>
44536 After splitting up into arguments and expansion, the resulting command is run
44537 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
44538 message that is being delivered is supplied on the standard input, and the
44539 standard output and standard error are both connected to a single pipe that is
44540 read by Exim. The <option>max_output</option> option controls how much output the command
44541 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
44542 control what is done with it.
44543 </para>
44544 <para>
44545 Not running the command under a shell (by default) lessens the security risks
44546 in cases when a command from a user&#x2019;s filter file is built out of data that was
44547 taken from an incoming message. If a shell is required, it can of course be
44548 explicitly specified as the command to be run. However, there are circumstances
44549 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
44550 under a shell and cannot easily be modified. To allow for these cases, there is
44551 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
44552 works. Instead of breaking up the command line as just described, it expands it
44553 as a single string and passes the result to <filename>/bin/sh</filename>. The
44554 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
44555 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
44556 </para>
44557 </section>
44558 <section id="SECTpipeenv">
44559 <title>Environment variables</title>
44560 <para>
44561 <indexterm role="concept">
44562 <primary><command>pipe</command> transport</primary>
44563 <secondary>environment for command</secondary>
44564 </indexterm>
44565 <indexterm role="concept">
44566 <primary>environment</primary>
44567 <secondary><command>pipe</command> transport</secondary>
44568 </indexterm>
44569 The environment variables listed below are set up when the command is invoked.
44570 This list is a compromise for maximum compatibility with other MTAs. Note that
44571 the <option>environment</option> option can be used to add additional variables to this
44572 environment. The environment for the <command>pipe</command> transport is not subject
44573 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
44574 </para>
44575 <literallayout>
44576 <literal>DOMAIN            </literal>   the domain of the address
44577 <literal>HOME              </literal>   the home directory, if set
44578 <literal>HOST              </literal>   the host name when called from a router (see below)
44579 <literal>LOCAL_PART        </literal>   see below
44580 <literal>LOCAL_PART_PREFIX </literal>   see below
44581 <literal>LOCAL_PART_SUFFIX </literal>   see below
44582 <literal>LOGNAME           </literal>   see below
44583 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
44584 <literal>PATH              </literal>   as specified by the <option>path</option> option below
44585 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
44586 <literal>RECIPIENT         </literal>   the complete recipient address
44587 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
44588 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
44589 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
44590 <literal>USER              </literal>   see below
44591 </literallayout>
44592 <para>
44593 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
44594 router, LOCAL_PART is set to the local part of the address. When it is
44595 called as a result of a forward or alias expansion, LOCAL_PART is set to
44596 the local part of the address that was expanded. In both cases, any affixes are
44597 removed from the local part, and made available in LOCAL_PART_PREFIX and
44598 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
44599 same value as LOCAL_PART for compatibility with other MTAs.
44600 </para>
44601 <para>
44602 <indexterm role="concept">
44603 <primary>HOST</primary>
44604 </indexterm>
44605 HOST is set only when a <command>pipe</command> transport is called from a router that
44606 associates hosts with an address, typically when using <command>pipe</command> as a
44607 pseudo-remote transport. HOST is set to the first host name specified by
44608 the router.
44609 </para>
44610 <para>
44611 <indexterm role="concept">
44612 <primary>HOME</primary>
44613 </indexterm>
44614 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
44615 for the HOME environment variable. Otherwise, a home directory may be set
44616 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
44617 user&#x2019;s home directory if <option>check_local_user</option> is set.
44618 </para>
44619 </section>
44620 <section id="SECID142">
44621 <title>Private options for pipe</title>
44622 <para>
44623 <indexterm role="concept">
44624 <primary>options</primary>
44625 <secondary><command>pipe</command> transport</secondary>
44626 </indexterm>
44627 </para>
44628 <para>
44629 <indexterm role="option">
44630 <primary><option>allow_commands</option></primary>
44631 </indexterm>
44632 </para>
44633 <informaltable frame="all">
44634 <tgroup cols="4" colsep="0" rowsep="0">
44635 <colspec colwidth="8*" align="left"/>
44636 <colspec colwidth="6*" align="center"/>
44637 <colspec colwidth="6*" align="center"/>
44638 <colspec colwidth="6*" align="right"/>
44639 <tbody>
44640 <row>
44641 <entry><option>allow_commands</option></entry>
44642 <entry>Use: <emphasis>pipe</emphasis></entry>
44643 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44644 <entry>Default: <emphasis>unset</emphasis></entry>
44645 </row>
44646 </tbody>
44647 </tgroup>
44648 </informaltable>
44649 <para>
44650 <indexterm role="concept">
44651 <primary><command>pipe</command> transport</primary>
44652 <secondary>permitted commands</secondary>
44653 </indexterm>
44654 The string is expanded, and is then interpreted as a colon-separated list of
44655 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
44656 permitted are those in the <option>allow_commands</option> list. They need not be absolute
44657 paths; the <option>path</option> option is still used for relative paths. If
44658 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
44659 in the <option>allow_commands</option> list, or a name without any slashes that is found on
44660 the path. In other words, if neither <option>allow_commands</option> nor
44661 <option>restrict_to_path</option> is set, there is no restriction on the command, but
44662 otherwise only commands that are permitted by one or the other are allowed. For
44663 example, if
44664 </para>
44665 <literallayout class="monospaced">
44666 allow_commands = /usr/bin/vacation
44667 </literallayout>
44668 <para>
44669 and <option>restrict_to_path</option> is not set, the only permitted command is
44670 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
44671 <option>use_shell</option> is set.
44672 </para>
44673 <para>
44674 <indexterm role="option">
44675 <primary><option>batch_id</option></primary>
44676 </indexterm>
44677 </para>
44678 <informaltable frame="all">
44679 <tgroup cols="4" colsep="0" rowsep="0">
44680 <colspec colwidth="8*" align="left"/>
44681 <colspec colwidth="6*" align="center"/>
44682 <colspec colwidth="6*" align="center"/>
44683 <colspec colwidth="6*" align="right"/>
44684 <tbody>
44685 <row>
44686 <entry><option>batch_id</option></entry>
44687 <entry>Use: <emphasis>pipe</emphasis></entry>
44688 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44689 <entry>Default: <emphasis>unset</emphasis></entry>
44690 </row>
44691 </tbody>
44692 </tgroup>
44693 </informaltable>
44694 <para>
44695 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44696 </para>
44697 <para>
44698 <indexterm role="option">
44699 <primary><option>batch_max</option></primary>
44700 </indexterm>
44701 </para>
44702 <informaltable frame="all">
44703 <tgroup cols="4" colsep="0" rowsep="0">
44704 <colspec colwidth="8*" align="left"/>
44705 <colspec colwidth="6*" align="center"/>
44706 <colspec colwidth="6*" align="center"/>
44707 <colspec colwidth="6*" align="right"/>
44708 <tbody>
44709 <row>
44710 <entry><option>batch_max</option></entry>
44711 <entry>Use: <emphasis>pipe</emphasis></entry>
44712 <entry>Type: <emphasis>integer</emphasis></entry>
44713 <entry>Default: <emphasis>1</emphasis></entry>
44714 </row>
44715 </tbody>
44716 </tgroup>
44717 </informaltable>
44718 <para>
44719 This limits the number of addresses that can be handled in a single delivery.
44720 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44721 </para>
44722 <para>
44723 <indexterm role="option">
44724 <primary><option>check_string</option></primary>
44725 </indexterm>
44726 </para>
44727 <informaltable frame="all">
44728 <tgroup cols="4" colsep="0" rowsep="0">
44729 <colspec colwidth="8*" align="left"/>
44730 <colspec colwidth="6*" align="center"/>
44731 <colspec colwidth="6*" align="center"/>
44732 <colspec colwidth="6*" align="right"/>
44733 <tbody>
44734 <row>
44735 <entry><option>check_string</option></entry>
44736 <entry>Use: <emphasis>pipe</emphasis></entry>
44737 <entry>Type: <emphasis>string</emphasis></entry>
44738 <entry>Default: <emphasis>unset</emphasis></entry>
44739 </row>
44740 </tbody>
44741 </tgroup>
44742 </informaltable>
44743 <para>
44744 As <command>pipe</command> writes the message, the start of each line is tested for matching
44745 <option>check_string</option>, and if it does, the initial matching characters are replaced
44746 by the contents of <option>escape_string</option>, provided both are set. The value of
44747 <option>check_string</option> is a literal string, not a regular expression, and the case of
44748 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
44749 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
44750 the SMTP escaping protocol. Any settings made in the configuration file are
44751 ignored.
44752 </para>
44753 <para>
44754 <indexterm role="option">
44755 <primary><option>command</option></primary>
44756 </indexterm>
44757 </para>
44758 <informaltable frame="all">
44759 <tgroup cols="4" colsep="0" rowsep="0">
44760 <colspec colwidth="8*" align="left"/>
44761 <colspec colwidth="6*" align="center"/>
44762 <colspec colwidth="6*" align="center"/>
44763 <colspec colwidth="6*" align="right"/>
44764 <tbody>
44765 <row>
44766 <entry><option>command</option></entry>
44767 <entry>Use: <emphasis>pipe</emphasis></entry>
44768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44769 <entry>Default: <emphasis>unset</emphasis></entry>
44770 </row>
44771 </tbody>
44772 </tgroup>
44773 </informaltable>
44774 <para>
44775 This option need not be set when <command>pipe</command> is being used to deliver to pipes
44776 obtained directly from address redirections. In other cases, the option must be
44777 set, to provide a command to be run. It need not yield an absolute path (see
44778 the <option>path</option> option below). The command is split up into separate arguments by
44779 Exim, and each argument is separately expanded, as described in section
44780 <xref linkend="SECThowcommandrun"/> above.
44781 </para>
44782 <para>
44783 <indexterm role="option">
44784 <primary><option>environment</option></primary>
44785 </indexterm>
44786 </para>
44787 <informaltable frame="all">
44788 <tgroup cols="4" colsep="0" rowsep="0">
44789 <colspec colwidth="8*" align="left"/>
44790 <colspec colwidth="6*" align="center"/>
44791 <colspec colwidth="6*" align="center"/>
44792 <colspec colwidth="6*" align="right"/>
44793 <tbody>
44794 <row>
44795 <entry><option>environment</option></entry>
44796 <entry>Use: <emphasis>pipe</emphasis></entry>
44797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44798 <entry>Default: <emphasis>unset</emphasis></entry>
44799 </row>
44800 </tbody>
44801 </tgroup>
44802 </informaltable>
44803 <para>
44804 <indexterm role="concept">
44805 <primary><command>pipe</command> transport</primary>
44806 <secondary>environment for command</secondary>
44807 </indexterm>
44808 <indexterm role="concept">
44809 <primary>environment</primary>
44810 <secondary><command>pipe</command> transport</secondary>
44811 </indexterm>
44812 This option is used to add additional variables to the environment in which the
44813 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
44814 a string which is expanded, and then interpreted as a colon-separated list of
44815 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
44816 </para>
44817 <para>
44818 <indexterm role="option">
44819 <primary><option>escape_string</option></primary>
44820 </indexterm>
44821 </para>
44822 <informaltable frame="all">
44823 <tgroup cols="4" colsep="0" rowsep="0">
44824 <colspec colwidth="8*" align="left"/>
44825 <colspec colwidth="6*" align="center"/>
44826 <colspec colwidth="6*" align="center"/>
44827 <colspec colwidth="6*" align="right"/>
44828 <tbody>
44829 <row>
44830 <entry><option>escape_string</option></entry>
44831 <entry>Use: <emphasis>pipe</emphasis></entry>
44832 <entry>Type: <emphasis>string</emphasis></entry>
44833 <entry>Default: <emphasis>unset</emphasis></entry>
44834 </row>
44835 </tbody>
44836 </tgroup>
44837 </informaltable>
44838 <para>
44839 See <option>check_string</option> above.
44840 </para>
44841 <para>
44842 <indexterm role="option">
44843 <primary><option>freeze_exec_fail</option></primary>
44844 </indexterm>
44845 </para>
44846 <informaltable frame="all">
44847 <tgroup cols="4" colsep="0" rowsep="0">
44848 <colspec colwidth="8*" align="left"/>
44849 <colspec colwidth="6*" align="center"/>
44850 <colspec colwidth="6*" align="center"/>
44851 <colspec colwidth="6*" align="right"/>
44852 <tbody>
44853 <row>
44854 <entry><option>freeze_exec_fail</option></entry>
44855 <entry>Use: <emphasis>pipe</emphasis></entry>
44856 <entry>Type: <emphasis>boolean</emphasis></entry>
44857 <entry>Default: <emphasis>false</emphasis></entry>
44858 </row>
44859 </tbody>
44860 </tgroup>
44861 </informaltable>
44862 <para>
44863 <indexterm role="concept">
44864 <primary>exec failure</primary>
44865 </indexterm>
44866 <indexterm role="concept">
44867 <primary>failure of exec</primary>
44868 </indexterm>
44869 <indexterm role="concept">
44870 <primary><command>pipe</command> transport</primary>
44871 <secondary>failure of exec</secondary>
44872 </indexterm>
44873 Failure to exec the command in a pipe transport is by default treated like
44874 any other failure while running the command. However, if <option>freeze_exec_fail</option>
44875 is set, failure to exec is treated specially, and causes the message to be
44876 frozen, whatever the setting of <option>ignore_status</option>.
44877 </para>
44878 <para>
44879 <indexterm role="option">
44880 <primary><option>freeze_signal</option></primary>
44881 </indexterm>
44882 </para>
44883 <informaltable frame="all">
44884 <tgroup cols="4" colsep="0" rowsep="0">
44885 <colspec colwidth="8*" align="left"/>
44886 <colspec colwidth="6*" align="center"/>
44887 <colspec colwidth="6*" align="center"/>
44888 <colspec colwidth="6*" align="right"/>
44889 <tbody>
44890 <row>
44891 <entry><option>freeze_signal</option></entry>
44892 <entry>Use: <emphasis>pipe</emphasis></entry>
44893 <entry>Type: <emphasis>boolean</emphasis></entry>
44894 <entry>Default: <emphasis>false</emphasis></entry>
44895 </row>
44896 </tbody>
44897 </tgroup>
44898 </informaltable>
44899 <para>
44900 <indexterm role="concept">
44901 <primary>signal exit</primary>
44902 </indexterm>
44903 <indexterm role="concept">
44904 <primary><command>pipe</command> transport</primary>
44905 <secondary>,</secondary>
44906 </indexterm>
44907 Normally if the process run by a command in a pipe transport exits on a signal,
44908 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
44909 frozen in Exim&#x2019;s queue instead.
44910 </para>
44911 <para>
44912 <indexterm role="option">
44913 <primary><option>force_command</option></primary>
44914 </indexterm>
44915 </para>
44916 <informaltable frame="all">
44917 <tgroup cols="4" colsep="0" rowsep="0">
44918 <colspec colwidth="8*" align="left"/>
44919 <colspec colwidth="6*" align="center"/>
44920 <colspec colwidth="6*" align="center"/>
44921 <colspec colwidth="6*" align="right"/>
44922 <tbody>
44923 <row>
44924 <entry><option>force_command</option></entry>
44925 <entry>Use: <emphasis>pipe</emphasis></entry>
44926 <entry>Type: <emphasis>boolean</emphasis></entry>
44927 <entry>Default: <emphasis>false</emphasis></entry>
44928 </row>
44929 </tbody>
44930 </tgroup>
44931 </informaltable>
44932 <para>
44933 <indexterm role="concept">
44934 <primary>force command</primary>
44935 </indexterm>
44936 <indexterm role="concept">
44937 <primary><command>pipe</command> transport</primary>
44938 <secondary>,</secondary>
44939 </indexterm>
44940 Normally when a router redirects an address directly to a pipe command
44941 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
44942 is set, the <option>command</option> option will used. This is especially
44943 useful for forcing a wrapper or additional argument to be added to the
44944 command. For example:
44945 </para>
44946 <literallayout class="monospaced">
44947 command = /usr/bin/remote_exec myhost -- $address_pipe
44948 force_command
44949 </literallayout>
44950 <para>
44951 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
44952 <option>force_command</option> is set, expanding out to the original argument vector as
44953 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
44954 </para>
44955 <para>
44956 <indexterm role="option">
44957 <primary><option>ignore_status</option></primary>
44958 </indexterm>
44959 </para>
44960 <informaltable frame="all">
44961 <tgroup cols="4" colsep="0" rowsep="0">
44962 <colspec colwidth="8*" align="left"/>
44963 <colspec colwidth="6*" align="center"/>
44964 <colspec colwidth="6*" align="center"/>
44965 <colspec colwidth="6*" align="right"/>
44966 <tbody>
44967 <row>
44968 <entry><option>ignore_status</option></entry>
44969 <entry>Use: <emphasis>pipe</emphasis></entry>
44970 <entry>Type: <emphasis>boolean</emphasis></entry>
44971 <entry>Default: <emphasis>false</emphasis></entry>
44972 </row>
44973 </tbody>
44974 </tgroup>
44975 </informaltable>
44976 <para>
44977 If this option is true, the status returned by the subprocess that is set up to
44978 run the command is ignored, and Exim behaves as if zero had been returned.
44979 Otherwise, a non-zero status or termination by signal causes an error return
44980 from the transport unless the status value is one of those listed in
44981 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
44982 </para>
44983 <para>
44984 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
44985 See the <option>timeout_defer</option> option for how timeouts are handled.
44986 </para>
44987 <para>
44988 <indexterm role="option">
44989 <primary><option>log_defer_output</option></primary>
44990 </indexterm>
44991 </para>
44992 <informaltable frame="all">
44993 <tgroup cols="4" colsep="0" rowsep="0">
44994 <colspec colwidth="8*" align="left"/>
44995 <colspec colwidth="6*" align="center"/>
44996 <colspec colwidth="6*" align="center"/>
44997 <colspec colwidth="6*" align="right"/>
44998 <tbody>
44999 <row>
45000 <entry><option>log_defer_output</option></entry>
45001 <entry>Use: <emphasis>pipe</emphasis></entry>
45002 <entry>Type: <emphasis>boolean</emphasis></entry>
45003 <entry>Default: <emphasis>false</emphasis></entry>
45004 </row>
45005 </tbody>
45006 </tgroup>
45007 </informaltable>
45008 <para>
45009 <indexterm role="concept">
45010 <primary><command>pipe</command> transport</primary>
45011 <secondary>logging output</secondary>
45012 </indexterm>
45013 If this option is set, and the status returned by the command is
45014 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
45015 and any output was produced on stdout or stderr, the first line of it is
45016 written to the main log.
45017 </para>
45018 <para>
45019 <indexterm role="option">
45020 <primary><option>log_fail_output</option></primary>
45021 </indexterm>
45022 </para>
45023 <informaltable frame="all">
45024 <tgroup cols="4" colsep="0" rowsep="0">
45025 <colspec colwidth="8*" align="left"/>
45026 <colspec colwidth="6*" align="center"/>
45027 <colspec colwidth="6*" align="center"/>
45028 <colspec colwidth="6*" align="right"/>
45029 <tbody>
45030 <row>
45031 <entry><option>log_fail_output</option></entry>
45032 <entry>Use: <emphasis>pipe</emphasis></entry>
45033 <entry>Type: <emphasis>boolean</emphasis></entry>
45034 <entry>Default: <emphasis>false</emphasis></entry>
45035 </row>
45036 </tbody>
45037 </tgroup>
45038 </informaltable>
45039 <para>
45040 If this option is set, and the command returns any output on stdout or
45041 stderr, and also ends with a return code that is neither zero nor one of
45042 the return codes listed in <option>temp_errors</option> (that is, the delivery
45043 failed), the first line of output is written to the main log. This
45044 option and <option>log_output</option> are mutually exclusive.  Only one of them may
45045 be set.
45046 </para>
45047 <para>
45048 <indexterm role="option">
45049 <primary><option>log_output</option></primary>
45050 </indexterm>
45051 </para>
45052 <informaltable frame="all">
45053 <tgroup cols="4" colsep="0" rowsep="0">
45054 <colspec colwidth="8*" align="left"/>
45055 <colspec colwidth="6*" align="center"/>
45056 <colspec colwidth="6*" align="center"/>
45057 <colspec colwidth="6*" align="right"/>
45058 <tbody>
45059 <row>
45060 <entry><option>log_output</option></entry>
45061 <entry>Use: <emphasis>pipe</emphasis></entry>
45062 <entry>Type: <emphasis>boolean</emphasis></entry>
45063 <entry>Default: <emphasis>false</emphasis></entry>
45064 </row>
45065 </tbody>
45066 </tgroup>
45067 </informaltable>
45068 <para>
45069 If this option is set and the command returns any output on stdout or
45070 stderr, the first line of output is written to the main log, whatever
45071 the return code. This option and <option>log_fail_output</option> are mutually
45072 exclusive. Only one of them may be set.
45073 </para>
45074 <para>
45075 <indexterm role="option">
45076 <primary><option>max_output</option></primary>
45077 </indexterm>
45078 </para>
45079 <informaltable frame="all">
45080 <tgroup cols="4" colsep="0" rowsep="0">
45081 <colspec colwidth="8*" align="left"/>
45082 <colspec colwidth="6*" align="center"/>
45083 <colspec colwidth="6*" align="center"/>
45084 <colspec colwidth="6*" align="right"/>
45085 <tbody>
45086 <row>
45087 <entry><option>max_output</option></entry>
45088 <entry>Use: <emphasis>pipe</emphasis></entry>
45089 <entry>Type: <emphasis>integer</emphasis></entry>
45090 <entry>Default: <emphasis>20K</emphasis></entry>
45091 </row>
45092 </tbody>
45093 </tgroup>
45094 </informaltable>
45095 <para>
45096 This specifies the maximum amount of output that the command may produce on its
45097 standard output and standard error file combined. If the limit is exceeded, the
45098 process running the command is killed. This is intended as a safety measure to
45099 catch runaway processes. The limit is applied independently of the settings of
45100 the options that control what is done with such output (for example,
45101 <option>return_output</option>). Because of buffering effects, the amount of output may
45102 exceed the limit by a small amount before Exim notices.
45103 </para>
45104 <para>
45105 <indexterm role="option">
45106 <primary><option>message_prefix</option></primary>
45107 </indexterm>
45108 </para>
45109 <informaltable frame="all">
45110 <tgroup cols="4" colsep="0" rowsep="0">
45111 <colspec colwidth="8*" align="left"/>
45112 <colspec colwidth="6*" align="center"/>
45113 <colspec colwidth="6*" align="center"/>
45114 <colspec colwidth="6*" align="right"/>
45115 <tbody>
45116 <row>
45117 <entry><option>message_prefix</option></entry>
45118 <entry>Use: <emphasis>pipe</emphasis></entry>
45119 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45120 <entry>Default: <emphasis>see below</emphasis></entry>
45121 </row>
45122 </tbody>
45123 </tgroup>
45124 </informaltable>
45125 <para>
45126 The string specified here is expanded and output at the start of every message.
45127 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
45128 </para>
45129 <literallayout class="monospaced">
45130 message_prefix = \
45131   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
45132   ${tod_bsdinbox}\n
45133 </literallayout>
45134 <para>
45135 <indexterm role="concept">
45136 <primary>Cyrus</primary>
45137 </indexterm>
45138 <indexterm role="concept">
45139 <primary><option>tmail</option></primary>
45140 </indexterm>
45141 <indexterm role="concept">
45142 <primary><quote>From</quote> line</primary>
45143 </indexterm>
45144 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
45145 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
45146 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
45147 setting
45148 </para>
45149 <literallayout class="monospaced">
45150 message_prefix =
45151 </literallayout>
45152 <para>
45153 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45154 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
45155 </para>
45156 <para>
45157 <indexterm role="option">
45158 <primary><option>message_suffix</option></primary>
45159 </indexterm>
45160 </para>
45161 <informaltable frame="all">
45162 <tgroup cols="4" colsep="0" rowsep="0">
45163 <colspec colwidth="8*" align="left"/>
45164 <colspec colwidth="6*" align="center"/>
45165 <colspec colwidth="6*" align="center"/>
45166 <colspec colwidth="6*" align="right"/>
45167 <tbody>
45168 <row>
45169 <entry><option>message_suffix</option></entry>
45170 <entry>Use: <emphasis>pipe</emphasis></entry>
45171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45172 <entry>Default: <emphasis>see below</emphasis></entry>
45173 </row>
45174 </tbody>
45175 </tgroup>
45176 </informaltable>
45177 <para>
45178 The string specified here is expanded and output at the end of every message.
45179 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
45180 The suffix can be suppressed by setting
45181 </para>
45182 <literallayout class="monospaced">
45183 message_suffix =
45184 </literallayout>
45185 <para>
45186 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45187 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
45188 </para>
45189 <para>
45190 <indexterm role="option">
45191 <primary><option>path</option></primary>
45192 </indexterm>
45193 </para>
45194 <informaltable frame="all">
45195 <tgroup cols="4" colsep="0" rowsep="0">
45196 <colspec colwidth="8*" align="left"/>
45197 <colspec colwidth="6*" align="center"/>
45198 <colspec colwidth="6*" align="center"/>
45199 <colspec colwidth="6*" align="right"/>
45200 <tbody>
45201 <row>
45202 <entry><option>path</option></entry>
45203 <entry>Use: <emphasis>pipe</emphasis></entry>
45204 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45205 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
45206 </row>
45207 </tbody>
45208 </tgroup>
45209 </informaltable>
45210 <para revisionflag="changed">
45211 This option is expanded and
45212 </para>
45213 <para>
45214 specifies the string that is set up in the PATH environment
45215 variable of the subprocess.
45216 If the <option>command</option> option does not yield an absolute path name, the command is
45217 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
45218 apply to a command specified as a transport filter.
45219 </para>
45220 <para>
45221 <indexterm role="option">
45222 <primary><option>permit_coredump</option></primary>
45223 </indexterm>
45224 </para>
45225 <informaltable frame="all">
45226 <tgroup cols="4" colsep="0" rowsep="0">
45227 <colspec colwidth="8*" align="left"/>
45228 <colspec colwidth="6*" align="center"/>
45229 <colspec colwidth="6*" align="center"/>
45230 <colspec colwidth="6*" align="right"/>
45231 <tbody>
45232 <row>
45233 <entry><option>permit_coredump</option></entry>
45234 <entry>Use: <emphasis>pipe</emphasis></entry>
45235 <entry>Type: <emphasis>boolean</emphasis></entry>
45236 <entry>Default: <emphasis>false</emphasis></entry>
45237 </row>
45238 </tbody>
45239 </tgroup>
45240 </informaltable>
45241 <para>
45242 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
45243 a core-dump of a pipe command, enable this command.  This enables core-dumps
45244 during delivery and affects both the Exim binary and the pipe command run.
45245 It is recommended that this option remain off unless and until you have a need
45246 for it and that this only be enabled when needed, as the risk of excessive
45247 resource consumption can be quite high.  Note also that Exim is typically
45248 installed as a setuid binary and most operating systems will inhibit coredumps
45249 of these by default, so further OS-specific action may be required.
45250 </para>
45251 <para>
45252 <indexterm role="option">
45253 <primary><option>pipe_as_creator</option></primary>
45254 </indexterm>
45255 </para>
45256 <informaltable frame="all">
45257 <tgroup cols="4" colsep="0" rowsep="0">
45258 <colspec colwidth="8*" align="left"/>
45259 <colspec colwidth="6*" align="center"/>
45260 <colspec colwidth="6*" align="center"/>
45261 <colspec colwidth="6*" align="right"/>
45262 <tbody>
45263 <row>
45264 <entry><option>pipe_as_creator</option></entry>
45265 <entry>Use: <emphasis>pipe</emphasis></entry>
45266 <entry>Type: <emphasis>boolean</emphasis></entry>
45267 <entry>Default: <emphasis>false</emphasis></entry>
45268 </row>
45269 </tbody>
45270 </tgroup>
45271 </informaltable>
45272 <para>
45273 <indexterm role="concept">
45274 <primary>uid (user id)</primary>
45275 <secondary>local delivery</secondary>
45276 </indexterm>
45277 If the generic <option>user</option> option is not set and this option is true, the delivery
45278 process is run under the uid that was in force when Exim was originally called
45279 to accept the message. If the group id is not otherwise set (via the generic
45280 <option>group</option> option), the gid that was in force when Exim was originally called to
45281 accept the message is used.
45282 </para>
45283 <para>
45284 <indexterm role="option">
45285 <primary><option>restrict_to_path</option></primary>
45286 </indexterm>
45287 </para>
45288 <informaltable frame="all">
45289 <tgroup cols="4" colsep="0" rowsep="0">
45290 <colspec colwidth="8*" align="left"/>
45291 <colspec colwidth="6*" align="center"/>
45292 <colspec colwidth="6*" align="center"/>
45293 <colspec colwidth="6*" align="right"/>
45294 <tbody>
45295 <row>
45296 <entry><option>restrict_to_path</option></entry>
45297 <entry>Use: <emphasis>pipe</emphasis></entry>
45298 <entry>Type: <emphasis>boolean</emphasis></entry>
45299 <entry>Default: <emphasis>false</emphasis></entry>
45300 </row>
45301 </tbody>
45302 </tgroup>
45303 </informaltable>
45304 <para>
45305 When this option is set, any command name not listed in <option>allow_commands</option> must
45306 contain no slashes. The command is searched for only in the directories listed
45307 in the <option>path</option> option. This option is intended for use in the case when a pipe
45308 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
45309 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
45310 </para>
45311 <para>
45312 <indexterm role="option">
45313 <primary><option>return_fail_output</option></primary>
45314 </indexterm>
45315 </para>
45316 <informaltable frame="all">
45317 <tgroup cols="4" colsep="0" rowsep="0">
45318 <colspec colwidth="8*" align="left"/>
45319 <colspec colwidth="6*" align="center"/>
45320 <colspec colwidth="6*" align="center"/>
45321 <colspec colwidth="6*" align="right"/>
45322 <tbody>
45323 <row>
45324 <entry><option>return_fail_output</option></entry>
45325 <entry>Use: <emphasis>pipe</emphasis></entry>
45326 <entry>Type: <emphasis>boolean</emphasis></entry>
45327 <entry>Default: <emphasis>false</emphasis></entry>
45328 </row>
45329 </tbody>
45330 </tgroup>
45331 </informaltable>
45332 <para>
45333 If this option is true, and the command produced any output and ended with a
45334 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
45335 is, the delivery failed), the output is returned in the bounce message.
45336 However, if the message has a null sender (that is, it is itself a bounce
45337 message), output from the command is discarded. This option and
45338 <option>return_output</option> are mutually exclusive. Only one of them may be set.
45339 </para>
45340 <para>
45341 <indexterm role="option">
45342 <primary><option>return_output</option></primary>
45343 </indexterm>
45344 </para>
45345 <informaltable frame="all">
45346 <tgroup cols="4" colsep="0" rowsep="0">
45347 <colspec colwidth="8*" align="left"/>
45348 <colspec colwidth="6*" align="center"/>
45349 <colspec colwidth="6*" align="center"/>
45350 <colspec colwidth="6*" align="right"/>
45351 <tbody>
45352 <row>
45353 <entry><option>return_output</option></entry>
45354 <entry>Use: <emphasis>pipe</emphasis></entry>
45355 <entry>Type: <emphasis>boolean</emphasis></entry>
45356 <entry>Default: <emphasis>false</emphasis></entry>
45357 </row>
45358 </tbody>
45359 </tgroup>
45360 </informaltable>
45361 <para>
45362 If this option is true, and the command produced any output, the delivery is
45363 deemed to have failed whatever the return code from the command, and the output
45364 is returned in the bounce message. Otherwise, the output is just discarded.
45365 However, if the message has a null sender (that is, it is a bounce message),
45366 output from the command is always discarded, whatever the setting of this
45367 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
45368 of them may be set.
45369 </para>
45370 <para>
45371 <indexterm role="option">
45372 <primary><option>temp_errors</option></primary>
45373 </indexterm>
45374 </para>
45375 <informaltable frame="all">
45376 <tgroup cols="4" colsep="0" rowsep="0">
45377 <colspec colwidth="8*" align="left"/>
45378 <colspec colwidth="6*" align="center"/>
45379 <colspec colwidth="6*" align="center"/>
45380 <colspec colwidth="6*" align="right"/>
45381 <tbody>
45382 <row>
45383 <entry><option>temp_errors</option></entry>
45384 <entry>Use: <emphasis>pipe</emphasis></entry>
45385 <entry>Type: <emphasis>string list</emphasis></entry>
45386 <entry>Default: <emphasis>see below</emphasis></entry>
45387 </row>
45388 </tbody>
45389 </tgroup>
45390 </informaltable>
45391 <para>
45392 <indexterm role="concept">
45393 <primary><command>pipe</command> transport</primary>
45394 <secondary>temporary failure</secondary>
45395 </indexterm>
45396 This option contains either a colon-separated list of numbers, or a single
45397 asterisk. If <option>ignore_status</option> is false
45398 and <option>return_output</option> is not set,
45399 and the command exits with a non-zero return code, the failure is treated as
45400 temporary and the delivery is deferred if the return code matches one of the
45401 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
45402 codes are treated as permanent errors. The default setting contains the codes
45403 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
45404 compiled on a system that does not define these macros, it assumes values of 75
45405 and 73, respectively.
45406 </para>
45407 <para>
45408 <indexterm role="option">
45409 <primary><option>timeout</option></primary>
45410 </indexterm>
45411 </para>
45412 <informaltable frame="all">
45413 <tgroup cols="4" colsep="0" rowsep="0">
45414 <colspec colwidth="8*" align="left"/>
45415 <colspec colwidth="6*" align="center"/>
45416 <colspec colwidth="6*" align="center"/>
45417 <colspec colwidth="6*" align="right"/>
45418 <tbody>
45419 <row>
45420 <entry><option>timeout</option></entry>
45421 <entry>Use: <emphasis>pipe</emphasis></entry>
45422 <entry>Type: <emphasis>time</emphasis></entry>
45423 <entry>Default: <emphasis>1h</emphasis></entry>
45424 </row>
45425 </tbody>
45426 </tgroup>
45427 </informaltable>
45428 <para>
45429 If the command fails to complete within this time, it is killed. This normally
45430 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
45431 specifies no timeout. In order to ensure that any subprocesses created by the
45432 command are also killed, Exim makes the initial process a process group leader,
45433 and kills the whole process group on a timeout. However, this can be defeated
45434 if one of the processes starts a new process group.
45435 </para>
45436 <para>
45437 <indexterm role="option">
45438 <primary><option>timeout_defer</option></primary>
45439 </indexterm>
45440 </para>
45441 <informaltable frame="all">
45442 <tgroup cols="4" colsep="0" rowsep="0">
45443 <colspec colwidth="8*" align="left"/>
45444 <colspec colwidth="6*" align="center"/>
45445 <colspec colwidth="6*" align="center"/>
45446 <colspec colwidth="6*" align="right"/>
45447 <tbody>
45448 <row>
45449 <entry><option>timeout_defer</option></entry>
45450 <entry>Use: <emphasis>pipe</emphasis></entry>
45451 <entry>Type: <emphasis>boolean</emphasis></entry>
45452 <entry>Default: <emphasis>false</emphasis></entry>
45453 </row>
45454 </tbody>
45455 </tgroup>
45456 </informaltable>
45457 <para>
45458 A timeout in a <command>pipe</command> transport, either in the command that the transport
45459 runs, or in a transport filter that is associated with it, is by default
45460 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
45461 is set true, both kinds of timeout become temporary errors, causing the
45462 delivery to be deferred.
45463 </para>
45464 <para>
45465 <indexterm role="option">
45466 <primary><option>umask</option></primary>
45467 </indexterm>
45468 </para>
45469 <informaltable frame="all">
45470 <tgroup cols="4" colsep="0" rowsep="0">
45471 <colspec colwidth="8*" align="left"/>
45472 <colspec colwidth="6*" align="center"/>
45473 <colspec colwidth="6*" align="center"/>
45474 <colspec colwidth="6*" align="right"/>
45475 <tbody>
45476 <row>
45477 <entry><option>umask</option></entry>
45478 <entry>Use: <emphasis>pipe</emphasis></entry>
45479 <entry>Type: <emphasis>octal integer</emphasis></entry>
45480 <entry>Default: <emphasis>022</emphasis></entry>
45481 </row>
45482 </tbody>
45483 </tgroup>
45484 </informaltable>
45485 <para>
45486 This specifies the umask setting for the subprocess that runs the command.
45487 </para>
45488 <para>
45489 <indexterm role="option">
45490 <primary><option>use_bsmtp</option></primary>
45491 </indexterm>
45492 </para>
45493 <informaltable frame="all">
45494 <tgroup cols="4" colsep="0" rowsep="0">
45495 <colspec colwidth="8*" align="left"/>
45496 <colspec colwidth="6*" align="center"/>
45497 <colspec colwidth="6*" align="center"/>
45498 <colspec colwidth="6*" align="right"/>
45499 <tbody>
45500 <row>
45501 <entry><option>use_bsmtp</option></entry>
45502 <entry>Use: <emphasis>pipe</emphasis></entry>
45503 <entry>Type: <emphasis>boolean</emphasis></entry>
45504 <entry>Default: <emphasis>false</emphasis></entry>
45505 </row>
45506 </tbody>
45507 </tgroup>
45508 </informaltable>
45509 <para>
45510 <indexterm role="concept">
45511 <primary>envelope sender</primary>
45512 </indexterm>
45513 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
45514 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
45515 commands. If you want to include a leading HELO command with such messages,
45516 you can do so by setting the <option>message_prefix</option> option. See section
45517 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
45518 </para>
45519 <para>
45520 <indexterm role="option">
45521 <primary><option>use_classresources</option></primary>
45522 </indexterm>
45523 </para>
45524 <informaltable frame="all">
45525 <tgroup cols="4" colsep="0" rowsep="0">
45526 <colspec colwidth="8*" align="left"/>
45527 <colspec colwidth="6*" align="center"/>
45528 <colspec colwidth="6*" align="center"/>
45529 <colspec colwidth="6*" align="right"/>
45530 <tbody>
45531 <row>
45532 <entry><option>use_classresources</option></entry>
45533 <entry>Use: <emphasis>pipe</emphasis></entry>
45534 <entry>Type: <emphasis>boolean</emphasis></entry>
45535 <entry>Default: <emphasis>false</emphasis></entry>
45536 </row>
45537 </tbody>
45538 </tgroup>
45539 </informaltable>
45540 <para>
45541 <indexterm role="concept">
45542 <primary>class resources (BSD)</primary>
45543 </indexterm>
45544 This option is available only when Exim is running on FreeBSD, NetBSD, or
45545 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
45546 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
45547 limits for the uid under which the pipe is to run are obtained from the login
45548 class database.
45549 </para>
45550 <para>
45551 <indexterm role="option">
45552 <primary><option>use_crlf</option></primary>
45553 </indexterm>
45554 </para>
45555 <informaltable frame="all">
45556 <tgroup cols="4" colsep="0" rowsep="0">
45557 <colspec colwidth="8*" align="left"/>
45558 <colspec colwidth="6*" align="center"/>
45559 <colspec colwidth="6*" align="center"/>
45560 <colspec colwidth="6*" align="right"/>
45561 <tbody>
45562 <row>
45563 <entry><option>use_crlf</option></entry>
45564 <entry>Use: <emphasis>pipe</emphasis></entry>
45565 <entry>Type: <emphasis>boolean</emphasis></entry>
45566 <entry>Default: <emphasis>false</emphasis></entry>
45567 </row>
45568 </tbody>
45569 </tgroup>
45570 </informaltable>
45571 <para>
45572 <indexterm role="concept">
45573 <primary>carriage return</primary>
45574 </indexterm>
45575 <indexterm role="concept">
45576 <primary>linefeed</primary>
45577 </indexterm>
45578 This option causes lines to be terminated with the two-character CRLF sequence
45579 (carriage return, linefeed) instead of just a linefeed character. In the case
45580 of batched SMTP, the byte sequence written to the pipe is then an exact image
45581 of what would be sent down a real SMTP connection.
45582 </para>
45583 <para>
45584 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
45585 written verbatim, so must contain their own carriage return characters if these
45586 are needed. When <option>use_bsmtp</option> is not set, the default values for both
45587 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
45588 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45589 </para>
45590 <para>
45591 <indexterm role="option">
45592 <primary><option>use_shell</option></primary>
45593 </indexterm>
45594 </para>
45595 <informaltable frame="all">
45596 <tgroup cols="4" colsep="0" rowsep="0">
45597 <colspec colwidth="8*" align="left"/>
45598 <colspec colwidth="6*" align="center"/>
45599 <colspec colwidth="6*" align="center"/>
45600 <colspec colwidth="6*" align="right"/>
45601 <tbody>
45602 <row>
45603 <entry><option>use_shell</option></entry>
45604 <entry>Use: <emphasis>pipe</emphasis></entry>
45605 <entry>Type: <emphasis>boolean</emphasis></entry>
45606 <entry>Default: <emphasis>false</emphasis></entry>
45607 </row>
45608 </tbody>
45609 </tgroup>
45610 </informaltable>
45611 <para>
45612 <indexterm role="variable">
45613 <primary><varname>$pipe_addresses</varname></primary>
45614 </indexterm>
45615 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
45616 instead of being run directly from the transport, as described in section
45617 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
45618 where the command is expected to be run under a shell and cannot easily be
45619 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
45620 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
45621 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
45622 its <option>-c</option> option.
45623 </para>
45624 </section>
45625 <section id="SECID143">
45626 <title>Using an external local delivery agent</title>
45627 <para>
45628 <indexterm role="concept">
45629 <primary>local delivery</primary>
45630 <secondary>using an external agent</secondary>
45631 </indexterm>
45632 <indexterm role="concept">
45633 <primary><emphasis>procmail</emphasis></primary>
45634 </indexterm>
45635 <indexterm role="concept">
45636 <primary>external local delivery</primary>
45637 </indexterm>
45638 <indexterm role="concept">
45639 <primary>delivery</primary>
45640 <secondary><emphasis>procmail</emphasis></secondary>
45641 </indexterm>
45642 <indexterm role="concept">
45643 <primary>delivery</primary>
45644 <secondary>by external agent</secondary>
45645 </indexterm>
45646 The <command>pipe</command> transport can be used to pass all messages that require local
45647 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
45648 this, care must be taken to ensure that the pipe is run under an appropriate
45649 uid and gid. In some configurations one wants this to be a uid that is trusted
45650 by the delivery agent to supply the correct sender of the message. It may be
45651 necessary to recompile or reconfigure the delivery agent so that it trusts an
45652 appropriate user. The following is an example transport and router
45653 configuration for <option>procmail</option>:
45654 </para>
45655 <literallayout class="monospaced">
45656 # transport
45657 procmail_pipe:
45658   driver = pipe
45659   command = /usr/local/bin/procmail -d $local_part
45660   return_path_add
45661   delivery_date_add
45662   envelope_to_add
45663   check_string = "From "
45664   escape_string = "&gt;From "
45665   umask = 077
45666   user = $local_part
45667   group = mail
45668
45669 # router
45670 procmail:
45671   driver = accept
45672   check_local_user
45673   transport = procmail_pipe
45674 </literallayout>
45675 <para>
45676 In this example, the pipe is run as the local user, but with the group set to
45677 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
45678 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
45679 user to supply a correct sender address. If you do not specify either a
45680 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
45681 home directory is the user&#x2019;s home directory by default.
45682 </para>
45683 <para>
45684 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
45685 </para>
45686 <literallayout class="monospaced">
45687 IFS=" "
45688 </literallayout>
45689 <para>
45690 as shown in some <option>procmail</option> documentation, because Exim does not by default
45691 use a shell to run pipe commands.
45692 </para>
45693 <para>
45694 <indexterm role="concept">
45695 <primary>Cyrus</primary>
45696 </indexterm>
45697 The next example shows a transport and a router for a system where local
45698 deliveries are handled by the Cyrus IMAP server.
45699 </para>
45700 <literallayout class="monospaced">
45701 # transport
45702 local_delivery_cyrus:
45703   driver = pipe
45704   command = /usr/cyrus/bin/deliver \
45705             -m ${substr_1:$local_part_suffix} -- $local_part
45706   user = cyrus
45707   group = mail
45708   return_output
45709   log_output
45710   message_prefix =
45711   message_suffix =
45712
45713 # router
45714 local_user_cyrus:
45715   driver = accept
45716   check_local_user
45717   local_part_suffix = .*
45718   transport = local_delivery_cyrus
45719 </literallayout>
45720 <para>
45721 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
45722 <option>return_output</option> to cause any text written by Cyrus to be returned to the
45723 sender.
45724 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
45725 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
45726 </para>
45727 </section>
45728 </chapter>
45729
45730 <chapter id="CHAPsmtptrans">
45731 <title>The smtp transport</title>
45732 <para>
45733 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
45734 <primary>transports</primary>
45735 <secondary><command>smtp</command></secondary>
45736 </indexterm>
45737 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
45738 <primary><command>smtp</command> transport</primary>
45739 </indexterm>
45740 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
45741 or LMTP protocol. The list of hosts to try can either be taken from the address
45742 that is being processed (having been set up by the router), or specified
45743 explicitly for the transport. Timeout and retry processing (see chapter
45744 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
45745 </para>
45746 <section id="SECID144">
45747 <title>Multiple messages on a single connection</title>
45748 <para>
45749 The sending of multiple messages over a single TCP/IP connection can arise in
45750 two ways:
45751 </para>
45752 <itemizedlist>
45753 <listitem>
45754 <para>
45755 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
45756 routed to the same host, more than one copy of the message has to be sent to
45757 that host. In this situation, multiple copies may be sent in a single run of
45758 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
45759 does when it has too many addresses to send in one message also depends on the
45760 value of the global <option>remote_max_parallel</option> option. Details are given in
45761 section <xref linkend="SECToutSMTPTCP"/>.)
45762 </para>
45763 </listitem>
45764 <listitem>
45765 <para>
45766 <indexterm role="concept">
45767 <primary>hints database</primary>
45768 <secondary>remembering routing</secondary>
45769 </indexterm>
45770 When a message has been successfully delivered over a TCP/IP connection, Exim
45771 looks in its hints database to see if there are any other messages awaiting a
45772 connection to the same host. If there are, a new delivery process is started
45773 for one of them, and the current TCP/IP connection is passed on to it. The new
45774 process may in turn send multiple copies and possibly create yet another
45775 process.
45776 </para>
45777 </listitem>
45778 </itemizedlist>
45779 <para>
45780 For each copy sent over the same TCP/IP connection, a sequence counter is
45781 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
45782 no further messages are sent over that connection.
45783 </para>
45784 </section>
45785 <section id="SECID145">
45786 <title>Use of the $host and $host_address variables</title>
45787 <para>
45788 <indexterm role="variable">
45789 <primary><varname>$host</varname></primary>
45790 </indexterm>
45791 <indexterm role="variable">
45792 <primary><varname>$host_address</varname></primary>
45793 </indexterm>
45794 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
45795 <varname>$host_address</varname> are the name and IP address of the first host on the host list
45796 passed by the router. However, when the transport is about to connect to a
45797 specific host, and while it is connected to that host, <varname>$host</varname> and
45798 <varname>$host_address</varname> are set to the values for that host. These are the values
45799 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
45800 <option>serialize_hosts</option>, and the various TLS options are expanded.
45801 </para>
45802 </section>
45803 <section id="usecippeer">
45804 <title>Use of $tls_cipher and $tls_peerdn</title>
45805 <para>
45806 <indexterm role="variable">
45807 <primary><varname>$tls_bits</varname></primary>
45808 </indexterm>
45809 <indexterm role="variable">
45810 <primary><varname>$tls_cipher</varname></primary>
45811 </indexterm>
45812 <indexterm role="variable">
45813 <primary><varname>$tls_peerdn</varname></primary>
45814 </indexterm>
45815 <indexterm role="variable">
45816 <primary><varname>$tls_sni</varname></primary>
45817 </indexterm>
45818 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
45819 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
45820 are the values that were set when the message was received.
45821 These are the values that are used for options that are expanded before any
45822 SMTP connections are made. Just before each connection is made, these four
45823 variables are emptied. If TLS is subsequently started, they are set to the
45824 appropriate values for the outgoing connection, and these are the values that
45825 are in force when any authenticators are run and when the
45826 <option>authenticated_sender</option> option is expanded.
45827 </para>
45828 <para>
45829 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
45830 and will be removed in a future release.
45831 </para>
45832 </section>
45833 <section id="SECID146">
45834 <title>Private options for smtp</title>
45835 <para>
45836 <indexterm role="concept">
45837 <primary>options</primary>
45838 <secondary><command>smtp</command> transport</secondary>
45839 </indexterm>
45840 The private options of the <command>smtp</command> transport are as follows:
45841 </para>
45842 <para>
45843 <indexterm role="option">
45844 <primary><option>address_retry_include_sender</option></primary>
45845 </indexterm>
45846 </para>
45847 <informaltable frame="all">
45848 <tgroup cols="4" colsep="0" rowsep="0">
45849 <colspec colwidth="8*" align="left"/>
45850 <colspec colwidth="6*" align="center"/>
45851 <colspec colwidth="6*" align="center"/>
45852 <colspec colwidth="6*" align="right"/>
45853 <tbody>
45854 <row>
45855 <entry><option>address_retry_include_sender</option></entry>
45856 <entry>Use: <emphasis>smtp</emphasis></entry>
45857 <entry>Type: <emphasis>boolean</emphasis></entry>
45858 <entry>Default: <emphasis>true</emphasis></entry>
45859 </row>
45860 </tbody>
45861 </tgroup>
45862 </informaltable>
45863 <para>
45864 <indexterm role="concept">
45865 <primary>4<emphasis>xx</emphasis> responses</primary>
45866 <secondary>retrying after</secondary>
45867 </indexterm>
45868 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
45869 is the combination of sender and recipient that is delayed in subsequent queue
45870 runs until the retry time is reached. You can delay the recipient without
45871 reference to the sender (which is what earlier versions of Exim did), by
45872 setting <option>address_retry_include_sender</option> false. However, this can lead to
45873 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
45874 </para>
45875 <para>
45876 <indexterm role="option">
45877 <primary><option>allow_localhost</option></primary>
45878 </indexterm>
45879 </para>
45880 <informaltable frame="all">
45881 <tgroup cols="4" colsep="0" rowsep="0">
45882 <colspec colwidth="8*" align="left"/>
45883 <colspec colwidth="6*" align="center"/>
45884 <colspec colwidth="6*" align="center"/>
45885 <colspec colwidth="6*" align="right"/>
45886 <tbody>
45887 <row>
45888 <entry><option>allow_localhost</option></entry>
45889 <entry>Use: <emphasis>smtp</emphasis></entry>
45890 <entry>Type: <emphasis>boolean</emphasis></entry>
45891 <entry>Default: <emphasis>false</emphasis></entry>
45892 </row>
45893 </tbody>
45894 </tgroup>
45895 </informaltable>
45896 <para>
45897 <indexterm role="concept">
45898 <primary>local host</primary>
45899 <secondary>sending to</secondary>
45900 </indexterm>
45901 <indexterm role="concept">
45902 <primary>fallback</primary>
45903 <secondary>hosts specified on transport</secondary>
45904 </indexterm>
45905 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
45906 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
45907 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
45908 the delivery anyway. This should be used only in special cases when the
45909 configuration ensures that no looping will result (for example, a differently
45910 configured Exim is listening on the port to which the message is sent).
45911 </para>
45912 <para>
45913 <indexterm role="option">
45914 <primary><option>authenticated_sender</option></primary>
45915 </indexterm>
45916 </para>
45917 <informaltable frame="all">
45918 <tgroup cols="4" colsep="0" rowsep="0">
45919 <colspec colwidth="8*" align="left"/>
45920 <colspec colwidth="6*" align="center"/>
45921 <colspec colwidth="6*" align="center"/>
45922 <colspec colwidth="6*" align="right"/>
45923 <tbody>
45924 <row>
45925 <entry><option>authenticated_sender</option></entry>
45926 <entry>Use: <emphasis>smtp</emphasis></entry>
45927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45928 <entry>Default: <emphasis>unset</emphasis></entry>
45929 </row>
45930 </tbody>
45931 </tgroup>
45932 </informaltable>
45933 <para>
45934 <indexterm role="concept">
45935 <primary>Cyrus</primary>
45936 </indexterm>
45937 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
45938 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
45939 overriding any existing authenticated sender value. If the string expansion is
45940 forced to fail, the option is ignored. Other expansion failures cause delivery
45941 to be deferred. If the result of expansion is an empty string, that is also
45942 ignored.
45943 </para>
45944 <para>
45945 The expansion happens after the outgoing connection has been made and TLS
45946 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
45947 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
45948 particular connection.
45949 </para>
45950 <para>
45951 If the SMTP session is not authenticated, the expansion of
45952 <option>authenticated_sender</option> still happens (and can cause the delivery to be
45953 deferred if it fails), but no AUTH= item is added to MAIL commands
45954 unless <option>authenticated_sender_force</option> is true.
45955 </para>
45956 <para>
45957 This option allows you to use the <command>smtp</command> transport in LMTP mode to
45958 deliver mail to Cyrus IMAP and provide the proper local part as the
45959 <quote>authenticated sender</quote>, via a setting such as:
45960 </para>
45961 <literallayout class="monospaced">
45962 authenticated_sender = $local_part
45963 </literallayout>
45964 <para>
45965 This removes the need for IMAP subfolders to be assigned special ACLs to
45966 allow direct delivery to those subfolders.
45967 </para>
45968 <para>
45969 Because of expected uses such as that just described for Cyrus (when no
45970 domain is involved), there is no checking on the syntax of the provided
45971 value.
45972 </para>
45973 <para>
45974 <indexterm role="option">
45975 <primary><option>authenticated_sender_force</option></primary>
45976 </indexterm>
45977 </para>
45978 <informaltable frame="all">
45979 <tgroup cols="4" colsep="0" rowsep="0">
45980 <colspec colwidth="8*" align="left"/>
45981 <colspec colwidth="6*" align="center"/>
45982 <colspec colwidth="6*" align="center"/>
45983 <colspec colwidth="6*" align="right"/>
45984 <tbody>
45985 <row>
45986 <entry><option>authenticated_sender_force</option></entry>
45987 <entry>Use: <emphasis>smtp</emphasis></entry>
45988 <entry>Type: <emphasis>boolean</emphasis></entry>
45989 <entry>Default: <emphasis>false</emphasis></entry>
45990 </row>
45991 </tbody>
45992 </tgroup>
45993 </informaltable>
45994 <para>
45995 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
45996 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
45997 authenticated as a client.
45998 </para>
45999 <para>
46000 <indexterm role="option">
46001 <primary><option>command_timeout</option></primary>
46002 </indexterm>
46003 </para>
46004 <informaltable frame="all">
46005 <tgroup cols="4" colsep="0" rowsep="0">
46006 <colspec colwidth="8*" align="left"/>
46007 <colspec colwidth="6*" align="center"/>
46008 <colspec colwidth="6*" align="center"/>
46009 <colspec colwidth="6*" align="right"/>
46010 <tbody>
46011 <row>
46012 <entry><option>command_timeout</option></entry>
46013 <entry>Use: <emphasis>smtp</emphasis></entry>
46014 <entry>Type: <emphasis>time</emphasis></entry>
46015 <entry>Default: <emphasis>5m</emphasis></entry>
46016 </row>
46017 </tbody>
46018 </tgroup>
46019 </informaltable>
46020 <para>
46021 This sets a timeout for receiving a response to an SMTP command that has been
46022 sent out. It is also used when waiting for the initial banner line from the
46023 remote host. Its value must not be zero.
46024 </para>
46025 <para>
46026 <indexterm role="option">
46027 <primary><option>connect_timeout</option></primary>
46028 </indexterm>
46029 </para>
46030 <informaltable frame="all">
46031 <tgroup cols="4" colsep="0" rowsep="0">
46032 <colspec colwidth="8*" align="left"/>
46033 <colspec colwidth="6*" align="center"/>
46034 <colspec colwidth="6*" align="center"/>
46035 <colspec colwidth="6*" align="right"/>
46036 <tbody>
46037 <row>
46038 <entry><option>connect_timeout</option></entry>
46039 <entry>Use: <emphasis>smtp</emphasis></entry>
46040 <entry>Type: <emphasis>time</emphasis></entry>
46041 <entry>Default: <emphasis>5m</emphasis></entry>
46042 </row>
46043 </tbody>
46044 </tgroup>
46045 </informaltable>
46046 <para>
46047 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
46048 to a remote host. A setting of zero allows the system timeout (typically
46049 several minutes) to act. To have any effect, the value of this option must be
46050 less than the system timeout. However, it has been observed that on some
46051 systems there is no system timeout, which is why the default value for this
46052 option is 5 minutes, a value recommended by RFC 1123.
46053 </para>
46054 <para>
46055 <indexterm role="option">
46056 <primary><option>connection_max_messages</option></primary>
46057 </indexterm>
46058 </para>
46059 <informaltable frame="all">
46060 <tgroup cols="4" colsep="0" rowsep="0">
46061 <colspec colwidth="8*" align="left"/>
46062 <colspec colwidth="6*" align="center"/>
46063 <colspec colwidth="6*" align="center"/>
46064 <colspec colwidth="6*" align="right"/>
46065 <tbody>
46066 <row>
46067 <entry><option>connection_max_messages</option></entry>
46068 <entry>Use: <emphasis>smtp</emphasis></entry>
46069 <entry>Type: <emphasis>integer</emphasis></entry>
46070 <entry>Default: <emphasis>500</emphasis></entry>
46071 </row>
46072 </tbody>
46073 </tgroup>
46074 </informaltable>
46075 <para>
46076 <indexterm role="concept">
46077 <primary>SMTP</primary>
46078 <secondary>passed connection</secondary>
46079 </indexterm>
46080 <indexterm role="concept">
46081 <primary>SMTP</primary>
46082 <secondary>multiple deliveries</secondary>
46083 </indexterm>
46084 <indexterm role="concept">
46085 <primary>multiple SMTP deliveries</primary>
46086 </indexterm>
46087 This controls the maximum number of separate message deliveries that are sent
46088 over a single TCP/IP connection. If the value is zero, there is no limit.
46089 For testing purposes, this value can be overridden by the <option>-oB</option> command line
46090 option.
46091 </para>
46092 <para>
46093 <indexterm role="option">
46094 <primary><option>data_timeout</option></primary>
46095 </indexterm>
46096 </para>
46097 <informaltable frame="all">
46098 <tgroup cols="4" colsep="0" rowsep="0">
46099 <colspec colwidth="8*" align="left"/>
46100 <colspec colwidth="6*" align="center"/>
46101 <colspec colwidth="6*" align="center"/>
46102 <colspec colwidth="6*" align="right"/>
46103 <tbody>
46104 <row>
46105 <entry><option>data_timeout</option></entry>
46106 <entry>Use: <emphasis>smtp</emphasis></entry>
46107 <entry>Type: <emphasis>time</emphasis></entry>
46108 <entry>Default: <emphasis>5m</emphasis></entry>
46109 </row>
46110 </tbody>
46111 </tgroup>
46112 </informaltable>
46113 <para>
46114 This sets a timeout for the transmission of each block in the data portion of
46115 the message. As a result, the overall timeout for a message depends on the size
46116 of the message. Its value must not be zero. See also <option>final_timeout</option>.
46117 </para>
46118 <para>
46119 <indexterm role="option">
46120 <primary><option>dkim_domain</option></primary>
46121 </indexterm>
46122 </para>
46123 <informaltable frame="all">
46124 <tgroup cols="4" colsep="0" rowsep="0">
46125 <colspec colwidth="8*" align="left"/>
46126 <colspec colwidth="6*" align="center"/>
46127 <colspec colwidth="6*" align="center"/>
46128 <colspec colwidth="6*" align="right"/>
46129 <tbody>
46130 <row>
46131 <entry><option>dkim_domain</option></entry>
46132 <entry>Use: <emphasis>smtp</emphasis></entry>
46133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46134 <entry>Default: <emphasis>unset</emphasis></entry>
46135 </row>
46136 </tbody>
46137 </tgroup>
46138 </informaltable>
46139 <para>
46140 <indexterm role="option">
46141 <primary><option>dkim_selector</option></primary>
46142 </indexterm>
46143 </para>
46144 <informaltable frame="all">
46145 <tgroup cols="4" colsep="0" rowsep="0">
46146 <colspec colwidth="8*" align="left"/>
46147 <colspec colwidth="6*" align="center"/>
46148 <colspec colwidth="6*" align="center"/>
46149 <colspec colwidth="6*" align="right"/>
46150 <tbody>
46151 <row>
46152 <entry><option>dkim_selector</option></entry>
46153 <entry>Use: <emphasis>smtp</emphasis></entry>
46154 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46155 <entry>Default: <emphasis>unset</emphasis></entry>
46156 </row>
46157 </tbody>
46158 </tgroup>
46159 </informaltable>
46160 <para>
46161 <indexterm role="option">
46162 <primary><option>dkim_private_key</option></primary>
46163 </indexterm>
46164 </para>
46165 <informaltable frame="all">
46166 <tgroup cols="4" colsep="0" rowsep="0">
46167 <colspec colwidth="8*" align="left"/>
46168 <colspec colwidth="6*" align="center"/>
46169 <colspec colwidth="6*" align="center"/>
46170 <colspec colwidth="6*" align="right"/>
46171 <tbody>
46172 <row>
46173 <entry><option>dkim_private_key</option></entry>
46174 <entry>Use: <emphasis>smtp</emphasis></entry>
46175 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46176 <entry>Default: <emphasis>unset</emphasis></entry>
46177 </row>
46178 </tbody>
46179 </tgroup>
46180 </informaltable>
46181 <para>
46182 <indexterm role="option">
46183 <primary><option>dkim_canon</option></primary>
46184 </indexterm>
46185 </para>
46186 <informaltable frame="all">
46187 <tgroup cols="4" colsep="0" rowsep="0">
46188 <colspec colwidth="8*" align="left"/>
46189 <colspec colwidth="6*" align="center"/>
46190 <colspec colwidth="6*" align="center"/>
46191 <colspec colwidth="6*" align="right"/>
46192 <tbody>
46193 <row>
46194 <entry><option>dkim_canon</option></entry>
46195 <entry>Use: <emphasis>smtp</emphasis></entry>
46196 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46197 <entry>Default: <emphasis>unset</emphasis></entry>
46198 </row>
46199 </tbody>
46200 </tgroup>
46201 </informaltable>
46202 <para>
46203 <indexterm role="option">
46204 <primary><option>dkim_strict</option></primary>
46205 </indexterm>
46206 </para>
46207 <informaltable frame="all">
46208 <tgroup cols="4" colsep="0" rowsep="0">
46209 <colspec colwidth="8*" align="left"/>
46210 <colspec colwidth="6*" align="center"/>
46211 <colspec colwidth="6*" align="center"/>
46212 <colspec colwidth="6*" align="right"/>
46213 <tbody>
46214 <row>
46215 <entry><option>dkim_strict</option></entry>
46216 <entry>Use: <emphasis>smtp</emphasis></entry>
46217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46218 <entry>Default: <emphasis>unset</emphasis></entry>
46219 </row>
46220 </tbody>
46221 </tgroup>
46222 </informaltable>
46223 <para>
46224 <indexterm role="option">
46225 <primary><option>dkim_sign_headers</option></primary>
46226 </indexterm>
46227 </para>
46228 <informaltable frame="all">
46229 <tgroup cols="4" colsep="0" rowsep="0">
46230 <colspec colwidth="8*" align="left"/>
46231 <colspec colwidth="6*" align="center"/>
46232 <colspec colwidth="6*" align="center"/>
46233 <colspec colwidth="6*" align="right"/>
46234 <tbody>
46235 <row>
46236 <entry><option>dkim_sign_headers</option></entry>
46237 <entry>Use: <emphasis>smtp</emphasis></entry>
46238 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46239 <entry>Default: <emphasis>unset</emphasis></entry>
46240 </row>
46241 </tbody>
46242 </tgroup>
46243 </informaltable>
46244 <para>
46245 DKIM signing options.  For details see section <xref linkend="SECDKIMSIGN"/>.
46246 </para>
46247 <para>
46248 <indexterm role="option">
46249 <primary><option>delay_after_cutoff</option></primary>
46250 </indexterm>
46251 </para>
46252 <informaltable frame="all">
46253 <tgroup cols="4" colsep="0" rowsep="0">
46254 <colspec colwidth="8*" align="left"/>
46255 <colspec colwidth="6*" align="center"/>
46256 <colspec colwidth="6*" align="center"/>
46257 <colspec colwidth="6*" align="right"/>
46258 <tbody>
46259 <row>
46260 <entry><option>delay_after_cutoff</option></entry>
46261 <entry>Use: <emphasis>smtp</emphasis></entry>
46262 <entry>Type: <emphasis>boolean</emphasis></entry>
46263 <entry>Default: <emphasis>true</emphasis></entry>
46264 </row>
46265 </tbody>
46266 </tgroup>
46267 </informaltable>
46268 <para>
46269 This option controls what happens when all remote IP addresses for a given
46270 domain have been inaccessible for so long that they have passed their retry
46271 cutoff times.
46272 </para>
46273 <para>
46274 In the default state, if the next retry time has not been reached for any of
46275 them, the address is bounced without trying any deliveries. In other words,
46276 Exim delays retrying an IP address after the final cutoff time until a new
46277 retry time is reached, and can therefore bounce an address without ever trying
46278 a delivery, when machines have been down for a long time. Some people are
46279 unhappy at this prospect, so...
46280 </para>
46281 <para>
46282 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
46283 addresses are past their final cutoff time, Exim tries to deliver to those
46284 IP addresses that have not been tried since the message arrived. If there are
46285 none, of if they all fail, the address is bounced. In other words, it does not
46286 delay when a new message arrives, but immediately tries those expired IP
46287 addresses that haven&#x2019;t been tried since the message arrived. If there is a
46288 continuous stream of messages for the dead hosts, unsetting
46289 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
46290 to them.
46291 </para>
46292 <para>
46293 <indexterm role="option">
46294 <primary><option>dns_qualify_single</option></primary>
46295 </indexterm>
46296 </para>
46297 <informaltable frame="all">
46298 <tgroup cols="4" colsep="0" rowsep="0">
46299 <colspec colwidth="8*" align="left"/>
46300 <colspec colwidth="6*" align="center"/>
46301 <colspec colwidth="6*" align="center"/>
46302 <colspec colwidth="6*" align="right"/>
46303 <tbody>
46304 <row>
46305 <entry><option>dns_qualify_single</option></entry>
46306 <entry>Use: <emphasis>smtp</emphasis></entry>
46307 <entry>Type: <emphasis>boolean</emphasis></entry>
46308 <entry>Default: <emphasis>true</emphasis></entry>
46309 </row>
46310 </tbody>
46311 </tgroup>
46312 </informaltable>
46313 <para>
46314 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
46315 and the <option>gethostbyname</option> option is false,
46316 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
46317 in chapter <xref linkend="CHAPdnslookup"/> for more details.
46318 </para>
46319 <para>
46320 <indexterm role="option">
46321 <primary><option>dns_search_parents</option></primary>
46322 </indexterm>
46323 </para>
46324 <informaltable frame="all">
46325 <tgroup cols="4" colsep="0" rowsep="0">
46326 <colspec colwidth="8*" align="left"/>
46327 <colspec colwidth="6*" align="center"/>
46328 <colspec colwidth="6*" align="center"/>
46329 <colspec colwidth="6*" align="right"/>
46330 <tbody>
46331 <row>
46332 <entry><option>dns_search_parents</option></entry>
46333 <entry>Use: <emphasis>smtp</emphasis></entry>
46334 <entry>Type: <emphasis>boolean</emphasis></entry>
46335 <entry>Default: <emphasis>false</emphasis></entry>
46336 </row>
46337 </tbody>
46338 </tgroup>
46339 </informaltable>
46340 <para>
46341 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
46342 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
46343 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
46344 details.
46345 </para>
46346 <para>
46347 <indexterm role="option">
46348 <primary><option>dnssec_request_domains</option></primary>
46349 </indexterm>
46350 </para>
46351 <informaltable frame="all">
46352 <tgroup cols="4" colsep="0" rowsep="0">
46353 <colspec colwidth="8*" align="left"/>
46354 <colspec colwidth="6*" align="center"/>
46355 <colspec colwidth="6*" align="center"/>
46356 <colspec colwidth="6*" align="right"/>
46357 <tbody>
46358 <row>
46359 <entry><option>dnssec_request_domains</option></entry>
46360 <entry>Use: <emphasis>smtp</emphasis></entry>
46361 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46362 <entry>Default: <emphasis>unset</emphasis></entry>
46363 </row>
46364 </tbody>
46365 </tgroup>
46366 </informaltable>
46367 <para>
46368 <indexterm role="concept">
46369 <primary>MX record</primary>
46370 <secondary>security</secondary>
46371 </indexterm>
46372 <indexterm role="concept">
46373 <primary>DNSSEC</primary>
46374 <secondary>MX lookup</secondary>
46375 </indexterm>
46376 <indexterm role="concept">
46377 <primary>security</primary>
46378 <secondary>MX lookup</secondary>
46379 </indexterm>
46380 <indexterm role="concept">
46381 <primary>DNS</primary>
46382 <secondary>DNSSEC</secondary>
46383 </indexterm>
46384 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
46385 the dnssec request bit set.
46386 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46387 </para>
46388 <para>
46389 <indexterm role="option">
46390 <primary><option>dnssec_require_domains</option></primary>
46391 </indexterm>
46392 </para>
46393 <informaltable frame="all">
46394 <tgroup cols="4" colsep="0" rowsep="0">
46395 <colspec colwidth="8*" align="left"/>
46396 <colspec colwidth="6*" align="center"/>
46397 <colspec colwidth="6*" align="center"/>
46398 <colspec colwidth="6*" align="right"/>
46399 <tbody>
46400 <row>
46401 <entry><option>dnssec_require_domains</option></entry>
46402 <entry>Use: <emphasis>smtp</emphasis></entry>
46403 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46404 <entry>Default: <emphasis>unset</emphasis></entry>
46405 </row>
46406 </tbody>
46407 </tgroup>
46408 </informaltable>
46409 <para>
46410 <indexterm role="concept">
46411 <primary>MX record</primary>
46412 <secondary>security</secondary>
46413 </indexterm>
46414 <indexterm role="concept">
46415 <primary>DNSSEC</primary>
46416 <secondary>MX lookup</secondary>
46417 </indexterm>
46418 <indexterm role="concept">
46419 <primary>security</primary>
46420 <secondary>MX lookup</secondary>
46421 </indexterm>
46422 <indexterm role="concept">
46423 <primary>DNS</primary>
46424 <secondary>DNSSEC</secondary>
46425 </indexterm>
46426 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
46427 the dnssec request bit set.  Any returns not having the Authenticated Data bit
46428 (AD bit) set will be ignored and logged as a host-lookup failure.
46429 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46430 </para>
46431 <para>
46432 <indexterm role="option">
46433 <primary><option>dscp</option></primary>
46434 </indexterm>
46435 </para>
46436 <informaltable frame="all">
46437 <tgroup cols="4" colsep="0" rowsep="0">
46438 <colspec colwidth="8*" align="left"/>
46439 <colspec colwidth="6*" align="center"/>
46440 <colspec colwidth="6*" align="center"/>
46441 <colspec colwidth="6*" align="right"/>
46442 <tbody>
46443 <row>
46444 <entry><option>dscp</option></entry>
46445 <entry>Use: <emphasis>smtp</emphasis></entry>
46446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46447 <entry>Default: <emphasis>unset</emphasis></entry>
46448 </row>
46449 </tbody>
46450 </tgroup>
46451 </informaltable>
46452 <para>
46453 <indexterm role="concept">
46454 <primary>DCSP</primary>
46455 <secondary>outbound</secondary>
46456 </indexterm>
46457 This option causes the DSCP value associated with a socket to be set to one
46458 of a number of fixed strings or to numeric value.
46459 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
46460 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
46461 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
46462 </para>
46463 <para>
46464 The outbound packets from Exim will be marked with this value in the header
46465 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
46466 that these values will have any effect, not be stripped by networking
46467 equipment, or do much of anything without cooperation with your Network
46468 Engineer and those of all network operators between the source and destination.
46469 </para>
46470 <para>
46471 <indexterm role="option">
46472 <primary><option>fallback_hosts</option></primary>
46473 </indexterm>
46474 </para>
46475 <informaltable frame="all">
46476 <tgroup cols="4" colsep="0" rowsep="0">
46477 <colspec colwidth="8*" align="left"/>
46478 <colspec colwidth="6*" align="center"/>
46479 <colspec colwidth="6*" align="center"/>
46480 <colspec colwidth="6*" align="right"/>
46481 <tbody>
46482 <row>
46483 <entry><option>fallback_hosts</option></entry>
46484 <entry>Use: <emphasis>smtp</emphasis></entry>
46485 <entry>Type: <emphasis>string list</emphasis></entry>
46486 <entry>Default: <emphasis>unset</emphasis></entry>
46487 </row>
46488 </tbody>
46489 </tgroup>
46490 </informaltable>
46491 <para>
46492 <indexterm role="concept">
46493 <primary>fallback</primary>
46494 <secondary>hosts specified on transport</secondary>
46495 </indexterm>
46496 String expansion is not applied to this option. The argument must be a
46497 colon-separated list of host names or IP addresses, optionally also including
46498 port numbers, though the separator can be changed, as described in section
46499 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46500 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46501 in section <xref linkend="SECTformatonehostitem"/>.
46502 </para>
46503 <para>
46504 Fallback hosts can also be specified on routers, which associate them with the
46505 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
46506 <option>fallback_hosts</option> specified on the transport is used only if the address does
46507 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
46508 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
46509 However, <option>hosts_randomize</option> does apply to fallback host lists.
46510 </para>
46511 <para>
46512 If Exim is unable to deliver to any of the hosts for a particular address, and
46513 the errors are not permanent rejections, the address is put on a separate
46514 transport queue with its host list replaced by the fallback hosts, unless the
46515 address was routed via MX records and the current host was in the original MX
46516 list. In that situation, the fallback host list is not used.
46517 </para>
46518 <para>
46519 Once normal deliveries are complete, the fallback queue is delivered by
46520 re-running the same transports with the new host lists. If several failing
46521 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
46522 copy of the message is sent.
46523 </para>
46524 <para>
46525 The resolution of the host names on the fallback list is controlled by the
46526 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
46527 both to cases when the host list comes with the address and when it is taken
46528 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
46529 fails</quote> facility.
46530 </para>
46531 <para>
46532 <indexterm role="option">
46533 <primary><option>final_timeout</option></primary>
46534 </indexterm>
46535 </para>
46536 <informaltable frame="all">
46537 <tgroup cols="4" colsep="0" rowsep="0">
46538 <colspec colwidth="8*" align="left"/>
46539 <colspec colwidth="6*" align="center"/>
46540 <colspec colwidth="6*" align="center"/>
46541 <colspec colwidth="6*" align="right"/>
46542 <tbody>
46543 <row>
46544 <entry><option>final_timeout</option></entry>
46545 <entry>Use: <emphasis>smtp</emphasis></entry>
46546 <entry>Type: <emphasis>time</emphasis></entry>
46547 <entry>Default: <emphasis>10m</emphasis></entry>
46548 </row>
46549 </tbody>
46550 </tgroup>
46551 </informaltable>
46552 <para>
46553 This is the timeout that applies while waiting for the response to the final
46554 line containing just <quote>.</quote> that terminates a message. Its value must not be
46555 zero.
46556 </para>
46557 <para>
46558 <indexterm role="option">
46559 <primary><option>gethostbyname</option></primary>
46560 </indexterm>
46561 </para>
46562 <informaltable frame="all">
46563 <tgroup cols="4" colsep="0" rowsep="0">
46564 <colspec colwidth="8*" align="left"/>
46565 <colspec colwidth="6*" align="center"/>
46566 <colspec colwidth="6*" align="center"/>
46567 <colspec colwidth="6*" align="right"/>
46568 <tbody>
46569 <row>
46570 <entry><option>gethostbyname</option></entry>
46571 <entry>Use: <emphasis>smtp</emphasis></entry>
46572 <entry>Type: <emphasis>boolean</emphasis></entry>
46573 <entry>Default: <emphasis>false</emphasis></entry>
46574 </row>
46575 </tbody>
46576 </tgroup>
46577 </informaltable>
46578 <para>
46579 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
46580 being used, names are looked up using <function>gethostbyname()</function>
46581 (or <function>getipnodebyname()</function> when available)
46582 instead of using the DNS. Of course, that function may in fact use the DNS, but
46583 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
46584 </para>
46585 <para>
46586 <indexterm role="option">
46587 <primary><option>gnutls_compat_mode</option></primary>
46588 </indexterm>
46589 </para>
46590 <informaltable frame="all">
46591 <tgroup cols="4" colsep="0" rowsep="0">
46592 <colspec colwidth="8*" align="left"/>
46593 <colspec colwidth="6*" align="center"/>
46594 <colspec colwidth="6*" align="center"/>
46595 <colspec colwidth="6*" align="right"/>
46596 <tbody>
46597 <row>
46598 <entry><option>gnutls_compat_mode</option></entry>
46599 <entry>Use: <emphasis>smtp</emphasis></entry>
46600 <entry>Type: <emphasis>boolean</emphasis></entry>
46601 <entry>Default: <emphasis>unset</emphasis></entry>
46602 </row>
46603 </tbody>
46604 </tgroup>
46605 </informaltable>
46606 <para>
46607 This option controls whether GnuTLS is used in compatibility mode in an Exim
46608 server. This reduces security slightly, but improves interworking with older
46609 implementations of TLS.
46610 </para>
46611 <para>
46612 <indexterm role="option">
46613 <primary><option>helo_data</option></primary>
46614 </indexterm>
46615 </para>
46616 <informaltable frame="all">
46617 <tgroup cols="4" colsep="0" rowsep="0">
46618 <colspec colwidth="8*" align="left"/>
46619 <colspec colwidth="6*" align="center"/>
46620 <colspec colwidth="6*" align="center"/>
46621 <colspec colwidth="6*" align="right"/>
46622 <tbody>
46623 <row>
46624 <entry><option>helo_data</option></entry>
46625 <entry>Use: <emphasis>smtp</emphasis></entry>
46626 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46627 <entry>Default: <emphasis>see below</emphasis></entry>
46628 </row>
46629 </tbody>
46630 </tgroup>
46631 </informaltable>
46632 <para>
46633 <indexterm role="concept">
46634 <primary>HELO</primary>
46635 <secondary>argument, setting</secondary>
46636 </indexterm>
46637 <indexterm role="concept">
46638 <primary>EHLO</primary>
46639 <secondary>argument, setting</secondary>
46640 </indexterm>
46641 <indexterm role="concept">
46642 <primary>LHLO argument setting</primary>
46643 </indexterm>
46644 The value of this option is expanded after a connection to a another host has
46645 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
46646 command that starts the outgoing SMTP or LMTP session. The default value of the
46647 option is:
46648 </para>
46649 <literallayout class="monospaced">
46650 $primary_hostname
46651 </literallayout>
46652 <para>
46653 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
46654 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
46655 <varname>$sending_port</varname> are set to the local IP address and port number that are being
46656 used. These variables can be used to generate different values for different
46657 servers or different local IP addresses. For example, if you want the string
46658 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
46659 interface address, you could use this:
46660 </para>
46661 <literallayout class="monospaced">
46662 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
46663   {$primary_hostname}}
46664 </literallayout>
46665 <para>
46666 The use of <option>helo_data</option> applies both to sending messages and when doing
46667 callouts.
46668 </para>
46669 <para>
46670 <indexterm role="option">
46671 <primary><option>hosts</option></primary>
46672 </indexterm>
46673 </para>
46674 <informaltable frame="all">
46675 <tgroup cols="4" colsep="0" rowsep="0">
46676 <colspec colwidth="8*" align="left"/>
46677 <colspec colwidth="6*" align="center"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="right"/>
46680 <tbody>
46681 <row>
46682 <entry><option>hosts</option></entry>
46683 <entry>Use: <emphasis>smtp</emphasis></entry>
46684 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46685 <entry>Default: <emphasis>unset</emphasis></entry>
46686 </row>
46687 </tbody>
46688 </tgroup>
46689 </informaltable>
46690 <para>
46691 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
46692 finds the hosts by looking up the address domain in the DNS, or by
46693 <command>manualroute</command>, which has lists of hosts in its configuration. However,
46694 email addresses can be passed to the <command>smtp</command> transport by any router, and not
46695 all of them can provide an associated list of hosts.
46696 </para>
46697 <para>
46698 The <option>hosts</option> option specifies a list of hosts to be used if the address being
46699 processed does not have any hosts associated with it. The hosts specified by
46700 <option>hosts</option> are also used, whether or not the address has its own hosts, if
46701 <option>hosts_override</option> is set.
46702 </para>
46703 <para>
46704 The string is first expanded, before being interpreted as a colon-separated
46705 list of host names or IP addresses, possibly including port numbers. The
46706 separator may be changed to something other than colon, as described in section
46707 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46708 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46709 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
46710 of the <command>manualroute</command> router is not available here.
46711 </para>
46712 <para>
46713 If the expansion fails, delivery is deferred. Unless the failure was caused by
46714 the inability to complete a lookup, the error is logged to the panic log as
46715 well as the main log. Host names are looked up either by searching directly for
46716 address records in the DNS or by calling <function>gethostbyname()</function> (or
46717 <function>getipnodebyname()</function> when available), depending on the setting of the
46718 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
46719 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
46720 address are used.
46721 </para>
46722 <para>
46723 During delivery, the hosts are tried in order, subject to their retry status,
46724 unless <option>hosts_randomize</option> is set.
46725 </para>
46726 <para>
46727 <indexterm role="option">
46728 <primary><option>hosts_avoid_esmtp</option></primary>
46729 </indexterm>
46730 </para>
46731 <informaltable frame="all">
46732 <tgroup cols="4" colsep="0" rowsep="0">
46733 <colspec colwidth="8*" align="left"/>
46734 <colspec colwidth="6*" align="center"/>
46735 <colspec colwidth="6*" align="center"/>
46736 <colspec colwidth="6*" align="right"/>
46737 <tbody>
46738 <row>
46739 <entry><option>hosts_avoid_esmtp</option></entry>
46740 <entry>Use: <emphasis>smtp</emphasis></entry>
46741 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46742 <entry>Default: <emphasis>unset</emphasis></entry>
46743 </row>
46744 </tbody>
46745 </tgroup>
46746 </informaltable>
46747 <para>
46748 <indexterm role="concept">
46749 <primary>ESMTP, avoiding use of</primary>
46750 </indexterm>
46751 <indexterm role="concept">
46752 <primary>HELO</primary>
46753 <secondary>forcing use of</secondary>
46754 </indexterm>
46755 <indexterm role="concept">
46756 <primary>EHLO</primary>
46757 <secondary>avoiding use of</secondary>
46758 </indexterm>
46759 <indexterm role="concept">
46760 <primary>PIPELINING</primary>
46761 <secondary>avoiding the use of</secondary>
46762 </indexterm>
46763 This option is for use with broken hosts that announce ESMTP facilities (for
46764 example, PIPELINING) and then fail to implement them properly. When a host
46765 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
46766 start of the SMTP session. This means that it cannot use any of the ESMTP
46767 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
46768 </para>
46769 <para>
46770 <indexterm role="option">
46771 <primary><option>hosts_avoid_pipelining</option></primary>
46772 </indexterm>
46773 </para>
46774 <informaltable frame="all">
46775 <tgroup cols="4" colsep="0" rowsep="0">
46776 <colspec colwidth="8*" align="left"/>
46777 <colspec colwidth="6*" align="center"/>
46778 <colspec colwidth="6*" align="center"/>
46779 <colspec colwidth="6*" align="right"/>
46780 <tbody>
46781 <row>
46782 <entry><option>hosts_avoid_pipelining</option></entry>
46783 <entry>Use: <emphasis>smtp</emphasis></entry>
46784 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46785 <entry>Default: <emphasis>unset</emphasis></entry>
46786 </row>
46787 </tbody>
46788 </tgroup>
46789 </informaltable>
46790 <para>
46791 <indexterm role="concept">
46792 <primary>PIPELINING</primary>
46793 <secondary>avoiding the use of</secondary>
46794 </indexterm>
46795 Exim will not use the SMTP PIPELINING extension when delivering to any host
46796 that matches this list, even if the server host advertises PIPELINING support.
46797 </para>
46798 <para>
46799 <indexterm role="option">
46800 <primary><option>hosts_avoid_tls</option></primary>
46801 </indexterm>
46802 </para>
46803 <informaltable frame="all">
46804 <tgroup cols="4" colsep="0" rowsep="0">
46805 <colspec colwidth="8*" align="left"/>
46806 <colspec colwidth="6*" align="center"/>
46807 <colspec colwidth="6*" align="center"/>
46808 <colspec colwidth="6*" align="right"/>
46809 <tbody>
46810 <row>
46811 <entry><option>hosts_avoid_tls</option></entry>
46812 <entry>Use: <emphasis>smtp</emphasis></entry>
46813 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46814 <entry>Default: <emphasis>unset</emphasis></entry>
46815 </row>
46816 </tbody>
46817 </tgroup>
46818 </informaltable>
46819 <para>
46820 <indexterm role="concept">
46821 <primary>TLS</primary>
46822 <secondary>avoiding for certain hosts</secondary>
46823 </indexterm>
46824 Exim will not try to start a TLS session when delivering to any host that
46825 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46826 </para>
46827 <para>
46828 <indexterm role="option">
46829 <primary><option>hosts_verify_avoid_tls</option></primary>
46830 </indexterm>
46831 </para>
46832 <informaltable frame="all">
46833 <tgroup cols="4" colsep="0" rowsep="0">
46834 <colspec colwidth="8*" align="left"/>
46835 <colspec colwidth="6*" align="center"/>
46836 <colspec colwidth="6*" align="center"/>
46837 <colspec colwidth="6*" align="right"/>
46838 <tbody>
46839 <row>
46840 <entry><option>hosts_verify_avoid_tls</option></entry>
46841 <entry>Use: <emphasis>smtp</emphasis></entry>
46842 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46843 <entry>Default: <emphasis>unset</emphasis></entry>
46844 </row>
46845 </tbody>
46846 </tgroup>
46847 </informaltable>
46848 <para>
46849 <indexterm role="concept">
46850 <primary>TLS</primary>
46851 <secondary>avoiding for certain hosts</secondary>
46852 </indexterm>
46853 Exim will not try to start a TLS session for a verify callout,
46854 or when delivering in cutthrough mode,
46855 to any host that matches this list.
46856 </para>
46857 <para>
46858 <indexterm role="option">
46859 <primary><option>hosts_max_try</option></primary>
46860 </indexterm>
46861 </para>
46862 <informaltable frame="all">
46863 <tgroup cols="4" colsep="0" rowsep="0">
46864 <colspec colwidth="8*" align="left"/>
46865 <colspec colwidth="6*" align="center"/>
46866 <colspec colwidth="6*" align="center"/>
46867 <colspec colwidth="6*" align="right"/>
46868 <tbody>
46869 <row>
46870 <entry><option>hosts_max_try</option></entry>
46871 <entry>Use: <emphasis>smtp</emphasis></entry>
46872 <entry>Type: <emphasis>integer</emphasis></entry>
46873 <entry>Default: <emphasis>5</emphasis></entry>
46874 </row>
46875 </tbody>
46876 </tgroup>
46877 </informaltable>
46878 <para>
46879 <indexterm role="concept">
46880 <primary>host</primary>
46881 <secondary>maximum number to try</secondary>
46882 </indexterm>
46883 <indexterm role="concept">
46884 <primary>limit</primary>
46885 <secondary>number of hosts tried</secondary>
46886 </indexterm>
46887 <indexterm role="concept">
46888 <primary>limit</primary>
46889 <secondary>number of MX tried</secondary>
46890 </indexterm>
46891 <indexterm role="concept">
46892 <primary>MX record</primary>
46893 <secondary>maximum tried</secondary>
46894 </indexterm>
46895 This option limits the number of IP addresses that are tried for any one
46896 delivery in cases where there are temporary delivery errors. Section
46897 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
46898 </para>
46899 <para>
46900 <indexterm role="option">
46901 <primary><option>hosts_max_try_hardlimit</option></primary>
46902 </indexterm>
46903 </para>
46904 <informaltable frame="all">
46905 <tgroup cols="4" colsep="0" rowsep="0">
46906 <colspec colwidth="8*" align="left"/>
46907 <colspec colwidth="6*" align="center"/>
46908 <colspec colwidth="6*" align="center"/>
46909 <colspec colwidth="6*" align="right"/>
46910 <tbody>
46911 <row>
46912 <entry><option>hosts_max_try_hardlimit</option></entry>
46913 <entry>Use: <emphasis>smtp</emphasis></entry>
46914 <entry>Type: <emphasis>integer</emphasis></entry>
46915 <entry>Default: <emphasis>50</emphasis></entry>
46916 </row>
46917 </tbody>
46918 </tgroup>
46919 </informaltable>
46920 <para>
46921 This is an additional check on the maximum number of IP addresses that Exim
46922 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
46923 why it exists.
46924 </para>
46925 <para>
46926 <indexterm role="option">
46927 <primary><option>hosts_nopass_tls</option></primary>
46928 </indexterm>
46929 </para>
46930 <informaltable frame="all">
46931 <tgroup cols="4" colsep="0" rowsep="0">
46932 <colspec colwidth="8*" align="left"/>
46933 <colspec colwidth="6*" align="center"/>
46934 <colspec colwidth="6*" align="center"/>
46935 <colspec colwidth="6*" align="right"/>
46936 <tbody>
46937 <row>
46938 <entry><option>hosts_nopass_tls</option></entry>
46939 <entry>Use: <emphasis>smtp</emphasis></entry>
46940 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46941 <entry>Default: <emphasis>unset</emphasis></entry>
46942 </row>
46943 </tbody>
46944 </tgroup>
46945 </informaltable>
46946 <para>
46947 <indexterm role="concept">
46948 <primary>TLS</primary>
46949 <secondary>passing connection</secondary>
46950 </indexterm>
46951 <indexterm role="concept">
46952 <primary>multiple SMTP deliveries</primary>
46953 </indexterm>
46954 <indexterm role="concept">
46955 <primary>TLS</primary>
46956 <secondary>multiple message deliveries</secondary>
46957 </indexterm>
46958 For any host that matches this list, a connection on which a TLS session has
46959 been started will not be passed to a new delivery process for sending another
46960 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
46961 explanation of when this might be needed.
46962 </para>
46963 <para>
46964 <indexterm role="option">
46965 <primary><option>hosts_override</option></primary>
46966 </indexterm>
46967 </para>
46968 <informaltable frame="all">
46969 <tgroup cols="4" colsep="0" rowsep="0">
46970 <colspec colwidth="8*" align="left"/>
46971 <colspec colwidth="6*" align="center"/>
46972 <colspec colwidth="6*" align="center"/>
46973 <colspec colwidth="6*" align="right"/>
46974 <tbody>
46975 <row>
46976 <entry><option>hosts_override</option></entry>
46977 <entry>Use: <emphasis>smtp</emphasis></entry>
46978 <entry>Type: <emphasis>boolean</emphasis></entry>
46979 <entry>Default: <emphasis>false</emphasis></entry>
46980 </row>
46981 </tbody>
46982 </tgroup>
46983 </informaltable>
46984 <para>
46985 If this option is set and the <option>hosts</option> option is also set, any hosts that are
46986 attached to the address are ignored, and instead the hosts specified by the
46987 <option>hosts</option> option are always used. This option does not apply to
46988 <option>fallback_hosts</option>.
46989 </para>
46990 <para>
46991 <indexterm role="option">
46992 <primary><option>hosts_randomize</option></primary>
46993 </indexterm>
46994 </para>
46995 <informaltable frame="all">
46996 <tgroup cols="4" colsep="0" rowsep="0">
46997 <colspec colwidth="8*" align="left"/>
46998 <colspec colwidth="6*" align="center"/>
46999 <colspec colwidth="6*" align="center"/>
47000 <colspec colwidth="6*" align="right"/>
47001 <tbody>
47002 <row>
47003 <entry><option>hosts_randomize</option></entry>
47004 <entry>Use: <emphasis>smtp</emphasis></entry>
47005 <entry>Type: <emphasis>boolean</emphasis></entry>
47006 <entry>Default: <emphasis>false</emphasis></entry>
47007 </row>
47008 </tbody>
47009 </tgroup>
47010 </informaltable>
47011 <para>
47012 <indexterm role="concept">
47013 <primary>randomized host list</primary>
47014 </indexterm>
47015 <indexterm role="concept">
47016 <primary>host</primary>
47017 <secondary>list of; randomized</secondary>
47018 </indexterm>
47019 <indexterm role="concept">
47020 <primary>fallback</primary>
47021 <secondary>randomized hosts</secondary>
47022 </indexterm>
47023 If this option is set, and either the list of hosts is taken from the
47024 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
47025 were not obtained from MX records (this includes fallback hosts from the
47026 router), and were not randomized by the router, the order of trying the hosts
47027 is randomized each time the transport runs. Randomizing the order of a host
47028 list can be used to do crude load sharing.
47029 </para>
47030 <para>
47031 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
47032 order is separately randomized. This makes it possible to set up MX-like
47033 behaviour. The boundaries between groups are indicated by an item that is just
47034 <literal>+</literal> in the host list. For example:
47035 </para>
47036 <literallayout class="monospaced">
47037 hosts = host1:host2:host3:+:host4:host5
47038 </literallayout>
47039 <para>
47040 The order of the first three hosts and the order of the last two hosts is
47041 randomized for each use, but the first three always end up before the last two.
47042 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
47043 </para>
47044 <para>
47045 <indexterm role="option">
47046 <primary><option>hosts_require_auth</option></primary>
47047 </indexterm>
47048 </para>
47049 <informaltable frame="all">
47050 <tgroup cols="4" colsep="0" rowsep="0">
47051 <colspec colwidth="8*" align="left"/>
47052 <colspec colwidth="6*" align="center"/>
47053 <colspec colwidth="6*" align="center"/>
47054 <colspec colwidth="6*" align="right"/>
47055 <tbody>
47056 <row>
47057 <entry><option>hosts_require_auth</option></entry>
47058 <entry>Use: <emphasis>smtp</emphasis></entry>
47059 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47060 <entry>Default: <emphasis>unset</emphasis></entry>
47061 </row>
47062 </tbody>
47063 </tgroup>
47064 </informaltable>
47065 <para>
47066 <indexterm role="concept">
47067 <primary>authentication</primary>
47068 <secondary>required by client</secondary>
47069 </indexterm>
47070 This option provides a list of servers for which authentication must succeed
47071 before Exim will try to transfer a message. If authentication fails for
47072 servers which are not in this list, Exim tries to send unauthenticated. If
47073 authentication fails for one of these servers, delivery is deferred. This
47074 temporary error is detectable in the retry rules, so it can be turned into a
47075 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
47076 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47077 </para>
47078 <para>
47079 <indexterm role="option">
47080 <primary><option>hosts_request_ocsp</option></primary>
47081 </indexterm>
47082 </para>
47083 <informaltable frame="all">
47084 <tgroup cols="4" colsep="0" rowsep="0">
47085 <colspec colwidth="8*" align="left"/>
47086 <colspec colwidth="6*" align="center"/>
47087 <colspec colwidth="6*" align="center"/>
47088 <colspec colwidth="6*" align="right"/>
47089 <tbody>
47090 <row>
47091 <entry><option>hosts_request_ocsp</option></entry>
47092 <entry>Use: <emphasis>smtp</emphasis></entry>
47093 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47094 <entry>Default: <emphasis>*</emphasis></entry>
47095 </row>
47096 </tbody>
47097 </tgroup>
47098 </informaltable>
47099 <para>
47100 <indexterm role="concept">
47101 <primary>TLS</primary>
47102 <secondary>requiring for certain servers</secondary>
47103 </indexterm>
47104 Exim will request a Certificate Status on a
47105 TLS session for any host that matches this list.
47106 <option>tls_verify_certificates</option> should also be set for the transport.
47107 </para>
47108 <para>
47109 <indexterm role="option">
47110 <primary><option>hosts_require_ocsp</option></primary>
47111 </indexterm>
47112 </para>
47113 <informaltable frame="all">
47114 <tgroup cols="4" colsep="0" rowsep="0">
47115 <colspec colwidth="8*" align="left"/>
47116 <colspec colwidth="6*" align="center"/>
47117 <colspec colwidth="6*" align="center"/>
47118 <colspec colwidth="6*" align="right"/>
47119 <tbody>
47120 <row>
47121 <entry><option>hosts_require_ocsp</option></entry>
47122 <entry>Use: <emphasis>smtp</emphasis></entry>
47123 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47124 <entry>Default: <emphasis>unset</emphasis></entry>
47125 </row>
47126 </tbody>
47127 </tgroup>
47128 </informaltable>
47129 <para>
47130 <indexterm role="concept">
47131 <primary>TLS</primary>
47132 <secondary>requiring for certain servers</secondary>
47133 </indexterm>
47134 Exim will request, and check for a valid Certificate Status being given, on a
47135 TLS session for any host that matches this list.
47136 <option>tls_verify_certificates</option> should also be set for the transport.
47137 </para>
47138 <para>
47139 <indexterm role="option">
47140 <primary><option>hosts_require_tls</option></primary>
47141 </indexterm>
47142 </para>
47143 <informaltable frame="all">
47144 <tgroup cols="4" colsep="0" rowsep="0">
47145 <colspec colwidth="8*" align="left"/>
47146 <colspec colwidth="6*" align="center"/>
47147 <colspec colwidth="6*" align="center"/>
47148 <colspec colwidth="6*" align="right"/>
47149 <tbody>
47150 <row>
47151 <entry><option>hosts_require_tls</option></entry>
47152 <entry>Use: <emphasis>smtp</emphasis></entry>
47153 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47154 <entry>Default: <emphasis>unset</emphasis></entry>
47155 </row>
47156 </tbody>
47157 </tgroup>
47158 </informaltable>
47159 <para>
47160 <indexterm role="concept">
47161 <primary>TLS</primary>
47162 <secondary>requiring for certain servers</secondary>
47163 </indexterm>
47164 Exim will insist on using a TLS session when delivering to any host that
47165 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47166 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
47167 incoming messages, use an appropriate ACL.
47168 </para>
47169 <para>
47170 <indexterm role="option">
47171 <primary><option>hosts_try_auth</option></primary>
47172 </indexterm>
47173 </para>
47174 <informaltable frame="all">
47175 <tgroup cols="4" colsep="0" rowsep="0">
47176 <colspec colwidth="8*" align="left"/>
47177 <colspec colwidth="6*" align="center"/>
47178 <colspec colwidth="6*" align="center"/>
47179 <colspec colwidth="6*" align="right"/>
47180 <tbody>
47181 <row>
47182 <entry><option>hosts_try_auth</option></entry>
47183 <entry>Use: <emphasis>smtp</emphasis></entry>
47184 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47185 <entry>Default: <emphasis>unset</emphasis></entry>
47186 </row>
47187 </tbody>
47188 </tgroup>
47189 </informaltable>
47190 <para>
47191 <indexterm role="concept">
47192 <primary>authentication</primary>
47193 <secondary>optional in client</secondary>
47194 </indexterm>
47195 This option provides a list of servers to which, provided they announce
47196 authentication support, Exim will attempt to authenticate as a client when it
47197 connects. If authentication fails, Exim will try to transfer the message
47198 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
47199 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47200 </para>
47201 <para>
47202 <indexterm role="option">
47203 <primary><option>hosts_try_chunking</option></primary>
47204 </indexterm>
47205 </para>
47206 <informaltable frame="all">
47207 <tgroup cols="4" colsep="0" rowsep="0">
47208 <colspec colwidth="8*" align="left"/>
47209 <colspec colwidth="6*" align="center"/>
47210 <colspec colwidth="6*" align="center"/>
47211 <colspec colwidth="6*" align="right"/>
47212 <tbody>
47213 <row>
47214 <entry><option>hosts_try_chunking</option></entry>
47215 <entry>Use: <emphasis>smtp</emphasis></entry>
47216 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47217 <entry>Default: <emphasis>*</emphasis></entry>
47218 </row>
47219 </tbody>
47220 </tgroup>
47221 </informaltable>
47222 <para>
47223 <indexterm role="concept">
47224 <primary>CHUNKING</primary>
47225 <secondary>enabling, in client</secondary>
47226 </indexterm>
47227 <indexterm role="concept">
47228 <primary>BDAT</primary>
47229 <secondary>SMTP command</secondary>
47230 </indexterm>
47231 <indexterm role="concept">
47232 <primary>RFC 3030</primary>
47233 <secondary>CHUNKING</secondary>
47234 </indexterm>
47235 This option provides a list of servers to which, provided they announce
47236 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
47237 BDAT will not be used in conjunction with a transport filter.
47238 </para>
47239 <para>
47240 <indexterm role="option">
47241 <primary><option>hosts_try_fastopen</option></primary>
47242 </indexterm>
47243 </para>
47244 <informaltable frame="all">
47245 <tgroup cols="4" colsep="0" rowsep="0">
47246 <colspec colwidth="8*" align="left"/>
47247 <colspec colwidth="6*" align="center"/>
47248 <colspec colwidth="6*" align="center"/>
47249 <colspec colwidth="6*" align="right"/>
47250 <tbody>
47251 <row>
47252 <entry><option>hosts_try_fastopen</option></entry>
47253 <entry>Use: <emphasis>smtp</emphasis></entry>
47254 <entry>Type: <emphasis>host list!!</emphasis></entry>
47255 <entry>Default: <emphasis>unset</emphasis></entry>
47256 </row>
47257 </tbody>
47258 </tgroup>
47259 </informaltable>
47260 <para>
47261 <indexterm role="concept">
47262 <primary>fast open, TCP</primary>
47263 <secondary>enabling, in client</secondary>
47264 </indexterm>
47265 <indexterm role="concept">
47266 <primary>TCP Fast Open</primary>
47267 <secondary>enabling, in client</secondary>
47268 </indexterm>
47269 <indexterm role="concept">
47270 <primary>RFC 7413</primary>
47271 <secondary>TCP Fast Open</secondary>
47272 </indexterm>
47273 This option provides a list of servers to which, provided
47274 the facility is supported by this system, Exim will attempt to
47275 perform a TCP Fast Open.
47276 No data is sent on the SYN segment but, if the remote server also
47277 supports the facility, it can send its SMTP banner immediately after
47278 the SYN,ACK segment.  This can save up to one round-trip time.
47279 </para>
47280 <para>
47281 The facility is only active for previously-contacted servers,
47282 as the initiator must present a cookie in the SYN segment.
47283 </para>
47284 <para>
47285 On (at least some) current Linux distributions the facility must be enabled
47286 in the kernel by the sysadmin before the support is usable.
47287 </para>
47288 <para>
47289 <indexterm role="option">
47290 <primary><option>hosts_try_prdr</option></primary>
47291 </indexterm>
47292 </para>
47293 <informaltable frame="all">
47294 <tgroup cols="4" colsep="0" rowsep="0">
47295 <colspec colwidth="8*" align="left"/>
47296 <colspec colwidth="6*" align="center"/>
47297 <colspec colwidth="6*" align="center"/>
47298 <colspec colwidth="6*" align="right"/>
47299 <tbody>
47300 <row>
47301 <entry><option>hosts_try_prdr</option></entry>
47302 <entry>Use: <emphasis>smtp</emphasis></entry>
47303 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47304 <entry>Default: <emphasis>*</emphasis></entry>
47305 </row>
47306 </tbody>
47307 </tgroup>
47308 </informaltable>
47309 <para>
47310 <indexterm role="concept">
47311 <primary>PRDR</primary>
47312 <secondary>enabling, optional in client</secondary>
47313 </indexterm>
47314 This option provides a list of servers to which, provided they announce
47315 PRDR support, Exim will attempt to negotiate PRDR
47316 for multi-recipient messages.
47317 The option can usually be left as default.
47318 </para>
47319 <para>
47320 <indexterm role="option">
47321 <primary><option>interface</option></primary>
47322 </indexterm>
47323 </para>
47324 <informaltable frame="all">
47325 <tgroup cols="4" colsep="0" rowsep="0">
47326 <colspec colwidth="8*" align="left"/>
47327 <colspec colwidth="6*" align="center"/>
47328 <colspec colwidth="6*" align="center"/>
47329 <colspec colwidth="6*" align="right"/>
47330 <tbody>
47331 <row>
47332 <entry><option>interface</option></entry>
47333 <entry>Use: <emphasis>smtp</emphasis></entry>
47334 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47335 <entry>Default: <emphasis>unset</emphasis></entry>
47336 </row>
47337 </tbody>
47338 </tgroup>
47339 </informaltable>
47340 <para>
47341 <indexterm role="concept">
47342 <primary>bind IP address</primary>
47343 </indexterm>
47344 <indexterm role="concept">
47345 <primary>IP address</primary>
47346 <secondary>binding</secondary>
47347 </indexterm>
47348 <indexterm role="variable">
47349 <primary><varname>$host</varname></primary>
47350 </indexterm>
47351 <indexterm role="variable">
47352 <primary><varname>$host_address</varname></primary>
47353 </indexterm>
47354 This option specifies which interface to bind to when making an outgoing SMTP
47355 call. The value is an IP address, not an interface name such as
47356 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
47357 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
47358 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
47359 outgoing interface address. There is no variable that contains an outgoing
47360 interface address because, unless it is set by this option, its value is
47361 unknown.
47362 </para>
47363 <para>
47364 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
47365 <varname>$host_address</varname> refer to the host to which a connection is about to be made
47366 during the expansion of the string. Forced expansion failure, or an empty
47367 string result causes the option to be ignored. Otherwise, after expansion, the
47368 string must be a list of IP addresses, colon-separated by default, but the
47369 separator can be changed in the usual way. For example:
47370 </para>
47371 <literallayout class="monospaced">
47372 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
47373 </literallayout>
47374 <para>
47375 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
47376 connection. If none of them are the correct type, the option is ignored. If
47377 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
47378 interface to use if the host has more than one.
47379 </para>
47380 <para>
47381 <indexterm role="option">
47382 <primary><option>keepalive</option></primary>
47383 </indexterm>
47384 </para>
47385 <informaltable frame="all">
47386 <tgroup cols="4" colsep="0" rowsep="0">
47387 <colspec colwidth="8*" align="left"/>
47388 <colspec colwidth="6*" align="center"/>
47389 <colspec colwidth="6*" align="center"/>
47390 <colspec colwidth="6*" align="right"/>
47391 <tbody>
47392 <row>
47393 <entry><option>keepalive</option></entry>
47394 <entry>Use: <emphasis>smtp</emphasis></entry>
47395 <entry>Type: <emphasis>boolean</emphasis></entry>
47396 <entry>Default: <emphasis>true</emphasis></entry>
47397 </row>
47398 </tbody>
47399 </tgroup>
47400 </informaltable>
47401 <para>
47402 <indexterm role="concept">
47403 <primary>keepalive</primary>
47404 <secondary>on outgoing connection</secondary>
47405 </indexterm>
47406 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
47407 connections. When set, it causes the kernel to probe idle connections
47408 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
47409 of the connection should send a acknowledgment if the connection is still okay
47410 or a reset if the connection has been aborted. The reason for doing this is
47411 that it has the beneficial effect of freeing up certain types of connection
47412 that can get stuck when the remote host is disconnected without tidying up the
47413 TCP/IP call properly. The keepalive mechanism takes several hours to detect
47414 unreachable hosts.
47415 </para>
47416 <para>
47417 <indexterm role="option">
47418 <primary><option>lmtp_ignore_quota</option></primary>
47419 </indexterm>
47420 </para>
47421 <informaltable frame="all">
47422 <tgroup cols="4" colsep="0" rowsep="0">
47423 <colspec colwidth="8*" align="left"/>
47424 <colspec colwidth="6*" align="center"/>
47425 <colspec colwidth="6*" align="center"/>
47426 <colspec colwidth="6*" align="right"/>
47427 <tbody>
47428 <row>
47429 <entry><option>lmtp_ignore_quota</option></entry>
47430 <entry>Use: <emphasis>smtp</emphasis></entry>
47431 <entry>Type: <emphasis>boolean</emphasis></entry>
47432 <entry>Default: <emphasis>false</emphasis></entry>
47433 </row>
47434 </tbody>
47435 </tgroup>
47436 </informaltable>
47437 <para>
47438 <indexterm role="concept">
47439 <primary>LMTP</primary>
47440 <secondary>ignoring quota errors</secondary>
47441 </indexterm>
47442 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
47443 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
47444 has advertised support for IGNOREQUOTA in its response to the LHLO command.
47445 </para>
47446 <para>
47447 <indexterm role="option">
47448 <primary><option>max_rcpt</option></primary>
47449 </indexterm>
47450 </para>
47451 <informaltable frame="all">
47452 <tgroup cols="4" colsep="0" rowsep="0">
47453 <colspec colwidth="8*" align="left"/>
47454 <colspec colwidth="6*" align="center"/>
47455 <colspec colwidth="6*" align="center"/>
47456 <colspec colwidth="6*" align="right"/>
47457 <tbody>
47458 <row>
47459 <entry><option>max_rcpt</option></entry>
47460 <entry>Use: <emphasis>smtp</emphasis></entry>
47461 <entry>Type: <emphasis>integer</emphasis></entry>
47462 <entry>Default: <emphasis>100</emphasis></entry>
47463 </row>
47464 </tbody>
47465 </tgroup>
47466 </informaltable>
47467 <para>
47468 <indexterm role="concept">
47469 <primary>RCPT</primary>
47470 <secondary>maximum number of outgoing</secondary>
47471 </indexterm>
47472 This option limits the number of RCPT commands that are sent in a single
47473 SMTP message transaction. Each set of addresses is treated independently, and
47474 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
47475 permits this.
47476 </para>
47477 <para>
47478 <indexterm role="option">
47479 <primary><option>multi_domain</option></primary>
47480 </indexterm>
47481 </para>
47482 <informaltable frame="all">
47483 <tgroup cols="4" colsep="0" rowsep="0">
47484 <colspec colwidth="8*" align="left"/>
47485 <colspec colwidth="6*" align="center"/>
47486 <colspec colwidth="6*" align="center"/>
47487 <colspec colwidth="6*" align="right"/>
47488 <tbody>
47489 <row>
47490 <entry><option>multi_domain</option></entry>
47491 <entry>Use: <emphasis>smtp</emphasis></entry>
47492 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47493 <entry>Default: <emphasis>true</emphasis></entry>
47494 </row>
47495 </tbody>
47496 </tgroup>
47497 </informaltable>
47498 <para>
47499 <indexterm role="variable">
47500 <primary><varname>$domain</varname></primary>
47501 </indexterm>
47502 When this option is set, the <command>smtp</command> transport can handle a number of
47503 addresses containing a mixture of different domains provided they all resolve
47504 to the same list of hosts. Turning the option off restricts the transport to
47505 handling only one domain at a time. This is useful if you want to use
47506 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
47507 is a single domain involved in a remote delivery.
47508 </para>
47509 <para>
47510 It is expanded per-address and can depend on any of
47511 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
47512 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
47513 </para>
47514 <para>
47515 <indexterm role="option">
47516 <primary><option>port</option></primary>
47517 </indexterm>
47518 </para>
47519 <informaltable frame="all">
47520 <tgroup cols="4" colsep="0" rowsep="0">
47521 <colspec colwidth="8*" align="left"/>
47522 <colspec colwidth="6*" align="center"/>
47523 <colspec colwidth="6*" align="center"/>
47524 <colspec colwidth="6*" align="right"/>
47525 <tbody>
47526 <row>
47527 <entry><option>port</option></entry>
47528 <entry>Use: <emphasis>smtp</emphasis></entry>
47529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47530 <entry>Default: <emphasis>see below</emphasis></entry>
47531 </row>
47532 </tbody>
47533 </tgroup>
47534 </informaltable>
47535 <para>
47536 <indexterm role="concept">
47537 <primary>port</primary>
47538 <secondary>sending TCP/IP</secondary>
47539 </indexterm>
47540 <indexterm role="concept">
47541 <primary>TCP/IP</primary>
47542 <secondary>setting outgoing port</secondary>
47543 </indexterm>
47544 This option specifies the TCP/IP port on the server to which Exim connects.
47545 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
47546 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
47547 The name was changed to minimize confusion with the outgoing port. There is no
47548 variable that contains an outgoing port.
47549 </para>
47550 <para>
47551 If the value of this option begins with a digit it is taken as a port number;
47552 otherwise it is looked up using <function>getservbyname()</function>. The default value is
47553 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
47554 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
47555 is deferred.
47556 </para>
47557 <para>
47558 <indexterm role="option">
47559 <primary><option>protocol</option></primary>
47560 </indexterm>
47561 </para>
47562 <informaltable frame="all">
47563 <tgroup cols="4" colsep="0" rowsep="0">
47564 <colspec colwidth="8*" align="left"/>
47565 <colspec colwidth="6*" align="center"/>
47566 <colspec colwidth="6*" align="center"/>
47567 <colspec colwidth="6*" align="right"/>
47568 <tbody>
47569 <row>
47570 <entry><option>protocol</option></entry>
47571 <entry>Use: <emphasis>smtp</emphasis></entry>
47572 <entry>Type: <emphasis>string</emphasis></entry>
47573 <entry>Default: <emphasis>smtp</emphasis></entry>
47574 </row>
47575 </tbody>
47576 </tgroup>
47577 </informaltable>
47578 <para>
47579 <indexterm role="concept">
47580 <primary>LMTP</primary>
47581 <secondary>over TCP/IP</secondary>
47582 </indexterm>
47583 <indexterm role="concept">
47584 <primary>ssmtp protocol</primary>
47585 <secondary>outbound</secondary>
47586 </indexterm>
47587 <indexterm role="concept">
47588 <primary>TLS</primary>
47589 <secondary>SSL-on-connect outbound</secondary>
47590 </indexterm>
47591 <indexterm role="variable">
47592 <primary><varname>$port</varname></primary>
47593 </indexterm>
47594 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
47595 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
47596 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
47597 deliveries into closed message stores. Exim also has support for running LMTP
47598 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
47599 </para>
47600 <para>
47601 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
47602 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
47603 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
47604 The Internet standards bodies strongly discourage use of this mode.
47605 </para>
47606 <para>
47607 <indexterm role="option">
47608 <primary><option>retry_include_ip_address</option></primary>
47609 </indexterm>
47610 </para>
47611 <informaltable frame="all">
47612 <tgroup cols="4" colsep="0" rowsep="0">
47613 <colspec colwidth="8*" align="left"/>
47614 <colspec colwidth="6*" align="center"/>
47615 <colspec colwidth="6*" align="center"/>
47616 <colspec colwidth="6*" align="right"/>
47617 <tbody>
47618 <row>
47619 <entry><option>retry_include_ip_address</option></entry>
47620 <entry>Use: <emphasis>smtp</emphasis></entry>
47621 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47622 <entry>Default: <emphasis>true</emphasis></entry>
47623 </row>
47624 </tbody>
47625 </tgroup>
47626 </informaltable>
47627 <para>
47628 Exim normally includes both the host name and the IP address in the key it
47629 constructs for indexing retry data after a temporary delivery failure. This
47630 means that when one of several IP addresses for a host is failing, it gets
47631 tried periodically (controlled by the retry rules), but use of the other IP
47632 addresses is not affected.
47633 </para>
47634 <para>
47635 However, in some dialup environments hosts are assigned a different IP address
47636 each time they connect. In this situation the use of the IP address as part of
47637 the retry key leads to undesirable behaviour. Setting this option false causes
47638 Exim to use only the host name.
47639 Since it is expanded it can be made to depend on the host or domain.
47640 </para>
47641 <para>
47642 <indexterm role="option">
47643 <primary><option>serialize_hosts</option></primary>
47644 </indexterm>
47645 </para>
47646 <informaltable frame="all">
47647 <tgroup cols="4" colsep="0" rowsep="0">
47648 <colspec colwidth="8*" align="left"/>
47649 <colspec colwidth="6*" align="center"/>
47650 <colspec colwidth="6*" align="center"/>
47651 <colspec colwidth="6*" align="right"/>
47652 <tbody>
47653 <row>
47654 <entry><option>serialize_hosts</option></entry>
47655 <entry>Use: <emphasis>smtp</emphasis></entry>
47656 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47657 <entry>Default: <emphasis>unset</emphasis></entry>
47658 </row>
47659 </tbody>
47660 </tgroup>
47661 </informaltable>
47662 <para>
47663 <indexterm role="concept">
47664 <primary>serializing connections</primary>
47665 </indexterm>
47666 <indexterm role="concept">
47667 <primary>host</primary>
47668 <secondary>serializing connections</secondary>
47669 </indexterm>
47670 Because Exim operates in a distributed manner, if several messages for the same
47671 host arrive at around the same time, more than one simultaneous connection to
47672 the remote host can occur. This is not usually a problem except when there is a
47673 slow link between the hosts. In that situation it may be helpful to restrict
47674 Exim to one connection at a time. This can be done by setting
47675 <option>serialize_hosts</option> to match the relevant hosts.
47676 </para>
47677 <para>
47678 <indexterm role="concept">
47679 <primary>hints database</primary>
47680 <secondary>serializing deliveries to a host</secondary>
47681 </indexterm>
47682 Exim implements serialization by means of a hints database in which a record is
47683 written whenever a process connects to one of the restricted hosts. The record
47684 is deleted when the connection is completed. Obviously there is scope for
47685 records to get left lying around if there is a system or program crash. To
47686 guard against this, Exim ignores any records that are more than six hours old.
47687 </para>
47688 <para>
47689 If you set up this kind of serialization, you should also arrange to delete the
47690 relevant hints database whenever your system reboots. The names of the files
47691 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
47692 may be one or two files, depending on the type of DBM in use. The same files
47693 are used for ETRN serialization.
47694 </para>
47695 <para>
47696 See also the <option>max_parallel</option> generic transport option.
47697 </para>
47698 <para>
47699 <indexterm role="option">
47700 <primary><option>size_addition</option></primary>
47701 </indexterm>
47702 </para>
47703 <informaltable frame="all">
47704 <tgroup cols="4" colsep="0" rowsep="0">
47705 <colspec colwidth="8*" align="left"/>
47706 <colspec colwidth="6*" align="center"/>
47707 <colspec colwidth="6*" align="center"/>
47708 <colspec colwidth="6*" align="right"/>
47709 <tbody>
47710 <row>
47711 <entry><option>size_addition</option></entry>
47712 <entry>Use: <emphasis>smtp</emphasis></entry>
47713 <entry>Type: <emphasis>integer</emphasis></entry>
47714 <entry>Default: <emphasis>1024</emphasis></entry>
47715 </row>
47716 </tbody>
47717 </tgroup>
47718 </informaltable>
47719 <para>
47720 <indexterm role="concept">
47721 <primary>SMTP</primary>
47722 <secondary>SIZE</secondary>
47723 </indexterm>
47724 <indexterm role="concept">
47725 <primary>message</primary>
47726 <secondary>size issue for transport filter</secondary>
47727 </indexterm>
47728 <indexterm role="concept">
47729 <primary>size</primary>
47730 <secondary>of message</secondary>
47731 </indexterm>
47732 <indexterm role="concept">
47733 <primary>transport</primary>
47734 <secondary>filter</secondary>
47735 </indexterm>
47736 <indexterm role="concept">
47737 <primary>filter</primary>
47738 <secondary>transport filter</secondary>
47739 </indexterm>
47740 If a remote SMTP server indicates that it supports the SIZE option of the
47741 MAIL command, Exim uses this to pass over the message size at the start of
47742 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
47743 sends, to allow for headers and other text that may be added during delivery by
47744 configuration options or in a transport filter. It may be necessary to increase
47745 this if a lot of text is added to messages.
47746 </para>
47747 <para>
47748 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
47749 the use of the SIZE option altogether.
47750 </para>
47751 <para>
47752 <indexterm role="option">
47753 <primary><option>socks_proxy</option></primary>
47754 </indexterm>
47755 </para>
47756 <informaltable frame="all">
47757 <tgroup cols="4" colsep="0" rowsep="0">
47758 <colspec colwidth="8*" align="left"/>
47759 <colspec colwidth="6*" align="center"/>
47760 <colspec colwidth="6*" align="center"/>
47761 <colspec colwidth="6*" align="right"/>
47762 <tbody>
47763 <row>
47764 <entry><option>socks_proxy</option></entry>
47765 <entry>Use: <emphasis>smtp</emphasis></entry>
47766 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47767 <entry>Default: <emphasis>unset</emphasis></entry>
47768 </row>
47769 </tbody>
47770 </tgroup>
47771 </informaltable>
47772 <para>
47773 <indexterm role="concept">
47774 <primary>proxy</primary>
47775 <secondary>SOCKS</secondary>
47776 </indexterm>
47777 This option enables use of SOCKS proxies for connections made by the
47778 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
47779 </para>
47780 <para>
47781 <indexterm role="option">
47782 <primary><option>tls_certificate</option></primary>
47783 </indexterm>
47784 </para>
47785 <informaltable frame="all">
47786 <tgroup cols="4" colsep="0" rowsep="0">
47787 <colspec colwidth="8*" align="left"/>
47788 <colspec colwidth="6*" align="center"/>
47789 <colspec colwidth="6*" align="center"/>
47790 <colspec colwidth="6*" align="right"/>
47791 <tbody>
47792 <row>
47793 <entry><option>tls_certificate</option></entry>
47794 <entry>Use: <emphasis>smtp</emphasis></entry>
47795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47796 <entry>Default: <emphasis>unset</emphasis></entry>
47797 </row>
47798 </tbody>
47799 </tgroup>
47800 </informaltable>
47801 <para>
47802 <indexterm role="concept">
47803 <primary>TLS</primary>
47804 <secondary>client certificate, location of</secondary>
47805 </indexterm>
47806 <indexterm role="concept">
47807 <primary>certificate</primary>
47808 <secondary>client, location of</secondary>
47809 </indexterm>
47810 <indexterm role="variable">
47811 <primary><varname>$host</varname></primary>
47812 </indexterm>
47813 <indexterm role="variable">
47814 <primary><varname>$host_address</varname></primary>
47815 </indexterm>
47816 The value of this option must be the absolute path to a file which contains the
47817 client&#x2019;s certificate, for possible use when sending a message over an encrypted
47818 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
47819 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
47820 details of TLS.
47821 </para>
47822 <para>
47823 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
47824 certificate when sending messages as a client. The global option of the same
47825 name specifies the certificate for Exim as a server; it is not automatically
47826 assumed that the same certificate should be used when Exim is operating as a
47827 client.
47828 </para>
47829 <para>
47830 <indexterm role="option">
47831 <primary><option>tls_crl</option></primary>
47832 </indexterm>
47833 </para>
47834 <informaltable frame="all">
47835 <tgroup cols="4" colsep="0" rowsep="0">
47836 <colspec colwidth="8*" align="left"/>
47837 <colspec colwidth="6*" align="center"/>
47838 <colspec colwidth="6*" align="center"/>
47839 <colspec colwidth="6*" align="right"/>
47840 <tbody>
47841 <row>
47842 <entry><option>tls_crl</option></entry>
47843 <entry>Use: <emphasis>smtp</emphasis></entry>
47844 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47845 <entry>Default: <emphasis>unset</emphasis></entry>
47846 </row>
47847 </tbody>
47848 </tgroup>
47849 </informaltable>
47850 <para>
47851 <indexterm role="concept">
47852 <primary>TLS</primary>
47853 <secondary>client certificate revocation list</secondary>
47854 </indexterm>
47855 <indexterm role="concept">
47856 <primary>certificate</primary>
47857 <secondary>revocation list for client</secondary>
47858 </indexterm>
47859 This option specifies a certificate revocation list. The expanded value must
47860 be the name of a file that contains a CRL in PEM format.
47861 </para>
47862 <para>
47863 <indexterm role="option">
47864 <primary><option>tls_dh_min_bits</option></primary>
47865 </indexterm>
47866 </para>
47867 <informaltable frame="all">
47868 <tgroup cols="4" colsep="0" rowsep="0">
47869 <colspec colwidth="8*" align="left"/>
47870 <colspec colwidth="6*" align="center"/>
47871 <colspec colwidth="6*" align="center"/>
47872 <colspec colwidth="6*" align="right"/>
47873 <tbody>
47874 <row>
47875 <entry><option>tls_dh_min_bits</option></entry>
47876 <entry>Use: <emphasis>smtp</emphasis></entry>
47877 <entry>Type: <emphasis>integer</emphasis></entry>
47878 <entry>Default: <emphasis>1024</emphasis></entry>
47879 </row>
47880 </tbody>
47881 </tgroup>
47882 </informaltable>
47883 <para>
47884 <indexterm role="concept">
47885 <primary>TLS</primary>
47886 <secondary>Diffie-Hellman minimum acceptable size</secondary>
47887 </indexterm>
47888 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
47889 key agreement is negotiated, the server will provide a large prime number
47890 for use.  This option establishes the minimum acceptable size of that number.
47891 If the parameter offered by the server is too small, then the TLS handshake
47892 will fail.
47893 </para>
47894 <para>
47895 Only supported when using GnuTLS.
47896 </para>
47897 <para>
47898 <indexterm role="option">
47899 <primary><option>tls_privatekey</option></primary>
47900 </indexterm>
47901 </para>
47902 <informaltable frame="all">
47903 <tgroup cols="4" colsep="0" rowsep="0">
47904 <colspec colwidth="8*" align="left"/>
47905 <colspec colwidth="6*" align="center"/>
47906 <colspec colwidth="6*" align="center"/>
47907 <colspec colwidth="6*" align="right"/>
47908 <tbody>
47909 <row>
47910 <entry><option>tls_privatekey</option></entry>
47911 <entry>Use: <emphasis>smtp</emphasis></entry>
47912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47913 <entry>Default: <emphasis>unset</emphasis></entry>
47914 </row>
47915 </tbody>
47916 </tgroup>
47917 </informaltable>
47918 <para>
47919 <indexterm role="concept">
47920 <primary>TLS</primary>
47921 <secondary>client private key, location of</secondary>
47922 </indexterm>
47923 <indexterm role="variable">
47924 <primary><varname>$host</varname></primary>
47925 </indexterm>
47926 <indexterm role="variable">
47927 <primary><varname>$host_address</varname></primary>
47928 </indexterm>
47929 The value of this option must be the absolute path to a file which contains the
47930 client&#x2019;s private key. This is used when sending a message over an encrypted
47931 connection using a client certificate. The values of <varname>$host</varname> and
47932 <varname>$host_address</varname> are set to the name and address of the server during the
47933 expansion. If this option is unset, or the expansion is forced to fail, or the
47934 result is an empty string, the private key is assumed to be in the same file as
47935 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47936 </para>
47937 <para>
47938 <indexterm role="option">
47939 <primary><option>tls_require_ciphers</option></primary>
47940 </indexterm>
47941 </para>
47942 <informaltable frame="all">
47943 <tgroup cols="4" colsep="0" rowsep="0">
47944 <colspec colwidth="8*" align="left"/>
47945 <colspec colwidth="6*" align="center"/>
47946 <colspec colwidth="6*" align="center"/>
47947 <colspec colwidth="6*" align="right"/>
47948 <tbody>
47949 <row>
47950 <entry><option>tls_require_ciphers</option></entry>
47951 <entry>Use: <emphasis>smtp</emphasis></entry>
47952 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47953 <entry>Default: <emphasis>unset</emphasis></entry>
47954 </row>
47955 </tbody>
47956 </tgroup>
47957 </informaltable>
47958 <para>
47959 <indexterm role="concept">
47960 <primary>TLS</primary>
47961 <secondary>requiring specific ciphers</secondary>
47962 </indexterm>
47963 <indexterm role="concept">
47964 <primary>cipher</primary>
47965 <secondary>requiring specific</secondary>
47966 </indexterm>
47967 <indexterm role="variable">
47968 <primary><varname>$host</varname></primary>
47969 </indexterm>
47970 <indexterm role="variable">
47971 <primary><varname>$host_address</varname></primary>
47972 </indexterm>
47973 The value of this option must be a list of permitted cipher suites, for use
47974 when setting up an outgoing encrypted connection. (There is a global option of
47975 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
47976 <varname>$host_address</varname> are set to the name and address of the server during the
47977 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
47978 is used in different ways by OpenSSL and GnuTLS (see sections
47979 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
47980 ciphers is a preference order.
47981 </para>
47982 <para>
47983 <indexterm role="option">
47984 <primary><option>tls_sni</option></primary>
47985 </indexterm>
47986 </para>
47987 <informaltable frame="all">
47988 <tgroup cols="4" colsep="0" rowsep="0">
47989 <colspec colwidth="8*" align="left"/>
47990 <colspec colwidth="6*" align="center"/>
47991 <colspec colwidth="6*" align="center"/>
47992 <colspec colwidth="6*" align="right"/>
47993 <tbody>
47994 <row>
47995 <entry><option>tls_sni</option></entry>
47996 <entry>Use: <emphasis>smtp</emphasis></entry>
47997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47998 <entry>Default: <emphasis>unset</emphasis></entry>
47999 </row>
48000 </tbody>
48001 </tgroup>
48002 </informaltable>
48003 <para>
48004 <indexterm role="concept">
48005 <primary>TLS</primary>
48006 <secondary>Server Name Indication</secondary>
48007 </indexterm>
48008 <indexterm role="variable">
48009 <primary><varname>$tls_sni</varname></primary>
48010 </indexterm>
48011 If this option is set then it sets the $tls_out_sni variable and causes any
48012 TLS session to pass this value as the Server Name Indication extension to
48013 the remote side, which can be used by the remote side to select an appropriate
48014 certificate and private key for the session.
48015 </para>
48016 <para>
48017 See <xref linkend="SECTtlssni"/> for more information.
48018 </para>
48019 <para>
48020 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
48021 TLS extensions.
48022 </para>
48023 <para>
48024 <indexterm role="option">
48025 <primary><option>tls_tempfail_tryclear</option></primary>
48026 </indexterm>
48027 </para>
48028 <informaltable frame="all">
48029 <tgroup cols="4" colsep="0" rowsep="0">
48030 <colspec colwidth="8*" align="left"/>
48031 <colspec colwidth="6*" align="center"/>
48032 <colspec colwidth="6*" align="center"/>
48033 <colspec colwidth="6*" align="right"/>
48034 <tbody>
48035 <row>
48036 <entry><option>tls_tempfail_tryclear</option></entry>
48037 <entry>Use: <emphasis>smtp</emphasis></entry>
48038 <entry>Type: <emphasis>boolean</emphasis></entry>
48039 <entry>Default: <emphasis>true</emphasis></entry>
48040 </row>
48041 </tbody>
48042 </tgroup>
48043 </informaltable>
48044 <para>
48045 <indexterm role="concept">
48046 <primary>4<emphasis>xx</emphasis> responses</primary>
48047 <secondary>to STARTTLS</secondary>
48048 </indexterm>
48049 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
48050 setting up a TLS session, this option determines whether or not Exim should try
48051 to deliver the message unencrypted. If it is set false, delivery to the
48052 current host is deferred; if there are other hosts, they are tried. If this
48053 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
48054 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
48055 TLS negotiation fails, Exim closes the current connection (because it is in an
48056 unknown state), opens a new one to the same host, and then tries the delivery
48057 in clear.
48058 </para>
48059 <para>
48060 <indexterm role="option">
48061 <primary><option>tls_try_verify_hosts</option></primary>
48062 </indexterm>
48063 </para>
48064 <informaltable frame="all">
48065 <tgroup cols="4" colsep="0" rowsep="0">
48066 <colspec colwidth="8*" align="left"/>
48067 <colspec colwidth="6*" align="center"/>
48068 <colspec colwidth="6*" align="center"/>
48069 <colspec colwidth="6*" align="right"/>
48070 <tbody>
48071 <row>
48072 <entry><option>tls_try_verify_hosts</option></entry>
48073 <entry>Use: <emphasis>smtp</emphasis></entry>
48074 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48075 <entry>Default: <emphasis>*</emphasis></entry>
48076 </row>
48077 </tbody>
48078 </tgroup>
48079 </informaltable>
48080 <para>
48081 <indexterm role="concept">
48082 <primary>TLS</primary>
48083 <secondary>server certificate verification</secondary>
48084 </indexterm>
48085 <indexterm role="concept">
48086 <primary>certificate</primary>
48087 <secondary>verification of server</secondary>
48088 </indexterm>
48089 This option gives a list of hosts for which, on encrypted connections,
48090 certificate verification will be tried but need not succeed.
48091 The <option>tls_verify_certificates</option> option must also be set.
48092 Note that unless the host is in this list
48093 TLS connections will be denied to hosts using self-signed certificates
48094 when <option>tls_verify_certificates</option> is matched.
48095 The <varname>$tls_out_certificate_verified</varname> variable is set when
48096 certificate verification succeeds.
48097 </para>
48098 <para>
48099 <indexterm role="option">
48100 <primary><option>tls_verify_cert_hostnames</option></primary>
48101 </indexterm>
48102 </para>
48103 <informaltable frame="all">
48104 <tgroup cols="4" colsep="0" rowsep="0">
48105 <colspec colwidth="8*" align="left"/>
48106 <colspec colwidth="6*" align="center"/>
48107 <colspec colwidth="6*" align="center"/>
48108 <colspec colwidth="6*" align="right"/>
48109 <tbody>
48110 <row>
48111 <entry><option>tls_verify_cert_hostnames</option></entry>
48112 <entry>Use: <emphasis>smtp</emphasis></entry>
48113 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48114 <entry>Default: <emphasis>*</emphasis></entry>
48115 </row>
48116 </tbody>
48117 </tgroup>
48118 </informaltable>
48119 <para>
48120 <indexterm role="concept">
48121 <primary>TLS</primary>
48122 <secondary>server certificate hostname verification</secondary>
48123 </indexterm>
48124 <indexterm role="concept">
48125 <primary>certificate</primary>
48126 <secondary>verification of server</secondary>
48127 </indexterm>
48128 This option give a list of hosts for which,
48129 while verifying the server certificate,
48130 checks will be included on the host name
48131 (note that this will generally be the result of a DNS MX lookup)
48132 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
48133 limited to being the initial component of a 3-or-more component FQDN.
48134 </para>
48135 <para>
48136 There is no equivalent checking on client certificates.
48137 </para>
48138 <para>
48139 <indexterm role="option">
48140 <primary><option>tls_verify_certificates</option></primary>
48141 </indexterm>
48142 </para>
48143 <informaltable frame="all">
48144 <tgroup cols="4" colsep="0" rowsep="0">
48145 <colspec colwidth="8*" align="left"/>
48146 <colspec colwidth="6*" align="center"/>
48147 <colspec colwidth="6*" align="center"/>
48148 <colspec colwidth="6*" align="right"/>
48149 <tbody>
48150 <row>
48151 <entry><option>tls_verify_certificates</option></entry>
48152 <entry>Use: <emphasis>smtp</emphasis></entry>
48153 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48154 <entry>Default: <emphasis>system</emphasis></entry>
48155 </row>
48156 </tbody>
48157 </tgroup>
48158 </informaltable>
48159 <para>
48160 <indexterm role="concept">
48161 <primary>TLS</primary>
48162 <secondary>server certificate verification</secondary>
48163 </indexterm>
48164 <indexterm role="concept">
48165 <primary>certificate</primary>
48166 <secondary>verification of server</secondary>
48167 </indexterm>
48168 <indexterm role="variable">
48169 <primary><varname>$host</varname></primary>
48170 </indexterm>
48171 <indexterm role="variable">
48172 <primary><varname>$host_address</varname></primary>
48173 </indexterm>
48174 The value of this option must be either the
48175 word "system"
48176 or the absolute path to
48177 a file or directory containing permitted certificates for servers,
48178 for use when setting up an encrypted connection.
48179 </para>
48180 <para>
48181 The "system" value for the option will use a location compiled into the SSL library.
48182 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
48183 is taken as empty and an explicit location
48184 must be specified.
48185 </para>
48186 <para>
48187 The use of a directory for the option value is not available for GnuTLS versions
48188 preceding 3.3.6 and a single file must be used.
48189 </para>
48190 <para>
48191 With OpenSSL the certificates specified
48192 explicitly
48193 either by file or directory
48194 are added to those given by the system default location.
48195 </para>
48196 <para>
48197 The values of <varname>$host</varname> and
48198 <varname>$host_address</varname> are set to the name and address of the server during the
48199 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48200 </para>
48201 <para>
48202 For back-compatibility,
48203 if neither tls_verify_hosts nor tls_try_verify_hosts are set
48204 (a single-colon empty list counts as being set)
48205 and certificate verification fails the TLS connection is closed.
48206 </para>
48207 <para>
48208 <indexterm role="option">
48209 <primary><option>tls_verify_hosts</option></primary>
48210 </indexterm>
48211 </para>
48212 <informaltable frame="all">
48213 <tgroup cols="4" colsep="0" rowsep="0">
48214 <colspec colwidth="8*" align="left"/>
48215 <colspec colwidth="6*" align="center"/>
48216 <colspec colwidth="6*" align="center"/>
48217 <colspec colwidth="6*" align="right"/>
48218 <tbody>
48219 <row>
48220 <entry><option>tls_verify_hosts</option></entry>
48221 <entry>Use: <emphasis>smtp</emphasis></entry>
48222 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48223 <entry>Default: <emphasis>unset</emphasis></entry>
48224 </row>
48225 </tbody>
48226 </tgroup>
48227 </informaltable>
48228 <para>
48229 <indexterm role="concept">
48230 <primary>TLS</primary>
48231 <secondary>server certificate verification</secondary>
48232 </indexterm>
48233 <indexterm role="concept">
48234 <primary>certificate</primary>
48235 <secondary>verification of server</secondary>
48236 </indexterm>
48237 This option gives a list of hosts for which, on encrypted connections,
48238 certificate verification must succeed.
48239 The <option>tls_verify_certificates</option> option must also be set.
48240 If both this option and <option>tls_try_verify_hosts</option> are unset
48241 operation is as if this option selected all hosts.
48242 </para>
48243 </section>
48244 <section id="SECTvalhosmax">
48245 <title>How the limits for the number of hosts to try are used</title>
48246 <para>
48247 <indexterm role="concept">
48248 <primary>host</primary>
48249 <secondary>maximum number to try</secondary>
48250 </indexterm>
48251 <indexterm role="concept">
48252 <primary>limit</primary>
48253 <secondary>hosts; maximum number tried</secondary>
48254 </indexterm>
48255 There are two options that are concerned with the number of hosts that are
48256 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
48257 <option>hosts_max_try_hardlimit</option>.
48258 </para>
48259 <para>
48260 The <option>hosts_max_try</option> option limits the number of hosts that are tried
48261 for a single delivery. However, despite the term <quote>host</quote> in its name, the
48262 option actually applies to each IP address independently. In other words, a
48263 multihomed host is treated as several independent hosts, just as it is for
48264 retrying.
48265 </para>
48266 <para>
48267 Many of the larger ISPs have multiple MX records which often point to
48268 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
48269 created as a result of routing one of these domains.
48270 </para>
48271 <para>
48272 Trying every single IP address on such a long list does not seem sensible; if
48273 several at the top of the list fail, it is reasonable to assume there is some
48274 problem that is likely to affect all of them. Roughly speaking, the value of
48275 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
48276 delivery. However, the logic cannot be quite that simple.
48277 </para>
48278 <para>
48279 Firstly, IP addresses that are skipped because their retry times have not
48280 arrived do not count, and in addition, addresses that are past their retry
48281 limits are also not counted, even when they are tried. This means that when
48282 some IP addresses are past their retry limits, more than the value of
48283 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
48284 that all IP addresses are considered before timing out an email address (but
48285 see below for an exception).
48286 </para>
48287 <para>
48288 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
48289 list to see if there is a subsequent host with a different (higher valued) MX.
48290 If there is, that host is considered next, and the current IP address is used
48291 but not counted. This behaviour helps in the case of a domain with a retry rule
48292 that hardly ever delays any hosts, as is now explained:
48293 </para>
48294 <para>
48295 Consider the case of a long list of hosts with one MX value, and a few with a
48296 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
48297 hosts at the top of the list are tried at first. With the default retry rule,
48298 which specifies increasing retry times, the higher MX hosts are eventually
48299 tried when those at the top of the list are skipped because they have not
48300 reached their retry times.
48301 </para>
48302 <para>
48303 However, it is common practice to put a fixed short retry time on domains for
48304 large ISPs, on the grounds that their servers are rarely down for very long.
48305 Unfortunately, these are exactly the domains that tend to resolve to long lists
48306 of hosts. The short retry time means that the lowest MX hosts are tried every
48307 time. The attempts may be in a different order because of random sorting, but
48308 without the special MX check, the higher MX hosts would never be tried until
48309 all the lower MX hosts had timed out (which might be several days), because
48310 there are always some lower MX hosts that have reached their retry times. With
48311 the special check, Exim considers at least one IP address from each MX value at
48312 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
48313 reached.
48314 </para>
48315 <para>
48316 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
48317 particular, Exim normally eventually tries all the IP addresses before timing
48318 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
48319 reasonable thing to do. Recently, however, some lunatic DNS configurations have
48320 been set up with hundreds of IP addresses for some domains. It can
48321 take a very long time indeed for an address to time out in these cases.
48322 </para>
48323 <para>
48324 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
48325 Exim never tries more than this number of IP addresses; if it hits this limit
48326 and they are all timed out, the email address is bounced, even though not all
48327 possible IP addresses have been tried.
48328 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
48329 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
48330 </para>
48331 </section>
48332 </chapter>
48333
48334 <chapter id="CHAPrewrite">
48335 <title>Address rewriting</title>
48336 <para>
48337 <indexterm role="concept" id="IIDaddrew" class="startofrange">
48338 <primary>rewriting</primary>
48339 <secondary>addresses</secondary>
48340 </indexterm>
48341 There are some circumstances in which Exim automatically rewrites domains in
48342 addresses. The two most common are when an address is given without a domain
48343 (referred to as an <quote>unqualified address</quote>) or when an address contains an
48344 abbreviated domain that is expanded by DNS lookup.
48345 </para>
48346 <para>
48347 Unqualified envelope addresses are accepted only for locally submitted
48348 messages, or for messages that are received from hosts matching
48349 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
48350 appropriate. Unqualified addresses in header lines are qualified if they are in
48351 locally submitted messages, or messages from hosts that are permitted to send
48352 unqualified envelope addresses. Otherwise, unqualified addresses in header
48353 lines are neither qualified nor rewritten.
48354 </para>
48355 <para>
48356 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
48357 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
48358 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
48359 do this. The new RFCs do not contain this suggestion.
48360 </para>
48361 <section id="SECID147">
48362 <title>Explicitly configured address rewriting</title>
48363 <para>
48364 This chapter describes the rewriting rules that can be used in the
48365 main rewrite section of the configuration file, and also in the generic
48366 <option>headers_rewrite</option> option that can be set on any transport.
48367 </para>
48368 <para>
48369 Some people believe that configured address rewriting is a Mortal Sin.
48370 Others believe that life is not possible without it. Exim provides the
48371 facility; you do not have to use it.
48372 </para>
48373 <para>
48374 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
48375 configuration file are applied to addresses in incoming messages, both envelope
48376 addresses and addresses in header lines. Each rule specifies the types of
48377 address to which it applies.
48378 </para>
48379 <para>
48380 Whether or not addresses in header lines are rewritten depends on the origin of
48381 the headers and the type of rewriting. Global rewriting, that is, rewriting
48382 rules from the rewrite section of the configuration file, is applied only to
48383 those headers that were received with the message. Header lines that are added
48384 by ACLs or by a system filter or by individual routers or transports (which
48385 are specific to individual recipient addresses) are not rewritten by the global
48386 rules.
48387 </para>
48388 <para>
48389 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
48390 applies all headers except those added by routers and transports. That is, as
48391 well as the headers that were received with the message, it also applies to
48392 headers that were added by an ACL or a system filter.
48393 </para>
48394 <para>
48395 In general, rewriting addresses from your own system or domain has some
48396 legitimacy. Rewriting other addresses should be done only with great care and
48397 in special circumstances. The author of Exim believes that rewriting should be
48398 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
48399 Although it can sometimes be used as a routing tool, this is very strongly
48400 discouraged.
48401 </para>
48402 <para>
48403 There are two commonly encountered circumstances where rewriting is used, as
48404 illustrated by these examples:
48405 </para>
48406 <itemizedlist>
48407 <listitem>
48408 <para>
48409 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
48410 exchange mail with each other behind a firewall, but there is only a single
48411 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
48412 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
48413 </para>
48414 </listitem>
48415 <listitem>
48416 <para>
48417 A host rewrites the local parts of its own users so that, for example,
48418 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
48419 </para>
48420 </listitem>
48421 </itemizedlist>
48422 </section>
48423 <section id="SECID148">
48424 <title>When does rewriting happen?</title>
48425 <para>
48426 <indexterm role="concept">
48427 <primary>rewriting</primary>
48428 <secondary>timing of</secondary>
48429 </indexterm>
48430 <indexterm role="concept">
48431 <primary>access control lists (ACLs)</primary>
48432 <secondary>rewriting addresses in</secondary>
48433 </indexterm>
48434 Configured address rewriting can take place at several different stages of a
48435 message&#x2019;s processing.
48436 </para>
48437 <para>
48438 <indexterm role="variable">
48439 <primary><varname>$sender_address</varname></primary>
48440 </indexterm>
48441 At the start of an ACL for MAIL, the sender address may have been rewritten
48442 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
48443 ordinary rewrite rules have yet been applied. If, however, the sender address
48444 is verified in the ACL, it is rewritten before verification, and remains
48445 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
48446 rewritten address. This also applies if sender verification happens in a
48447 RCPT ACL. Otherwise, when the sender address is not verified, it is
48448 rewritten as soon as a message&#x2019;s header lines have been received.
48449 </para>
48450 <para>
48451 <indexterm role="variable">
48452 <primary><varname>$domain</varname></primary>
48453 </indexterm>
48454 <indexterm role="variable">
48455 <primary><varname>$local_part</varname></primary>
48456 </indexterm>
48457 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
48458 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
48459 rewrite rules have yet been applied to it. However, the behaviour is different
48460 from the sender address when a recipient is verified. The address is rewritten
48461 for the verification, but the rewriting is not remembered at this stage. The
48462 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
48463 as they were before (that is, they contain the unrewritten &ndash; except for
48464 SMTP-time rewriting &ndash; address).
48465 </para>
48466 <para>
48467 As soon as a message&#x2019;s header lines have been received, all the envelope
48468 recipient addresses are permanently rewritten, and rewriting is also applied to
48469 the addresses in the header lines (if configured). This happens before adding
48470 any header lines that were specified in MAIL or RCPT ACLs, and
48471 <indexterm role="concept">
48472 <primary><function>local_scan()</function> function</primary>
48473 <secondary>address rewriting; timing of</secondary>
48474 </indexterm>
48475 before the DATA ACL and <function>local_scan()</function> functions are run.
48476 </para>
48477 <para>
48478 When an address is being routed, either for delivery or for verification,
48479 rewriting is applied immediately to child addresses that are generated by
48480 redirection, unless <option>no_rewrite</option> is set on the router.
48481 </para>
48482 <para>
48483 <indexterm role="concept">
48484 <primary>envelope sender</primary>
48485 <secondary>rewriting at transport time</secondary>
48486 </indexterm>
48487 <indexterm role="concept">
48488 <primary>rewriting</primary>
48489 <secondary>at transport time</secondary>
48490 </indexterm>
48491 <indexterm role="concept">
48492 <primary>header lines</primary>
48493 <secondary>rewriting at transport time</secondary>
48494 </indexterm>
48495 At transport time, additional rewriting of addresses in header lines can be
48496 specified by setting the generic <option>headers_rewrite</option> option on a transport.
48497 This option contains rules that are identical in form to those in the rewrite
48498 section of the configuration file. They are applied to the original message
48499 header lines and any that were added by ACLs or a system filter. They are not
48500 applied to header lines that are added by routers or the transport.
48501 </para>
48502 <para>
48503 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
48504 transport option. However, it is not possible to rewrite envelope recipients at
48505 transport time.
48506 </para>
48507 </section>
48508 <section id="SECID149">
48509 <title>Testing the rewriting rules that apply on input</title>
48510 <para>
48511 <indexterm role="concept">
48512 <primary>rewriting</primary>
48513 <secondary>testing</secondary>
48514 </indexterm>
48515 <indexterm role="concept">
48516 <primary>testing</primary>
48517 <secondary>rewriting</secondary>
48518 </indexterm>
48519 Exim&#x2019;s input rewriting configuration appears in a part of the run time
48520 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
48521 <option>-brw</option> command line option. This takes an address (which can be a full RFC
48522 2822 address) as its argument. The output is a list of how the address would be
48523 transformed by the rewriting rules for each of the different places it might
48524 appear in an incoming message, that is, for each different header and for the
48525 envelope sender and recipient fields. For example,
48526 </para>
48527 <literallayout class="monospaced">
48528 exim -brw ph10@exim.workshop.example
48529 </literallayout>
48530 <para>
48531 might produce the output
48532 </para>
48533 <literallayout class="monospaced">
48534 sender: Philip.Hazel@exim.workshop.example
48535 from: Philip.Hazel@exim.workshop.example
48536 to: ph10@exim.workshop.example
48537 cc: ph10@exim.workshop.example
48538 bcc: ph10@exim.workshop.example
48539 reply-to: Philip.Hazel@exim.workshop.example
48540 env-from: Philip.Hazel@exim.workshop.example
48541 env-to: ph10@exim.workshop.example
48542 </literallayout>
48543 <para>
48544 which shows that rewriting has been set up for that address when used in any of
48545 the source fields, but not when it appears as a recipient address. At the
48546 present time, there is no equivalent way of testing rewriting rules that are
48547 set for a particular transport.
48548 </para>
48549 </section>
48550 <section id="SECID150">
48551 <title>Rewriting rules</title>
48552 <para>
48553 <indexterm role="concept">
48554 <primary>rewriting</primary>
48555 <secondary>rules</secondary>
48556 </indexterm>
48557 The rewrite section of the configuration file consists of lines of rewriting
48558 rules in the form
48559 </para>
48560 <literallayout>
48561 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
48562 </literallayout>
48563 <para>
48564 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
48565 transport option are given as a colon-separated list. Each item in the list
48566 takes the same form as a line in the main rewriting configuration (except that
48567 any colons must be doubled, of course).
48568 </para>
48569 <para>
48570 The formats of source patterns and replacement strings are described below.
48571 Each is terminated by white space, unless enclosed in double quotes, in which
48572 case normal quoting conventions apply inside the quotes. The flags are single
48573 characters which may appear in any order. Spaces and tabs between them are
48574 ignored.
48575 </para>
48576 <para>
48577 For each address that could potentially be rewritten, the rules are scanned in
48578 order, and replacements for the address from earlier rules can themselves be
48579 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
48580 </para>
48581 <para>
48582 The order in which addresses are rewritten is undefined, may change between
48583 releases, and must not be relied on, with one exception: when a message is
48584 received, the envelope sender is always rewritten first, before any header
48585 lines are rewritten. For example, the replacement string for a rewrite of an
48586 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
48587 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
48588 that the envelope sender has already been rewritten.
48589 </para>
48590 <para>
48591 <indexterm role="variable">
48592 <primary><varname>$domain</varname></primary>
48593 </indexterm>
48594 <indexterm role="variable">
48595 <primary><varname>$local_part</varname></primary>
48596 </indexterm>
48597 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
48598 string to refer to the address that is being rewritten. Note that lookup-driven
48599 rewriting can be done by a rule of the form
48600 </para>
48601 <literallayout class="monospaced">
48602 *@*   ${lookup ...
48603 </literallayout>
48604 <para>
48605 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
48606 refer to the address that is being rewritten.
48607 </para>
48608 </section>
48609 <section id="SECID151">
48610 <title>Rewriting patterns</title>
48611 <para>
48612 <indexterm role="concept">
48613 <primary>rewriting</primary>
48614 <secondary>patterns</secondary>
48615 </indexterm>
48616 <indexterm role="concept">
48617 <primary>address list</primary>
48618 <secondary>in a rewriting pattern</secondary>
48619 </indexterm>
48620 The source pattern in a rewriting rule is any item which may appear in an
48621 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
48622 single-item address list, which means that it is expanded before being tested
48623 against the address. As always, if you use a regular expression as a pattern,
48624 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
48625 facility to suppress string expansion within the regular expression.
48626 </para>
48627 <para>
48628 Domains in patterns should be given in lower case. Local parts in patterns are
48629 case-sensitive. If you want to do case-insensitive matching of local parts, you
48630 can use a regular expression that starts with <literal>^(?i)</literal>.
48631 </para>
48632 <para>
48633 <indexterm role="concept">
48634 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48635 <secondary>in rewriting rules</secondary>
48636 </indexterm>
48637 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
48638 depending on the type of match which occurred. These can be used in the
48639 replacement string to insert portions of the incoming address. <varname>$0</varname> always
48640 refers to the complete incoming address. When a regular expression is used, the
48641 numerical variables are set from its capturing subexpressions. For other types
48642 of pattern they are set as follows:
48643 </para>
48644 <itemizedlist>
48645 <listitem>
48646 <para>
48647 If a local part or domain starts with an asterisk, the numerical variables
48648 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
48649 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
48650 pattern
48651 </para>
48652 <literallayout class="monospaced">
48653 *queen@*.fict.example
48654 </literallayout>
48655 <para>
48656 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
48657 </para>
48658 <literallayout class="monospaced">
48659 $0 = hearts-queen@wonderland.fict.example
48660 $1 = hearts-
48661 $2 = wonderland
48662 </literallayout>
48663 <para>
48664 Note that if the local part does not start with an asterisk, but the domain
48665 does, it is <varname>$1</varname> that contains the wild part of the domain.
48666 </para>
48667 </listitem>
48668 <listitem>
48669 <para>
48670 If the domain part of the pattern is a partial lookup, the wild and fixed parts
48671 of the domain are placed in the next available numerical variables. Suppose,
48672 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
48673 rewriting rule of the form
48674 </para>
48675 <literallayout>
48676 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
48677 </literallayout>
48678 <para>
48679 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
48680 </para>
48681 <literallayout class="monospaced">
48682 $1 = foo
48683 $2 = bar
48684 $3 = baz.example
48685 </literallayout>
48686 <para>
48687 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
48688 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
48689 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
48690 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
48691 whole domain. For non-partial domain lookups, no numerical variables are set.
48692 </para>
48693 </listitem>
48694 </itemizedlist>
48695 </section>
48696 <section id="SECID152">
48697 <title>Rewriting replacements</title>
48698 <para>
48699 <indexterm role="concept">
48700 <primary>rewriting</primary>
48701 <secondary>replacements</secondary>
48702 </indexterm>
48703 If the replacement string for a rule is a single asterisk, addresses that
48704 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
48705 rewriting rules are scanned. For example,
48706 </para>
48707 <literallayout class="monospaced">
48708 hatta@lookingglass.fict.example  *  f
48709 </literallayout>
48710 <para>
48711 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
48712 <emphasis>From:</emphasis> headers.
48713 </para>
48714 <para>
48715 <indexterm role="variable">
48716 <primary><varname>$domain</varname></primary>
48717 </indexterm>
48718 <indexterm role="variable">
48719 <primary><varname>$local_part</varname></primary>
48720 </indexterm>
48721 If the replacement string is not a single asterisk, it is expanded, and must
48722 yield a fully qualified address. Within the expansion, the variables
48723 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
48724 Any letters they contain retain their original case &ndash; they are not lower
48725 cased. The numerical variables are set up according to the type of pattern that
48726 matched the address, as described above. If the expansion is forced to fail by
48727 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
48728 current rule is abandoned, but subsequent rules may take effect. Any other
48729 expansion failure causes the entire rewriting operation to be abandoned, and an
48730 entry written to the panic log.
48731 </para>
48732 </section>
48733 <section id="SECID153">
48734 <title>Rewriting flags</title>
48735 <para>
48736 There are three different kinds of flag that may appear on rewriting rules:
48737 </para>
48738 <itemizedlist>
48739 <listitem>
48740 <para>
48741 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
48742 c, f, h, r, s, t.
48743 </para>
48744 </listitem>
48745 <listitem>
48746 <para>
48747 A flag that specifies rewriting at SMTP time: S.
48748 </para>
48749 </listitem>
48750 <listitem>
48751 <para>
48752 Flags that control the rewriting process: Q, q, R, w.
48753 </para>
48754 </listitem>
48755 </itemizedlist>
48756 <para>
48757 For rules that are part of the <option>headers_rewrite</option> generic transport option,
48758 E, F, T, and S are not permitted.
48759 </para>
48760 </section>
48761 <section id="SECID154">
48762 <title>Flags specifying which headers and envelope addresses to rewrite</title>
48763 <para>
48764 <indexterm role="concept">
48765 <primary>rewriting</primary>
48766 <secondary>flags</secondary>
48767 </indexterm>
48768 If none of the following flag letters, nor the <quote>S</quote> flag (see section
48769 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
48770 and to both the sender and recipient fields of the envelope, whereas a
48771 transport-time rewriting rule just applies to all headers. Otherwise, the
48772 rewriting rule is skipped unless the relevant addresses are being processed.
48773 </para>
48774 <literallayout>
48775 <literal>E</literal>       rewrite all envelope fields
48776 <literal>F</literal>       rewrite the envelope From field
48777 <literal>T</literal>       rewrite the envelope To field
48778 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
48779 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
48780 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
48781 <literal>h</literal>       rewrite all headers
48782 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
48783 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
48784 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
48785 </literallayout>
48786 <para>
48787 "All headers" means all of the headers listed above that can be selected
48788 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
48789 other headers such as <emphasis>Subject:</emphasis> etc.
48790 </para>
48791 <para>
48792 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
48793 restrict this to special known cases in your own domains.
48794 </para>
48795 </section>
48796 <section id="SECTrewriteS">
48797 <title>The SMTP-time rewriting flag</title>
48798 <para>
48799 <indexterm role="concept">
48800 <primary>SMTP</primary>
48801 <secondary>rewriting malformed addresses</secondary>
48802 </indexterm>
48803 <indexterm role="concept">
48804 <primary>RCPT</primary>
48805 <secondary>rewriting argument of</secondary>
48806 </indexterm>
48807 <indexterm role="concept">
48808 <primary>MAIL</primary>
48809 <secondary>rewriting argument of</secondary>
48810 </indexterm>
48811 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
48812 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
48813 before any other processing; even before syntax checking. The pattern is
48814 required to be a regular expression, and it is matched against the whole of the
48815 data for the command, including any surrounding angle brackets.
48816 </para>
48817 <para>
48818 <indexterm role="variable">
48819 <primary><varname>$domain</varname></primary>
48820 </indexterm>
48821 <indexterm role="variable">
48822 <primary><varname>$local_part</varname></primary>
48823 </indexterm>
48824 This form of rewrite rule allows for the handling of addresses that are not
48825 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
48826 input). Because the input is not required to be a syntactically valid address,
48827 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
48828 expansion of the replacement string. The result of rewriting replaces the
48829 original address in the MAIL or RCPT command.
48830 </para>
48831 </section>
48832 <section id="SECID155">
48833 <title>Flags controlling the rewriting process</title>
48834 <para>
48835 There are four flags which control the way the rewriting process works. These
48836 take effect only when a rule is invoked, that is, when the address is of the
48837 correct type (matches the flags) and matches the pattern:
48838 </para>
48839 <itemizedlist>
48840 <listitem>
48841 <para>
48842 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
48843 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
48844 absence of <quote>Q</quote> the rewritten address must always include a domain.
48845 </para>
48846 </listitem>
48847 <listitem>
48848 <para>
48849 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
48850 even if no rewriting actually takes place because of a <quote>fail</quote> in the
48851 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
48852 (does not match the flags) or does not match the pattern.
48853 </para>
48854 </listitem>
48855 <listitem>
48856 <para>
48857 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
48858 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
48859 rewriting once it fails to match (after at least one successful rewrite).
48860 </para>
48861 </listitem>
48862 <listitem>
48863 <para>
48864 <indexterm role="concept">
48865 <primary>rewriting</primary>
48866 <secondary>whole addresses</secondary>
48867 </indexterm>
48868 When an address in a header is rewritten, the rewriting normally applies only
48869 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
48870 left unchanged. For example, rewriting might change
48871 </para>
48872 <literallayout class="monospaced">
48873 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
48874 </literallayout>
48875 <para>
48876 into
48877 </para>
48878 <literallayout class="monospaced">
48879 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
48880 </literallayout>
48881 <para>
48882 <indexterm role="concept">
48883 <primary>RFC 2047</primary>
48884 </indexterm>
48885 Sometimes there is a need to replace the whole address item, and this can be
48886 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
48887 causes an address in a header line to be rewritten, the entire address is
48888 replaced, not just the working part. The replacement must be a complete RFC
48889 2822 address, including the angle brackets if necessary. If text outside angle
48890 brackets contains a character whose value is greater than 126 or less than 32
48891 (except for tab), the text is encoded according to RFC 2047. The character set
48892 is taken from <option>headers_charset</option>, which gets its default at build time.
48893 </para>
48894 <para>
48895 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
48896 rewritten, all but the working part of the replacement address is discarded.
48897 </para>
48898 </listitem>
48899 </itemizedlist>
48900 </section>
48901 <section id="SECID156">
48902 <title>Rewriting examples</title>
48903 <para>
48904 Here is an example of the two common rewriting paradigms:
48905 </para>
48906 <literallayout class="monospaced">
48907 *@*.hitch.fict.example  $1@hitch.fict.example
48908 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
48909                      {$value}fail}@hitch.fict.example bctfrF
48910 </literallayout>
48911 <para>
48912 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
48913 the string expansion to fail if the lookup does not succeed. In this context it
48914 has the effect of leaving the original address unchanged, but Exim goes on to
48915 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
48916 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
48917 explicitly, which would cause the rewritten address to be the same as before,
48918 at the cost of a small bit of processing. Not supplying either of these is an
48919 error, since the rewritten address would then contain no local part.
48920 </para>
48921 <para>
48922 The first example above replaces the domain with a superior, more general
48923 domain. This may not be desirable for certain local parts. If the rule
48924 </para>
48925 <literallayout class="monospaced">
48926 root@*.hitch.fict.example  *
48927 </literallayout>
48928 <para>
48929 were inserted before the first rule, rewriting would be suppressed for the
48930 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
48931 </para>
48932 <para>
48933 Rewriting can be made conditional on a number of tests, by making use of
48934 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
48935 messages that originate outside the local host:
48936 </para>
48937 <literallayout class="monospaced">
48938 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
48939                          {$1@hitch.fict.example}fail}"
48940 </literallayout>
48941 <para>
48942 The replacement string is quoted in this example because it contains white
48943 space.
48944 </para>
48945 <para>
48946 <indexterm role="concept">
48947 <primary>rewriting</primary>
48948 <secondary>bang paths</secondary>
48949 </indexterm>
48950 <indexterm role="concept">
48951 <primary>bang paths</primary>
48952 <secondary>rewriting</secondary>
48953 </indexterm>
48954 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
48955 an address it treats it as an unqualified local part which it qualifies with
48956 the local qualification domain (if the source of the message is local or if the
48957 remote host is permitted to send unqualified addresses). Rewriting can
48958 sometimes be used to handle simple bang paths with a fixed number of
48959 components. For example, the rule
48960 </para>
48961 <literallayout class="monospaced">
48962 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
48963 </literallayout>
48964 <para>
48965 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
48966 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
48967 a global rewriting rule for envelope addresses. It can provide a backdoor
48968 method for using your system as a relay, because the incoming addresses appear
48969 to be local. If the bang path addresses are received via SMTP, it is safer to
48970 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
48971 can be done on the rewritten addresses.
48972 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
48973 </para>
48974 </section>
48975 </chapter>
48976
48977 <chapter id="CHAPretry">
48978 <title>Retry configuration</title>
48979 <para>
48980 <indexterm role="concept" id="IIDretconf1" class="startofrange">
48981 <primary>retry</primary>
48982 <secondary>configuration, description of</secondary>
48983 </indexterm>
48984 <indexterm role="concept" id="IIDregconf2" class="startofrange">
48985 <primary>configuration file</primary>
48986 <secondary>retry section</secondary>
48987 </indexterm>
48988 The <quote>retry</quote> section of the runtime configuration file contains a list of
48989 retry rules that control how often Exim tries to deliver messages that cannot
48990 be delivered at the first attempt. If there are no retry rules (the section is
48991 empty or not present), there are no retries. In this situation, temporary
48992 errors are treated as permanent. The default configuration contains a single,
48993 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
48994 line option can be used to test which retry rule will be used for a given
48995 address, domain and error.
48996 </para>
48997 <para>
48998 The most common cause of retries is temporary failure to deliver to a remote
48999 host because the host is down, or inaccessible because of a network problem.
49000 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
49001 address) basis, not on a per-message basis. Thus, if one message has recently
49002 been delayed, delivery of a new message to the same host is not immediately
49003 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
49004 log selector is set, the message
49005 <indexterm role="concept">
49006 <primary>retry</primary>
49007 <secondary>time not reached</secondary>
49008 </indexterm>
49009 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
49010 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
49011 the handling of errors during remote deliveries.
49012 </para>
49013 <para>
49014 Retry processing applies to routing as well as to delivering, except as covered
49015 in the next paragraph. The retry rules do not distinguish between these
49016 actions. It is not possible, for example, to specify different behaviour for
49017 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
49018 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
49019 added complication, so did not implement it. However, although they share the
49020 same retry rule, the actual retry times for routing and transporting a given
49021 domain are maintained independently.
49022 </para>
49023 <para>
49024 When a delivery is not part of a queue run (typically an immediate delivery on
49025 receipt of a message), the routers are always run, and local deliveries are
49026 always attempted, even if retry times are set for them. This makes for better
49027 behaviour if one particular message is causing problems (for example, causing
49028 quota overflow, or provoking an error in a filter file). If such a delivery
49029 suffers a temporary failure, the retry data is updated as normal, and
49030 subsequent delivery attempts from queue runs occur only when the retry time for
49031 the local address is reached.
49032 </para>
49033 <section id="SECID157">
49034 <title>Changing retry rules</title>
49035 <para>
49036 If you change the retry rules in your configuration, you should consider
49037 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
49038 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
49039 always safe; that is why they are called <quote>hints</quote>.
49040 </para>
49041 <para>
49042 The hints retry data contains suggested retry times based on the previous
49043 rules. In the case of a long-running problem with a remote host, it might
49044 record the fact that the host has timed out. If your new rules increase the
49045 timeout time for such a host, you should definitely remove the old retry data
49046 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
49047 messages that it should now be retaining.
49048 </para>
49049 </section>
49050 <section id="SECID158">
49051 <title>Format of retry rules</title>
49052 <para>
49053 <indexterm role="concept">
49054 <primary>retry</primary>
49055 <secondary>rules</secondary>
49056 </indexterm>
49057 Each retry rule occupies one line and consists of three or four parts,
49058 separated by white space: a pattern, an error name, an optional list of sender
49059 addresses, and a list of retry parameters. The pattern and sender lists must be
49060 enclosed in double quotes if they contain white space. The rules are searched
49061 in order until one is found where the pattern, error name, and sender list (if
49062 present) match the failing host or address, the error that occurred, and the
49063 message&#x2019;s sender, respectively.
49064 </para>
49065 <para>
49066 The pattern is any single item that may appear in an address list (see section
49067 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
49068 which means that it is expanded before being tested against the address that
49069 has been delayed. A negated address list item is permitted. Address
49070 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
49071 which makes it possible for many retry rules to start with just a domain. For
49072 example,
49073 </para>
49074 <literallayout class="monospaced">
49075 lookingglass.fict.example        *  F,24h,30m;
49076 </literallayout>
49077 <para>
49078 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
49079 whereas
49080 </para>
49081 <literallayout class="monospaced">
49082 alice@lookingglass.fict.example  *  F,24h,30m;
49083 </literallayout>
49084 <para>
49085 applies only to temporary failures involving the local part <option>alice</option>.
49086 In practice, almost all rules start with a domain name pattern without a local
49087 part.
49088 </para>
49089 <para>
49090 <indexterm role="concept">
49091 <primary>regular expressions</primary>
49092 <secondary>in retry rules</secondary>
49093 </indexterm>
49094 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
49095 must match a complete address, not just a domain, because that is how regular
49096 expressions work in address lists.
49097 </para>
49098 <literallayout>
49099 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
49100 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
49101 </literallayout>
49102 </section>
49103 <section id="SECID159">
49104 <title>Choosing which retry rule to use for address errors</title>
49105 <para>
49106 When Exim is looking for a retry rule after a routing attempt has failed (for
49107 example, after a DNS timeout), each line in the retry configuration is tested
49108 against the complete address only if <option>retry_use_local_part</option> is set for the
49109 router. Otherwise, only the domain is used, except when matching against a
49110 regular expression, when the local part of the address is replaced with <quote>*</quote>.
49111 A domain on its own can match a domain pattern, or a pattern that starts with
49112 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
49113 <option>check_local_user</option> is true, and false for other routers.
49114 </para>
49115 <para>
49116 Similarly, when Exim is looking for a retry rule after a local delivery has
49117 failed (for example, after a mailbox full error), each line in the retry
49118 configuration is tested against the complete address only if
49119 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
49120 local transports).
49121 </para>
49122 <para>
49123 <indexterm role="concept">
49124 <primary>4<emphasis>xx</emphasis> responses</primary>
49125 <secondary>retry rules for</secondary>
49126 </indexterm>
49127 However, when Exim is looking for a retry rule after a remote delivery attempt
49128 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
49129 whole address is always used as the key when searching the retry rules. The
49130 rule that is found is used to create a retry time for the combination of the
49131 failing address and the message&#x2019;s sender. It is the combination of sender and
49132 recipient that is delayed in subsequent queue runs until its retry time is
49133 reached. You can delay the recipient without regard to the sender by setting
49134 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
49135 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
49136 commands.
49137 </para>
49138 </section>
49139 <section id="SECID160">
49140 <title>Choosing which retry rule to use for host and message errors</title>
49141 <para>
49142 For a temporary error that is not related to an individual address (for
49143 example, a connection timeout), each line in the retry configuration is checked
49144 twice. First, the name of the remote host is used as a domain name (preceded by
49145 <quote>*@</quote> when matching a regular expression). If this does not match the line,
49146 the domain from the email address is tried in a similar fashion. For example,
49147 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
49148 </para>
49149 <literallayout class="monospaced">
49150 a.b.c.example  MX  5  x.y.z.example
49151                MX  6  p.q.r.example
49152                MX  7  m.n.o.example
49153 </literallayout>
49154 <para>
49155 and the retry rules are
49156 </para>
49157 <literallayout class="monospaced">
49158 p.q.r.example    *      F,24h,30m;
49159 a.b.c.example    *      F,4d,45m;
49160 </literallayout>
49161 <para>
49162 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
49163 first rule matches neither the host nor the domain, so Exim looks at the second
49164 rule. This does not match the host, but it does match the domain, so it is used
49165 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
49166 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
49167 first retry rule is used, because it matches the host.
49168 </para>
49169 <para>
49170 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
49171 first rule to determine retry times, but for all the other hosts for the domain
49172 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
49173 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
49174 </para>
49175 <para>
49176 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
49177 However, if a message is routed directly to an IP address without the use of a
49178 host name, for example, if a <command>manualroute</command> router contains a setting such as:
49179 </para>
49180 <literallayout class="monospaced">
49181 route_list = *.a.example  192.168.34.23
49182 </literallayout>
49183 <para>
49184 then the <quote>host name</quote> that is used when searching for a retry rule is the
49185 textual form of the IP address.
49186 </para>
49187 </section>
49188 <section id="SECID161">
49189 <title>Retry rules for specific errors</title>
49190 <para>
49191 <indexterm role="concept">
49192 <primary>retry</primary>
49193 <secondary>specific errors; specifying</secondary>
49194 </indexterm>
49195 The second field in a retry rule is the name of a particular error, or an
49196 asterisk, which matches any error. The errors that can be tested for are:
49197 </para>
49198 <variablelist>
49199 <varlistentry>
49200 <term><option>auth_failed</option></term>
49201 <listitem>
49202 <para>
49203 Authentication failed when trying to send to a host in the
49204 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
49205 </para>
49206 </listitem></varlistentry>
49207 <varlistentry>
49208 <term><option>data_4xx</option></term>
49209 <listitem>
49210 <para>
49211 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
49212 after the command, or after sending the message&#x2019;s data.
49213 </para>
49214 </listitem></varlistentry>
49215 <varlistentry>
49216 <term><option>mail_4xx</option></term>
49217 <listitem>
49218 <para>
49219 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
49220 </para>
49221 </listitem></varlistentry>
49222 <varlistentry>
49223 <term><option>rcpt_4xx</option></term>
49224 <listitem>
49225 <para>
49226 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
49227 </para>
49228 </listitem></varlistentry>
49229 </variablelist>
49230 <para>
49231 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
49232 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
49233 recognize 452 errors given to RCPT commands for addresses in a certain domain,
49234 and have retries every ten minutes with a one-hour timeout, you could set up a
49235 retry rule of this form:
49236 </para>
49237 <literallayout class="monospaced">
49238 the.domain.name  rcpt_452   F,1h,10m
49239 </literallayout>
49240 <para>
49241 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
49242 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
49243 </para>
49244 <variablelist>
49245 <varlistentry>
49246 <term><option>lost_connection</option></term>
49247 <listitem>
49248 <para>
49249 A server unexpectedly closed the SMTP connection. There may, of course,
49250 legitimate reasons for this (host died, network died), but if it repeats a lot
49251 for the same host, it indicates something odd.
49252 </para>
49253 </listitem></varlistentry>
49254 <varlistentry>
49255 <term><option>lookup</option></term>
49256 <listitem>
49257 <para>
49258 A DNS lookup for a host failed.
49259 Note that a <option>dnslookup</option> router will need to have matched
49260 its <option>fail_defer_domains</option> option for this retry type to be usable.
49261 Also note that a <option>manualroute</option> router will probably need
49262 its <option>host_find_failed</option> option set to <option>defer</option>.
49263 </para>
49264 </listitem></varlistentry>
49265 <varlistentry>
49266 <term><option>refused_MX</option></term>
49267 <listitem>
49268 <para>
49269 A connection to a host obtained from an MX record was refused.
49270 </para>
49271 </listitem></varlistentry>
49272 <varlistentry>
49273 <term><option>refused_A</option></term>
49274 <listitem>
49275 <para>
49276 A connection to a host not obtained from an MX record was refused.
49277 </para>
49278 </listitem></varlistentry>
49279 <varlistentry>
49280 <term><option>refused</option></term>
49281 <listitem>
49282 <para>
49283 A connection was refused.
49284 </para>
49285 </listitem></varlistentry>
49286 <varlistentry>
49287 <term><option>timeout_connect_MX</option></term>
49288 <listitem>
49289 <para>
49290 A connection attempt to a host obtained from an MX record timed out.
49291 </para>
49292 </listitem></varlistentry>
49293 <varlistentry>
49294 <term><option>timeout_connect_A</option></term>
49295 <listitem>
49296 <para>
49297 A connection attempt to a host not obtained from an MX record timed out.
49298 </para>
49299 </listitem></varlistentry>
49300 <varlistentry>
49301 <term><option>timeout_connect</option></term>
49302 <listitem>
49303 <para>
49304 A connection attempt timed out.
49305 </para>
49306 </listitem></varlistentry>
49307 <varlistentry>
49308 <term><option>timeout_MX</option></term>
49309 <listitem>
49310 <para>
49311 There was a timeout while connecting or during an SMTP session with a host
49312 obtained from an MX record.
49313 </para>
49314 </listitem></varlistentry>
49315 <varlistentry>
49316 <term><option>timeout_A</option></term>
49317 <listitem>
49318 <para>
49319 There was a timeout while connecting or during an SMTP session with a host not
49320 obtained from an MX record.
49321 </para>
49322 </listitem></varlistentry>
49323 <varlistentry>
49324 <term><option>timeout</option></term>
49325 <listitem>
49326 <para>
49327 There was a timeout while connecting or during an SMTP session.
49328 </para>
49329 </listitem></varlistentry>
49330 <varlistentry>
49331 <term><option>tls_required</option></term>
49332 <listitem>
49333 <para>
49334 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
49335 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
49336 to STARTTLS, or there was a problem setting up the TLS connection.
49337 </para>
49338 </listitem></varlistentry>
49339 <varlistentry>
49340 <term><option>quota</option></term>
49341 <listitem>
49342 <para>
49343 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49344 transport.
49345 </para>
49346 </listitem></varlistentry>
49347 <varlistentry>
49348 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
49349 <listitem>
49350 <para>
49351 <indexterm role="concept">
49352 <primary>quota</primary>
49353 <secondary>error testing in retry rule</secondary>
49354 </indexterm>
49355 <indexterm role="concept">
49356 <primary>retry</primary>
49357 <secondary>quota error testing</secondary>
49358 </indexterm>
49359 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49360 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
49361 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
49362 for four days.
49363 </para>
49364 </listitem></varlistentry>
49365 </variablelist>
49366 <para>
49367 <indexterm role="concept">
49368 <primary>mailbox</primary>
49369 <secondary>time of last read</secondary>
49370 </indexterm>
49371 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
49372 timeouts when the mailbox is full and is not being read by its owner. Ideally,
49373 it should be based on the last time that the user accessed the mailbox.
49374 However, it is not always possible to determine this. Exim uses the following
49375 heuristic rules:
49376 </para>
49377 <itemizedlist>
49378 <listitem>
49379 <para>
49380 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
49381 used. As no new messages are being delivered (because the mailbox is over
49382 quota), Exim does not access the file, so this is the time of last user access.
49383 </para>
49384 </listitem>
49385 <listitem>
49386 <para>
49387 <indexterm role="concept">
49388 <primary>maildir format</primary>
49389 <secondary>time of last read</secondary>
49390 </indexterm>
49391 For a maildir delivery, the time of last modification of the <filename>new</filename>
49392 subdirectory is used. As the mailbox is over quota, no new files are created in
49393 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
49394 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
49395 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
49396 time that is used is therefore the last time that the user read a new message.
49397 </para>
49398 </listitem>
49399 <listitem>
49400 <para>
49401 For other kinds of multi-file mailbox, the time of last access cannot be
49402 obtained, so a retry rule that uses this type of error field is never matched.
49403 </para>
49404 </listitem>
49405 </itemizedlist>
49406 <para>
49407 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
49408 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
49409 when a local delivery is deferred because a partition is full (the ENOSPC
49410 error).
49411 </para>
49412 </section>
49413 <section id="SECID162">
49414 <title>Retry rules for specified senders</title>
49415 <para>
49416 <indexterm role="concept">
49417 <primary>retry</primary>
49418 <secondary>rules; sender-specific</secondary>
49419 </indexterm>
49420 You can specify retry rules that apply only when the failing message has a
49421 specific sender. In particular, this can be used to define retry rules that
49422 apply only to bounce messages. The third item in a retry rule can be of this
49423 form:
49424 </para>
49425 <literallayout>
49426 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
49427 </literallayout>
49428 <para>
49429 The retry timings themselves are then the fourth item. For example:
49430 </para>
49431 <literallayout class="monospaced">
49432 *   rcpt_4xx   senders=:   F,1h,30m
49433 </literallayout>
49434 <para>
49435 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
49436 host. If the address list contains white space, it must be enclosed in quotes.
49437 For example:
49438 </para>
49439 <literallayout class="monospaced">
49440 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
49441 </literallayout>
49442 <para>
49443 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
49444 (which do not depend on the recipient). The reason is that the sender is used
49445 only to match the retry rule. Once the rule has been found for a host error,
49446 its contents are used to set a retry time for the host, and this will apply to
49447 all messages, not just those with specific senders.
49448 </para>
49449 <para>
49450 When testing retry rules using <option>-brt</option>, you can supply a sender using the
49451 <option>-f</option> command line option, like this:
49452 </para>
49453 <literallayout class="monospaced">
49454 exim -f "" -brt user@dom.ain
49455 </literallayout>
49456 <para>
49457 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
49458 list is never matched.
49459 </para>
49460 </section>
49461 <section id="SECID163">
49462 <title>Retry parameters</title>
49463 <para>
49464 <indexterm role="concept">
49465 <primary>retry</primary>
49466 <secondary>parameters in rules</secondary>
49467 </indexterm>
49468 The third (or fourth, if a senders list is present) field in a retry rule is a
49469 sequence of retry parameter sets, separated by semicolons. Each set consists of
49470 </para>
49471 <literallayout>
49472 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
49473 </literallayout>
49474 <para>
49475 The letter identifies the algorithm for computing a new retry time; the cutoff
49476 time is the time beyond which this algorithm no longer applies, and the
49477 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
49478 time that the first failure for the domain (combined with the local part if
49479 relevant) was detected, not from the time the message was received.
49480 </para>
49481 <para>
49482 <indexterm role="concept">
49483 <primary>retry</primary>
49484 <secondary>algorithms</secondary>
49485 </indexterm>
49486 <indexterm role="concept">
49487 <primary>retry</primary>
49488 <secondary>fixed intervals</secondary>
49489 </indexterm>
49490 <indexterm role="concept">
49491 <primary>retry</primary>
49492 <secondary>increasing intervals</secondary>
49493 </indexterm>
49494 <indexterm role="concept">
49495 <primary>retry</primary>
49496 <secondary>random intervals</secondary>
49497 </indexterm>
49498 The available algorithms are:
49499 </para>
49500 <itemizedlist>
49501 <listitem>
49502 <para>
49503 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
49504 the interval.
49505 </para>
49506 </listitem>
49507 <listitem>
49508 <para>
49509 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
49510 specifies a starting value for the interval, and the second a multiplier, which
49511 is used to increase the size of the interval at each retry.
49512 </para>
49513 </listitem>
49514 <listitem>
49515 <para>
49516 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
49517 retry, the previous interval is multiplied by the factor in order to get a
49518 maximum for the next interval. The minimum interval is the first argument of
49519 the parameter, and an actual interval is chosen randomly between them. Such a
49520 rule has been found to be helpful in cluster configurations when all the
49521 members of the cluster restart at once, and may therefore synchronize their
49522 queue processing times.
49523 </para>
49524 </listitem>
49525 </itemizedlist>
49526 <para>
49527 When computing the next retry time, the algorithm definitions are scanned in
49528 order until one whose cutoff time has not yet passed is reached. This is then
49529 used to compute a new retry time that is later than the current time. In the
49530 case of fixed interval retries, this simply means adding the interval to the
49531 current time. For geometrically increasing intervals, retry intervals are
49532 computed from the rule&#x2019;s parameters until one that is greater than the previous
49533 interval is found. The main configuration variable
49534 <indexterm role="concept">
49535 <primary>limit</primary>
49536 <secondary>retry interval</secondary>
49537 </indexterm>
49538 <indexterm role="concept">
49539 <primary>retry</primary>
49540 <secondary>interval, maximum</secondary>
49541 </indexterm>
49542 <indexterm role="option">
49543 <primary><option>retry_interval_max</option></primary>
49544 </indexterm>
49545 <option>retry_interval_max</option> limits the maximum interval between retries. It
49546 cannot be set greater than <literal>24h</literal>, which is its default value.
49547 </para>
49548 <para>
49549 A single remote domain may have a number of hosts associated with it, and each
49550 host may have more than one IP address. Retry algorithms are selected on the
49551 basis of the domain name, but are applied to each IP address independently. If,
49552 for example, a host has two IP addresses and one is unusable, Exim will
49553 generate retry times for it and will not try to use it until its next retry
49554 time comes. Thus the good IP address is likely to be tried first most of the
49555 time.
49556 </para>
49557 <para>
49558 <indexterm role="concept">
49559 <primary>hints database</primary>
49560 <secondary>use for retrying</secondary>
49561 </indexterm>
49562 Retry times are hints rather than promises. Exim does not make any attempt to
49563 run deliveries exactly at the computed times. Instead, a queue runner process
49564 starts delivery processes for delayed messages periodically, and these attempt
49565 new deliveries only for those addresses that have passed their next retry time.
49566 If a new message arrives for a deferred address, an immediate delivery attempt
49567 occurs only if the address has passed its retry time. In the absence of new
49568 messages, the minimum time between retries is the interval between queue runner
49569 processes. There is not much point in setting retry times of five minutes if
49570 your queue runners happen only once an hour, unless there are a significant
49571 number of incoming messages (which might be the case on a system that is
49572 sending everything to a smart host, for example).
49573 </para>
49574 <para>
49575 The data in the retry hints database can be inspected by using the
49576 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
49577 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
49578 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
49579 are for the hosts associated with a particular mail domain, and also for local
49580 deliveries that have been deferred.
49581 </para>
49582 </section>
49583 <section id="SECID164">
49584 <title>Retry rule examples</title>
49585 <para>
49586 Here are some example retry rules:
49587 </para>
49588 <literallayout class="monospaced">
49589 alice@wonderland.fict.example quota_5d  F,7d,3h
49590 wonderland.fict.example       quota_5d
49591 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
49592 lookingglass.fict.example     *         F,24h,30m;
49593 *                 refused_A   F,2h,20m;
49594 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
49595 </literallayout>
49596 <para>
49597 The first rule sets up special handling for mail to
49598 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
49599 mailbox has not been read for at least 5 days. Retries continue every three
49600 hours for 7 days. The second rule handles over-quota errors for all other local
49601 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
49602 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
49603 fail are bounced immediately if the mailbox has not been read for at least 5
49604 days.
49605 </para>
49606 <para>
49607 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
49608 happen every 15 minutes for an hour, then with geometrically increasing
49609 intervals until two days have passed since a delivery first failed. After the
49610 first hour there is a delay of one hour, then two hours, then four hours, and
49611 so on (this is a rather extreme example).
49612 </para>
49613 <para>
49614 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
49615 They happen every 30 minutes for 24 hours only. The remaining two rules handle
49616 all other domains, with special action for connection refusal from hosts that
49617 were not obtained from an MX record.
49618 </para>
49619 <para>
49620 The final rule in a retry configuration should always have asterisks in the
49621 first two fields so as to provide a general catch-all for any addresses that do
49622 not have their own special handling. This example tries every 15 minutes for 2
49623 hours, then with intervals starting at one hour and increasing by a factor of
49624 1.5 up to 16 hours, then every 8 hours up to 5 days.
49625 </para>
49626 </section>
49627 <section id="SECID165">
49628 <title>Timeout of retry data</title>
49629 <para>
49630 <indexterm role="concept">
49631 <primary>timeout</primary>
49632 <secondary>of retry data</secondary>
49633 </indexterm>
49634 <indexterm role="option">
49635 <primary><option>retry_data_expire</option></primary>
49636 </indexterm>
49637 <indexterm role="concept">
49638 <primary>hints database</primary>
49639 <secondary>data expiry</secondary>
49640 </indexterm>
49641 <indexterm role="concept">
49642 <primary>retry</primary>
49643 <secondary>timeout of data</secondary>
49644 </indexterm>
49645 Exim timestamps the data that it writes to its retry hints database. When it
49646 consults the data during a delivery it ignores any that is older than the value
49647 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
49648 been tried for 7 days, Exim will try to deliver to it immediately a message
49649 arrives, and if that fails, it will calculate a retry time as if it were
49650 failing for the first time.
49651 </para>
49652 <para>
49653 This improves the behaviour for messages routed to rarely-used hosts such as MX
49654 backups. If such a host was down at one time, and happens to be down again when
49655 Exim tries a month later, using the old retry data would imply that it had been
49656 down all the time, which is not a justified assumption.
49657 </para>
49658 <para>
49659 If a host really is permanently dead, this behaviour causes a burst of retries
49660 every now and again, but only if messages routed to it are rare. If there is a
49661 message at least once every 7 days the retry data never expires.
49662 </para>
49663 </section>
49664 <section id="SECID166">
49665 <title>Long-term failures</title>
49666 <para>
49667 <indexterm role="concept">
49668 <primary>delivery failure, long-term</primary>
49669 </indexterm>
49670 <indexterm role="concept">
49671 <primary>retry</primary>
49672 <secondary>after long-term failure</secondary>
49673 </indexterm>
49674 Special processing happens when an email address has been failing for so long
49675 that the cutoff time for the last algorithm is reached. For example, using the
49676 default retry rule:
49677 </para>
49678 <literallayout class="monospaced">
49679 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
49680 </literallayout>
49681 <para>
49682 the cutoff time is four days. Reaching the retry cutoff is independent of how
49683 long any specific message has been failing; it is the length of continuous
49684 failure for the recipient address that counts.
49685 </para>
49686 <para>
49687 When the cutoff time is reached for a local delivery, or for all the IP
49688 addresses associated with a remote delivery, a subsequent delivery failure
49689 causes Exim to give up on the address, and a bounce message is generated.
49690 In order to cater for new messages that use the failing address, a next retry
49691 time is still computed from the final algorithm, and is used as follows:
49692 </para>
49693 <para>
49694 For local deliveries, one delivery attempt is always made for any subsequent
49695 messages. If this delivery fails, the address fails immediately. The
49696 post-cutoff retry time is not used.
49697 </para>
49698 <para>
49699 If the delivery is remote, there are two possibilities, controlled by the
49700 <indexterm role="option">
49701 <primary><option>delay_after_cutoff</option></primary>
49702 </indexterm>
49703 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
49704 default. Until the post-cutoff retry time for one of the IP addresses is
49705 reached, the failing email address is bounced immediately, without a delivery
49706 attempt taking place. After that time, one new delivery attempt is made to
49707 those IP addresses that are past their retry times, and if that still fails,
49708 the address is bounced and new retry times are computed.
49709 </para>
49710 <para>
49711 In other words, when all the hosts for a given email address have been failing
49712 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
49713 times is reached. Then it tries once, and bounces if that attempt fails. This
49714 behaviour ensures that few resources are wasted in repeatedly trying to deliver
49715 to a broken destination, but if the host does recover, Exim will eventually
49716 notice.
49717 </para>
49718 <para>
49719 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
49720 addresses are past their final cutoff time, Exim tries to deliver to those IP
49721 addresses that have not been tried since the message arrived. If there are
49722 no suitable IP addresses, or if they all fail, the address is bounced. In other
49723 words, it does not delay when a new message arrives, but tries the expired
49724 addresses immediately, unless they have been tried since the message arrived.
49725 If there is a continuous stream of messages for the failing domains, setting
49726 <option>delay_after_cutoff</option> false means that there will be many more attempts to
49727 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
49728 true.
49729 </para>
49730 </section>
49731 <section id="SECID167">
49732 <title>Deliveries that work intermittently</title>
49733 <para>
49734 <indexterm role="concept">
49735 <primary>retry</primary>
49736 <secondary>intermittently working deliveries</secondary>
49737 </indexterm>
49738 Some additional logic is needed to cope with cases where a host is
49739 intermittently available, or when a message has some attribute that prevents
49740 its delivery when others to the same address get through. In this situation,
49741 because some messages are successfully delivered, the <quote>retry clock</quote> for the
49742 host or address keeps getting reset by the successful deliveries, and so
49743 failing messages remain on the queue for ever because the cutoff time is never
49744 reached.
49745 </para>
49746 <para>
49747 Two exceptional actions are applied to prevent this happening. The first
49748 applies to errors that are related to a message rather than a remote host.
49749 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
49750 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
49751 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
49752 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
49753 is used when scanning the retry rules to decide when to try next and when to
49754 time out the address.
49755 </para>
49756 <para>
49757 The exceptional second action applies in all cases. If a message has been on
49758 the queue for longer than the cutoff time of any applicable retry rule for a
49759 given address, a delivery is attempted for that address, even if it is not yet
49760 time, and if this delivery fails, the address is timed out. A new retry time is
49761 not computed in this case, so that other messages for the same address are
49762 considered immediately.
49763 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
49764 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
49765 </para>
49766 </section>
49767 </chapter>
49768
49769 <chapter id="CHAPSMTPAUTH">
49770 <title>SMTP authentication</title>
49771 <para>
49772 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
49773 <primary>SMTP</primary>
49774 <secondary>authentication configuration</secondary>
49775 </indexterm>
49776 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
49777 <primary>authentication</primary>
49778 </indexterm>
49779 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
49780 with SMTP authentication. This facility is an extension to the SMTP protocol,
49781 described in RFC 2554, which allows a client SMTP host to authenticate itself
49782 to a server. This is a common way for a server to recognize clients that are
49783 permitted to use it as a relay. SMTP authentication is not of relevance to the
49784 transfer of mail between servers that have no managerial connection with each
49785 other.
49786 </para>
49787 <para>
49788 <indexterm role="concept">
49789 <primary>AUTH</primary>
49790 <secondary>description of</secondary>
49791 </indexterm>
49792 Very briefly, the way SMTP authentication works is as follows:
49793 </para>
49794 <itemizedlist>
49795 <listitem>
49796 <para>
49797 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
49798 the client&#x2019;s EHLO command.
49799 </para>
49800 </listitem>
49801 <listitem>
49802 <para>
49803 The client issues an AUTH command, naming a specific mechanism. The command
49804 may, optionally, contain some authentication data.
49805 </para>
49806 </listitem>
49807 <listitem>
49808 <para>
49809 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
49810 appropriate responses. In simple authentication mechanisms, the challenges are
49811 just prompts for user names and passwords. The server does not have to issue
49812 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
49813 with the AUTH command.
49814 </para>
49815 </listitem>
49816 <listitem>
49817 <para>
49818 The server either accepts or denies authentication.
49819 </para>
49820 </listitem>
49821 <listitem>
49822 <para>
49823 If authentication succeeds, the client may optionally make use of the AUTH
49824 option on the MAIL command to pass an authenticated sender in subsequent
49825 mail transactions. Authentication lasts for the remainder of the SMTP
49826 connection.
49827 </para>
49828 </listitem>
49829 <listitem>
49830 <para>
49831 If authentication fails, the client may give up, or it may try a different
49832 authentication mechanism, or it may try transferring mail over the
49833 unauthenticated connection.
49834 </para>
49835 </listitem>
49836 </itemizedlist>
49837 <para>
49838 If you are setting up a client, and want to know which authentication
49839 mechanisms the server supports, you can use Telnet to connect to port 25 (the
49840 SMTP port) on the server, and issue an EHLO command. The response to this
49841 includes the list of supported mechanisms. For example:
49842 </para>
49843 <literallayout>
49844 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
49845 <literal>Trying 192.168.34.25...</literal>
49846 <literal>Connected to server.example.</literal>
49847 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
49848 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
49849 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
49850 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
49851 <literal>250-SIZE 52428800</literal>
49852 <literal>250-PIPELINING</literal>
49853 <literal>250-AUTH PLAIN</literal>
49854 <literal>250 HELP</literal>
49855 </literallayout>
49856 <para>
49857 The second-last line of this example output shows that the server supports
49858 authentication using the PLAIN mechanism. In Exim, the different authentication
49859 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
49860 routers and transports, which authenticators are included in the binary is
49861 controlled by build-time definitions. The following are currently available,
49862 included by setting
49863 </para>
49864 <literallayout class="monospaced">
49865 AUTH_CRAM_MD5=yes
49866 AUTH_CYRUS_SASL=yes
49867 AUTH_DOVECOT=yes
49868 AUTH_GSASL=yes
49869 AUTH_HEIMDAL_GSSAPI=yes
49870 AUTH_PLAINTEXT=yes
49871 AUTH_SPA=yes
49872 AUTH_TLS=yes
49873 </literallayout>
49874 <para>
49875 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
49876 authentication mechanism (RFC 2195), and the second provides an interface to
49877 the Cyrus SASL authentication library.
49878 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
49879 work via a socket interface.
49880 The fourth provides an interface to the GNU SASL authentication library, which
49881 provides mechanisms but typically not data sources.
49882 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
49883 supporting setting a server keytab.
49884 The sixth can be configured to support
49885 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
49886 not formally documented, but used by several MUAs. The seventh authenticator
49887 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
49888 The eighth is an Exim authenticator but not an SMTP one;
49889 instead it can use information from a TLS negotiation.
49890 </para>
49891 <para>
49892 The authenticators are configured using the same syntax as other drivers (see
49893 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
49894 authentication section need be present in the configuration file. Each
49895 authenticator can in principle have both server and client functions. When Exim
49896 is receiving SMTP mail, it is acting as a server; when it is sending out
49897 messages over SMTP, it is acting as a client. Authenticator configuration
49898 options are provided for use in both these circumstances.
49899 </para>
49900 <para>
49901 To make it clear which options apply to which situation, the prefixes
49902 <option>server_</option> and <option>client_</option> are used on option names that are specific to
49903 either the server or the client function, respectively. Server and client
49904 functions are disabled if none of their options are set. If an authenticator is
49905 to be used for both server and client functions, a single definition, using
49906 both sets of options, is required. For example:
49907 </para>
49908 <literallayout class="monospaced">
49909 cram:
49910   driver = cram_md5
49911   public_name = CRAM-MD5
49912   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
49913   client_name = ph10
49914   client_secret = secret2
49915 </literallayout>
49916 <para>
49917 The <option>server_</option> option is used when Exim is acting as a server, and the
49918 <option>client_</option> options when it is acting as a client.
49919 </para>
49920 <para>
49921 Descriptions of the individual authenticators are given in subsequent chapters.
49922 The remainder of this chapter covers the generic options for the
49923 authenticators, followed by general discussion of the way authentication works
49924 in Exim.
49925 </para>
49926 <para>
49927 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
49928 per-mechanism basis.  Please read carefully to determine which variables hold
49929 account labels such as usercodes and which hold passwords or other
49930 authenticating data.
49931 </para>
49932 <para>
49933 Note that some mechanisms support two different identifiers for accounts: the
49934 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
49935 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
49936 Conceptually, authentication data such as passwords are tied to the identifier
49937 used to authenticate; servers may have rules to permit one user to act as a
49938 second user, so that after login the session is treated as though that second
49939 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
49940 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
49941 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
49942 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
49943 choose to honour.
49944 </para>
49945 <para>
49946 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
49947 to a client to help it select an account and credentials to use.  In some
49948 mechanisms, the client and server provably agree on the realm, but clients
49949 typically can not treat the realm as secure data to be blindly trusted.
49950 </para>
49951 <section id="SECID168">
49952 <title>Generic options for authenticators</title>
49953 <para>
49954 <indexterm role="concept">
49955 <primary>authentication</primary>
49956 <secondary>generic options</secondary>
49957 </indexterm>
49958 <indexterm role="concept">
49959 <primary>options</primary>
49960 <secondary>generic; for authenticators</secondary>
49961 </indexterm>
49962 </para>
49963 <para>
49964 <indexterm role="option">
49965 <primary><option>client_condition</option></primary>
49966 </indexterm>
49967 </para>
49968 <informaltable frame="all">
49969 <tgroup cols="4" colsep="0" rowsep="0">
49970 <colspec colwidth="8*" align="left"/>
49971 <colspec colwidth="6*" align="center"/>
49972 <colspec colwidth="6*" align="center"/>
49973 <colspec colwidth="6*" align="right"/>
49974 <tbody>
49975 <row>
49976 <entry><option>client_condition</option></entry>
49977 <entry>Use: <emphasis>authenticators</emphasis></entry>
49978 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49979 <entry>Default: <emphasis>unset</emphasis></entry>
49980 </row>
49981 </tbody>
49982 </tgroup>
49983 </informaltable>
49984 <para>
49985 When Exim is authenticating as a client, it skips any authenticator whose
49986 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
49987 used, for example, to skip plain text authenticators when the connection is not
49988 encrypted by a setting such as:
49989 </para>
49990 <literallayout class="monospaced">
49991 client_condition = ${if !eq{$tls_out_cipher}{}}
49992 </literallayout>
49993 <para>
49994 <indexterm role="option">
49995 <primary><option>client_set_id</option></primary>
49996 </indexterm>
49997 </para>
49998 <informaltable frame="all">
49999 <tgroup cols="4" colsep="0" rowsep="0">
50000 <colspec colwidth="8*" align="left"/>
50001 <colspec colwidth="6*" align="center"/>
50002 <colspec colwidth="6*" align="center"/>
50003 <colspec colwidth="6*" align="right"/>
50004 <tbody>
50005 <row>
50006 <entry><option>client_set_id</option></entry>
50007 <entry>Use: <emphasis>authenticators</emphasis></entry>
50008 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50009 <entry>Default: <emphasis>unset</emphasis></entry>
50010 </row>
50011 </tbody>
50012 </tgroup>
50013 </informaltable>
50014 <para>
50015 When client authentication succeeds, this condition is expanded; the
50016 result is used in the log lines for outbound messages.
50017 Typically it will be the user name used for authentication.
50018 </para>
50019 <para>
50020 <indexterm role="option">
50021 <primary><option>driver</option></primary>
50022 </indexterm>
50023 </para>
50024 <informaltable frame="all">
50025 <tgroup cols="4" colsep="0" rowsep="0">
50026 <colspec colwidth="8*" align="left"/>
50027 <colspec colwidth="6*" align="center"/>
50028 <colspec colwidth="6*" align="center"/>
50029 <colspec colwidth="6*" align="right"/>
50030 <tbody>
50031 <row>
50032 <entry><option>driver</option></entry>
50033 <entry>Use: <emphasis>authenticators</emphasis></entry>
50034 <entry>Type: <emphasis>string</emphasis></entry>
50035 <entry>Default: <emphasis>unset</emphasis></entry>
50036 </row>
50037 </tbody>
50038 </tgroup>
50039 </informaltable>
50040 <para>
50041 This option must always be set. It specifies which of the available
50042 authenticators is to be used.
50043 </para>
50044 <para>
50045 <indexterm role="option">
50046 <primary><option>public_name</option></primary>
50047 </indexterm>
50048 </para>
50049 <informaltable frame="all">
50050 <tgroup cols="4" colsep="0" rowsep="0">
50051 <colspec colwidth="8*" align="left"/>
50052 <colspec colwidth="6*" align="center"/>
50053 <colspec colwidth="6*" align="center"/>
50054 <colspec colwidth="6*" align="right"/>
50055 <tbody>
50056 <row>
50057 <entry><option>public_name</option></entry>
50058 <entry>Use: <emphasis>authenticators</emphasis></entry>
50059 <entry>Type: <emphasis>string</emphasis></entry>
50060 <entry>Default: <emphasis>unset</emphasis></entry>
50061 </row>
50062 </tbody>
50063 </tgroup>
50064 </informaltable>
50065 <para>
50066 This option specifies the name of the authentication mechanism that the driver
50067 implements, and by which it is known to the outside world. These names should
50068 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
50069 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
50070 defaults to the driver&#x2019;s instance name.
50071 </para>
50072 <para>
50073 <indexterm role="option">
50074 <primary><option>server_advertise_condition</option></primary>
50075 </indexterm>
50076 </para>
50077 <informaltable frame="all">
50078 <tgroup cols="4" colsep="0" rowsep="0">
50079 <colspec colwidth="8*" align="left"/>
50080 <colspec colwidth="6*" align="center"/>
50081 <colspec colwidth="6*" align="center"/>
50082 <colspec colwidth="6*" align="right"/>
50083 <tbody>
50084 <row>
50085 <entry><option>server_advertise_condition</option></entry>
50086 <entry>Use: <emphasis>authenticators</emphasis></entry>
50087 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50088 <entry>Default: <emphasis>unset</emphasis></entry>
50089 </row>
50090 </tbody>
50091 </tgroup>
50092 </informaltable>
50093 <para>
50094 When a server is about to advertise an authentication mechanism, the condition
50095 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
50096 mechanism is not advertised.
50097 If the expansion fails, the mechanism is not advertised. If the failure was not
50098 forced, and was not caused by a lookup defer, the incident is logged.
50099 See section <xref linkend="SECTauthexiser"/> below for further discussion.
50100 </para>
50101 <para>
50102 <indexterm role="option">
50103 <primary><option>server_condition</option></primary>
50104 </indexterm>
50105 </para>
50106 <informaltable frame="all">
50107 <tgroup cols="4" colsep="0" rowsep="0">
50108 <colspec colwidth="8*" align="left"/>
50109 <colspec colwidth="6*" align="center"/>
50110 <colspec colwidth="6*" align="center"/>
50111 <colspec colwidth="6*" align="right"/>
50112 <tbody>
50113 <row>
50114 <entry><option>server_condition</option></entry>
50115 <entry>Use: <emphasis>authenticators</emphasis></entry>
50116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50117 <entry>Default: <emphasis>unset</emphasis></entry>
50118 </row>
50119 </tbody>
50120 </tgroup>
50121 </informaltable>
50122 <para>
50123 This option must be set for a <option>plaintext</option> server authenticator, where it
50124 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
50125 for details.
50126 </para>
50127 <para>
50128 For the <command>gsasl</command> authenticator, this option is required for various
50129 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
50130 </para>
50131 <para>
50132 For the other authenticators, <option>server_condition</option> can be used as an additional
50133 authentication or authorization mechanism that is applied after the other
50134 authenticator conditions succeed. If it is set, it is expanded when the
50135 authenticator would otherwise return a success code. If the expansion is forced
50136 to fail, authentication fails. Any other expansion failure causes a temporary
50137 error code to be returned. If the result of a successful expansion is an empty
50138 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50139 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
50140 other result, a temporary error code is returned, with the expanded string as
50141 the error text.
50142 </para>
50143 <para>
50144 <indexterm role="option">
50145 <primary><option>server_debug_print</option></primary>
50146 </indexterm>
50147 </para>
50148 <informaltable frame="all">
50149 <tgroup cols="4" colsep="0" rowsep="0">
50150 <colspec colwidth="8*" align="left"/>
50151 <colspec colwidth="6*" align="center"/>
50152 <colspec colwidth="6*" align="center"/>
50153 <colspec colwidth="6*" align="right"/>
50154 <tbody>
50155 <row>
50156 <entry><option>server_debug_print</option></entry>
50157 <entry>Use: <emphasis>authenticators</emphasis></entry>
50158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50159 <entry>Default: <emphasis>unset</emphasis></entry>
50160 </row>
50161 </tbody>
50162 </tgroup>
50163 </informaltable>
50164 <para>
50165 If this option is set and authentication debugging is enabled (see the <option>-d</option>
50166 command line option), the string is expanded and included in the debugging
50167 output when the authenticator is run as a server. This can help with checking
50168 out the values of variables.
50169 If expansion of the string fails, the error message is written to the debugging
50170 output, and Exim carries on processing.
50171 </para>
50172 <para>
50173 <indexterm role="option">
50174 <primary><option>server_set_id</option></primary>
50175 </indexterm>
50176 </para>
50177 <informaltable frame="all">
50178 <tgroup cols="4" colsep="0" rowsep="0">
50179 <colspec colwidth="8*" align="left"/>
50180 <colspec colwidth="6*" align="center"/>
50181 <colspec colwidth="6*" align="center"/>
50182 <colspec colwidth="6*" align="right"/>
50183 <tbody>
50184 <row>
50185 <entry><option>server_set_id</option></entry>
50186 <entry>Use: <emphasis>authenticators</emphasis></entry>
50187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50188 <entry>Default: <emphasis>unset</emphasis></entry>
50189 </row>
50190 </tbody>
50191 </tgroup>
50192 </informaltable>
50193 <para>
50194 <indexterm role="variable">
50195 <primary><varname>$authenticated_id</varname></primary>
50196 </indexterm>
50197 When an Exim server successfully authenticates a client, this string is
50198 expanded using data from the authentication, and preserved for any incoming
50199 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
50200 lines for incoming messages. For example, a user/password authenticator
50201 configuration might preserve the user name that was used to authenticate, and
50202 refer to it subsequently during delivery of the message.
50203 If expansion fails, the option is ignored.
50204 </para>
50205 <para>
50206 <indexterm role="option">
50207 <primary><option>server_mail_auth_condition</option></primary>
50208 </indexterm>
50209 </para>
50210 <informaltable frame="all">
50211 <tgroup cols="4" colsep="0" rowsep="0">
50212 <colspec colwidth="8*" align="left"/>
50213 <colspec colwidth="6*" align="center"/>
50214 <colspec colwidth="6*" align="center"/>
50215 <colspec colwidth="6*" align="right"/>
50216 <tbody>
50217 <row>
50218 <entry><option>server_mail_auth_condition</option></entry>
50219 <entry>Use: <emphasis>authenticators</emphasis></entry>
50220 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50221 <entry>Default: <emphasis>unset</emphasis></entry>
50222 </row>
50223 </tbody>
50224 </tgroup>
50225 </informaltable>
50226 <para>
50227 This option allows a server to discard authenticated sender addresses supplied
50228 as part of MAIL commands in SMTP connections that are authenticated by the
50229 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
50230 as part of the authentication process; instead its (unexpanded) value is
50231 remembered for later use.
50232 How it is used is described in the following section.
50233 </para>
50234 </section>
50235 <section id="SECTauthparamail">
50236 <title>The AUTH parameter on MAIL commands</title>
50237 <para>
50238 <indexterm role="concept">
50239 <primary>authentication</primary>
50240 <secondary>sender; authenticated</secondary>
50241 </indexterm>
50242 <indexterm role="concept">
50243 <primary>AUTH</primary>
50244 <secondary>on MAIL command</secondary>
50245 </indexterm>
50246 When a client supplied an AUTH= item on a MAIL command, Exim applies
50247 the following checks before accepting it as the authenticated sender of the
50248 message:
50249 </para>
50250 <itemizedlist>
50251 <listitem>
50252 <para>
50253 If the connection is not using extended SMTP (that is, HELO was used rather
50254 than EHLO), the use of AUTH= is a syntax error.
50255 </para>
50256 </listitem>
50257 <listitem>
50258 <para>
50259 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
50260 </para>
50261 </listitem>
50262 <listitem>
50263 <para>
50264 <indexterm role="variable">
50265 <primary><varname>$authenticated_sender</varname></primary>
50266 </indexterm>
50267 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
50268 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
50269 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
50270 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
50271 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
50272 given for the MAIL command.
50273 </para>
50274 </listitem>
50275 <listitem>
50276 <para>
50277 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
50278 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
50279 authenticated.
50280 </para>
50281 </listitem>
50282 <listitem>
50283 <para>
50284 If the AUTH= value was accepted by either of the two previous rules, and
50285 the client has authenticated, and the authenticator has a setting for the
50286 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
50287 valued that was saved from the authenticator is expanded. If the expansion
50288 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
50289 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
50290 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
50291 message.
50292 </para>
50293 </listitem>
50294 </itemizedlist>
50295 <para>
50296 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
50297 hosts to which Exim authenticates as a client. Do not confuse this value with
50298 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
50299 process, and which is not usually a complete email address.
50300 </para>
50301 <para>
50302 <indexterm role="variable">
50303 <primary><varname>$sender_address</varname></primary>
50304 </indexterm>
50305 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
50306 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
50307 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
50308 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
50309 ACL is run.
50310 </para>
50311 </section>
50312 <section id="SECTauthexiser">
50313 <title>Authentication on an Exim server</title>
50314 <para>
50315 <indexterm role="concept">
50316 <primary>authentication</primary>
50317 <secondary>on an Exim server</secondary>
50318 </indexterm>
50319 When Exim receives an EHLO command, it advertises the public names of those
50320 authenticators that are configured as servers, subject to the following
50321 conditions:
50322 </para>
50323 <itemizedlist>
50324 <listitem>
50325 <para>
50326 The client host must match <option>auth_advertise_hosts</option> (default *).
50327 </para>
50328 </listitem>
50329 <listitem>
50330 <para>
50331 It the <option>server_advertise_condition</option> option is set, its expansion must not
50332 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
50333 </para>
50334 </listitem>
50335 </itemizedlist>
50336 <para>
50337 The order in which the authenticators are defined controls the order in which
50338 the mechanisms are advertised.
50339 </para>
50340 <para>
50341 Some mail clients (for example, some versions of Netscape) require the user to
50342 provide a name and password for authentication whenever AUTH is advertised,
50343 even though authentication may not in fact be needed (for example, Exim may be
50344 set up to allow unconditional relaying from the client by an IP address check).
50345 You can make such clients more friendly by not advertising AUTH to them.
50346 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
50347 that runs for RCPT) to relay without authentication, you should set
50348 </para>
50349 <literallayout class="monospaced">
50350 auth_advertise_hosts = ! 10.9.8.0/24
50351 </literallayout>
50352 <para>
50353 so that no authentication mechanisms are advertised to them.
50354 </para>
50355 <para>
50356 The <option>server_advertise_condition</option> controls the advertisement of individual
50357 authentication mechanisms. For example, it can be used to restrict the
50358 advertisement of a particular mechanism to encrypted connections, by a setting
50359 such as:
50360 </para>
50361 <literallayout class="monospaced">
50362 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
50363 </literallayout>
50364 <para>
50365 <indexterm role="variable">
50366 <primary><varname>$tls_in_cipher</varname></primary>
50367 </indexterm>
50368 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
50369 yields <quote>yes</quote>, which allows the advertisement to happen.
50370 </para>
50371 <para>
50372 When an Exim server receives an AUTH command from a client, it rejects it
50373 immediately if AUTH was not advertised in response to an earlier EHLO
50374 command. This is the case if
50375 </para>
50376 <itemizedlist>
50377 <listitem>
50378 <para>
50379 The client host does not match <option>auth_advertise_hosts</option>; or
50380 </para>
50381 </listitem>
50382 <listitem>
50383 <para>
50384 No authenticators are configured with server options; or
50385 </para>
50386 </listitem>
50387 <listitem>
50388 <para>
50389 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
50390 server authenticators.
50391 </para>
50392 </listitem>
50393 </itemizedlist>
50394 <para>
50395 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
50396 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
50397 AUTH is accepted from any client host.
50398 </para>
50399 <para>
50400 If AUTH is not rejected by the ACL, Exim searches its configuration for a
50401 server authentication mechanism that was advertised in response to EHLO and
50402 that matches the one named in the AUTH command. If it finds one, it runs
50403 the appropriate authentication protocol, and authentication either succeeds or
50404 fails. If there is no matching advertised mechanism, the AUTH command is
50405 rejected with a 504 error.
50406 </para>
50407 <para>
50408 <indexterm role="variable">
50409 <primary><varname>$received_protocol</varname></primary>
50410 </indexterm>
50411 <indexterm role="variable">
50412 <primary><varname>$sender_host_authenticated</varname></primary>
50413 </indexterm>
50414 When a message is received from an authenticated host, the value of
50415 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
50416 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
50417 public name) of the authenticator driver that successfully authenticated the
50418 client from which the message was received. This variable is empty if there was
50419 no successful authentication.
50420 </para>
50421 </section>
50422 <section id="SECID169">
50423 <title>Testing server authentication</title>
50424 <para>
50425 <indexterm role="concept">
50426 <primary>authentication</primary>
50427 <secondary>testing a server</secondary>
50428 </indexterm>
50429 <indexterm role="concept">
50430 <primary>AUTH</primary>
50431 <secondary>testing a server</secondary>
50432 </indexterm>
50433 <indexterm role="concept">
50434 <primary>base64 encoding</primary>
50435 <secondary>creating authentication test data</secondary>
50436 </indexterm>
50437 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
50438 configurations. The data for the AUTH command has to be sent using base64
50439 encoding. A quick way to produce such data for testing is the following Perl
50440 script:
50441 </para>
50442 <literallayout class="monospaced">
50443 use MIME::Base64;
50444 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
50445 </literallayout>
50446 <para>
50447 <indexterm role="concept">
50448 <primary>binary zero</primary>
50449 <secondary>in authentication data</secondary>
50450 </indexterm>
50451 This interprets its argument as a Perl string, and then encodes it. The
50452 interpretation as a Perl string allows binary zeros, which are required for
50453 some kinds of authentication, to be included in the data. For example, a
50454 command line to run this script on such data might be
50455 </para>
50456 <literallayout class="monospaced">
50457 encode '\0user\0password'
50458 </literallayout>
50459 <para>
50460 Note the use of single quotes to prevent the shell interpreting the
50461 backslashes, so that they can be interpreted by Perl to specify characters
50462 whose code value is zero.
50463 </para>
50464 <para>
50465 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
50466 digit, you must use three zeros instead of one after the leading backslash. If
50467 you do not, the octal digit that starts your string will be incorrectly
50468 interpreted as part of the code for the first character.
50469 </para>
50470 <para>
50471 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
50472 specially, you must use a Perl escape to prevent them being misinterpreted. For
50473 example, a command such as
50474 </para>
50475 <literallayout class="monospaced">
50476 encode '\0user@domain.com\0pas$$word'
50477 </literallayout>
50478 <para>
50479 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
50480 </para>
50481 <para>
50482 If you have the <option>mimencode</option> command installed, another way to do produce
50483 base64-encoded strings is to run the command
50484 </para>
50485 <literallayout class="monospaced">
50486 echo -e -n `\0user\0password' | mimencode
50487 </literallayout>
50488 <para>
50489 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
50490 in the argument, and the <option>-n</option> option specifies no newline at the end of its
50491 output. However, not all versions of <option>echo</option> recognize these options, so you
50492 should check your version before relying on this suggestion.
50493 </para>
50494 </section>
50495 <section id="SECID170">
50496 <title>Authentication by an Exim client</title>
50497 <para>
50498 <indexterm role="concept">
50499 <primary>authentication</primary>
50500 <secondary>on an Exim client</secondary>
50501 </indexterm>
50502 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
50503 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
50504 announces support for authentication, and the host matches an entry in either
50505 of these options, Exim (as a client) tries to authenticate as follows:
50506 </para>
50507 <itemizedlist>
50508 <listitem>
50509 <para>
50510 For each authenticator that is configured as a client, in the order in which
50511 they are defined in the configuration, it searches the authentication
50512 mechanisms announced by the server for one whose name matches the public name
50513 of the authenticator.
50514 </para>
50515 </listitem>
50516 <listitem>
50517 <para>
50518 <indexterm role="variable">
50519 <primary><varname>$host</varname></primary>
50520 </indexterm>
50521 <indexterm role="variable">
50522 <primary><varname>$host_address</varname></primary>
50523 </indexterm>
50524 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
50525 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
50526 that the client might do. They are set to the server&#x2019;s name and IP address. If
50527 any expansion is forced to fail, the authentication attempt is abandoned, and
50528 Exim moves on to the next authenticator. Otherwise an expansion failure causes
50529 delivery to be deferred.
50530 </para>
50531 </listitem>
50532 <listitem>
50533 <para>
50534 If the result of the authentication attempt is a temporary error or a timeout,
50535 Exim abandons trying to send the message to the host for the moment. It will
50536 try again later. If there are any backup hosts available, they are tried in the
50537 usual way.
50538 </para>
50539 </listitem>
50540 <listitem>
50541 <para>
50542 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
50543 carries on searching the list of authenticators and tries another one if
50544 possible. If all authentication attempts give permanent errors, or if there are
50545 no attempts because no mechanisms match (or option expansions force failure),
50546 what happens depends on whether the host matches <option>hosts_require_auth</option> or
50547 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
50548 delivery is deferred. The error can be detected in the retry rules, and thereby
50549 turned into a permanent error if you wish. In the second case, Exim tries to
50550 deliver the message unauthenticated.
50551 </para>
50552 </listitem>
50553 </itemizedlist>
50554 <para revisionflag="changed">
50555 Note that the hostlist test for whether to do authentication can be
50556 confused if name-IP lookups change between the time the peer is decided
50557 on and the transport running.  For example, with a manualroute
50558 router given a host name, and DNS "round-robin" use by that name: if
50559 the local resolver cache times out between the router and the transport
50560 running, the transport may get an IP for the name for its authentication
50561 check which does not match the connection peer IP.
50562 No authentication will then be done, despite the names being identical.
50563 </para>
50564 <para revisionflag="changed">
50565 For such cases use a separate transport which always authenticates.
50566 </para>
50567 <para>
50568 <indexterm role="concept">
50569 <primary>AUTH</primary>
50570 <secondary>on MAIL command</secondary>
50571 </indexterm>
50572 When Exim has authenticated itself to a remote server, it adds the AUTH
50573 parameter to the MAIL commands it sends, if it has an authenticated sender for
50574 the message. If the message came from a remote host, the authenticated sender
50575 is the one that was receiving on an incoming MAIL command, provided that the
50576 incoming connection was authenticated and the <option>server_mail_auth</option> condition
50577 allowed the authenticated sender to be retained. If a local process calls Exim
50578 to send a message, the sender address that is built from the login name and
50579 <option>qualify_domain</option> is treated as authenticated. However, if the
50580 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
50581 the authenticated sender that was received with the message.
50582 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
50583 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
50584 </para>
50585 </section>
50586 </chapter>
50587
50588 <chapter id="CHAPplaintext">
50589 <title>The plaintext authenticator</title>
50590 <para>
50591 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
50592 <primary><command>plaintext</command> authenticator</primary>
50593 </indexterm>
50594 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
50595 <primary>authenticators</primary>
50596 <secondary><command>plaintext</command></secondary>
50597 </indexterm>
50598 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
50599 LOGIN authentication mechanisms, both of which transfer authentication data as
50600 plain (unencrypted) text (though base64 encoded). The use of plain text is a
50601 security risk; you are strongly advised to insist on the use of SMTP encryption
50602 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
50603 use unencrypted plain text, you should not use the same passwords for SMTP
50604 connections as you do for login accounts.
50605 </para>
50606 <section id="SECID171">
50607 <title>Plaintext options</title>
50608 <para>
50609 <indexterm role="concept">
50610 <primary>options</primary>
50611 <secondary><command>plaintext</command> authenticator (server)</secondary>
50612 </indexterm>
50613 When configured as a server, <command>plaintext</command> uses the following options:
50614 </para>
50615 <para>
50616 <indexterm role="option">
50617 <primary><option>server_condition</option></primary>
50618 </indexterm>
50619 </para>
50620 <informaltable frame="all">
50621 <tgroup cols="4" colsep="0" rowsep="0">
50622 <colspec colwidth="8*" align="left"/>
50623 <colspec colwidth="6*" align="center"/>
50624 <colspec colwidth="6*" align="center"/>
50625 <colspec colwidth="6*" align="right"/>
50626 <tbody>
50627 <row>
50628 <entry><option>server_condition</option></entry>
50629 <entry>Use: <emphasis>authenticators</emphasis></entry>
50630 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50631 <entry>Default: <emphasis>unset</emphasis></entry>
50632 </row>
50633 </tbody>
50634 </tgroup>
50635 </informaltable>
50636 <para>
50637 This is actually a global authentication option, but it must be set in order to
50638 configure the <command>plaintext</command> driver as a server. Its use is described below.
50639 </para>
50640 <para>
50641 <indexterm role="option">
50642 <primary><option>server_prompts</option></primary>
50643 </indexterm>
50644 </para>
50645 <informaltable frame="all">
50646 <tgroup cols="4" colsep="0" rowsep="0">
50647 <colspec colwidth="8*" align="left"/>
50648 <colspec colwidth="6*" align="center"/>
50649 <colspec colwidth="6*" align="center"/>
50650 <colspec colwidth="6*" align="right"/>
50651 <tbody>
50652 <row>
50653 <entry><option>server_prompts</option></entry>
50654 <entry>Use: <emphasis>plaintext</emphasis></entry>
50655 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50656 <entry>Default: <emphasis>unset</emphasis></entry>
50657 </row>
50658 </tbody>
50659 </tgroup>
50660 </informaltable>
50661 <para>
50662 The contents of this option, after expansion, must be a colon-separated list of
50663 prompt strings. If expansion fails, a temporary authentication rejection is
50664 given.
50665 </para>
50666 </section>
50667 <section id="SECTplainserver">
50668 <title>Using plaintext in a server</title>
50669 <para>
50670 <indexterm role="concept">
50671 <primary>AUTH</primary>
50672 <secondary>in <command>plaintext</command> authenticator</secondary>
50673 </indexterm>
50674 <indexterm role="concept">
50675 <primary>binary zero</primary>
50676 <secondary>in <command>plaintext</command> authenticator</secondary>
50677 </indexterm>
50678 <indexterm role="concept">
50679 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50680 <secondary>in <command>plaintext</command> authenticator</secondary>
50681 </indexterm>
50682 <indexterm role="variable">
50683 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50684 </indexterm>
50685 <indexterm role="concept">
50686 <primary>base64 encoding</primary>
50687 <secondary>in <command>plaintext</command> authenticator</secondary>
50688 </indexterm>
50689 </para>
50690 <para>
50691 When running as a server, <command>plaintext</command> performs the authentication test by
50692 expanding a string. The data sent by the client with the AUTH command, or in
50693 response to subsequent prompts, is base64 encoded, and so may contain any byte
50694 values when decoded. If any data is supplied with the command, it is treated as
50695 a list of strings, separated by NULs (binary zeros), the first three of which
50696 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
50697 (neither LOGIN nor PLAIN uses more than three strings).
50698 </para>
50699 <para>
50700 For compatibility with previous releases of Exim, the values are also placed in
50701 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
50702 variables for this purpose is now deprecated, as it can lead to confusion in
50703 string expansions that also use them for other things.
50704 </para>
50705 <para>
50706 If there are more strings in <option>server_prompts</option> than the number of strings
50707 supplied with the AUTH command, the remaining prompts are used to obtain more
50708 data. Each response from the client may be a list of NUL-separated strings.
50709 </para>
50710 <para>
50711 <indexterm role="variable">
50712 <primary><varname>$authenticated_id</varname></primary>
50713 </indexterm>
50714 Once a sufficient number of data strings have been received,
50715 <option>server_condition</option> is expanded. If the expansion is forced to fail,
50716 authentication fails. Any other expansion failure causes a temporary error code
50717 to be returned. If the result of a successful expansion is an empty string,
50718 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50719 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
50720 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
50721 For any other result, a temporary error code is returned, with the expanded
50722 string as the error text
50723 </para>
50724 <para>
50725 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
50726 password, be sure to make the authentication fail if the user is unknown.
50727 There are good and bad examples at the end of the next section.
50728 </para>
50729 </section>
50730 <section id="SECID172">
50731 <title>The PLAIN authentication mechanism</title>
50732 <para>
50733 <indexterm role="concept">
50734 <primary>PLAIN authentication mechanism</primary>
50735 </indexterm>
50736 <indexterm role="concept">
50737 <primary>authentication</primary>
50738 <secondary>PLAIN mechanism</secondary>
50739 </indexterm>
50740 <indexterm role="concept">
50741 <primary>binary zero</primary>
50742 <secondary>in <command>plaintext</command> authenticator</secondary>
50743 </indexterm>
50744 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
50745 sent as one item of data (that is, one combined string containing two NUL
50746 separators). The data is sent either as part of the AUTH command, or
50747 subsequently in response to an empty prompt from the server.
50748 </para>
50749 <para>
50750 The second and third strings are a user name and a corresponding password.
50751 Using a single fixed user name and password as an example, this could be
50752 configured as follows:
50753 </para>
50754 <literallayout class="monospaced">
50755 fixed_plain:
50756   driver = plaintext
50757   public_name = PLAIN
50758   server_prompts = :
50759   server_condition = \
50760     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
50761   server_set_id = $auth2
50762 </literallayout>
50763 <para>
50764 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
50765 are exactly what we want here, so they need not be specified. Obviously, if the
50766 password contains expansion-significant characters such as dollar, backslash,
50767 or closing brace, they have to be escaped.
50768 </para>
50769 <para>
50770 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
50771 the end of a string list are ignored). If all the data comes as part of the
50772 AUTH command, as is commonly the case, the prompt is not used. This
50773 authenticator is advertised in the response to EHLO as
50774 </para>
50775 <literallayout class="monospaced">
50776 250-AUTH PLAIN
50777 </literallayout>
50778 <para>
50779 and a client host can authenticate itself by sending the command
50780 </para>
50781 <literallayout class="monospaced">
50782 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
50783 </literallayout>
50784 <para>
50785 As this contains three strings (more than the number of prompts), no further
50786 data is required from the client. Alternatively, the client may just send
50787 </para>
50788 <literallayout class="monospaced">
50789 AUTH PLAIN
50790 </literallayout>
50791 <para>
50792 to initiate authentication, in which case the server replies with an empty
50793 prompt. The client must respond with the combined data string.
50794 </para>
50795 <para>
50796 The data string is base64 encoded, as required by the RFC. This example,
50797 when decoded, is &lt;<emphasis>NUL</emphasis>&gt;<literal>username</literal>&lt;<emphasis>NUL</emphasis>&gt;<literal>mysecret</literal>, where &lt;<emphasis>NUL</emphasis>&gt;
50798 represents a zero byte. This is split up into three strings, the first of which
50799 is empty. The <option>server_condition</option> option in the authenticator checks that the
50800 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
50801 </para>
50802 <para>
50803 Having just one fixed user name and password, as in this example, is not very
50804 realistic, though for a small organization with only a handful of
50805 authenticating clients it could make sense.
50806 </para>
50807 <para>
50808 A more sophisticated instance of this authenticator could use the user name in
50809 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
50810 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
50811 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
50812 This is an incorrect example:
50813 </para>
50814 <literallayout class="monospaced">
50815 server_condition = \
50816   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
50817 </literallayout>
50818 <para>
50819 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
50820 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
50821 incorrect? It works fine for existing users, but consider what happens if a
50822 non-existent user name is given. The lookup fails, but as no success/failure
50823 strings are given for the lookup, it yields an empty string. Thus, to defeat
50824 the authentication, all a client has to do is to supply a non-existent user
50825 name and an empty password. The correct way of writing this test is:
50826 </para>
50827 <literallayout class="monospaced">
50828 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
50829   {${if eq{$value}{$auth3}}} {false}}
50830 </literallayout>
50831 <para>
50832 In this case, if the lookup succeeds, the result is checked; if the lookup
50833 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
50834 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
50835 always fails if its second argument is empty. However, the second way of
50836 writing the test makes the logic clearer.
50837 </para>
50838 </section>
50839 <section id="SECID173">
50840 <title>The LOGIN authentication mechanism</title>
50841 <para>
50842 <indexterm role="concept">
50843 <primary>LOGIN authentication mechanism</primary>
50844 </indexterm>
50845 <indexterm role="concept">
50846 <primary>authentication</primary>
50847 <secondary>LOGIN mechanism</secondary>
50848 </indexterm>
50849 The LOGIN authentication mechanism is not documented in any RFC, but is in use
50850 in a number of programs. No data is sent with the AUTH command. Instead, a
50851 user name and password are supplied separately, in response to prompts. The
50852 plaintext authenticator can be configured to support this as in this example:
50853 </para>
50854 <literallayout class="monospaced">
50855 fixed_login:
50856   driver = plaintext
50857   public_name = LOGIN
50858   server_prompts = User Name : Password
50859   server_condition = \
50860     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
50861   server_set_id = $auth1
50862 </literallayout>
50863 <para>
50864 Because of the way plaintext operates, this authenticator accepts data supplied
50865 with the AUTH command (in contravention of the specification of LOGIN), but
50866 if the client does not supply it (as is the case for LOGIN clients), the prompt
50867 strings are used to obtain two data items.
50868 </para>
50869 <para>
50870 Some clients are very particular about the precise text of the prompts. For
50871 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
50872 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
50873 strings. It uses the <option>ldapauth</option> expansion condition to check the user
50874 name and password by binding to an LDAP server:
50875 </para>
50876 <literallayout class="monospaced">
50877 login:
50878   driver = plaintext
50879   public_name = LOGIN
50880   server_prompts = Username:: : Password::
50881   server_condition = ${if and{{ \
50882     !eq{}{$auth1} }{ \
50883     ldapauth{\
50884       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
50885       pass=${quote:$auth2} \
50886       ldap://ldap.example.org/} }} }
50887   server_set_id = uid=$auth1,ou=people,o=example.org
50888 </literallayout>
50889 <para>
50890 We have to check that the username is not empty before using it, because LDAP
50891 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
50892 operator to correctly quote the DN for authentication. However, the basic
50893 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
50894 correct one to use for the password, because quoting is needed only to make
50895 the password conform to the Exim syntax. At the LDAP level, the password is an
50896 uninterpreted string.
50897 </para>
50898 </section>
50899 <section id="SECID174">
50900 <title>Support for different kinds of authentication</title>
50901 <para>
50902 A number of string expansion features are provided for the purpose of
50903 interfacing to different ways of user authentication. These include checking
50904 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
50905 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
50906 <xref linkend="SECTexpcond"/>.
50907 </para>
50908 </section>
50909 <section id="SECID175">
50910 <title>Using plaintext in a client</title>
50911 <para>
50912 <indexterm role="concept">
50913 <primary>options</primary>
50914 <secondary><command>plaintext</command> authenticator (client)</secondary>
50915 </indexterm>
50916 The <command>plaintext</command> authenticator has two client options:
50917 </para>
50918 <para>
50919 <indexterm role="option">
50920 <primary><option>client_ignore_invalid_base64</option></primary>
50921 </indexterm>
50922 </para>
50923 <informaltable frame="all">
50924 <tgroup cols="4" colsep="0" rowsep="0">
50925 <colspec colwidth="8*" align="left"/>
50926 <colspec colwidth="6*" align="center"/>
50927 <colspec colwidth="6*" align="center"/>
50928 <colspec colwidth="6*" align="right"/>
50929 <tbody>
50930 <row>
50931 <entry><option>client_ignore_invalid_base64</option></entry>
50932 <entry>Use: <emphasis>plaintext</emphasis></entry>
50933 <entry>Type: <emphasis>boolean</emphasis></entry>
50934 <entry>Default: <emphasis>false</emphasis></entry>
50935 </row>
50936 </tbody>
50937 </tgroup>
50938 </informaltable>
50939 <para>
50940 If the client receives a server prompt that is not a valid base64 string,
50941 authentication is abandoned by default. However, if this option is set true,
50942 the error in the challenge is ignored and the client sends the response as
50943 usual.
50944 </para>
50945 <para>
50946 <indexterm role="option">
50947 <primary><option>client_send</option></primary>
50948 </indexterm>
50949 </para>
50950 <informaltable frame="all">
50951 <tgroup cols="4" colsep="0" rowsep="0">
50952 <colspec colwidth="8*" align="left"/>
50953 <colspec colwidth="6*" align="center"/>
50954 <colspec colwidth="6*" align="center"/>
50955 <colspec colwidth="6*" align="right"/>
50956 <tbody>
50957 <row>
50958 <entry><option>client_send</option></entry>
50959 <entry>Use: <emphasis>plaintext</emphasis></entry>
50960 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50961 <entry>Default: <emphasis>unset</emphasis></entry>
50962 </row>
50963 </tbody>
50964 </tgroup>
50965 </informaltable>
50966 <para>
50967 The string is a colon-separated list of authentication data strings. Each
50968 string is independently expanded before being sent to the server. The first
50969 string is sent with the AUTH command; any more strings are sent in response
50970 to prompts from the server. Before each string is expanded, the value of the
50971 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
50972 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
50973 way. Thus, the prompt that is received in response to sending the first string
50974 (with the AUTH command) can be used in the expansion of the second string, and
50975 so on. If an invalid base64 string is received when
50976 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
50977 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
50978 </para>
50979 <para>
50980 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
50981 splitting takes priority and happens first.
50982 </para>
50983 <para>
50984 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
50985 the data, further processing is applied to each string before it is sent. If
50986 there are any single circumflex characters in the string, they are converted to
50987 NULs. Should an actual circumflex be required as data, it must be doubled in
50988 the string.
50989 </para>
50990 <para>
50991 This is an example of a client configuration that implements the PLAIN
50992 authentication mechanism with a fixed user name and password:
50993 </para>
50994 <literallayout class="monospaced">
50995 fixed_plain:
50996   driver = plaintext
50997   public_name = PLAIN
50998   client_send = ^username^mysecret
50999 </literallayout>
51000 <para>
51001 The lack of colons means that the entire text is sent with the AUTH
51002 command, with the circumflex characters converted to NULs. A similar example
51003 that uses the LOGIN mechanism is:
51004 </para>
51005 <literallayout class="monospaced">
51006 fixed_login:
51007   driver = plaintext
51008   public_name = LOGIN
51009   client_send = : username : mysecret
51010 </literallayout>
51011 <para>
51012 The initial colon means that the first string is empty, so no data is sent with
51013 the AUTH command itself. The remaining strings are sent in response to
51014 prompts.
51015 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
51016 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
51017 </para>
51018 </section>
51019 </chapter>
51020
51021 <chapter id="CHID9">
51022 <title>The cram_md5 authenticator</title>
51023 <para>
51024 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
51025 <primary><command>cram_md5</command> authenticator</primary>
51026 </indexterm>
51027 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
51028 <primary>authenticators</primary>
51029 <secondary><command>cram_md5</command></secondary>
51030 </indexterm>
51031 <indexterm role="concept">
51032 <primary>CRAM-MD5 authentication mechanism</primary>
51033 </indexterm>
51034 <indexterm role="concept">
51035 <primary>authentication</primary>
51036 <secondary>CRAM-MD5 mechanism</secondary>
51037 </indexterm>
51038 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
51039 sends a challenge string to the client, and the response consists of a user
51040 name and the CRAM-MD5 digest of the challenge string combined with a secret
51041 string (password) which is known to both server and client. Thus, the secret
51042 is not sent over the network as plain text, which makes this authenticator more
51043 secure than <command>plaintext</command>. However, the downside is that the secret has to be
51044 available in plain text at either end.
51045 </para>
51046 <section id="SECID176">
51047 <title>Using cram_md5 as a server</title>
51048 <para>
51049 <indexterm role="concept">
51050 <primary>options</primary>
51051 <secondary><command>cram_md5</command> authenticator (server)</secondary>
51052 </indexterm>
51053 This authenticator has one server option, which must be set to configure the
51054 authenticator as a server:
51055 </para>
51056 <para>
51057 <indexterm role="option">
51058 <primary><option>server_secret</option></primary>
51059 </indexterm>
51060 </para>
51061 <informaltable frame="all">
51062 <tgroup cols="4" colsep="0" rowsep="0">
51063 <colspec colwidth="8*" align="left"/>
51064 <colspec colwidth="6*" align="center"/>
51065 <colspec colwidth="6*" align="center"/>
51066 <colspec colwidth="6*" align="right"/>
51067 <tbody>
51068 <row>
51069 <entry><option>server_secret</option></entry>
51070 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51071 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51072 <entry>Default: <emphasis>unset</emphasis></entry>
51073 </row>
51074 </tbody>
51075 </tgroup>
51076 </informaltable>
51077 <para>
51078 <indexterm role="concept">
51079 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51080 <secondary>in <command>cram_md5</command> authenticator</secondary>
51081 </indexterm>
51082 When the server receives the client&#x2019;s response, the user name is placed in
51083 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
51084 obtain the password for that user. The server then computes the CRAM-MD5 digest
51085 that the client should have sent, and checks that it received the correct
51086 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
51087 fails. If the expansion fails for some other reason, a temporary error code is
51088 returned to the client.
51089 </para>
51090 <para>
51091 For compatibility with previous releases of Exim, the user name is also placed
51092 in <varname>$1</varname>. However, the use of this variables for this purpose is now
51093 deprecated, as it can lead to confusion in string expansions that also use
51094 numeric variables for other things.
51095 </para>
51096 <para>
51097 For example, the following authenticator checks that the user name given by the
51098 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
51099 user name, authentication fails.
51100 </para>
51101 <literallayout class="monospaced">
51102 fixed_cram:
51103   driver = cram_md5
51104   public_name = CRAM-MD5
51105   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
51106   server_set_id = $auth1
51107 </literallayout>
51108 <para>
51109 <indexterm role="variable">
51110 <primary><varname>$authenticated_id</varname></primary>
51111 </indexterm>
51112 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
51113 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
51114 secret string in a file, using the user name as the key. For example:
51115 </para>
51116 <literallayout class="monospaced">
51117 lookup_cram:
51118   driver = cram_md5
51119   public_name = CRAM-MD5
51120   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
51121                   {$value}fail}
51122   server_set_id = $auth1
51123 </literallayout>
51124 <para>
51125 Note that this expansion explicitly forces failure if the lookup fails
51126 because <varname>$auth1</varname> contains an unknown user name.
51127 </para>
51128 <para>
51129 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
51130 using the relevant libraries, you need to know the realm to specify in the
51131 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
51132 realm, with:
51133 </para>
51134 <literallayout class="monospaced">
51135 cyrusless_crammd5:
51136   driver = cram_md5
51137   public_name = CRAM-MD5
51138   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
51139                   dbmjz{/etc/sasldb2}{$value}fail}
51140   server_set_id = $auth1
51141 </literallayout>
51142 </section>
51143 <section id="SECID177">
51144 <title>Using cram_md5 as a client</title>
51145 <para>
51146 <indexterm role="concept">
51147 <primary>options</primary>
51148 <secondary><command>cram_md5</command> authenticator (client)</secondary>
51149 </indexterm>
51150 When used as a client, the <command>cram_md5</command> authenticator has two options:
51151 </para>
51152 <para>
51153 <indexterm role="option">
51154 <primary><option>client_name</option></primary>
51155 </indexterm>
51156 </para>
51157 <informaltable frame="all">
51158 <tgroup cols="4" colsep="0" rowsep="0">
51159 <colspec colwidth="8*" align="left"/>
51160 <colspec colwidth="6*" align="center"/>
51161 <colspec colwidth="6*" align="center"/>
51162 <colspec colwidth="6*" align="right"/>
51163 <tbody>
51164 <row>
51165 <entry><option>client_name</option></entry>
51166 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51167 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51168 <entry>Default: <emphasis>the primary host name</emphasis></entry>
51169 </row>
51170 </tbody>
51171 </tgroup>
51172 </informaltable>
51173 <para>
51174 This string is expanded, and the result used as the user name data when
51175 computing the response to the server&#x2019;s challenge.
51176 </para>
51177 <para>
51178 <indexterm role="option">
51179 <primary><option>client_secret</option></primary>
51180 </indexterm>
51181 </para>
51182 <informaltable frame="all">
51183 <tgroup cols="4" colsep="0" rowsep="0">
51184 <colspec colwidth="8*" align="left"/>
51185 <colspec colwidth="6*" align="center"/>
51186 <colspec colwidth="6*" align="center"/>
51187 <colspec colwidth="6*" align="right"/>
51188 <tbody>
51189 <row>
51190 <entry><option>client_secret</option></entry>
51191 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51192 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51193 <entry>Default: <emphasis>unset</emphasis></entry>
51194 </row>
51195 </tbody>
51196 </tgroup>
51197 </informaltable>
51198 <para>
51199 This option must be set for the authenticator to work as a client. Its value is
51200 expanded and the result used as the secret string when computing the response.
51201 </para>
51202 <para>
51203 <indexterm role="variable">
51204 <primary><varname>$host</varname></primary>
51205 </indexterm>
51206 <indexterm role="variable">
51207 <primary><varname>$host_address</varname></primary>
51208 </indexterm>
51209 Different user names and secrets can be used for different servers by referring
51210 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
51211 expansion string is treated as an indication that this authenticator is not
51212 prepared to handle this case. Exim moves on to the next configured client
51213 authenticator. Any other expansion failure causes Exim to give up trying to
51214 send the message to the current server.
51215 </para>
51216 <para>
51217 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
51218 strings, is:
51219 </para>
51220 <literallayout class="monospaced">
51221 fixed_cram:
51222   driver = cram_md5
51223   public_name = CRAM-MD5
51224   client_name = ph10
51225   client_secret = secret
51226 </literallayout>
51227 <para>
51228 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
51229 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
51230 </para>
51231 </section>
51232 </chapter>
51233
51234 <chapter id="CHID10">
51235 <title>The cyrus_sasl authenticator</title>
51236 <para>
51237 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
51238 <primary><command>cyrus_sasl</command> authenticator</primary>
51239 </indexterm>
51240 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
51241 <primary>authenticators</primary>
51242 <secondary><command>cyrus_sasl</command></secondary>
51243 </indexterm>
51244 <indexterm role="concept">
51245 <primary>Cyrus</primary>
51246 <secondary>SASL library</secondary>
51247 </indexterm>
51248 <indexterm role="concept">
51249 <primary>Kerberos</primary>
51250 </indexterm>
51251 The code for this authenticator was provided by Matthew Byng-Maddick of A L
51252 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
51253 </para>
51254 <para>
51255 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
51256 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
51257 Layer</quote>). This library supports a number of authentication mechanisms,
51258 including PLAIN and LOGIN, but also several others that Exim does not support
51259 directly. In particular, there is support for Kerberos authentication.
51260 </para>
51261 <para>
51262 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
51263 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
51264 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
51265 name of the driver to determine which mechanism to support.
51266 </para>
51267 <para>
51268 Where access to some kind of secret file is required, for example in GSSAPI
51269 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
51270 user, and that the Cyrus SASL library has no way of escalating privileges
51271 by default. You may also find you need to set environment variables,
51272 depending on the driver you are using.
51273 </para>
51274 <para>
51275 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
51276 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
51277 Kerberos, note that because of limitations in the GSSAPI interface,
51278 changing the server keytab might need to be communicated down to the Kerberos
51279 layer independently. The mechanism for doing so is dependent upon the Kerberos
51280 implementation.
51281 </para>
51282 <para>
51283 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
51284 may be set to point to an alternative keytab file. Exim will pass this
51285 variable through from its own inherited environment when started as root or the
51286 Exim user. The keytab file needs to be readable by the Exim user.
51287 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
51288 environment variable.  In practice, for those releases, the Cyrus authenticator
51289 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
51290 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
51291 </para>
51292 <section id="SECID178">
51293 <title>Using cyrus_sasl as a server</title>
51294 <para>
51295 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
51296 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
51297 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
51298 use of this variable for this purpose is now deprecated, as it can lead to
51299 confusion in string expansions that also use numeric variables for other
51300 things.
51301 </para>
51302 <para>
51303 <indexterm role="option">
51304 <primary><option>server_hostname</option></primary>
51305 </indexterm>
51306 </para>
51307 <informaltable frame="all">
51308 <tgroup cols="4" colsep="0" rowsep="0">
51309 <colspec colwidth="8*" align="left"/>
51310 <colspec colwidth="6*" align="center"/>
51311 <colspec colwidth="6*" align="center"/>
51312 <colspec colwidth="6*" align="right"/>
51313 <tbody>
51314 <row>
51315 <entry><option>server_hostname</option></entry>
51316 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51318 <entry>Default: <emphasis>see below</emphasis></entry>
51319 </row>
51320 </tbody>
51321 </tgroup>
51322 </informaltable>
51323 <para>
51324 This option selects the hostname that is used when communicating with the
51325 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
51326 SASL plug-in what it does with this data.
51327 </para>
51328 <para>
51329 <indexterm role="option">
51330 <primary><option>server_mech</option></primary>
51331 </indexterm>
51332 </para>
51333 <informaltable frame="all">
51334 <tgroup cols="4" colsep="0" rowsep="0">
51335 <colspec colwidth="8*" align="left"/>
51336 <colspec colwidth="6*" align="center"/>
51337 <colspec colwidth="6*" align="center"/>
51338 <colspec colwidth="6*" align="right"/>
51339 <tbody>
51340 <row>
51341 <entry><option>server_mech</option></entry>
51342 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51343 <entry>Type: <emphasis>string</emphasis></entry>
51344 <entry>Default: <emphasis>see below</emphasis></entry>
51345 </row>
51346 </tbody>
51347 </tgroup>
51348 </informaltable>
51349 <para>
51350 This option selects the authentication mechanism this driver should use. The
51351 default is the value of the generic <option>public_name</option> option. This option allows
51352 you to use a different underlying mechanism from the advertised name. For
51353 example:
51354 </para>
51355 <literallayout class="monospaced">
51356 sasl:
51357   driver = cyrus_sasl
51358   public_name = X-ANYTHING
51359   server_mech = CRAM-MD5
51360   server_set_id = $auth1
51361 </literallayout>
51362 <para>
51363 <indexterm role="option">
51364 <primary><option>server_realm</option></primary>
51365 </indexterm>
51366 </para>
51367 <informaltable frame="all">
51368 <tgroup cols="4" colsep="0" rowsep="0">
51369 <colspec colwidth="8*" align="left"/>
51370 <colspec colwidth="6*" align="center"/>
51371 <colspec colwidth="6*" align="center"/>
51372 <colspec colwidth="6*" align="right"/>
51373 <tbody>
51374 <row>
51375 <entry><option>server_realm</option></entry>
51376 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51378 <entry>Default: <emphasis>unset</emphasis></entry>
51379 </row>
51380 </tbody>
51381 </tgroup>
51382 </informaltable>
51383 <para>
51384 This specifies the SASL realm that the server claims to be in.
51385 </para>
51386 <para>
51387 <indexterm role="option">
51388 <primary><option>server_service</option></primary>
51389 </indexterm>
51390 </para>
51391 <informaltable frame="all">
51392 <tgroup cols="4" colsep="0" rowsep="0">
51393 <colspec colwidth="8*" align="left"/>
51394 <colspec colwidth="6*" align="center"/>
51395 <colspec colwidth="6*" align="center"/>
51396 <colspec colwidth="6*" align="right"/>
51397 <tbody>
51398 <row>
51399 <entry><option>server_service</option></entry>
51400 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51401 <entry>Type: <emphasis>string</emphasis></entry>
51402 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51403 </row>
51404 </tbody>
51405 </tgroup>
51406 </informaltable>
51407 <para>
51408 This is the SASL service that the server claims to implement.
51409 </para>
51410 <para>
51411 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
51412 private options. All you need to do is to specify an appropriate mechanism as
51413 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
51414 PLAIN, you could have two authenticators as follows:
51415 </para>
51416 <literallayout class="monospaced">
51417 sasl_cram_md5:
51418   driver = cyrus_sasl
51419   public_name = CRAM-MD5
51420   server_set_id = $auth1
51421
51422 sasl_plain:
51423   driver = cyrus_sasl
51424   public_name = PLAIN
51425   server_set_id = $auth2
51426 </literallayout>
51427 <para>
51428 Cyrus SASL does implement the LOGIN authentication method, even though it is
51429 not a standard method. It is disabled by default in the source distribution,
51430 but it is present in many binary distributions.
51431 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
51432 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
51433 </para>
51434 </section>
51435 </chapter>
51436
51437 <chapter id="CHAPdovecot">
51438 <title>The dovecot authenticator</title>
51439 <para>
51440 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
51441 <primary><command>dovecot</command> authenticator</primary>
51442 </indexterm>
51443 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
51444 <primary>authenticators</primary>
51445 <secondary><command>dovecot</command></secondary>
51446 </indexterm>
51447 This authenticator is an interface to the authentication facility of the
51448 Dovecot POP/IMAP server, which can support a number of authentication methods.
51449 Note that Dovecot must be configured to use auth-client not auth-userdb.
51450 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
51451 to use the same mechanisms for SMTP authentication. This is a server
51452 authenticator only. There is only one option:
51453 </para>
51454 <para>
51455 <indexterm role="option">
51456 <primary><option>server_socket</option></primary>
51457 </indexterm>
51458 </para>
51459 <informaltable frame="all">
51460 <tgroup cols="4" colsep="0" rowsep="0">
51461 <colspec colwidth="8*" align="left"/>
51462 <colspec colwidth="6*" align="center"/>
51463 <colspec colwidth="6*" align="center"/>
51464 <colspec colwidth="6*" align="right"/>
51465 <tbody>
51466 <row>
51467 <entry><option>server_socket</option></entry>
51468 <entry>Use: <emphasis>dovecot</emphasis></entry>
51469 <entry>Type: <emphasis>string</emphasis></entry>
51470 <entry>Default: <emphasis>unset</emphasis></entry>
51471 </row>
51472 </tbody>
51473 </tgroup>
51474 </informaltable>
51475 <para>
51476 This option must specify the socket that is the interface to Dovecot
51477 authentication. The <option>public_name</option> option must specify an authentication
51478 mechanism that Dovecot is configured to support. You can have several
51479 authenticators for different mechanisms. For example:
51480 </para>
51481 <literallayout class="monospaced">
51482 dovecot_plain:
51483   driver = dovecot
51484   public_name = PLAIN
51485   server_socket = /var/run/dovecot/auth-client
51486   server_set_id = $auth1
51487
51488 dovecot_ntlm:
51489   driver = dovecot
51490   public_name = NTLM
51491   server_socket = /var/run/dovecot/auth-client
51492   server_set_id = $auth1
51493 </literallayout>
51494 <para>
51495 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
51496 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
51497 option is passed in the Dovecot authentication command. If, for a TLS
51498 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
51499 option is passed. When authentication succeeds, the identity of the user
51500 who authenticated is placed in <varname>$auth1</varname>.
51501 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
51502 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
51503 </para>
51504 </chapter>
51505
51506 <chapter id="CHAPgsasl">
51507 <title>The gsasl authenticator</title>
51508 <para>
51509 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
51510 <primary><command>gsasl</command> authenticator</primary>
51511 </indexterm>
51512 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
51513 <primary>authenticators</primary>
51514 <secondary><command>gsasl</command></secondary>
51515 </indexterm>
51516 <indexterm role="concept">
51517 <primary>authentication</primary>
51518 <secondary>GNU SASL</secondary>
51519 </indexterm>
51520 <indexterm role="concept">
51521 <primary>authentication</primary>
51522 <secondary>SASL</secondary>
51523 </indexterm>
51524 <indexterm role="concept">
51525 <primary>authentication</primary>
51526 <secondary>EXTERNAL</secondary>
51527 </indexterm>
51528 <indexterm role="concept">
51529 <primary>authentication</primary>
51530 <secondary>ANONYMOUS</secondary>
51531 </indexterm>
51532 <indexterm role="concept">
51533 <primary>authentication</primary>
51534 <secondary>PLAIN</secondary>
51535 </indexterm>
51536 <indexterm role="concept">
51537 <primary>authentication</primary>
51538 <secondary>LOGIN</secondary>
51539 </indexterm>
51540 <indexterm role="concept">
51541 <primary>authentication</primary>
51542 <secondary>DIGEST-MD5</secondary>
51543 </indexterm>
51544 <indexterm role="concept">
51545 <primary>authentication</primary>
51546 <secondary>CRAM-MD5</secondary>
51547 </indexterm>
51548 <indexterm role="concept">
51549 <primary>authentication</primary>
51550 <secondary>SCRAM-SHA-1</secondary>
51551 </indexterm>
51552 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
51553 library and the mechanisms it provides.  This is new as of the 4.80 release
51554 and there are a few areas where the library does not let Exim smoothly
51555 scale to handle future authentication mechanisms, so no guarantee can be
51556 made that any particular new authentication mechanism will be supported
51557 without code changes in Exim.
51558 </para>
51559 <para>
51560 <indexterm role="option">
51561 <primary><option>server_channelbinding</option></primary>
51562 </indexterm>
51563 </para>
51564 <informaltable frame="all">
51565 <tgroup cols="4" colsep="0" rowsep="0">
51566 <colspec colwidth="8*" align="left"/>
51567 <colspec colwidth="6*" align="center"/>
51568 <colspec colwidth="6*" align="center"/>
51569 <colspec colwidth="6*" align="right"/>
51570 <tbody>
51571 <row>
51572 <entry><option>server_channelbinding</option></entry>
51573 <entry>Use: <emphasis>gsasl</emphasis></entry>
51574 <entry>Type: <emphasis>boolean</emphasis></entry>
51575 <entry>Default: <emphasis>false</emphasis></entry>
51576 </row>
51577 </tbody>
51578 </tgroup>
51579 </informaltable>
51580 <para>
51581 Some authentication mechanisms are able to use external context at both ends
51582 of the session to bind the authentication to that context, and fail the
51583 authentication process if that context differs.  Specifically, some TLS
51584 ciphersuites can provide identifying information about the cryptographic
51585 context.
51586 </para>
51587 <para>
51588 This means that certificate identity and verification becomes a non-issue,
51589 as a man-in-the-middle attack will cause the correct client and server to
51590 see different identifiers and authentication will fail.
51591 </para>
51592 <para>
51593 This is currently only supported when using the GnuTLS library.  This is
51594 only usable by mechanisms which support "channel binding"; at time of
51595 writing, that&#x2019;s the SCRAM family.
51596 </para>
51597 <para>
51598 This defaults off to ensure smooth upgrade across Exim releases, in case
51599 this option causes some clients to start failing.  Some future release
51600 of Exim may switch the default to be true.
51601 </para>
51602 <para>
51603 <indexterm role="option">
51604 <primary><option>server_hostname</option></primary>
51605 </indexterm>
51606 </para>
51607 <informaltable frame="all">
51608 <tgroup cols="4" colsep="0" rowsep="0">
51609 <colspec colwidth="8*" align="left"/>
51610 <colspec colwidth="6*" align="center"/>
51611 <colspec colwidth="6*" align="center"/>
51612 <colspec colwidth="6*" align="right"/>
51613 <tbody>
51614 <row>
51615 <entry><option>server_hostname</option></entry>
51616 <entry>Use: <emphasis>gsasl</emphasis></entry>
51617 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51618 <entry>Default: <emphasis>see below</emphasis></entry>
51619 </row>
51620 </tbody>
51621 </tgroup>
51622 </informaltable>
51623 <para>
51624 This option selects the hostname that is used when communicating with the
51625 library. The default value is <literal>$primary_hostname</literal>.
51626 Some mechanisms will use this data.
51627 </para>
51628 <para>
51629 <indexterm role="option">
51630 <primary><option>server_mech</option></primary>
51631 </indexterm>
51632 </para>
51633 <informaltable frame="all">
51634 <tgroup cols="4" colsep="0" rowsep="0">
51635 <colspec colwidth="8*" align="left"/>
51636 <colspec colwidth="6*" align="center"/>
51637 <colspec colwidth="6*" align="center"/>
51638 <colspec colwidth="6*" align="right"/>
51639 <tbody>
51640 <row>
51641 <entry><option>server_mech</option></entry>
51642 <entry>Use: <emphasis>gsasl</emphasis></entry>
51643 <entry>Type: <emphasis>string</emphasis></entry>
51644 <entry>Default: <emphasis>see below</emphasis></entry>
51645 </row>
51646 </tbody>
51647 </tgroup>
51648 </informaltable>
51649 <para>
51650 This option selects the authentication mechanism this driver should use. The
51651 default is the value of the generic <option>public_name</option> option. This option allows
51652 you to use a different underlying mechanism from the advertised name. For
51653 example:
51654 </para>
51655 <literallayout class="monospaced">
51656 sasl:
51657   driver = gsasl
51658   public_name = X-ANYTHING
51659   server_mech = CRAM-MD5
51660   server_set_id = $auth1
51661 </literallayout>
51662 <para>
51663 <indexterm role="option">
51664 <primary><option>server_password</option></primary>
51665 </indexterm>
51666 </para>
51667 <informaltable frame="all">
51668 <tgroup cols="4" colsep="0" rowsep="0">
51669 <colspec colwidth="8*" align="left"/>
51670 <colspec colwidth="6*" align="center"/>
51671 <colspec colwidth="6*" align="center"/>
51672 <colspec colwidth="6*" align="right"/>
51673 <tbody>
51674 <row>
51675 <entry><option>server_password</option></entry>
51676 <entry>Use: <emphasis>gsasl</emphasis></entry>
51677 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51678 <entry>Default: <emphasis>unset</emphasis></entry>
51679 </row>
51680 </tbody>
51681 </tgroup>
51682 </informaltable>
51683 <para>
51684 Various mechanisms need access to the cleartext password on the server, so
51685 that proof-of-possession can be demonstrated on the wire, without sending
51686 the password itself.
51687 </para>
51688 <para>
51689 The data available for lookup varies per mechanism.
51690 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
51691 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
51692 if available, else the empty string.
51693 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
51694 else the empty string.
51695 </para>
51696 <para>
51697 A forced failure will cause authentication to defer.
51698 </para>
51699 <para>
51700 If using this option, it may make sense to set the <option>server_condition</option>
51701 option to be simply "true".
51702 </para>
51703 <para>
51704 <indexterm role="option">
51705 <primary><option>server_realm</option></primary>
51706 </indexterm>
51707 </para>
51708 <informaltable frame="all">
51709 <tgroup cols="4" colsep="0" rowsep="0">
51710 <colspec colwidth="8*" align="left"/>
51711 <colspec colwidth="6*" align="center"/>
51712 <colspec colwidth="6*" align="center"/>
51713 <colspec colwidth="6*" align="right"/>
51714 <tbody>
51715 <row>
51716 <entry><option>server_realm</option></entry>
51717 <entry>Use: <emphasis>gsasl</emphasis></entry>
51718 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51719 <entry>Default: <emphasis>unset</emphasis></entry>
51720 </row>
51721 </tbody>
51722 </tgroup>
51723 </informaltable>
51724 <para>
51725 This specifies the SASL realm that the server claims to be in.
51726 Some mechanisms will use this data.
51727 </para>
51728 <para>
51729 <indexterm role="option">
51730 <primary><option>server_scram_iter</option></primary>
51731 </indexterm>
51732 </para>
51733 <informaltable frame="all">
51734 <tgroup cols="4" colsep="0" rowsep="0">
51735 <colspec colwidth="8*" align="left"/>
51736 <colspec colwidth="6*" align="center"/>
51737 <colspec colwidth="6*" align="center"/>
51738 <colspec colwidth="6*" align="right"/>
51739 <tbody>
51740 <row>
51741 <entry><option>server_scram_iter</option></entry>
51742 <entry>Use: <emphasis>gsasl</emphasis></entry>
51743 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51744 <entry>Default: <emphasis>unset</emphasis></entry>
51745 </row>
51746 </tbody>
51747 </tgroup>
51748 </informaltable>
51749 <para>
51750 This option provides data for the SCRAM family of mechanisms.
51751 <varname>$auth1</varname> is not available at evaluation time.
51752 (This may change, as we receive feedback on use)
51753 </para>
51754 <para>
51755 <indexterm role="option">
51756 <primary><option>server_scram_salt</option></primary>
51757 </indexterm>
51758 </para>
51759 <informaltable frame="all">
51760 <tgroup cols="4" colsep="0" rowsep="0">
51761 <colspec colwidth="8*" align="left"/>
51762 <colspec colwidth="6*" align="center"/>
51763 <colspec colwidth="6*" align="center"/>
51764 <colspec colwidth="6*" align="right"/>
51765 <tbody>
51766 <row>
51767 <entry><option>server_scram_salt</option></entry>
51768 <entry>Use: <emphasis>gsasl</emphasis></entry>
51769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51770 <entry>Default: <emphasis>unset</emphasis></entry>
51771 </row>
51772 </tbody>
51773 </tgroup>
51774 </informaltable>
51775 <para>
51776 This option provides data for the SCRAM family of mechanisms.
51777 <varname>$auth1</varname> is not available at evaluation time.
51778 (This may change, as we receive feedback on use)
51779 </para>
51780 <para>
51781 <indexterm role="option">
51782 <primary><option>server_service</option></primary>
51783 </indexterm>
51784 </para>
51785 <informaltable frame="all">
51786 <tgroup cols="4" colsep="0" rowsep="0">
51787 <colspec colwidth="8*" align="left"/>
51788 <colspec colwidth="6*" align="center"/>
51789 <colspec colwidth="6*" align="center"/>
51790 <colspec colwidth="6*" align="right"/>
51791 <tbody>
51792 <row>
51793 <entry><option>server_service</option></entry>
51794 <entry>Use: <emphasis>gsasl</emphasis></entry>
51795 <entry>Type: <emphasis>string</emphasis></entry>
51796 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51797 </row>
51798 </tbody>
51799 </tgroup>
51800 </informaltable>
51801 <para>
51802 This is the SASL service that the server claims to implement.
51803 Some mechanisms will use this data.
51804 </para>
51805 <section id="SECTgsaslauthvar">
51806 <title><command>gsasl</command> auth variables</title>
51807 <para>
51808 <indexterm role="variable">
51809 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51810 </indexterm>
51811 These may be set when evaluating specific options, as detailed above.
51812 They will also be set when evaluating <option>server_condition</option>.
51813 </para>
51814 <para>
51815 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
51816 meanings for these variables:
51817 </para>
51818 <itemizedlist>
51819 <listitem>
51820 <para>
51821 <indexterm role="variable">
51822 <primary><varname>$auth1</varname></primary>
51823 </indexterm>
51824 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
51825 </para>
51826 </listitem>
51827 <listitem>
51828 <para>
51829 <indexterm role="variable">
51830 <primary><varname>$auth2</varname></primary>
51831 </indexterm>
51832 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
51833 </para>
51834 </listitem>
51835 <listitem>
51836 <para>
51837 <indexterm role="variable">
51838 <primary><varname>$auth3</varname></primary>
51839 </indexterm>
51840 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
51841 </para>
51842 </listitem>
51843 </itemizedlist>
51844 <para>
51845 On a per-mechanism basis:
51846 </para>
51847 <itemizedlist>
51848 <listitem>
51849 <para>
51850 <indexterm role="concept">
51851 <primary>authentication</primary>
51852 <secondary>EXTERNAL</secondary>
51853 </indexterm>
51854 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
51855 the <option>server_condition</option> option must be present.
51856 </para>
51857 </listitem>
51858 <listitem>
51859 <para>
51860 <indexterm role="concept">
51861 <primary>authentication</primary>
51862 <secondary>ANONYMOUS</secondary>
51863 </indexterm>
51864 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
51865 the <option>server_condition</option> option must be present.
51866 </para>
51867 </listitem>
51868 <listitem>
51869 <para>
51870 <indexterm role="concept">
51871 <primary>authentication</primary>
51872 <secondary>GSSAPI</secondary>
51873 </indexterm>
51874 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
51875 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
51876 the <option>server_condition</option> option must be present.
51877 </para>
51878 </listitem>
51879 </itemizedlist>
51880 <para>
51881 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
51882 identifier; this is analogous to FTP anonymous authentication passing an
51883 email address, or software-identifier@, as the "password".
51884 </para>
51885 <para>
51886 An example showing the password having the realm specified in the callback
51887 and demonstrating a Cyrus SASL to GSASL migration approach is:
51888 </para>
51889 <literallayout class="monospaced">
51890 gsasl_cyrusless_crammd5:
51891   driver = gsasl
51892   public_name = CRAM-MD5
51893   server_realm = imap.example.org
51894   server_password = ${lookup{$auth1:$auth3:userPassword}\
51895                     dbmjz{/etc/sasldb2}{$value}fail}
51896   server_set_id = ${quote:$auth1}
51897   server_condition = yes
51898 </literallayout>
51899 </section>
51900 </chapter>
51901
51902 <chapter id="CHAPheimdalgss">
51903 <title>The heimdal_gssapi authenticator</title>
51904 <para>
51905 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
51906 <primary><command>heimdal_gssapi</command> authenticator</primary>
51907 </indexterm>
51908 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
51909 <primary>authenticators</primary>
51910 <secondary><command>heimdal_gssapi</command></secondary>
51911 </indexterm>
51912 <indexterm role="concept">
51913 <primary>authentication</primary>
51914 <secondary>GSSAPI</secondary>
51915 </indexterm>
51916 <indexterm role="concept">
51917 <primary>authentication</primary>
51918 <secondary>Kerberos</secondary>
51919 </indexterm>
51920 The <command>heimdal_gssapi</command> authenticator provides server integration for the
51921 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
51922 reliably.
51923 </para>
51924 <para>
51925 <indexterm role="option">
51926 <primary><option>server_hostname</option></primary>
51927 </indexterm>
51928 </para>
51929 <informaltable frame="all">
51930 <tgroup cols="4" colsep="0" rowsep="0">
51931 <colspec colwidth="8*" align="left"/>
51932 <colspec colwidth="6*" align="center"/>
51933 <colspec colwidth="6*" align="center"/>
51934 <colspec colwidth="6*" align="right"/>
51935 <tbody>
51936 <row>
51937 <entry><option>server_hostname</option></entry>
51938 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51939 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51940 <entry>Default: <emphasis>see below</emphasis></entry>
51941 </row>
51942 </tbody>
51943 </tgroup>
51944 </informaltable>
51945 <para>
51946 This option selects the hostname that is used, with <option>server_service</option>,
51947 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
51948 identifier.  The default value is <literal>$primary_hostname</literal>.
51949 </para>
51950 <para>
51951 <indexterm role="option">
51952 <primary><option>server_keytab</option></primary>
51953 </indexterm>
51954 </para>
51955 <informaltable frame="all">
51956 <tgroup cols="4" colsep="0" rowsep="0">
51957 <colspec colwidth="8*" align="left"/>
51958 <colspec colwidth="6*" align="center"/>
51959 <colspec colwidth="6*" align="center"/>
51960 <colspec colwidth="6*" align="right"/>
51961 <tbody>
51962 <row>
51963 <entry><option>server_keytab</option></entry>
51964 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51965 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51966 <entry>Default: <emphasis>unset</emphasis></entry>
51967 </row>
51968 </tbody>
51969 </tgroup>
51970 </informaltable>
51971 <para>
51972 If set, then Heimdal will not use the system default keytab (typically
51973 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
51974 The value should be a pathname, with no <quote>file:</quote> prefix.
51975 </para>
51976 <para>
51977 <indexterm role="option">
51978 <primary><option>server_service</option></primary>
51979 </indexterm>
51980 </para>
51981 <informaltable frame="all">
51982 <tgroup cols="4" colsep="0" rowsep="0">
51983 <colspec colwidth="8*" align="left"/>
51984 <colspec colwidth="6*" align="center"/>
51985 <colspec colwidth="6*" align="center"/>
51986 <colspec colwidth="6*" align="right"/>
51987 <tbody>
51988 <row>
51989 <entry><option>server_service</option></entry>
51990 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51991 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51992 <entry>Default: <emphasis>smtp</emphasis></entry>
51993 </row>
51994 </tbody>
51995 </tgroup>
51996 </informaltable>
51997 <para>
51998 This option specifies the service identifier used, in conjunction with
51999 <option>server_hostname</option>, for building the identifier for finding credentials
52000 from the keytab.
52001 </para>
52002 <section id="SECTheimdalgssauthvar">
52003 <title><command>heimdal_gssapi</command> auth variables</title>
52004 <para>
52005 Beware that these variables will typically include a realm, thus will appear
52006 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
52007 not verified, so a malicious client can set it to anything.
52008 </para>
52009 <para>
52010 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
52011 Distribution Center.  Note that these are not quite email addresses.
52012 Each identifier is for a role, and so the left-hand-side may include a
52013 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
52014 </para>
52015 <para>
52016 <indexterm role="variable">
52017 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52018 </indexterm>
52019 </para>
52020 <itemizedlist>
52021 <listitem>
52022 <para>
52023 <indexterm role="variable">
52024 <primary><varname>$auth1</varname></primary>
52025 </indexterm>
52026 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
52027 </para>
52028 </listitem>
52029 <listitem>
52030 <para>
52031 <indexterm role="variable">
52032 <primary><varname>$auth2</varname></primary>
52033 </indexterm>
52034 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
52035 authentication.  If that was empty, this will also be set to the
52036 GSS Display Name.
52037 </para>
52038 </listitem>
52039 </itemizedlist>
52040 </section>
52041 </chapter>
52042
52043 <chapter id="CHAPspa">
52044 <title>The spa authenticator</title>
52045 <para>
52046 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
52047 <primary><command>spa</command> authenticator</primary>
52048 </indexterm>
52049 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
52050 <primary>authenticators</primary>
52051 <secondary><command>spa</command></secondary>
52052 </indexterm>
52053 <indexterm role="concept">
52054 <primary>authentication</primary>
52055 <secondary>Microsoft Secure Password</secondary>
52056 </indexterm>
52057 <indexterm role="concept">
52058 <primary>authentication</primary>
52059 <secondary>NTLM</secondary>
52060 </indexterm>
52061 <indexterm role="concept">
52062 <primary>Microsoft Secure Password Authentication</primary>
52063 </indexterm>
52064 <indexterm role="concept">
52065 <primary>NTLM authentication</primary>
52066 </indexterm>
52067 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
52068 Password Authentication</emphasis> mechanism,
52069 which is also sometimes known as NTLM (NT LanMan). The code for client side of
52070 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
52071 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
52072 server side was subsequently contributed by Tom Kistner. The mechanism works as
52073 follows:
52074 </para>
52075 <itemizedlist>
52076 <listitem>
52077 <para>
52078 After the AUTH command has been accepted, the client sends an SPA
52079 authentication request based on the user name and optional domain.
52080 </para>
52081 </listitem>
52082 <listitem>
52083 <para>
52084 The server sends back a challenge.
52085 </para>
52086 </listitem>
52087 <listitem>
52088 <para>
52089 The client builds a challenge response which makes use of the user&#x2019;s password
52090 and sends it to the server, which then accepts or rejects it.
52091 </para>
52092 </listitem>
52093 </itemizedlist>
52094 <para>
52095 Encryption is used to protect the password in transit.
52096 </para>
52097 <section id="SECID179">
52098 <title>Using spa as a server</title>
52099 <para>
52100 <indexterm role="concept">
52101 <primary>options</primary>
52102 <secondary><command>spa</command> authenticator (server)</secondary>
52103 </indexterm>
52104 The <command>spa</command> authenticator has just one server option:
52105 </para>
52106 <para>
52107 <indexterm role="option">
52108 <primary><option>server_password</option></primary>
52109 </indexterm>
52110 </para>
52111 <informaltable frame="all">
52112 <tgroup cols="4" colsep="0" rowsep="0">
52113 <colspec colwidth="8*" align="left"/>
52114 <colspec colwidth="6*" align="center"/>
52115 <colspec colwidth="6*" align="center"/>
52116 <colspec colwidth="6*" align="right"/>
52117 <tbody>
52118 <row>
52119 <entry><option>server_password</option></entry>
52120 <entry>Use: <emphasis>spa</emphasis></entry>
52121 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52122 <entry>Default: <emphasis>unset</emphasis></entry>
52123 </row>
52124 </tbody>
52125 </tgroup>
52126 </informaltable>
52127 <para>
52128 <indexterm role="concept">
52129 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52130 <secondary>in <command>spa</command> authenticator</secondary>
52131 </indexterm>
52132 This option is expanded, and the result must be the cleartext password for the
52133 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
52134 compatibility with previous releases of Exim, the user name is also placed in
52135 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
52136 it can lead to confusion in string expansions that also use numeric variables
52137 for other things. For example:
52138 </para>
52139 <literallayout class="monospaced">
52140 spa:
52141   driver = spa
52142   public_name = NTLM
52143   server_password = \
52144     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
52145 </literallayout>
52146 <para>
52147 If the expansion is forced to fail, authentication fails. Any other expansion
52148 failure causes a temporary error code to be returned.
52149 </para>
52150 </section>
52151 <section id="SECID180">
52152 <title>Using spa as a client</title>
52153 <para>
52154 <indexterm role="concept">
52155 <primary>options</primary>
52156 <secondary><command>spa</command> authenticator (client)</secondary>
52157 </indexterm>
52158 The <command>spa</command> authenticator has the following client options:
52159 </para>
52160 <para>
52161 <indexterm role="option">
52162 <primary><option>client_domain</option></primary>
52163 </indexterm>
52164 </para>
52165 <informaltable frame="all">
52166 <tgroup cols="4" colsep="0" rowsep="0">
52167 <colspec colwidth="8*" align="left"/>
52168 <colspec colwidth="6*" align="center"/>
52169 <colspec colwidth="6*" align="center"/>
52170 <colspec colwidth="6*" align="right"/>
52171 <tbody>
52172 <row>
52173 <entry><option>client_domain</option></entry>
52174 <entry>Use: <emphasis>spa</emphasis></entry>
52175 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52176 <entry>Default: <emphasis>unset</emphasis></entry>
52177 </row>
52178 </tbody>
52179 </tgroup>
52180 </informaltable>
52181 <para>
52182 This option specifies an optional domain for the authentication.
52183 </para>
52184 <para>
52185 <indexterm role="option">
52186 <primary><option>client_password</option></primary>
52187 </indexterm>
52188 </para>
52189 <informaltable frame="all">
52190 <tgroup cols="4" colsep="0" rowsep="0">
52191 <colspec colwidth="8*" align="left"/>
52192 <colspec colwidth="6*" align="center"/>
52193 <colspec colwidth="6*" align="center"/>
52194 <colspec colwidth="6*" align="right"/>
52195 <tbody>
52196 <row>
52197 <entry><option>client_password</option></entry>
52198 <entry>Use: <emphasis>spa</emphasis></entry>
52199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52200 <entry>Default: <emphasis>unset</emphasis></entry>
52201 </row>
52202 </tbody>
52203 </tgroup>
52204 </informaltable>
52205 <para>
52206 This option specifies the user&#x2019;s password, and must be set.
52207 </para>
52208 <para>
52209 <indexterm role="option">
52210 <primary><option>client_username</option></primary>
52211 </indexterm>
52212 </para>
52213 <informaltable frame="all">
52214 <tgroup cols="4" colsep="0" rowsep="0">
52215 <colspec colwidth="8*" align="left"/>
52216 <colspec colwidth="6*" align="center"/>
52217 <colspec colwidth="6*" align="center"/>
52218 <colspec colwidth="6*" align="right"/>
52219 <tbody>
52220 <row>
52221 <entry><option>client_username</option></entry>
52222 <entry>Use: <emphasis>spa</emphasis></entry>
52223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52224 <entry>Default: <emphasis>unset</emphasis></entry>
52225 </row>
52226 </tbody>
52227 </tgroup>
52228 </informaltable>
52229 <para>
52230 This option specifies the user name, and must be set. Here is an example of a
52231 configuration of this authenticator for use with the mail servers at
52232 <emphasis>msn.com</emphasis>:
52233 </para>
52234 <literallayout class="monospaced">
52235 msn:
52236   driver = spa
52237   public_name = MSN
52238   client_username = msn/msn_username
52239   client_password = msn_plaintext_password
52240   client_domain = DOMAIN_OR_UNSET
52241 </literallayout>
52242 <para>
52243 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
52244 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
52245 </para>
52246 </section>
52247 </chapter>
52248
52249 <chapter id="CHAPtlsauth">
52250 <title>The tls authenticator</title>
52251 <para>
52252 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
52253 <primary><command>tls</command> authenticator</primary>
52254 </indexterm>
52255 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
52256 <primary>authenticators</primary>
52257 <secondary><command>tls</command></secondary>
52258 </indexterm>
52259 <indexterm role="concept">
52260 <primary>authentication</primary>
52261 <secondary>Client Certificate</secondary>
52262 </indexterm>
52263 <indexterm role="concept">
52264 <primary>authentication</primary>
52265 <secondary>X509</secondary>
52266 </indexterm>
52267 <indexterm role="concept">
52268 <primary>Certificate-based authentication</primary>
52269 </indexterm>
52270 The <command>tls</command> authenticator provides server support for
52271 authentication based on client certificates.
52272 </para>
52273 <para>
52274 It is not an SMTP authentication mechanism and is not
52275 advertised by the server as part of the SMTP EHLO response.
52276 It is an Exim authenticator in the sense that it affects
52277 the protocol element of the log line, can be tested for
52278 by the <option>authenticated</option> ACL condition, and can set
52279 the <varname>$authenticated_id</varname> variable.
52280 </para>
52281 <para>
52282 The client must present a verifiable certificate,
52283 for which it must have been requested via the
52284 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
52285 (see <xref linkend="CHAPTLS"/>).
52286 </para>
52287 <para>
52288 If an authenticator of this type is configured it is
52289 run before any SMTP-level communication is done,
52290 and can authenticate the connection.
52291 If it does, SMTP authentication is not offered.
52292 </para>
52293 <para>
52294 A maximum of one authenticator of this type may be present.
52295 </para>
52296 <para>
52297 <indexterm role="concept">
52298 <primary>options</primary>
52299 <secondary><command>tls</command> authenticator (server)</secondary>
52300 </indexterm>
52301 The <command>tls</command> authenticator has three server options:
52302 </para>
52303 <para>
52304 <indexterm role="option">
52305 <primary><option>server_param1</option></primary>
52306 </indexterm>
52307 </para>
52308 <informaltable frame="all">
52309 <tgroup cols="4" colsep="0" rowsep="0">
52310 <colspec colwidth="8*" align="left"/>
52311 <colspec colwidth="6*" align="center"/>
52312 <colspec colwidth="6*" align="center"/>
52313 <colspec colwidth="6*" align="right"/>
52314 <tbody>
52315 <row>
52316 <entry><option>server_param1</option></entry>
52317 <entry>Use: <emphasis>tls</emphasis></entry>
52318 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52319 <entry>Default: <emphasis>unset</emphasis></entry>
52320 </row>
52321 </tbody>
52322 </tgroup>
52323 </informaltable>
52324 <para>
52325 <indexterm role="concept">
52326 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
52327 <secondary>in <command>tls</command> authenticator</secondary>
52328 </indexterm>
52329 This option is expanded after the TLS negotiation and
52330 the result is placed in <varname>$auth1</varname>.
52331 If the expansion is forced to fail, authentication fails. Any other expansion
52332 failure causes a temporary error code to be returned.
52333 </para>
52334 <para>
52335 <indexterm role="option">
52336 <primary><option>server_param2</option></primary>
52337 </indexterm>
52338 </para>
52339 <informaltable frame="all">
52340 <tgroup cols="4" colsep="0" rowsep="0">
52341 <colspec colwidth="8*" align="left"/>
52342 <colspec colwidth="6*" align="center"/>
52343 <colspec colwidth="6*" align="center"/>
52344 <colspec colwidth="6*" align="right"/>
52345 <tbody>
52346 <row>
52347 <entry><option>server_param2</option></entry>
52348 <entry>Use: <emphasis>tls</emphasis></entry>
52349 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52350 <entry>Default: <emphasis>unset</emphasis></entry>
52351 </row>
52352 </tbody>
52353 </tgroup>
52354 </informaltable>
52355 <para>
52356 <indexterm role="option">
52357 <primary><option>server_param3</option></primary>
52358 </indexterm>
52359 </para>
52360 <informaltable frame="all">
52361 <tgroup cols="4" colsep="0" rowsep="0">
52362 <colspec colwidth="8*" align="left"/>
52363 <colspec colwidth="6*" align="center"/>
52364 <colspec colwidth="6*" align="center"/>
52365 <colspec colwidth="6*" align="right"/>
52366 <tbody>
52367 <row>
52368 <entry><option>server_param3</option></entry>
52369 <entry>Use: <emphasis>tls</emphasis></entry>
52370 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52371 <entry>Default: <emphasis>unset</emphasis></entry>
52372 </row>
52373 </tbody>
52374 </tgroup>
52375 </informaltable>
52376 <para>
52377 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
52378 </para>
52379 <para>
52380 <option>server_param1</option> may also be spelled <option>server_param</option>.
52381 </para>
52382 <para>
52383 Example:
52384 </para>
52385 <literallayout class="monospaced">
52386 tls:
52387   driver = tls
52388   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
52389                                     {$tls_in_peercert}}
52390   server_condition =  ${if forany {$auth1} \
52391                             {!= {0} \
52392                                 {${lookup ldap{ldap:///\
52393                          mailname=${quote_ldap_dn:${lc:$item}},\
52394                          ou=users,LDAP_DC?mailid} {$value}{0} \
52395                        }    }   } }
52396   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
52397 </literallayout>
52398 <para>
52399 This accepts a client certificate that is verifiable against any
52400 of your configured trust-anchors
52401 (which usually means the full set of public CAs)
52402 and which has a SAN with a good account name.
52403 Note that the client cert is on the wire in-clear, including the SAN,
52404 whereas a plaintext SMTP AUTH done inside TLS is not.
52405 </para>
52406 <para>
52407 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
52408 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
52409 </para>
52410 <para>
52411 Note that because authentication is traditionally an SMTP operation,
52412 the <option>authenticated</option> ACL condition cannot be used in
52413 a connect- or helo-ACL.
52414 </para>
52415 </chapter>
52416
52417 <chapter id="CHAPTLS">
52418 <title>Encrypted SMTP connections using TLS/SSL</title>
52419 <titleabbrev>Encrypted SMTP connections</titleabbrev>
52420 <para>
52421 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
52422 <primary>encryption</primary>
52423 <secondary>on SMTP connection</secondary>
52424 </indexterm>
52425 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
52426 <primary>SMTP</primary>
52427 <secondary>encryption</secondary>
52428 </indexterm>
52429 <indexterm role="concept">
52430 <primary>TLS</primary>
52431 <secondary>on SMTP connection</secondary>
52432 </indexterm>
52433 <indexterm role="concept">
52434 <primary>OpenSSL</primary>
52435 </indexterm>
52436 <indexterm role="concept">
52437 <primary>GnuTLS</primary>
52438 </indexterm>
52439 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
52440 Sockets Layer), is implemented by making use of the OpenSSL library or the
52441 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
52442 cryptographic code in the Exim distribution itself for implementing TLS. In
52443 order to use this feature you must install OpenSSL or GnuTLS, and then build a
52444 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
52445 You also need to understand the basic concepts of encryption at a managerial
52446 level, and in particular, the way that public keys, private keys, and
52447 certificates are used.
52448 </para>
52449 <para>
52450 RFC 3207 defines how SMTP connections can make use of encryption. Once a
52451 connection is established, the client issues a STARTTLS command. If the
52452 server accepts this, the client and the server negotiate an encryption
52453 mechanism. If the negotiation succeeds, the data that subsequently passes
52454 between them is encrypted.
52455 </para>
52456 <para>
52457 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
52458 and if so, what cipher suite is in use, whether the client supplied a
52459 certificate, and whether or not that certificate was verified. This makes it
52460 possible for an Exim server to deny or accept certain commands based on the
52461 encryption state.
52462 </para>
52463 <para>
52464 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
52465 disrupt TLS connections. You need to turn off SMTP scanning for these products
52466 in order to get TLS to work.
52467 </para>
52468 <section id="SECID284">
52469 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
52470 <para>
52471 <indexterm role="concept">
52472 <primary>ssmtp protocol</primary>
52473 </indexterm>
52474 <indexterm role="concept">
52475 <primary>smtps protocol</primary>
52476 </indexterm>
52477 <indexterm role="concept">
52478 <primary>SMTP</primary>
52479 <secondary>ssmtp protocol</secondary>
52480 </indexterm>
52481 <indexterm role="concept">
52482 <primary>SMTP</primary>
52483 <secondary>smtps protocol</secondary>
52484 </indexterm>
52485 Early implementations of encrypted SMTP used a different TCP port from normal
52486 SMTP, and expected an encryption negotiation to start immediately, instead of
52487 waiting for a STARTTLS command from the client using the standard SMTP
52488 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
52489 allocated for this purpose.
52490 </para>
52491 <para>
52492 This approach was abandoned when encrypted SMTP was standardized, but there are
52493 still some legacy clients that use it. Exim supports these clients by means of
52494 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
52495 numbers; the most common use is expected to be:
52496 </para>
52497 <literallayout class="monospaced">
52498 tls_on_connect_ports = 465
52499 </literallayout>
52500 <para>
52501 The port numbers specified by this option apply to all SMTP connections, both
52502 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
52503 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
52504 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
52505 an extra port &ndash; rather, it specifies different behaviour on a port that is
52506 defined elsewhere.
52507 </para>
52508 <para>
52509 There is also a <option>-tls-on-connect</option> command line option. This overrides
52510 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
52511 </para>
52512 </section>
52513 <section id="SECTopenvsgnu">
52514 <title>OpenSSL vs GnuTLS</title>
52515 <para>
52516 <indexterm role="concept">
52517 <primary>TLS</primary>
52518 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
52519 </indexterm>
52520 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
52521 followed later, when the first versions of GnuTLS were released. To build Exim
52522 to use GnuTLS, you need to set
52523 </para>
52524 <literallayout class="monospaced">
52525 USE_GNUTLS=yes
52526 </literallayout>
52527 <para>
52528 in Local/Makefile, in addition to
52529 </para>
52530 <literallayout class="monospaced">
52531 SUPPORT_TLS=yes
52532 </literallayout>
52533 <para>
52534 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
52535 include files and libraries for GnuTLS can be found.
52536 </para>
52537 <para>
52538 There are some differences in usage when using GnuTLS instead of OpenSSL:
52539 </para>
52540 <itemizedlist>
52541 <listitem>
52542 <para>
52543 The <option>tls_verify_certificates</option> option
52544 cannot be the path of a directory
52545 for GnuTLS versions before 3.3.6
52546 (for later versions, or OpenSSL, it can be either).
52547 </para>
52548 </listitem>
52549 <listitem>
52550 <para>
52551 The default value for <option>tls_dhparam</option> differs for historical reasons.
52552 </para>
52553 </listitem>
52554 <listitem>
52555 <para>
52556 <indexterm role="variable">
52557 <primary><varname>$tls_in_peerdn</varname></primary>
52558 </indexterm>
52559 <indexterm role="variable">
52560 <primary><varname>$tls_out_peerdn</varname></primary>
52561 </indexterm>
52562 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
52563 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
52564 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
52565 </para>
52566 </listitem>
52567 <listitem>
52568 <para>
52569 OpenSSL identifies cipher suites using hyphens as separators, for example:
52570 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
52571 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
52572 in a cipher list. To make life simpler, Exim changes underscores to hyphens
52573 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
52574 to handle its own older variants) when processing lists of cipher suites in the
52575 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
52576 option).
52577 </para>
52578 </listitem>
52579 <listitem>
52580 <para>
52581 The <option>tls_require_ciphers</option> options operate differently, as described in the
52582 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
52583 </para>
52584 </listitem>
52585 <listitem>
52586 <para>
52587 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
52588 When using OpenSSL, this option is ignored.
52589 (If an API is found to let OpenSSL be configured in this way,
52590 let the Exim Maintainers know and we&#x2019;ll likely use it).
52591 </para>
52592 </listitem>
52593 <listitem>
52594 <para>
52595 Some other recently added features may only be available in one or the other.
52596 This should be documented with the feature.  If the documentation does not
52597 explicitly state that the feature is infeasible in the other TLS
52598 implementation, then patches are welcome.
52599 </para>
52600 </listitem>
52601 </itemizedlist>
52602 </section>
52603 <section id="SECTgnutlsparam">
52604 <title>GnuTLS parameter computation</title>
52605 <para>
52606 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
52607 an explicit path; if the latter, then the text about generation still applies,
52608 but not the chosen filename.
52609 By default, as of Exim 4.80 a hard-coded D-H prime is used.
52610 See the documentation of <option>tls_dhparam</option> for more information.
52611 </para>
52612 <para>
52613 GnuTLS uses D-H parameters that may take a substantial amount of time
52614 to compute. It is unreasonable to re-compute them for every TLS session.
52615 Therefore, Exim keeps this data in a file in its spool directory, called
52616 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
52617 of bits requested.
52618 The file is owned by the Exim user and is readable only by
52619 its owner. Every Exim process that start up GnuTLS reads the D-H
52620 parameters from this file. If the file does not exist, the first Exim process
52621 that needs it computes the data and writes it to a temporary file which is
52622 renamed once it is complete. It does not matter if several Exim processes do
52623 this simultaneously (apart from wasting a few resources). Once a file is in
52624 place, new Exim processes immediately start using it.
52625 </para>
52626 <para>
52627 For maximum security, the parameters that are stored in this file should be
52628 recalculated periodically, the frequency depending on your paranoia level.
52629 If you are avoiding using the fixed D-H primes published in RFCs, then you
52630 are concerned about some advanced attacks and will wish to do this; if you do
52631 not regenerate then you might as well stick to the standard primes.
52632 </para>
52633 <para>
52634 Arranging this is easy in principle; just delete the file when you want new
52635 values to be computed. However, there may be a problem. The calculation of new
52636 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
52637 If the system is not very active, <filename>/dev/random</filename> may delay returning data
52638 until enough randomness (entropy) is available. This may cause Exim to hang for
52639 a substantial amount of time, causing timeouts on incoming connections.
52640 </para>
52641 <para>
52642 The solution is to generate the parameters externally to Exim. They are stored
52643 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
52644 generated externally using the <command>certtool</command> command that is part of GnuTLS.
52645 </para>
52646 <para>
52647 To replace the parameters with new ones, instead of deleting the file
52648 and letting Exim re-create it, you can generate new parameters using
52649 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
52650 renaming. The relevant commands are something like this:
52651 </para>
52652 <literallayout class="monospaced">
52653 # ls
52654 [ look for file; assume gnutls-params-2236 is the most recent ]
52655 # rm -f new-params
52656 # touch new-params
52657 # chown exim:exim new-params
52658 # chmod 0600 new-params
52659 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
52660 # openssl dhparam -noout -text -in new-params | head
52661 [ check the first line, make sure it's not more than 2236;
52662   if it is, then go back to the start ("rm") and repeat
52663   until the size generated is at most the size requested ]
52664 # chmod 0400 new-params
52665 # mv new-params gnutls-params-2236
52666 </literallayout>
52667 <para>
52668 If Exim never has to generate the parameters itself, the possibility of
52669 stalling is removed.
52670 </para>
52671 <para>
52672 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
52673 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
52674 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
52675 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
52676 and Exim does so.  This attempt to remove Exim from TLS policy decisions
52677 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
52678 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
52679 which applies to all D-H usage, client or server.  If the value returned by
52680 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
52681 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
52682 limit, which is still much higher than Exim historically used.
52683 </para>
52684 <para>
52685 The filename and bits used will change as the GnuTLS maintainers change the
52686 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
52687 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
52688 2432 bits, while NSS is limited to 2236 bits.
52689 </para>
52690 <para>
52691 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
52692 increase the chance of the generated prime actually being within acceptable
52693 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
52694 procedure above.  There is no sane procedure available to Exim to double-check
52695 the size of the generated prime, so it might still be too large.
52696 </para>
52697 </section>
52698 <section id="SECTreqciphssl">
52699 <title>Requiring specific ciphers in OpenSSL</title>
52700 <para>
52701 <indexterm role="concept">
52702 <primary>TLS</primary>
52703 <secondary>requiring specific ciphers (OpenSSL)</secondary>
52704 </indexterm>
52705 <indexterm role="option">
52706 <primary><option>tls_require_ciphers</option></primary>
52707 <secondary>OpenSSL</secondary>
52708 </indexterm>
52709 There is a function in the OpenSSL library that can be passed a list of cipher
52710 suites before the cipher negotiation takes place. This specifies which ciphers
52711 are acceptable. The list is colon separated and may contain names like
52712 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
52713 directly to this function call.
52714 Many systems will install the OpenSSL manual-pages, so you may have
52715 <emphasis>ciphers(1)</emphasis> available to you.
52716 The following quotation from the OpenSSL
52717 documentation specifies what forms of item are allowed in the cipher string:
52718 </para>
52719 <itemizedlist>
52720 <listitem>
52721 <para>
52722 It can consist of a single cipher suite such as RC4-SHA.
52723 </para>
52724 </listitem>
52725 <listitem>
52726 <para>
52727 It can represent a list of cipher suites containing a certain algorithm,
52728 or cipher suites of a certain type. For example SHA1 represents all
52729 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
52730 SSL v3 algorithms.
52731 </para>
52732 </listitem>
52733 <listitem>
52734 <para>
52735 Lists of cipher suites can be combined in a single cipher string using
52736 the + character. This is used as a logical and operation. For example
52737 SHA1+DES represents all cipher suites containing the SHA1 and the DES
52738 algorithms.
52739 </para>
52740 </listitem>
52741 </itemizedlist>
52742 <para>
52743 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
52744 <literal>-</literal> or <literal>+</literal>.
52745 </para>
52746 <itemizedlist>
52747 <listitem>
52748 <para>
52749 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
52750 ciphers deleted can never reappear in the list even if they are explicitly
52751 stated.
52752 </para>
52753 </listitem>
52754 <listitem>
52755 <para>
52756 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
52757 of the ciphers can be added again by later options.
52758 </para>
52759 </listitem>
52760 <listitem>
52761 <para>
52762 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
52763 option does not add any new ciphers; it just moves matching existing ones.
52764 </para>
52765 </listitem>
52766 </itemizedlist>
52767 <para>
52768 If none of these characters is present, the string is interpreted as
52769 a list of ciphers to be appended to the current preference list. If the list
52770 includes any ciphers already present they will be ignored: that is, they will
52771 not be moved to the end of the list.
52772 </para>
52773 <para>
52774 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
52775 string:
52776 </para>
52777 <literallayout class="monospaced">
52778 # note single-quotes to get ! past any shell history expansion
52779 $ openssl ciphers 'HIGH:!MD5:!SHA1'
52780 </literallayout>
52781 <para>
52782 This example will let the library defaults be permitted on the MX port, where
52783 there&#x2019;s probably no identity verification anyway, but ups the ante on the
52784 submission ports where the administrator might have some influence on the
52785 choice of clients used:
52786 </para>
52787 <literallayout class="monospaced">
52788 # OpenSSL variant; see man ciphers(1)
52789 tls_require_ciphers = ${if =={$received_port}{25}\
52790                            {DEFAULT}\
52791                            {HIGH:!MD5:!SHA1}}
52792 </literallayout>
52793 </section>
52794 <section id="SECTreqciphgnu">
52795 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
52796 <para>
52797 <indexterm role="concept">
52798 <primary>GnuTLS</primary>
52799 <secondary>specifying parameters for</secondary>
52800 </indexterm>
52801 <indexterm role="concept">
52802 <primary>TLS</primary>
52803 <secondary>specifying ciphers (GnuTLS)</secondary>
52804 </indexterm>
52805 <indexterm role="concept">
52806 <primary>TLS</primary>
52807 <secondary>specifying key exchange methods (GnuTLS)</secondary>
52808 </indexterm>
52809 <indexterm role="concept">
52810 <primary>TLS</primary>
52811 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
52812 </indexterm>
52813 <indexterm role="concept">
52814 <primary>TLS</primary>
52815 <secondary>specifying protocols (GnuTLS)</secondary>
52816 </indexterm>
52817 <indexterm role="concept">
52818 <primary>TLS</primary>
52819 <secondary>specifying priority string (GnuTLS)</secondary>
52820 </indexterm>
52821 <indexterm role="option">
52822 <primary><option>tls_require_ciphers</option></primary>
52823 <secondary>GnuTLS</secondary>
52824 </indexterm>
52825 The GnuTLS library allows the caller to provide a "priority string", documented
52826 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
52827 ciphersuite specification in OpenSSL.
52828 </para>
52829 <para>
52830 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
52831 and controls both protocols and ciphers.
52832 </para>
52833 <para>
52834 The <option>tls_require_ciphers</option> option is available both as an global option,
52835 controlling how Exim behaves as a server, and also as an option of the
52836 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
52837 the value is string expanded.  The resulting string is not an Exim list and
52838 the string is given to the GnuTLS library, so that Exim does not need to be
52839 aware of future feature enhancements of GnuTLS.
52840 </para>
52841 <para>
52842 Documentation of the strings accepted may be found in the GnuTLS manual, under
52843 "Priority strings".  This is online as
52844 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/html_node/Priority-Strings.html">http://www.gnutls.org/manual/html_node/Priority-Strings.html</ulink></emphasis>,
52845 but beware that this relates to GnuTLS 3, which may be newer than the version
52846 installed on your system.  If you are using GnuTLS 3,
52847 then the example code
52848 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string</ulink></emphasis>
52849 on that site can be used to test a given string.
52850 </para>
52851 <para>
52852 For example:
52853 </para>
52854 <literallayout class="monospaced">
52855 # Disable older versions of protocols
52856 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
52857 </literallayout>
52858 <para>
52859 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
52860 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
52861 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
52862 </para>
52863 <para>
52864 This example will let the library defaults be permitted on the MX port, where
52865 there&#x2019;s probably no identity verification anyway, and lowers security further
52866 by increasing compatibility; but this ups the ante on the submission ports
52867 where the administrator might have some influence on the choice of clients
52868 used:
52869 </para>
52870 <literallayout class="monospaced">
52871 # GnuTLS variant
52872 tls_require_ciphers = ${if =={$received_port}{25}\
52873                            {NORMAL:%COMPAT}\
52874                            {SECURE128}}
52875 </literallayout>
52876 </section>
52877 <section id="SECID182">
52878 <title>Configuring an Exim server to use TLS</title>
52879 <para>
52880 <indexterm role="concept">
52881 <primary>TLS</primary>
52882 <secondary>configuring an Exim server</secondary>
52883 </indexterm>
52884 When Exim has been built with TLS support, it advertises the availability of
52885 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
52886 but not to any others. The default value of this option is unset, which means
52887 that STARTTLS is not advertised at all. This default is chosen because you
52888 need to set some other options in order to make TLS available, and also it is
52889 sensible for systems that want to use TLS only as a client.
52890 </para>
52891 <para>
52892 If a client issues a STARTTLS command and there is some configuration
52893 problem in the server, the command is rejected with a 454 error. If the client
52894 persists in trying to issue SMTP commands, all except QUIT are rejected
52895 with the error
52896 </para>
52897 <literallayout class="monospaced">
52898 554 Security failure
52899 </literallayout>
52900 <para>
52901 If a STARTTLS command is issued within an existing TLS session, it is
52902 rejected with a 554 error code.
52903 </para>
52904 <para>
52905 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
52906 must be set to match some hosts. The default is * which matches all hosts.
52907 </para>
52908 <para>
52909 If this is all you do, TLS encryption will be enabled but not authentication -
52910 meaning that the peer has no assurance it is actually you he is talking to.
52911 You gain protection from a passive sniffer listening on the wire but not
52912 from someone able to intercept the communication.
52913 </para>
52914 <para>
52915 Further protection requires some further configuration at the server end.
52916 </para>
52917 <para>
52918 It is rumoured that all existing clients that support TLS/SSL use RSA
52919 encryption. To make this work you need to set, in the server,
52920 </para>
52921 <literallayout class="monospaced">
52922 tls_certificate = /some/file/name
52923 tls_privatekey = /some/file/name
52924 </literallayout>
52925 <para>
52926 These options are, in fact, expanded strings, so you can make them depend on
52927 the identity of the client that is connected if you wish. The first file
52928 contains the server&#x2019;s X509 certificate, and the second contains the private key
52929 that goes with it. These files need to be
52930 PEM format and readable by the Exim user, and must
52931 always be given as full path names.
52932 The key must not be password-protected.
52933 They can be the same file if both the
52934 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
52935 set, or if its expansion is forced to fail or results in an empty string, this
52936 is assumed to be the case. The certificate file may also contain intermediate
52937 certificates that need to be sent to the client to enable it to authenticate
52938 the server&#x2019;s certificate.
52939 </para>
52940 <para>
52941 If you do not understand about certificates and keys, please try to find a
52942 source of this background information, which is not Exim-specific. (There are a
52943 few comments below in section <xref linkend="SECTcerandall"/>.)
52944 </para>
52945 <para>
52946 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
52947 they apply only in the case of a server. If you need to use a certificate in an
52948 Exim client, you must set the options of the same names in an <command>smtp</command>
52949 transport.
52950 </para>
52951 <para>
52952 With just these options, an Exim server will be able to use TLS. It does not
52953 require the client to have a certificate (but see below for how to insist on
52954 this). There is one other option that may be needed in other situations. If
52955 </para>
52956 <literallayout class="monospaced">
52957 tls_dhparam = /some/file/name
52958 </literallayout>
52959 <para>
52960 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
52961 with the parameters contained in the file.
52962 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
52963 available:
52964 </para>
52965 <literallayout class="monospaced">
52966 tls_dhparam = none
52967 </literallayout>
52968 <para>
52969 This may also be set to a string identifying a standard prime to be used for
52970 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
52971 used is <literal>ike23</literal>.  There are a few standard primes available, see the
52972 documentation for <option>tls_dhparam</option> for the complete list.
52973 </para>
52974 <para>
52975 See the command
52976 </para>
52977 <literallayout class="monospaced">
52978 openssl dhparam
52979 </literallayout>
52980 <para>
52981 for a way of generating file data.
52982 </para>
52983 <para>
52984 The strings supplied for these three options are expanded every time a client
52985 host connects. It is therefore possible to use different certificates and keys
52986 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
52987 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
52988 forced to fail, Exim behaves as if the option is not set.
52989 </para>
52990 <para>
52991 <indexterm role="concept">
52992 <primary>cipher</primary>
52993 <secondary>logging</secondary>
52994 </indexterm>
52995 <indexterm role="concept">
52996 <primary>log</primary>
52997 <secondary>TLS cipher</secondary>
52998 </indexterm>
52999 <indexterm role="variable">
53000 <primary><varname>$tls_in_cipher</varname></primary>
53001 </indexterm>
53002 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
53003 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
53004 incoming message (by default &ndash; you can, of course, change this), and it is
53005 also included in the log line that records a message&#x2019;s arrival, keyed by
53006 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
53007 condition can be used to test for specific cipher suites in ACLs.
53008 </para>
53009 <para>
53010 Once TLS has been established, the ACLs that run for subsequent SMTP commands
53011 can check the name of the cipher suite and vary their actions accordingly. The
53012 cipher suite names vary, depending on which TLS library is being used. For
53013 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
53014 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
53015 documentation for more details.
53016 </para>
53017 <para>
53018 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
53019 (again depending on the <option>tls_cipher</option> log selector).
53020 </para>
53021 </section>
53022 <section id="SECID183">
53023 <title>Requesting and verifying client certificates</title>
53024 <para>
53025 <indexterm role="concept">
53026 <primary>certificate</primary>
53027 <secondary>verification of client</secondary>
53028 </indexterm>
53029 <indexterm role="concept">
53030 <primary>TLS</primary>
53031 <secondary>client certificate verification</secondary>
53032 </indexterm>
53033 If you want an Exim server to request a certificate when negotiating a TLS
53034 session with a client, you must set either <option>tls_verify_hosts</option> or
53035 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
53036 apply to all TLS connections. For any host that matches one of these options,
53037 Exim requests a certificate as part of the setup of the TLS session. The
53038 contents of the certificate are verified by comparing it with a list of
53039 expected certificates.
53040 These may be the system default set (depending on library version),
53041 an explicit file or,
53042 depending on library version, a directory, identified by
53043 <option>tls_verify_certificates</option>.
53044 </para>
53045 <para>
53046 A file can contain multiple certificates, concatenated end to end. If a
53047 directory is used
53048 (OpenSSL only),
53049 each certificate must be in a separate file, with a name (or a symbolic link)
53050 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
53051 certificate. You can compute the relevant hash by running the command
53052 </para>
53053 <literallayout class="monospaced">
53054 openssl x509 -hash -noout -in /cert/file
53055 </literallayout>
53056 <para>
53057 where <filename>/cert/file</filename> contains a single certificate.
53058 </para>
53059 <para>
53060 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
53061 what happens if the client does not supply a certificate, or if the certificate
53062 does not match any of the certificates in the collection named by
53063 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
53064 attempt to set up a TLS session is aborted, and the incoming connection is
53065 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
53066 session continues. ACLs that run for subsequent SMTP commands can detect the
53067 fact that no certificate was verified, and vary their actions accordingly. For
53068 example, you can insist on a certificate before accepting a message for
53069 relaying, but not when the message is destined for local delivery.
53070 </para>
53071 <para>
53072 <indexterm role="variable">
53073 <primary><varname>$tls_in_peerdn</varname></primary>
53074 </indexterm>
53075 When a client supplies a certificate (whether it verifies or not), the value of
53076 the Distinguished Name of the certificate is made available in the variable
53077 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
53078 </para>
53079 <para>
53080 <indexterm role="concept">
53081 <primary>log</primary>
53082 <secondary>distinguished name</secondary>
53083 </indexterm>
53084 Because it is often a long text string, it is not included in the log line or
53085 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
53086 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
53087 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
53088 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
53089 </para>
53090 </section>
53091 <section id="SECID184">
53092 <title>Revoked certificates</title>
53093 <para>
53094 <indexterm role="concept">
53095 <primary>TLS</primary>
53096 <secondary>revoked certificates</secondary>
53097 </indexterm>
53098 <indexterm role="concept">
53099 <primary>revocation list</primary>
53100 </indexterm>
53101 <indexterm role="concept">
53102 <primary>certificate</primary>
53103 <secondary>revocation list</secondary>
53104 </indexterm>
53105 <indexterm role="concept">
53106 <primary>OCSP</primary>
53107 <secondary>stapling</secondary>
53108 </indexterm>
53109 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
53110 certificates are revoked. If you have such a list, you can pass it to an Exim
53111 server using the global option called <option>tls_crl</option> and to an Exim client using
53112 an identically named option for the <command>smtp</command> transport. In each case, the value
53113 of the option is expanded and must then be the name of a file that contains a
53114 CRL in PEM format.
53115 The downside is that clients have to periodically re-download a potentially huge
53116 file from every certificate authority they know of.
53117 </para>
53118 <para>
53119 The way with most moving parts at query time is Online Certificate
53120 Status Protocol (OCSP), where the client verifies the certificate
53121 against an OCSP server run by the CA.  This lets the CA track all
53122 usage of the certs.  It requires running software with access to the
53123 private key of the CA, to sign the responses to the OCSP queries.  OCSP
53124 is based on HTTP and can be proxied accordingly.
53125 </para>
53126 <para>
53127 The only widespread OCSP server implementation (known to this writer)
53128 comes as part of OpenSSL and aborts on an invalid request, such as
53129 connecting to the port and then disconnecting.  This requires
53130 re-entering the passphrase each time some random client does this.
53131 </para>
53132 <para>
53133 The third way is OCSP Stapling; in this, the server using a certificate
53134 issued by the CA periodically requests an OCSP proof of validity from
53135 the OCSP server, then serves it up inline as part of the TLS
53136 negotiation.   This approach adds no extra round trips, does not let the
53137 CA track users, scales well with number of certs issued by the CA and is
53138 resilient to temporary OCSP server failures, as long as the server
53139 starts retrying to fetch an OCSP proof some time before its current
53140 proof expires.  The downside is that it requires server support.
53141 </para>
53142 <para>
53143 Unless Exim is built with the support disabled,
53144 or with GnuTLS earlier than version 3.3.16 / 3.4.8
53145 support for OCSP stapling is included.
53146 </para>
53147 <para>
53148 There is a global option called <option>tls_ocsp_file</option>.
53149 The file specified therein is expected to be in DER format, and contain
53150 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
53151 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
53152 contains <literal>tls_in_sni</literal>, as per other TLS options.
53153 </para>
53154 <para>
53155 Exim does not at this time implement any support for fetching a new OCSP
53156 proof.  The burden is on the administrator to handle this, outside of
53157 Exim.  The file specified should be replaced atomically, so that the
53158 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
53159 on each connection, so a new file will be handled transparently on the
53160 next connection.
53161 </para>
53162 <para>
53163 When built with OpenSSL Exim will check for a valid next update timestamp
53164 in the OCSP proof; if not present, or if the proof has expired, it will be
53165 ignored.
53166 </para>
53167 <para>
53168 For the client to be able to verify the stapled OCSP the server must
53169 also supply, in its stapled information, any intermediate
53170 certificates for the chain leading to the OCSP proof from the signer
53171 of the server certificate.  There may be zero or one such. These
53172 intermediate certificates should be added to the server OCSP stapling
53173 file named by <option>tls_ocsp_file</option>.
53174 </para>
53175 <para>
53176 Note that the proof only covers the terminal server certificate,
53177 not any of the chain from CA to it.
53178 </para>
53179 <para>
53180 There is no current way to staple a proof for a client certificate.
53181 </para>
53182 <literallayout class="monospaced">
53183   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
53184   OCSP server is supplied.  The server URL may be included in the
53185   server certificate, if the CA is helpful.
53186
53187   One failure mode seen was the OCSP Signer cert expiring before the end
53188   of validity of the OCSP proof. The checking done by Exim/OpenSSL
53189   noted this as invalid overall, but the re-fetch script did not.
53190 </literallayout>
53191 </section>
53192 <section id="SECID185">
53193 <title>Configuring an Exim client to use TLS</title>
53194 <para>
53195 <indexterm role="concept">
53196 <primary>cipher</primary>
53197 <secondary>logging</secondary>
53198 </indexterm>
53199 <indexterm role="concept">
53200 <primary>log</primary>
53201 <secondary>TLS cipher</secondary>
53202 </indexterm>
53203 <indexterm role="concept">
53204 <primary>log</primary>
53205 <secondary>distinguished name</secondary>
53206 </indexterm>
53207 <indexterm role="concept">
53208 <primary>TLS</primary>
53209 <secondary>configuring an Exim client</secondary>
53210 </indexterm>
53211 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
53212 deliveries as well as to incoming, the latter one causing logging of the
53213 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
53214 within the <command>smtp</command> transport.
53215 </para>
53216 <para>
53217 It is not necessary to set any options to have TLS work in the <command>smtp</command>
53218 transport. If Exim is built with TLS support, and TLS is advertised by a
53219 server, the <command>smtp</command> transport always tries to start a TLS session. However,
53220 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
53221 transport) to a list of server hosts for which TLS should not be used.
53222 </para>
53223 <para>
53224 If you do not want Exim to attempt to send messages unencrypted when an attempt
53225 to set up an encrypted connection fails in any way, you can set
53226 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
53227 those hosts, delivery is always deferred if an encrypted connection cannot be
53228 set up. If there are any other hosts for the address, they are tried in the
53229 usual way.
53230 </para>
53231 <para>
53232 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
53233 the message unencrypted. It always does this if the response to STARTTLS is
53234 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
53235 session after a success response code, what happens is controlled by the
53236 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
53237 delivery to this host is deferred, and other hosts (if available) are tried. If
53238 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
53239 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
53240 negotiation fails, Exim closes the current connection (because it is in an
53241 unknown state), opens a new one to the same host, and then tries the delivery
53242 unencrypted.
53243 </para>
53244 <para>
53245 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
53246 transport provide the client with a certificate, which is passed to the server
53247 if it requests it. If the server is Exim, it will request a certificate only if
53248 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
53249 </para>
53250 <para>
53251 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
53252 specifies a collection of expected server certificates.
53253 These may be the system default set (depending on library version),
53254 a file or,
53255 depending on library version, a directory,
53256 must name a file or,
53257 for OpenSSL only (not GnuTLS), a directory.
53258 The client verifies the server&#x2019;s certificate
53259 against this collection, taking into account any revoked certificates that are
53260 in the list defined by <option>tls_crl</option>.
53261 Failure to verify fails the TLS connection unless either of the
53262 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
53263 </para>
53264 <para>
53265 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
53266 certificate verification to the listed servers.  Verification either must
53267 or need not succeed respectively.
53268 </para>
53269 <para>
53270 The <command>smtp</command> transport has two OCSP-related options:
53271 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
53272 is requested and required for the connection to proceed.  The default
53273 value is empty.
53274 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
53275 a Certificate Status is requested (but not necessarily verified).  The default
53276 value is "*" meaning that requests are made unless configured
53277 otherwise.
53278 </para>
53279 <para>
53280 The host(s) should also be in <option>hosts_require_tls</option>, and
53281 <option>tls_verify_certificates</option> configured for the transport,
53282 for OCSP to be relevant.
53283 </para>
53284 <para>
53285 If
53286 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
53287 list of permitted cipher suites. If either of these checks fails, delivery to
53288 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
53289 alternative hosts, if any.
53290 </para>
53291 <para>
53292  <emphasis role="bold">Note</emphasis>:
53293 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
53294 is operating as a client. Exim does not assume that a server certificate (set
53295 by the global options of the same name) should also be used when operating as a
53296 client.
53297 </para>
53298 <para>
53299 <indexterm role="variable">
53300 <primary><varname>$host</varname></primary>
53301 </indexterm>
53302 <indexterm role="variable">
53303 <primary><varname>$host_address</varname></primary>
53304 </indexterm>
53305 All the TLS options in the <command>smtp</command> transport are expanded before use, with
53306 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
53307 which the client is connected. Forced failure of an expansion causes Exim to
53308 behave as if the relevant option were unset.
53309 </para>
53310 <para>
53311 <indexterm role="variable">
53312 <primary><varname>$tls_out_bits</varname></primary>
53313 </indexterm>
53314 <indexterm role="variable">
53315 <primary><varname>$tls_out_cipher</varname></primary>
53316 </indexterm>
53317 <indexterm role="variable">
53318 <primary><varname>$tls_out_peerdn</varname></primary>
53319 </indexterm>
53320 <indexterm role="variable">
53321 <primary><varname>$tls_out_sni</varname></primary>
53322 </indexterm>
53323 Before an SMTP connection is established, the
53324 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
53325 variables are emptied. (Until the first connection, they contain the values
53326 that were set when the message was received.) If STARTTLS is subsequently
53327 successfully obeyed, these variables are set to the relevant values for the
53328 outgoing connection.
53329 </para>
53330 </section>
53331 <section id="SECTtlssni">
53332 <title>Use of TLS Server Name Indication</title>
53333 <para>
53334 <indexterm role="concept">
53335 <primary>TLS</primary>
53336 <secondary>Server Name Indication</secondary>
53337 </indexterm>
53338 <indexterm role="variable">
53339 <primary><varname>$tls_in_sni</varname></primary>
53340 </indexterm>
53341 <indexterm role="option">
53342 <primary><option>tls_in_sni</option></primary>
53343 </indexterm>
53344 With TLS1.0 or above, there is an extension mechanism by which extra
53345 information can be included at various points in the protocol.  One of these
53346 extensions, documented in RFC 6066 (and before that RFC 4366) is
53347 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
53348 client in the initial handshake, so that the server can examine the servername
53349 within and possibly choose to use different certificates and keys (and more)
53350 for this session.
53351 </para>
53352 <para>
53353 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
53354 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
53355 address.
53356 </para>
53357 <para>
53358 With SMTP to MX, there are the same problems here as in choosing the identity
53359 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
53360 provide the identity which you then cryptographically verify.  So this will
53361 be of limited use in that environment.
53362 </para>
53363 <para>
53364 With SMTP to Submission, there is a well-defined hostname which clients are
53365 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
53366 choose to include this information in the TLS negotiation.  If this becomes
53367 wide-spread, then hosters can choose to present different certificates to
53368 different clients.  Or even negotiate different cipher suites.
53369 </para>
53370 <para>
53371 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
53372 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
53373 nothing more to it.  Choosing a sensible value not derived insecurely is the
53374 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
53375 for the lifetime of the client connection (including during authentication).
53376 </para>
53377 <para>
53378 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
53379 received from a client.
53380 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
53381 </para>
53382 <para>
53383 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
53384 option (prior to expansion) then the following options will be re-expanded
53385 during TLS session handshake, to permit alternative values to be chosen:
53386 </para>
53387 <itemizedlist>
53388 <listitem>
53389 <para>
53390 <indexterm role="variable">
53391 <primary><option>tls_certificate</option></primary>
53392 </indexterm>
53393 <option>tls_certificate</option>
53394 </para>
53395 </listitem>
53396 <listitem>
53397 <para>
53398 <indexterm role="variable">
53399 <primary><option>tls_crl</option></primary>
53400 </indexterm>
53401 <option>tls_crl</option>
53402 </para>
53403 </listitem>
53404 <listitem>
53405 <para>
53406 <indexterm role="variable">
53407 <primary><option>tls_privatekey</option></primary>
53408 </indexterm>
53409 <option>tls_privatekey</option>
53410 </para>
53411 </listitem>
53412 <listitem>
53413 <para>
53414 <indexterm role="variable">
53415 <primary><option>tls_verify_certificates</option></primary>
53416 </indexterm>
53417 <option>tls_verify_certificates</option>
53418 </para>
53419 </listitem>
53420 <listitem>
53421 <para>
53422 <indexterm role="variable">
53423 <primary><option>tls_ocsp_file</option></primary>
53424 </indexterm>
53425 <option>tls_ocsp_file</option>
53426 </para>
53427 </listitem>
53428 </itemizedlist>
53429 <para>
53430 Great care should be taken to deal with matters of case, various injection
53431 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
53432 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
53433 arbitrary unverified data provided prior to authentication.
53434 Further, the initial certificate is loaded before SNI is arrived, so
53435 an expansion for <option>tls_certificate</option> must have a default which is used
53436 when <varname>$tls_in_sni</varname> is empty.
53437 </para>
53438 <para>
53439 The Exim developers are proceeding cautiously and so far no other TLS options
53440 are re-expanded.
53441 </para>
53442 <para>
53443 When Exim is built against OpenSSL, OpenSSL must have been built with support
53444 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
53445 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
53446 see <literal>-servername</literal> in the output, then OpenSSL has support.
53447 </para>
53448 <para>
53449 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
53450 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
53451 built, then you have SNI support).
53452 </para>
53453 </section>
53454 <section id="SECTmulmessam">
53455 <title>Multiple messages on the same encrypted TCP/IP connection</title>
53456 <para>
53457 <indexterm role="concept">
53458 <primary>multiple SMTP deliveries with TLS</primary>
53459 </indexterm>
53460 <indexterm role="concept">
53461 <primary>TLS</primary>
53462 <secondary>multiple message deliveries</secondary>
53463 </indexterm>
53464 Exim sends multiple messages down the same TCP/IP connection by starting up
53465 an entirely new delivery process for each message, passing the socket from
53466 one process to the next. This implementation does not fit well with the use
53467 of TLS, because there is quite a lot of state information associated with a TLS
53468 connection, not just a socket identification. Passing all the state information
53469 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
53470 session before passing the socket to a new process. The new process may then
53471 try to start a new TLS session, and if successful, may try to re-authenticate
53472 if AUTH is in use, before sending the next message.
53473 </para>
53474 <para>
53475 The RFC is not clear as to whether or not an SMTP session continues in clear
53476 after TLS has been shut down, or whether TLS may be restarted again later, as
53477 just described. However, if the server is Exim, this shutdown and
53478 reinitialization works. It is not known which (if any) other servers operate
53479 successfully if the client closes a TLS session and continues with unencrypted
53480 SMTP, but there are certainly some that do not work. For such servers, Exim
53481 should not pass the socket to another process, because the failure of the
53482 subsequent attempt to use it would cause Exim to record a temporary host error,
53483 and delay other deliveries to that host.
53484 </para>
53485 <para>
53486 To test for this case, Exim sends an EHLO command to the server after
53487 closing down the TLS session. If this fails in any way, the connection is
53488 closed instead of being passed to a new delivery process, but no retry
53489 information is recorded.
53490 </para>
53491 <para>
53492 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
53493 <command>smtp</command> transport to match those hosts for which Exim should not pass
53494 connections to new processes if TLS has been used.
53495 </para>
53496 </section>
53497 <section id="SECTcerandall">
53498 <title>Certificates and all that</title>
53499 <para>
53500 <indexterm role="concept">
53501 <primary>certificate</primary>
53502 <secondary>references to discussion</secondary>
53503 </indexterm>
53504 In order to understand fully how TLS works, you need to know about
53505 certificates, certificate signing, and certificate authorities. This is not the
53506 place to give a tutorial, especially as I do not know very much about it
53507 myself. Some helpful introduction can be found in the FAQ for the SSL addition
53508 to Apache, currently at
53509 </para>
53510 <literallayout>
53511 <emphasis role="bold"><ulink url="http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24">http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24</ulink></emphasis>
53512 </literallayout>
53513 <para>
53514 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
53515 links to further files.
53516 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
53517 0-201-61598-3), contains both introductory and more in-depth descriptions.
53518 Some sample programs taken from the book are available from
53519 </para>
53520 <literallayout>
53521 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
53522 </literallayout>
53523 </section>
53524 <section id="SECID186">
53525 <title>Certificate chains</title>
53526 <para>
53527 The file named by <option>tls_certificate</option> may contain more than one
53528 certificate. This is useful in the case where the certificate that is being
53529 sent is validated by an intermediate certificate which the other end does
53530 not have. Multiple certificates must be in the correct order in the file.
53531 First the host&#x2019;s certificate itself, then the first intermediate
53532 certificate to validate the issuer of the host certificate, then the next
53533 intermediate certificate to validate the issuer of the first intermediate
53534 certificate, and so on, until finally (optionally) the root certificate.
53535 The root certificate must already be trusted by the recipient for
53536 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
53537 root certificate along with the rest makes it available for the user to
53538 install if the receiving end is a client MUA that can interact with a user.
53539 </para>
53540 <para>
53541 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
53542 even if your libraries allow loading them for use in Exim when acting as a
53543 server, increasingly clients will not accept such certificates.  The error
53544 diagnostics in such a case can be frustratingly vague.
53545 </para>
53546 </section>
53547 <section id="SECID187">
53548 <title>Self-signed certificates</title>
53549 <para>
53550 <indexterm role="concept">
53551 <primary>certificate</primary>
53552 <secondary>self-signed</secondary>
53553 </indexterm>
53554 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
53555 with OpenSSL, like this:
53556 </para>
53557 <literallayout class="monospaced">
53558 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
53559             -days 9999 -nodes
53560 </literallayout>
53561 <para>
53562 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
53563 delimited and so can be identified independently. The <option>-days</option> option
53564 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
53565 important: if you do not set it, the key is encrypted with a passphrase
53566 that you are prompted for, and any use that is made of the key causes more
53567 prompting for the passphrase. This is not helpful if you are going to use
53568 this certificate and key in an MTA, where prompting is not possible.
53569 </para>
53570 <para>
53571 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
53572 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
53573 the above command might produce a date in the past.  Think carefully about
53574 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
53575 of the certificate or reconsider your platform deployment.  (At time of
53576 writing, reducing the duration is the most likely choice, but the inexorable
53577 progression of time takes us steadily towards an era where this will not
53578 be a sensible resolution).
53579 </para>
53580 <para>
53581 A self-signed certificate made in this way is sufficient for testing, and
53582 may be adequate for all your requirements if you are mainly interested in
53583 encrypting transfers, and not in secure identification.
53584 </para>
53585 <para>
53586 However, many clients require that the certificate presented by the server be a
53587 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
53588 certificate. In this situation, the self-signed certificate described above
53589 must be installed on the client host as a trusted root <emphasis>certification
53590 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
53591 signed with that self-signed certificate.
53592 </para>
53593 <para>
53594 For information on creating self-signed CA certificates and using them to sign
53595 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
53596 Open-source PKI book, available online at
53597 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
53598 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
53599 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
53600 </para>
53601 </section>
53602 </chapter>
53603
53604 <chapter id="CHAPACL">
53605 <title>Access control lists</title>
53606 <para>
53607 <indexterm role="concept" id="IIDacl" class="startofrange">
53608 <primary>access control lists (ACLs)</primary>
53609 <secondary>description</secondary>
53610 </indexterm>
53611 <indexterm role="concept">
53612 <primary>control of incoming mail</primary>
53613 </indexterm>
53614 <indexterm role="concept">
53615 <primary>message</primary>
53616 <secondary>controlling incoming</secondary>
53617 </indexterm>
53618 <indexterm role="concept">
53619 <primary>policy control</primary>
53620 <secondary>access control lists</secondary>
53621 </indexterm>
53622 Access Control Lists (ACLs) are defined in a separate section of the run time
53623 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
53624 name, terminated by a colon. Here is a complete ACL section that contains just
53625 one very small ACL:
53626 </para>
53627 <literallayout class="monospaced">
53628 begin acl
53629 small_acl:
53630   accept   hosts = one.host.only
53631 </literallayout>
53632 <para>
53633 You can have as many lists as you like in the ACL section, and the order in
53634 which they appear does not matter. The lists are self-terminating.
53635 </para>
53636 <para>
53637 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
53638 certain SMTP commands. This applies both to incoming TCP/IP connections, and
53639 when a local process submits a message using SMTP by specifying the <option>-bs</option>
53640 option. The most common use is for controlling which recipients are accepted
53641 in incoming messages. In addition, you can define an ACL that is used to check
53642 local non-SMTP messages. The default configuration file contains an example of
53643 a realistic ACL for checking RCPT commands. This is discussed in chapter
53644 <xref linkend="CHAPdefconfil"/>.
53645 </para>
53646 <section id="SECID188">
53647 <title>Testing ACLs</title>
53648 <para>
53649 The <option>-bh</option> command line option provides a way of testing your ACL
53650 configuration locally by running a fake SMTP session with which you interact.
53651 </para>
53652 </section>
53653 <section id="SECID189">
53654 <title>Specifying when ACLs are used</title>
53655 <para>
53656 <indexterm role="concept">
53657 <primary>access control lists (ACLs)</primary>
53658 <secondary>options for specifying</secondary>
53659 </indexterm>
53660 In order to cause an ACL to be used, you have to name it in one of the relevant
53661 options in the main part of the configuration. These options are:
53662 <indexterm role="concept">
53663 <primary>AUTH</primary>
53664 <secondary>ACL for</secondary>
53665 </indexterm>
53666 <indexterm role="concept">
53667 <primary>DATA</primary>
53668 <secondary>ACLs for</secondary>
53669 </indexterm>
53670 <indexterm role="concept">
53671 <primary>ETRN</primary>
53672 <secondary>ACL for</secondary>
53673 </indexterm>
53674 <indexterm role="concept">
53675 <primary>EXPN</primary>
53676 <secondary>ACL for</secondary>
53677 </indexterm>
53678 <indexterm role="concept">
53679 <primary>HELO</primary>
53680 <secondary>ACL for</secondary>
53681 </indexterm>
53682 <indexterm role="concept">
53683 <primary>EHLO</primary>
53684 <secondary>ACL for</secondary>
53685 </indexterm>
53686 <indexterm role="concept">
53687 <primary>DKIM</primary>
53688 <secondary>ACL for</secondary>
53689 </indexterm>
53690 <indexterm role="concept">
53691 <primary>MAIL</primary>
53692 <secondary>ACL for</secondary>
53693 </indexterm>
53694 <indexterm role="concept">
53695 <primary>QUIT, ACL for</primary>
53696 </indexterm>
53697 <indexterm role="concept">
53698 <primary>RCPT</primary>
53699 <secondary>ACL for</secondary>
53700 </indexterm>
53701 <indexterm role="concept">
53702 <primary>STARTTLS, ACL for</primary>
53703 </indexterm>
53704 <indexterm role="concept">
53705 <primary>VRFY</primary>
53706 <secondary>ACL for</secondary>
53707 </indexterm>
53708 <indexterm role="concept">
53709 <primary>SMTP</primary>
53710 <secondary>connection, ACL for</secondary>
53711 </indexterm>
53712 <indexterm role="concept">
53713 <primary>non-SMTP messages</primary>
53714 <secondary>ACLs for</secondary>
53715 </indexterm>
53716 <indexterm role="concept">
53717 <primary>MIME content scanning</primary>
53718 <secondary>ACL for</secondary>
53719 </indexterm>
53720 <indexterm role="concept">
53721 <primary>PRDR</primary>
53722 <secondary>ACL for</secondary>
53723 </indexterm>
53724 </para>
53725 <informaltable frame="none">
53726 <tgroup cols="2" colsep="0" rowsep="0">
53727 <colspec colwidth="140pt" align="left"/>
53728 <colspec colwidth="254pt" align="left"/>
53729 <tbody>
53730 <row>
53731 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
53732 <entry>ACL for non-SMTP messages</entry>
53733 </row>
53734 <row>
53735 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
53736 <entry>ACL for non-SMTP MIME parts</entry>
53737 </row>
53738 <row>
53739 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
53740 <entry>ACL at start of non-SMTP message</entry>
53741 </row>
53742 <row>
53743 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
53744 <entry>ACL for AUTH</entry>
53745 </row>
53746 <row>
53747 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
53748 <entry>ACL for start of SMTP connection</entry>
53749 </row>
53750 <row>
53751 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
53752 <entry>ACL after DATA is complete</entry>
53753 </row>
53754 <row>
53755 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
53756 <entry>ACL for each recipient, after DATA is complete</entry>
53757 </row>
53758 <row>
53759 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
53760 <entry>ACL for each DKIM signer</entry>
53761 </row>
53762 <row>
53763 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
53764 <entry>ACL for ETRN</entry>
53765 </row>
53766 <row>
53767 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
53768 <entry>ACL for EXPN</entry>
53769 </row>
53770 <row>
53771 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
53772 <entry>ACL for HELO or EHLO</entry>
53773 </row>
53774 <row>
53775 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
53776 <entry>ACL for MAIL</entry>
53777 </row>
53778 <row>
53779 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
53780 <entry>ACL for the AUTH parameter of MAIL</entry>
53781 </row>
53782 <row>
53783 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
53784 <entry>ACL for content-scanning MIME parts</entry>
53785 </row>
53786 <row>
53787 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
53788 <entry>ACL for non-QUIT terminations</entry>
53789 </row>
53790 <row>
53791 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
53792 <entry>ACL at start of DATA command</entry>
53793 </row>
53794 <row>
53795 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
53796 <entry>ACL for QUIT</entry>
53797 </row>
53798 <row>
53799 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
53800 <entry>ACL for RCPT</entry>
53801 </row>
53802 <row>
53803 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
53804 <entry>ACL for STARTTLS</entry>
53805 </row>
53806 <row>
53807 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
53808 <entry>ACL for VRFY</entry>
53809 </row>
53810 </tbody>
53811 </tgroup>
53812 </informaltable>
53813 <para>
53814 For example, if you set
53815 </para>
53816 <literallayout class="monospaced">
53817 acl_smtp_rcpt = small_acl
53818 </literallayout>
53819 <para>
53820 the little ACL defined above is used whenever Exim receives a RCPT command
53821 in an SMTP dialogue. The majority of policy tests on incoming messages can be
53822 done when RCPT commands arrive. A rejection of RCPT should cause the
53823 sending MTA to give up on the recipient address contained in the RCPT
53824 command, whereas rejection at other times may cause the client MTA to keep on
53825 trying to deliver the message. It is therefore recommended that you do as much
53826 testing as possible at RCPT time.
53827 </para>
53828 </section>
53829 <section id="SECID190">
53830 <title>The non-SMTP ACLs</title>
53831 <para>
53832 <indexterm role="concept">
53833 <primary>non-SMTP messages</primary>
53834 <secondary>ACLs for</secondary>
53835 </indexterm>
53836 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
53837 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
53838 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
53839 the state of the SMTP connection such as encryption and authentication) are not
53840 relevant and are forbidden in these ACLs. However, the sender and recipients
53841 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
53842 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
53843 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
53844 in any of these ACLs.
53845 </para>
53846 <para>
53847 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
53848 non-SMTP message, before any of the message has been read. (This is the
53849 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
53850 batched SMTP input, it runs after the DATA command has been reached. The
53851 result of this ACL is ignored; it cannot be used to reject a message. If you
53852 really need to, you could set a value in an ACL variable here and reject based
53853 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
53854 controls, and in particular, it can be used to set
53855 </para>
53856 <literallayout class="monospaced">
53857 control = suppress_local_fixups
53858 </literallayout>
53859 <para>
53860 This cannot be used in the other non-SMTP ACLs because by the time they are
53861 run, it is too late.
53862 </para>
53863 <para>
53864 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
53865 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
53866 </para>
53867 <para>
53868 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
53869 kind of rejection is treated as permanent, because there is no way of sending a
53870 temporary error for these kinds of message.
53871 </para>
53872 </section>
53873 <section id="SECID191">
53874 <title>The SMTP connect ACL</title>
53875 <para>
53876 <indexterm role="concept">
53877 <primary>SMTP</primary>
53878 <secondary>connection, ACL for</secondary>
53879 </indexterm>
53880 <indexterm role="option">
53881 <primary><option>smtp_banner</option></primary>
53882 </indexterm>
53883 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
53884 session, after the test specified by <option>host_reject_connection</option> (which is now
53885 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
53886 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
53887 the message override the banner message that is otherwise specified by the
53888 <option>smtp_banner</option> option.
53889 </para>
53890 </section>
53891 <section id="SECID192">
53892 <title>The EHLO/HELO ACL</title>
53893 <para>
53894 <indexterm role="concept">
53895 <primary>EHLO</primary>
53896 <secondary>ACL for</secondary>
53897 </indexterm>
53898 <indexterm role="concept">
53899 <primary>HELO</primary>
53900 <secondary>ACL for</secondary>
53901 </indexterm>
53902 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
53903 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
53904 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
53905 Note that a client may issue more than one EHLO or HELO command in an SMTP
53906 session, and indeed is required to issue a new EHLO or HELO after successfully
53907 setting up encryption following a STARTTLS command.
53908 </para>
53909 <para>
53910 Note also that a deny neither forces the client to go away nor means that
53911 mail will be refused on the connection.  Consider checking for
53912 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
53913 </para>
53914 <para>
53915 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
53916 modifier, the message may not contain more than one line (it will be truncated
53917 at the first newline and a panic logged if it does). Such a message cannot
53918 affect the EHLO options that are listed on the second and subsequent lines of
53919 an EHLO response.
53920 </para>
53921 </section>
53922 <section id="SECID193">
53923 <title>The DATA ACLs</title>
53924 <para>
53925 <indexterm role="concept">
53926 <primary>DATA</primary>
53927 <secondary>ACLs for</secondary>
53928 </indexterm>
53929 Two ACLs are associated with the DATA command, because it is two-stage
53930 command, with two responses being sent to the client.
53931 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
53932 is obeyed. This gives you control after all the RCPT commands, but before
53933 the message itself is received. It offers the opportunity to give a negative
53934 response to the DATA command before the data is transmitted. Header lines
53935 added by MAIL or RCPT ACLs are not visible at this time, but any that
53936 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
53937 </para>
53938 <para>
53939 You cannot test the contents of the message, for example, to verify addresses
53940 in the headers, at RCPT time or when the DATA command is received. Such
53941 tests have to appear in the ACL that is run after the message itself has been
53942 received, before the final response to the DATA command is sent. This is
53943 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
53944 associated with the DATA command.
53945 </para>
53946 <para>
53947 <indexterm role="concept">
53948 <primary>CHUNKING</primary>
53949 <secondary>BDAT command</secondary>
53950 </indexterm>
53951 <indexterm role="concept">
53952 <primary>BDAT</primary>
53953 <secondary>SMTP command</secondary>
53954 </indexterm>
53955 <indexterm role="concept">
53956 <primary>RFC 3030</primary>
53957 <secondary>CHUNKING</secondary>
53958 </indexterm>
53959 If CHUNKING was advertised and a BDAT command sequence is received,
53960 the <option>acl_smtp_predata</option> ACL is not run.
53961 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
53962 the data specified is received.
53963 </para>
53964 <para>
53965 For both of these ACLs, it is not possible to reject individual recipients. An
53966 error response rejects the entire message. Unfortunately, it is known that some
53967 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
53968 before or after the data) correctly &ndash; they keep the message on their queues
53969 and try again later, but that is their problem, though it does waste some of
53970 your resources.
53971 </para>
53972 <para>
53973 The <option>acl_smtp_data</option> ACL is run after
53974 the <option>acl_smtp_data_prdr</option>,
53975 the <option>acl_smtp_dkim</option>
53976 and the <option>acl_smtp_mime</option> ACLs.
53977 </para>
53978 </section>
53979 <section id="SECTDKIMACL">
53980 <title>The SMTP DKIM ACL</title>
53981 <para>
53982 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
53983 enabled (which is the default).
53984 </para>
53985 <para>
53986 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
53987 received, and is executed for each DKIM signature found in a message.  If not
53988 otherwise specified, the default action is to accept.
53989 </para>
53990 <para>
53991 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
53992 </para>
53993 <para>
53994 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53995 </para>
53996 </section>
53997 <section id="SECID194">
53998 <title>The SMTP MIME ACL</title>
53999 <para>
54000 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
54001 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
54002 </para>
54003 <para>
54004 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54005 </para>
54006 </section>
54007 <section id="SECTPRDRACL">
54008 <title>The SMTP PRDR ACL</title>
54009 <para>
54010 <indexterm role="concept">
54011 <primary>PRDR</primary>
54012 <secondary>ACL for</secondary>
54013 </indexterm>
54014 <indexterm role="option">
54015 <primary><option>prdr_enable</option></primary>
54016 </indexterm>
54017 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
54018 with PRDR support enabled (which is the default).
54019 It becomes active only when the PRDR feature is negotiated between
54020 client and server for a message, and more than one recipient
54021 has been accepted.
54022 </para>
54023 <para>
54024 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
54025 has been received, and is executed once for each recipient of the message
54026 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
54027 The test may accept, defer or deny for individual recipients.
54028 The <option>acl_smtp_data</option> will still be called after this ACL and
54029 can reject the message overall, even if this ACL has accepted it
54030 for some or all recipients.
54031 </para>
54032 <para>
54033 PRDR may be used to support per-user content filtering.  Without it
54034 one must defer any recipient after the first that has a different
54035 content-filter configuration.  With PRDR, the RCPT-time check
54036 <indexterm role="concept">
54037 <primary>PRDR</primary>
54038 <secondary>variable for</secondary>
54039 </indexterm>
54040 for this can be disabled when the variable <varname>$prdr_requested</varname>
54041 is <quote>yes</quote>.
54042 Any required difference in behaviour of the main DATA-time
54043 ACL should however depend on the PRDR-time ACL having run, as Exim
54044 will avoid doing so in some situations (e.g.  single-recipient mails).
54045 </para>
54046 <para>
54047 See also the <option>prdr_enable</option> global option
54048 and the <option>hosts_try_prdr</option> smtp transport option.
54049 </para>
54050 <para>
54051 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54052 If the ACL is not defined, processing completes as if
54053 the feature was not requested by the client.
54054 </para>
54055 </section>
54056 <section id="SECTQUITACL">
54057 <title>The QUIT ACL</title>
54058 <para>
54059 <indexterm role="concept">
54060 <primary>QUIT, ACL for</primary>
54061 </indexterm>
54062 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
54063 does not affect the response code to QUIT, which is always 221. Thus, the ACL
54064 does not in fact control any access.
54065 For this reason, it may only accept
54066 or warn as its final result.
54067 </para>
54068 <para>
54069 This ACL can be used for tasks such as custom logging at the end of an SMTP
54070 session. For example, you can use ACL variables in other ACLs to count
54071 messages, recipients, etc., and log the totals at QUIT time using one or
54072 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
54073 </para>
54074 <para>
54075 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
54076 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
54077 </para>
54078 <para>
54079 You do not need to have a final <option>accept</option>, but if you do, you can use a
54080 <option>message</option> modifier to specify custom text that is sent as part of the 221
54081 response to QUIT.
54082 </para>
54083 <para>
54084 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
54085 failure (for example, failure to open a log file, or when Exim is bombing out
54086 because it has detected an unrecoverable error), all SMTP commands from the
54087 client are given temporary error responses until QUIT is received or the
54088 connection is closed. In these special cases, the QUIT ACL does not run.
54089 </para>
54090 </section>
54091 <section id="SECTNOTQUITACL">
54092 <title>The not-QUIT ACL</title>
54093 <para>
54094 <indexterm role="variable">
54095 <primary><varname>$acl_smtp_notquit</varname></primary>
54096 </indexterm>
54097 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
54098 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
54099 trouble, such as being unable to write to its log files, this ACL is not run,
54100 because it might try to do things (such as write to log files) that make the
54101 situation even worse.
54102 </para>
54103 <para>
54104 Like the QUIT ACL, this ACL is provided to make it possible to do customized
54105 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
54106 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
54107 and <option>warn</option>.
54108 </para>
54109 <para>
54110 <indexterm role="variable">
54111 <primary><varname>$smtp_notquit_reason</varname></primary>
54112 </indexterm>
54113 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
54114 to a string that indicates the reason for the termination of the SMTP
54115 connection. The possible values are:
54116 </para>
54117 <informaltable frame="none">
54118 <tgroup cols="2" colsep="0" rowsep="0">
54119 <colspec colwidth="196pt" align="left"/>
54120 <colspec colwidth="254pt" align="left"/>
54121 <tbody>
54122 <row>
54123 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
54124 <entry>Another ACL issued a <option>drop</option> command</entry>
54125 </row>
54126 <row>
54127 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
54128 <entry>Too many unknown or non-mail commands</entry>
54129 </row>
54130 <row>
54131 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
54132 <entry>Timeout while reading SMTP commands</entry>
54133 </row>
54134 <row>
54135 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
54136 <entry>The SMTP connection has been lost</entry>
54137 </row>
54138 <row>
54139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
54140 <entry>Timeout while reading message data</entry>
54141 </row>
54142 <row>
54143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
54144 <entry>The <function>local_scan()</function> function crashed</entry>
54145 </row>
54146 <row>
54147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
54148 <entry>The <function>local_scan()</function> function timed out</entry>
54149 </row>
54150 <row>
54151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
54152 <entry>SIGTERM or SIGINT</entry>
54153 </row>
54154 <row>
54155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
54156 <entry>SMTP synchronization error</entry>
54157 </row>
54158 <row>
54159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
54160 <entry>TLS failed to start</entry>
54161 </row>
54162 </tbody>
54163 </tgroup>
54164 </informaltable>
54165 <para>
54166 In most cases when an SMTP connection is closed without having received QUIT,
54167 Exim sends an SMTP response message before actually closing the connection.
54168 With the exception of the <literal>acl-drop</literal> case, the default message can be
54169 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
54170 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
54171 used.
54172 </para>
54173 </section>
54174 <section id="SECID195">
54175 <title>Finding an ACL to use</title>
54176 <para>
54177 <indexterm role="concept">
54178 <primary>access control lists (ACLs)</primary>
54179 <secondary>finding which to use</secondary>
54180 </indexterm>
54181 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
54182 you can use different ACLs in different circumstances. For example,
54183 </para>
54184 <literallayout class="monospaced">
54185 acl_smtp_rcpt = ${if ={25}{$interface_port} \
54186                      {acl_check_rcpt} {acl_check_rcpt_submit} }
54187 </literallayout>
54188 <para>
54189 In the default configuration file there are some example settings for
54190 providing an RFC 4409 message submission service on port 587 and a
54191 non-standard <quote>smtps</quote> service on port 465. You can use a string
54192 expansion like this to choose an ACL for MUAs on these ports which is
54193 more appropriate for this purpose than the default ACL on port 25.
54194 </para>
54195 <para>
54196 The expanded string does not have to be the name of an ACL in the
54197 configuration file; there are other possibilities. Having expanded the
54198 string, Exim searches for an ACL as follows:
54199 </para>
54200 <itemizedlist>
54201 <listitem>
54202 <para>
54203 If the string begins with a slash, Exim uses it as a file name, and reads its
54204 contents as an ACL. The lines are processed in the same way as lines in the
54205 Exim configuration file. In particular, continuation lines are supported, blank
54206 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
54207 If the file does not exist or cannot be read, an error occurs (typically
54208 causing a temporary failure of whatever caused the ACL to be run). For example:
54209 </para>
54210 <literallayout class="monospaced">
54211 acl_smtp_data = /etc/acls/\
54212   ${lookup{$sender_host_address}lsearch\
54213   {/etc/acllist}{$value}{default}}
54214 </literallayout>
54215 <para>
54216 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
54217 back to a default if the lookup fails. If an ACL is successfully read from a
54218 file, it is retained in memory for the duration of the Exim process, so that it
54219 can be re-used without having to re-read the file.
54220 </para>
54221 </listitem>
54222 <listitem>
54223 <para>
54224 If the string does not start with a slash, and does not contain any spaces,
54225 Exim searches the ACL section of the configuration for an ACL whose name
54226 matches the string.
54227 </para>
54228 </listitem>
54229 <listitem>
54230 <para>
54231 If no named ACL is found, or if the string contains spaces, Exim parses
54232 the string as an inline ACL. This can save typing in cases where you just
54233 want to have something like
54234 </para>
54235 <literallayout class="monospaced">
54236 acl_smtp_vrfy = accept
54237 </literallayout>
54238 <para>
54239 in order to allow free use of the VRFY command. Such a string may contain
54240 newlines; it is processed in the same way as an ACL that is read from a file.
54241 </para>
54242 </listitem>
54243 </itemizedlist>
54244 </section>
54245 <section id="SECID196">
54246 <title>ACL return codes</title>
54247 <para>
54248 <indexterm role="concept">
54249 <primary>access control lists (ACLs)</primary>
54250 <secondary>return codes</secondary>
54251 </indexterm>
54252 Except for the QUIT ACL, which does not affect the SMTP return code (see
54253 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
54254 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
54255 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
54256 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
54257 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
54258 This also causes a 4<emphasis>xx</emphasis> return code.
54259 </para>
54260 <para>
54261 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
54262 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
54263 submitters of non-SMTP messages.
54264 </para>
54265 <para>
54266 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
54267 has the effect of <quote>accept</quote>, but causes either the entire message or an
54268 individual recipient address to be discarded. In other words, it is a
54269 blackholing facility. Use it with care.
54270 </para>
54271 <para>
54272 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
54273 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
54274 RCPT ACL is to discard just the one recipient address. If there are no
54275 recipients left when the message&#x2019;s data is received, the DATA ACL is not
54276 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
54277 remaining recipients. The <quote>discard</quote> return is not permitted for the
54278 <option>acl_smtp_predata</option> ACL.
54279 </para>
54280 <para revisionflag="changed">
54281 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
54282 is done on the address and the result determines the SMTP response.
54283 </para>
54284 <para>
54285 <indexterm role="concept">
54286 <primary><function>local_scan()</function> function</primary>
54287 <secondary>when all recipients discarded</secondary>
54288 </indexterm>
54289 The <function>local_scan()</function> function is always run, even if there are no remaining
54290 recipients; it may create new recipients.
54291 </para>
54292 </section>
54293 <section id="SECID197">
54294 <title>Unset ACL options</title>
54295 <para>
54296 <indexterm role="concept">
54297 <primary>access control lists (ACLs)</primary>
54298 <secondary>unset options</secondary>
54299 </indexterm>
54300 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
54301 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
54302 not defined at all. For any defined ACL, the default action when control
54303 reaches the end of the ACL statements is <quote>deny</quote>.
54304 </para>
54305 <para>
54306 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
54307 these two are ACLs that are used only for their side effects. They cannot be
54308 used to accept or reject anything.
54309 </para>
54310 <para>
54311 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
54312 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
54313 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
54314 when the ACL is not defined is <quote>accept</quote>.
54315 </para>
54316 <para>
54317 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
54318 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
54319 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
54320 messages over an SMTP connection. For an example, see the ACL in the default
54321 configuration file.
54322 </para>
54323 </section>
54324 <section id="SECID198">
54325 <title>Data for message ACLs</title>
54326 <para>
54327 <indexterm role="concept">
54328 <primary>access control lists (ACLs)</primary>
54329 <secondary>data for message ACL</secondary>
54330 </indexterm>
54331 <indexterm role="variable">
54332 <primary><varname>$domain</varname></primary>
54333 </indexterm>
54334 <indexterm role="variable">
54335 <primary><varname>$local_part</varname></primary>
54336 </indexterm>
54337 <indexterm role="variable">
54338 <primary><varname>$sender_address</varname></primary>
54339 </indexterm>
54340 <indexterm role="variable">
54341 <primary><varname>$sender_host_address</varname></primary>
54342 </indexterm>
54343 <indexterm role="variable">
54344 <primary><varname>$smtp_command</varname></primary>
54345 </indexterm>
54346 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
54347 that contain information about the host and the message&#x2019;s sender (for example,
54348 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
54349 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
54350 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
54351 is available in <varname>$smtp_command</varname>.
54352 </para>
54353 <para>
54354 When an ACL for the AUTH parameter of MAIL is running, the variables that
54355 contain information about the host are set, but <varname>$sender_address</varname> is not yet
54356 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
54357 how it is used.
54358 </para>
54359 <para>
54360 <indexterm role="variable">
54361 <primary><varname>$message_size</varname></primary>
54362 </indexterm>
54363 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
54364 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
54365 that parameter is not given. The value is updated to the true message size by
54366 the time the final DATA ACL is run (after the message data has been
54367 received).
54368 </para>
54369 <para>
54370 <indexterm role="variable">
54371 <primary><varname>$rcpt_count</varname></primary>
54372 </indexterm>
54373 <indexterm role="variable">
54374 <primary><varname>$recipients_count</varname></primary>
54375 </indexterm>
54376 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
54377 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
54378 accepted, so while an ACL for RCPT is being processed, it contains the number
54379 of previously accepted recipients. At DATA time (for both the DATA ACLs),
54380 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
54381 <varname>$recipients_count</varname> contains the total number of accepted recipients.
54382 </para>
54383 </section>
54384 <section id="SECTdatfornon">
54385 <title>Data for non-message ACLs</title>
54386 <para>
54387 <indexterm role="concept">
54388 <primary>access control lists (ACLs)</primary>
54389 <secondary>data for non-message ACL</secondary>
54390 </indexterm>
54391 <indexterm role="variable">
54392 <primary><varname>$smtp_command_argument</varname></primary>
54393 </indexterm>
54394 <indexterm role="variable">
54395 <primary><varname>$smtp_command</varname></primary>
54396 </indexterm>
54397 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
54398 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
54399 and the entire SMTP command is available in <varname>$smtp_command</varname>.
54400 These variables can be tested using a <option>condition</option> condition. For example,
54401 here is an ACL for use with AUTH, which insists that either the session is
54402 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
54403 does not permit authentication methods that use cleartext passwords on
54404 unencrypted connections.
54405 </para>
54406 <literallayout class="monospaced">
54407 acl_check_auth:
54408   accept encrypted = *
54409   accept condition = ${if eq{${uc:$smtp_command_argument}}\
54410                      {CRAM-MD5}}
54411   deny   message   = TLS encryption or CRAM-MD5 required
54412 </literallayout>
54413 <para>
54414 (Another way of applying this restriction is to arrange for the authenticators
54415 that use cleartext passwords not to be advertised when the connection is not
54416 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
54417 option to do this.)
54418 </para>
54419 </section>
54420 <section id="SECID199">
54421 <title>Format of an ACL</title>
54422 <para>
54423 <indexterm role="concept">
54424 <primary>access control lists (ACLs)</primary>
54425 <secondary>format of</secondary>
54426 </indexterm>
54427 <indexterm role="concept">
54428 <primary>access control lists (ACLs)</primary>
54429 <secondary>verbs, definition of</secondary>
54430 </indexterm>
54431 An individual ACL consists of a number of statements. Each statement starts
54432 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
54433 Modifiers can change the way the verb operates, define error and log messages,
54434 set variables, insert delays, and vary the processing of accepted messages.
54435 </para>
54436 <para>
54437 If all the conditions are met, the verb is obeyed. The same condition may be
54438 used (with different arguments) more than once in the same statement. This
54439 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
54440 example:
54441 </para>
54442 <literallayout class="monospaced">
54443 deny  dnslists = list1.example
54444       dnslists = list2.example
54445 </literallayout>
54446 <para>
54447 If there are no conditions, the verb is always obeyed. Exim stops evaluating
54448 the conditions and modifiers when it reaches a condition that fails. What
54449 happens then depends on the verb (and in one case, on a special modifier). Not
54450 all the conditions make sense at every testing point. For example, you cannot
54451 test a sender address in the ACL that is run for a VRFY command.
54452 </para>
54453 </section>
54454 <section id="SECID200">
54455 <title>ACL verbs</title>
54456 <para>
54457 The ACL verbs are as follows:
54458 </para>
54459 <itemizedlist>
54460 <listitem>
54461 <para>
54462 <indexterm role="concept">
54463 <primary><option>accept</option> ACL verb</primary>
54464 </indexterm>
54465 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
54466 of the conditions are not met, what happens depends on whether <option>endpass</option>
54467 appears among the conditions (for syntax see below). If the failing condition
54468 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
54469 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
54470 check a RCPT command:
54471 </para>
54472 <literallayout class="monospaced">
54473 accept domains = +local_domains
54474        endpass
54475        verify = recipient
54476 </literallayout>
54477 <para>
54478 If the recipient domain does not match the <option>domains</option> condition, control
54479 passes to the next statement. If it does match, the recipient is verified, and
54480 the command is accepted if verification succeeds. However, if verification
54481 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
54482 <option>endpass</option>.
54483 </para>
54484 <para>
54485 The <option>endpass</option> feature has turned out to be confusing to many people, so its
54486 use is not recommended nowadays. It is always possible to rewrite an ACL so
54487 that <option>endpass</option> is not needed, and it is no longer used in the default
54488 configuration.
54489 </para>
54490 <para>
54491 <indexterm role="concept">
54492 <primary><option>message</option> ACL modifier</primary>
54493 <secondary>with <option>accept</option></secondary>
54494 </indexterm>
54495 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
54496 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
54497 (when an <option>accept</option> verb either accepts or passes control to the next
54498 statement), <option>message</option> can be used to vary the message that is sent when an
54499 SMTP command is accepted. For example, in a RCPT ACL you could have:
54500 </para>
54501 <literallayout>
54502 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
54503 <literal>        message = OK, I will allow you through today</literal>
54504 </literallayout>
54505 <para>
54506 You can specify an SMTP response code, optionally followed by an <quote>extended
54507 response code</quote> at the start of the message, but the first digit must be the
54508 same as would be sent by default, which is 2 for an <option>accept</option> verb.
54509 </para>
54510 <para>
54511 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
54512 an error message that is used when access is denied. This behaviour is retained
54513 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
54514 of <option>endpass</option>.
54515 </para>
54516 </listitem>
54517 <listitem>
54518 <para>
54519 <indexterm role="concept">
54520 <primary><option>defer</option> ACL verb</primary>
54521 </indexterm>
54522 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
54523 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
54524 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
54525 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
54526 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
54527 be used in any ACL, and even for a recipient it might be a simpler approach.
54528 </para>
54529 </listitem>
54530 <listitem>
54531 <para>
54532 <indexterm role="concept">
54533 <primary><option>deny</option> ACL verb</primary>
54534 </indexterm>
54535 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
54536 the conditions are not met, control is passed to the next ACL statement. For
54537 example,
54538 </para>
54539 <literallayout class="monospaced">
54540 deny dnslists = blackholes.mail-abuse.org
54541 </literallayout>
54542 <para>
54543 rejects commands from hosts that are on a DNS black list.
54544 </para>
54545 </listitem>
54546 <listitem>
54547 <para>
54548 <indexterm role="concept">
54549 <primary><option>discard</option> ACL verb</primary>
54550 </indexterm>
54551 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
54552 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
54553 that are concerned with receiving messages. When all the conditions are true,
54554 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
54555 recipients to be discarded. If it is used in an ACL for RCPT, just the one
54556 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
54557 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
54558 do not appear in the log line when the <option>received_recipients</option> log selector is set.
54559 </para>
54560 <para>
54561 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
54562 its contents are added to the line that is automatically written to the log.
54563 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
54564 </para>
54565 </listitem>
54566 <listitem>
54567 <para>
54568 <indexterm role="concept">
54569 <primary><option>drop</option> ACL verb</primary>
54570 </indexterm>
54571 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
54572 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
54573 </para>
54574 <literallayout class="monospaced">
54575 drop   message   = I don't take more than 20 RCPTs
54576        condition = ${if &gt; {$rcpt_count}{20}}
54577 </literallayout>
54578 <para>
54579 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
54580 The connection is always dropped after sending a 550 response.
54581 </para>
54582 </listitem>
54583 <listitem>
54584 <para>
54585 <indexterm role="concept">
54586 <primary><option>require</option> ACL verb</primary>
54587 </indexterm>
54588 <option>require</option>: If all the conditions are met, control is passed to the next ACL
54589 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
54590 example, when checking a RCPT command,
54591 </para>
54592 <literallayout class="monospaced">
54593 require message = Sender did not verify
54594         verify  = sender
54595 </literallayout>
54596 <para>
54597 passes control to subsequent statements only if the message&#x2019;s sender can be
54598 verified. Otherwise, it rejects the command. Note the positioning of the
54599 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
54600 discussed in section <xref linkend="SECTcondmodproc"/>.
54601 </para>
54602 </listitem>
54603 <listitem>
54604 <para>
54605 <indexterm role="concept">
54606 <primary><option>warn</option> ACL verb</primary>
54607 </indexterm>
54608 <option>warn</option>: If all the conditions are true, a line specified by the
54609 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
54610 to the next ACL statement. If any condition is false, the log line is not
54611 written. If an identical log line is requested several times in the same
54612 message, only one copy is actually written to the log. If you want to force
54613 duplicates to be written, use the <option>logwrite</option> modifier instead.
54614 </para>
54615 <para>
54616 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
54617 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
54618 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
54619 first failing condition. There is more about adding header lines in section
54620 <xref linkend="SECTaddheadacl"/>.
54621 </para>
54622 <para>
54623 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
54624 some sort of defer), the log line specified by <option>log_message</option> is not written.
54625 This does not include the case of a forced failure from a lookup, which
54626 is considered to be a successful completion. After a defer, no further
54627 conditions or modifiers in the <option>warn</option> statement are processed. The incident
54628 is logged, and the ACL continues to be processed, from the next statement
54629 onwards.
54630 </para>
54631 <para>
54632 <indexterm role="variable">
54633 <primary><varname>$acl_verify_message</varname></primary>
54634 </indexterm>
54635 When one of the <option>warn</option> conditions is an address verification that fails, the
54636 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
54637 want this logged, you must set it up explicitly. For example:
54638 </para>
54639 <literallayout class="monospaced">
54640 warn   !verify = sender
54641        log_message = sender verify failed: $acl_verify_message
54642 </literallayout>
54643 </listitem>
54644 </itemizedlist>
54645 <para>
54646 At the end of each ACL there is an implicit unconditional <option>deny</option>.
54647 </para>
54648 <para>
54649 As you can see from the examples above, the conditions and modifiers are
54650 written one to a line, with the first one on the same line as the verb, and
54651 subsequent ones on following lines. If you have a very long condition, you can
54652 continue it onto several physical lines by the usual backslash continuation
54653 mechanism. It is conventional to align the conditions vertically.
54654 </para>
54655 </section>
54656 <section id="SECTaclvariables">
54657 <title>ACL variables</title>
54658 <para>
54659 <indexterm role="concept">
54660 <primary>access control lists (ACLs)</primary>
54661 <secondary>variables</secondary>
54662 </indexterm>
54663 There are some special variables that can be set during ACL processing. They
54664 can be used to pass information between different ACLs, different invocations
54665 of the same ACL in the same SMTP connection, and between ACLs and the routers,
54666 transports, and filters that are used to deliver a message. The names of these
54667 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
54668 an underscore, but the remainder of the name can be any sequence of
54669 alphanumeric characters and underscores that you choose. There is no limit on
54670 the number of ACL variables. The two sets act as follows:
54671 </para>
54672 <itemizedlist>
54673 <listitem>
54674 <para>
54675 The values of those variables whose names begin with <varname>$acl_c</varname> persist
54676 throughout an SMTP connection. They are never reset. Thus, a value that is set
54677 while receiving one message is still available when receiving the next message
54678 on the same SMTP connection.
54679 </para>
54680 </listitem>
54681 <listitem>
54682 <para>
54683 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
54684 while a message is being received. They are reset afterwards. They are also
54685 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
54686 </para>
54687 </listitem>
54688 </itemizedlist>
54689 <para>
54690 When a message is accepted, the current values of all the ACL variables are
54691 preserved with the message and are subsequently made available at delivery
54692 time. The ACL variables are set by a modifier called <option>set</option>. For example:
54693 </para>
54694 <literallayout class="monospaced">
54695 accept hosts = whatever
54696        set acl_m4 = some value
54697 accept authenticated = *
54698        set acl_c_auth = yes
54699 </literallayout>
54700 <para>
54701 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
54702 be set. If you want to set a variable without taking any action, you can use a
54703 <option>warn</option> verb without any other modifiers or conditions.
54704 </para>
54705 <para>
54706 <indexterm role="option">
54707 <primary><option>strict_acl_vars</option></primary>
54708 </indexterm>
54709 What happens if a syntactically valid but undefined ACL variable is
54710 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
54711 false (the default), an empty string is substituted; if it is true, an
54712 error is generated.
54713 </para>
54714 <para>
54715 Versions of Exim before 4.64 have a limited set of numbered variables, but
54716 their names are compatible, so there is no problem with upgrading.
54717 </para>
54718 </section>
54719 <section id="SECTcondmodproc">
54720 <title>Condition and modifier processing</title>
54721 <para>
54722 <indexterm role="concept">
54723 <primary>access control lists (ACLs)</primary>
54724 <secondary>conditions; processing</secondary>
54725 </indexterm>
54726 <indexterm role="concept">
54727 <primary>access control lists (ACLs)</primary>
54728 <secondary>modifiers; processing</secondary>
54729 </indexterm>
54730 An exclamation mark preceding a condition negates its result. For example:
54731 </para>
54732 <literallayout class="monospaced">
54733 deny   domains = *.dom.example
54734       !verify  = recipient
54735 </literallayout>
54736 <para>
54737 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
54738 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
54739 negation can be used on the right-hand side of a condition. For example, these
54740 two statements are equivalent:
54741 </para>
54742 <literallayout class="monospaced">
54743 deny  hosts = !192.168.3.4
54744 deny !hosts =  192.168.3.4
54745 </literallayout>
54746 <para>
54747 However, for many conditions (<option>verify</option> being a good example), only left-hand
54748 side negation of the whole condition is possible.
54749 </para>
54750 <para>
54751 The arguments of conditions and modifiers are expanded. A forced failure
54752 of an expansion causes a condition to be ignored, that is, it behaves as if the
54753 condition is true. Consider these two statements:
54754 </para>
54755 <literallayout class="monospaced">
54756 accept  senders = ${lookup{$host_name}lsearch\
54757                   {/some/file}{$value}fail}
54758 accept  senders = ${lookup{$host_name}lsearch\
54759                   {/some/file}{$value}{}}
54760 </literallayout>
54761 <para>
54762 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
54763 the returned list is searched, but if the lookup fails the behaviour is
54764 different in the two cases. The <option>fail</option> in the first statement causes the
54765 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
54766 therefore succeeds. The second statement, however, generates an empty list when
54767 the lookup fails. No sender can match an empty list, so the condition fails,
54768 and therefore the <option>accept</option> also fails.
54769 </para>
54770 <para>
54771 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
54772 specify actions that are taken as the conditions for a statement are checked;
54773 others specify text for messages that are used when access is denied or a
54774 warning is generated. The <option>control</option> modifier affects the way an incoming
54775 message is handled.
54776 </para>
54777 <para>
54778 The positioning of the modifiers in an ACL statement is important, because the
54779 processing of a verb ceases as soon as its outcome is known. Only those
54780 modifiers that have already been encountered will take effect. For example,
54781 consider this use of the <option>message</option> modifier:
54782 </para>
54783 <literallayout class="monospaced">
54784 require message = Can't verify sender
54785         verify  = sender
54786         message = Can't verify recipient
54787         verify  = recipient
54788         message = This message cannot be used
54789 </literallayout>
54790 <para>
54791 If sender verification fails, Exim knows that the result of the statement is
54792 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
54793 so its text is used as the error message. If sender verification succeeds, but
54794 recipient verification fails, the second message is used. If recipient
54795 verification succeeds, the third message becomes <quote>current</quote>, but is never used
54796 because there are no more conditions to cause failure.
54797 </para>
54798 <para>
54799 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
54800 modifier that is used, because all the conditions must be true for rejection to
54801 happen. Specifying more than one <option>message</option> modifier does not make sense, and
54802 the message can even be specified after all the conditions. For example:
54803 </para>
54804 <literallayout class="monospaced">
54805 deny   hosts = ...
54806       !senders = *@my.domain.example
54807        message = Invalid sender from client host
54808 </literallayout>
54809 <para>
54810 The <quote>deny</quote> result does not happen until the end of the statement is reached,
54811 by which time Exim has set up the message.
54812 </para>
54813 </section>
54814 <section id="SECTACLmodi">
54815 <title>ACL modifiers</title>
54816 <para>
54817 <indexterm role="concept">
54818 <primary>access control lists (ACLs)</primary>
54819 <secondary>modifiers; list of</secondary>
54820 </indexterm>
54821 The ACL modifiers are as follows:
54822 </para>
54823 <variablelist>
54824 <varlistentry>
54825 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54826 <listitem>
54827 <para>
54828 This modifier specifies one or more header lines that are to be added to an
54829 incoming message, assuming, of course, that the message is ultimately
54830 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
54831 </para>
54832 </listitem></varlistentry>
54833 <varlistentry>
54834 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54835 <listitem>
54836 <para>
54837 <indexterm role="concept">
54838 <primary><option>continue</option> ACL modifier</primary>
54839 </indexterm>
54840 <indexterm role="concept">
54841 <primary>database</primary>
54842 <secondary>updating in ACL</secondary>
54843 </indexterm>
54844 This modifier does nothing of itself, and processing of the ACL always
54845 continues with the next condition or modifier. The value of <option>continue</option> is in
54846 the side effects of expanding its argument. Typically this could be used to
54847 update a database. It is really just a syntactic tidiness, to avoid having to
54848 write rather ugly lines like this:
54849 </para>
54850 <literallayout>
54851 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
54852 </literallayout>
54853 <para>
54854 Instead, all you need is
54855 </para>
54856 <literallayout>
54857 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
54858 </literallayout>
54859 </listitem></varlistentry>
54860 <varlistentry>
54861 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54862 <listitem>
54863 <para>
54864 <indexterm role="concept">
54865 <primary><option>control</option> ACL modifier</primary>
54866 </indexterm>
54867 This modifier affects the subsequent processing of the SMTP connection or of an
54868 incoming message that is accepted. The effect of the first type of control
54869 lasts for the duration of the connection, whereas the effect of the second type
54870 lasts only until the current message has been received. The message-specific
54871 controls always apply to the whole message, not to individual recipients,
54872 even if the <option>control</option> modifier appears in a RCPT ACL.
54873 </para>
54874 <para>
54875 As there are now quite a few controls that can be applied, they are described
54876 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
54877 in several different ways. For example:
54878 </para>
54879 <itemizedlist>
54880 <listitem>
54881 <para>
54882 It can be at the end of an <option>accept</option> statement:
54883 </para>
54884 <literallayout class="monospaced">
54885     accept  ...some conditions
54886             control = queue_only
54887 </literallayout>
54888 <para>
54889 In this case, the control is applied when this statement yields <quote>accept</quote>, in
54890 other words, when the conditions are all true.
54891 </para>
54892 </listitem>
54893 <listitem>
54894 <para>
54895 It can be in the middle of an <option>accept</option> statement:
54896 </para>
54897 <literallayout class="monospaced">
54898     accept  ...some conditions...
54899             control = queue_only
54900             ...some more conditions...
54901 </literallayout>
54902 <para>
54903 If the first set of conditions are true, the control is applied, even if the
54904 statement does not accept because one of the second set of conditions is false.
54905 In this case, some subsequent statement must yield <quote>accept</quote> for the control
54906 to be relevant.
54907 </para>
54908 </listitem>
54909 <listitem>
54910 <para>
54911 It can be used with <option>warn</option> to apply the control, leaving the
54912 decision about accepting or denying to a subsequent verb. For
54913 example:
54914 </para>
54915 <literallayout class="monospaced">
54916     warn    ...some conditions...
54917             control = freeze
54918     accept  ...
54919 </literallayout>
54920 <para>
54921 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
54922 <option>logwrite</option>, so it does not add anything to the message and does not write a
54923 log entry.
54924 </para>
54925 </listitem>
54926 <listitem>
54927 <para>
54928 If you want to apply a control unconditionally, you can use it with a
54929 <option>require</option> verb. For example:
54930 </para>
54931 <literallayout class="monospaced">
54932     require  control = no_multiline_responses
54933 </literallayout>
54934 </listitem>
54935 </itemizedlist>
54936 </listitem></varlistentry>
54937 <varlistentry>
54938 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
54939 <listitem>
54940 <para>
54941 <indexterm role="concept">
54942 <primary><option>delay</option> ACL modifier</primary>
54943 </indexterm>
54944 <indexterm role="option">
54945 <primary><option>-bh</option></primary>
54946 </indexterm>
54947 This modifier may appear in any ACL except notquit. It causes Exim to wait for
54948 the time interval before proceeding. However, when testing Exim using the
54949 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
54950 output instead). The time is given in the usual Exim notation, and the delay
54951 happens as soon as the modifier is processed. In an SMTP session, pending
54952 output is flushed before the delay is imposed.
54953 </para>
54954 <para>
54955 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
54956 example:
54957 </para>
54958 <literallayout class="monospaced">
54959 deny    ...some conditions...
54960         delay = 30s
54961 </literallayout>
54962 <para>
54963 The delay happens if all the conditions are true, before the statement returns
54964 <quote>deny</quote>. Compare this with:
54965 </para>
54966 <literallayout class="monospaced">
54967 deny    delay = 30s
54968         ...some conditions...
54969 </literallayout>
54970 <para>
54971 which waits for 30s before processing the conditions. The <option>delay</option> modifier
54972 can also be used with <option>warn</option> and together with <option>control</option>:
54973 </para>
54974 <literallayout class="monospaced">
54975 warn    ...some conditions...
54976         delay = 2m
54977         control = freeze
54978 accept  ...
54979 </literallayout>
54980 <para>
54981 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
54982 responses to several commands are no longer buffered and sent in one packet (as
54983 they would normally be) because all output is flushed before imposing the
54984 delay. This optimization is disabled so that a number of small delays do not
54985 appear to the client as one large aggregated delay that might provoke an
54986 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
54987 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
54988 </para>
54989 </listitem></varlistentry>
54990 <varlistentry>
54991 <term><emphasis role="bold">endpass</emphasis></term>
54992 <listitem>
54993 <para>
54994 <indexterm role="concept">
54995 <primary><option>endpass</option> ACL modifier</primary>
54996 </indexterm>
54997 This modifier, which has no argument, is recognized only in <option>accept</option> and
54998 <option>discard</option> statements. It marks the boundary between the conditions whose
54999 failure causes control to pass to the next statement, and the conditions whose
55000 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
55001 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
55002 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
55003 </para>
55004 </listitem></varlistentry>
55005 <varlistentry>
55006 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55007 <listitem>
55008 <para>
55009 <indexterm role="concept">
55010 <primary><option>log_message</option> ACL modifier</primary>
55011 </indexterm>
55012 This modifier sets up a message that is used as part of the log message if the
55013 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
55014 </para>
55015 <literallayout class="monospaced">
55016 require log_message = wrong cipher suite $tls_in_cipher
55017         encrypted   = DES-CBC3-SHA
55018 </literallayout>
55019 <para>
55020 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
55021 example:
55022 </para>
55023 <literallayout>
55024 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55025 <literal>        log_message = Discarded $local_part@$domain because...</literal>
55026 </literallayout>
55027 <para>
55028 When access is denied, <option>log_message</option> adds to any underlying error message
55029 that may exist because of a condition failure. For example, while verifying a
55030 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
55031 message.
55032 </para>
55033 <para>
55034 The message may be defined before the conditions to which it applies, because
55035 the string expansion does not happen until Exim decides that access is to be
55036 denied. This means that any variables that are set by the condition are
55037 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
55038 variables are set after a DNS black list lookup succeeds. If the expansion of
55039 <option>log_message</option> fails, or if the result is an empty string, the modifier is
55040 ignored.
55041 </para>
55042 <para>
55043 <indexterm role="variable">
55044 <primary><varname>$acl_verify_message</varname></primary>
55045 </indexterm>
55046 If you want to use a <option>warn</option> statement to log the result of an address
55047 verification, you can use <varname>$acl_verify_message</varname> to include the verification
55048 error message.
55049 </para>
55050 <para>
55051 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
55052 the start of the logged message. If the same warning log message is requested
55053 more than once while receiving  a single email message, only one copy is
55054 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
55055 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
55056 is logged for a successful <option>warn</option> statement.
55057 </para>
55058 <para>
55059 If <option>log_message</option> is not present and there is no underlying error message (for
55060 example, from the failure of address verification), but <option>message</option> is present,
55061 the <option>message</option> text is used for logging rejections. However, if any text for
55062 logging contains newlines, only the first line is logged. In the absence of
55063 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
55064 logging rejections.
55065 </para>
55066 </listitem></varlistentry>
55067 <varlistentry>
55068 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
55069 <listitem>
55070 <para>
55071 <indexterm role="concept">
55072 <primary><option>log_reject_target</option> ACL modifier</primary>
55073 </indexterm>
55074 <indexterm role="concept">
55075 <primary>logging in ACL</primary>
55076 <secondary>specifying which log</secondary>
55077 </indexterm>
55078 This modifier makes it possible to specify which logs are used for messages
55079 about ACL rejections. Its argument is a colon-separated list of words that can
55080 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
55081 may be empty, in which case a rejection is not logged at all. For example, this
55082 ACL fragment writes no logging information when access is denied:
55083 </para>
55084 <literallayout>
55085 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55086 <literal>     log_reject_target =</literal>
55087 </literallayout>
55088 <para>
55089 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
55090 permanent and temporary rejections. Its effect lasts for the rest of the
55091 current ACL.
55092 </para>
55093 </listitem></varlistentry>
55094 <varlistentry>
55095 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55096 <listitem>
55097 <para>
55098 <indexterm role="concept">
55099 <primary><option>logwrite</option> ACL modifier</primary>
55100 </indexterm>
55101 <indexterm role="concept">
55102 <primary>logging in ACL</primary>
55103 <secondary>immediate</secondary>
55104 </indexterm>
55105 This modifier writes a message to a log file as soon as it is encountered when
55106 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
55107 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
55108 access.) The <option>logwrite</option> modifier can be used to log special incidents in
55109 ACLs. For example:
55110 </para>
55111 <literallayout>
55112 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
55113 <literal>       control  = freeze</literal>
55114 <literal>       logwrite = froze message because ...</literal>
55115 </literallayout>
55116 <para>
55117 By default, the message is written to the main log. However, it may begin
55118 with a colon, followed by a comma-separated list of log names, and then
55119 another colon, to specify exactly which logs are to be written. For
55120 example:
55121 </para>
55122 <literallayout class="monospaced">
55123 logwrite = :main,reject: text for main and reject logs
55124 logwrite = :panic: text for panic log only
55125 </literallayout>
55126 </listitem></varlistentry>
55127 <varlistentry>
55128 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55129 <listitem>
55130 <para>
55131 <indexterm role="concept">
55132 <primary><option>message</option> ACL modifier</primary>
55133 </indexterm>
55134 This modifier sets up a text string that is expanded and used as a response
55135 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
55136 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
55137 there is some complication if <option>endpass</option> is involved; see the description of
55138 <option>accept</option> for details.)
55139 </para>
55140 <para>
55141 The expansion of the message happens at the time Exim decides that the ACL is
55142 to end, not at the time it processes <option>message</option>. If the expansion fails, or
55143 generates an empty string, the modifier is ignored. Here is an example where
55144 <option>message</option> must be specified first, because the ACL ends with a rejection if
55145 the <option>hosts</option> condition fails:
55146 </para>
55147 <literallayout class="monospaced">
55148 require  message = Host not recognized
55149          hosts = 10.0.0.0/8
55150 </literallayout>
55151 <para>
55152 (Once a condition has failed, no further conditions or modifiers are
55153 processed.)
55154 </para>
55155 <para>
55156 <indexterm role="concept">
55157 <primary>SMTP</primary>
55158 <secondary>error codes</secondary>
55159 </indexterm>
55160 <indexterm role="option">
55161 <primary><option>smtp_banner</option></primary>
55162 </indexterm>
55163 For ACLs that are triggered by SMTP commands, the message is returned as part
55164 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
55165 is meaningful only for SMTP, as no message is returned when a non-SMTP message
55166 is accepted. In the case of the connect ACL, accepting with a message modifier
55167 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
55168 accept message may not contain more than one line (otherwise it will be
55169 truncated at the first newline and a panic logged), and it cannot affect the
55170 EHLO options.
55171 </para>
55172 <para>
55173 When SMTP is involved, the message may begin with an overriding response code,
55174 consisting of three digits optionally followed by an <quote>extended response code</quote>
55175 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
55176 </para>
55177 <literallayout class="monospaced">
55178 deny  message = 599 1.2.3 Host not welcome
55179       hosts = 192.168.34.0/24
55180 </literallayout>
55181 <para>
55182 The first digit of the supplied response code must be the same as would be sent
55183 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
55184 access, but for the predata ACL, note that the default success code is 354, not
55185 2<emphasis>xx</emphasis>.
55186 </para>
55187 <para>
55188 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
55189 the message modifier cannot override the 221 response code.
55190 </para>
55191 <para>
55192 The text in a <option>message</option> modifier is literal; any quotes are taken as
55193 literals, but because the string is expanded, backslash escapes are processed
55194 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
55195 response.
55196 </para>
55197 <para>
55198 <indexterm role="variable">
55199 <primary><varname>$acl_verify_message</varname></primary>
55200 </indexterm>
55201 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
55202 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
55203 </para>
55204 <para>
55205 If <option>message</option> is used on a statement that verifies an address, the message
55206 specified overrides any message that is generated by the verification process.
55207 However, the original message is available in the variable
55208 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
55209 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
55210 routers to be passed back as part of the SMTP response, you should either not
55211 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
55212 </para>
55213 <para>
55214 For compatibility with previous releases of Exim, a <option>message</option> modifier that
55215 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
55216 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
55217 all the conditions are true, wherever it appears in an ACL command, whereas
55218 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
55219 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
55220 effect.
55221 </para>
55222 </listitem></varlistentry>
55223 <varlistentry>
55224 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55225 <listitem>
55226 <para>
55227 This modifier specifies the use of a named queue for spool files
55228 for the message.
55229 It can only be used before the message is received (i.e. not in
55230 the DATA ACL).
55231 This could be used, for example, for known high-volume burst sources
55232 of traffic, or for quarantine of messages.
55233 Separate queue-runner processes will be needed for named queues.
55234 If the text after expansion is empty, the default queue is used.
55235 </para>
55236 </listitem></varlistentry>
55237 <varlistentry>
55238 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55239 <listitem>
55240 <para>
55241 This modifier specifies one or more header names in a colon-separated list
55242  that are to be removed from an incoming message, assuming, of course, that
55243 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
55244 </para>
55245 </listitem></varlistentry>
55246 <varlistentry>
55247 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
55248 <listitem>
55249 <para>
55250 <indexterm role="concept">
55251 <primary><option>set</option> ACL modifier</primary>
55252 </indexterm>
55253 This modifier puts a value into one of the ACL variables (see section
55254 <xref linkend="SECTaclvariables"/>).
55255 </para>
55256 </listitem></varlistentry>
55257 <varlistentry>
55258 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
55259 <listitem>
55260 <para>
55261 This modifier sends a UDP packet, for purposes such as statistics
55262 collection or behaviour monitoring. The parameters are expanded, and
55263 the result of the expansion must be a colon-separated list consisting
55264 of a destination server, port number, and the packet contents. The
55265 server can be specified as a host name or IPv4 or IPv6 address. The
55266 separator can be changed with the usual angle bracket syntax. For
55267 example, you might want to collect information on which hosts connect
55268 when:
55269 </para>
55270 <literallayout class="monospaced">
55271 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
55272              $tod_zulu $sender_host_address
55273 </literallayout>
55274 </listitem></varlistentry>
55275 </variablelist>
55276 </section>
55277 <section id="SECTcontrols">
55278 <title>Use of the control modifier</title>
55279 <para>
55280 <indexterm role="concept">
55281 <primary><option>control</option> ACL modifier</primary>
55282 </indexterm>
55283 The <option>control</option> modifier supports the following settings:
55284 </para>
55285 <variablelist>
55286 <varlistentry>
55287 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
55288 <listitem>
55289 <para>
55290 This modifier allows a client host to use the SMTP AUTH command even when it
55291 has not been advertised in response to EHLO. Furthermore, because there are
55292 apparently some really broken clients that do this, Exim will accept AUTH after
55293 HELO (rather than EHLO) when this control is set. It should be used only if you
55294 really need it, and you should limit its use to those broken clients that do
55295 not work without it. For example:
55296 </para>
55297 <literallayout class="monospaced">
55298 warn hosts   = 192.168.34.25
55299      control = allow_auth_unadvertised
55300 </literallayout>
55301 <para>
55302 Normally, when an Exim server receives an AUTH command, it checks the name of
55303 the authentication mechanism that is given in the command to ensure that it
55304 matches an advertised mechanism. When this control is set, the check that a
55305 mechanism has been advertised is bypassed. Any configured mechanism can be used
55306 by the client. This control is permitted only in the connection and HELO ACLs.
55307 </para>
55308 </listitem></varlistentry>
55309 <varlistentry>
55310 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
55311 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
55312 <listitem>
55313 <para>
55314 <indexterm role="concept">
55315 <primary>access control lists (ACLs)</primary>
55316 <secondary>case of local part in</secondary>
55317 </indexterm>
55318 <indexterm role="concept">
55319 <primary>case of local parts</primary>
55320 </indexterm>
55321 <indexterm role="variable">
55322 <primary><varname>$local_part</varname></primary>
55323 </indexterm>
55324 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
55325 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
55326 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
55327 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
55328 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
55329 is encountered.
55330 </para>
55331 <para>
55332 These controls affect only the current recipient. Moreover, they apply only to
55333 local part handling that takes place directly in the ACL (for example, as a key
55334 in lookups). If a test to verify the recipient is obeyed, the case-related
55335 handling of the local part during the verification is controlled by the router
55336 configuration (see the <option>caseful_local_part</option> generic router option).
55337 </para>
55338 <para>
55339 This facility could be used, for example, to add a spam score to local parts
55340 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
55341 spam score:
55342 </para>
55343 <literallayout class="monospaced">
55344 warn  control = caseful_local_part
55345       set acl_m4 = ${eval:\
55346                      $acl_m4 + \
55347                      ${if match{$local_part}{[A-Z]}{1}{0}}\
55348                     }
55349       control = caselower_local_part
55350 </literallayout>
55351 <para>
55352 Notice that we put back the lower cased version afterwards, assuming that
55353 is what is wanted for subsequent tests.
55354 </para>
55355 </listitem></varlistentry>
55356 <varlistentry>
55357 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55358 <listitem>
55359 <para>
55360 <indexterm role="concept">
55361 <primary>access control lists (ACLs)</primary>
55362 <secondary>cutthrough routing</secondary>
55363 </indexterm>
55364 <indexterm role="concept">
55365 <primary>cutthrough</primary>
55366 <secondary>requesting</secondary>
55367 </indexterm>
55368 This option requests delivery be attempted while the item is being received.
55369 </para>
55370 <para>
55371 The option is usable in the RCPT ACL.
55372 If enabled for a message received via smtp and routed to an smtp transport,
55373 and only one transport, interface, destination host and port combination
55374 is used for all recipients of the message,
55375 then the delivery connection is made while the receiving connection is open
55376 and data is copied from one to the other.
55377 </para>
55378 <para>
55379 An attempt to set this option for any recipient but the first
55380 for a mail will be quietly ignored.
55381 If a recipient-verify callout
55382 (with use_sender)
55383 connection is subsequently
55384 requested in the same ACL it is held open and used for
55385 any subsequent recipients and the data,
55386 otherwise one is made after the initial RCPT ACL completes.
55387 </para>
55388 <para>
55389 Note that routers are used in verify mode,
55390 and cannot depend on content of received headers.
55391 Note also that headers cannot be
55392 modified by any of the post-data ACLs (DATA, MIME and DKIM).
55393 Headers may be modified by routers (subject to the above) and transports.
55394 </para>
55395 <para>
55396 All the usual ACLs are called; if one results in the message being
55397 rejected, all effort spent in delivery (including the costs on
55398 the ultimate destination) will be wasted.
55399 Note that in the case of data-time ACLs this includes the entire
55400 message body.
55401 </para>
55402 <para>
55403 Cutthrough delivery is not supported via transport-filters or when DKIM signing
55404 of outgoing messages is done, because it sends data to the ultimate destination
55405 before the entire message has been received from the source.
55406 It is not supported for messages received with the SMTP PRDR
55407 </para>
55408 <para revisionflag="changed">
55409 or CHUNKING
55410 </para>
55411 <para>
55412 options in use.
55413 </para>
55414 <para>
55415 Should the ultimate destination system positively accept or reject the mail,
55416 a corresponding indication is given to the source system and nothing is queued.
55417 If the item is successfully delivered in cutthrough mode
55418 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
55419 before the acceptance "&lt;=" line.
55420 </para>
55421 <para>
55422 If there is a temporary error the item is queued for later delivery in the
55423 usual fashion.
55424 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
55425 to the control; the default value is <quote>spool</quote> and the alternate value
55426 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
55427 and does not queue the message.
55428 Note that this is independent of any recipient verify conditions in the ACL.
55429 </para>
55430 <para>
55431 Delivery in this mode avoids the generation of a bounce mail to a
55432 (possibly faked)
55433 sender when the destination system is doing content-scan based rejection.
55434 </para>
55435 </listitem></varlistentry>
55436 <varlistentry>
55437 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55438 <listitem>
55439 <para>
55440 <indexterm role="concept">
55441 <primary>access control lists (ACLs)</primary>
55442 <secondary>enabling debug logging</secondary>
55443 </indexterm>
55444 <indexterm role="concept">
55445 <primary>debugging</primary>
55446 <secondary>enabling from an ACL</secondary>
55447 </indexterm>
55448 This control turns on debug logging, almost as though Exim had been invoked
55449 with <literal>-d</literal>, with the output going to a new logfile, by default called
55450 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
55451 may access any variables already defined.  The logging may be adjusted with
55452 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
55453 option.
55454 Logging may be stopped, and the file removed, with the <emphasis>kill</emphasis> option.
55455 Some examples (which depend on variables that don&#x2019;t exist in all
55456 contexts):
55457 </para>
55458 <literallayout class="monospaced">
55459       control = debug
55460       control = debug/tag=.$sender_host_address
55461       control = debug/opts=+expand+acl
55462       control = debug/tag=.$message_exim_id/opts=+expand
55463       control = debug/kill
55464 </literallayout>
55465 </listitem></varlistentry>
55466 <varlistentry>
55467 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
55468 <listitem>
55469 <para>
55470 <indexterm role="concept">
55471 <primary>disable DKIM verify</primary>
55472 </indexterm>
55473 <indexterm role="concept">
55474 <primary>DKIM</primary>
55475 <secondary>disable verify</secondary>
55476 </indexterm>
55477 This control turns off DKIM verification processing entirely.  For details on
55478 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
55479 </para>
55480 </listitem></varlistentry>
55481 <varlistentry>
55482 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
55483 <listitem>
55484 <para>
55485 <indexterm role="concept">
55486 <primary>access control lists (ACLs)</primary>
55487 <secondary>setting DSCP value</secondary>
55488 </indexterm>
55489 <indexterm role="concept">
55490 <primary>DSCP</primary>
55491 <secondary>inbound</secondary>
55492 </indexterm>
55493 This option causes the DSCP value associated with the socket for the inbound
55494 connection to be adjusted to a given value, given as one of a number of fixed
55495 strings or to numeric value.
55496 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
55497 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
55498 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
55499 </para>
55500 <para>
55501 The outbound packets from Exim will be marked with this value in the header
55502 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
55503 that these values will have any effect, not be stripped by networking
55504 equipment, or do much of anything without cooperation with your Network
55505 Engineer and those of all network operators between the source and destination.
55506 </para>
55507 </listitem></varlistentry>
55508 <varlistentry>
55509 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
55510 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
55511 <listitem>
55512 <para>
55513 <indexterm role="concept">
55514 <primary>SMTP</primary>
55515 <secondary>synchronization checking</secondary>
55516 </indexterm>
55517 <indexterm role="concept">
55518 <primary>synchronization checking in SMTP</primary>
55519 </indexterm>
55520 These controls make it possible to be selective about when SMTP synchronization
55521 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
55522 state of the switch (it is true by default). See the description of this option
55523 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
55524 </para>
55525 <para>
55526 The effect of these two controls lasts for the remainder of the SMTP
55527 connection. They can appear in any ACL except the one for the non-SMTP
55528 messages. The most straightforward place to put them is in the ACL defined by
55529 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
55530 before the first synchronization check. The expected use is to turn off the
55531 synchronization checks for badly-behaved hosts that you nevertheless need to
55532 work with.
55533 </para>
55534 </listitem></varlistentry>
55535 <varlistentry>
55536 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55537 <listitem>
55538 <para>
55539 <indexterm role="concept">
55540 <primary>fake defer</primary>
55541 </indexterm>
55542 <indexterm role="concept">
55543 <primary>defer, fake</primary>
55544 </indexterm>
55545 This control works in exactly the same way as <option>fakereject</option> (described below)
55546 except that it causes an SMTP 450 response after the message data instead of a
55547 550 response. You must take care when using <option>fakedefer</option> because it causes the
55548 messages to be duplicated when the sender retries. Therefore, you should not
55549 use <option>fakedefer</option> if the message is to be delivered normally.
55550 </para>
55551 </listitem></varlistentry>
55552 <varlistentry>
55553 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55554 <listitem>
55555 <para>
55556 <indexterm role="concept">
55557 <primary>fake rejection</primary>
55558 </indexterm>
55559 <indexterm role="concept">
55560 <primary>rejection, fake</primary>
55561 </indexterm>
55562 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
55563 words, only when an SMTP message is being received. If Exim accepts the
55564 message, instead the final 250 response, a 550 rejection message is sent.
55565 However, Exim proceeds to deliver the message as normal. The control applies
55566 only to the current message, not to any subsequent ones that may be received in
55567 the same SMTP connection.
55568 </para>
55569 <para>
55570 The text for the 550 response is taken from the <option>control</option> modifier. If no
55571 message is supplied, the following is used:
55572 </para>
55573 <literallayout class="monospaced">
55574 550-Your message has been rejected but is being
55575 550-kept for evaluation.
55576 550-If it was a legitimate message, it may still be
55577 550 delivered to the target recipient(s).
55578 </literallayout>
55579 <para>
55580 This facility should be used with extreme caution.
55581 </para>
55582 </listitem></varlistentry>
55583 <varlistentry>
55584 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
55585 <listitem>
55586 <para>
55587 <indexterm role="concept">
55588 <primary>frozen messages</primary>
55589 <secondary>forcing in ACL</secondary>
55590 </indexterm>
55591 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55592 other words, only when a message is being received. If the message is accepted,
55593 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
55594 current message, not to any subsequent ones that may be received in the same
55595 SMTP connection.
55596 </para>
55597 <para>
55598 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
55599 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
55600 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
55601 are obeyed for the current message have the <literal>/no_tell</literal> option.
55602 </para>
55603 </listitem></varlistentry>
55604 <varlistentry>
55605 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
55606 <listitem>
55607 <para>
55608 <indexterm role="concept">
55609 <primary>SMTP</primary>
55610 <secondary>output flushing, disabling for delay</secondary>
55611 </indexterm>
55612 Exim normally flushes SMTP output before implementing a delay in an ACL, to
55613 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55614 use. This control, as long as it is encountered before the <option>delay</option> modifier,
55615 disables such output flushing.
55616 </para>
55617 </listitem></varlistentry>
55618 <varlistentry>
55619 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
55620 <listitem>
55621 <para>
55622 <indexterm role="concept">
55623 <primary>SMTP</primary>
55624 <secondary>output flushing, disabling for callout</secondary>
55625 </indexterm>
55626 Exim normally flushes SMTP output before performing a callout in an ACL, to
55627 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55628 use. This control, as long as it is encountered before the <option>verify</option> condition
55629 that causes the callout, disables such output flushing.
55630 </para>
55631 </listitem></varlistentry>
55632 <varlistentry>
55633 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
55634 <listitem>
55635 <para>
55636 This control is available when Exim is compiled with the content scanning
55637 extension. Content scanning may require a copy of the current message, or parts
55638 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
55639 or spam scanner. Normally, such copies are deleted when they are no longer
55640 needed. If this control is set, the copies are not deleted. The control applies
55641 only to the current message, not to any subsequent ones that may be received in
55642 the same SMTP connection. It is provided for debugging purposes and is unlikely
55643 to be useful in production.
55644 </para>
55645 </listitem></varlistentry>
55646 <varlistentry>
55647 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
55648 <listitem>
55649 <para>
55650 <indexterm role="concept">
55651 <primary>multiline responses, suppressing</primary>
55652 </indexterm>
55653 This control is permitted for any ACL except the one for non-SMTP messages.
55654 It seems that there are broken clients in use that cannot handle multiline
55655 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
55656 </para>
55657 <para>
55658 If this control is set, multiline SMTP responses from ACL rejections are
55659 suppressed. One way of doing this would have been to put out these responses as
55660 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
55661 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
55662 responses might get close to that. So this facility, which is after all only a
55663 sop to broken clients, is implemented by doing two very easy things:
55664 </para>
55665 <itemizedlist>
55666 <listitem>
55667 <para>
55668 Extra information that is normally output as part of a rejection caused by
55669 sender verification failure is omitted. Only the final line (typically <quote>sender
55670 verification failed</quote>) is sent.
55671 </para>
55672 </listitem>
55673 <listitem>
55674 <para>
55675 If a <option>message</option> modifier supplies a multiline response, only the first
55676 line is output.
55677 </para>
55678 </listitem>
55679 </itemizedlist>
55680 <para>
55681 The setting of the switch can, of course, be made conditional on the
55682 calling host. Its effect lasts until the end of the SMTP connection.
55683 </para>
55684 </listitem></varlistentry>
55685 <varlistentry>
55686 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
55687 <listitem>
55688 <para>
55689 <indexterm role="concept">
55690 <primary>PIPELINING</primary>
55691 <secondary>suppressing advertising</secondary>
55692 </indexterm>
55693 This control turns off the advertising of the PIPELINING extension to SMTP in
55694 the current session. To be useful, it must be obeyed before Exim sends its
55695 response to an EHLO command. Therefore, it should normally appear in an ACL
55696 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
55697 <option>pipelining_advertise_hosts</option>.
55698 </para>
55699 </listitem></varlistentry>
55700 <varlistentry>
55701 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
55702 <listitem>
55703 <para>
55704 <indexterm role="option">
55705 <primary><option>queue_only</option></primary>
55706 </indexterm>
55707 <indexterm role="concept">
55708 <primary>queueing incoming messages</primary>
55709 </indexterm>
55710 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55711 other words, only when a message is being received. If the message is accepted,
55712 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
55713 runner. No immediate delivery process is started. In other words, it has the
55714 effect as the <option>queue_only</option> global option. However, the control applies only
55715 to the current message, not to any subsequent ones that may be received in the
55716 same SMTP connection.
55717 </para>
55718 </listitem></varlistentry>
55719 <varlistentry>
55720 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55721 <listitem>
55722 <para>
55723 <indexterm role="concept">
55724 <primary>message</primary>
55725 <secondary>submission</secondary>
55726 </indexterm>
55727 <indexterm role="concept">
55728 <primary>submission mode</primary>
55729 </indexterm>
55730 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
55731 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
55732 the current message is a submission from a local MUA. In this case, Exim
55733 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
55734 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
55735 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
55736 late (the message has already been created).
55737 </para>
55738 <para>
55739 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
55740 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
55741 submission mode; the available options for this control are described there.
55742 The control applies only to the current message, not to any subsequent ones
55743 that may be received in the same SMTP connection.
55744 </para>
55745 </listitem></varlistentry>
55746 <varlistentry>
55747 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
55748 <listitem>
55749 <para>
55750 <indexterm role="concept">
55751 <primary>submission fixups, suppressing</primary>
55752 </indexterm>
55753 This control applies to locally submitted (non TCP/IP) messages, and is the
55754 complement of <literal>control = submission</literal>. It disables the fixups that are
55755 normally applied to locally-submitted messages. Specifically:
55756 </para>
55757 <itemizedlist>
55758 <listitem>
55759 <para>
55760 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
55761 dynamic version of <option>local_sender_retain</option>).
55762 </para>
55763 </listitem>
55764 <listitem>
55765 <para>
55766 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
55767 </para>
55768 </listitem>
55769 <listitem>
55770 <para>
55771 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
55772 </para>
55773 </listitem>
55774 </itemizedlist>
55775 <para>
55776 This control may be useful when a remotely-originated message is accepted,
55777 passed to some scanning program, and then re-submitted for delivery. It can be
55778 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55779 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
55780 data is read.
55781 </para>
55782 <para>
55783 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
55784 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
55785 </para>
55786 </listitem></varlistentry>
55787 <varlistentry>
55788 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
55789 <listitem>
55790 <para>
55791 This control enables conversion of UTF-8 in message addresses
55792 to a-label form.
55793 For details see section <xref linkend="SECTi18nMTA"/>.
55794 </para>
55795 </listitem></varlistentry>
55796 </variablelist>
55797 </section>
55798 <section id="SECTsummesfix">
55799 <title>Summary of message fixup control</title>
55800 <para>
55801 All four possibilities for message fixups can be specified:
55802 </para>
55803 <itemizedlist>
55804 <listitem>
55805 <para>
55806 Locally submitted, fixups applied: the default.
55807 </para>
55808 </listitem>
55809 <listitem>
55810 <para>
55811 Locally submitted, no fixups applied: use
55812 <literal>control = suppress_local_fixups</literal>.
55813 </para>
55814 </listitem>
55815 <listitem>
55816 <para>
55817 Remotely submitted, no fixups applied: the default.
55818 </para>
55819 </listitem>
55820 <listitem>
55821 <para>
55822 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
55823 </para>
55824 </listitem>
55825 </itemizedlist>
55826 </section>
55827 <section id="SECTaddheadacl">
55828 <title>Adding header lines in ACLs</title>
55829 <para>
55830 <indexterm role="concept">
55831 <primary>header lines</primary>
55832 <secondary>adding in an ACL</secondary>
55833 </indexterm>
55834 <indexterm role="concept">
55835 <primary>header lines</primary>
55836 <secondary>position of added lines</secondary>
55837 </indexterm>
55838 <indexterm role="concept">
55839 <primary><option>add_header</option> ACL modifier</primary>
55840 </indexterm>
55841 The <option>add_header</option> modifier can be used to add one or more extra header lines
55842 to an incoming message, as in this example:
55843 </para>
55844 <literallayout class="monospaced">
55845 warn dnslists = sbl.spamhaus.org : \
55846                 dialup.mail-abuse.org
55847      add_header = X-blacklisted-at: $dnslist_domain
55848 </literallayout>
55849 <para>
55850 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55851 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55852 receiving a message). The message must ultimately be accepted for
55853 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
55854 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
55855 RCPT ACL).
55856 </para>
55857 <para>
55858 Headers will not be added to the message if the modifier is used in
55859 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
55860 </para>
55861 <para>
55862 Leading and trailing newlines are removed from
55863 the data for the <option>add_header</option> modifier; if it then
55864 contains one or more newlines that
55865 are not followed by a space or a tab, it is assumed to contain multiple header
55866 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
55867 front of any line that is not a valid header line.
55868 </para>
55869 <para>
55870 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
55871 They are added to the message before processing the DATA and MIME ACLs.
55872 However, if an identical header line is requested more than once, only one copy
55873 is actually added to the message. Further header lines may be accumulated
55874 during the DATA and MIME ACLs, after which they are added to the message, again
55875 with duplicates suppressed. Thus, it is possible to add two identical header
55876 lines to an SMTP message, but only if one is added before DATA and one after.
55877 In the case of non-SMTP messages, new headers are accumulated during the
55878 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
55879 message is rejected after DATA or by the non-SMTP ACL, all added header lines
55880 are included in the entry that is written to the reject log.
55881 </para>
55882 <para>
55883 <indexterm role="concept">
55884 <primary>header lines</primary>
55885 <secondary>added; visibility of</secondary>
55886 </indexterm>
55887 Header lines are not visible in string expansions
55888 of message headers
55889 until they are added to the
55890 message. It follows that header lines defined in the MAIL, RCPT, and predata
55891 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
55892 header lines that are added by the DATA or MIME ACLs are not visible in those
55893 ACLs. Because of this restriction, you cannot use header lines as a way of
55894 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
55895 this, you can use ACL variables, as described in section
55896 <xref linkend="SECTaclvariables"/>.
55897 </para>
55898 <para>
55899 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
55900 </para>
55901 <para>
55902 The <option>add_header</option> modifier acts immediately as it is encountered during the
55903 processing of an ACL. Notice the difference between these two cases:
55904 </para>
55905 <literallayout>
55906 <literal>accept add_header = ADDED: some text</literal>
55907 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
55908
55909 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
55910 <literal>       add_header = ADDED: some text</literal>
55911 </literallayout>
55912 <para>
55913 In the first case, the header line is always added, whether or not the
55914 condition is true. In the second case, the header line is added only if the
55915 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
55916 ACL statement. All those that are encountered before a condition fails are
55917 honoured.
55918 </para>
55919 <para>
55920 <indexterm role="concept">
55921 <primary><option>warn</option> ACL verb</primary>
55922 </indexterm>
55923 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
55924 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
55925 effect only if all the conditions are true, even if it appears before some of
55926 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
55927 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
55928 are present on a <option>warn</option> verb, both are processed according to their
55929 specifications.
55930 </para>
55931 <para>
55932 By default, new header lines are added to a message at the end of the existing
55933 header lines. However, you can specify that any particular header line should
55934 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
55935 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
55936 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
55937 </para>
55938 <para>
55939 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
55940 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
55941 header line, respectively. (Header text cannot start with a colon, as there has
55942 to be a header name first.) For example:
55943 </para>
55944 <literallayout class="monospaced">
55945 warn add_header = \
55946        :after_received:X-My-Header: something or other...
55947 </literallayout>
55948 <para>
55949 If more than one header line is supplied in a single <option>add_header</option> modifier,
55950 each one is treated independently and can therefore be placed differently. If
55951 you add more than one line at the start, or after the Received: block, they end
55952 up in reverse order.
55953 </para>
55954 <para>
55955 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
55956 added in an ACL. It does NOT work for header lines that are added in a
55957 system filter or in a router or transport.
55958 </para>
55959 </section>
55960 <section id="SECTremoveheadacl">
55961 <title>Removing header lines in ACLs</title>
55962 <para>
55963 <indexterm role="concept">
55964 <primary>header lines</primary>
55965 <secondary>removing in an ACL</secondary>
55966 </indexterm>
55967 <indexterm role="concept">
55968 <primary>header lines</primary>
55969 <secondary>position of removed lines</secondary>
55970 </indexterm>
55971 <indexterm role="concept">
55972 <primary><option>remove_header</option> ACL modifier</primary>
55973 </indexterm>
55974 The <option>remove_header</option> modifier can be used to remove one or more header lines
55975 from an incoming message, as in this example:
55976 </para>
55977 <literallayout class="monospaced">
55978 warn   message        = Remove internal headers
55979        remove_header  = x-route-mail1 : x-route-mail2
55980 </literallayout>
55981 <para>
55982 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55983 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55984 receiving a message). The message must ultimately be accepted for
55985 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
55986 with any ACL verb, including <option>deny</option>, though this is really not useful for
55987 any verb that doesn&#x2019;t result in a delivered message.
55988 </para>
55989 <para>
55990 Headers will not be removed from the message if the modifier is used in
55991 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
55992 </para>
55993 <para>
55994 More than one header can be removed at the same time by using a colon separated
55995 list of header names. The header matching is case insensitive. Wildcards are
55996 not permitted, nor is list expansion performed, so you cannot use hostlists to
55997 create a list of headers, however both connection and message variable expansion
55998 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
55999 </para>
56000 <literallayout class="monospaced">
56001 warn   hosts           = +internal_hosts
56002        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
56003 warn   message         = Remove internal headers
56004        remove_header   = $acl_c_ihdrs
56005 </literallayout>
56006 <para>
56007 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
56008 They are removed from the message before processing the DATA and MIME ACLs.
56009 There is no harm in attempting to remove the same header twice nor is removing
56010 a non-existent header. Further header lines to be removed may be accumulated
56011 during the DATA and MIME ACLs, after which they are removed from the message,
56012 if present. In the case of non-SMTP messages, headers to be removed are
56013 accumulated during the non-SMTP ACLs, and are removed from the message after
56014 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
56015 ACL, there really is no effect because there is no logging of what headers
56016 would have been removed.
56017 </para>
56018 <para>
56019 <indexterm role="concept">
56020 <primary>header lines</primary>
56021 <secondary>removed; visibility of</secondary>
56022 </indexterm>
56023 Header lines are not visible in string expansions until the DATA phase when it
56024 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
56025 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
56026 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
56027 this restriction, you cannot use header lines as a way of controlling data
56028 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
56029 you should instead use ACL variables, as described in section
56030 <xref linkend="SECTaclvariables"/>.
56031 </para>
56032 <para>
56033 The <option>remove_header</option> modifier acts immediately as it is encountered during the
56034 processing of an ACL. Notice the difference between these two cases:
56035 </para>
56036 <literallayout>
56037 <literal>accept remove_header = X-Internal</literal>
56038 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
56039
56040 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
56041 <literal>       remove_header = X-Internal</literal>
56042 </literallayout>
56043 <para>
56044 In the first case, the header line is always removed, whether or not the
56045 condition is true. In the second case, the header line is removed only if the
56046 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
56047 same ACL statement. All those that are encountered before a condition fails
56048 are honoured.
56049 </para>
56050 <para>
56051 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
56052 present during ACL processing. It does NOT remove header lines that are added
56053 in a system filter or in a router or transport.
56054 </para>
56055 </section>
56056 <section id="SECTaclconditions">
56057 <title>ACL conditions</title>
56058 <para>
56059 <indexterm role="concept">
56060 <primary>access control lists (ACLs)</primary>
56061 <secondary>conditions; list of</secondary>
56062 </indexterm>
56063 Some of the conditions listed in this section are available only when Exim is
56064 compiled with the content-scanning extension. They are included here briefly
56065 for completeness. More detailed descriptions can be found in the discussion on
56066 content scanning in chapter <xref linkend="CHAPexiscan"/>.
56067 </para>
56068 <para>
56069 Not all conditions are relevant in all circumstances. For example, testing
56070 senders and recipients does not make sense in an ACL that is being run as the
56071 result of the arrival of an ETRN command, and checks on message headers can be
56072 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
56073 can use the same condition (with different parameters) more than once in the
56074 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
56075 The conditions are as follows:
56076 </para>
56077 <variablelist>
56078 <varlistentry>
56079 <term><emphasis role="bold">acl&nbsp;=&nbsp;</emphasis>&lt;<emphasis>name&nbsp;of&nbsp;acl&nbsp;or&nbsp;ACL&nbsp;string&nbsp;or&nbsp;file&nbsp;name&nbsp;</emphasis>&gt;</term>
56080 <listitem>
56081 <para>
56082 <indexterm role="concept">
56083 <primary>access control lists (ACLs)</primary>
56084 <secondary>nested</secondary>
56085 </indexterm>
56086 <indexterm role="concept">
56087 <primary>access control lists (ACLs)</primary>
56088 <secondary>indirect</secondary>
56089 </indexterm>
56090 <indexterm role="concept">
56091 <primary>access control lists (ACLs)</primary>
56092 <secondary>arguments</secondary>
56093 </indexterm>
56094 <indexterm role="concept">
56095 <primary><option>acl</option> ACL condition</primary>
56096 </indexterm>
56097 The possible values of the argument are the same as for the
56098 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
56099 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
56100 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
56101 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
56102 condition false. This means that further processing of the <option>warn</option> verb
56103 ceases, but processing of the ACL continues.
56104 </para>
56105 <para>
56106 If the argument is a named ACL, up to nine space-separated optional values
56107 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
56108 and $acl_narg is set to the count of values.
56109 Previous values of these variables are restored after the call returns.
56110 The name and values are expanded separately.
56111 Note that spaces in complex expansions which are used as arguments
56112 will act as argument separators.
56113 </para>
56114 <para>
56115 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
56116 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
56117 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
56118 conditions are tested.
56119 </para>
56120 <para>
56121 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
56122 loops. This condition allows you to use different ACLs in different
56123 circumstances. For example, different ACLs can be used to handle RCPT commands
56124 for different local users or different local domains.
56125 </para>
56126 </listitem></varlistentry>
56127 <varlistentry>
56128 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56129 <listitem>
56130 <para>
56131 <indexterm role="concept">
56132 <primary><option>authenticated</option> ACL condition</primary>
56133 </indexterm>
56134 <indexterm role="concept">
56135 <primary>authentication</primary>
56136 <secondary>ACL checking</secondary>
56137 </indexterm>
56138 <indexterm role="concept">
56139 <primary>access control lists (ACLs)</primary>
56140 <secondary>testing for authentication</secondary>
56141 </indexterm>
56142 If the SMTP connection is not authenticated, the condition is false. Otherwise,
56143 the name of the authenticator is tested against the list. To test for
56144 authentication by any authenticator, you can set
56145 </para>
56146 <literallayout class="monospaced">
56147 authenticated = *
56148 </literallayout>
56149 </listitem></varlistentry>
56150 <varlistentry>
56151 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
56152 <listitem>
56153 <para>
56154 <indexterm role="concept">
56155 <primary><option>condition</option> ACL condition</primary>
56156 </indexterm>
56157 <indexterm role="concept">
56158 <primary>customizing</primary>
56159 <secondary>ACL condition</secondary>
56160 </indexterm>
56161 <indexterm role="concept">
56162 <primary>access control lists (ACLs)</primary>
56163 <secondary>customized test</secondary>
56164 </indexterm>
56165 <indexterm role="concept">
56166 <primary>access control lists (ACLs)</primary>
56167 <secondary>testing, customized</secondary>
56168 </indexterm>
56169 This feature allows you to make up custom conditions. If the result of
56170 expanding the string is an empty string, the number zero, or one of the strings
56171 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
56172 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
56173 any other value, some error is assumed to have occurred, and the ACL returns
56174 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
56175 ignored. The effect is to treat it as true, whether it is positive or
56176 negative.
56177 </para>
56178 </listitem></varlistentry>
56179 <varlistentry>
56180 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
56181 <listitem>
56182 <para>
56183 <indexterm role="concept">
56184 <primary><option>decode</option> ACL condition</primary>
56185 </indexterm>
56186 This condition is available only when Exim is compiled with the
56187 content-scanning extension, and it is allowed only in the ACL defined by
56188 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
56189 If all goes well, the condition is true. It is false only if there are
56190 problems such as a syntax error or a memory shortage. For more details, see
56191 chapter <xref linkend="CHAPexiscan"/>.
56192 </para>
56193 </listitem></varlistentry>
56194 <varlistentry>
56195 <term><emphasis role="bold">dnslists&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;domain&nbsp;names&nbsp;and&nbsp;other&nbsp;data</emphasis>&gt;</term>
56196 <listitem>
56197 <para>
56198 <indexterm role="concept">
56199 <primary><option>dnslists</option> ACL condition</primary>
56200 </indexterm>
56201 <indexterm role="concept">
56202 <primary>DNS list</primary>
56203 <secondary>in ACL</secondary>
56204 </indexterm>
56205 <indexterm role="concept">
56206 <primary>black list (DNS)</primary>
56207 </indexterm>
56208 <indexterm role="concept">
56209 <primary>access control lists (ACLs)</primary>
56210 <secondary>testing a DNS list</secondary>
56211 </indexterm>
56212 This condition checks for entries in DNS black lists. These are also known as
56213 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
56214 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
56215 different variants of this condition to describe briefly here. See sections
56216 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
56217 </para>
56218 </listitem></varlistentry>
56219 <varlistentry>
56220 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56221 <listitem>
56222 <para>
56223 <indexterm role="concept">
56224 <primary><option>domains</option> ACL condition</primary>
56225 </indexterm>
56226 <indexterm role="concept">
56227 <primary>domain</primary>
56228 <secondary>ACL checking</secondary>
56229 </indexterm>
56230 <indexterm role="concept">
56231 <primary>access control lists (ACLs)</primary>
56232 <secondary>testing a recipient domain</secondary>
56233 </indexterm>
56234 <indexterm role="variable">
56235 <primary><varname>$domain_data</varname></primary>
56236 </indexterm>
56237 This condition is relevant only after a RCPT command. It checks that the domain
56238 of the recipient address is in the domain list. If percent-hack processing is
56239 enabled, it is done before this test is done. If the check succeeds with a
56240 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
56241 <option>domains</option> test.
56242 </para>
56243 <para>
56244 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
56245 use <option>domains</option> in a DATA ACL.
56246 </para>
56247 </listitem></varlistentry>
56248 <varlistentry>
56249 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56250 <listitem>
56251 <para>
56252 <indexterm role="concept">
56253 <primary><option>encrypted</option> ACL condition</primary>
56254 </indexterm>
56255 <indexterm role="concept">
56256 <primary>encryption</primary>
56257 <secondary>checking in an ACL</secondary>
56258 </indexterm>
56259 <indexterm role="concept">
56260 <primary>access control lists (ACLs)</primary>
56261 <secondary>testing for encryption</secondary>
56262 </indexterm>
56263 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
56264 name of the cipher suite in use is tested against the list. To test for
56265 encryption without testing for any specific cipher suite(s), set
56266 </para>
56267 <literallayout class="monospaced">
56268 encrypted = *
56269 </literallayout>
56270 </listitem></varlistentry>
56271 <varlistentry>
56272 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
56273 <listitem>
56274 <para>
56275 <indexterm role="concept">
56276 <primary><option>hosts</option> ACL condition</primary>
56277 </indexterm>
56278 <indexterm role="concept">
56279 <primary>host</primary>
56280 <secondary>ACL checking</secondary>
56281 </indexterm>
56282 <indexterm role="concept">
56283 <primary>access control lists (ACLs)</primary>
56284 <secondary>testing the client host</secondary>
56285 </indexterm>
56286 This condition tests that the calling host matches the host list. If you have
56287 name lookups or wildcarded host names and IP addresses in the same host list,
56288 you should normally put the IP addresses first. For example, you could have:
56289 </para>
56290 <literallayout class="monospaced">
56291 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
56292 </literallayout>
56293 <para>
56294 The lookup in this example uses the host name for its key. This is implied by
56295 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
56296 and it wouldn&#x2019;t matter which way round you had these two items.)
56297 </para>
56298 <para>
56299 The reason for the problem with host names lies in the left-to-right way that
56300 Exim processes lists. It can test IP addresses without doing any DNS lookups,
56301 but when it reaches an item that requires a host name, it fails if it cannot
56302 find a host name to compare with the pattern. If the above list is given in the
56303 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
56304 found, even if its IP address is 10.9.8.7.
56305 </para>
56306 <para>
56307 If you really do want to do the name check first, and still recognize the IP
56308 address even if the name lookup fails, you can rewrite the ACL like this:
56309 </para>
56310 <literallayout class="monospaced">
56311 accept hosts = dbm;/etc/friendly/hosts
56312 accept hosts = 10.9.8.7
56313 </literallayout>
56314 <para>
56315 The default action on failing to find the host name is to assume that the host
56316 is not in the list, so the first <option>accept</option> statement fails. The second
56317 statement can then check the IP address.
56318 </para>
56319 <para>
56320 <indexterm role="variable">
56321 <primary><varname>$host_data</varname></primary>
56322 </indexterm>
56323 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
56324 of the lookup is made available in the <varname>$host_data</varname> variable. This
56325 allows you, for example, to set up a statement like this:
56326 </para>
56327 <literallayout class="monospaced">
56328 deny  hosts = net-lsearch;/some/file
56329 message = $host_data
56330 </literallayout>
56331 <para>
56332 which gives a custom error message for each denied host.
56333 </para>
56334 </listitem></varlistentry>
56335 <varlistentry>
56336 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
56337 <listitem>
56338 <para>
56339 <indexterm role="concept">
56340 <primary><option>local_parts</option> ACL condition</primary>
56341 </indexterm>
56342 <indexterm role="concept">
56343 <primary>local part</primary>
56344 <secondary>ACL checking</secondary>
56345 </indexterm>
56346 <indexterm role="concept">
56347 <primary>access control lists (ACLs)</primary>
56348 <secondary>testing a local part</secondary>
56349 </indexterm>
56350 <indexterm role="variable">
56351 <primary><varname>$local_part_data</varname></primary>
56352 </indexterm>
56353 This condition is relevant only after a RCPT command. It checks that the local
56354 part of the recipient address is in the list. If percent-hack processing is
56355 enabled, it is done before this test. If the check succeeds with a lookup, the
56356 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
56357 the next <option>local_parts</option> test.
56358 </para>
56359 </listitem></varlistentry>
56360 <varlistentry>
56361 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
56362 <listitem>
56363 <para>
56364 <indexterm role="concept">
56365 <primary><option>malware</option> ACL condition</primary>
56366 </indexterm>
56367 <indexterm role="concept">
56368 <primary>access control lists (ACLs)</primary>
56369 <secondary>virus scanning</secondary>
56370 </indexterm>
56371 <indexterm role="concept">
56372 <primary>access control lists (ACLs)</primary>
56373 <secondary>scanning for viruses</secondary>
56374 </indexterm>
56375 This condition is available only when Exim is compiled with the
56376 content-scanning extension. It causes the incoming message to be scanned for
56377 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
56378 </para>
56379 </listitem></varlistentry>
56380 <varlistentry>
56381 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56382 <listitem>
56383 <para>
56384 <indexterm role="concept">
56385 <primary><option>mime_regex</option> ACL condition</primary>
56386 </indexterm>
56387 <indexterm role="concept">
56388 <primary>access control lists (ACLs)</primary>
56389 <secondary>testing by regex matching</secondary>
56390 </indexterm>
56391 This condition is available only when Exim is compiled with the
56392 content-scanning extension, and it is allowed only in the ACL defined by
56393 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
56394 with any of the regular expressions. For details, see chapter
56395 <xref linkend="CHAPexiscan"/>.
56396 </para>
56397 </listitem></varlistentry>
56398 <varlistentry>
56399 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
56400 <listitem>
56401 <para>
56402 <indexterm role="concept">
56403 <primary>rate limiting</primary>
56404 </indexterm>
56405 This condition can be used to limit the rate at which a user or host submits
56406 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
56407 </para>
56408 </listitem></varlistentry>
56409 <varlistentry>
56410 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56411 <listitem>
56412 <para>
56413 <indexterm role="concept">
56414 <primary><option>recipients</option> ACL condition</primary>
56415 </indexterm>
56416 <indexterm role="concept">
56417 <primary>recipient</primary>
56418 <secondary>ACL checking</secondary>
56419 </indexterm>
56420 <indexterm role="concept">
56421 <primary>access control lists (ACLs)</primary>
56422 <secondary>testing a recipient</secondary>
56423 </indexterm>
56424 This condition is relevant only after a RCPT command. It checks the entire
56425 recipient address against a list of recipients.
56426 </para>
56427 </listitem></varlistentry>
56428 <varlistentry>
56429 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56430 <listitem>
56431 <para>
56432 <indexterm role="concept">
56433 <primary><option>regex</option> ACL condition</primary>
56434 </indexterm>
56435 <indexterm role="concept">
56436 <primary>access control lists (ACLs)</primary>
56437 <secondary>testing by regex matching</secondary>
56438 </indexterm>
56439 This condition is available only when Exim is compiled with the
56440 content-scanning extension, and is available only in the DATA, MIME, and
56441 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
56442 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
56443 </para>
56444 </listitem></varlistentry>
56445 <varlistentry>
56446 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56447 <listitem>
56448 <para>
56449 <indexterm role="concept">
56450 <primary><option>sender_domains</option> ACL condition</primary>
56451 </indexterm>
56452 <indexterm role="concept">
56453 <primary>sender</primary>
56454 <secondary>ACL checking</secondary>
56455 </indexterm>
56456 <indexterm role="concept">
56457 <primary>access control lists (ACLs)</primary>
56458 <secondary>testing a sender domain</secondary>
56459 </indexterm>
56460 <indexterm role="variable">
56461 <primary><varname>$domain</varname></primary>
56462 </indexterm>
56463 <indexterm role="variable">
56464 <primary><varname>$sender_address_domain</varname></primary>
56465 </indexterm>
56466 This condition tests the domain of the sender of the message against the given
56467 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
56468 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
56469 of this condition. This is an exception to the general rule for testing domain
56470 lists. It is done this way so that, if this condition is used in an ACL for a
56471 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
56472 influence the sender checking.
56473 </para>
56474 <para>
56475 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56476 relaying, because sender addresses are easily, and commonly, forged.
56477 </para>
56478 </listitem></varlistentry>
56479 <varlistentry>
56480 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56481 <listitem>
56482 <para>
56483 <indexterm role="concept">
56484 <primary><option>senders</option> ACL condition</primary>
56485 </indexterm>
56486 <indexterm role="concept">
56487 <primary>sender</primary>
56488 <secondary>ACL checking</secondary>
56489 </indexterm>
56490 <indexterm role="concept">
56491 <primary>access control lists (ACLs)</primary>
56492 <secondary>testing a sender</secondary>
56493 </indexterm>
56494 This condition tests the sender of the message against the given list. To test
56495 for a bounce message, which has an empty sender, set
56496 </para>
56497 <literallayout class="monospaced">
56498 senders = :
56499 </literallayout>
56500 <para>
56501 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56502 relaying, because sender addresses are easily, and commonly, forged.
56503 </para>
56504 </listitem></varlistentry>
56505 <varlistentry>
56506 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
56507 <listitem>
56508 <para>
56509 <indexterm role="concept">
56510 <primary><option>spam</option> ACL condition</primary>
56511 </indexterm>
56512 <indexterm role="concept">
56513 <primary>access control lists (ACLs)</primary>
56514 <secondary>scanning for spam</secondary>
56515 </indexterm>
56516 This condition is available only when Exim is compiled with the
56517 content-scanning extension. It causes the incoming message to be scanned by
56518 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
56519 </para>
56520 </listitem></varlistentry>
56521 <varlistentry>
56522 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
56523 <listitem>
56524 <para>
56525 <indexterm role="concept">
56526 <primary><option>verify</option> ACL condition</primary>
56527 </indexterm>
56528 <indexterm role="concept">
56529 <primary>TLS</primary>
56530 <secondary>client certificate verification</secondary>
56531 </indexterm>
56532 <indexterm role="concept">
56533 <primary>certificate</primary>
56534 <secondary>verification of client</secondary>
56535 </indexterm>
56536 <indexterm role="concept">
56537 <primary>access control lists (ACLs)</primary>
56538 <secondary>certificate verification</secondary>
56539 </indexterm>
56540 <indexterm role="concept">
56541 <primary>access control lists (ACLs)</primary>
56542 <secondary>testing a TLS certificate</secondary>
56543 </indexterm>
56544 This condition is true in an SMTP session if the session is encrypted, and a
56545 certificate was received from the client, and the certificate was verified. The
56546 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
56547 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
56548 </para>
56549 </listitem></varlistentry>
56550 <varlistentry>
56551 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
56552 <listitem>
56553 <para>
56554 <indexterm role="concept">
56555 <primary>CSA verification</primary>
56556 </indexterm>
56557 This condition checks whether the sending host (the client) is authorized to
56558 send email. Details of how this works are given in section
56559 <xref linkend="SECTverifyCSA"/>.
56560 </para>
56561 </listitem></varlistentry>
56562 <varlistentry>
56563 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
56564 <listitem>
56565 <para>
56566 <indexterm role="concept">
56567 <primary><option>verify</option> ACL condition</primary>
56568 </indexterm>
56569 <indexterm role="concept">
56570 <primary>access control lists (ACLs)</primary>
56571 <secondary>verifying header names only ASCII</secondary>
56572 </indexterm>
56573 <indexterm role="concept">
56574 <primary>header lines</primary>
56575 <secondary>verifying header names only ASCII</secondary>
56576 </indexterm>
56577 <indexterm role="concept">
56578 <primary>verifying</primary>
56579 <secondary>header names only ASCII</secondary>
56580 </indexterm>
56581 This condition is relevant only in an ACL that is run after a message has been
56582 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56583 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
56584 there are no non-ASCII characters, also excluding control characters.  The
56585 allowable characters are decimal ASCII values 33 through 126.
56586 </para>
56587 <para>
56588 Exim itself will handle headers with non-ASCII characters, but it can cause
56589 problems for downstream applications, so this option will allow their
56590 detection and rejection in the DATA ACL&#x2019;s.
56591 </para>
56592 </listitem></varlistentry>
56593 <varlistentry>
56594 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56595 <listitem>
56596 <para>
56597 <indexterm role="concept">
56598 <primary><option>verify</option> ACL condition</primary>
56599 </indexterm>
56600 <indexterm role="concept">
56601 <primary>access control lists (ACLs)</primary>
56602 <secondary>verifying sender in the header</secondary>
56603 </indexterm>
56604 <indexterm role="concept">
56605 <primary>header lines</primary>
56606 <secondary>verifying the sender in</secondary>
56607 </indexterm>
56608 <indexterm role="concept">
56609 <primary>sender</primary>
56610 <secondary>verifying in header</secondary>
56611 </indexterm>
56612 <indexterm role="concept">
56613 <primary>verifying</primary>
56614 <secondary>sender in header</secondary>
56615 </indexterm>
56616 This condition is relevant only in an ACL that is run after a message has been
56617 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56618 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
56619 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
56620 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
56621 However, an address that appears in one of these headers need not be an address
56622 that accepts bounce messages; only sender addresses in envelopes are required
56623 to accept bounces. Therefore, if you use the callout option on this check, you
56624 might want to arrange for a non-empty address in the MAIL command.
56625 </para>
56626 <para>
56627 Details of address verification and the options are given later, starting at
56628 section <xref linkend="SECTaddressverification"/> (callouts are described in section
56629 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
56630 condition to restrict it to bounce messages only:
56631 </para>
56632 <literallayout class="monospaced">
56633 deny    senders = :
56634         message = A valid sender header is required for bounces
56635        !verify  = header_sender
56636 </literallayout>
56637 </listitem></varlistentry>
56638 <varlistentry>
56639 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
56640 <listitem>
56641 <para>
56642 <indexterm role="concept">
56643 <primary><option>verify</option> ACL condition</primary>
56644 </indexterm>
56645 <indexterm role="concept">
56646 <primary>access control lists (ACLs)</primary>
56647 <secondary>verifying header syntax</secondary>
56648 </indexterm>
56649 <indexterm role="concept">
56650 <primary>header lines</primary>
56651 <secondary>verifying syntax</secondary>
56652 </indexterm>
56653 <indexterm role="concept">
56654 <primary>verifying</primary>
56655 <secondary>header syntax</secondary>
56656 </indexterm>
56657 This condition is relevant only in an ACL that is run after a message has been
56658 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56659 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
56660 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
56661 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
56662 Unqualified addresses (local parts without domains) are
56663 permitted only in locally generated messages and from hosts that match
56664 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
56665 appropriate.
56666 </para>
56667 <para>
56668 Note that this condition is a syntax check only. However, a common spamming
56669 ploy used to be to send syntactically invalid headers such as
56670 </para>
56671 <literallayout class="monospaced">
56672 To: @
56673 </literallayout>
56674 <para>
56675 and this condition can be used to reject such messages, though they are not as
56676 common as they used to be.
56677 </para>
56678 </listitem></varlistentry>
56679 <varlistentry>
56680 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
56681 <listitem>
56682 <para>
56683 <indexterm role="concept">
56684 <primary><option>verify</option> ACL condition</primary>
56685 </indexterm>
56686 <indexterm role="concept">
56687 <primary>access control lists (ACLs)</primary>
56688 <secondary>verifying HELO/EHLO</secondary>
56689 </indexterm>
56690 <indexterm role="concept">
56691 <primary>HELO</primary>
56692 <secondary>verifying</secondary>
56693 </indexterm>
56694 <indexterm role="concept">
56695 <primary>EHLO</primary>
56696 <secondary>verifying</secondary>
56697 </indexterm>
56698 <indexterm role="concept">
56699 <primary>verifying</primary>
56700 <secondary>EHLO</secondary>
56701 </indexterm>
56702 <indexterm role="concept">
56703 <primary>verifying</primary>
56704 <secondary>HELO</secondary>
56705 </indexterm>
56706 This condition is true if a HELO or EHLO command has been received from the
56707 client host, and its contents have been verified. If there has been no previous
56708 attempt to verify the HELO/EHLO contents, it is carried out when this
56709 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
56710 <option>helo_try_verify_hosts</option> options for details of how to request verification
56711 independently of this condition.
56712 </para>
56713 <para>
56714 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
56715 option), this condition is always true.
56716 </para>
56717 </listitem></varlistentry>
56718 <varlistentry>
56719 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
56720 <listitem>
56721 <para>
56722 <indexterm role="concept">
56723 <primary>verifying</primary>
56724 <secondary>not blind</secondary>
56725 </indexterm>
56726 <indexterm role="concept">
56727 <primary>bcc recipients, verifying none</primary>
56728 </indexterm>
56729 This condition checks that there are no blind (bcc) recipients in the message.
56730 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
56731 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
56732 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
56733 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
56734 used only in a DATA or non-SMTP ACL.
56735 </para>
56736 <para>
56737 There are, of course, many legitimate messages that make use of blind (bcc)
56738 recipients. This check should not be used on its own for blocking messages.
56739 </para>
56740 </listitem></varlistentry>
56741 <varlistentry>
56742 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56743 <listitem>
56744 <para>
56745 <indexterm role="concept">
56746 <primary><option>verify</option> ACL condition</primary>
56747 </indexterm>
56748 <indexterm role="concept">
56749 <primary>access control lists (ACLs)</primary>
56750 <secondary>verifying recipient</secondary>
56751 </indexterm>
56752 <indexterm role="concept">
56753 <primary>recipient</primary>
56754 <secondary>verifying</secondary>
56755 </indexterm>
56756 <indexterm role="concept">
56757 <primary>verifying</primary>
56758 <secondary>recipient</secondary>
56759 </indexterm>
56760 <indexterm role="variable">
56761 <primary><varname>$address_data</varname></primary>
56762 </indexterm>
56763 This condition is relevant only after a RCPT command. It verifies the current
56764 recipient. Details of address verification are given later, starting at section
56765 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
56766 of <varname>$address_data</varname> is the last value that was set while routing the address.
56767 This applies even if the verification fails. When an address that is being
56768 verified is redirected to a single address, verification continues with the new
56769 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
56770 value for the child address.
56771 </para>
56772 </listitem></varlistentry>
56773 <varlistentry>
56774 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56775 <listitem>
56776 <para>
56777 <indexterm role="concept">
56778 <primary><option>verify</option> ACL condition</primary>
56779 </indexterm>
56780 <indexterm role="concept">
56781 <primary>access control lists (ACLs)</primary>
56782 <secondary>verifying host reverse lookup</secondary>
56783 </indexterm>
56784 <indexterm role="concept">
56785 <primary>host</primary>
56786 <secondary>verifying reverse lookup</secondary>
56787 </indexterm>
56788 This condition ensures that a verified host name has been looked up from the IP
56789 address of the client host. (This may have happened already if the host name
56790 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
56791 Verification ensures that the host name obtained from a reverse DNS lookup, or
56792 one of its aliases, does, when it is itself looked up in the DNS, yield the
56793 original IP address.
56794 </para>
56795 <para>
56796 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
56797 DNS operation returns a temporary error, the verify condition succeeds.
56798 </para>
56799 <para>
56800 If this condition is used for a locally generated message (that is, when there
56801 is no client host involved), it always succeeds.
56802 </para>
56803 </listitem></varlistentry>
56804 <varlistentry>
56805 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56806 <listitem>
56807 <para>
56808 <indexterm role="concept">
56809 <primary><option>verify</option> ACL condition</primary>
56810 </indexterm>
56811 <indexterm role="concept">
56812 <primary>access control lists (ACLs)</primary>
56813 <secondary>verifying sender</secondary>
56814 </indexterm>
56815 <indexterm role="concept">
56816 <primary>sender</primary>
56817 <secondary>verifying</secondary>
56818 </indexterm>
56819 <indexterm role="concept">
56820 <primary>verifying</primary>
56821 <secondary>sender</secondary>
56822 </indexterm>
56823 This condition is relevant only after a MAIL or RCPT command, or after a
56824 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
56825 the message&#x2019;s sender is empty (that is, this is a bounce message), the
56826 condition is true. Otherwise, the sender address is verified.
56827 </para>
56828 <para>
56829 <indexterm role="variable">
56830 <primary><varname>$address_data</varname></primary>
56831 </indexterm>
56832 <indexterm role="variable">
56833 <primary><varname>$sender_address_data</varname></primary>
56834 </indexterm>
56835 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
56836 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
56837 value can be used in subsequent conditions and modifiers in the same ACL
56838 statement. It does not persist after the end of the current statement. If you
56839 want to preserve the value for longer, you can save it in an ACL variable.
56840 </para>
56841 <para>
56842 Details of verification are given later, starting at section
56843 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
56844 to avoid doing it more than once per message.
56845 </para>
56846 </listitem></varlistentry>
56847 <varlistentry>
56848 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56849 <listitem>
56850 <para>
56851 <indexterm role="concept">
56852 <primary><option>verify</option> ACL condition</primary>
56853 </indexterm>
56854 This is a variation of the previous option, in which a modified address is
56855 verified as a sender.
56856 </para>
56857 <para revisionflag="changed">
56858 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
56859 (eg. is generated from the received message)
56860 they must be protected from the options parsing by doubling:
56861 </para>
56862 <literallayout class="monospaced" revisionflag="changed">
56863 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
56864 </literallayout>
56865 </listitem></varlistentry>
56866 </variablelist>
56867 </section>
56868 <section id="SECTmorednslists">
56869 <title>Using DNS lists</title>
56870 <para>
56871 <indexterm role="concept">
56872 <primary>DNS list</primary>
56873 <secondary>in ACL</secondary>
56874 </indexterm>
56875 <indexterm role="concept">
56876 <primary>black list (DNS)</primary>
56877 </indexterm>
56878 <indexterm role="concept">
56879 <primary>access control lists (ACLs)</primary>
56880 <secondary>testing a DNS list</secondary>
56881 </indexterm>
56882 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
56883 is on at least one of a number of DNS lists by looking up the inverted IP
56884 address in one or more DNS domains. (Note that DNS list domains are not mail
56885 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
56886 special options instead.) For example, if the calling host&#x2019;s IP
56887 address is 192.168.62.43, and the ACL statement is
56888 </para>
56889 <literallayout class="monospaced">
56890 deny dnslists = blackholes.mail-abuse.org : \
56891                 dialups.mail-abuse.org
56892 </literallayout>
56893 <para>
56894 the following records are looked up:
56895 </para>
56896 <literallayout class="monospaced">
56897 43.62.168.192.blackholes.mail-abuse.org
56898 43.62.168.192.dialups.mail-abuse.org
56899 </literallayout>
56900 <para>
56901 As soon as Exim finds an existing DNS record, processing of the list stops.
56902 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
56903 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
56904 use two separate conditions:
56905 </para>
56906 <literallayout class="monospaced">
56907 deny dnslists = blackholes.mail-abuse.org
56908      dnslists = dialups.mail-abuse.org
56909 </literallayout>
56910 <para>
56911 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
56912 behaves as if the host does not match the list item, that is, as if the DNS
56913 record does not exist. If there are further items in the DNS list, they are
56914 processed.
56915 </para>
56916 <para>
56917 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
56918 (which is the most common usage), because it prevents a DNS failure from
56919 blocking mail. However, you can change this behaviour by putting one of the
56920 following special items in the list:
56921 </para>
56922 <literallayout>
56923 <literal>+include_unknown </literal>   behave as if the item is on the list
56924 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
56925 <literal>+defer_unknown   </literal>   give a temporary error
56926 </literallayout>
56927 <para>
56928 <indexterm role="concept">
56929 <primary><literal>+include_unknown</literal></primary>
56930 </indexterm>
56931 <indexterm role="concept">
56932 <primary><literal>+exclude_unknown</literal></primary>
56933 </indexterm>
56934 <indexterm role="concept">
56935 <primary><literal>+defer_unknown</literal></primary>
56936 </indexterm>
56937 Each of these applies to any subsequent items on the list. For example:
56938 </para>
56939 <literallayout class="monospaced">
56940 deny dnslists = +defer_unknown : foo.bar.example
56941 </literallayout>
56942 <para>
56943 Testing the list of domains stops as soon as a match is found. If you want to
56944 warn for one list and block for another, you can use two different statements:
56945 </para>
56946 <literallayout class="monospaced">
56947 deny  dnslists = blackholes.mail-abuse.org
56948 warn  message  = X-Warn: sending host is on dialups list
56949       dnslists = dialups.mail-abuse.org
56950 </literallayout>
56951 <para>
56952 <indexterm role="concept">
56953 <primary>caching</primary>
56954 <secondary>of dns lookup</secondary>
56955 </indexterm>
56956 <indexterm role="concept">
56957 <primary>DNS</primary>
56958 <secondary>TTL</secondary>
56959 </indexterm>
56960 DNS list lookups are cached by Exim for the duration of the SMTP session
56961 (but limited by the DNS return TTL value),
56962 so a lookup based on the IP address is done at most once for any incoming
56963 connection (assuming long-enough TTL).
56964 Exim does not share information between multiple incoming
56965 connections (but your local name server cache should be active).
56966 </para>
56967 </section>
56968 <section id="SECID201">
56969 <title>Specifying the IP address for a DNS list lookup</title>
56970 <para>
56971 <indexterm role="concept">
56972 <primary>DNS list</primary>
56973 <secondary>keyed by explicit IP address</secondary>
56974 </indexterm>
56975 By default, the IP address that is used in a DNS list lookup is the IP address
56976 of the calling host. However, you can specify another IP address by listing it
56977 after the domain name, introduced by a slash. For example:
56978 </para>
56979 <literallayout class="monospaced">
56980 deny dnslists = black.list.tld/192.168.1.2
56981 </literallayout>
56982 <para>
56983 This feature is not very helpful with explicit IP addresses; it is intended for
56984 use with IP addresses that are looked up, for example, the IP addresses of the
56985 MX hosts or nameservers of an email sender address. For an example, see section
56986 <xref linkend="SECTmulkeyfor"/> below.
56987 </para>
56988 </section>
56989 <section id="SECID202">
56990 <title>DNS lists keyed on domain names</title>
56991 <para>
56992 <indexterm role="concept">
56993 <primary>DNS list</primary>
56994 <secondary>keyed by domain name</secondary>
56995 </indexterm>
56996 There are some lists that are keyed on domain names rather than inverted IP
56997 addresses (see for example the <emphasis>domain based zones</emphasis> link at
56998 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
56999 with these lists. You can change the name that is looked up in a DNS list by
57000 listing it after the domain name, introduced by a slash. For example,
57001 </para>
57002 <literallayout class="monospaced">
57003 deny  message  = Sender's domain is listed at $dnslist_domain
57004       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
57005 </literallayout>
57006 <para>
57007 This particular example is useful only in ACLs that are obeyed after the
57008 RCPT or DATA commands, when a sender address is available. If (for
57009 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
57010 up by this example is
57011 </para>
57012 <literallayout class="monospaced">
57013 tld.example.dsn.rfc-ignorant.org
57014 </literallayout>
57015 <para>
57016 A single <option>dnslists</option> condition can contain entries for both names and IP
57017 addresses. For example:
57018 </para>
57019 <literallayout class="monospaced">
57020 deny dnslists = sbl.spamhaus.org : \
57021                 dsn.rfc-ignorant.org/$sender_address_domain
57022 </literallayout>
57023 <para>
57024 The first item checks the sending host&#x2019;s IP address; the second checks a domain
57025 name. The whole condition is true if either of the DNS lookups succeeds.
57026 </para>
57027 </section>
57028 <section id="SECTmulkeyfor">
57029 <title>Multiple explicit keys for a DNS list</title>
57030 <para>
57031 <indexterm role="concept">
57032 <primary>DNS list</primary>
57033 <secondary>multiple keys for</secondary>
57034 </indexterm>
57035 The syntax described above for looking up explicitly-defined values (either
57036 names or IP addresses) in a DNS blacklist is a simplification. After the domain
57037 name for the DNS list, what follows the slash can in fact be a list of items.
57038 As with all lists in Exim, the default separator is a colon. However, because
57039 this is a sublist within the list of DNS blacklist domains, it is necessary
57040 either to double the separators like this:
57041 </para>
57042 <literallayout class="monospaced">
57043 dnslists = black.list.tld/name.1::name.2
57044 </literallayout>
57045 <para>
57046 or to change the separator character, like this:
57047 </para>
57048 <literallayout class="monospaced">
57049 dnslists = black.list.tld/&lt;;name.1;name.2
57050 </literallayout>
57051 <para>
57052 If an item in the list is an IP address, it is inverted before the DNS
57053 blacklist domain is appended. If it is not an IP address, no inversion
57054 occurs. Consider this condition:
57055 </para>
57056 <literallayout class="monospaced">
57057 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
57058 </literallayout>
57059 <para>
57060 The DNS lookups that occur are:
57061 </para>
57062 <literallayout class="monospaced">
57063 2.1.168.192.black.list.tld
57064 a.domain.black.list.tld
57065 </literallayout>
57066 <para>
57067 Once a DNS record has been found (that matches a specific IP return
57068 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
57069 are done. If there is a temporary DNS error, the rest of the sublist of domains
57070 or IP addresses is tried. A temporary error for the whole dnslists item occurs
57071 only if no other DNS lookup in this sublist succeeds. In other words, a
57072 successful lookup for any of the items in the sublist overrides a temporary
57073 error for a previous item.
57074 </para>
57075 <para>
57076 The ability to supply a list of items after the slash is in some sense just a
57077 syntactic convenience. These two examples have the same effect:
57078 </para>
57079 <literallayout class="monospaced">
57080 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
57081 dnslists = black.list.tld/a.domain::b.domain
57082 </literallayout>
57083 <para>
57084 However, when the data for the list is obtained from a lookup, the second form
57085 is usually much more convenient. Consider this example:
57086 </para>
57087 <literallayout class="monospaced">
57088 deny message  = The mail servers for the domain \
57089                 $sender_address_domain \
57090                 are listed at $dnslist_domain ($dnslist_value); \
57091                 see $dnslist_text.
57092      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
57093                                    ${lookup dnsdb {&gt;|mxh=\
57094                                    $sender_address_domain} }} }
57095 </literallayout>
57096 <para>
57097 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
57098 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
57099 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
57100 of expanding the condition might be something like this:
57101 </para>
57102 <literallayout class="monospaced">
57103 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
57104 </literallayout>
57105 <para>
57106 Thus, this example checks whether or not the IP addresses of the sender
57107 domain&#x2019;s mail servers are on the Spamhaus black list.
57108 </para>
57109 <para>
57110 The key that was used for a successful DNS list lookup is put into the variable
57111 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
57112 </para>
57113 </section>
57114 <section id="SECID203">
57115 <title>Data returned by DNS lists</title>
57116 <para>
57117 <indexterm role="concept">
57118 <primary>DNS list</primary>
57119 <secondary>data returned from</secondary>
57120 </indexterm>
57121 DNS lists are constructed using address records in the DNS. The original RBL
57122 just used the address 127.0.0.1 on the right hand side of each record, but the
57123 RBL+ list and some other lists use a number of values with different meanings.
57124 The values used on the RBL+ list are:
57125 </para>
57126 <literallayout>
57127 127.1.0.1  RBL
57128 127.1.0.2  DUL
57129 127.1.0.3  DUL and RBL
57130 127.1.0.4  RSS
57131 127.1.0.5  RSS and RBL
57132 127.1.0.6  RSS and DUL
57133 127.1.0.7  RSS and DUL and RBL
57134 </literallayout>
57135 <para>
57136 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
57137 different values. Some DNS lists may return more than one address record;
57138 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
57139 </para>
57140 </section>
57141 <section id="SECID204">
57142 <title>Variables set from DNS lists</title>
57143 <para>
57144 <indexterm role="concept">
57145 <primary>expansion</primary>
57146 <secondary>variables, set from DNS list</secondary>
57147 </indexterm>
57148 <indexterm role="concept">
57149 <primary>DNS list</primary>
57150 <secondary>variables set from</secondary>
57151 </indexterm>
57152 <indexterm role="variable">
57153 <primary><varname>$dnslist_domain</varname></primary>
57154 </indexterm>
57155 <indexterm role="variable">
57156 <primary><varname>$dnslist_matched</varname></primary>
57157 </indexterm>
57158 <indexterm role="variable">
57159 <primary><varname>$dnslist_text</varname></primary>
57160 </indexterm>
57161 <indexterm role="variable">
57162 <primary><varname>$dnslist_value</varname></primary>
57163 </indexterm>
57164 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
57165 the name of the overall domain that matched (for example,
57166 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
57167 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
57168 the DNS record. When the key is an IP address, it is not reversed in
57169 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
57170 cases, for example:
57171 </para>
57172 <literallayout class="monospaced">
57173 deny dnslists = spamhaus.example
57174 </literallayout>
57175 <para>
57176 the key is also available in another variable (in this case,
57177 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
57178 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
57179 might generate a dnslists lookup like this:
57180 </para>
57181 <literallayout class="monospaced">
57182 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
57183 </literallayout>
57184 <para>
57185 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
57186 <literal>192.168.6.7</literal> (for example).
57187 </para>
57188 <para>
57189 If more than one address record is returned by the DNS lookup, all the IP
57190 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
57191 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
57192 record. For lists such as RBL+ the TXT record for a merged entry is often not
57193 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
57194 information.
57195 </para>
57196 <para>
57197 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
57198 &ndash; although these appear before the condition in the ACL, they are not
57199 expanded until after it has failed. For example:
57200 </para>
57201 <literallayout class="monospaced">
57202 deny    hosts = !+local_networks
57203         message = $sender_host_address is listed \
57204                   at $dnslist_domain
57205         dnslists = rbl-plus.mail-abuse.example
57206 </literallayout>
57207 </section>
57208 <section id="SECTaddmatcon">
57209 <title>Additional matching conditions for DNS lists</title>
57210 <para>
57211 <indexterm role="concept">
57212 <primary>DNS list</primary>
57213 <secondary>matching specific returned data</secondary>
57214 </indexterm>
57215 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
57216 in order to restrict its action to DNS records with a matching right hand side.
57217 For example,
57218 </para>
57219 <literallayout class="monospaced">
57220 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
57221 </literallayout>
57222 <para>
57223 rejects only those hosts that yield 127.0.0.2. Without this additional data,
57224 any address record is considered to be a match. For the moment, we assume
57225 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
57226 describes how multiple records are handled.
57227 </para>
57228 <para>
57229 More than one IP address may be given for checking, using a comma as a
57230 separator. These are alternatives &ndash; if any one of them matches, the
57231 <option>dnslists</option> condition is true. For example:
57232 </para>
57233 <literallayout class="monospaced">
57234 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57235 </literallayout>
57236 <para>
57237 If you want to specify a constraining address list and also specify names or IP
57238 addresses to be looked up, the constraining address list must be specified
57239 first. For example:
57240 </para>
57241 <literallayout class="monospaced">
57242 deny dnslists = dsn.rfc-ignorant.org\
57243                 =127.0.0.2/$sender_address_domain
57244 </literallayout>
57245 <para>
57246 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
57247 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
57248 In other words, the listed addresses are used as bit masks. The comparison is
57249 true if all the bits in the mask are present in the address that is being
57250 tested. For example:
57251 </para>
57252 <literallayout class="monospaced">
57253 dnslists = a.b.c&amp;0.0.0.3
57254 </literallayout>
57255 <para>
57256 matches if the address is <emphasis>x.x.x.</emphasis>3, <emphasis>x.x.x.</emphasis>7, <emphasis>x.x.x.</emphasis>11, etc. If you
57257 want to test whether one bit or another bit is present (as opposed to both
57258 being present), you must use multiple values. For example:
57259 </para>
57260 <literallayout class="monospaced">
57261 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
57262 </literallayout>
57263 <para>
57264 matches if the final component of the address is an odd number or two times
57265 an odd number.
57266 </para>
57267 </section>
57268 <section id="SECID205">
57269 <title>Negated DNS matching conditions</title>
57270 <para>
57271 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
57272 condition. Whereas
57273 </para>
57274 <literallayout class="monospaced">
57275 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57276 </literallayout>
57277 <para>
57278 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57279 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
57280 </para>
57281 <literallayout class="monospaced">
57282 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
57283 </literallayout>
57284 <para>
57285 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57286 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
57287 words, the result of the test is inverted if an exclamation mark appears before
57288 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
57289 </para>
57290 <para>
57291 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
57292 host, or address list (which is why the syntax is different).
57293 </para>
57294 <para>
57295 If you are using just one list, the negation syntax does not gain you much. The
57296 previous example is precisely equivalent to
57297 </para>
57298 <literallayout class="monospaced">
57299 deny  dnslists = a.b.c
57300      !dnslists = a.b.c=127.0.0.2,127.0.0.3
57301 </literallayout>
57302 <para>
57303 However, if you are using multiple lists, the negation syntax is clearer.
57304 Consider this example:
57305 </para>
57306 <literallayout class="monospaced">
57307 deny  dnslists = sbl.spamhaus.org : \
57308                  list.dsbl.org : \
57309                  dnsbl.njabl.org!=127.0.0.3 : \
57310                  relays.ordb.org
57311 </literallayout>
57312 <para>
57313 Using only positive lists, this would have to be:
57314 </para>
57315 <literallayout class="monospaced">
57316 deny  dnslists = sbl.spamhaus.org : \
57317                  list.dsbl.org
57318 deny  dnslists = dnsbl.njabl.org
57319      !dnslists = dnsbl.njabl.org=127.0.0.3
57320 deny  dnslists = relays.ordb.org
57321 </literallayout>
57322 <para>
57323 which is less clear, and harder to maintain.
57324 </para>
57325 </section>
57326 <section id="SECThanmuldnsrec">
57327 <title>Handling multiple DNS records from a DNS list</title>
57328 <para>
57329 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
57330 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
57331 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
57332 the match to specific results from the DNS lookup, there are two ways in which
57333 the checking can be handled. For example, consider the condition:
57334 </para>
57335 <literallayout class="monospaced">
57336 dnslists = a.b.c=127.0.0.1
57337 </literallayout>
57338 <para>
57339 What happens if the DNS lookup for the incoming IP address yields both
57340 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
57341 condition true because at least one given value was found, or is it false
57342 because at least one of the found values was not listed? And how does this
57343 affect negated conditions? Both possibilities are provided for with the help of
57344 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
57345 </para>
57346 <itemizedlist>
57347 <listitem>
57348 <para>
57349 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
57350 IP addresses matches one of the listed addresses. For the example above, the
57351 condition is true because 127.0.0.1 matches.
57352 </para>
57353 </listitem>
57354 <listitem>
57355 <para>
57356 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
57357 looked up IP addresses matches one of the listed addresses. If the condition is
57358 changed to:
57359 </para>
57360 <literallayout class="monospaced">
57361 dnslists = a.b.c==127.0.0.1
57362 </literallayout>
57363 <para>
57364 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57365 false because 127.0.0.2 is not listed. You would need to have:
57366 </para>
57367 <literallayout class="monospaced">
57368 dnslists = a.b.c==127.0.0.1,127.0.0.2
57369 </literallayout>
57370 <para>
57371 for the condition to be true.
57372 </para>
57373 </listitem>
57374 </itemizedlist>
57375 <para>
57376 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
57377 the precise opposite of the behaviour above. Thus:
57378 </para>
57379 <itemizedlist>
57380 <listitem>
57381 <para>
57382 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
57383 addresses matches one of the listed addresses. Consider:
57384 </para>
57385 <literallayout class="monospaced">
57386 dnslists = a.b.c!&amp;0.0.0.1
57387 </literallayout>
57388 <para>
57389 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57390 false because 127.0.0.1 matches.
57391 </para>
57392 </listitem>
57393 <listitem>
57394 <para>
57395 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
57396 looked up IP address that does not match. Consider:
57397 </para>
57398 <literallayout class="monospaced">
57399 dnslists = a.b.c!=&amp;0.0.0.1
57400 </literallayout>
57401 <para>
57402 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57403 true, because 127.0.0.2 does not match. You would need to have:
57404 </para>
57405 <literallayout class="monospaced">
57406 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
57407 </literallayout>
57408 <para>
57409 for the condition to be false.
57410 </para>
57411 </listitem>
57412 </itemizedlist>
57413 <para>
57414 When the DNS lookup yields only a single IP address, there is no difference
57415 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
57416 </para>
57417 </section>
57418 <section id="SECTmordetinf">
57419 <title>Detailed information from merged DNS lists</title>
57420 <para>
57421 <indexterm role="concept">
57422 <primary>DNS list</primary>
57423 <secondary>information from merged</secondary>
57424 </indexterm>
57425 When the facility for restricting the matching IP values in a DNS list is used,
57426 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
57427 the true reason for rejection. This happens when lists are merged and the IP
57428 address in the A record is used to distinguish them; unfortunately there is
57429 only one TXT record. One way round this is not to use merged lists, but that
57430 can be inefficient because it requires multiple DNS lookups where one would do
57431 in the vast majority of cases when the host of interest is not on any of the
57432 lists.
57433 </para>
57434 <para>
57435 A less inefficient way of solving this problem is available. If
57436 two domain names, comma-separated, are given, the second is used first to
57437 do an initial check, making use of any IP value restrictions that are set.
57438 If there is a match, the first domain is used, without any IP value
57439 restrictions, to get the TXT record. As a byproduct of this, there is also
57440 a check that the IP being tested is indeed on the first list. The first
57441 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
57442 </para>
57443 <literallayout class="monospaced">
57444 reject message  = \
57445          rejected because $sender_host_address is blacklisted \
57446          at $dnslist_domain\n$dnslist_text
57447        dnslists = \
57448          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
57449          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57450 </literallayout>
57451 <para>
57452 For the first blacklist item, this starts by doing a lookup in
57453 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
57454 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
57455 value, and as long as something is found, it looks for the corresponding TXT
57456 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
57457 The second blacklist item is processed similarly.
57458 </para>
57459 <para>
57460 If you are interested in more than one merged list, the same list must be
57461 given several times, but because the results of the DNS lookups are cached,
57462 the DNS calls themselves are not repeated. For example:
57463 </para>
57464 <literallayout class="monospaced">
57465 reject dnslists = \
57466          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
57467          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
57468          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
57469          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57470 </literallayout>
57471 <para>
57472 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
57473 values matches (or if no record is found), this is the only lookup that is
57474 done. Only if there is a match is one of the more specific lists consulted.
57475 </para>
57476 </section>
57477 <section id="SECTmorednslistslast">
57478 <title>DNS lists and IPv6</title>
57479 <para>
57480 <indexterm role="concept">
57481 <primary>IPv6</primary>
57482 <secondary>DNS black lists</secondary>
57483 </indexterm>
57484 <indexterm role="concept">
57485 <primary>DNS list</primary>
57486 <secondary>IPv6 usage</secondary>
57487 </indexterm>
57488 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
57489 nibble by nibble. For example, if the calling host&#x2019;s IP address is
57490 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
57491 </para>
57492 <literallayout class="monospaced">
57493 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
57494   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
57495 </literallayout>
57496 <para>
57497 (split over two lines here to fit on the page). Unfortunately, some of the DNS
57498 lists contain wildcard records, intended for IPv4, that interact badly with
57499 IPv6. For example, the DNS entry
57500 </para>
57501 <literallayout class="monospaced">
57502 *.3.some.list.example.    A    127.0.0.1
57503 </literallayout>
57504 <para>
57505 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
57506 Unfortunately, it also matches the entire 3::/4 IPv6 network.
57507 </para>
57508 <para>
57509 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
57510 <option>condition</option> condition, as in this example:
57511 </para>
57512 <literallayout class="monospaced">
57513 deny   condition = ${if isip4{$sender_host_address}}
57514        dnslists  = some.list.example
57515 </literallayout>
57516 <para>
57517 If an explicit key is being used for a DNS lookup and it may be an IPv6
57518 address you should specify alternate list separators for both the outer
57519 (DNS list name) list and inner (lookup keys) list:
57520 </para>
57521 <literallayout class="monospaced">
57522        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
57523 </literallayout>
57524 </section>
57525 <section id="SECTratelimiting">
57526 <title>Rate limiting incoming messages</title>
57527 <para>
57528 <indexterm role="concept">
57529 <primary>rate limiting</primary>
57530 <secondary>client sending</secondary>
57531 </indexterm>
57532 <indexterm role="concept">
57533 <primary>limiting client sending rates</primary>
57534 </indexterm>
57535 <indexterm role="option">
57536 <primary><option>smtp_ratelimit_*</option></primary>
57537 </indexterm>
57538 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
57539 which clients can send email. This is more powerful than the
57540 <option>smtp_ratelimit_*</option> options, because those options control the rate of
57541 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
57542 works across all connections (concurrent and sequential) from the same client
57543 host. The syntax of the <option>ratelimit</option> condition is:
57544 </para>
57545 <literallayout>
57546 <literal>ratelimit =</literal> &lt;<emphasis>m</emphasis>&gt; <literal>/</literal> &lt;<emphasis>p</emphasis>&gt; <literal>/</literal> &lt;<emphasis>options</emphasis>&gt; <literal>/</literal> &lt;<emphasis>key</emphasis>&gt;
57547 </literallayout>
57548 <para>
57549 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
57550 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
57551 </para>
57552 <para>
57553 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
57554 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
57555 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
57556 of <emphasis>p</emphasis>.
57557 </para>
57558 <para>
57559 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
57560 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
57561 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
57562 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
57563 send in each time interval. It also specifies the number of messages permitted
57564 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
57565 constant, you can allow a client to send more messages in a burst without
57566 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
57567 both small, messages must be sent at an even rate.
57568 </para>
57569 <para>
57570 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
57571 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
57572 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
57573 instructions when it is run with no arguments.
57574 </para>
57575 <para>
57576 The key is used to look up the data for calculating the client&#x2019;s average
57577 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
57578 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
57579 which means Exim computes the sending rate of each client host IP address.
57580 By changing the key you can change how Exim identifies clients for the purpose
57581 of ratelimiting. For example, to limit the sending rate of each authenticated
57582 user, independent of the computer they are sending from, set the key to
57583 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
57584 example, <varname>$authenticated_id</varname> is only meaningful if the client has
57585 authenticated (which you can check with the <option>authenticated</option> ACL condition).
57586 </para>
57587 <para>
57588 The lookup key does not have to identify clients: If you want to limit the
57589 rate at which a recipient receives messages, you can use the key
57590 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
57591 ACL.
57592 </para>
57593 <para>
57594 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
57595 specifies what Exim measures the rate of, for example messages or recipients
57596 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
57597 <option>count=</option> options. You can also control when Exim updates the recorded rate
57598 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
57599 separated by a slash, like the other parameters. They may appear in any order.
57600 </para>
57601 <para>
57602 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
57603 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
57604 stored, so you can alter the configured maximum rate and Exim will still
57605 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
57606 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
57607 behaviour. The lookup key is not affected by changes to the update mode and
57608 the <option>count=</option> option.
57609 </para>
57610 </section>
57611 <section id="ratoptmea">
57612 <title>Ratelimit options for what is being measured</title>
57613 <para>
57614 <indexterm role="concept">
57615 <primary>rate limiting</primary>
57616 <secondary>per_* options</secondary>
57617 </indexterm>
57618 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
57619 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
57620 <option>acl_not_smtp_start</option> ACLs.
57621 </para>
57622 <para>
57623 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
57624 the default if none of the <option>per_*</option> options is specified. It can be used in
57625 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
57626 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
57627 </para>
57628 <para>
57629 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
57630 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
57631 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
57632 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
57633 in its MAIL command, which may be inaccurate or completely missing. You can
57634 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
57635 in kilobytes, megabytes, or gigabytes, respectively.
57636 </para>
57637 <para>
57638 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
57639 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
57640 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
57641 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
57642 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
57643 in either case the rate limiting engine will see a message with many
57644 recipients as a large high-speed burst.
57645 </para>
57646 <para>
57647 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
57648 number of different recipients that the client has sent messages to in the
57649 last time period. That is, if the client repeatedly sends messages to the same
57650 recipient, its measured rate is not increased. This option can only be used in
57651 <option>acl_smtp_rcpt</option>.
57652 </para>
57653 <para>
57654 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
57655 condition is processed. This can be used to limit the rate of any SMTP
57656 command. If it is used in multiple ACLs it can limit the aggregate rate of
57657 multiple different commands.
57658 </para>
57659 <para>
57660 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
57661 measured rate. For example, the <option>per_byte</option> option is equivalent to
57662 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
57663 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
57664 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
57665 </para>
57666 <para>
57667 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
57668 </para>
57669 </section>
57670 <section id="ratoptupd">
57671 <title>Ratelimit update modes</title>
57672 <para>
57673 <indexterm role="concept">
57674 <primary>rate limiting</primary>
57675 <secondary>reading data without updating</secondary>
57676 </indexterm>
57677 You can specify one of three options with the <option>ratelimit</option> condition to
57678 control when its database is updated. This section describes the <option>readonly</option>
57679 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
57680 </para>
57681 <para>
57682 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
57683 previously-computed rate to check against the limit.
57684 </para>
57685 <para>
57686 For example, you can test the client&#x2019;s sending rate and deny it access (when
57687 it is too fast) in the connect ACL. If the client passes this check then it
57688 can go on to send a message, in which case its recorded rate will be updated
57689 in the MAIL ACL. Subsequent connections from the same client will check this
57690 new rate.
57691 </para>
57692 <literallayout class="monospaced">
57693 acl_check_connect:
57694  deny ratelimit = 100 / 5m / readonly
57695     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
57696                   (max $sender_rate_limit)
57697 # ...
57698 acl_check_mail:
57699  warn ratelimit = 100 / 5m / strict
57700     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
57701                   (max $sender_rate_limit)
57702 </literallayout>
57703 <para>
57704 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
57705 processing a message then it may increase the client&#x2019;s measured rate more than
57706 it should. For example, this will happen if you check the <option>per_rcpt</option> option
57707 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
57708 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
57709 multiple update problems by using the <option>readonly</option> option on later ratelimit
57710 checks.
57711 </para>
57712 <para>
57713 The <option>per_*</option> options described above do not make sense in some ACLs. If you
57714 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
57715 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
57716 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
57717 next section) so you must specify the <option>readonly</option> option explicitly.
57718 </para>
57719 </section>
57720 <section id="ratoptfast">
57721 <title>Ratelimit options for handling fast clients</title>
57722 <para>
57723 <indexterm role="concept">
57724 <primary>rate limiting</primary>
57725 <secondary>strict and leaky modes</secondary>
57726 </indexterm>
57727 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
57728 engine can react in two possible ways, depending on the presence of the
57729 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
57730 counter-measures (such as rejecting the message) that may be specified by the
57731 rest of the ACL.
57732 </para>
57733 <para>
57734 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
57735 updated if it is above the limit. The effect of this is that Exim measures the
57736 client&#x2019;s average rate of successfully sent email, which cannot be greater than
57737 the maximum allowed. If the client is over the limit it may suffer some
57738 counter-measures (as specified in the ACL), but it will still be able to send
57739 email at the configured maximum rate, whatever the rate of its attempts. This
57740 is generally the better choice if you have clients that retry automatically.
57741 For example, it does not prevent a sender with an over-aggressive retry rate
57742 from getting any email through.
57743 </para>
57744 <para>
57745 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
57746 updated. The effect of this is that Exim measures the client&#x2019;s average rate
57747 of attempts to send email, which can be much higher than the maximum it is
57748 actually allowed. If the client is over the limit it may be subjected to
57749 counter-measures by the ACL. It must slow down and allow sufficient time to
57750 pass that its computed rate falls below the maximum before it can send email
57751 again. The time (the number of smoothing periods) it must wait and not
57752 attempt to send mail can be calculated with this formula:
57753 </para>
57754 <literallayout class="monospaced">
57755         ln(peakrate/maxrate)
57756 </literallayout>
57757 </section>
57758 <section id="ratoptuniq">
57759 <title>Limiting the rate of different events</title>
57760 <para>
57761 <indexterm role="concept">
57762 <primary>rate limiting</primary>
57763 <secondary>counting unique events</secondary>
57764 </indexterm>
57765 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
57766 rate of different events. For example, the <option>per_addr</option> option uses this
57767 mechanism to count the number of different recipients that the client has
57768 sent messages to in the last time period; it is equivalent to
57769 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
57770 measure the rate that a client uses different sender addresses with the
57771 options <literal>per_mail/unique=$sender_address</literal>.
57772 </para>
57773 <para>
57774 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
57775 has seen for that key. The whole set is thrown away when it is older than the
57776 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
57777 per period. In the <option>leaky</option> update mode, an event that causes the client to
57778 go over the limit is not added to the set, in the same way that the client&#x2019;s
57779 recorded rate is not updated in the same situation.
57780 </para>
57781 <para>
57782 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
57783 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
57784 rate.
57785 </para>
57786 <para>
57787 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
57788 other <option>ratelimit</option> options in order to store the event set. The number of
57789 unique values is potentially as large as the rate limit, so the extra space
57790 required increases with larger limits.
57791 </para>
57792 <para>
57793 The uniqueification is not perfect: there is a small probability that Exim
57794 will think a new event has happened before. If the sender&#x2019;s rate is less than
57795 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
57796 the measured rate can go above the limit, in which case Exim may under-count
57797 events by a significant margin. Fortunately, if the rate is high enough (2.7
57798 times the limit) that the false positive rate goes above 9%, then Exim will
57799 throw away the over-full event set before the measured rate falls below the
57800 limit. Therefore the only harm should be that exceptionally high sending rates
57801 are logged incorrectly; any countermeasures you configure will be as effective
57802 as intended.
57803 </para>
57804 </section>
57805 <section id="useratlim">
57806 <title>Using rate limiting</title>
57807 <para>
57808 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
57809 when the rate limit is exceeded. This might be anything from logging a warning
57810 (for example, while measuring existing sending rates in order to define
57811 policy), through time delays to slow down fast senders, up to rejecting the
57812 message. For example:
57813 </para>
57814 <literallayout class="monospaced">
57815 # Log all senders' rates
57816 warn ratelimit = 0 / 1h / strict
57817      log_message = Sender rate $sender_rate / $sender_rate_period
57818
57819 # Slow down fast senders; note the need to truncate $sender_rate
57820 # at the decimal point.
57821 warn ratelimit = 100 / 1h / per_rcpt / strict
57822      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
57823                    $sender_rate_limit }s
57824
57825 # Keep authenticated users under control
57826 deny authenticated = *
57827      ratelimit = 100 / 1d / strict / $authenticated_id
57828
57829 # System-wide rate limit
57830 defer message = Sorry, too busy. Try again later.
57831      ratelimit = 10 / 1s / $primary_hostname
57832
57833 # Restrict incoming rate from each host, with a default
57834 # set using a macro and special cases looked up in a table.
57835 defer message = Sender rate exceeds $sender_rate_limit \
57836                messages per $sender_rate_period
57837      ratelimit = ${lookup {$sender_host_address} \
57838                    cdb {DB/ratelimits.cdb} \
57839                    {$value} {RATELIMIT} }
57840 </literallayout>
57841 <para>
57842 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
57843 especially with the <option>per_rcpt</option> option, you may suffer from a performance
57844 bottleneck caused by locking on the ratelimit hints database. Apart from
57845 making your ACLs less complicated, you can reduce the problem by using a
57846 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
57847 this means that Exim will lose its hints data after a reboot (including retry
57848 hints, the callout cache, and ratelimit data).
57849 </para>
57850 </section>
57851 <section id="SECTaddressverification">
57852 <title>Address verification</title>
57853 <para>
57854 <indexterm role="concept">
57855 <primary>verifying address</primary>
57856 <secondary>options for</secondary>
57857 </indexterm>
57858 <indexterm role="concept">
57859 <primary>policy control</primary>
57860 <secondary>address verification</secondary>
57861 </indexterm>
57862 Several of the <option>verify</option> conditions described in section
57863 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
57864 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
57865 The verification conditions can be followed by options that modify the
57866 verification process. The options are separated from the keyword and from each
57867 other by slashes, and some of them contain parameters. For example:
57868 </para>
57869 <literallayout class="monospaced">
57870 verify = sender/callout
57871 verify = recipient/defer_ok/callout=10s,defer_ok
57872 </literallayout>
57873 <para>
57874 The first stage of address verification, which always happens, is to run the
57875 address through the routers, in <quote>verify mode</quote>. Routers can detect the
57876 difference between verification and routing for delivery, and their actions can
57877 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
57878 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
57879 The available options are as follows:
57880 </para>
57881 <itemizedlist>
57882 <listitem>
57883 <para>
57884 If the <option>callout</option> option is specified, successful routing to one or more
57885 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
57886 check. Callouts and their sub-options are discussed in the next section.
57887 </para>
57888 </listitem>
57889 <listitem>
57890 <para>
57891 If there is a defer error while doing verification routing, the ACL
57892 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
57893 options, the condition is forced to be true instead. Note that this is a main
57894 verification option as well as a suboption for callouts.
57895 </para>
57896 </listitem>
57897 <listitem>
57898 <para>
57899 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
57900 discusses the reporting of sender address verification failures.
57901 </para>
57902 </listitem>
57903 <listitem>
57904 <para>
57905 The <option>success_on_redirect</option> option causes verification always to succeed
57906 immediately after a successful redirection. By default, if a redirection
57907 generates just one address, that address is also verified. See further
57908 discussion in section <xref linkend="SECTredirwhilveri"/>.
57909 </para>
57910 </listitem>
57911 </itemizedlist>
57912 <para>
57913 <indexterm role="concept">
57914 <primary>verifying address</primary>
57915 <secondary>differentiating failures</secondary>
57916 </indexterm>
57917 <indexterm role="variable">
57918 <primary><varname>$recipient_verify_failure</varname></primary>
57919 </indexterm>
57920 <indexterm role="variable">
57921 <primary><varname>$sender_verify_failure</varname></primary>
57922 </indexterm>
57923 <indexterm role="variable">
57924 <primary><varname>$acl_verify_message</varname></primary>
57925 </indexterm>
57926 After an address verification failure, <varname>$acl_verify_message</varname> contains the
57927 error message that is associated with the failure. It can be preserved by
57928 coding like this:
57929 </para>
57930 <literallayout class="monospaced">
57931 warn  !verify = sender
57932        set acl_m0 = $acl_verify_message
57933 </literallayout>
57934 <para>
57935 If you are writing your own custom rejection message or log message when
57936 denying access, you can use this variable to include information about the
57937 verification failure.
57938 </para>
57939 <para>
57940 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
57941 appropriate) contains one of the following words:
57942 </para>
57943 <itemizedlist>
57944 <listitem>
57945 <para>
57946 <option>qualify</option>: The address was unqualified (no domain), and the message
57947 was neither local nor came from an exempted host.
57948 </para>
57949 </listitem>
57950 <listitem>
57951 <para>
57952 <option>route</option>: Routing failed.
57953 </para>
57954 </listitem>
57955 <listitem>
57956 <para>
57957 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
57958 occurred at or before the MAIL command (that is, on initial
57959 connection, HELO, or MAIL).
57960 </para>
57961 </listitem>
57962 <listitem>
57963 <para>
57964 <option>recipient</option>: The RCPT command in a callout was rejected.
57965 </para>
57966 </listitem>
57967 <listitem>
57968 <para>
57969 <option>postmaster</option>: The postmaster check in a callout was rejected.
57970 </para>
57971 </listitem>
57972 </itemizedlist>
57973 <para>
57974 The main use of these variables is expected to be to distinguish between
57975 rejections of MAIL and rejections of RCPT in callouts.
57976 </para>
57977 </section>
57978 <section id="SECTcallver">
57979 <title>Callout verification</title>
57980 <para>
57981 <indexterm role="concept">
57982 <primary>verifying address</primary>
57983 <secondary>by callout</secondary>
57984 </indexterm>
57985 <indexterm role="concept">
57986 <primary>callout</primary>
57987 <secondary>verification</secondary>
57988 </indexterm>
57989 <indexterm role="concept">
57990 <primary>SMTP</primary>
57991 <secondary>callout verification</secondary>
57992 </indexterm>
57993 For non-local addresses, routing verifies the domain, but is unable to do any
57994 checking of the local part. There are situations where some means of verifying
57995 the local part is desirable. One way this can be done is to make an SMTP
57996 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
57997 a subsequent host for a recipient address, to see if the host accepts the
57998 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
57999 sender address, the callback is not to the client host that is trying to
58000 deliver the message, but to one of the hosts that accepts incoming mail for the
58001 sender&#x2019;s domain.
58002 </para>
58003 <para>
58004 Exim does not do callouts by default. If you want them to happen, you must
58005 request them by setting appropriate options on the <option>verify</option> condition, as
58006 described below. This facility should be used with care, because it can add a
58007 lot of resource usage to the cost of verifying an address. However, Exim does
58008 cache the results of callouts, which helps to reduce the cost. Details of
58009 caching are in section <xref linkend="SECTcallvercache"/>.
58010 </para>
58011 <para>
58012 Recipient callouts are usually used only between hosts that are controlled by
58013 the same administration. For example, a corporate gateway host could use
58014 callouts to check for valid recipients on an internal mailserver. A successful
58015 callout does not guarantee that a real delivery to the address would succeed;
58016 on the other hand, a failing callout does guarantee that a delivery would fail.
58017 </para>
58018 <para>
58019 If the <option>callout</option> option is present on a condition that verifies an address, a
58020 second stage of verification occurs if the address is successfully routed to
58021 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
58022 <command>manualroute</command> router, where the router specifies the hosts. However, if a
58023 router that does not set up hosts routes to an <command>smtp</command> transport with a
58024 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
58025 <option>hosts_override</option> set, its hosts are always used, whether or not the router
58026 supplies a host list.
58027 Callouts are only supported on <command>smtp</command> transports.
58028 </para>
58029 <para>
58030 The port that is used is taken from the transport, if it is specified and is a
58031 remote transport. (For routers that do verification only, no transport need be
58032 specified.) Otherwise, the default SMTP port is used. If a remote transport
58033 specifies an outgoing interface, this is used; otherwise the interface is not
58034 specified. Likewise, the text that is used for the HELO command is taken from
58035 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
58036 <varname>$smtp_active_hostname</varname> is used.
58037 </para>
58038 <para>
58039 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
58040 test whether a bounce message could be delivered to the sender address. The
58041 following SMTP commands are sent:
58042 </para>
58043 <literallayout>
58044 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
58045 <literal>MAIL FROM:&lt;&gt;</literal>
58046 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
58047 <literal>QUIT</literal>
58048 </literallayout>
58049 <para>
58050 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
58051 set to <quote>lmtp</quote>.
58052 </para>
58053 <para>
58054 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
58055 settings.
58056 </para>
58057 <para>
58058 A recipient callout check is similar. By default, it also uses an empty address
58059 for the sender. This default is chosen because most hosts do not make use of
58060 the sender address when verifying a recipient. Using the same address means
58061 that a single cache entry can be used for each recipient. Some sites, however,
58062 do make use of the sender address when verifying. These are catered for by the
58063 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
58064 </para>
58065 <para>
58066 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
58067 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
58068 Exim tries the next host, if any. If there is a problem with all the remote
58069 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
58070 <option>callout</option> option is given, in which case the condition is forced to succeed.
58071 </para>
58072 <para>
58073 <indexterm role="concept">
58074 <primary>SMTP</primary>
58075 <secondary>output flushing, disabling for callout</secondary>
58076 </indexterm>
58077 A callout may take a little time. For this reason, Exim normally flushes SMTP
58078 output before performing a callout in an ACL, to avoid unexpected timeouts in
58079 clients when the SMTP PIPELINING extension is in use. The flushing can be
58080 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
58081 </para>
58082 </section>
58083 <section id="CALLaddparcall">
58084 <title>Additional parameters for callouts</title>
58085 <para>
58086 <indexterm role="concept">
58087 <primary>callout</primary>
58088 <secondary>additional parameters for</secondary>
58089 </indexterm>
58090 The <option>callout</option> option can be followed by an equals sign and a number of
58091 optional parameters, separated by commas. For example:
58092 </para>
58093 <literallayout class="monospaced">
58094 verify = recipient/callout=10s,defer_ok
58095 </literallayout>
58096 <para>
58097 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
58098 separate verify options, is retained for backwards compatibility, but is now
58099 deprecated. The additional parameters for <option>callout</option> are as follows:
58100 </para>
58101 <variablelist>
58102 <varlistentry>
58103 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
58104 <listitem>
58105 <para>
58106 <indexterm role="concept">
58107 <primary>callout</primary>
58108 <secondary>timeout, specifying</secondary>
58109 </indexterm>
58110 This specifies the timeout that applies for the callout attempt to each host.
58111 For example:
58112 </para>
58113 <literallayout class="monospaced">
58114 verify = sender/callout=5s
58115 </literallayout>
58116 <para>
58117 The default is 30 seconds. The timeout is used for each response from the
58118 remote host. It is also used for the initial connection, unless overridden by
58119 the <option>connect</option> parameter.
58120 </para>
58121 </listitem></varlistentry>
58122 <varlistentry>
58123 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58124 <listitem>
58125 <para>
58126 <indexterm role="concept">
58127 <primary>callout</primary>
58128 <secondary>connection timeout, specifying</secondary>
58129 </indexterm>
58130 This parameter makes it possible to set a different (usually smaller) timeout
58131 for making the SMTP connection. For example:
58132 </para>
58133 <literallayout class="monospaced">
58134 verify = sender/callout=5s,connect=1s
58135 </literallayout>
58136 <para>
58137 If not specified, this timeout defaults to the general timeout value.
58138 </para>
58139 </listitem></varlistentry>
58140 <varlistentry>
58141 <term><emphasis role="bold">defer_ok</emphasis></term>
58142 <listitem>
58143 <para>
58144 <indexterm role="concept">
58145 <primary>callout</primary>
58146 <secondary>defer, action on</secondary>
58147 </indexterm>
58148 When this parameter is present, failure to contact any host, or any other kind
58149 of temporary error, is treated as success by the ACL. However, the cache is not
58150 updated in this circumstance.
58151 </para>
58152 </listitem></varlistentry>
58153 <varlistentry>
58154 <term><emphasis role="bold">fullpostmaster</emphasis></term>
58155 <listitem>
58156 <para>
58157 <indexterm role="concept">
58158 <primary>callout</primary>
58159 <secondary>full postmaster check</secondary>
58160 </indexterm>
58161 This operates like the <option>postmaster</option> option (see below), but if the check for
58162 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
58163 accordance with the specification in RFC 2821. The RFC states that the
58164 unqualified address <emphasis>postmaster</emphasis> should be accepted.
58165 </para>
58166 </listitem></varlistentry>
58167 <varlistentry>
58168 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58169 <listitem>
58170 <para>
58171 <indexterm role="concept">
58172 <primary>callout</primary>
58173 <secondary>sender when verifying header</secondary>
58174 </indexterm>
58175 When verifying addresses in header lines using the <option>header_sender</option>
58176 verification option, Exim behaves by default as if the addresses are envelope
58177 sender addresses from a message. Callout verification therefore tests to see
58178 whether a bounce message could be delivered, by using an empty address in the
58179 MAIL command. However, it is arguable that these addresses might never be used
58180 as envelope senders, and could therefore justifiably reject bounce messages
58181 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
58182 address to use in the MAIL command. For example:
58183 </para>
58184 <literallayout class="monospaced">
58185 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
58186 </literallayout>
58187 <para>
58188 This parameter is available only for the <option>header_sender</option> verification option.
58189 </para>
58190 </listitem></varlistentry>
58191 <varlistentry>
58192 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58193 <listitem>
58194 <para>
58195 <indexterm role="concept">
58196 <primary>callout</primary>
58197 <secondary>overall timeout, specifying</secondary>
58198 </indexterm>
58199 This parameter sets an overall timeout for performing a callout verification.
58200 For example:
58201 </para>
58202 <literallayout class="monospaced">
58203 verify = sender/callout=5s,maxwait=30s
58204 </literallayout>
58205 <para>
58206 This timeout defaults to four times the callout timeout for individual SMTP
58207 commands. The overall timeout applies when there is more than one host that can
58208 be tried. The timeout is checked before trying the next host. This prevents
58209 very long delays if there are a large number of hosts and all are timing out
58210 (for example, when network connections are timing out).
58211 </para>
58212 </listitem></varlistentry>
58213 <varlistentry>
58214 <term><emphasis role="bold">no_cache</emphasis></term>
58215 <listitem>
58216 <para>
58217 <indexterm role="concept">
58218 <primary>callout</primary>
58219 <secondary>cache, suppressing</secondary>
58220 </indexterm>
58221 <indexterm role="concept">
58222 <primary>caching callout, suppressing</primary>
58223 </indexterm>
58224 When this parameter is given, the callout cache is neither read nor updated.
58225 </para>
58226 </listitem></varlistentry>
58227 <varlistentry>
58228 <term><emphasis role="bold">postmaster</emphasis></term>
58229 <listitem>
58230 <para>
58231 <indexterm role="concept">
58232 <primary>callout</primary>
58233 <secondary>postmaster; checking</secondary>
58234 </indexterm>
58235 When this parameter is set, a successful callout check is followed by a similar
58236 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
58237 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
58238 the postmaster check is recorded in a cache record; if it is a failure, this is
58239 used to fail subsequent callouts for the domain without a connection being
58240 made, until the cache record expires.
58241 </para>
58242 </listitem></varlistentry>
58243 <varlistentry>
58244 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58245 <listitem>
58246 <para>
58247 The postmaster check uses an empty sender in the MAIL command by default.
58248 You can use this parameter to do a postmaster check using a different address.
58249 For example:
58250 </para>
58251 <literallayout class="monospaced">
58252 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
58253 </literallayout>
58254 <para>
58255 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
58256 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
58257 </para>
58258 <literallayout class="monospaced">
58259 require  verify = sender/callout=postmaster_mailfrom=
58260 </literallayout>
58261 <para>
58262 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
58263 account of the sender address. It is assumed that either the empty address or
58264 a fixed non-empty address will be used. All that Exim remembers is that the
58265 postmaster check for the domain succeeded or failed.
58266 </para>
58267 </listitem></varlistentry>
58268 <varlistentry>
58269 <term><emphasis role="bold">random</emphasis></term>
58270 <listitem>
58271 <para>
58272 <indexterm role="concept">
58273 <primary>callout</primary>
58274 <secondary><quote>random</quote> check</secondary>
58275 </indexterm>
58276 When this parameter is set, before doing the normal callout check, Exim does a
58277 check for a <quote>random</quote> local part at the same domain. The local part is not
58278 really random &ndash; it is defined by the expansion of the option
58279 <option>callout_random_local_part</option>, which defaults to
58280 </para>
58281 <literallayout class="monospaced">
58282 $primary_hostname-$tod_epoch-testing
58283 </literallayout>
58284 <para>
58285 The idea here is to try to determine whether the remote host accepts all local
58286 parts without checking. If it does, there is no point in doing callouts for
58287 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
58288 a cache record, and used to force the current and subsequent callout checks to
58289 succeed without a connection being made, until the cache record expires.
58290 </para>
58291 </listitem></varlistentry>
58292 <varlistentry>
58293 <term><emphasis role="bold">use_postmaster</emphasis></term>
58294 <listitem>
58295 <para>
58296 <indexterm role="concept">
58297 <primary>callout</primary>
58298 <secondary>sender for recipient check</secondary>
58299 </indexterm>
58300 This parameter applies to recipient callouts only. For example:
58301 </para>
58302 <literallayout class="monospaced">
58303 deny  !verify = recipient/callout=use_postmaster
58304 </literallayout>
58305 <para>
58306 <indexterm role="variable">
58307 <primary><varname>$qualify_domain</varname></primary>
58308 </indexterm>
58309 It causes a non-empty postmaster address to be used in the MAIL command when
58310 performing the callout for the recipient, and also for a <quote>random</quote> check if
58311 that is configured. The local part of the address is <literal>postmaster</literal> and the
58312 domain is the contents of <varname>$qualify_domain</varname>.
58313 </para>
58314 </listitem></varlistentry>
58315 <varlistentry>
58316 <term><emphasis role="bold">use_sender</emphasis></term>
58317 <listitem>
58318 <para>
58319 This option applies to recipient callouts only. For example:
58320 </para>
58321 <literallayout class="monospaced">
58322 require  verify = recipient/callout=use_sender
58323 </literallayout>
58324 <para>
58325 It causes the message&#x2019;s actual sender address to be used in the MAIL
58326 command when performing the callout, instead of an empty address. There is no
58327 need to use this option unless you know that the called hosts make use of the
58328 sender when checking recipients. If used indiscriminately, it reduces the
58329 usefulness of callout caching.
58330 </para>
58331 </listitem></varlistentry>
58332 </variablelist>
58333 <para>
58334 If you use any of the parameters that set a non-empty sender for the MAIL
58335 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
58336 <option>use_sender</option>), you should think about possible loops. Recipient checking is
58337 usually done between two hosts that are under the same management, and the host
58338 that receives the callouts is not normally configured to do callouts itself.
58339 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
58340 these circumstances.
58341 </para>
58342 <para>
58343 However, if you use a non-empty sender address for a callout to an arbitrary
58344 host, there is the likelihood that the remote host will itself initiate a
58345 callout check back to your host. As it is checking what appears to be a message
58346 sender, it is likely to use an empty address in MAIL, thus avoiding a
58347 callout loop. However, to be on the safe side it would be best to set up your
58348 own ACLs so that they do not do sender verification checks when the recipient
58349 is the address you use for header sender or postmaster callout checking.
58350 </para>
58351 <para>
58352 Another issue to think about when using non-empty senders for callouts is
58353 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
58354 by the sender/recipient combination; thus, for any given recipient, many more
58355 actual callouts are performed than when an empty sender or postmaster is used.
58356 </para>
58357 </section>
58358 <section id="SECTcallvercache">
58359 <title>Callout caching</title>
58360 <para>
58361 <indexterm role="concept">
58362 <primary>hints database</primary>
58363 <secondary>callout cache</secondary>
58364 </indexterm>
58365 <indexterm role="concept">
58366 <primary>callout</primary>
58367 <secondary>cache, description of</secondary>
58368 </indexterm>
58369 <indexterm role="concept">
58370 <primary>caching</primary>
58371 <secondary>callout</secondary>
58372 </indexterm>
58373 Exim caches the results of callouts in order to reduce the amount of resources
58374 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
58375 option. A hints database called <quote>callout</quote> is used for the cache. Two
58376 different record types are used: one records the result of a callout check for
58377 a specific address, and the other records information that applies to the
58378 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
58379 </para>
58380 <para>
58381 When an original callout fails, a detailed SMTP error message is given about
58382 the failure. However, for subsequent failures use the cache data, this message
58383 is not available.
58384 </para>
58385 <para>
58386 The expiry times for negative and positive address cache records are
58387 independent, and can be set by the global options <option>callout_negative_expire</option>
58388 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
58389 </para>
58390 <para>
58391 If a host gives a negative response to an SMTP connection, or rejects any
58392 commands up to and including
58393 </para>
58394 <literallayout class="monospaced">
58395 MAIL FROM:&lt;&gt;
58396 </literallayout>
58397 <para>
58398 (but not including the MAIL command with a non-empty address),
58399 any callout attempt is bound to fail. Exim remembers such failures in a
58400 domain cache record, which it uses to fail callouts for the domain without
58401 making new connections, until the domain record times out. There are two
58402 separate expiry times for domain cache records:
58403 <option>callout_domain_negative_expire</option> (default 3h) and
58404 <option>callout_domain_positive_expire</option> (default 7d).
58405 </para>
58406 <para>
58407 Domain records expire when the negative expiry time is reached if callouts
58408 cannot be made for the domain, or if the postmaster check failed.
58409 Otherwise, they expire when the positive expiry time is reached. This
58410 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
58411 will eventually be noticed.
58412 </para>
58413 <para>
58414 The callout caching mechanism is based on the domain of the address that is
58415 being tested. If the domain routes to several hosts, it is assumed that their
58416 behaviour will be the same.
58417 </para>
58418 </section>
58419 <section id="SECTsenaddver">
58420 <title>Sender address verification reporting</title>
58421 <para>
58422 <indexterm role="concept">
58423 <primary>verifying</primary>
58424 <secondary>suppressing error details</secondary>
58425 </indexterm>
58426 See section <xref linkend="SECTaddressverification"/> for a general discussion of
58427 verification. When sender verification fails in an ACL, the details of the
58428 failure are given as additional output lines before the 550 response to the
58429 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
58430 you might see:
58431 </para>
58432 <literallayout class="monospaced">
58433 MAIL FROM:&lt;xyz@abc.example&gt;
58434 250 OK
58435 RCPT TO:&lt;pqr@def.example&gt;
58436 550-Verification failed for &lt;xyz@abc.example&gt;
58437 550-Called:   192.168.34.43
58438 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
58439 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
58440 550 Sender verification failed
58441 </literallayout>
58442 <para>
58443 If more than one RCPT command fails in the same way, the details are given
58444 only for the first of them. However, some administrators do not want to send
58445 out this much information. You can suppress the details by adding
58446 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
58447 example:
58448 </para>
58449 <literallayout class="monospaced">
58450 verify = sender/no_details
58451 </literallayout>
58452 </section>
58453 <section id="SECTredirwhilveri">
58454 <title>Redirection while verifying</title>
58455 <para>
58456 <indexterm role="concept">
58457 <primary>verifying</primary>
58458 <secondary>redirection while</secondary>
58459 </indexterm>
58460 <indexterm role="concept">
58461 <primary>address redirection</primary>
58462 <secondary>while verifying</secondary>
58463 </indexterm>
58464 A dilemma arises when a local address is redirected by aliasing or forwarding
58465 during verification: should the generated addresses themselves be verified,
58466 or should the successful expansion of the original address be enough to verify
58467 it? By default, Exim takes the following pragmatic approach:
58468 </para>
58469 <itemizedlist>
58470 <listitem>
58471 <para>
58472 When an incoming address is redirected to just one child address, verification
58473 continues with the child address, and if that fails to verify, the original
58474 verification also fails.
58475 </para>
58476 </listitem>
58477 <listitem>
58478 <para>
58479 When an incoming address is redirected to more than one child address,
58480 verification does not continue. A success result is returned.
58481 </para>
58482 </listitem>
58483 </itemizedlist>
58484 <para>
58485 This seems the most reasonable behaviour for the common use of aliasing as a
58486 way of redirecting different local parts to the same mailbox. It means, for
58487 example, that a pair of alias entries of the form
58488 </para>
58489 <literallayout class="monospaced">
58490 A.Wol:   aw123
58491 aw123:   :fail: Gone away, no forwarding address
58492 </literallayout>
58493 <para>
58494 work as expected, with both local parts causing verification failure. When a
58495 redirection generates more than one address, the behaviour is more like a
58496 mailing list, where the existence of the alias itself is sufficient for
58497 verification to succeed.
58498 </para>
58499 <para>
58500 It is possible, however, to change the default behaviour so that all successful
58501 redirections count as successful verifications, however many new addresses are
58502 generated. This is specified by the <option>success_on_redirect</option> verification
58503 option. For example:
58504 </para>
58505 <literallayout class="monospaced">
58506 require verify = recipient/success_on_redirect/callout=10s
58507 </literallayout>
58508 <para>
58509 In this example, verification succeeds if a router generates a new address, and
58510 the callout does not occur, because no address was routed to a remote host.
58511 </para>
58512 <para>
58513 When verification is being tested via the <option>-bv</option> option, the treatment of
58514 redirections is as just described, unless the <option>-v</option> or any debugging option is
58515 also specified. In that case, full verification is done for every generated
58516 address and a report is output for each of them.
58517 </para>
58518 </section>
58519 <section id="SECTverifyCSA">
58520 <title>Client SMTP authorization (CSA)</title>
58521 <para>
58522 <indexterm role="concept">
58523 <primary>CSA</primary>
58524 <secondary>verifying</secondary>
58525 </indexterm>
58526 Client SMTP Authorization is a system that allows a site to advertise
58527 which machines are and are not permitted to send email. This is done by placing
58528 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
58529 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
58530 Authorization checks in Exim are performed by the ACL condition:
58531 </para>
58532 <literallayout class="monospaced">
58533 verify = csa
58534 </literallayout>
58535 <para>
58536 This fails if the client is not authorized. If there is a DNS problem, or if no
58537 valid CSA SRV record is found, or if the client is authorized, the condition
58538 succeeds. These three cases can be distinguished using the expansion variable
58539 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
58540 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
58541 be likely to cause problems for legitimate email.
58542 </para>
58543 <para>
58544 The error messages produced by the CSA code include slightly more
58545 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
58546 looking up the CSA SRV record, or problems looking up the CSA target
58547 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
58548 </para>
58549 <itemizedlist>
58550 <listitem>
58551 <para>
58552 The client&#x2019;s host name is explicitly not authorized.
58553 </para>
58554 </listitem>
58555 <listitem>
58556 <para>
58557 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
58558 </para>
58559 </listitem>
58560 <listitem>
58561 <para>
58562 The client&#x2019;s host name is authorized but it has no valid target IP addresses
58563 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
58564 </para>
58565 </listitem>
58566 <listitem>
58567 <para>
58568 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
58569 that all subdomains must be explicitly authorized.
58570 </para>
58571 </listitem>
58572 </itemizedlist>
58573 <para>
58574 The <option>csa</option> verification condition can take an argument which is the domain to
58575 use for the DNS query. The default is:
58576 </para>
58577 <literallayout class="monospaced">
58578 verify = csa/$sender_helo_name
58579 </literallayout>
58580 <para>
58581 This implementation includes an extension to CSA. If the query domain
58582 is an address literal such as [192.0.2.95], or if it is a bare IP
58583 address, Exim searches for CSA SRV records in the reverse DNS as if
58584 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
58585 meaningful to say:
58586 </para>
58587 <literallayout class="monospaced">
58588 verify = csa/$sender_host_address
58589 </literallayout>
58590 <para>
58591 In fact, this is the check that Exim performs if the client does not say HELO.
58592 This extension can be turned off by setting the main configuration option
58593 <option>dns_csa_use_reverse</option> to be false.
58594 </para>
58595 <para>
58596 If a CSA SRV record is not found for the domain itself, a search
58597 is performed through its parent domains for a record which might be
58598 making assertions about subdomains. The maximum depth of this search is limited
58599 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
58600 default. Exim does not look for CSA SRV records in a top level domain, so the
58601 default settings handle HELO domains as long as seven
58602 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
58603 of legitimate HELO domains.
58604 </para>
58605 <para>
58606 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
58607 direct SRV lookups, this is not sufficient because of the extra parent domain
58608 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
58609 addresses into lookups in the reverse DNS space. The result of a successful
58610 lookup such as:
58611 </para>
58612 <literallayout class="monospaced">
58613 ${lookup dnsdb {csa=$sender_helo_name}}
58614 </literallayout>
58615 <para>
58616 has two space-separated fields: an authorization code and a target host name.
58617 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
58618 authorization required but absent, or <quote>?</quote> for unknown.
58619 </para>
58620 </section>
58621 <section id="SECTverifyPRVS">
58622 <title>Bounce address tag validation</title>
58623 <para>
58624 <indexterm role="concept">
58625 <primary>BATV, verifying</primary>
58626 </indexterm>
58627 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
58628 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
58629 Genuine incoming bounce messages should therefore always be addressed to
58630 recipients that have a valid tag. This scheme is a way of detecting unwanted
58631 bounce messages caused by sender address forgeries (often called <quote>collateral
58632 spam</quote>), because the recipients of such messages do not include valid tags.
58633 </para>
58634 <para>
58635 There are two expansion items to help with the implementation of the BATV
58636 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
58637 the original envelope sender address by using a simple key to add a hash of the
58638 address and some time-based randomizing information. The <option>prvs</option> expansion
58639 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
58640 The syntax of these expansion items is described in section
58641 <xref linkend="SECTexpansionitems"/>.
58642 </para>
58643 <para>
58644 As an example, suppose the secret per-address keys are stored in an MySQL
58645 database. A query to look up the key for an address could be defined as a macro
58646 like this:
58647 </para>
58648 <literallayout class="monospaced">
58649 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
58650                 WHERE sender='${quote_mysql:$prvscheck_address}'\
58651                 }{$value}}
58652 </literallayout>
58653 <para>
58654 Suppose also that the senders who make use of BATV are defined by an address
58655 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
58656 use this:
58657 </para>
58658 <literallayout class="monospaced">
58659 # Bounces: drop unsigned addresses for BATV senders
58660 deny message = This address does not send an unsigned reverse path
58661      senders = :
58662      recipients = +batv_senders
58663
58664 # Bounces: In case of prvs-signed address, check signature.
58665 deny message = Invalid reverse path signature.
58666      senders = :
58667      condition  = ${prvscheck {$local_part@$domain}\
58668                   {PRVSCHECK_SQL}{1}}
58669      !condition = $prvscheck_result
58670 </literallayout>
58671 <para>
58672 The first statement rejects recipients for bounce messages that are addressed
58673 to plain BATV sender addresses, because it is known that BATV senders do not
58674 send out messages with plain sender addresses. The second statement rejects
58675 recipients that are prvs-signed, but with invalid signatures (either because
58676 the key is wrong, or the signature has timed out).
58677 </para>
58678 <para>
58679 A non-prvs-signed address is not rejected by the second statement, because the
58680 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
58681 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
58682 the first argument is a syntactically valid prvs-signed address, the yield is
58683 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
58684 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
58685 of the checks (empty for failure, <quote>1</quote> for success).
58686 </para>
58687 <para>
58688 There is one more issue you must consider when implementing prvs-signing:
58689 you have to ensure that the routers accept prvs-signed addresses and
58690 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
58691 router to remove the signature with a configuration along these lines:
58692 </para>
58693 <literallayout class="monospaced">
58694 batv_redirect:
58695   driver = redirect
58696   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
58697 </literallayout>
58698 <para>
58699 This works because, if the third argument of <option>prvscheck</option> is empty, the result
58700 of the expansion of a prvs-signed address is the decoded value of the original
58701 address. This router should probably be the first of your routers that handles
58702 local addresses.
58703 </para>
58704 <para>
58705 To create BATV-signed addresses in the first place, a transport of this form
58706 can be used:
58707 </para>
58708 <literallayout class="monospaced">
58709 external_smtp_batv:
58710   driver = smtp
58711   return_path = ${prvs {$return_path} \
58712                        {${lookup mysql{SELECT \
58713                        secret FROM batv_prvs WHERE \
58714                        sender='${quote_mysql:$sender_address}'} \
58715                        {$value}fail}}}
58716 </literallayout>
58717 <para>
58718 If no key can be found for the existing return path, no signing takes place.
58719 </para>
58720 </section>
58721 <section id="SECTrelaycontrol">
58722 <title>Using an ACL to control relaying</title>
58723 <para>
58724 <indexterm role="concept">
58725 <primary>access control lists (ACLs)</primary>
58726 <secondary>relay control</secondary>
58727 </indexterm>
58728 <indexterm role="concept">
58729 <primary>relaying</primary>
58730 <secondary>control by ACL</secondary>
58731 </indexterm>
58732 <indexterm role="concept">
58733 <primary>policy control</primary>
58734 <secondary>relay control</secondary>
58735 </indexterm>
58736 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
58737 delivers it directly to another host as a result of a remote address contained
58738 within it. Redirecting a local address via an alias or forward file and then
58739 passing the message on to another host is not relaying,
58740 <indexterm role="concept">
58741 <primary><quote>percent hack</quote></primary>
58742 </indexterm>
58743 but a redirection as a result of the <quote>percent hack</quote> is.
58744 </para>
58745 <para>
58746 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
58747 A host which is acting as a gateway or an MX backup is concerned with incoming
58748 relaying from arbitrary hosts to a specific set of domains. On the other hand,
58749 a host which is acting as a smart host for a number of clients is concerned
58750 with outgoing relaying from those clients to the Internet at large. Often the
58751 same host is fulfilling both functions,
58752 but in principle these two kinds of relaying are entirely independent. What is
58753 not wanted is the transmission of mail from arbitrary remote hosts through your
58754 system to arbitrary domains.
58755 </para>
58756 <para>
58757 You can implement relay control by means of suitable statements in the ACL that
58758 runs for each RCPT command. For convenience, it is often easiest to use
58759 Exim&#x2019;s named list facility to define the domains and hosts involved. For
58760 example, suppose you want to do the following:
58761 </para>
58762 <itemizedlist>
58763 <listitem>
58764 <para>
58765 Deliver a number of domains to mailboxes on the local host (or process them
58766 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
58767 <emphasis>my.dom2.example</emphasis>.
58768 </para>
58769 </listitem>
58770 <listitem>
58771 <para>
58772 Relay mail for a number of other domains for which you are the secondary MX.
58773 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
58774 </para>
58775 </listitem>
58776 <listitem>
58777 <para>
58778 Relay mail from the hosts on your local LAN, to whatever domains are involved.
58779 Suppose your LAN is 192.168.45.0/24.
58780 </para>
58781 </listitem>
58782 </itemizedlist>
58783 <para>
58784 In the main part of the configuration, you put the following definitions:
58785 </para>
58786 <literallayout class="monospaced">
58787 domainlist local_domains    = my.dom1.example : my.dom2.example
58788 domainlist relay_to_domains = friend1.example : friend2.example
58789 hostlist   relay_from_hosts = 192.168.45.0/24
58790 </literallayout>
58791 <para>
58792 Now you can use these definitions in the ACL that is run for every RCPT
58793 command:
58794 </para>
58795 <literallayout class="monospaced">
58796 acl_check_rcpt:
58797   accept domains = +local_domains : +relay_to_domains
58798   accept hosts   = +relay_from_hosts
58799 </literallayout>
58800 <para>
58801 The first statement accepts any RCPT command that contains an address in
58802 the local or relay domains. For any other domain, control passes to the second
58803 statement, which accepts the command only if it comes from one of the relay
58804 hosts. In practice, you will probably want to make your ACL more sophisticated
58805 than this, for example, by including sender and recipient verification. The
58806 default configuration includes a more comprehensive example, which is described
58807 in chapter <xref linkend="CHAPdefconfil"/>.
58808 </para>
58809 </section>
58810 <section id="SECTcheralcon">
58811 <title>Checking a relay configuration</title>
58812 <para>
58813 <indexterm role="concept">
58814 <primary>relaying</primary>
58815 <secondary>checking control of</secondary>
58816 </indexterm>
58817 You can check the relay characteristics of your configuration in the same way
58818 that you can test any ACL behaviour for an incoming SMTP connection, by using
58819 the <option>-bh</option> option to run a fake SMTP session with which you interact.
58820 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
58821 </para>
58822 </section>
58823 </chapter>
58824
58825 <chapter id="CHAPexiscan">
58826 <title>Content scanning at ACL time</title>
58827 <para>
58828 <indexterm role="concept" id="IIDcosca" class="startofrange">
58829 <primary>content scanning</primary>
58830 <secondary>at ACL time</secondary>
58831 </indexterm>
58832 The extension of Exim to include content scanning at ACL time, formerly known
58833 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
58834 was integrated into the main source for Exim release 4.50, and Tom continues to
58835 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
58836 specification.
58837 </para>
58838 <para>
58839 It is also possible to scan the content of messages at other times. The
58840 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
58841 scanning after all the ACLs have run. A transport filter can be used to scan
58842 messages at delivery time (see the <option>transport_filter</option> option, described in
58843 chapter <xref linkend="CHAPtransportgeneric"/>).
58844 </para>
58845 <para>
58846 If you want to include the ACL-time content-scanning features when you compile
58847 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
58848 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
58849 </para>
58850 <itemizedlist>
58851 <listitem>
58852 <para>
58853 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
58854 for all MIME parts for SMTP and non-SMTP messages, respectively.
58855 </para>
58856 </listitem>
58857 <listitem>
58858 <para>
58859 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
58860 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
58861 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
58862 </para>
58863 </listitem>
58864 <listitem>
58865 <para>
58866 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
58867 of messages, or parts of messages, for debugging purposes.
58868 </para>
58869 </listitem>
58870 <listitem>
58871 <para>
58872 Additional expansion variables that are set in the new ACL and by the new
58873 conditions.
58874 </para>
58875 </listitem>
58876 <listitem>
58877 <para>
58878 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
58879 </para>
58880 </listitem>
58881 </itemizedlist>
58882 <para>
58883 Content-scanning is continually evolving, and new features are still being
58884 added. While such features are still unstable and liable to incompatible
58885 changes, they are made available in Exim by setting options whose names begin
58886 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
58887 this manual. You can find out about them by reading the file called
58888 <filename>doc/experimental.txt</filename>.
58889 </para>
58890 <para>
58891 All the content-scanning facilities work on a MBOX copy of the message that is
58892 temporarily created in a file called:
58893 </para>
58894 <literallayout>
58895 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
58896 </literallayout>
58897 <para>
58898 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
58899 expect an MBOX-like structure inside that file. The file is created when the
58900 first content scanning facility is called. Subsequent calls to content
58901 scanning conditions open the same file again. The directory is recursively
58902 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
58903 </para>
58904 <literallayout class="monospaced">
58905 control = no_mbox_unspool
58906 </literallayout>
58907 <para>
58908 has been encountered. When the MIME ACL decodes files, they are put into the
58909 same directory by default.
58910 </para>
58911 <section id="SECTscanvirus">
58912 <title>Scanning for viruses</title>
58913 <para>
58914 <indexterm role="concept">
58915 <primary>virus scanning</primary>
58916 </indexterm>
58917 <indexterm role="concept">
58918 <primary>content scanning</primary>
58919 <secondary>for viruses</secondary>
58920 </indexterm>
58921 <indexterm role="concept">
58922 <primary>content scanning</primary>
58923 <secondary>the <option>malware</option> condition</secondary>
58924 </indexterm>
58925 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
58926 It supports a <quote>generic</quote> interface to scanners called via the shell, and
58927 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
58928 in memory and thus are much faster.
58929 </para>
58930 <para>
58931 A timeout of 2 minutes is applied to a scanner call (by default);
58932 if it expires then a defer action is taken.
58933 </para>
58934 <para>
58935 <indexterm role="option">
58936 <primary><option>av_scanner</option></primary>
58937 </indexterm>
58938 You can set the <option>av_scanner</option> option in the main part of the configuration
58939 to specify which scanner to use, together with any additional options that
58940 are needed. The basic syntax is as follows:
58941 </para>
58942 <literallayout>
58943 <literal>av_scanner = &lt;</literal><emphasis>scanner-type</emphasis><literal>&gt;:&lt;</literal><emphasis>option1</emphasis><literal>&gt;:&lt;</literal><emphasis>option2</emphasis><literal>&gt;:[...]</literal>
58944 </literallayout>
58945 <para>
58946 If you do not set <option>av_scanner</option>, it defaults to
58947 </para>
58948 <literallayout class="monospaced">
58949 av_scanner = sophie:/var/run/sophie
58950 </literallayout>
58951 <para>
58952 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
58953 before use.
58954 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
58955 The following scanner types are supported in this release:
58956 </para>
58957 <variablelist>
58958 <varlistentry>
58959 <term><option>avast</option></term>
58960 <listitem>
58961 <para>
58962 <indexterm role="concept">
58963 <primary>virus scanners</primary>
58964 <secondary>avast</secondary>
58965 </indexterm>
58966 This is the scanner daemon of Avast. It has been tested with Avast Core
58967 Security (currently at version 1.1.7).
58968 You can get a trial version at <emphasis role="bold"><ulink url="http://www.avast.com">http://www.avast.com</ulink></emphasis> or for Linux
58969 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
58970 This scanner type takes one option,
58971 which can be either a full path to a UNIX socket,
58972 or host and port specifiers separated by white space.
58973 The host may be a name or an IP address; the port is either a
58974 single number or a pair of numbers with a dash between.
58975 Any further options are given, on separate lines,
58976 to the daemon as options before the main scan command.
58977 For example:
58978 </para>
58979 <literallayout class="monospaced">
58980 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
58981 av_scanner = avast:192.168.2.22 5036
58982 </literallayout>
58983 <para>
58984 If you omit the argument, the default path
58985 <filename>/var/run/avast/scan.sock</filename>
58986 is used.
58987 If you use a remote host,
58988 you need to make Exim&#x2019;s spool directory available to it,
58989 as the scanner is passed a file path, not file contents.
58990 For information about available commands and their options you may use
58991 </para>
58992 <literallayout class="monospaced">
58993 $ socat UNIX:/var/run/avast/scan.sock STDIO:
58994     FLAGS
58995     SENSITIVITY
58996     PACK
58997 </literallayout>
58998 </listitem></varlistentry>
58999 <varlistentry>
59000 <term><option>aveserver</option></term>
59001 <listitem>
59002 <para>
59003 <indexterm role="concept">
59004 <primary>virus scanners</primary>
59005 <secondary>Kaspersky</secondary>
59006 </indexterm>
59007 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
59008 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
59009 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
59010 example:
59011 </para>
59012 <literallayout class="monospaced">
59013 av_scanner = aveserver:/var/run/aveserver
59014 </literallayout>
59015 </listitem></varlistentry>
59016 <varlistentry>
59017 <term><option>clamd</option></term>
59018 <listitem>
59019 <para>
59020 <indexterm role="concept">
59021 <primary>virus scanners</primary>
59022 <secondary>clamd</secondary>
59023 </indexterm>
59024 This daemon-type scanner is GPL and free. You can get it at
59025 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
59026 unpack MIME containers, so it used to be recommended to unpack MIME attachments
59027 in the MIME ACL. This is no longer believed to be necessary.
59028 </para>
59029 <para>
59030 The options are a list of server specifiers, which may be
59031 a UNIX socket specification,
59032 a TCP socket specification,
59033 or a (global) option.
59034 </para>
59035 <para>
59036 A socket specification consists of a space-separated list.
59037 For a Unix socket the first element is a full path for the socket,
59038 for a TCP socket the first element is the IP address
59039 and the second a port number,
59040 Any further elements are per-server (non-global) options.
59041 These per-server options are supported:
59042 </para>
59043 <literallayout class="monospaced">
59044 retry=&lt;timespec&gt;  Retry on connect fail
59045 </literallayout>
59046 <para>
59047 The <literal>retry</literal> option specifies a time after which a single retry for
59048 a failed connect is made.  The default is to not retry.
59049 </para>
59050 <para>
59051 If a Unix socket file is specified, only one server is supported.
59052 </para>
59053 <para>
59054 Examples:
59055 </para>
59056 <literallayout class="monospaced">
59057 av_scanner = clamd:/opt/clamd/socket
59058 av_scanner = clamd:192.0.2.3 1234
59059 av_scanner = clamd:192.0.2.3 1234:local
59060 av_scanner = clamd:192.0.2.3 1234 retry=10s
59061 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
59062 </literallayout>
59063 <para>
59064 If the value of av_scanner points to a UNIX socket file or contains the
59065 <literal>local</literal>
59066 option, then the ClamAV interface will pass a filename containing the data
59067 to be scanned, which will should normally result in less I/O happening and be
59068 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
59069 Exim does not assume that there is a common filesystem with the remote host.
59070 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
59071 you be running a version of ClamAV prior to 0.95.
59072 </para>
59073 <para>
59074 The final example shows that multiple TCP targets can be specified.  Exim will
59075 randomly use one for each incoming email (i.e. it load balances them).  Note
59076 that only TCP targets may be used if specifying a list of scanners; a UNIX
59077 socket cannot be mixed in with TCP targets.  If one of the servers becomes
59078 unavailable, Exim will try the remaining one(s) until it finds one that works.
59079 When a clamd server becomes unreachable, Exim will log a message.  Exim does
59080 not keep track of scanner state between multiple messages, and the scanner
59081 selection is random, so the message will get logged in the mainlog for each
59082 email that the down scanner gets chosen first (message wrapped to be readable):
59083 </para>
59084 <literallayout class="monospaced">
59085 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
59086    clamd: connection to localhost, port 3310 failed
59087    (Connection refused)
59088 </literallayout>
59089 <para>
59090 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
59091 contributing the code for this scanner.
59092 </para>
59093 </listitem></varlistentry>
59094 <varlistentry>
59095 <term><option>cmdline</option></term>
59096 <listitem>
59097 <para>
59098 <indexterm role="concept">
59099 <primary>virus scanners</primary>
59100 <secondary>command line interface</secondary>
59101 </indexterm>
59102 This is the keyword for the generic command line scanner interface. It can be
59103 used to attach virus scanners that are invoked from the shell. This scanner
59104 type takes 3 mandatory options:
59105 </para>
59106 <orderedlist numeration="arabic">
59107 <listitem>
59108 <para>
59109 The full path and name of the scanner binary, with all command line options,
59110 and a placeholder (<literal>%s</literal>) for the directory to scan.
59111 </para>
59112 </listitem>
59113 <listitem>
59114 <para>
59115 A regular expression to match against the STDOUT and STDERR output of the
59116 virus scanner. If the expression matches, a virus was found. You must make
59117 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
59118 the <quote>trigger</quote> expression.
59119 </para>
59120 </listitem>
59121 <listitem>
59122 <para>
59123 Another regular expression, containing exactly one pair of parentheses, to
59124 match the name of the virus found in the scanners output. This is called the
59125 <quote>name</quote> expression.
59126 </para>
59127 </listitem>
59128 </orderedlist>
59129 <para>
59130 For example, Sophos Sweep reports a virus on a line like this:
59131 </para>
59132 <literallayout class="monospaced">
59133 Virus 'W32/Magistr-B' found in file ./those.bat
59134 </literallayout>
59135 <para>
59136 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
59137 name expression, we want to extract the W32/Magistr-B string, so we can match
59138 for the single quotes left and right of it. Altogether, this makes the
59139 configuration setting:
59140 </para>
59141 <literallayout class="monospaced">
59142 av_scanner = cmdline:\
59143              /path/to/sweep -ss -all -rec -archive %s:\
59144              found in file:'(.+)'
59145 </literallayout>
59146 </listitem></varlistentry>
59147 <varlistentry>
59148 <term><option>drweb</option></term>
59149 <listitem>
59150 <para>
59151 <indexterm role="concept">
59152 <primary>virus scanners</primary>
59153 <secondary>DrWeb</secondary>
59154 </indexterm>
59155 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
59156 takes one option,
59157 either a full path to a UNIX socket,
59158 or host and port specifiers separated by white space.
59159 The host may be a name or an IP address; the port is either a
59160 single number or a pair of numbers with a dash between.
59161 For example:
59162 </para>
59163 <literallayout class="monospaced">
59164 av_scanner = drweb:/var/run/drwebd.sock
59165 av_scanner = drweb:192.168.2.20 31337
59166 </literallayout>
59167 <para>
59168 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
59169 is used. Thanks to Alex Miller for contributing the code for this scanner.
59170 </para>
59171 </listitem></varlistentry>
59172 <varlistentry>
59173 <term><option>f-protd</option></term>
59174 <listitem>
59175 <para>
59176 <indexterm role="concept">
59177 <primary>virus scanners</primary>
59178 <secondary>f-protd</secondary>
59179 </indexterm>
59180 The f-protd scanner is accessed via HTTP over TCP.
59181 One argument is taken, being a space-separated hostname and port number
59182 (or port-range).
59183 For example:
59184 </para>
59185 <literallayout class="monospaced">
59186 av_scanner = f-protd:localhost 10200-10204
59187 </literallayout>
59188 <para>
59189 If you omit the argument, the default values show above are used.
59190 </para>
59191 </listitem></varlistentry>
59192 <varlistentry>
59193 <term><option>fsecure</option></term>
59194 <listitem>
59195 <para>
59196 <indexterm role="concept">
59197 <primary>virus scanners</primary>
59198 <secondary>F-Secure</secondary>
59199 </indexterm>
59200 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
59201 argument which is the path to a UNIX socket. For example:
59202 </para>
59203 <literallayout class="monospaced">
59204 av_scanner = fsecure:/path/to/.fsav
59205 </literallayout>
59206 <para>
59207 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
59208 Thelmen for contributing the code for this scanner.
59209 </para>
59210 </listitem></varlistentry>
59211 <varlistentry>
59212 <term><option>kavdaemon</option></term>
59213 <listitem>
59214 <para>
59215 <indexterm role="concept">
59216 <primary>virus scanners</primary>
59217 <secondary>Kaspersky</secondary>
59218 </indexterm>
59219 This is the scanner daemon of Kaspersky Version 4. This version of the
59220 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
59221 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
59222 For example:
59223 </para>
59224 <literallayout class="monospaced">
59225 av_scanner = kavdaemon:/opt/AVP/AvpCtl
59226 </literallayout>
59227 <para>
59228 The default path is <filename>/var/run/AvpCtl</filename>.
59229 </para>
59230 </listitem></varlistentry>
59231 <varlistentry>
59232 <term><option>mksd</option></term>
59233 <listitem>
59234 <para>
59235 <indexterm role="concept">
59236 <primary>virus scanners</primary>
59237 <secondary>mksd</secondary>
59238 </indexterm>
59239 This is a daemon type scanner that is aimed mainly at Polish users, though some
59240 parts of documentation are now available in English. You can get it at
59241 <emphasis role="bold"><ulink url="http://linux.mks.com.pl/">http://linux.mks.com.pl/</ulink></emphasis>. The only option for this scanner type is
59242 the maximum number of processes used simultaneously to scan the attachments,
59243 provided that mksd has
59244 been run with at least the same number of child processes. For example:
59245 </para>
59246 <literallayout class="monospaced">
59247 av_scanner = mksd:2
59248 </literallayout>
59249 <para>
59250 You can safely omit this option (the default value is 1).
59251 </para>
59252 </listitem></varlistentry>
59253 <varlistentry>
59254 <term><option>sock</option></term>
59255 <listitem>
59256 <para>
59257 <indexterm role="concept">
59258 <primary>virus scanners</primary>
59259 <secondary>simple socket-connected</secondary>
59260 </indexterm>
59261 This is a general-purpose way of talking to simple scanner daemons
59262 running on the local machine.
59263 There are four options:
59264 an address (which may be an IP address and port, or the path of a Unix socket),
59265 a commandline to send (may include a single %s which will be replaced with
59266 the path to the mail file to be scanned),
59267 an RE to trigger on from the returned data,
59268 an RE to extract malware_name from the returned data.
59269 For example:
59270 </para>
59271 <literallayout class="monospaced">
59272 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
59273 </literallayout>
59274 <para>
59275 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
59276 Default for the commandline is <filename>%s\n</filename>.
59277 Both regular-expressions are required.
59278 </para>
59279 </listitem></varlistentry>
59280 <varlistentry>
59281 <term><option>sophie</option></term>
59282 <listitem>
59283 <para>
59284 <indexterm role="concept">
59285 <primary>virus scanners</primary>
59286 <secondary>Sophos and Sophie</secondary>
59287 </indexterm>
59288 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
59289 You can get Sophie at <emphasis role="bold"><ulink url="http://www.clanfield.info/sophie/">http://www.clanfield.info/sophie/</ulink></emphasis>. The only option
59290 for this scanner type is the path to the UNIX socket that Sophie uses for
59291 client communication. For example:
59292 </para>
59293 <literallayout class="monospaced">
59294 av_scanner = sophie:/tmp/sophie
59295 </literallayout>
59296 <para>
59297 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
59298 the option.
59299 </para>
59300 </listitem></varlistentry>
59301 </variablelist>
59302 <para>
59303 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
59304 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
59305 ACL.
59306 </para>
59307 <para>
59308 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
59309 makes it possible to use different scanners. See further below for an example.
59310 The <option>malware</option> condition caches its results, so when you use it multiple times
59311 for the same message, the actual scanning process is only carried out once.
59312 However, using expandable items in <option>av_scanner</option> disables this caching, in
59313 which case each use of the <option>malware</option> condition causes a new scan of the
59314 message.
59315 </para>
59316 <para>
59317 The <option>malware</option> condition takes a right-hand argument that is expanded before
59318 use and taken as a list, slash-separated by default.
59319 The first element can then be one of
59320 </para>
59321 <itemizedlist>
59322 <listitem>
59323 <para>
59324 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
59325 The condition succeeds if a virus was found, and fail otherwise. This is the
59326 recommended usage.
59327 </para>
59328 </listitem>
59329 <listitem>
59330 <para>
59331 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
59332 the condition fails immediately.
59333 </para>
59334 </listitem>
59335 <listitem>
59336 <para>
59337 A regular expression, in which case the message is scanned for viruses. The
59338 condition succeeds if a virus is found and its name matches the regular
59339 expression. This allows you to take special actions on certain types of virus.
59340 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
59341 unless the separator is changed (in the usual way).
59342 </para>
59343 </listitem>
59344 </itemizedlist>
59345 <para>
59346 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
59347 messages even if there is a problem with the virus scanner.
59348 Otherwise, such a problem causes the ACL to defer.
59349 </para>
59350 <para>
59351 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
59352 specify a non-default timeout.  The default is two minutes.
59353 For example:
59354 </para>
59355 <literallayout class="monospaced">
59356 malware = * / defer_ok / tmo=10s
59357 </literallayout>
59358 <para>
59359 A timeout causes the ACL to defer.
59360 </para>
59361 <para>
59362 <indexterm role="variable">
59363 <primary><varname>$callout_address</varname></primary>
59364 </indexterm>
59365 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
59366 is set to record the actual address used.
59367 </para>
59368 <para>
59369 <indexterm role="variable">
59370 <primary><varname>$malware_name</varname></primary>
59371 </indexterm>
59372 When a virus is found, the condition sets up an expansion variable called
59373 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
59374 <option>message</option> modifier that specifies the error returned to the sender, and/or in
59375 logging data.
59376 </para>
59377 <para>
59378 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
59379 imposed by your anti-virus scanner.
59380 </para>
59381 <para>
59382 Here is a very simple scanning example:
59383 </para>
59384 <literallayout class="monospaced">
59385 deny message = This message contains malware ($malware_name)
59386      malware = *
59387 </literallayout>
59388 <para>
59389 The next example accepts messages when there is a problem with the scanner:
59390 </para>
59391 <literallayout class="monospaced">
59392 deny message = This message contains malware ($malware_name)
59393      malware = */defer_ok
59394 </literallayout>
59395 <para>
59396 The next example shows how to use an ACL variable to scan with both sophie and
59397 aveserver. It assumes you have set:
59398 </para>
59399 <literallayout class="monospaced">
59400 av_scanner = $acl_m0
59401 </literallayout>
59402 <para>
59403 in the main Exim configuration.
59404 </para>
59405 <literallayout class="monospaced">
59406 deny message = This message contains malware ($malware_name)
59407      set acl_m0 = sophie
59408      malware = *
59409
59410 deny message = This message contains malware ($malware_name)
59411      set acl_m0 = aveserver
59412      malware = *
59413 </literallayout>
59414 </section>
59415 <section id="SECTscanspamass">
59416 <title>Scanning with SpamAssassin and Rspamd</title>
59417 <para>
59418 <indexterm role="concept">
59419 <primary>content scanning</primary>
59420 <secondary>for spam</secondary>
59421 </indexterm>
59422 <indexterm role="concept">
59423 <primary>spam scanning</primary>
59424 </indexterm>
59425 <indexterm role="concept">
59426 <primary>SpamAssassin</primary>
59427 </indexterm>
59428 <indexterm role="concept">
59429 <primary>Rspamd</primary>
59430 </indexterm>
59431 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
59432 score and a report for the message.
59433 Support is also provided for Rspamd.
59434 </para>
59435 <para>
59436 For more information about installation and configuration of SpamAssassin or
59437 Rspamd refer to their respective websites at
59438 <emphasis role="bold"><ulink url="http://spamassassin.apache.org">http://spamassassin.apache.org</ulink></emphasis> and <emphasis role="bold"><ulink url="http://www.rspamd.com">http://www.rspamd.com</ulink></emphasis>
59439 </para>
59440 <para>
59441 SpamAssassin can be installed with CPAN by running:
59442 </para>
59443 <literallayout class="monospaced">
59444 perl -MCPAN -e 'install Mail::SpamAssassin'
59445 </literallayout>
59446 <para>
59447 SpamAssassin has its own set of configuration files. Please review its
59448 documentation to see how you can tweak it. The default installation should work
59449 nicely, however.
59450 </para>
59451 <para>
59452 <indexterm role="option">
59453 <primary><option>spamd_address</option></primary>
59454 </indexterm>
59455 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
59456 intend to use an instance running on the local host you do not need to set
59457 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
59458 you must set the <option>spamd_address</option> option in the global part of the Exim
59459 configuration as follows (example):
59460 </para>
59461 <literallayout class="monospaced">
59462 spamd_address = 192.168.99.45 387
59463 </literallayout>
59464 <para>
59465 The SpamAssassin protocol relies on a TCP half-close from the client.
59466 If your SpamAssassin client side is running a Linux system with an
59467 iptables firewall, consider setting
59468 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
59469 timeout, Exim uses when waiting for a response from the SpamAssassin
59470 server (currently defaulting to 120s).  With a lower value the Linux
59471 connection tracking may consider your half-closed connection as dead too
59472 soon.
59473 </para>
59474 <para>
59475 To use Rspamd (which by default listens on all local addresses
59476 on TCP port 11333)
59477 you should add <option>variant=rspamd</option> after the address/port pair, for example:
59478 </para>
59479 <literallayout class="monospaced">
59480 spamd_address = 127.0.0.1 11333 variant=rspamd
59481 </literallayout>
59482 <para>
59483 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
59484 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
59485 file name instead of an address/port pair:
59486 </para>
59487 <literallayout class="monospaced">
59488 spamd_address = /var/run/spamd_socket
59489 </literallayout>
59490 <para>
59491 You can have multiple <option>spamd</option> servers to improve scalability. These can
59492 reside on other hardware reachable over the network. To specify multiple
59493 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
59494 option, separated with colons (the separator can be changed in the usual way):
59495 </para>
59496 <literallayout class="monospaced">
59497 spamd_address = 192.168.2.10 783 : \
59498                 192.168.2.11 783 : \
59499                 192.168.2.12 783
59500 </literallayout>
59501 <para>
59502 Up to 32 <option>spamd</option> servers are supported.
59503 When a server fails to respond to the connection attempt, all other
59504 servers are tried until one succeeds. If no server responds, the <option>spam</option>
59505 condition defers.
59506 </para>
59507 <para>
59508 Unix and TCP socket specifications may be mixed in any order.
59509 Each element of the list is a list itself, space-separated by default
59510 and changeable in the usual way; take care to not double the separator.
59511 </para>
59512 <para>
59513 For TCP socket specifications a host name or IP (v4 or v6, but
59514 subject to list-separator quoting rules) address can be used,
59515 and the port can be one or a dash-separated pair.
59516 In the latter case, the range is tried in strict order.
59517 </para>
59518 <para>
59519 Elements after the first for Unix sockets, or second for TCP socket,
59520 are options.
59521 The supported options are:
59522 </para>
59523 <literallayout class="monospaced">
59524 pri=&lt;priority&gt;      Selection priority
59525 weight=&lt;value&gt;      Selection bias
59526 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
59527 retry=&lt;timespec&gt;    Retry on connect fail
59528 tmo=&lt;timespec&gt;      Connection time limit
59529 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
59530 </literallayout>
59531 <para>
59532 The <literal>pri</literal> option specifies a priority for the server within the list,
59533 higher values being tried first.
59534 The default priority is 1.
59535 </para>
59536 <para>
59537 The <literal>weight</literal> option specifies a selection bias.
59538 Within a priority set
59539 servers are queried in a random fashion, weighted by this value.
59540 The default value for selection bias is 1.
59541 </para>
59542 <para>
59543 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
59544 in the local time zone; each element being one or more digits.
59545 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
59546 characters, may be omitted and will be taken as zero.
59547 </para>
59548 <para>
59549 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
59550 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
59551 </para>
59552 <para>
59553 The <literal>tmo</literal> option specifies an overall timeout for communication.
59554 The default value is two minutes.
59555 </para>
59556 <para>
59557 The <literal>retry</literal> option specifies a time after which a single retry for
59558 a failed connect is made.
59559 The default is to not retry.
59560 </para>
59561 <para>
59562 The <option>spamd_address</option> variable is expanded before use if it starts with
59563 a dollar sign. In this case, the expansion may return a string that is
59564 used as the list so that multiple spamd servers can be the result of an
59565 expansion.
59566 </para>
59567 <para>
59568 <indexterm role="variable">
59569 <primary><varname>$callout_address</varname></primary>
59570 </indexterm>
59571 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
59572 is set to record the actual address used.
59573 </para>
59574 </section>
59575 <section id="SECID206">
59576 <title>Calling SpamAssassin from an Exim ACL</title>
59577 <para>
59578 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
59579 </para>
59580 <literallayout class="monospaced">
59581 deny message = This message was classified as SPAM
59582      spam = joe
59583 </literallayout>
59584 <para>
59585 The right-hand side of the <option>spam</option> condition specifies a name. This is
59586 relevant if you have set up multiple SpamAssassin profiles. If you do not want
59587 to scan using a specific profile, but rather use the SpamAssassin system-wide
59588 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
59589 Rspamd does not use this setting. However, you must put something on the
59590 right-hand side.
59591 </para>
59592 <para>
59593 The name allows you to use per-domain or per-user antispam profiles in
59594 principle, but this is not straightforward in practice, because a message may
59595 have multiple recipients, not necessarily all in the same domain. Because the
59596 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
59597 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
59598 are not set.
59599 Careful enforcement of single-recipient messages
59600 (e.g. by responding with defer in the recipient ACL for all recipients
59601 after the first),
59602 or the use of PRDR,
59603 <indexterm role="concept">
59604 <primary>PRDR</primary>
59605 <secondary>use for per-user SpamAssassin profiles</secondary>
59606 </indexterm>
59607 are needed to use this feature.
59608 </para>
59609 <para>
59610 The right-hand side of the <option>spam</option> condition is expanded before being used, so
59611 you can put lookups or conditions there. When the right-hand side evaluates to
59612 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
59613 </para>
59614 <para>
59615 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
59616 large ones may cause significant performance degradation. As most spam messages
59617 are quite small, it is recommended that you do not scan the big ones. For
59618 example:
59619 </para>
59620 <literallayout class="monospaced">
59621 deny message = This message was classified as SPAM
59622      condition = ${if &lt; {$message_size}{10K}}
59623      spam = nobody
59624 </literallayout>
59625 <para>
59626 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
59627 SpamAssassin profile has been matched or exceeded. If you want to use the
59628 <option>spam</option> condition for its side effects (see the variables below), you can make
59629 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
59630 </para>
59631 <para>
59632 <indexterm role="concept">
59633 <primary>spam scanning</primary>
59634 <secondary>returned variables</secondary>
59635 </indexterm>
59636 When the <option>spam</option> condition is run, it sets up a number of expansion
59637 variables.
59638 Except for <varname>$spam_report</varname>,
59639 these variables are saved with the received message so are
59640 available for use at delivery time.
59641 </para>
59642 <variablelist>
59643 <varlistentry>
59644 <term><varname>$spam_score</varname></term>
59645 <listitem>
59646 <para>
59647 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
59648 for inclusion in log or reject messages.
59649 </para>
59650 </listitem></varlistentry>
59651 <varlistentry>
59652 <term><varname>$spam_score_int</varname></term>
59653 <listitem>
59654 <para>
59655 The spam score of the message, multiplied by ten, as an integer value. For
59656 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
59657 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
59658 The integer value is useful for numeric comparisons in conditions.
59659 </para>
59660 </listitem></varlistentry>
59661 <varlistentry>
59662 <term><varname>$spam_bar</varname></term>
59663 <listitem>
59664 <para>
59665 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
59666 integer part of the spam score value. A spam score of 4.4 would have a
59667 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
59668 headers, since MUAs can match on such strings. The maximum length of the
59669 spam bar is 50 characters.
59670 </para>
59671 </listitem></varlistentry>
59672 <varlistentry>
59673 <term><varname>$spam_report</varname></term>
59674 <listitem>
59675 <para>
59676 A multiline text table, containing the full SpamAssassin report for the
59677 message. Useful for inclusion in headers or reject messages.
59678 This variable is only usable in a DATA-time ACL.
59679 Beware that SpamAssassin may return non-ASCII characters, especially
59680 when running in country-specific locales, which are not legal
59681 unencoded in headers.
59682 </para>
59683 </listitem></varlistentry>
59684 <varlistentry>
59685 <term><varname>$spam_action</varname></term>
59686 <listitem>
59687 <para>
59688 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
59689 spam score versus threshold.
59690 For Rspamd, the recommended action.
59691 </para>
59692 </listitem></varlistentry>
59693 </variablelist>
59694 <para>
59695 The <option>spam</option> condition caches its results unless expansion in
59696 spamd_address was used. If you call it again with the same user name, it
59697 does not scan again, but rather returns the same values as before.
59698 </para>
59699 <para>
59700 The <option>spam</option> condition returns DEFER if there is any error while running
59701 the message through SpamAssassin or if the expansion of spamd_address
59702 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
59703 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
59704 spam condition, like this:
59705 </para>
59706 <literallayout class="monospaced">
59707 deny message = This message was classified as SPAM
59708      spam    = joe/defer_ok
59709 </literallayout>
59710 <para>
59711 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
59712 </para>
59713 <para>
59714 Here is a longer, commented example of the use of the <option>spam</option>
59715 condition:
59716 </para>
59717 <literallayout class="monospaced">
59718 # put headers in all messages (no matter if spam or not)
59719 warn  spam = nobody:true
59720       add_header = X-Spam-Score: $spam_score ($spam_bar)
59721       add_header = X-Spam-Report: $spam_report
59722
59723 # add second subject line with *SPAM* marker when message
59724 # is over threshold
59725 warn  spam = nobody
59726       add_header = Subject: *SPAM* $h_Subject:
59727
59728 # reject spam at high scores (&gt; 12)
59729 deny  message = This message scored $spam_score spam points.
59730       spam = nobody:true
59731       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
59732 </literallayout>
59733 </section>
59734 <section id="SECTscanmimepart">
59735 <title>Scanning MIME parts</title>
59736 <para>
59737 <indexterm role="concept">
59738 <primary>content scanning</primary>
59739 <secondary>MIME parts</secondary>
59740 </indexterm>
59741 <indexterm role="concept">
59742 <primary>MIME content scanning</primary>
59743 </indexterm>
59744 <indexterm role="option">
59745 <primary><option>acl_smtp_mime</option></primary>
59746 </indexterm>
59747 <indexterm role="option">
59748 <primary><option>acl_not_smtp_mime</option></primary>
59749 </indexterm>
59750 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
59751 each MIME part of an SMTP message, including multipart types, in the sequence
59752 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
59753 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
59754 options may both refer to the same ACL if you want the same processing in both
59755 cases.
59756 </para>
59757 <para>
59758 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
59759 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
59760 the case of a non-SMTP message. However, a MIME ACL is called only if the
59761 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
59762 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
59763 result code is sent to the client. In the case of an SMTP message, the
59764 <option>acl_smtp_data</option> ACL is not called when this happens.
59765 </para>
59766 <para>
59767 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
59768 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
59769 condition to match against the raw MIME part. You can also use the
59770 <option>mime_regex</option> condition to match against the decoded MIME part (see section
59771 <xref linkend="SECTscanregex"/>).
59772 </para>
59773 <para>
59774 At the start of a MIME ACL, a number of variables are set from the header
59775 information for the relevant MIME part. These are described below. The contents
59776 of the MIME part are not by default decoded into a disk file except for MIME
59777 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
59778 part into a disk file, you can use the <option>decode</option> condition. The general
59779 syntax is:
59780 </para>
59781 <literallayout>
59782 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
59783 </literallayout>
59784 <para>
59785 The right hand side is expanded before use. After expansion,
59786 the value can be:
59787 </para>
59788 <orderedlist numeration="arabic">
59789 <listitem>
59790 <para>
59791 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
59792 </para>
59793 </listitem>
59794 <listitem>
59795 <para>
59796 The string <quote>default</quote>. In that case, the file is put in the temporary
59797 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
59798 a sequential file name consisting of the message id and a sequence number. The
59799 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
59800 </para>
59801 </listitem>
59802 <listitem>
59803 <para>
59804 A full path name starting with a slash. If the full name is an existing
59805 directory, it is used as a replacement for the default directory. The filename
59806 is then sequentially assigned. If the path does not exist, it is used as
59807 the full path and file name.
59808 </para>
59809 </listitem>
59810 <listitem>
59811 <para>
59812 If the string does not start with a slash, it is used as the
59813 filename, and the default path is then used.
59814 </para>
59815 </listitem>
59816 </orderedlist>
59817 <para>
59818 The <option>decode</option> condition normally succeeds. It is only false for syntax
59819 errors or unusual circumstances such as memory shortages. You can easily decode
59820 a file with its original, proposed filename using
59821 </para>
59822 <literallayout class="monospaced">
59823 decode = $mime_filename
59824 </literallayout>
59825 <para>
59826 However, you should keep in mind that <varname>$mime_filename</varname> might contain
59827 anything. If you place files outside of the default path, they are not
59828 automatically unlinked.
59829 </para>
59830 <para>
59831 For RFC822 attachments (these are messages attached to messages, with a
59832 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
59833 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
59834 variable is set (see below). Attached messages are always decoded to disk
59835 before being checked, and the files are unlinked once the check is done.
59836 </para>
59837 <para>
59838 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
59839 used to match regular expressions against raw and decoded MIME parts,
59840 respectively. They are described in section <xref linkend="SECTscanregex"/>.
59841 </para>
59842 <para>
59843 <indexterm role="concept">
59844 <primary>MIME content scanning</primary>
59845 <secondary>returned variables</secondary>
59846 </indexterm>
59847 The following list describes all expansion variables that are
59848 available in the MIME ACL:
59849 </para>
59850 <variablelist>
59851 <varlistentry>
59852 <term><varname>$mime_boundary</varname></term>
59853 <listitem>
59854 <para>
59855 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
59856 have a boundary string, which is stored in this variable. If the current part
59857 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
59858 contains the empty string.
59859 </para>
59860 </listitem></varlistentry>
59861 <varlistentry>
59862 <term><varname>$mime_charset</varname></term>
59863 <listitem>
59864 <para>
59865 This variable contains the character set identifier, if one was found in the
59866 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
59867 </para>
59868 <literallayout class="monospaced">
59869 us-ascii
59870 gb2312 (Chinese)
59871 iso-8859-1
59872 </literallayout>
59873 <para>
59874 Please note that this value is not normalized, so you should do matches
59875 case-insensitively.
59876 </para>
59877 </listitem></varlistentry>
59878 <varlistentry>
59879 <term><varname>$mime_content_description</varname></term>
59880 <listitem>
59881 <para>
59882 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
59883 header. It can contain a human-readable description of the parts content. Some
59884 implementations repeat the filename for attachments here, but they are usually
59885 only used for display purposes.
59886 </para>
59887 </listitem></varlistentry>
59888 <varlistentry>
59889 <term><varname>$mime_content_disposition</varname></term>
59890 <listitem>
59891 <para>
59892 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
59893 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
59894 </para>
59895 </listitem></varlistentry>
59896 <varlistentry>
59897 <term><varname>$mime_content_id</varname></term>
59898 <listitem>
59899 <para>
59900 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
59901 This is a unique ID that can be used to reference a part from another part.
59902 </para>
59903 </listitem></varlistentry>
59904 <varlistentry>
59905 <term><varname>$mime_content_size</varname></term>
59906 <listitem>
59907 <para>
59908 This variable is set only after the <option>decode</option> modifier (see above) has been
59909 successfully run. It contains the size of the decoded part in kilobytes. The
59910 size is always rounded up to full kilobytes, so only a completely empty part
59911 has a <varname>$mime_content_size</varname> of zero.
59912 </para>
59913 </listitem></varlistentry>
59914 <varlistentry>
59915 <term><varname>$mime_content_transfer_encoding</varname></term>
59916 <listitem>
59917 <para>
59918 This variable contains the normalized content of the
59919 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
59920 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
59921 </para>
59922 </listitem></varlistentry>
59923 <varlistentry>
59924 <term><varname>$mime_content_type</varname></term>
59925 <listitem>
59926 <para>
59927 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
59928 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
59929 are some examples of popular MIME types, as they may appear in this variable:
59930 </para>
59931 <literallayout class="monospaced">
59932 text/plain
59933 text/html
59934 application/octet-stream
59935 image/jpeg
59936 audio/midi
59937 </literallayout>
59938 <para>
59939 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
59940 empty string.
59941 </para>
59942 </listitem></varlistentry>
59943 <varlistentry>
59944 <term><varname>$mime_decoded_filename</varname></term>
59945 <listitem>
59946 <para>
59947 This variable is set only after the <option>decode</option> modifier (see above) has been
59948 successfully run. It contains the full path and file name of the file
59949 containing the decoded data.
59950 </para>
59951 </listitem></varlistentry>
59952 </variablelist>
59953 <para>
59954 <indexterm role="concept">
59955 <primary>RFC 2047</primary>
59956 </indexterm>
59957 </para>
59958 <variablelist>
59959 <varlistentry>
59960 <term><varname>$mime_filename</varname></term>
59961 <listitem>
59962 <para>
59963 This is perhaps the most important of the MIME variables. It contains a
59964 proposed filename for an attachment, if one was found in either the
59965 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
59966 RFC2047
59967 or RFC2231
59968 decoded, but no additional sanity checks are done.
59969  If no filename was
59970 found, this variable contains the empty string.
59971 </para>
59972 </listitem></varlistentry>
59973 <varlistentry>
59974 <term><varname>$mime_is_coverletter</varname></term>
59975 <listitem>
59976 <para>
59977 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
59978 attached data. It can be used to clamp down on flashy or unnecessarily encoded
59979 content in the cover letter, while not restricting attachments at all.
59980 </para>
59981 <para>
59982 The variable contains 1 (true) for a MIME part believed to be part of the
59983 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
59984 follows:
59985 </para>
59986 <orderedlist numeration="arabic">
59987 <listitem>
59988 <para>
59989 The outermost MIME part of a message is always a cover letter.
59990 </para>
59991 </listitem>
59992 <listitem>
59993 <para>
59994 If a multipart/alternative or multipart/related MIME part is a cover letter,
59995 so are all MIME subparts within that multipart.
59996 </para>
59997 </listitem>
59998 <listitem>
59999 <para>
60000 If any other multipart is a cover letter, the first subpart is a cover letter,
60001 and the rest are attachments.
60002 </para>
60003 </listitem>
60004 <listitem>
60005 <para>
60006 All parts contained within an attachment multipart are attachments.
60007 </para>
60008 </listitem>
60009 </orderedlist>
60010 <para>
60011 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
60012 alternative plain text), while allowing HTML files to be attached. HTML
60013 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
60014 </para>
60015 <literallayout class="monospaced">
60016 deny message = HTML mail is not accepted here
60017 !condition = $mime_is_rfc822
60018 condition = $mime_is_coverletter
60019 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
60020 </literallayout>
60021 </listitem></varlistentry>
60022 <varlistentry>
60023 <term><varname>$mime_is_multipart</varname></term>
60024 <listitem>
60025 <para>
60026 This variable has the value 1 (true) when the current part has the main type
60027 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
60028 Since multipart entities only serve as containers for other parts, you may not
60029 want to carry out specific actions on them.
60030 </para>
60031 </listitem></varlistentry>
60032 <varlistentry>
60033 <term><varname>$mime_is_rfc822</varname></term>
60034 <listitem>
60035 <para>
60036 This variable has the value 1 (true) if the current part is not a part of the
60037 checked message itself, but part of an attached message. Attached message
60038 decoding is fully recursive.
60039 </para>
60040 </listitem></varlistentry>
60041 <varlistentry>
60042 <term><varname>$mime_part_count</varname></term>
60043 <listitem>
60044 <para>
60045 This variable is a counter that is raised for each processed MIME part. It
60046 starts at zero for the very first part (which is usually a multipart). The
60047 counter is per-message, so it is reset when processing RFC822 attachments (see
60048 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
60049 complete, so you can use it in the DATA ACL to determine the number of MIME
60050 parts of a message. For non-MIME messages, this variable contains the value -1.
60051 </para>
60052 </listitem></varlistentry>
60053 </variablelist>
60054 </section>
60055 <section id="SECTscanregex">
60056 <title>Scanning with regular expressions</title>
60057 <para>
60058 <indexterm role="concept">
60059 <primary>content scanning</primary>
60060 <secondary>with regular expressions</secondary>
60061 </indexterm>
60062 <indexterm role="concept">
60063 <primary>regular expressions</primary>
60064 <secondary>content scanning with</secondary>
60065 </indexterm>
60066 You can specify your own custom regular expression matches on the full body of
60067 the message, or on individual MIME parts.
60068 </para>
60069 <para>
60070 The <option>regex</option> condition takes one or more regular expressions as arguments and
60071 matches them against the full message (when called in the DATA ACL) or a raw
60072 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
60073 linewise, with a maximum line length of 32K characters. That means you cannot
60074 have multiline matches with the <option>regex</option> condition.
60075 </para>
60076 <para>
60077 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
60078 to 32K of decoded content (the whole content at once, not linewise). If the
60079 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
60080 is decoded automatically when <option>mime_regex</option> is executed (using default path
60081 and filename values). If the decoded data is larger than  32K, only the first
60082 32K characters are checked.
60083 </para>
60084 <para>
60085 The regular expressions are passed as a colon-separated list. To include a
60086 literal colon, you must double it. Since the whole right-hand side string is
60087 expanded before being used, you must also escape dollar signs and backslashes
60088 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
60089 Here is a simple example that contains two regular expressions:
60090 </para>
60091 <literallayout class="monospaced">
60092 deny message = contains blacklisted regex ($regex_match_string)
60093      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
60094 </literallayout>
60095 <para>
60096 The conditions returns true if any one of the regular expressions matches. The
60097 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
60098 matching regular expression.
60099 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
60100 are set to any substrings captured by the regular expression.
60101 </para>
60102 <para>
60103 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
60104 CPU-intensive.
60105 </para>
60106 <para>
60107 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
60108 </para>
60109 </section>
60110 </chapter>
60111
60112 <chapter id="CHAPlocalscan">
60113 <title>Adding a local scan function to Exim</title>
60114 <titleabbrev>Local scan function</titleabbrev>
60115 <para>
60116 <indexterm role="concept" id="IIDlosca" class="startofrange">
60117 <primary><function>local_scan()</function> function</primary>
60118 <secondary>description of</secondary>
60119 </indexterm>
60120 <indexterm role="concept">
60121 <primary>customizing</primary>
60122 <secondary>input scan using C function</secondary>
60123 </indexterm>
60124 <indexterm role="concept">
60125 <primary>policy control</primary>
60126 <secondary>by local scan function</secondary>
60127 </indexterm>
60128 In these days of email worms, viruses, and ever-increasing spam, some sites
60129 want to apply a lot of checking to messages before accepting them.
60130 </para>
60131 <para>
60132 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
60133 passing messages to external virus and spam scanning software. You can also do
60134 a certain amount in Exim itself through string expansions and the <option>condition</option>
60135 condition in the ACL that runs after the SMTP DATA command or the ACL for
60136 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
60137 </para>
60138 <para>
60139 To allow for further customization to a site&#x2019;s own requirements, there is the
60140 possibility of linking Exim with a private message scanning function, written
60141 in C. If you want to run code that is written in something other than C, you
60142 can of course use a little C stub to call it.
60143 </para>
60144 <para>
60145 The local scan function is run once for every incoming message, at the point
60146 when Exim is just about to accept the message.
60147 It can therefore be used to control non-SMTP messages from local processes as
60148 well as messages arriving via SMTP.
60149 </para>
60150 <para>
60151 Exim applies a timeout to calls of the local scan function, and there is an
60152 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
60153 Zero means <quote>no timeout</quote>.
60154 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
60155 before calling the local scan function, so that the most common types of crash
60156 are caught. If the timeout is exceeded or one of those signals is caught, the
60157 incoming message is rejected with a temporary error if it is an SMTP message.
60158 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
60159 code. The incident is logged on the main and reject logs.
60160 </para>
60161 <section id="SECID207">
60162 <title>Building Exim to use a local scan function</title>
60163 <para>
60164 <indexterm role="concept">
60165 <primary><function>local_scan()</function> function</primary>
60166 <secondary>building Exim to use</secondary>
60167 </indexterm>
60168 To make use of the local scan function feature, you must tell Exim where your
60169 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
60170 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
60171 directory, so you might set
60172 </para>
60173 <literallayout class="monospaced">
60174 LOCAL_SCAN_SOURCE=Local/local_scan.c
60175 </literallayout>
60176 <para>
60177 for example. The function must be called <function>local_scan()</function>. It is called by
60178 Exim after it has received a message, when the success return code is about to
60179 be sent. This is after all the ACLs have been run. The return code from your
60180 function controls whether the message is actually accepted or not. There is a
60181 commented template function (that just accepts the message) in the file
60182 _src/local_scan.c_.
60183 </para>
60184 <para>
60185 If you want to make use of Exim&#x2019;s run time configuration file to set options
60186 for your <function>local_scan()</function> function, you must also set
60187 </para>
60188 <literallayout class="monospaced">
60189 LOCAL_SCAN_HAS_OPTIONS=yes
60190 </literallayout>
60191 <para>
60192 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
60193 </para>
60194 </section>
60195 <section id="SECTapiforloc">
60196 <title>API for local_scan()</title>
60197 <para>
60198 <indexterm role="concept">
60199 <primary><function>local_scan()</function> function</primary>
60200 <secondary>API description</secondary>
60201 </indexterm>
60202 You must include this line near the start of your code:
60203 </para>
60204 <literallayout class="monospaced">
60205 #include "local_scan.h"
60206 </literallayout>
60207 <para>
60208 This header file defines a number of variables and other values, and the
60209 prototype for the function itself. Exim is coded to use unsigned char values
60210 almost exclusively, and one of the things this header defines is a shorthand
60211 for <literal>unsigned char</literal> called <literal>uschar</literal>.
60212 It also contains the following macro definitions, to simplify casting character
60213 strings and pointers to character strings:
60214 </para>
60215 <literallayout class="monospaced">
60216 #define CS   (char *)
60217 #define CCS  (const char *)
60218 #define CSS  (char **)
60219 #define US   (unsigned char *)
60220 #define CUS  (const unsigned char *)
60221 #define USS  (unsigned char **)
60222 </literallayout>
60223 <para>
60224 The function prototype for <function>local_scan()</function> is:
60225 </para>
60226 <literallayout class="monospaced">
60227 extern int local_scan(int fd, uschar **return_text);
60228 </literallayout>
60229 <para>
60230 The arguments are as follows:
60231 </para>
60232 <itemizedlist>
60233 <listitem>
60234 <para>
60235 <option>fd</option> is a file descriptor for the file that contains the body of the message
60236 (the -D file). The file is open for reading and writing, but updating it is not
60237 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
60238 </para>
60239 <para>
60240 The descriptor is positioned at character 19 of the file, which is the first
60241 character of the body itself, because the first 19 characters are the message
60242 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
60243 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
60244 case this changes in some future version.
60245 </para>
60246 </listitem>
60247 <listitem>
60248 <para>
60249 <option>return_text</option> is an address which you can use to return a pointer to a text
60250 string at the end of the function. The value it points to on entry is NULL.
60251 </para>
60252 </listitem>
60253 </itemizedlist>
60254 <para>
60255 The function must return an <option>int</option> value which is one of the following macros:
60256 </para>
60257 <variablelist>
60258 <varlistentry>
60259 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
60260 <listitem>
60261 <para>
60262 <indexterm role="variable">
60263 <primary><varname>$local_scan_data</varname></primary>
60264 </indexterm>
60265 The message is accepted. If you pass back a string of text, it is saved with
60266 the message, and made available in the variable <varname>$local_scan_data</varname>. No
60267 newlines are permitted (if there are any, they are turned into spaces) and the
60268 maximum length of text is 1000 characters.
60269 </para>
60270 </listitem></varlistentry>
60271 <varlistentry>
60272 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
60273 <listitem>
60274 <para>
60275 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60276 queued without immediate delivery, and is frozen.
60277 </para>
60278 </listitem></varlistentry>
60279 <varlistentry>
60280 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
60281 <listitem>
60282 <para>
60283 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60284 queued without immediate delivery.
60285 </para>
60286 </listitem></varlistentry>
60287 <varlistentry>
60288 <term><literal>LOCAL_SCAN_REJECT</literal></term>
60289 <listitem>
60290 <para>
60291 The message is rejected; the returned text is used as an error message which is
60292 passed back to the sender and which is also logged. Newlines are permitted &ndash;
60293 they cause a multiline response for SMTP rejections, but are converted to
60294 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
60295 used.
60296 </para>
60297 </listitem></varlistentry>
60298 <varlistentry>
60299 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
60300 <listitem>
60301 <para>
60302 The message is temporarily rejected; the returned text is used as an error
60303 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
60304 problem</quote> is used.
60305 </para>
60306 </listitem></varlistentry>
60307 <varlistentry>
60308 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
60309 <listitem>
60310 <para>
60311 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
60312 message is not written to the reject log. It has the effect of unsetting the
60313 <option>rejected_header</option> log selector for just this rejection. If
60314 <option>rejected_header</option> is already unset (see the discussion of the
60315 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
60316 same as LOCAL_SCAN_REJECT.
60317 </para>
60318 </listitem></varlistentry>
60319 <varlistentry>
60320 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
60321 <listitem>
60322 <para>
60323 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
60324 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
60325 </para>
60326 </listitem></varlistentry>
60327 </variablelist>
60328 <para>
60329 If the message is not being received by interactive SMTP, rejections are
60330 reported by writing to <option>stderr</option> or by sending an email, as configured by the
60331 <option>-oe</option> command line options.
60332 </para>
60333 </section>
60334 <section id="SECTconoptloc">
60335 <title>Configuration options for local_scan()</title>
60336 <para>
60337 <indexterm role="concept">
60338 <primary><function>local_scan()</function> function</primary>
60339 <secondary>configuration options</secondary>
60340 </indexterm>
60341 It is possible to have option settings in the main configuration file
60342 that set values in static variables in the <function>local_scan()</function> module. If you
60343 want to do this, you must have the line
60344 </para>
60345 <literallayout class="monospaced">
60346 LOCAL_SCAN_HAS_OPTIONS=yes
60347 </literallayout>
60348 <para>
60349 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
60350 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
60351 file, you must define static variables to hold the option values, and a table
60352 to define them.
60353 </para>
60354 <para>
60355 The table must be a vector called <option>local_scan_options</option>, of type
60356 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
60357 and a pointer to the variable that holds the value. The entries must appear in
60358 alphabetical order. Following <option>local_scan_options</option> you must also define a
60359 variable called <option>local_scan_options_count</option> that contains the number of
60360 entries in the table. Here is a short example, showing two kinds of option:
60361 </para>
60362 <literallayout class="monospaced">
60363 static int my_integer_option = 42;
60364 static uschar *my_string_option = US"a default string";
60365
60366 optionlist local_scan_options[] = {
60367   { "my_integer", opt_int,       &amp;my_integer_option },
60368   { "my_string",  opt_stringptr, &amp;my_string_option }
60369 };
60370
60371 int local_scan_options_count =
60372   sizeof(local_scan_options)/sizeof(optionlist);
60373 </literallayout>
60374 <para>
60375 The values of the variables can now be changed from Exim&#x2019;s runtime
60376 configuration file by including a local scan section as in this example:
60377 </para>
60378 <literallayout class="monospaced">
60379 begin local_scan
60380 my_integer = 99
60381 my_string = some string of text...
60382 </literallayout>
60383 <para>
60384 The available types of option data are as follows:
60385 </para>
60386 <variablelist>
60387 <varlistentry>
60388 <term><emphasis role="bold">opt_bool</emphasis></term>
60389 <listitem>
60390 <para>
60391 This specifies a boolean (true/false) option. The address should point to a
60392 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
60393 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
60394 whether such a variable has been set at all, you can initialize it to
60395 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
60396 values.)
60397 </para>
60398 </listitem></varlistentry>
60399 <varlistentry>
60400 <term><emphasis role="bold">opt_fixed</emphasis></term>
60401 <listitem>
60402 <para>
60403 This specifies a fixed point number, such as is used for load averages.
60404 The address should point to a variable of type <literal>int</literal>. The value is stored
60405 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
60406 </para>
60407 </listitem></varlistentry>
60408 <varlistentry>
60409 <term><emphasis role="bold">opt_int</emphasis></term>
60410 <listitem>
60411 <para>
60412 This specifies an integer; the address should point to a variable of type
60413 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
60414 Exim.
60415 </para>
60416 </listitem></varlistentry>
60417 <varlistentry>
60418 <term><emphasis role="bold">opt_mkint</emphasis></term>
60419 <listitem>
60420 <para>
60421 This is the same as <option>opt_int</option>, except that when such a value is output in a
60422 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
60423 printed with the suffix K or M.
60424 </para>
60425 </listitem></varlistentry>
60426 <varlistentry>
60427 <term><emphasis role="bold">opt_octint</emphasis></term>
60428 <listitem>
60429 <para>
60430 This also specifies an integer, but the value is always interpreted as an
60431 octal integer, whether or not it starts with the digit zero, and it is
60432 always output in octal.
60433 </para>
60434 </listitem></varlistentry>
60435 <varlistentry>
60436 <term><emphasis role="bold">opt_stringptr</emphasis></term>
60437 <listitem>
60438 <para>
60439 This specifies a string value; the address must be a pointer to a
60440 variable that points to a string (for example, of type <literal>uschar *</literal>).
60441 </para>
60442 </listitem></varlistentry>
60443 <varlistentry>
60444 <term><emphasis role="bold">opt_time</emphasis></term>
60445 <listitem>
60446 <para>
60447 This specifies a time interval value. The address must point to a variable of
60448 type <literal>int</literal>. The value that is placed there is a number of seconds.
60449 </para>
60450 </listitem></varlistentry>
60451 </variablelist>
60452 <para>
60453 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
60454 out the values of all the <function>local_scan()</function> options.
60455 </para>
60456 </section>
60457 <section id="SECID208">
60458 <title>Available Exim variables</title>
60459 <para>
60460 <indexterm role="concept">
60461 <primary><function>local_scan()</function> function</primary>
60462 <secondary>available Exim variables</secondary>
60463 </indexterm>
60464 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
60465 are the only ones that are guaranteed to be maintained from release to release.
60466 Note, however, that you can obtain the value of any Exim expansion variable,
60467 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
60468 C variables are as follows:
60469 </para>
60470 <variablelist>
60471 <varlistentry>
60472 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
60473 <listitem>
60474 <para>
60475 This variable contains the number of lines in the message&#x2019;s body.
60476 </para>
60477 </listitem></varlistentry>
60478 <varlistentry>
60479 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
60480 <listitem>
60481 <para>
60482 This variable contains the number of binary zero bytes in the message&#x2019;s body.
60483 </para>
60484 </listitem></varlistentry>
60485 <varlistentry>
60486 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
60487 <listitem>
60488 <para>
60489 This variable is set to zero when no debugging is taking place. Otherwise, it
60490 is a bitmap of debugging selectors. Two bits are identified for use in
60491 <function>local_scan()</function>; they are defined as macros:
60492 </para>
60493 <itemizedlist>
60494 <listitem>
60495 <para>
60496 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
60497 testing option that is not privileged &ndash; any caller may set it. All the
60498 other selector bits can be set only by admin users.
60499 </para>
60500 </listitem>
60501 <listitem>
60502 <para>
60503 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
60504 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
60505 of debugging bits.
60506 </para>
60507 </listitem>
60508 </itemizedlist>
60509 <para>
60510 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
60511 selected, you should use code like this:
60512 </para>
60513 <literallayout class="monospaced">
60514 if ((debug_selector &amp; D_local_scan) != 0)
60515   debug_printf("xxx", ...);
60516 </literallayout>
60517 </listitem></varlistentry>
60518 <varlistentry>
60519 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
60520 <listitem>
60521 <para>
60522 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
60523 variable <option>expand_string_message</option> contains the error message, zero-terminated.
60524 </para>
60525 </listitem></varlistentry>
60526 <varlistentry>
60527 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
60528 <listitem>
60529 <para>
60530 A pointer to a chain of header lines. The <option>header_line</option> structure is
60531 discussed below.
60532 </para>
60533 </listitem></varlistentry>
60534 <varlistentry>
60535 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
60536 <listitem>
60537 <para>
60538 A pointer to the last of the header lines.
60539 </para>
60540 </listitem></varlistentry>
60541 <varlistentry>
60542 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
60543 <listitem>
60544 <para>
60545 The value of the <option>headers_charset</option> configuration option.
60546 </para>
60547 </listitem></varlistentry>
60548 <varlistentry>
60549 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
60550 <listitem>
60551 <para>
60552 This variable is TRUE during a host checking session that is initiated by the
60553 <option>-bh</option> command line option.
60554 </para>
60555 </listitem></varlistentry>
60556 <varlistentry>
60557 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
60558 <listitem>
60559 <para>
60560 The IP address of the interface that received the message, as a string. This
60561 is NULL for locally submitted messages.
60562 </para>
60563 </listitem></varlistentry>
60564 <varlistentry>
60565 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
60566 <listitem>
60567 <para>
60568 The port on which this message was received. When testing with the <option>-bh</option>
60569 command line option, the value of this variable is -1 unless a port has been
60570 specified via the <option>-oMi</option> option.
60571 </para>
60572 </listitem></varlistentry>
60573 <varlistentry>
60574 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
60575 <listitem>
60576 <para>
60577 This variable contains Exim&#x2019;s message id for the incoming message (the value of
60578 <varname>$message_exim_id</varname>) as a zero-terminated string.
60579 </para>
60580 </listitem></varlistentry>
60581 <varlistentry>
60582 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
60583 <listitem>
60584 <para>
60585 The name of the protocol by which the message was received.
60586 </para>
60587 </listitem></varlistentry>
60588 <varlistentry>
60589 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
60590 <listitem>
60591 <para>
60592 The number of accepted recipients.
60593 </para>
60594 </listitem></varlistentry>
60595 <varlistentry>
60596 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
60597 <listitem>
60598 <para>
60599 <indexterm role="concept">
60600 <primary>recipient</primary>
60601 <secondary>adding in local scan</secondary>
60602 </indexterm>
60603 <indexterm role="concept">
60604 <primary>recipient</primary>
60605 <secondary>removing in local scan</secondary>
60606 </indexterm>
60607 The list of accepted recipients, held in a vector of length
60608 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
60609 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
60610 below). You can delete recipients by removing them from the vector and
60611 adjusting the value in <option>recipients_count</option>. In particular, by setting
60612 <option>recipients_count</option> to zero you remove all recipients. If you then return the
60613 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
60614 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
60615 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
60616 </para>
60617 </listitem></varlistentry>
60618 <varlistentry>
60619 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
60620 <listitem>
60621 <para>
60622 The envelope sender address. For bounce messages this is the empty string.
60623 </para>
60624 </listitem></varlistentry>
60625 <varlistentry>
60626 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
60627 <listitem>
60628 <para>
60629 The IP address of the sending host, as a string. This is NULL for
60630 locally-submitted messages.
60631 </para>
60632 </listitem></varlistentry>
60633 <varlistentry>
60634 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
60635 <listitem>
60636 <para>
60637 The name of the authentication mechanism that was used, or NULL if the message
60638 was not received over an authenticated SMTP connection.
60639 </para>
60640 </listitem></varlistentry>
60641 <varlistentry>
60642 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
60643 <listitem>
60644 <para>
60645 The name of the sending host, if known.
60646 </para>
60647 </listitem></varlistentry>
60648 <varlistentry>
60649 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
60650 <listitem>
60651 <para>
60652 The port on the sending host.
60653 </para>
60654 </listitem></varlistentry>
60655 <varlistentry>
60656 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
60657 <listitem>
60658 <para>
60659 This variable is TRUE for all SMTP input, including BSMTP.
60660 </para>
60661 </listitem></varlistentry>
60662 <varlistentry>
60663 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
60664 <listitem>
60665 <para>
60666 This variable is TRUE for BSMTP input.
60667 </para>
60668 </listitem></varlistentry>
60669 <varlistentry>
60670 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
60671 <listitem>
60672 <para>
60673 The contents of this variable control which pool of memory is used for new
60674 requests. See section <xref linkend="SECTmemhanloc"/> for details.
60675 </para>
60676 </listitem></varlistentry>
60677 </variablelist>
60678 </section>
60679 <section id="SECID209">
60680 <title>Structure of header lines</title>
60681 <para>
60682 The <option>header_line</option> structure contains the members listed below.
60683 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
60684 (see below). You can cause header lines to be ignored (deleted) by setting
60685 their type to *.
60686 </para>
60687 <variablelist>
60688 <varlistentry>
60689 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
60690 <listitem>
60691 <para>
60692 A pointer to the next header line, or NULL for the last line.
60693 </para>
60694 </listitem></varlistentry>
60695 <varlistentry>
60696 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
60697 <listitem>
60698 <para>
60699 A code identifying certain headers that Exim recognizes. The codes are printing
60700 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
60701 Notice in particular that any header line whose type is * is not transmitted
60702 with the message. This flagging is used for header lines that have been
60703 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
60704 lines.) Effectively, * means <quote>deleted</quote>.
60705 </para>
60706 </listitem></varlistentry>
60707 <varlistentry>
60708 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
60709 <listitem>
60710 <para>
60711 The number of characters in the header line, including the terminating and any
60712 internal newlines.
60713 </para>
60714 </listitem></varlistentry>
60715 <varlistentry>
60716 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
60717 <listitem>
60718 <para>
60719 A pointer to the text of the header. It always ends with a newline, followed by
60720 a zero byte. Internal newlines are preserved.
60721 </para>
60722 </listitem></varlistentry>
60723 </variablelist>
60724 </section>
60725 <section id="SECID210">
60726 <title>Structure of recipient items</title>
60727 <para>
60728 The <option>recipient_item</option> structure contains these members:
60729 </para>
60730 <variablelist>
60731 <varlistentry>
60732 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
60733 <listitem>
60734 <para>
60735 This is a pointer to the recipient address as it was received.
60736 </para>
60737 </listitem></varlistentry>
60738 <varlistentry>
60739 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
60740 <listitem>
60741 <para>
60742 This is used in later Exim processing when top level addresses are created by
60743 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
60744 and must always contain -1 at this stage.
60745 </para>
60746 </listitem></varlistentry>
60747 <varlistentry>
60748 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
60749 <listitem>
60750 <para>
60751 If this value is not NULL, bounce messages caused by failing to deliver to the
60752 recipient are sent to the address it contains. In other words, it overrides the
60753 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
60754 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
60755 an unqualified address, Exim qualifies it using the domain from
60756 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
60757 is NULL for all recipients.
60758 </para>
60759 </listitem></varlistentry>
60760 </variablelist>
60761 </section>
60762 <section id="SECID211">
60763 <title>Available Exim functions</title>
60764 <para>
60765 <indexterm role="concept">
60766 <primary><function>local_scan()</function> function</primary>
60767 <secondary>available Exim functions</secondary>
60768 </indexterm>
60769 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
60770 These are the only ones that are guaranteed to be maintained from release to
60771 release:
60772 </para>
60773 <variablelist>
60774 <varlistentry>
60775 <term><emphasis role="bold">pid_t&nbsp;child_open(uschar&nbsp;**argv,&nbsp;uschar&nbsp;**envp,&nbsp;int&nbsp;newumask,&nbsp;int&nbsp;*infdptr,&nbsp;int&nbsp;*outfdptr, &nbsp;&nbsp;BOOL&nbsp;make_leader)</emphasis></term>
60776 <listitem>
60777 <para>
60778 This function creates a child process that runs the command specified by
60779 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
60780 be NULL if no environment variables are to be passed. A new umask is supplied
60781 for the process in <option>newumask</option>.
60782 </para>
60783 <para>
60784 Pipes to the standard input and output of the new process are set up
60785 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
60786 standard error is cloned to the standard output. If there are any file
60787 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
60788 argument is TRUE, the new process is made into a process group leader.
60789 </para>
60790 <para>
60791 The function returns the pid of the new process, or -1 if things go wrong.
60792 </para>
60793 </listitem></varlistentry>
60794 <varlistentry>
60795 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
60796 <listitem>
60797 <para>
60798 This function waits for a child process to terminate, or for a timeout (in
60799 seconds) to expire. A timeout value of zero means wait as long as it takes. The
60800 return value is as follows:
60801 </para>
60802 <itemizedlist>
60803 <listitem>
60804 <para>
60805 &gt;= 0
60806 </para>
60807 <para>
60808 The process terminated by a normal exit and the value is the process
60809 ending status.
60810 </para>
60811 </listitem>
60812 <listitem>
60813 <para>
60814 &lt; 0 and &gt; &ndash;256
60815 </para>
60816 <para>
60817 The process was terminated by a signal and the value is the negation of the
60818 signal number.
60819 </para>
60820 </listitem>
60821 <listitem>
60822 <para>
60823 &ndash;256
60824 </para>
60825 <para>
60826 The process timed out.
60827 </para>
60828 </listitem>
60829 <listitem>
60830 <para>
60831 &ndash;257
60832 </para>
60833 <para>
60834 The was some other error in wait(); <option>errno</option> is still set.
60835 </para>
60836 </listitem>
60837 </itemizedlist>
60838 </listitem></varlistentry>
60839 <varlistentry>
60840 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
60841 <listitem>
60842 <para>
60843 This function provide you with a means of submitting a new message to
60844 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
60845 want, but this packages it all up for you.) The function creates a pipe,
60846 forks a subprocess that is running
60847 </para>
60848 <literallayout class="monospaced">
60849 exim -t -oem -oi -f &lt;&gt;
60850 </literallayout>
60851 <para>
60852 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
60853 that is connected to the standard input. The yield of the function is the PID
60854 of the subprocess. You can then write a message to the file descriptor, with
60855 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
60856 </para>
60857 <para>
60858 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
60859 finish and to collect its ending status. A timeout value of zero is usually
60860 fine in this circumstance. Unless you have made a mistake with the recipient
60861 addresses, you should get a return code of zero.
60862 </para>
60863 </listitem></varlistentry>
60864 <varlistentry>
60865 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
60866 <listitem>
60867 <para>
60868 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
60869 that it runs is:
60870 </para>
60871 <literallayout>
60872 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
60873 </literallayout>
60874 <para>
60875 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
60876 </para>
60877 </listitem></varlistentry>
60878 <varlistentry>
60879 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
60880 <listitem>
60881 <para>
60882 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
60883 output is written to the standard error stream. If no debugging is selected,
60884 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
60885 conditional on the <literal>local_scan</literal> debug selector by coding like this:
60886 </para>
60887 <literallayout class="monospaced">
60888 if ((debug_selector &amp; D_local_scan) != 0)
60889   debug_printf("xxx", ...);
60890 </literallayout>
60891 </listitem></varlistentry>
60892 <varlistentry>
60893 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
60894 <listitem>
60895 <para>
60896 This is an interface to Exim&#x2019;s string expansion code. The return value is the
60897 expanded string, or NULL if there was an expansion failure.
60898 The C variable <option>expand_string_message</option> contains an error message after an
60899 expansion failure. If expansion does not change the string, the return value is
60900 the pointer to the input string. Otherwise, the return value points to a new
60901 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
60902 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
60903 </para>
60904 </listitem></varlistentry>
60905 <varlistentry>
60906 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
60907 <listitem>
60908 <para>
60909 This function allows you to an add additional header line at the end of the
60910 existing ones. The first argument is the type, and should normally be a space
60911 character. The second argument is a format string and any number of
60912 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
60913 if you want, and you must ensure that the string ends with a newline.
60914 </para>
60915 </listitem></varlistentry>
60916 <varlistentry>
60917 <term><emphasis role="bold">void&nbsp;header_add_at_position(BOOL&nbsp;after,&nbsp;uschar&nbsp;*name,&nbsp;BOOL&nbsp;topnot,&nbsp;int&nbsp;type,&nbsp;char&nbsp;*format, &nbsp;&nbsp;...)</emphasis></term>
60918 <listitem>
60919 <para>
60920 This function adds a new header line at a specified point in the header
60921 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
60922 </para>
60923 <para>
60924 If <option>name</option> is NULL, the new header is added at the end of the chain if
60925 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
60926 NULL, the header lines are searched for the first non-deleted header that
60927 matches the name. If one is found, the new header is added before it if
60928 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
60929 found header and any adjacent subsequent ones with the same name (even if
60930 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
60931 option controls where the header is added. If it is true, addition is at the
60932 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
60933 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
60934 </para>
60935 <literallayout class="monospaced">
60936 header_add_at_position(TRUE, US"Received", TRUE,
60937   ' ', "X-xxx: ...");
60938 </literallayout>
60939 <para>
60940 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
60941 there may not be if <option>received_header_text</option> expands to an empty string.
60942 </para>
60943 </listitem></varlistentry>
60944 <varlistentry>
60945 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
60946 <listitem>
60947 <para>
60948 This function removes header lines. If <option>occurrence</option> is zero or negative, all
60949 occurrences of the header are removed. If occurrence is greater than zero, that
60950 particular instance of the header is removed. If no header(s) can be found that
60951 match the specification, the function does nothing.
60952 </para>
60953 </listitem></varlistentry>
60954 <varlistentry>
60955 <term><emphasis role="bold">BOOL&nbsp;header_testname(header_line&nbsp;*hdr,&nbsp;uschar&nbsp;*name,&nbsp;int&nbsp;length,&nbsp;BOOL&nbsp;notdel)</emphasis></term>
60956 <listitem>
60957 <para>
60958 This function tests whether the given header has the given name. It is not just
60959 a string comparison, because white space is permitted between the name and the
60960 colon. If the <option>notdel</option> argument is true, a false return is forced for all
60961 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
60962 </para>
60963 <literallayout class="monospaced">
60964 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
60965 </literallayout>
60966 </listitem></varlistentry>
60967 <varlistentry>
60968 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
60969 <listitem>
60970 <para>
60971 <indexterm role="concept">
60972 <primary>base64 encoding</primary>
60973 <secondary>functions for <function>local_scan()</function> use</secondary>
60974 </indexterm>
60975 This function base64-encodes a string, which is passed by address and length.
60976 The text may contain bytes of any value, including zero. The result is passed
60977 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
60978 zero-terminated.
60979 </para>
60980 </listitem></varlistentry>
60981 <varlistentry>
60982 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
60983 <listitem>
60984 <para>
60985 This function decodes a base64-encoded string. Its arguments are a
60986 zero-terminated base64-encoded string and the address of a variable that is set
60987 to point to the result, which is in dynamic memory. The length of the decoded
60988 string is the yield of the function. If the input is invalid base64 data, the
60989 yield is -1. A zero byte is added to the end of the output string to make it
60990 easy to interpret as a C string (assuming it contains no zeros of its own). The
60991 added zero byte is not included in the returned count.
60992 </para>
60993 </listitem></varlistentry>
60994 <varlistentry>
60995 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
60996 <listitem>
60997 <para>
60998 This function checks for a match in a domain list. Domains are always
60999 matched caselessly. The return value is one of the following:
61000 </para>
61001 <literallayout>
61002 <literal>OK     </literal> match succeeded
61003 <literal>FAIL   </literal> match failed
61004 <literal>DEFER  </literal> match deferred
61005 </literallayout>
61006 <para>
61007 DEFER is usually caused by some kind of lookup defer, such as the
61008 inability to contact a database.
61009 </para>
61010 </listitem></varlistentry>
61011 <varlistentry>
61012 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61013 <listitem>
61014 <para>
61015 This function checks for a match in a local part list. The third argument
61016 controls case-sensitivity. The return values are as for
61017 <emphasis>lss_match_domain()</emphasis>.
61018 </para>
61019 </listitem></varlistentry>
61020 <varlistentry>
61021 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61022 <listitem>
61023 <para>
61024 This function checks for a match in an address list. The third argument
61025 controls the case-sensitivity of the local part match. The domain is always
61026 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
61027 </para>
61028 </listitem></varlistentry>
61029 <varlistentry>
61030 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
61031 <listitem>
61032 <para>
61033 This function checks for a match in a host list. The most common usage is
61034 expected to be
61035 </para>
61036 <literallayout class="monospaced">
61037 lss_match_host(sender_host_name, sender_host_address, ...)
61038 </literallayout>
61039 <para>
61040 <indexterm role="variable">
61041 <primary><varname>$sender_host_address</varname></primary>
61042 </indexterm>
61043 An empty address field matches an empty item in the host list. If the host name
61044 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
61045 looked up if a host name is required to match an item in the list. The return
61046 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
61047 returns ERROR in the case when it had to look up a host name, but the lookup
61048 failed.
61049 </para>
61050 </listitem></varlistentry>
61051 <varlistentry>
61052 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
61053 <listitem>
61054 <para>
61055 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
61056 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
61057 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
61058 them. It specifies to which log or logs the message is written. The remaining
61059 arguments are a format and relevant insertion arguments. The string should not
61060 contain any newlines, not even at the end.
61061 </para>
61062 </listitem></varlistentry>
61063 <varlistentry>
61064 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
61065 <listitem>
61066 <para>
61067 This function adds an additional recipient to the message. The first argument
61068 is the recipient address. If it is unqualified (has no domain), it is qualified
61069 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
61070 </para>
61071 <para>
61072 This function does not allow you to specify a private <option>errors_to</option> address (as
61073 described with the structure of <option>recipient_item</option> above), because it pre-dates
61074 the addition of that field to the structure. However, it is easy to add such a
61075 value afterwards. For example:
61076 </para>
61077 <literallayout class="monospaced">
61078  receive_add_recipient(US"monitor@mydom.example", -1);
61079  recipients_list[recipients_count-1].errors_to =
61080    US"postmaster@mydom.example";
61081 </literallayout>
61082 </listitem></varlistentry>
61083 <varlistentry>
61084 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
61085 <listitem>
61086 <para>
61087 This is a convenience function to remove a named recipient from the list of
61088 recipients. It returns true if a recipient was removed, and false if no
61089 matching recipient could be found. The argument must be a complete email
61090 address.
61091 </para>
61092 </listitem></varlistentry>
61093 </variablelist>
61094 <para>
61095 <indexterm role="concept">
61096 <primary>RFC 2047</primary>
61097 </indexterm>
61098 </para>
61099 <variablelist>
61100 <varlistentry>
61101 <term><emphasis role="bold">uschar&nbsp;rfc2047_decode(uschar&nbsp;*string,&nbsp;BOOL&nbsp;lencheck,&nbsp;uschar&nbsp;*target,&nbsp;int&nbsp;zeroval,&nbsp;int&nbsp;*lenptr, &nbsp;&nbsp;uschar&nbsp;**error)</emphasis></term>
61102 <listitem>
61103 <para>
61104 This function decodes strings that are encoded according to RFC 2047. Typically
61105 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
61106 from the Q or B encoding into a byte-string. Then, if provided with the name of
61107 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
61108 made  to translate the result to the named character set. If this fails, the
61109 binary string is returned with an error message.
61110 </para>
61111 <para>
61112 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
61113 maximum MIME word length is enforced. The third argument is the target
61114 encoding, or NULL if no translation is wanted.
61115 </para>
61116 <para>
61117 <indexterm role="concept">
61118 <primary>binary zero</primary>
61119 <secondary>in RFC 2047 decoding</secondary>
61120 </indexterm>
61121 <indexterm role="concept">
61122 <primary>RFC 2047</primary>
61123 <secondary>binary zero in</secondary>
61124 </indexterm>
61125 If a binary zero is encountered in the decoded string, it is replaced by the
61126 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
61127 not be 0 because header lines are handled as zero-terminated strings.
61128 </para>
61129 <para>
61130 The function returns the result of processing the string, zero-terminated; if
61131 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
61132 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
61133 </para>
61134 <para>
61135 If an error is encountered, the function returns NULL and uses the <option>error</option>
61136 argument to return an error message. The variable pointed to by <option>error</option> is
61137 set to NULL if there is no error; it may be set non-NULL even when the function
61138 returns a non-NULL value if decoding was successful, but there was a problem
61139 with translation.
61140 </para>
61141 </listitem></varlistentry>
61142 <varlistentry>
61143 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
61144 <listitem>
61145 <para>
61146 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
61147 below.
61148 </para>
61149 </listitem></varlistentry>
61150 <varlistentry>
61151 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
61152 <listitem>
61153 <para>
61154 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
61155 output stream. You should use this function only when there is an SMTP output
61156 stream, that is, when the incoming message is being received via interactive
61157 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
61158 is FALSE. If you want to test for an incoming message from another host (as
61159 opposed to a local process that used the <option>-bs</option> command line option), you can
61160 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
61161 is involved.
61162 </para>
61163 <para>
61164 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
61165 output function, so it can be used for all forms of SMTP connection.
61166 </para>
61167 <para>
61168 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
61169 must start with an appropriate response code: 550 if you are going to return
61170 LOCAL_SCAN_REJECT, 451 if you are going to return
61171 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
61172 initial lines of a multi-line response, the code must be followed by a hyphen
61173 to indicate that the line is not the final response line. You must also ensure
61174 that the lines you write terminate with CRLF. For example:
61175 </para>
61176 <literallayout class="monospaced">
61177 smtp_printf("550-this is some extra info\r\n");
61178 return LOCAL_SCAN_REJECT;
61179 </literallayout>
61180 <para>
61181 Note that you can also create multi-line responses by including newlines in
61182 the data returned via the <option>return_text</option> argument. The added value of using
61183 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
61184 multiple output lines.
61185 </para>
61186 <para>
61187 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
61188 does not automatically flush pending output, and therefore does not test
61189 the state of the stream. (In the main code of Exim, flushing and error
61190 detection is done when Exim is ready for the next SMTP input command.) If
61191 you want to flush the output and check for an error (for example, the
61192 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
61193 arguments. It flushes the output stream, and returns a non-zero value if there
61194 is an error.
61195 </para>
61196 </listitem></varlistentry>
61197 <varlistentry>
61198 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
61199 <listitem>
61200 <para>
61201 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
61202 chunk of memory whose size is given by the argument. Exim bombs out if it ever
61203 runs out of memory. See the next section for a discussion of memory handling.
61204 </para>
61205 </listitem></varlistentry>
61206 <varlistentry>
61207 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
61208 <listitem>
61209 <para>
61210 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
61211 permanent pool. See the next section for a discussion of memory handling.
61212 </para>
61213 </listitem></varlistentry>
61214 <varlistentry>
61215 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
61216 <listitem>
61217 <para>
61218 See below.
61219 </para>
61220 </listitem></varlistentry>
61221 <varlistentry>
61222 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
61223 <listitem>
61224 <para>
61225 See below.
61226 </para>
61227 </listitem></varlistentry>
61228 <varlistentry>
61229 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
61230 <listitem>
61231 <para>
61232 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
61233 The first makes a copy of an entire string. The second copies up to a maximum
61234 number of characters, indicated by the second argument. The third uses a format
61235 and insertion arguments to create a new string. In each case, the result is a
61236 pointer to a new string in the current memory pool. See the next section for
61237 more discussion.
61238 </para>
61239 </listitem></varlistentry>
61240 </variablelist>
61241 </section>
61242 <section id="SECTmemhanloc">
61243 <title>More about Exim&#x2019;s memory handling</title>
61244 <para>
61245 <indexterm role="concept">
61246 <primary><function>local_scan()</function> function</primary>
61247 <secondary>memory handling</secondary>
61248 </indexterm>
61249 No function is provided for freeing memory, because that is never needed.
61250 The dynamic memory that Exim uses when receiving a message is automatically
61251 recycled if another message is received by the same process (this applies only
61252 to incoming SMTP connections &ndash; other input methods can supply only one
61253 message at a time). After receiving the last message, a reception process
61254 terminates.
61255 </para>
61256 <para>
61257 Because it is recycled, the normal dynamic memory cannot be used for holding
61258 data that must be preserved over a number of incoming messages on the same SMTP
61259 connection. However, Exim in fact uses two pools of dynamic memory; the second
61260 one is not recycled, and can be used for this purpose.
61261 </para>
61262 <para>
61263 If you want to allocate memory that remains available for subsequent messages
61264 in the same SMTP connection, you should set
61265 </para>
61266 <literallayout class="monospaced">
61267 store_pool = POOL_PERM
61268 </literallayout>
61269 <para>
61270 before calling the function that does the allocation. There is no need to
61271 restore the value if you do not need to; however, if you do want to revert to
61272 the normal pool, you can either restore the previous value of <option>store_pool</option> or
61273 set it explicitly to POOL_MAIN.
61274 </para>
61275 <para>
61276 The pool setting applies to all functions that get dynamic memory, including
61277 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
61278 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
61279 block of memory from the permanent pool while preserving the value of
61280 <option>store_pool</option>.
61281 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
61282 </para>
61283 </section>
61284 </chapter>
61285
61286 <chapter id="CHAPsystemfilter">
61287 <title>System-wide message filtering</title>
61288 <para>
61289 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
61290 <primary>filter</primary>
61291 <secondary>system filter</secondary>
61292 </indexterm>
61293 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
61294 <primary>filtering all mail</primary>
61295 </indexterm>
61296 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
61297 <primary>system filter</primary>
61298 </indexterm>
61299 The previous chapters (on ACLs and the local scan function) describe checks
61300 that can be applied to messages before they are accepted by a host. There is
61301 also a mechanism for checking messages once they have been received, but before
61302 they are delivered. This is called the <emphasis>system filter</emphasis>.
61303 </para>
61304 <para>
61305 The system filter operates in a similar manner to users&#x2019; filter files, but it
61306 is run just once per message (however many recipients the message has).
61307 It should not normally be used as a substitute for routing, because <option>deliver</option>
61308 commands in a system router provide new envelope recipient addresses.
61309 The system filter must be an Exim filter. It cannot be a Sieve filter.
61310 </para>
61311 <para>
61312 The system filter is run at the start of a delivery attempt, before any routing
61313 is done. If a message fails to be completely delivered at the first attempt,
61314 the system filter is run again at the start of every retry.
61315 If you want your filter to do something only once per message, you can make use
61316 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
61317 prevent it happening on retries.
61318 </para>
61319 <para>
61320 <indexterm role="variable">
61321 <primary><varname>$domain</varname></primary>
61322 </indexterm>
61323 <indexterm role="variable">
61324 <primary><varname>$local_part</varname></primary>
61325 </indexterm>
61326 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
61327 specific to individual recipient addresses, such as <varname>$local_part</varname> and
61328 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
61329 you want to run a centrally-specified filter for each recipient address
61330 independently, you can do so by setting up a suitable <command>redirect</command> router, as
61331 described in section <xref linkend="SECTperaddfil"/> below.
61332 </para>
61333 <section id="SECID212">
61334 <title>Specifying a system filter</title>
61335 <para>
61336 <indexterm role="concept">
61337 <primary>uid (user id)</primary>
61338 <secondary>system filter</secondary>
61339 </indexterm>
61340 <indexterm role="concept">
61341 <primary>gid (group id)</primary>
61342 <secondary>system filter</secondary>
61343 </indexterm>
61344 The name of the file that contains the system filter must be specified by
61345 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
61346 other than root, you must also set <option>system_filter_user</option> and
61347 <option>system_filter_group</option> as appropriate. For example:
61348 </para>
61349 <literallayout class="monospaced">
61350 system_filter = /etc/mail/exim.filter
61351 system_filter_user = exim
61352 </literallayout>
61353 <para>
61354 If a system filter generates any deliveries directly to files or pipes (via the
61355 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
61356 specified by setting <option>system_filter_file_transport</option> and
61357 <option>system_filter_pipe_transport</option>, respectively. Similarly,
61358 <option>system_filter_reply_transport</option> must be set to handle any messages generated
61359 by the <option>reply</option> command.
61360 </para>
61361 </section>
61362 <section id="SECID213">
61363 <title>Testing a system filter</title>
61364 <para>
61365 You can run simple tests of a system filter in the same way as for a user
61366 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
61367 are permitted only in system filters are recognized.
61368 </para>
61369 <para>
61370 If you want to test the combined effect of a system filter and a user filter,
61371 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
61372 </para>
61373 </section>
61374 <section id="SECID214">
61375 <title>Contents of a system filter</title>
61376 <para>
61377 The language used to specify system filters is the same as for users&#x2019; filter
61378 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
61379 mail filtering</emphasis>. However, there are some additional features that are
61380 available only in system filters; these are described in subsequent sections.
61381 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
61382 they cause errors.
61383 </para>
61384 <para>
61385 <indexterm role="concept">
61386 <primary>frozen messages</primary>
61387 <secondary>manual thaw; testing in filter</secondary>
61388 </indexterm>
61389 There are two special conditions which, though available in users&#x2019; filter
61390 files, are designed for use in system filters. The condition <option>first_delivery</option>
61391 is true only for the first attempt at delivering a message, and
61392 <option>manually_thawed</option> is true only if the message has been frozen, and
61393 subsequently thawed by an admin user. An explicit forced delivery counts as a
61394 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
61395 </para>
61396 <para>
61397 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
61398 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
61399 succeed, it will not be tried again.
61400 If you want Exim to retry an unseen delivery until it succeeds, you should
61401 arrange to set it up every time the filter runs.
61402 </para>
61403 <para>
61404 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
61405 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
61406 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
61407 to which users&#x2019; filter files can refer.
61408 </para>
61409 </section>
61410 <section id="SECID215">
61411 <title>Additional variable for system filters</title>
61412 <para>
61413 <indexterm role="variable">
61414 <primary><varname>$recipients</varname></primary>
61415 </indexterm>
61416 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
61417 of the message (separated by commas and white space), is available in system
61418 filters. It is not available in users&#x2019; filters for privacy reasons.
61419 </para>
61420 </section>
61421 <section id="SECID216">
61422 <title>Defer, freeze, and fail commands for system filters</title>
61423 <para>
61424 <indexterm role="concept">
61425 <primary>freezing messages</primary>
61426 </indexterm>
61427 <indexterm role="concept">
61428 <primary>message</primary>
61429 <secondary>freezing</secondary>
61430 </indexterm>
61431 <indexterm role="concept">
61432 <primary>message</primary>
61433 <secondary>forced failure</secondary>
61434 </indexterm>
61435 <indexterm role="concept">
61436 <primary><option>fail</option></primary>
61437 <secondary>in system filter</secondary>
61438 </indexterm>
61439 <indexterm role="concept">
61440 <primary><option>freeze</option> in system filter</primary>
61441 </indexterm>
61442 <indexterm role="concept">
61443 <primary><option>defer</option> in system filter</primary>
61444 </indexterm>
61445 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
61446 always available in system filters, but are not normally enabled in users&#x2019;
61447 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
61448 for the <command>redirect</command> router.) These commands can optionally be followed by the
61449 word <option>text</option> and a string containing an error message, for example:
61450 </para>
61451 <literallayout class="monospaced">
61452 fail text "this message looks like spam to me"
61453 </literallayout>
61454 <para>
61455 The keyword <option>text</option> is optional if the next character is a double quote.
61456 </para>
61457 <para>
61458 The <option>defer</option> command defers delivery of the original recipients of the
61459 message. The <option>fail</option> command causes all the original recipients to be failed,
61460 and a bounce message to be created. The <option>freeze</option> command suspends all
61461 delivery attempts for the original recipients. In all cases, any new deliveries
61462 that are specified by the filter are attempted as normal after the filter has
61463 run.
61464 </para>
61465 <para>
61466 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
61467 not manually frozen since. This means that automatic freezing by a system
61468 filter can be used as a way of checking out suspicious messages. If a message
61469 is found to be all right, manually unfreezing it allows it to be delivered.
61470 </para>
61471 <para>
61472 <indexterm role="concept">
61473 <primary>log</primary>
61474 <secondary><option>fail</option> command log line</secondary>
61475 </indexterm>
61476 <indexterm role="concept">
61477 <primary><option>fail</option></primary>
61478 <secondary>log line; reducing</secondary>
61479 </indexterm>
61480 The text given with a fail command is used as part of the bounce message as
61481 well as being written to the log. If the message is quite long, this can fill
61482 up a lot of log space when such failures are common. To reduce the size of the
61483 log message, Exim interprets the text in a special way if it starts with the
61484 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
61485 strings is written to the log, and the rest of the text is used in the bounce
61486 message. For example:
61487 </para>
61488 <literallayout class="monospaced">
61489 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
61490      because it contains attachments that we are \
61491      not prepared to receive."
61492 </literallayout>
61493 <para>
61494 <indexterm role="concept">
61495 <primary>loop</primary>
61496 <secondary>caused by <option>fail</option></secondary>
61497 </indexterm>
61498 Take great care with the <option>fail</option> command when basing the decision to fail on
61499 the contents of the message, because the bounce message will of course include
61500 the contents of the original message and will therefore trigger the <option>fail</option>
61501 command again (causing a mail loop) unless steps are taken to prevent this.
61502 Testing the <option>error_message</option> condition is one way to prevent this. You could
61503 use, for example
61504 </para>
61505 <literallayout class="monospaced">
61506 if $message_body contains "this is spam" and not error_message
61507 then fail text "spam is not wanted here" endif
61508 </literallayout>
61509 <para>
61510 though of course that might let through unwanted bounce messages. The
61511 alternative is clever checking of the body and/or headers to detect bounces
61512 generated by the filter.
61513 </para>
61514 <para>
61515 The interpretation of a system filter file ceases after a
61516 <option>defer</option>,
61517 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
61518 set up earlier in the filter file are honoured, so you can use a sequence such
61519 as
61520 </para>
61521 <literallayout class="monospaced">
61522 mail ...
61523 freeze
61524 </literallayout>
61525 <para>
61526 to send a specified message when the system filter is freezing (or deferring or
61527 failing) a message. The normal deliveries for the message do not, of course,
61528 take place.
61529 </para>
61530 </section>
61531 <section id="SECTaddremheasys">
61532 <title>Adding and removing headers in a system filter</title>
61533 <para>
61534 <indexterm role="concept">
61535 <primary>header lines</primary>
61536 <secondary>adding; in system filter</secondary>
61537 </indexterm>
61538 <indexterm role="concept">
61539 <primary>header lines</primary>
61540 <secondary>removing; in system filter</secondary>
61541 </indexterm>
61542 <indexterm role="concept">
61543 <primary>filter</primary>
61544 <secondary>header lines; adding/removing</secondary>
61545 </indexterm>
61546 Two filter commands that are available only in system filters are:
61547 </para>
61548 <literallayout class="monospaced">
61549 headers add &lt;string&gt;
61550 headers remove &lt;string&gt;
61551 </literallayout>
61552 <para>
61553 The argument for the <option>headers add</option> is a string that is expanded and then
61554 added to the end of the message&#x2019;s headers. It is the responsibility of the
61555 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
61556 space is ignored, and if the string is otherwise empty, or if the expansion is
61557 forced to fail, the command has no effect.
61558 </para>
61559 <para>
61560 You can use <quote>\n</quote> within the string, followed by white space, to specify
61561 continued header lines. More than one header may be added in one command by
61562 including <quote>\n</quote> within the string without any following white space. For
61563 example:
61564 </para>
61565 <literallayout class="monospaced">
61566 headers add "X-header-1: ....\n  \
61567              continuation of X-header-1 ...\n\
61568              X-header-2: ...."
61569 </literallayout>
61570 <para>
61571 Note that the header line continuation white space after the first newline must
61572 be placed before the backslash that continues the input string, because white
61573 space after input continuations is ignored.
61574 </para>
61575 <para>
61576 The argument for <option>headers remove</option> is a colon-separated list of header names.
61577 This command applies only to those headers that are stored with the message;
61578 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
61579 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
61580 header with the same name, they are all removed.
61581 </para>
61582 <para>
61583 The <option>headers</option> command in a system filter makes an immediate change to the set
61584 of header lines that was received with the message (with possible additions
61585 from ACL processing). Subsequent commands in the system filter operate on the
61586 modified set, which also forms the basis for subsequent message delivery.
61587 Unless further modified during routing or transporting, this set of headers is
61588 used for all recipients of the message.
61589 </para>
61590 <para>
61591 During routing and transporting, the variables that refer to the contents of
61592 header lines refer only to those lines that are in this set. Thus, header lines
61593 that are added by a system filter are visible to users&#x2019; filter files and to all
61594 routers and transports. This contrasts with the manipulation of header lines by
61595 routers and transports, which is not immediate, but which instead is saved up
61596 until the message is actually being written (see section
61597 <xref linkend="SECTheadersaddrem"/>).
61598 </para>
61599 <para>
61600 If the message is not delivered at the first attempt, header lines that were
61601 added by the system filter are stored with the message, and so are still
61602 present at the next delivery attempt. Header lines that were removed are still
61603 present, but marked <quote>deleted</quote> so that they are not transported with the
61604 message. For this reason, it is usual to make the <option>headers</option> command
61605 conditional on <option>first_delivery</option> so that the set of header lines is not
61606 modified more than once.
61607 </para>
61608 <para>
61609 Because header modification in a system filter acts immediately, you have to
61610 use an indirect approach if you want to modify the contents of a header line.
61611 For example:
61612 </para>
61613 <literallayout class="monospaced">
61614 headers add "Old-Subject: $h_subject:"
61615 headers remove "Subject"
61616 headers add "Subject: new subject (was: $h_old-subject:)"
61617 headers remove "Old-Subject"
61618 </literallayout>
61619 </section>
61620 <section id="SECID217">
61621 <title>Setting an errors address in a system filter</title>
61622 <para>
61623 <indexterm role="concept">
61624 <primary>envelope sender</primary>
61625 </indexterm>
61626 In a system filter, if a <option>deliver</option> command is followed by
61627 </para>
61628 <literallayout class="monospaced">
61629 errors_to &lt;some address&gt;
61630 </literallayout>
61631 <para>
61632 in order to change the envelope sender (and hence the error reporting) for that
61633 delivery, any address may be specified. (In a user filter, only the current
61634 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
61635 might use
61636 </para>
61637 <literallayout class="monospaced">
61638 unseen deliver monitor@spying.example errors_to root@local.example
61639 </literallayout>
61640 <para>
61641 to take a copy which would not be sent back to the normal error reporting
61642 address if its delivery failed.
61643 </para>
61644 </section>
61645 <section id="SECTperaddfil">
61646 <title>Per-address filtering</title>
61647 <para>
61648 <indexterm role="variable">
61649 <primary><varname>$domain</varname></primary>
61650 </indexterm>
61651 <indexterm role="variable">
61652 <primary><varname>$local_part</varname></primary>
61653 </indexterm>
61654 In contrast to the system filter, which is run just once per message for each
61655 delivery attempt, it is also possible to set up a system-wide filtering
61656 operation that runs once for each recipient address. In this case, variables
61657 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
61658 filter file could be made dependent on them. This is an example of a router
61659 which implements such a filter:
61660 </para>
61661 <literallayout class="monospaced">
61662 central_filter:
61663   check_local_user
61664   driver = redirect
61665   domains = +local_domains
61666   file = /central/filters/$local_part
61667   no_verify
61668   allow_filter
61669   allow_freeze
61670 </literallayout>
61671 <para>
61672 The filter is run in a separate process under its own uid. Therefore, either
61673 <option>check_local_user</option> must be set (as above), in which case the filter is run as
61674 the local user, or the <option>user</option> option must be used to specify which user to
61675 use. If both are set, <option>user</option> overrides.
61676 </para>
61677 <para>
61678 Care should be taken to ensure that none of the commands in the filter file
61679 specify a significant delivery if the message is to go on to be delivered to
61680 its intended recipient. The router will not then claim to have dealt with the
61681 address, so it will be passed on to subsequent routers to be delivered in the
61682 normal way.
61683 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
61684 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
61685 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
61686 </para>
61687 </section>
61688 </chapter>
61689
61690 <chapter id="CHAPmsgproc">
61691 <title>Message processing</title>
61692 <para>
61693 <indexterm role="concept" id="IIDmesproc" class="startofrange">
61694 <primary>message</primary>
61695 <secondary>general processing</secondary>
61696 </indexterm>
61697 Exim performs various transformations on the sender and recipient addresses of
61698 all messages that it handles, and also on the messages&#x2019; header lines. Some of
61699 these are optional and configurable, while others always take place. All of
61700 this processing, except rewriting as a result of routing, and the addition or
61701 removal of header lines while delivering, happens when a message is received,
61702 before it is placed on Exim&#x2019;s queue.
61703 </para>
61704 <para>
61705 Some of the automatic processing takes place by default only for
61706 <quote>locally-originated</quote> messages. This adjective is used to describe messages
61707 that are not received over TCP/IP, but instead are passed to an Exim process on
61708 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
61709 set up by the <option>-bs</option> command line option.
61710 </para>
61711 <para>
61712 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
61713 or ::1) are not considered to be locally-originated. Exim does not treat the
61714 loopback interface specially in any way.
61715 </para>
61716 <para>
61717 If you want the loopback interface to be treated specially, you must ensure
61718 that there are appropriate entries in your ACLs.
61719 </para>
61720 <section id="SECTsubmodnon">
61721 <title>Submission mode for non-local messages</title>
61722 <para>
61723 <indexterm role="concept">
61724 <primary>message</primary>
61725 <secondary>submission</secondary>
61726 </indexterm>
61727 <indexterm role="concept">
61728 <primary>submission mode</primary>
61729 </indexterm>
61730 Processing that happens automatically for locally-originated messages (unless
61731 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
61732 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
61733 state. Submission mode is set by the modifier
61734 </para>
61735 <literallayout class="monospaced">
61736 control = submission
61737 </literallayout>
61738 <para>
61739 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
61740 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
61741 a local submission, and is normally used when the source of the message is
61742 known to be an MUA running on a client host (as opposed to an MTA). For
61743 example, to set submission mode for messages originating on the IPv4 loopback
61744 interface, you could include the following in the MAIL ACL:
61745 </para>
61746 <literallayout class="monospaced">
61747 warn  hosts = 127.0.0.1
61748       control = submission
61749 </literallayout>
61750 <para>
61751 <indexterm role="concept">
61752 <primary><option>sender_retain</option> submission option</primary>
61753 </indexterm>
61754 There are some options that can be used when setting submission mode. A slash
61755 is used to separate options. For example:
61756 </para>
61757 <literallayout class="monospaced">
61758 control = submission/sender_retain
61759 </literallayout>
61760 <para>
61761 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
61762 true and <option>local_from_check</option> false for the current incoming message. The first
61763 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
61764 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
61765 authenticated sender. With this setting, Exim still fixes up messages by adding
61766 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
61767 attempt to check sender authenticity in header lines.
61768 </para>
61769 <para>
61770 When <option>sender_retain</option> is not set, a submission mode setting may specify a
61771 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
61772 example:
61773 </para>
61774 <literallayout class="monospaced">
61775 control = submission/domain=some.domain
61776 </literallayout>
61777 <para>
61778 The domain may be empty. How this value is used is described in sections
61779 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
61780 that allows you to specify the user&#x2019;s full name for inclusion in a created
61781 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
61782 </para>
61783 <literallayout class="monospaced">
61784 accept authenticated = *
61785        control = submission/domain=wonderland.example/\
61786                             name=${lookup {$authenticated_id} \
61787                                    lsearch {/etc/exim/namelist}}
61788 </literallayout>
61789 <para>
61790 Because the name may contain any characters, including slashes, the <option>name</option>
61791 option must be given last. The remainder of the string is used as the name. For
61792 the example above, if <filename>/etc/exim/namelist</filename> contains:
61793 </para>
61794 <literallayout class="monospaced">
61795 bigegg:  Humpty Dumpty
61796 </literallayout>
61797 <para>
61798 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
61799 line would be:
61800 </para>
61801 <literallayout class="monospaced">
61802 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
61803 </literallayout>
61804 <para>
61805 <indexterm role="concept">
61806 <primary>return path</primary>
61807 <secondary>in submission mode</secondary>
61808 </indexterm>
61809 By default, submission mode forces the return path to the same address as is
61810 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
61811 specified, the return path is also left unchanged.
61812 </para>
61813 <para>
61814 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
61815 ACL. This means that any sender checks performed before the fix-ups use the
61816 untrusted sender address specified by the user, not the trusted sender address
61817 specified by submission mode. Although this might be slightly unexpected, it
61818 does mean that you can configure ACL checks to spot that a user is trying to
61819 spoof another&#x2019;s address.
61820 </para>
61821 </section>
61822 <section id="SECTlineendings">
61823 <title>Line endings</title>
61824 <para>
61825 <indexterm role="concept">
61826 <primary>line endings</primary>
61827 </indexterm>
61828 <indexterm role="concept">
61829 <primary>carriage return</primary>
61830 </indexterm>
61831 <indexterm role="concept">
61832 <primary>linefeed</primary>
61833 </indexterm>
61834 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
61835 linefeed) is the line ending for messages transmitted over the Internet using
61836 SMTP over TCP/IP. However, within individual operating systems, different
61837 conventions are used. For example, Unix-like systems use just LF, but others
61838 use CRLF or just CR.
61839 </para>
61840 <para>
61841 Exim was designed for Unix-like systems, and internally, it stores messages
61842 using the system&#x2019;s convention of a single LF as a line terminator. When
61843 receiving a message, all line endings are translated to this standard format.
61844 Originally, it was thought that programs that passed messages directly to an
61845 MTA within an operating system would use that system&#x2019;s convention. Experience
61846 has shown that this is not the case; for example, there are Unix applications
61847 that use CRLF in this circumstance. For this reason, and for compatibility with
61848 other MTAs, the way Exim handles line endings for all messages is now as
61849 follows:
61850 </para>
61851 <itemizedlist>
61852 <listitem>
61853 <para>
61854 LF not preceded by CR is treated as a line ending.
61855 </para>
61856 </listitem>
61857 <listitem>
61858 <para>
61859 CR is treated as a line ending; if it is immediately followed by LF, the LF
61860 is ignored.
61861 </para>
61862 </listitem>
61863 <listitem>
61864 <para>
61865 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
61866 nor a local message in the state where a line containing only a dot is a
61867 terminator.
61868 </para>
61869 </listitem>
61870 <listitem>
61871 <para>
61872 If a bare CR is encountered within a header line, an extra space is added after
61873 the line terminator so as not to end the header line. The reasoning behind this
61874 is that bare CRs in header lines are most likely either to be mistakes, or
61875 people trying to play silly games.
61876 </para>
61877 </listitem>
61878 <listitem>
61879 <para>
61880 If the first header line received in a message ends with CRLF, a subsequent
61881 bare LF in a header line is treated in the same way as a bare CR in a header
61882 line.
61883 </para>
61884 </listitem>
61885 </itemizedlist>
61886 </section>
61887 <section id="SECID218">
61888 <title>Unqualified addresses</title>
61889 <para>
61890 <indexterm role="concept">
61891 <primary>unqualified addresses</primary>
61892 </indexterm>
61893 <indexterm role="concept">
61894 <primary>address</primary>
61895 <secondary>qualification</secondary>
61896 </indexterm>
61897 By default, Exim expects every envelope address it receives from an external
61898 host to be fully qualified. Unqualified addresses cause negative responses to
61899 SMTP commands. However, because SMTP is used as a means of transporting
61900 messages from MUAs running on personal workstations, there is sometimes a
61901 requirement to accept unqualified addresses from specific hosts or IP networks.
61902 </para>
61903 <para>
61904 Exim has two options that separately control which hosts may send unqualified
61905 sender or recipient addresses in SMTP commands, namely
61906 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
61907 cases, if an unqualified address is accepted, it is qualified by adding the
61908 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
61909 </para>
61910 <para>
61911 <indexterm role="option">
61912 <primary><option>qualify_domain</option></primary>
61913 </indexterm>
61914 <indexterm role="option">
61915 <primary><option>qualify_recipient</option></primary>
61916 </indexterm>
61917 Unqualified addresses in header lines are automatically qualified for messages
61918 that are locally originated, unless the <option>-bnq</option> option is given on the command
61919 line. For messages received over SMTP, unqualified addresses in header lines
61920 are qualified only if unqualified addresses are permitted in SMTP commands. In
61921 other words, such qualification is also controlled by
61922 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
61923 </para>
61924 </section>
61925 <section id="SECID219">
61926 <title>The UUCP From line</title>
61927 <para>
61928 <indexterm role="concept">
61929 <primary><quote>From</quote> line</primary>
61930 </indexterm>
61931 <indexterm role="concept">
61932 <primary>UUCP</primary>
61933 <secondary><quote>From</quote> line</secondary>
61934 </indexterm>
61935 <indexterm role="concept">
61936 <primary>sender</primary>
61937 <secondary>address</secondary>
61938 </indexterm>
61939 <indexterm role="option">
61940 <primary><option>uucp_from_pattern</option></primary>
61941 </indexterm>
61942 <indexterm role="option">
61943 <primary><option>uucp_from_sender</option></primary>
61944 </indexterm>
61945 <indexterm role="concept">
61946 <primary>envelope sender</primary>
61947 </indexterm>
61948 <indexterm role="concept">
61949 <primary>Sendmail compatibility</primary>
61950 <secondary><quote>From</quote> line</secondary>
61951 </indexterm>
61952 Messages that have come from UUCP (and some other applications) often begin
61953 with a line containing the envelope sender and a timestamp, following the word
61954 <quote>From</quote>. Examples of two common formats are:
61955 </para>
61956 <literallayout class="monospaced">
61957 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
61958 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
61959 </literallayout>
61960 <para>
61961 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
61962 Exim recognizes such lines at the start of messages that are submitted to it
61963 via the command line (that is, on the standard input). It does not recognize
61964 such lines in incoming SMTP messages, unless the sending host matches
61965 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
61966 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
61967 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
61968 default value matches the two common cases shown above and puts the address
61969 that follows <quote>From</quote> into <varname>$1</varname>.
61970 </para>
61971 <para>
61972 <indexterm role="concept">
61973 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
61974 <secondary>in <quote>From </quote> line handling</secondary>
61975 </indexterm>
61976 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
61977 a trusted user, the message&#x2019;s sender address is constructed by expanding the
61978 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
61979 then parsed as an RFC 2822 address. If there is no domain, the local part is
61980 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
61981 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
61982 </para>
61983 <para>
61984 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
61985 sender address is not changed. This is also the case for incoming SMTP messages
61986 that are permitted to contain <quote>From</quote> lines.
61987 </para>
61988 <para>
61989 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
61990 treated as a data line that starts the body of the message, as it is not valid
61991 as a header line. This also happens if a <quote>From</quote> line is present in an
61992 incoming SMTP message from a source that is not permitted to send them.
61993 </para>
61994 </section>
61995 <section id="SECID220">
61996 <title>Resent- header lines</title>
61997 <para>
61998 <indexterm role="concept">
61999 <primary><option>Resent-</option> header lines</primary>
62000 </indexterm>
62001 <indexterm role="concept">
62002 <primary>header lines</primary>
62003 <secondary>Resent-</secondary>
62004 </indexterm>
62005 RFC 2822 makes provision for sets of header lines starting with the string
62006 <literal>Resent-</literal> to be added to a message when it is resent by the original
62007 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
62008 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
62009 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
62010 </para>
62011 <blockquote>
62012 <para>
62013 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
62014 processing of replies or other such automatic actions on messages.</emphasis>
62015 </para>
62016 </blockquote>
62017 <para>
62018 This leaves things a bit vague as far as other processing actions such as
62019 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
62020 follows:
62021 </para>
62022 <itemizedlist>
62023 <listitem>
62024 <para>
62025 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
62026 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
62027 </para>
62028 </listitem>
62029 <listitem>
62030 <para>
62031 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
62032 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
62033 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
62034 </para>
62035 </listitem>
62036 <listitem>
62037 <para>
62038 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
62039 also removed.
62040 </para>
62041 </listitem>
62042 <listitem>
62043 <para>
62044 For a locally-submitted message,
62045 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
62046 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
62047 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
62048 included in log lines in this case.
62049 </para>
62050 </listitem>
62051 <listitem>
62052 <para>
62053 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
62054 <option>Resent-</option> header lines are present.
62055 </para>
62056 </listitem>
62057 </itemizedlist>
62058 </section>
62059 <section id="SECID221">
62060 <title>The Auto-Submitted: header line</title>
62061 <para>
62062 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
62063 includes the header line:
62064 </para>
62065 <literallayout class="monospaced">
62066 Auto-Submitted: auto-replied
62067 </literallayout>
62068 </section>
62069 <section id="SECID222">
62070 <title>The Bcc: header line</title>
62071 <para>
62072 <indexterm role="concept">
62073 <primary><emphasis>Bcc:</emphasis> header line</primary>
62074 </indexterm>
62075 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
62076 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
62077 extracting its addresses). If <option>-t</option> is not present on the command line, any
62078 existing <emphasis>Bcc:</emphasis> is not removed.
62079 </para>
62080 </section>
62081 <section id="SECID223">
62082 <title>The Date: header line</title>
62083 <para>
62084 <indexterm role="concept">
62085 <primary><emphasis>Date:</emphasis> header line</primary>
62086 </indexterm>
62087 <indexterm role="concept">
62088 <primary>header lines</primary>
62089 <secondary>Date:</secondary>
62090 </indexterm>
62091 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
62092 Exim adds one, using the current date and time, unless the
62093 <option>suppress_local_fixups</option> control has been specified.
62094 </para>
62095 </section>
62096 <section id="SECID224">
62097 <title>The Delivery-date: header line</title>
62098 <para>
62099 <indexterm role="concept">
62100 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
62101 </indexterm>
62102 <indexterm role="option">
62103 <primary><option>delivery_date_remove</option></primary>
62104 </indexterm>
62105 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
62106 set. Exim can be configured to add them to the final delivery of messages. (See
62107 the generic <option>delivery_date_add</option> transport option.) They should not be present
62108 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
62109 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
62110 messages.
62111 </para>
62112 </section>
62113 <section id="SECID225">
62114 <title>The Envelope-to: header line</title>
62115 <para>
62116 <indexterm role="concept">
62117 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
62118 </indexterm>
62119 <indexterm role="concept">
62120 <primary>header lines</primary>
62121 <secondary>Envelope-to:</secondary>
62122 </indexterm>
62123 <indexterm role="option">
62124 <primary><option>envelope_to_remove</option></primary>
62125 </indexterm>
62126 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
62127 Exim can be configured to add them to the final delivery of messages. (See the
62128 generic <option>envelope_to_add</option> transport option.) They should not be present in
62129 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
62130 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
62131 messages.
62132 </para>
62133 </section>
62134 <section id="SECTthefrohea">
62135 <title>The From: header line</title>
62136 <para>
62137 <indexterm role="concept">
62138 <primary><emphasis>From:</emphasis> header line</primary>
62139 </indexterm>
62140 <indexterm role="concept">
62141 <primary>header lines</primary>
62142 <secondary>From:</secondary>
62143 </indexterm>
62144 <indexterm role="concept">
62145 <primary>Sendmail compatibility</primary>
62146 <secondary><quote>From</quote> line</secondary>
62147 </indexterm>
62148 <indexterm role="concept">
62149 <primary>message</primary>
62150 <secondary>submission</secondary>
62151 </indexterm>
62152 <indexterm role="concept">
62153 <primary>submission mode</primary>
62154 </indexterm>
62155 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
62156 adds one if either of the following conditions is true:
62157 </para>
62158 <itemizedlist>
62159 <listitem>
62160 <para>
62161 The envelope sender address is not empty (that is, this is not a bounce
62162 message). The added header line copies the envelope sender address.
62163 </para>
62164 </listitem>
62165 <listitem>
62166 <para>
62167 <indexterm role="variable">
62168 <primary><varname>$authenticated_id</varname></primary>
62169 </indexterm>
62170 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
62171 </para>
62172 <orderedlist numeration="arabic">
62173 <listitem>
62174 <para>
62175 <indexterm role="variable">
62176 <primary><varname>$qualify_domain</varname></primary>
62177 </indexterm>
62178 If no domain is specified by the submission control, the local part is
62179 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62180 </para>
62181 </listitem>
62182 <listitem>
62183 <para>
62184 If a non-empty domain is specified by the submission control, the local
62185 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62186 </para>
62187 </listitem>
62188 <listitem>
62189 <para>
62190 If an empty domain is specified by the submission control,
62191 <varname>$authenticated_id</varname> is assumed to be the complete address.
62192 </para>
62193 </listitem>
62194 </orderedlist>
62195 </listitem>
62196 </itemizedlist>
62197 <para>
62198 A non-empty envelope sender takes precedence.
62199 </para>
62200 <para>
62201 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
62202 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
62203 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
62204 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
62205 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
62206 <option>unknown_login</option> configuration option). The address is qualified with
62207 <option>qualify_domain</option>.
62208 </para>
62209 <para>
62210 For compatibility with Sendmail, if an incoming, non-SMTP message has a
62211 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
62212 user, this is replaced by an address containing the user&#x2019;s login name and full
62213 name as described in section <xref linkend="SECTconstr"/>.
62214 </para>
62215 </section>
62216 <section id="SECID226">
62217 <title>The Message-ID: header line</title>
62218 <para>
62219 <indexterm role="concept">
62220 <primary><emphasis>Message-ID:</emphasis> header line</primary>
62221 </indexterm>
62222 <indexterm role="concept">
62223 <primary>header lines</primary>
62224 <secondary>Message-ID:</secondary>
62225 </indexterm>
62226 <indexterm role="concept">
62227 <primary>message</primary>
62228 <secondary>submission</secondary>
62229 </indexterm>
62230 <indexterm role="option">
62231 <primary><option>message_id_header_text</option></primary>
62232 </indexterm>
62233 If a locally-generated or submission-mode incoming message does not contain a
62234 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
62235 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
62236 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
62237 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
62238 message id, preceded by the letter E to ensure it starts with a letter, and
62239 followed by @ and the primary host name. Additional information can be included
62240 in this header line by setting the <option>message_id_header_text</option> and/or
62241 <option>message_id_header_domain</option> options.
62242 </para>
62243 </section>
62244 <section id="SECID227">
62245 <title>The Received: header line</title>
62246 <para>
62247 <indexterm role="concept">
62248 <primary><emphasis>Received:</emphasis> header line</primary>
62249 </indexterm>
62250 <indexterm role="concept">
62251 <primary>header lines</primary>
62252 <secondary>Received:</secondary>
62253 </indexterm>
62254 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
62255 contents are defined by the <option>received_header_text</option> configuration option, and
62256 Exim automatically adds a semicolon and a timestamp to the configured string.
62257 </para>
62258 <para>
62259 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
62260 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
62261 line is the time that the message started to be received. This is the value
62262 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
62263 </para>
62264 <para>
62265 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
62266 changed to the time of acceptance, which is (apart from a small delay while the
62267 -H spool file is written) the earliest time at which delivery could start.
62268 </para>
62269 </section>
62270 <section id="SECID228">
62271 <title>The References: header line</title>
62272 <para>
62273 <indexterm role="concept">
62274 <primary><emphasis>References:</emphasis> header line</primary>
62275 </indexterm>
62276 <indexterm role="concept">
62277 <primary>header lines</primary>
62278 <secondary>References:</secondary>
62279 </indexterm>
62280 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
62281 header line. This is constructed according to the rules that are described in
62282 section 3.64 of RFC 2822 (which states that replies should contain such a
62283 header line), and section 3.14 of RFC 3834 (which states that automatic
62284 responses are not different in this respect). However, because some mail
62285 processing software does not cope well with very long header lines, no more
62286 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
62287 incoming message. If there are more than 12, the first one and then the final
62288 11 are copied, before adding the message ID of the incoming message.
62289 </para>
62290 </section>
62291 <section id="SECID229">
62292 <title>The Return-path: header line</title>
62293 <para>
62294 <indexterm role="concept">
62295 <primary><emphasis>Return-path:</emphasis> header line</primary>
62296 </indexterm>
62297 <indexterm role="concept">
62298 <primary>header lines</primary>
62299 <secondary>Return-path:</secondary>
62300 </indexterm>
62301 <indexterm role="option">
62302 <primary><option>return_path_remove</option></primary>
62303 </indexterm>
62304 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
62305 it does the final delivery of messages. (See the generic <option>return_path_add</option>
62306 transport option.) Therefore, they should not be present in messages in
62307 transit. If the <option>return_path_remove</option> configuration option is set (the
62308 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
62309 </para>
62310 </section>
62311 <section id="SECTthesenhea">
62312 <title>The Sender: header line</title>
62313 <para>
62314 <indexterm role="concept">
62315 <primary><emphasis>Sender:</emphasis> header line</primary>
62316 </indexterm>
62317 <indexterm role="concept">
62318 <primary>message</primary>
62319 <secondary>submission</secondary>
62320 </indexterm>
62321 <indexterm role="concept">
62322 <primary>header lines</primary>
62323 <secondary>Sender:</secondary>
62324 </indexterm>
62325 For a locally-originated message from an untrusted user, Exim may remove an
62326 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
62327 these actions by setting the <option>local_sender_retain</option> option true, the
62328 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
62329 control setting.
62330 </para>
62331 <para>
62332 When a local message is received from an untrusted user and
62333 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
62334 control has not been set, a check is made to see if the address given in the
62335 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
62336 that is expected has the login name as the local part and the value of
62337 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
62338 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
62339 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
62340 line is added to the message.
62341 </para>
62342 <para>
62343 If you set <option>local_from_check</option> false, this checking does not occur. However,
62344 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
62345 <option>local_sender_retain</option> to be true. It is not possible to set both of these
62346 options true at the same time.
62347 </para>
62348 <para>
62349 <indexterm role="concept">
62350 <primary>submission mode</primary>
62351 </indexterm>
62352 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
62353 received over TCP/IP or for messages submitted by trusted users. However, when
62354 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
62355 not specified on the submission control, the following processing takes place:
62356 </para>
62357 <para>
62358 <indexterm role="variable">
62359 <primary><varname>$authenticated_id</varname></primary>
62360 </indexterm>
62361 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
62362 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
62363 created as follows:
62364 </para>
62365 <itemizedlist>
62366 <listitem>
62367 <para>
62368 <indexterm role="variable">
62369 <primary><varname>$qualify_domain</varname></primary>
62370 </indexterm>
62371 If no domain is specified by the submission control, the local part is
62372 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62373 </para>
62374 </listitem>
62375 <listitem>
62376 <para>
62377 If a non-empty domain is specified by the submission control, the local part
62378 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62379 </para>
62380 </listitem>
62381 <listitem>
62382 <para>
62383 If an empty domain is specified by the submission control,
62384 <varname>$authenticated_id</varname> is assumed to be the complete address.
62385 </para>
62386 </listitem>
62387 </itemizedlist>
62388 <para>
62389 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
62390 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
62391 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
62392 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
62393 </para>
62394 <para>
62395 <indexterm role="concept">
62396 <primary>return path</primary>
62397 <secondary>created from <emphasis>Sender:</emphasis></secondary>
62398 </indexterm>
62399 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
62400 the message (the envelope sender address) is changed to be the same address,
62401 except in the case of submission mode when <option>sender_retain</option> is specified.
62402 </para>
62403 </section>
62404 <section id="SECTheadersaddrem">
62405 <title>Adding and removing header lines in routers and transports</title>
62406 <para>
62407 <indexterm role="concept">
62408 <primary>header lines</primary>
62409 <secondary>adding; in router or transport</secondary>
62410 </indexterm>
62411 <indexterm role="concept">
62412 <primary>header lines</primary>
62413 <secondary>removing; in router or transport</secondary>
62414 </indexterm>
62415 When a message is delivered, the addition and removal of header lines can be
62416 specified in a system filter, or on any of the routers and transports that
62417 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
62418 modifying headers in a system filter. Header lines can also be added in an ACL
62419 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
62420 </para>
62421 <para>
62422 In contrast to what happens in a system filter, header modifications that are
62423 specified on routers and transports apply only to the particular recipient
62424 addresses that are being processed by those routers and transports. These
62425 changes do not actually take place until a copy of the message is being
62426 transported. Therefore, they do not affect the basic set of header lines, and
62427 they do not affect the values of the variables that refer to header lines.
62428 </para>
62429 <para>
62430 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
62431 the transport cannot refer to the modified header lines, because such
62432 expansions all occur before the message is actually transported.
62433 </para>
62434 <para>
62435 For both routers and transports, the argument of a <option>headers_add</option>
62436 option must be in the form of one or more RFC 2822 header lines, separated by
62437 newlines (coded as <quote>\n</quote>). For example:
62438 </para>
62439 <literallayout class="monospaced">
62440 headers_add = X-added-header: added by $primary_hostname\n\
62441               X-added-second: another added header line
62442 </literallayout>
62443 <para>
62444 Exim does not check the syntax of these added header lines.
62445 </para>
62446 <para>
62447 Multiple <option>headers_add</option> options for a single router or transport can be
62448 specified; the values will append to a single list of header lines.
62449 Each header-line is separately expanded.
62450 </para>
62451 <para>
62452 The argument of a <option>headers_remove</option> option must consist of a colon-separated
62453 list of header names. This is confusing, because header names themselves are
62454 often terminated by colons. In this case, the colons are the list separators,
62455 not part of the names. For example:
62456 </para>
62457 <literallayout class="monospaced">
62458 headers_remove = return-receipt-to:acknowledge-to
62459 </literallayout>
62460 <para>
62461 Multiple <option>headers_remove</option> options for a single router or transport can be
62462 specified; the arguments will append to a single header-names list.
62463 Each item is separately expanded.
62464 Note that colons in complex expansions which are used to
62465 form all or part of a <option>headers_remove</option> list
62466 will act as list separators.
62467 </para>
62468 <para>
62469 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
62470 items are expanded at routing time,
62471 and then associated with all addresses that are
62472 accepted by that router, and also with any new addresses that it generates. If
62473 an address passes through several routers as a result of aliasing or
62474 forwarding, the changes are cumulative.
62475 </para>
62476 <para>
62477 <indexterm role="option">
62478 <primary><option>unseen</option></primary>
62479 </indexterm>
62480 However, this does not apply to multiple routers that result from the use of
62481 the <option>unseen</option> option. Any header modifications that were specified by the
62482 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
62483 </para>
62484 <para>
62485 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
62486 settings cannot be delivered together in a batch, so a transport is always
62487 dealing with a set of addresses that have the same header-processing
62488 requirements.
62489 </para>
62490 <para>
62491 The transport starts by writing the original set of header lines that arrived
62492 with the message, possibly modified by the system filter. As it writes out
62493 these lines, it consults the list of header names that were attached to the
62494 recipient address(es) by <option>headers_remove</option> options in routers, and it also
62495 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
62496 names are on either of these lists are not written out. If there are multiple
62497 instances of any listed header, they are all skipped.
62498 </para>
62499 <para>
62500 After the remaining original header lines have been written, new header
62501 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
62502 the order in which they were attached to the address. These are followed by any
62503 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
62504 </para>
62505 <para>
62506 This way of handling header line modifications in routers and transports has
62507 the following consequences:
62508 </para>
62509 <itemizedlist>
62510 <listitem>
62511 <para>
62512 The original set of header lines, possibly modified by the system filter,
62513 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
62514 to it, at all times.
62515 </para>
62516 </listitem>
62517 <listitem>
62518 <para>
62519 Header lines that are added by a router&#x2019;s
62520 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
62521 expansion syntax in subsequent routers or the transport.
62522 </para>
62523 </listitem>
62524 <listitem>
62525 <para>
62526 Conversely, header lines that are specified for removal by <option>headers_remove</option>
62527 in a router remain visible to subsequent routers and the transport.
62528 </para>
62529 </listitem>
62530 <listitem>
62531 <para>
62532 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
62533 a later router or by a transport.
62534 </para>
62535 </listitem>
62536 <listitem>
62537 <para>
62538 An added header can refer to the contents of an original header that is to be
62539 removed, even it has the same name as the added header. For example:
62540 </para>
62541 <literallayout class="monospaced">
62542 headers_remove = subject
62543 headers_add = Subject: new subject (was: $h_subject:)
62544 </literallayout>
62545 </listitem>
62546 </itemizedlist>
62547 <para>
62548 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
62549 for a <command>redirect</command> router that has the <option>one_time</option> option set.
62550 </para>
62551 </section>
62552 <section id="SECTconstr">
62553 <title>Constructed addresses</title>
62554 <para>
62555 <indexterm role="concept">
62556 <primary>address</primary>
62557 <secondary>constructed</secondary>
62558 </indexterm>
62559 <indexterm role="concept">
62560 <primary>constructed address</primary>
62561 </indexterm>
62562 When Exim constructs a sender address for a locally-generated message, it uses
62563 the form
62564 </para>
62565 <literallayout>
62566 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
62567 </literallayout>
62568 <para>
62569 For example:
62570 </para>
62571 <literallayout class="monospaced">
62572 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
62573 </literallayout>
62574 <para>
62575 The user name is obtained from the <option>-F</option> command line option if set, or
62576 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
62577 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
62578 ampersand character, this is replaced by the login name with the first letter
62579 upper cased, as is conventional in a number of operating systems. See the
62580 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
62581 The <option>unknown_username</option> option can be used to specify user names in cases when
62582 there is no password file entry.
62583 </para>
62584 <para>
62585 <indexterm role="concept">
62586 <primary>RFC 2047</primary>
62587 </indexterm>
62588 In all cases, the user name is made to conform to RFC 2822 by quoting all or
62589 parts of it if necessary. In addition, if it contains any non-printing
62590 characters, it is encoded as described in RFC 2047, which defines a way of
62591 including non-ASCII characters in header lines. The value of the
62592 <option>headers_charset</option> option specifies the name of the encoding that is used (the
62593 characters are assumed to be in this encoding). The setting of
62594 <option>print_topbitchars</option> controls whether characters with the top bit set (that
62595 is, with codes greater than 127) count as printing characters or not.
62596 </para>
62597 </section>
62598 <section id="SECID230">
62599 <title>Case of local parts</title>
62600 <para>
62601 <indexterm role="concept">
62602 <primary>case of local parts</primary>
62603 </indexterm>
62604 <indexterm role="concept">
62605 <primary>local part</primary>
62606 <secondary>case of</secondary>
62607 </indexterm>
62608 RFC 2822 states that the case of letters in the local parts of addresses cannot
62609 be assumed to be non-significant. Exim preserves the case of local parts of
62610 addresses, but by default it uses a lower-cased form when it is routing,
62611 because on most Unix systems, usernames are in lower case and case-insensitive
62612 routing is required. However, any particular router can be made to use the
62613 original case for local parts by setting the <option>caseful_local_part</option> generic
62614 router option.
62615 </para>
62616 <para>
62617 <indexterm role="concept">
62618 <primary>mixed-case login names</primary>
62619 </indexterm>
62620 If you must have mixed-case user names on your system, the best way to proceed,
62621 assuming you want case-independent handling of incoming email, is to set up
62622 your first router to convert incoming local parts in your domains to the
62623 correct case by means of a file lookup. For example:
62624 </para>
62625 <literallayout class="monospaced">
62626 correct_case:
62627   driver = redirect
62628   domains = +local_domains
62629   data = ${lookup{$local_part}cdb\
62630               {/etc/usercased.cdb}{$value}fail}\
62631               @$domain
62632 </literallayout>
62633 <para>
62634 For this router, the local part is forced to lower case by the default action
62635 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
62636 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
62637 on any subsequent routers which process your domains, they will operate on
62638 local parts with the correct case in a case-sensitive manner.
62639 </para>
62640 </section>
62641 <section id="SECID231">
62642 <title>Dots in local parts</title>
62643 <para>
62644 <indexterm role="concept">
62645 <primary>dot</primary>
62646 <secondary>in local part</secondary>
62647 </indexterm>
62648 <indexterm role="concept">
62649 <primary>local part</primary>
62650 <secondary>dots in</secondary>
62651 </indexterm>
62652 RFC 2822 forbids empty components in local parts. That is, an unquoted local
62653 part may not begin or end with a dot, nor have two consecutive dots in the
62654 middle. However, it seems that many MTAs do not enforce this, so Exim permits
62655 empty components for compatibility.
62656 </para>
62657 </section>
62658 <section id="SECID232">
62659 <title>Rewriting addresses</title>
62660 <para>
62661 <indexterm role="concept">
62662 <primary>rewriting</primary>
62663 <secondary>addresses</secondary>
62664 </indexterm>
62665 Rewriting of sender and recipient addresses, and addresses in headers, can
62666 happen automatically, or as the result of configuration options, as described
62667 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
62668 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
62669 </para>
62670 <para>
62671 Automatic rewriting includes qualification, as mentioned above. The other case
62672 in which it can happen is when an incomplete non-local domain is given. The
62673 routing process may cause this to be expanded into the full domain name. For
62674 example, a header such as
62675 </para>
62676 <literallayout class="monospaced">
62677 To: hare@teaparty
62678 </literallayout>
62679 <para>
62680 might get rewritten as
62681 </para>
62682 <literallayout class="monospaced">
62683 To: hare@teaparty.wonderland.fict.example
62684 </literallayout>
62685 <para>
62686 Rewriting as a result of routing is the one kind of message processing that
62687 does not happen at input time, as it cannot be done until the address has
62688 been routed.
62689 </para>
62690 <para>
62691 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
62692 addresses have been routed, in case any of the headers get changed as a
62693 result of routing. However, doing this in practice would hold up many
62694 deliveries for unreasonable amounts of time, just because one address could not
62695 immediately be routed. Exim therefore does not delay other deliveries when
62696 routing of one or more addresses is deferred.
62697 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
62698 </para>
62699 </section>
62700 </chapter>
62701
62702 <chapter id="CHAPSMTP">
62703 <title>SMTP processing</title>
62704 <para>
62705 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
62706 <primary>SMTP</primary>
62707 <secondary>processing details</secondary>
62708 </indexterm>
62709 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
62710 <primary>LMTP</primary>
62711 <secondary>processing details</secondary>
62712 </indexterm>
62713 Exim supports a number of different ways of using the SMTP protocol, and its
62714 LMTP variant, which is an interactive protocol for transferring messages into a
62715 closed mail store application. This chapter contains details of how SMTP is
62716 processed. For incoming mail, the following are available:
62717 </para>
62718 <itemizedlist>
62719 <listitem>
62720 <para>
62721 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
62722 </para>
62723 </listitem>
62724 <listitem>
62725 <para>
62726 SMTP over the standard input and output (the <option>-bs</option> option);
62727 </para>
62728 </listitem>
62729 <listitem>
62730 <para>
62731 Batched SMTP on the standard input (the <option>-bS</option> option).
62732 </para>
62733 </listitem>
62734 </itemizedlist>
62735 <para>
62736 For mail delivery, the following are available:
62737 </para>
62738 <itemizedlist>
62739 <listitem>
62740 <para>
62741 SMTP over TCP/IP (the <command>smtp</command> transport);
62742 </para>
62743 </listitem>
62744 <listitem>
62745 <para>
62746 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
62747 <quote>lmtp</quote>);
62748 </para>
62749 </listitem>
62750 <listitem>
62751 <para>
62752 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
62753 transport);
62754 </para>
62755 </listitem>
62756 <listitem>
62757 <para>
62758 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
62759 the <option>use_bsmtp</option> option set).
62760 </para>
62761 </listitem>
62762 </itemizedlist>
62763 <para>
62764 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
62765 stored in or read from files (or pipes), in a format in which SMTP commands are
62766 used to contain the envelope information.
62767 </para>
62768 <section id="SECToutSMTPTCP">
62769 <title>Outgoing SMTP and LMTP over TCP/IP</title>
62770 <para>
62771 <indexterm role="concept">
62772 <primary>SMTP</primary>
62773 <secondary>outgoing over TCP/IP</secondary>
62774 </indexterm>
62775 <indexterm role="concept">
62776 <primary>outgoing SMTP over TCP/IP</primary>
62777 </indexterm>
62778 <indexterm role="concept">
62779 <primary>LMTP</primary>
62780 <secondary>over TCP/IP</secondary>
62781 </indexterm>
62782 <indexterm role="concept">
62783 <primary>outgoing LMTP over TCP/IP</primary>
62784 </indexterm>
62785 <indexterm role="concept">
62786 <primary>EHLO</primary>
62787 </indexterm>
62788 <indexterm role="concept">
62789 <primary>HELO</primary>
62790 </indexterm>
62791 <indexterm role="concept">
62792 <primary>SIZE option on MAIL command</primary>
62793 </indexterm>
62794 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
62795 The <option>protocol</option> option selects which protocol is to be used, but the actual
62796 processing is the same in both cases.
62797 </para>
62798 <para>
62799 If, in response to its EHLO command, Exim is told that the SIZE
62800 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
62801 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
62802 <option>size_addition</option> option (default 1024) to allow for additions to the message
62803 such as per-transport header lines, or changes made in a
62804 <indexterm role="concept">
62805 <primary>transport</primary>
62806 <secondary>filter</secondary>
62807 </indexterm>
62808 <indexterm role="concept">
62809 <primary>filter</primary>
62810 <secondary>transport filter</secondary>
62811 </indexterm>
62812 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
62813 suppressed.
62814 </para>
62815 <para>
62816 If the remote server advertises support for PIPELINING, Exim uses the
62817 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
62818 required for the transaction.
62819 </para>
62820 <para>
62821 If the remote server advertises support for the STARTTLS command, and Exim
62822 was built to support TLS encryption, it tries to start a TLS session unless the
62823 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
62824 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
62825 is called for verification.
62826 </para>
62827 <para>
62828 If the remote server advertises support for the AUTH command, Exim scans
62829 the authenticators configuration for any suitable client settings, as described
62830 in chapter <xref linkend="CHAPSMTPAUTH"/>.
62831 </para>
62832 <para>
62833 <indexterm role="concept">
62834 <primary>carriage return</primary>
62835 </indexterm>
62836 <indexterm role="concept">
62837 <primary>linefeed</primary>
62838 </indexterm>
62839 Responses from the remote host are supposed to be terminated by CR followed by
62840 LF. However, there are known to be hosts that do not send CR characters, so in
62841 order to be able to interwork with such hosts, Exim treats LF on its own as a
62842 line terminator.
62843 </para>
62844 <para>
62845 If a message contains a number of different addresses, all those with the same
62846 characteristics (for example, the same envelope sender) that resolve to the
62847 same set of hosts, in the same order, are sent in a single SMTP transaction,
62848 even if they are for different domains, unless there are more than the setting
62849 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
62850 they are split into groups containing no more than <option>max_rcpt</option>s addresses
62851 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
62852 in parallel sessions. The order of hosts with identical MX values is not
62853 significant when checking whether addresses can be batched in this way.
62854 </para>
62855 <para>
62856 When the <command>smtp</command> transport suffers a temporary failure that is not
62857 message-related, Exim updates its transport-specific database, which contains
62858 records indexed by host name that remember which messages are waiting for each
62859 particular host. It also updates the retry database with new retry times.
62860 </para>
62861 <para>
62862 <indexterm role="concept">
62863 <primary>hints database</primary>
62864 <secondary>retry keys</secondary>
62865 </indexterm>
62866 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
62867 a multi-homed host is broken, it will soon be skipped most of the time.
62868 See the next section for more detail about error handling.
62869 </para>
62870 <para>
62871 <indexterm role="concept">
62872 <primary>SMTP</primary>
62873 <secondary>passed connection</secondary>
62874 </indexterm>
62875 <indexterm role="concept">
62876 <primary>SMTP</primary>
62877 <secondary>batching over TCP/IP</secondary>
62878 </indexterm>
62879 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
62880 looks in the hints database for the transport to see if there are any queued
62881 messages waiting for the host to which it is connected. If it finds one, it
62882 creates a new Exim process using the <option>-MC</option> option (which can only be used by
62883 a process running as root or the Exim user) and passes the TCP/IP socket to it
62884 so that it can deliver another message using the same socket. The new process
62885 does only those deliveries that are routed to the connected host, and may in
62886 turn pass the socket on to a third process, and so on.
62887 </para>
62888 <para>
62889 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
62890 limit the number of messages sent down a single TCP/IP connection.
62891 </para>
62892 <para>
62893 <indexterm role="concept">
62894 <primary>asterisk</primary>
62895 <secondary>after IP address</secondary>
62896 </indexterm>
62897 The second and subsequent messages delivered down an existing connection are
62898 identified in the main log by the addition of an asterisk after the closing
62899 square bracket of the IP address.
62900 </para>
62901 </section>
62902 <section id="SECToutSMTPerr">
62903 <title>Errors in outgoing SMTP</title>
62904 <para>
62905 <indexterm role="concept">
62906 <primary>error</primary>
62907 <secondary>in outgoing SMTP</secondary>
62908 </indexterm>
62909 <indexterm role="concept">
62910 <primary>SMTP</primary>
62911 <secondary>errors in outgoing</secondary>
62912 </indexterm>
62913 <indexterm role="concept">
62914 <primary>host</primary>
62915 <secondary>error</secondary>
62916 </indexterm>
62917 Three different kinds of error are recognized for outgoing SMTP: host errors,
62918 message errors, and recipient errors.
62919 </para>
62920 <variablelist>
62921 <varlistentry>
62922 <term><emphasis role="bold">Host errors</emphasis></term>
62923 <listitem>
62924 <para>
62925 A host error is not associated with a particular message or with a
62926 particular recipient of a message. The host errors are:
62927 </para>
62928 <itemizedlist>
62929 <listitem>
62930 <para>
62931 Connection refused or timed out,
62932 </para>
62933 </listitem>
62934 <listitem>
62935 <para>
62936 Any error response code on connection,
62937 </para>
62938 </listitem>
62939 <listitem>
62940 <para>
62941 Any error response code to EHLO or HELO,
62942 </para>
62943 </listitem>
62944 <listitem>
62945 <para>
62946 Loss of connection at any time, except after <quote>.</quote>,
62947 </para>
62948 </listitem>
62949 <listitem>
62950 <para>
62951 I/O errors at any time,
62952 </para>
62953 </listitem>
62954 <listitem>
62955 <para>
62956 Timeouts during the session, other than in response to MAIL, RCPT or
62957 the <quote>.</quote> at the end of the data.
62958 </para>
62959 </listitem>
62960 </itemizedlist>
62961 <para>
62962 For a host error, a permanent error response on connection, or in response to
62963 EHLO, causes all addresses routed to the host to be failed. Any other host
62964 error causes all addresses to be deferred, and retry data to be created for the
62965 host. It is not tried again, for any message, until its retry time arrives. If
62966 the current set of addresses are not all delivered in this run (to some
62967 alternative host), the message is added to the list of those waiting for this
62968 host, so if it is still undelivered when a subsequent successful delivery is
62969 made to the host, it will be sent down the same SMTP connection.
62970 </para>
62971 </listitem></varlistentry>
62972 <varlistentry>
62973 <term><emphasis role="bold">Message errors</emphasis></term>
62974 <listitem>
62975 <para>
62976 <indexterm role="concept">
62977 <primary>message</primary>
62978 <secondary>error</secondary>
62979 </indexterm>
62980 A message error is associated with a particular message when sent to a
62981 particular host, but not with a particular recipient of the message. The
62982 message errors are:
62983 </para>
62984 <itemizedlist>
62985 <listitem>
62986 <para>
62987 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
62988 the data,
62989 </para>
62990 </listitem>
62991 <listitem>
62992 <para>
62993 Timeout after MAIL,
62994 </para>
62995 </listitem>
62996 <listitem>
62997 <para>
62998 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
62999 timeout after the DATA command itself is treated as a host error, as is loss of
63000 connection at any other time.
63001 </para>
63002 </listitem>
63003 </itemizedlist>
63004 <para>
63005 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
63006 to be failed, and a delivery error report to be returned to the sender. A
63007 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
63008 addresses to be deferred. Retry data is not created for the host, but instead,
63009 a retry record for the combination of host plus message id is created. The
63010 message is not added to the list of those waiting for this host. This ensures
63011 that the failing message will not be sent to this host again until the retry
63012 time arrives. However, other messages that are routed to the host are not
63013 affected, so if it is some property of the message that is causing the error,
63014 it will not stop the delivery of other mail.
63015 </para>
63016 <para>
63017 If the remote host specified support for the SIZE parameter in its response
63018 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
63019 over-large message will cause a message error because the error arrives as a
63020 response to MAIL.
63021 </para>
63022 </listitem></varlistentry>
63023 <varlistentry>
63024 <term><emphasis role="bold">Recipient errors</emphasis></term>
63025 <listitem>
63026 <para>
63027 <indexterm role="concept">
63028 <primary>recipient</primary>
63029 <secondary>error</secondary>
63030 </indexterm>
63031 A recipient error is associated with a particular recipient of a message. The
63032 recipient errors are:
63033 </para>
63034 <itemizedlist>
63035 <listitem>
63036 <para>
63037 Any error response to RCPT,
63038 </para>
63039 </listitem>
63040 <listitem>
63041 <para>
63042 Timeout after RCPT.
63043 </para>
63044 </listitem>
63045 </itemizedlist>
63046 <para>
63047 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
63048 recipient address to be failed, and a bounce message to be returned to the
63049 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
63050 address to be deferred, and routing retry data to be created for it. This is
63051 used to delay processing of the address in subsequent queue runs, until its
63052 routing retry time arrives. This applies to all messages, but because it
63053 operates only in queue runs, one attempt will be made to deliver a new message
63054 to the failing address before the delay starts to operate. This ensures that,
63055 if the failure is really related to the message rather than the recipient
63056 (<quote>message too big for this recipient</quote> is a possible example), other messages
63057 have a chance of getting delivered. If a delivery to the address does succeed,
63058 the retry information gets cleared, so all stuck messages get tried again, and
63059 the retry clock is reset.
63060 </para>
63061 <para>
63062 The message is not added to the list of those waiting for this host. Use of the
63063 host for other messages is unaffected, and except in the case of a timeout,
63064 other recipients are processed independently, and may be successfully delivered
63065 in the current SMTP session. After a timeout it is of course impossible to
63066 proceed with the session, so all addresses get deferred. However, those other
63067 than the one that failed do not suffer any subsequent retry delays. Therefore,
63068 if one recipient is causing trouble, the others have a chance of getting
63069 through when a subsequent delivery attempt occurs before the failing
63070 recipient&#x2019;s retry time.
63071 </para>
63072 </listitem></varlistentry>
63073 </variablelist>
63074 <para>
63075 In all cases, if there are other hosts (or IP addresses) available for the
63076 current set of addresses (for example, from multiple MX records), they are
63077 tried in this run for any undelivered addresses, subject of course to their
63078 own retry data. In other words, recipient error retry data does not take effect
63079 until the next delivery attempt.
63080 </para>
63081 <para>
63082 Some hosts have been observed to give temporary error responses to every
63083 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
63084 would be nice if such circumstances could be recognized, and defer data for the
63085 host itself created, but this is not possible within the current Exim design.
63086 What actually happens is that retry data for every (host, message) combination
63087 is created.
63088 </para>
63089 <para>
63090 The reason that timeouts after MAIL and RCPT are treated specially is that
63091 these can sometimes arise as a result of the remote host&#x2019;s verification
63092 procedures. Exim makes this assumption, and treats them as if a temporary error
63093 response had been received. A timeout after <quote>.</quote> is treated specially because
63094 it is known that some broken implementations fail to recognize the end of the
63095 message if the last character of the last line is a binary zero. Thus, it is
63096 helpful to treat this case as a message error.
63097 </para>
63098 <para>
63099 Timeouts at other times are treated as host errors, assuming a problem with the
63100 host, or the connection to it. If a timeout after MAIL, RCPT,
63101 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
63102 the timeout is likely to occur at some other point in the dialogue, causing it
63103 then to be treated as a host error.
63104 </para>
63105 <para>
63106 There is experimental evidence that some MTAs drop the connection after the
63107 terminating <quote>.</quote> if they do not like the contents of the message for some
63108 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
63109 should be given. That is why Exim treats this case as a message rather than a
63110 host error, in order not to delay other messages to the same host.
63111 </para>
63112 </section>
63113 <section id="SECID233">
63114 <title>Incoming SMTP messages over TCP/IP</title>
63115 <para>
63116 <indexterm role="concept">
63117 <primary>SMTP</primary>
63118 <secondary>incoming over TCP/IP</secondary>
63119 </indexterm>
63120 <indexterm role="concept">
63121 <primary>incoming SMTP over TCP/IP</primary>
63122 </indexterm>
63123 <indexterm role="concept">
63124 <primary>inetd</primary>
63125 </indexterm>
63126 <indexterm role="concept">
63127 <primary>daemon</primary>
63128 </indexterm>
63129 Incoming SMTP messages can be accepted in one of two ways: by running a
63130 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
63131 <filename>/etc/inetd.conf</filename> should be like this:
63132 </para>
63133 <literallayout class="monospaced">
63134 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
63135 </literallayout>
63136 <para>
63137 Exim distinguishes between this case and the case of a locally running user
63138 agent using the <option>-bs</option> option by checking whether or not the standard input is
63139 a socket. When it is, either the port must be privileged (less than 1024), or
63140 the caller must be root or the Exim user. If any other user passes a socket
63141 with an unprivileged port number, Exim prints a message on the standard error
63142 stream and exits with an error code.
63143 </para>
63144 <para>
63145 By default, Exim does not make a log entry when a remote host connects or
63146 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
63147 unexpected. It can be made to write such log entries by setting the
63148 <option>smtp_connection</option> log selector.
63149 </para>
63150 <para>
63151 <indexterm role="concept">
63152 <primary>carriage return</primary>
63153 </indexterm>
63154 <indexterm role="concept">
63155 <primary>linefeed</primary>
63156 </indexterm>
63157 Commands from the remote host are supposed to be terminated by CR followed by
63158 LF. However, there are known to be hosts that do not send CR characters. In
63159 order to be able to interwork with such hosts, Exim treats LF on its own as a
63160 line terminator.
63161 Furthermore, because common code is used for receiving messages from all
63162 sources, a CR on its own is also interpreted as a line terminator. However, the
63163 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
63164 </para>
63165 <para>
63166 <indexterm role="concept">
63167 <primary>EHLO</primary>
63168 <secondary>invalid data</secondary>
63169 </indexterm>
63170 <indexterm role="concept">
63171 <primary>HELO</primary>
63172 <secondary>invalid data</secondary>
63173 </indexterm>
63174 One area that sometimes gives rise to problems concerns the EHLO or
63175 HELO commands. Some clients send syntactically invalid versions of these
63176 commands, which Exim rejects by default. (This is nothing to do with verifying
63177 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
63178 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
63179 match the broken hosts that send invalid commands.
63180 </para>
63181 <para>
63182 <indexterm role="concept">
63183 <primary>SIZE option on MAIL command</primary>
63184 </indexterm>
63185 <indexterm role="concept">
63186 <primary>MAIL</primary>
63187 <secondary>SIZE option</secondary>
63188 </indexterm>
63189 The amount of disk space available is checked whenever SIZE is received on
63190 a MAIL command, independently of whether <option>message_size_limit</option> or
63191 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
63192 false. A temporary error is given if there is not enough space. If
63193 <option>check_spool_space</option> is set, the check is for that amount of space plus the
63194 value given with SIZE, that is, it checks that the addition of the incoming
63195 message will not reduce the space below the threshold.
63196 </para>
63197 <para>
63198 When a message is successfully received, Exim includes the local message id in
63199 its response to the final <quote>.</quote> that terminates the data. If the remote host
63200 logs this text it can help with tracing what has happened to a message.
63201 </para>
63202 <para>
63203 The Exim daemon can limit the number of simultaneous incoming connections it is
63204 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
63205 number of simultaneous incoming connections from a single remote host (see the
63206 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
63207 rejected using the SMTP temporary error code 421.
63208 </para>
63209 <para>
63210 The Exim daemon does not rely on the SIGCHLD signal to detect when a
63211 subprocess has finished, as this can get lost at busy times. Instead, it looks
63212 for completed subprocesses every time it wakes up. Provided there are other
63213 things happening (new incoming calls, starts of queue runs), completed
63214 processes will be noticed and tidied away. On very quiet systems you may
63215 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
63216 it will be noticed when the daemon next wakes up.
63217 </para>
63218 <para>
63219 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
63220 and can also be set up to reject SMTP calls from non-reserved hosts at times of
63221 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
63222 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
63223 applies in both the daemon and <emphasis>inetd</emphasis> cases.
63224 </para>
63225 <para>
63226 Exim normally starts a delivery process for each message received, though this
63227 can be varied by means of the <option>-odq</option> command line option and the
63228 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
63229 number of simultaneously running delivery processes started in this way from
63230 SMTP input can be limited by the <option>smtp_accept_queue</option> and
63231 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
63232 subsequently received messages are just put on the input queue without starting
63233 a delivery process.
63234 </para>
63235 <para>
63236 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
63237 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
63238 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
63239 handled by an entirely independent Exim process. Control by load average is,
63240 however, available with <emphasis>inetd</emphasis>.
63241 </para>
63242 <para>
63243 Exim can be configured to verify addresses in incoming SMTP commands as they
63244 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
63245 to rewrite addresses at this time &ndash; before any syntax checking is done. See
63246 section <xref linkend="SECTrewriteS"/>.
63247 </para>
63248 <para>
63249 Exim can also be configured to limit the rate at which a client host submits
63250 MAIL and RCPT commands in a single SMTP session. See the
63251 <option>smtp_ratelimit_hosts</option> option.
63252 </para>
63253 </section>
63254 <section id="SECID234">
63255 <title>Unrecognized SMTP commands</title>
63256 <para>
63257 <indexterm role="concept">
63258 <primary>SMTP</primary>
63259 <secondary>unrecognized commands</secondary>
63260 </indexterm>
63261 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
63262 commands during a single SMTP connection, it drops the connection after sending
63263 the error response to the last command. The default value for
63264 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
63265 abuse that subvert web servers into making connections to SMTP ports; in these
63266 circumstances, a number of non-SMTP lines are sent first.
63267 </para>
63268 </section>
63269 <section id="SECID235">
63270 <title>Syntax and protocol errors in SMTP commands</title>
63271 <para>
63272 <indexterm role="concept">
63273 <primary>SMTP</primary>
63274 <secondary>syntax errors</secondary>
63275 </indexterm>
63276 <indexterm role="concept">
63277 <primary>SMTP</primary>
63278 <secondary>protocol errors</secondary>
63279 </indexterm>
63280 A syntax error is detected if an SMTP command is recognized, but there is
63281 something syntactically wrong with its data, for example, a malformed email
63282 address in a RCPT command. Protocol errors include invalid command
63283 sequencing such as RCPT before MAIL. If Exim receives more than
63284 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
63285 drops the connection after sending the error response to the last command. The
63286 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
63287 broken clients that loop sending bad commands (yes, it has been seen).
63288 </para>
63289 </section>
63290 <section id="SECID236">
63291 <title>Use of non-mail SMTP commands</title>
63292 <para>
63293 <indexterm role="concept">
63294 <primary>SMTP</primary>
63295 <secondary>non-mail commands</secondary>
63296 </indexterm>
63297 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
63298 DATA. Exim counts such commands, and drops the connection if there are too
63299 many of them in a single SMTP session. This action catches some
63300 denial-of-service attempts and things like repeated failing AUTHs, or a mad
63301 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
63302 defines what <quote>too many</quote> means. Its default value is 10.
63303 </para>
63304 <para>
63305 When a new message is expected, one occurrence of RSET is not counted. This
63306 allows a client to send one RSET between messages (this is not necessary,
63307 but some clients do it). Exim also allows one uncounted occurrence of HELO
63308 or EHLO, and one occurrence of STARTTLS between messages. After
63309 starting up a TLS session, another EHLO is expected, and so it too is not
63310 counted.
63311 </para>
63312 <para>
63313 The first occurrence of AUTH in a connection, or immediately following
63314 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
63315 RCPT, DATA, and QUIT are counted.
63316 </para>
63317 <para>
63318 You can control which hosts are subject to the limit set by
63319 <option>smtp_accept_max_nonmail</option> by setting
63320 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
63321 the limit apply to all hosts. This option means that you can exclude any
63322 specific badly-behaved hosts that you have to live with.
63323 </para>
63324 </section>
63325 <section id="SECID237">
63326 <title>The VRFY and EXPN commands</title>
63327 <para>
63328 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
63329 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
63330 appropriate) in order to decide whether the command should be accepted or not.
63331 </para>
63332 <para>
63333 <indexterm role="concept">
63334 <primary>VRFY</primary>
63335 <secondary>processing</secondary>
63336 </indexterm>
63337 When no ACL is defined for VRFY, or if it rejects without
63338 setting an explicit response code, the command is accepted
63339 (with a 252 SMTP response code)
63340 in order to support awkward clients that do a VRFY before every RCPT.
63341 When VRFY is accepted, it runs exactly the same code as when Exim is
63342 called with the <option>-bv</option> option, and returns 250/451/550
63343 SMTP response codes.
63344 </para>
63345 <para>
63346 <indexterm role="concept">
63347 <primary>EXPN</primary>
63348 <secondary>processing</secondary>
63349 </indexterm>
63350 If no ACL for EXPN is defined, the command is rejected.
63351 When EXPN is accepted, a single-level expansion of the address is done.
63352 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
63353 than a verification (the <option>-bv</option> option). If an unqualified local part is given
63354 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
63355 of VRFY and EXPN commands are logged on the main and reject logs, and
63356 VRFY verification failures are logged on the main log for consistency with
63357 RCPT failures.
63358 </para>
63359 </section>
63360 <section id="SECTETRN">
63361 <title>The ETRN command</title>
63362 <para>
63363 <indexterm role="concept">
63364 <primary>ETRN</primary>
63365 <secondary>processing</secondary>
63366 </indexterm>
63367 RFC 1985 describes an SMTP command called ETRN that is designed to
63368 overcome the security problems of the TURN command (which has fallen into
63369 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
63370 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
63371 should be accepted or not. If no ACL is defined, the command is rejected.
63372 </para>
63373 <para>
63374 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
63375 delivery to certain hosts. As Exim does not organize its message queue by host,
63376 the only form of ETRN that is supported by default is the one where the
63377 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
63378 specific to the SMTP server. A valid ETRN command causes a run of Exim with
63379 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
63380 argument. For example,
63381 </para>
63382 <literallayout class="monospaced">
63383 ETRN #brigadoon
63384 </literallayout>
63385 <para>
63386 runs the command
63387 </para>
63388 <literallayout class="monospaced">
63389 exim -R brigadoon
63390 </literallayout>
63391 <para>
63392 which causes a delivery attempt on all messages with undelivered addresses
63393 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
63394 default), Exim prevents the simultaneous execution of more than one queue run
63395 for the same argument string as a result of an ETRN command. This stops
63396 a misbehaving client from starting more than one queue runner at once.
63397 </para>
63398 <para>
63399 <indexterm role="concept">
63400 <primary>hints database</primary>
63401 <secondary>ETRN serialization</secondary>
63402 </indexterm>
63403 Exim implements the serialization by means of a hints database in which a
63404 record is written whenever a process is started by ETRN, and deleted when
63405 the process completes. However, Exim does not keep the SMTP session waiting for
63406 the ETRN process to complete. Once ETRN is accepted, the client is sent
63407 a <quote>success</quote> return code. Obviously there is scope for hints records to get
63408 left lying around if there is a system or program crash. To guard against this,
63409 Exim ignores any records that are more than six hours old.
63410 </para>
63411 <para>
63412 <indexterm role="option">
63413 <primary><option>smtp_etrn_command</option></primary>
63414 </indexterm>
63415 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
63416 used. This specifies a command that is run whenever ETRN is received,
63417 whatever the form of its argument. For
63418 example:
63419 </para>
63420 <literallayout class="monospaced">
63421 smtp_etrn_command = /etc/etrn_command $domain \
63422                     $sender_host_address
63423 </literallayout>
63424 <para>
63425 <indexterm role="variable">
63426 <primary><varname>$domain</varname></primary>
63427 </indexterm>
63428 The string is split up into arguments which are independently expanded. The
63429 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
63430 and no syntax checking is done on the contents of this argument. Exim does not
63431 wait for the command to complete, so its status code is not checked. Exim runs
63432 under its own uid and gid when receiving incoming SMTP, so it is not possible
63433 for it to change them before running the command.
63434 </para>
63435 </section>
63436 <section id="SECID238">
63437 <title>Incoming local SMTP</title>
63438 <para>
63439 <indexterm role="concept">
63440 <primary>SMTP</primary>
63441 <secondary>local incoming</secondary>
63442 </indexterm>
63443 Some user agents use SMTP to pass messages to their local MTA using the
63444 standard input and output, as opposed to passing the envelope on the command
63445 line and writing the message to the standard input. This is supported by the
63446 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
63447 messages over TCP/IP (including the use of ACLs), except that the envelope
63448 sender given in a MAIL command is ignored unless the caller is trusted. In
63449 an ACL you can detect this form of SMTP input by testing for an empty host
63450 identification. It is common to have this as the first line in the ACL that
63451 runs for RCPT commands:
63452 </para>
63453 <literallayout class="monospaced">
63454 accept hosts = :
63455 </literallayout>
63456 <para>
63457 This accepts SMTP messages from local processes without doing any other tests.
63458 </para>
63459 </section>
63460 <section id="SECTbatchSMTP">
63461 <title>Outgoing batched SMTP</title>
63462 <para>
63463 <indexterm role="concept">
63464 <primary>SMTP</primary>
63465 <secondary>batched outgoing</secondary>
63466 </indexterm>
63467 <indexterm role="concept">
63468 <primary>batched SMTP output</primary>
63469 </indexterm>
63470 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
63471 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
63472 be output in BSMTP format. No SMTP responses are possible for this form of
63473 delivery. All it is doing is using SMTP commands as a way of transmitting the
63474 envelope along with the message.
63475 </para>
63476 <para>
63477 The message is written to the file or pipe preceded by the SMTP commands
63478 MAIL and RCPT, and followed by a line containing a single dot. Lines in
63479 the message that start with a dot have an extra dot added. The SMTP command
63480 HELO is not normally used. If it is required, the <option>message_prefix</option> option
63481 can be used to specify it.
63482 </para>
63483 <para>
63484 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
63485 one recipient address at a time by default. However, you can arrange for them
63486 to handle several addresses at once by setting the <option>batch_max</option> option. When
63487 this is done for BSMTP, messages may contain multiple RCPT commands. See
63488 chapter <xref linkend="CHAPbatching"/> for more details.
63489 </para>
63490 <para>
63491 <indexterm role="variable">
63492 <primary><varname>$host</varname></primary>
63493 </indexterm>
63494 When one or more addresses are routed to a BSMTP transport by a router that
63495 sets up a host list, the name of the first host on the list is available to the
63496 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
63497 router:
63498 </para>
63499 <literallayout class="monospaced">
63500 begin routers
63501 route_append:
63502   driver = manualroute
63503   transport = smtp_appendfile
63504   route_list = domain.example  batch.host.example
63505
63506 begin transports
63507 smtp_appendfile:
63508   driver = appendfile
63509   directory = /var/bsmtp/$host
63510   batch_max = 1000
63511   use_bsmtp
63512   user = exim
63513 </literallayout>
63514 <para>
63515 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
63516 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
63517 message (unless there are more than 1000 recipients).
63518 </para>
63519 </section>
63520 <section id="SECTincomingbatchedSMTP">
63521 <title>Incoming batched SMTP</title>
63522 <para>
63523 <indexterm role="concept">
63524 <primary>SMTP</primary>
63525 <secondary>batched incoming</secondary>
63526 </indexterm>
63527 <indexterm role="concept">
63528 <primary>batched SMTP input</primary>
63529 </indexterm>
63530 The <option>-bS</option> command line option causes Exim to accept one or more messages by
63531 reading SMTP on the standard input, but to generate no responses. If the caller
63532 is trusted, the senders in the MAIL commands are believed; otherwise the
63533 sender is always the caller of Exim. Unqualified senders and receivers are not
63534 rejected (there seems little point) but instead just get qualified. HELO
63535 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
63536 as NOOP; QUIT quits.
63537 </para>
63538 <para>
63539 Minimal policy checking is done for BSMTP input. Only the non-SMTP
63540 ACL is run in the same way as for non-SMTP local input.
63541 </para>
63542 <para>
63543 If an error is detected while reading a message, including a missing <quote>.</quote> at
63544 the end, Exim gives up immediately. It writes details of the error to the
63545 standard output in a stylized way that the calling program should be able to
63546 make some use of automatically, for example:
63547 </para>
63548 <literallayout class="monospaced">
63549 554 Unexpected end of file
63550 Transaction started in line 10
63551 Error detected in line 14
63552 </literallayout>
63553 <para>
63554 It writes a more verbose version, for human consumption, to the standard error
63555 file, for example:
63556 </para>
63557 <literallayout class="monospaced">
63558 An error was detected while processing a file of BSMTP input.
63559 The error message was:
63560
63561 501 '&gt;' missing at end of address
63562
63563 The SMTP transaction started in line 10.
63564 The error was detected in line 12.
63565 The SMTP command at fault was:
63566
63567 rcpt to:&lt;malformed@in.com.plete
63568
63569 1 previous message was successfully processed.
63570 The rest of the batch was abandoned.
63571 </literallayout>
63572 <para>
63573 The return code from Exim is zero only if there were no errors. It is 1 if some
63574 messages were accepted before an error was detected, and 2 if no messages were
63575 accepted.
63576 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
63577 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
63578 </para>
63579 </section>
63580 </chapter>
63581
63582 <chapter id="CHAPemsgcust">
63583 <title>Customizing bounce and warning messages</title>
63584 <titleabbrev>Customizing messages</titleabbrev>
63585 <para>
63586 When a message fails to be delivered, or remains on the queue for more than a
63587 configured amount of time, Exim sends a message to the original sender, or
63588 to an alternative configured address. The text of these messages is built into
63589 the code of Exim, but it is possible to change it, either by adding a single
63590 string, or by replacing each of the paragraphs by text supplied in a file.
63591 </para>
63592 <para>
63593 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
63594 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
63595 option. Exim also adds the line
63596 </para>
63597 <literallayout class="monospaced">
63598 Auto-Submitted: auto-generated
63599 </literallayout>
63600 <para>
63601 to all warning and bounce messages,
63602 </para>
63603 <section id="SECID239">
63604 <title>Customizing bounce messages</title>
63605 <para>
63606 <indexterm role="concept">
63607 <primary>customizing</primary>
63608 <secondary>bounce message</secondary>
63609 </indexterm>
63610 <indexterm role="concept">
63611 <primary>bounce message</primary>
63612 <secondary>customizing</secondary>
63613 </indexterm>
63614 If <option>bounce_message_text</option> is set, its contents are included in the default
63615 message immediately after <quote>This message was created automatically by mail
63616 delivery software.</quote> The string is not expanded. It is not used if
63617 <option>bounce_message_file</option> is set.
63618 </para>
63619 <para>
63620 When <option>bounce_message_file</option> is set, it must point to a template file for
63621 constructing error messages. The file consists of a series of text items,
63622 separated by lines consisting of exactly four asterisks. If the file cannot be
63623 opened, default text is used and a message is written to the main and panic
63624 logs. If any text item in the file is empty, default text is used for that
63625 item.
63626 </para>
63627 <para>
63628 <indexterm role="variable">
63629 <primary><varname>$bounce_recipient</varname></primary>
63630 </indexterm>
63631 <indexterm role="variable">
63632 <primary><varname>$bounce_return_size_limit</varname></primary>
63633 </indexterm>
63634 Each item of text that is read from the file is expanded, and there are two
63635 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
63636 the recipient of an error message while it is being created, and
63637 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
63638 option, rounded to a whole number.
63639 </para>
63640 <para>
63641 The items must appear in the file in the following order:
63642 </para>
63643 <itemizedlist>
63644 <listitem>
63645 <para>
63646 The first item is included in the headers, and should include at least a
63647 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63648 </para>
63649 </listitem>
63650 <listitem>
63651 <para>
63652 The second item forms the start of the error message. After it, Exim lists the
63653 failing addresses with their error messages.
63654 </para>
63655 </listitem>
63656 <listitem>
63657 <para>
63658 The third item is used to introduce any text from pipe transports that is to be
63659 returned to the sender. It is omitted if there is no such text.
63660 </para>
63661 </listitem>
63662 <listitem>
63663 <para>
63664 The fourth, fifth and sixth items will be ignored and may be empty.
63665 The fields exist for back-compatibility
63666 </para>
63667 </listitem>
63668 </itemizedlist>
63669 <para>
63670 The default state (<option>bounce_message_file</option> unset) is equivalent to the
63671 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
63672 other lines have been split in order to fit them on the page:
63673 </para>
63674 <literallayout class="monospaced">
63675 Subject: Mail delivery failed
63676   ${if eq{$sender_address}{$bounce_recipient}
63677   {: returning message to sender}}
63678 ****
63679 This message was created automatically by mail delivery software.
63680
63681 A message ${if eq{$sender_address}{$bounce_recipient}
63682   {that you sent }{sent by
63683
63684 &lt;$sender_address&gt;
63685
63686 }}could not be delivered to all of its recipients.
63687 This is a permanent error. The following address(es) failed:
63688 ****
63689 The following text was generated during the delivery attempt(s):
63690 ****
63691 ------ This is a copy of the message, including all the headers.
63692   ------
63693 ****
63694 ------ The body of the message is $message_size characters long;
63695   only the first
63696 ------ $bounce_return_size_limit or so are included here.
63697 ****
63698 </literallayout>
63699 </section>
63700 <section id="SECTcustwarn">
63701 <title>Customizing warning messages</title>
63702 <para>
63703 <indexterm role="concept">
63704 <primary>customizing</primary>
63705 <secondary>warning message</secondary>
63706 </indexterm>
63707 <indexterm role="concept">
63708 <primary>warning of delay</primary>
63709 <secondary>customizing the message</secondary>
63710 </indexterm>
63711 The option <option>warn_message_file</option> can be pointed at a template file for use when
63712 warnings about message delays are created. In this case there are only three
63713 text sections:
63714 </para>
63715 <itemizedlist>
63716 <listitem>
63717 <para>
63718 The first item is included in the headers, and should include at least a
63719 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63720 </para>
63721 </listitem>
63722 <listitem>
63723 <para>
63724 The second item forms the start of the warning message. After it, Exim lists
63725 the delayed addresses.
63726 </para>
63727 </listitem>
63728 <listitem>
63729 <para>
63730 The third item then ends the message.
63731 </para>
63732 </listitem>
63733 </itemizedlist>
63734 <para>
63735 The default state is equivalent to the following file, except that some lines
63736 have been split here, in order to fit them on the page:
63737 </para>
63738 <literallayout class="monospaced">
63739 Subject: Warning: message $message_exim_id delayed
63740   $warn_message_delay
63741 ****
63742 This message was created automatically by mail delivery software.
63743
63744 A message ${if eq{$sender_address}{$warn_message_recipients}
63745 {that you sent }{sent by
63746
63747 &lt;$sender_address&gt;
63748
63749 }}has not been delivered to all of its recipients after
63750 more than $warn_message_delay on the queue on $primary_hostname.
63751
63752 The message identifier is:     $message_exim_id
63753 The subject of the message is: $h_subject
63754 The date of the message is:    $h_date
63755
63756 The following address(es) have not yet been delivered:
63757 ****
63758 No action is required on your part. Delivery attempts will
63759 continue for some time, and this warning may be repeated at
63760 intervals if the message remains undelivered. Eventually the
63761 mail delivery software will give up, and when that happens,
63762 the message will be returned to you.
63763 </literallayout>
63764 <para>
63765 <indexterm role="variable">
63766 <primary><varname>$warn_message_delay</varname></primary>
63767 </indexterm>
63768 <indexterm role="variable">
63769 <primary><varname>$warn_message_recipients</varname></primary>
63770 </indexterm>
63771 However, in the default state the subject and date lines are omitted if no
63772 appropriate headers exist. During the expansion of this file,
63773 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
63774 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
63775 of recipients for the warning message. There may be more than one if there are
63776 multiple addresses with different <option>errors_to</option> settings on the routers that
63777 handled them.
63778 </para>
63779 </section>
63780 </chapter>
63781
63782 <chapter id="CHAPcomconreq">
63783 <title>Some common configuration settings</title>
63784 <para>
63785 This chapter discusses some configuration settings that seem to be fairly
63786 common. More examples and discussion can be found in the Exim book.
63787 </para>
63788 <section id="SECID240">
63789 <title>Sending mail to a smart host</title>
63790 <para>
63791 <indexterm role="concept">
63792 <primary>smart host</primary>
63793 <secondary>example router</secondary>
63794 </indexterm>
63795 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
63796 should replace the default <command>dnslookup</command> router with a router which does the
63797 routing explicitly:
63798 </para>
63799 <literallayout class="monospaced">
63800 send_to_smart_host:
63801   driver = manualroute
63802   route_list = !+local_domains smart.host.name
63803   transport = remote_smtp
63804 </literallayout>
63805 <para>
63806 You can use the smart host&#x2019;s IP address instead of the name if you wish.
63807 If you are using Exim only to submit messages to a smart host, and not for
63808 receiving incoming messages, you can arrange for it to do the submission
63809 synchronously by setting the <option>mua_wrapper</option> option (see chapter
63810 <xref linkend="CHAPnonqueueing"/>).
63811 </para>
63812 </section>
63813 <section id="SECTmailinglists">
63814 <title>Using Exim to handle mailing lists</title>
63815 <para>
63816 <indexterm role="concept">
63817 <primary>mailing lists</primary>
63818 </indexterm>
63819 Exim can be used to run simple mailing lists, but for large and/or complicated
63820 requirements, the use of additional specialized mailing list software such as
63821 Majordomo or Mailman is recommended.
63822 </para>
63823 <para>
63824 The <command>redirect</command> router can be used to handle mailing lists where each list
63825 is maintained in a separate file, which can therefore be managed by an
63826 independent manager. The <option>domains</option> router option can be used to run these
63827 lists in a separate domain from normal mail. For example:
63828 </para>
63829 <literallayout class="monospaced">
63830 lists:
63831   driver = redirect
63832   domains = lists.example
63833   file = /usr/lists/$local_part
63834   forbid_pipe
63835   forbid_file
63836   errors_to = $local_part-request@lists.example
63837   no_more
63838 </literallayout>
63839 <para>
63840 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
63841 in that domain, it looks for a file that matches the local part. If there is no
63842 such file, the router declines, but because <option>no_more</option> is set, no subsequent
63843 routers are tried, and so the whole delivery fails.
63844 </para>
63845 <para>
63846 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
63847 expanded into a file name or a pipe delivery, which is usually inappropriate in
63848 a mailing list.
63849 </para>
63850 <para>
63851 <indexterm role="option">
63852 <primary><option>errors_to</option></primary>
63853 </indexterm>
63854 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
63855 taken from a mailing list are to be sent to the given address rather than the
63856 original sender of the message. However, before acting on this, Exim verifies
63857 the error address, and ignores it if verification fails.
63858 </para>
63859 <para>
63860 For example, using the configuration above, mail sent to
63861 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
63862 <filename>/usr/lists/dicts</filename>, with error reports directed to
63863 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
63864 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
63865 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
63866 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
63867 or <option>local_part_suffix</option> options) to handle addresses of the form
63868 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
63869 </para>
63870 </section>
63871 <section id="SECID241">
63872 <title>Syntax errors in mailing lists</title>
63873 <para>
63874 <indexterm role="concept">
63875 <primary>mailing lists</primary>
63876 <secondary>syntax errors in</secondary>
63877 </indexterm>
63878 If an entry in redirection data contains a syntax error, Exim normally defers
63879 delivery of the original address. That means that a syntax error in a mailing
63880 list holds up all deliveries to the list. This may not be appropriate when a
63881 list is being maintained automatically from data supplied by users, and the
63882 addresses are not rigorously checked.
63883 </para>
63884 <para>
63885 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
63886 entries that fail to parse, noting the incident in the log. If in addition
63887 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
63888 whenever a broken address is skipped. It is usually appropriate to set
63889 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
63890 </para>
63891 </section>
63892 <section id="SECID242">
63893 <title>Re-expansion of mailing lists</title>
63894 <para>
63895 <indexterm role="concept">
63896 <primary>mailing lists</primary>
63897 <secondary>re-expansion of</secondary>
63898 </indexterm>
63899 Exim remembers every individual address to which a message has been delivered,
63900 in order to avoid duplication, but it normally stores only the original
63901 recipient addresses with a message. If all the deliveries to a mailing list
63902 cannot be done at the first attempt, the mailing list is re-expanded when the
63903 delivery is next tried. This means that alterations to the list are taken into
63904 account at each delivery attempt, so addresses that have been added to
63905 the list since the message arrived will therefore receive a copy of the
63906 message, even though it pre-dates their subscription.
63907 </para>
63908 <para>
63909 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
63910 on the <command>redirect</command> router. If this is done, any addresses generated by the
63911 router that fail to deliver at the first attempt are added to the message as
63912 <quote>top level</quote> addresses, and the parent address that generated them is marked
63913 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
63914 subsequent delivery attempts. The disadvantage of this is that if any of the
63915 failing addresses are incorrect, correcting them in the file has no effect on
63916 pre-existing messages.
63917 </para>
63918 <para>
63919 The original top-level address is remembered with each of the generated
63920 addresses, and is output in any log messages. However, any intermediate parent
63921 addresses are not recorded. This makes a difference to the log only if the
63922 <option>all_parents</option> selector is set, but for mailing lists there is normally only
63923 one level of expansion anyway.
63924 </para>
63925 </section>
63926 <section id="SECID243">
63927 <title>Closed mailing lists</title>
63928 <para>
63929 <indexterm role="concept">
63930 <primary>mailing lists</primary>
63931 <secondary>closed</secondary>
63932 </indexterm>
63933 The examples so far have assumed open mailing lists, to which anybody may
63934 send mail. It is also possible to set up closed lists, where mail is accepted
63935 from specified senders only. This is done by making use of the generic
63936 <option>senders</option> option to restrict the router that handles the list.
63937 </para>
63938 <para>
63939 The following example uses the same file as a list of recipients and as a list
63940 of permitted senders. It requires three routers:
63941 </para>
63942 <literallayout class="monospaced">
63943 lists_request:
63944   driver = redirect
63945   domains = lists.example
63946   local_part_suffix = -request
63947   file = /usr/lists/$local_part$local_part_suffix
63948   no_more
63949
63950 lists_post:
63951   driver = redirect
63952   domains = lists.example
63953   senders = ${if exists {/usr/lists/$local_part}\
63954              {lsearch;/usr/lists/$local_part}{*}}
63955   file = /usr/lists/$local_part
63956   forbid_pipe
63957   forbid_file
63958   errors_to = $local_part-request@lists.example
63959   no_more
63960
63961 lists_closed:
63962   driver = redirect
63963   domains = lists.example
63964   allow_fail
63965   data = :fail: $local_part@lists.example is a closed mailing list
63966 </literallayout>
63967 <para>
63968 All three routers have the same <option>domains</option> setting, so for any other domains,
63969 they are all skipped. The first router runs only if the local part ends in
63970 <option>-request</option>. It handles messages to the list manager(s) by means of an open
63971 mailing list.
63972 </para>
63973 <para>
63974 The second router runs only if the <option>senders</option> precondition is satisfied. It
63975 checks for the existence of a list that corresponds to the local part, and then
63976 checks that the sender is on the list by means of a linear search. It is
63977 necessary to check for the existence of the file before trying to search it,
63978 because otherwise Exim thinks there is a configuration error. If the file does
63979 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
63980 means that the router runs, but because there is no list, declines, and
63981 <option>no_more</option> ensures that no further routers are run. The address fails with an
63982 <quote>unrouteable address</quote> error.
63983 </para>
63984 <para>
63985 The third router runs only if the second router is skipped, which happens when
63986 a mailing list exists, but the sender is not on it. This router forcibly fails
63987 the address, giving a suitable error message.
63988 </para>
63989 </section>
63990 <section id="SECTverp">
63991 <title>Variable Envelope Return Paths (VERP)</title>
63992 <para>
63993 <indexterm role="concept">
63994 <primary>VERP</primary>
63995 </indexterm>
63996 <indexterm role="concept">
63997 <primary>Variable Envelope Return Paths</primary>
63998 </indexterm>
63999 <indexterm role="concept">
64000 <primary>envelope sender</primary>
64001 </indexterm>
64002 Variable Envelope Return Paths &ndash; see <emphasis role="bold"><ulink url="http://cr.yp.to/proto/verp.txt">http://cr.yp.to/proto/verp.txt</ulink></emphasis> &ndash;
64003 are a way of helping mailing list administrators discover which subscription
64004 address is the cause of a particular delivery failure. The idea is to encode
64005 the original recipient address in the outgoing envelope sender address, so that
64006 if the message is forwarded by another host and then subsequently bounces, the
64007 original recipient can be extracted from the recipient address of the bounce.
64008 </para>
64009 <para>
64010 <indexterm role="option">
64011 <primary><option>errors_to</option></primary>
64012 </indexterm>
64013 <indexterm role="option">
64014 <primary><option>return_path</option></primary>
64015 </indexterm>
64016 Envelope sender addresses can be modified by Exim using two different
64017 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
64018 list examples), or the <option>return_path</option> option on a transport. The second of
64019 these is effective only if the message is successfully delivered to another
64020 host; it is not used for errors detected on the local host (see the description
64021 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
64022 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
64023 </para>
64024 <literallayout class="monospaced">
64025 verp_smtp:
64026   driver = smtp
64027   max_rcpt = 1
64028   return_path = \
64029     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64030       {$1-request+$local_part=$domain@your.dom.example}fail}
64031 </literallayout>
64032 <para>
64033 This has the effect of rewriting the return path (envelope sender) on outgoing
64034 SMTP messages, if the local part of the original return path ends in
64035 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
64036 local part and domain of the recipient into the return path. Suppose, for
64037 example, that a message whose return path has been set to
64038 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
64039 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
64040 rewritten as
64041 </para>
64042 <literallayout class="monospaced">
64043 somelist-request+subscriber=other.dom.example@your.dom.example
64044 </literallayout>
64045 <para>
64046 <indexterm role="variable">
64047 <primary><varname>$local_part</varname></primary>
64048 </indexterm>
64049 For this to work, you must tell Exim to send multiple copies of messages that
64050 have more than one recipient, so that each copy has just one recipient. This is
64051 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
64052 might be sent to several different recipients in the same domain, in which case
64053 <varname>$local_part</varname> is not available in the transport, because it is not unique.
64054 </para>
64055 <para>
64056 Unless your host is doing nothing but mailing list deliveries, you should
64057 probably use a separate transport for the VERP deliveries, so as not to use
64058 extra resources in making one-per-recipient copies for other deliveries. This
64059 can easily be done by expanding the <option>transport</option> option in the router:
64060 </para>
64061 <literallayout class="monospaced">
64062 dnslookup:
64063   driver = dnslookup
64064   domains = ! +local_domains
64065   transport = \
64066     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64067       {verp_smtp}{remote_smtp}}
64068   no_more
64069 </literallayout>
64070 <para>
64071 If you want to change the return path using <option>errors_to</option> in a router instead
64072 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
64073 routers that handle mailing list addresses. This will ensure that all delivery
64074 errors, including those detected on the local host, are sent to the VERP
64075 address.
64076 </para>
64077 <para>
64078 On a host that does no local deliveries and has no manual routing, only the
64079 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
64080 SMTP deliveries. Every mailing list recipient has its own return path value,
64081 and so Exim must hand them to the transport one at a time. Here is an example
64082 of a <command>dnslookup</command> router that implements VERP:
64083 </para>
64084 <literallayout class="monospaced">
64085 verp_dnslookup:
64086   driver = dnslookup
64087   domains = ! +local_domains
64088   transport = remote_smtp
64089   errors_to = \
64090     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
64091      {$1-request+$local_part=$domain@your.dom.example}fail}
64092   no_more
64093 </literallayout>
64094 <para>
64095 Before you start sending out messages with VERPed return paths, you must also
64096 configure Exim to accept the bounce messages that come back to those paths.
64097 Typically this is done by setting a <option>local_part_suffix</option> option for a
64098 router, and using this to route the messages to wherever you want to handle
64099 them.
64100 </para>
64101 <para>
64102 The overhead incurred in using VERP depends very much on the size of the
64103 message, the number of recipient addresses that resolve to the same remote
64104 host, and the speed of the connection over which the message is being sent. If
64105 a lot of addresses resolve to the same host and the connection is slow, sending
64106 a separate copy of the message for each address may take substantially longer
64107 than sending a single copy with many recipients (for which VERP cannot be
64108 used).
64109 </para>
64110 </section>
64111 <section id="SECTvirtualdomains">
64112 <title>Virtual domains</title>
64113 <para>
64114 <indexterm role="concept">
64115 <primary>virtual domains</primary>
64116 </indexterm>
64117 <indexterm role="concept">
64118 <primary>domain</primary>
64119 <secondary>virtual</secondary>
64120 </indexterm>
64121 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
64122 meanings:
64123 </para>
64124 <itemizedlist>
64125 <listitem>
64126 <para>
64127 A domain for which there are no real mailboxes; all valid local parts are
64128 aliases for other email addresses. Common examples are organizational
64129 top-level domains and <quote>vanity</quote> domains.
64130 </para>
64131 </listitem>
64132 <listitem>
64133 <para>
64134 One of a number of independent domains that are all handled by the same host,
64135 with mailboxes on that host, but where the mailbox owners do not necessarily
64136 have login accounts on that host.
64137 </para>
64138 </listitem>
64139 </itemizedlist>
64140 <para>
64141 The first usage is probably more common, and does seem more <quote>virtual</quote> than
64142 the second. This kind of domain can be handled in Exim with a straightforward
64143 aliasing router. One approach is to create a separate alias file for each
64144 virtual domain. Exim can test for the existence of the alias file to determine
64145 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
64146 to a router of this form:
64147 </para>
64148 <literallayout class="monospaced">
64149 virtual:
64150   driver = redirect
64151   domains = dsearch;/etc/mail/virtual
64152   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
64153   no_more
64154 </literallayout>
64155 <para>
64156 The <option>domains</option> option specifies that the router is to be skipped, unless there
64157 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
64158 domain that is being processed. When the router runs, it looks up the local
64159 part in the file to find a new address (or list of addresses). The <option>no_more</option>
64160 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
64161 string), Exim gives up on the address without trying any subsequent routers.
64162 </para>
64163 <para>
64164 This one router can handle all the virtual domains because the alias file names
64165 follow a fixed pattern. Permissions can be arranged so that appropriate people
64166 can edit the different alias files. A successful aliasing operation results in
64167 a new envelope recipient address, which is then routed from scratch.
64168 </para>
64169 <para>
64170 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
64171 way. One approach is to create a file for each domain containing a list of
64172 valid local parts, and use it in a router like this:
64173 </para>
64174 <literallayout class="monospaced">
64175 my_domains:
64176   driver = accept
64177   domains = dsearch;/etc/mail/domains
64178   local_parts = lsearch;/etc/mail/domains/$domain
64179   transport = my_mailboxes
64180 </literallayout>
64181 <para>
64182 The address is accepted if there is a file for the domain, and the local part
64183 can be found in the file. The <option>domains</option> option is used to check for the
64184 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
64185 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
64186 because that option is tested after <option>local_parts</option>. The transport is as
64187 follows:
64188 </para>
64189 <literallayout class="monospaced">
64190 my_mailboxes:
64191   driver = appendfile
64192   file = /var/mail/$domain/$local_part
64193   user = mail
64194 </literallayout>
64195 <para>
64196 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
64197 required, to specify which uid is to be used for writing to the mailboxes.
64198 </para>
64199 <para>
64200 The configuration shown here is just one example of how you might support this
64201 requirement. There are many other ways this kind of configuration can be set
64202 up, for example, by using a database instead of separate files to hold all the
64203 information about the domains.
64204 </para>
64205 </section>
64206 <section id="SECTmulbox">
64207 <title>Multiple user mailboxes</title>
64208 <para>
64209 <indexterm role="concept">
64210 <primary>multiple mailboxes</primary>
64211 </indexterm>
64212 <indexterm role="concept">
64213 <primary>mailbox</primary>
64214 <secondary>multiple</secondary>
64215 </indexterm>
64216 <indexterm role="concept">
64217 <primary>local part</primary>
64218 <secondary>prefix</secondary>
64219 </indexterm>
64220 <indexterm role="concept">
64221 <primary>local part</primary>
64222 <secondary>suffix</secondary>
64223 </indexterm>
64224 Heavy email users often want to operate with multiple mailboxes, into which
64225 incoming mail is automatically sorted. A popular way of handling this is to
64226 allow users to use multiple sender addresses, so that replies can easily be
64227 identified. Users are permitted to add prefixes or suffixes to their local
64228 parts for this purpose. The wildcard facility of the generic router options
64229 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
64230 example, consider this router:
64231 </para>
64232 <literallayout class="monospaced">
64233 userforward:
64234   driver = redirect
64235   check_local_user
64236   file = $home/.forward
64237   local_part_suffix = -*
64238   local_part_suffix_optional
64239   allow_filter
64240 </literallayout>
64241 <para>
64242 <indexterm role="variable">
64243 <primary><varname>$local_part_suffix</varname></primary>
64244 </indexterm>
64245 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
64246 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
64247 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
64248 </para>
64249 <literallayout class="monospaced">
64250 if $local_part_suffix contains -special then
64251 save /home/$local_part/Mail/special
64252 endif
64253 </literallayout>
64254 <para>
64255 If the filter file does not exist, or does not deal with such addresses, they
64256 fall through to subsequent routers, and, assuming no subsequent use of the
64257 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
64258 control over which suffixes are valid.
64259 </para>
64260 <para>
64261 Alternatively, a suffix can be used to trigger the use of a different
64262 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
64263 another MTA:
64264 </para>
64265 <literallayout class="monospaced">
64266 userforward:
64267   driver = redirect
64268   check_local_user
64269   file = $home/.forward$local_part_suffix
64270   local_part_suffix = -*
64271   local_part_suffix_optional
64272   allow_filter
64273 </literallayout>
64274 <para>
64275 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
64276 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
64277 does not exist, or does not deal with the address, it is passed on to
64278 subsequent routers, which could, if required, look for an unqualified
64279 <filename>.forward</filename> file to use as a default.
64280 </para>
64281 </section>
64282 <section id="SECID244">
64283 <title>Simplified vacation processing</title>
64284 <para>
64285 <indexterm role="concept">
64286 <primary>vacation processing</primary>
64287 </indexterm>
64288 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
64289 a pipe command in a <filename>.forward</filename> file
64290 (see section <xref linkend="SECTspecitredli"/> for syntax details).
64291 This is prone to error by inexperienced users. There are two features of Exim
64292 that can be used to make this process simpler for users:
64293 </para>
64294 <itemizedlist>
64295 <listitem>
64296 <para>
64297 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
64298 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
64299 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
64300 <filename>.forward</filename> file are then much simpler. For example:
64301 </para>
64302 <literallayout class="monospaced">
64303 spqr, vacation-spqr
64304 </literallayout>
64305 </listitem>
64306 <listitem>
64307 <para>
64308 The <option>require_files</option> generic router option can be used to trigger a
64309 vacation delivery by checking for the existence of a certain file in the
64310 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
64311 ensure that the original delivery also proceeds. In this case, all the user has
64312 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
64313 message.
64314 </para>
64315 </listitem>
64316 </itemizedlist>
64317 <para>
64318 Another advantage of both these methods is that they both work even when the
64319 use of arbitrary pipes by users is locked out.
64320 </para>
64321 </section>
64322 <section id="SECID245">
64323 <title>Taking copies of mail</title>
64324 <para>
64325 <indexterm role="concept">
64326 <primary>message</primary>
64327 <secondary>copying every</secondary>
64328 </indexterm>
64329 Some installations have policies that require archive copies of all messages to
64330 be made. A single copy of each message can easily be taken by an appropriate
64331 command in a system filter, which could, for example, use a different file for
64332 each day&#x2019;s messages.
64333 </para>
64334 <para>
64335 There is also a shadow transport mechanism that can be used to take copies of
64336 messages that are successfully delivered by local transports, one copy per
64337 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
64338 notification of delivery by sites that insist on doing such things.
64339 </para>
64340 </section>
64341 <section id="SECID246">
64342 <title>Intermittently connected hosts</title>
64343 <para>
64344 <indexterm role="concept">
64345 <primary>intermittently connected hosts</primary>
64346 </indexterm>
64347 It has become quite common (because it is cheaper) for hosts to connect to the
64348 Internet periodically rather than remain connected all the time. The normal
64349 arrangement is that mail for such hosts accumulates on a system that is
64350 permanently connected.
64351 </para>
64352 <para>
64353 Exim was designed for use on permanently connected hosts, and so it is not
64354 particularly well-suited to use in an intermittently connected environment.
64355 Nevertheless there are some features that can be used.
64356 </para>
64357 </section>
64358 <section id="SECID247">
64359 <title>Exim on the upstream server host</title>
64360 <para>
64361 It is tempting to arrange for incoming mail for the intermittently connected
64362 host to remain on Exim&#x2019;s queue until the client connects. However, this
64363 approach does not scale very well. Two different kinds of waiting message are
64364 being mixed up in the same queue &ndash; those that cannot be delivered because of
64365 some temporary problem, and those that are waiting for their destination host
64366 to connect. This makes it hard to manage the queue, as well as wasting
64367 resources, because each queue runner scans the entire queue.
64368 </para>
64369 <para>
64370 A better approach is to separate off those messages that are waiting for an
64371 intermittently connected host. This can be done by delivering these messages
64372 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
64373 format, from where they are transmitted by other software when their
64374 destination connects. This makes it easy to collect all the mail for one host
64375 in a single directory, and to apply local timeout rules on a per-message basis
64376 if required.
64377 </para>
64378 <para>
64379 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
64380 you are doing this, you should configure Exim with a long retry period for the
64381 intermittent host. For example:
64382 </para>
64383 <literallayout class="monospaced">
64384 cheshire.wonderland.fict.example    *   F,5d,24h
64385 </literallayout>
64386 <para>
64387 This stops a lot of failed delivery attempts from occurring, but Exim remembers
64388 which messages it has queued up for that host. Once the intermittent host comes
64389 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
64390 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
64391 causes all the queued up messages to be delivered, often down a single SMTP
64392 connection. While the host remains connected, any new messages get delivered
64393 immediately.
64394 </para>
64395 <para>
64396 If the connecting hosts do not have fixed IP addresses, that is, if a host is
64397 issued with a different IP address each time it connects, Exim&#x2019;s retry
64398 mechanisms on the holding host get confused, because the IP address is normally
64399 used as part of the key string for holding retry information. This can be
64400 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
64401 Since this has disadvantages for permanently connected hosts, it is best to
64402 arrange a separate transport for the intermittently connected ones.
64403 </para>
64404 </section>
64405 <section id="SECID248">
64406 <title>Exim on the intermittently connected client host</title>
64407 <para>
64408 The value of <option>smtp_accept_queue_per_connection</option> should probably be
64409 increased, or even set to zero (that is, disabled) on the intermittently
64410 connected host, so that all incoming messages down a single connection get
64411 delivered immediately.
64412 </para>
64413 <para>
64414 <indexterm role="concept">
64415 <primary>SMTP</primary>
64416 <secondary>passed connection</secondary>
64417 </indexterm>
64418 <indexterm role="concept">
64419 <primary>SMTP</primary>
64420 <secondary>multiple deliveries</secondary>
64421 </indexterm>
64422 <indexterm role="concept">
64423 <primary>multiple SMTP deliveries</primary>
64424 </indexterm>
64425 Mail waiting to be sent from an intermittently connected host will probably
64426 not have been routed, because without a connection DNS lookups are not
64427 possible. This means that if a normal queue run is done at connection time,
64428 each message is likely to be sent in a separate SMTP session. This can be
64429 avoided by starting the queue run with a command line option beginning with
64430 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
64431 first pass, routing is done but no deliveries take place. The second pass is a
64432 normal queue run; since all the messages have been previously routed, those
64433 destined for the same host are likely to get sent as multiple deliveries in a
64434 single SMTP connection.
64435 </para>
64436 </section>
64437 </chapter>
64438
64439 <chapter id="CHAPnonqueueing">
64440 <title>Using Exim as a non-queueing client</title>
64441 <titleabbrev>Exim as a non-queueing client</titleabbrev>
64442 <para>
64443 <indexterm role="concept">
64444 <primary>client, non-queueing</primary>
64445 </indexterm>
64446 <indexterm role="concept">
64447 <primary>smart host</primary>
64448 <secondary>suppressing queueing</secondary>
64449 </indexterm>
64450 On a personal computer, it is a common requirement for all
64451 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
64452 configured to operate that way, for all the popular operating systems.
64453 However, there are some MUAs for Unix-like systems that cannot be so
64454 configured: they submit messages using the command line interface of
64455 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
64456 messages this way.
64457 </para>
64458 <para>
64459 If the personal computer runs continuously, there is no problem, because it can
64460 run a conventional MTA that handles delivery to the smart host, and deal with
64461 any delays via its queueing mechanism. However, if the computer does not run
64462 continuously or runs different operating systems at different times, queueing
64463 email is not desirable.
64464 </para>
64465 <para>
64466 There is therefore a requirement for something that can provide the
64467 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
64468 any queueing or retrying facilities. Furthermore, the delivery to the smart
64469 host should be synchronous, so that if it fails, the sending MUA is immediately
64470 informed. In other words, we want something that extends an MUA that submits
64471 to a local MTA via the command line so that it behaves like one that submits
64472 to a remote smart host using TCP/SMTP.
64473 </para>
64474 <para>
64475 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
64476 that do this job. However, people have found them to be lacking in various
64477 ways. For instance, you might want to allow aliasing and forwarding to be done
64478 before sending a message to the smart host.
64479 </para>
64480 <para>
64481 Exim already had the necessary infrastructure for doing this job. Just a few
64482 tweaks were needed to make it behave as required, though it is somewhat of an
64483 overkill to use a fully-featured MTA for this purpose.
64484 </para>
64485 <para>
64486 <indexterm role="option">
64487 <primary><option>mua_wrapper</option></primary>
64488 </indexterm>
64489 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
64490 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
64491 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
64492 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
64493 compatible router and transport configuration. Typically there will be just one
64494 router and one transport, sending everything to a smart host.
64495 </para>
64496 <para>
64497 When run in MUA wrapping mode, the behaviour of Exim changes in the
64498 following ways:
64499 </para>
64500 <itemizedlist>
64501 <listitem>
64502 <para>
64503 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
64504 In other words, the only way to submit messages is via the command line.
64505 </para>
64506 </listitem>
64507 <listitem>
64508 <para>
64509 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
64510 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
64511 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
64512 does not finish until the delivery attempt is complete. If the delivery is
64513 successful, a zero return code is given.
64514 </para>
64515 </listitem>
64516 <listitem>
64517 <para>
64518 Address redirection is permitted, but the final routing for all addresses must
64519 be to the same remote transport, and to the same list of hosts. Furthermore,
64520 the return address (envelope sender) must be the same for all recipients, as
64521 must any added or deleted header lines. In other words, it must be possible to
64522 deliver the message in a single SMTP transaction, however many recipients there
64523 are.
64524 </para>
64525 </listitem>
64526 <listitem>
64527 <para>
64528 If these conditions are not met, or if routing any address results in a
64529 failure or defer status, or if Exim is unable to deliver all the recipients
64530 successfully to one of the smart hosts, delivery of the entire message fails.
64531 </para>
64532 </listitem>
64533 <listitem>
64534 <para>
64535 Because no queueing is allowed, all failures are treated as permanent; there
64536 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
64537 smart host. Furthermore, because only a single yes/no response can be given to
64538 the caller, it is not possible to deliver to some recipients and not others. If
64539 there is an error (temporary or permanent) for any recipient, all are failed.
64540 </para>
64541 </listitem>
64542 <listitem>
64543 <para>
64544 If more than one smart host is listed, Exim will try another host after a
64545 connection failure or a timeout, in the normal way. However, if this kind of
64546 failure happens for all the hosts, the delivery fails.
64547 </para>
64548 </listitem>
64549 <listitem>
64550 <para>
64551 When delivery fails, an error message is written to the standard error stream
64552 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
64553 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
64554 are ever generated.
64555 </para>
64556 </listitem>
64557 <listitem>
64558 <para>
64559 No retry data is maintained, and any retry rules are ignored.
64560 </para>
64561 </listitem>
64562 <listitem>
64563 <para>
64564 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
64565 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
64566 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
64567 </para>
64568 </listitem>
64569 </itemizedlist>
64570 <para>
64571 The overall effect is that Exim makes a single synchronous attempt to deliver
64572 the message, failing if there is any kind of problem. Because no local
64573 deliveries are done and no daemon can be run, Exim does not need root
64574 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
64575 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
64576 the advantages and disadvantages of running without root privilege.
64577 </para>
64578 </chapter>
64579
64580 <chapter id="CHAPlog">
64581 <title>Log files</title>
64582 <para>
64583 <indexterm role="concept" id="IIDloggen" class="startofrange">
64584 <primary>log</primary>
64585 <secondary>general description</secondary>
64586 </indexterm>
64587 <indexterm role="concept">
64588 <primary>log</primary>
64589 <secondary>types of</secondary>
64590 </indexterm>
64591 Exim writes three different logs, referred to as the main log, the reject log,
64592 and the panic log:
64593 </para>
64594 <itemizedlist>
64595 <listitem>
64596 <para>
64597 <indexterm role="concept">
64598 <primary>main log</primary>
64599 </indexterm>
64600 The main log records the arrival of each message and each delivery in a single
64601 line in each case. The format is as compact as possible, in an attempt to keep
64602 down the size of log files. Two-character flag sequences make it easy to pick
64603 out these lines. A number of other events are recorded in the main log. Some of
64604 them are optional, in which case the <option>log_selector</option> option controls whether
64605 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
64606 analysis of main log files, is provided in the Exim distribution (see section
64607 <xref linkend="SECTmailstat"/>).
64608 </para>
64609 </listitem>
64610 <listitem>
64611 <para>
64612 <indexterm role="concept">
64613 <primary>reject log</primary>
64614 </indexterm>
64615 The reject log records information from messages that are rejected as a result
64616 of a configuration option (that is, for policy reasons).
64617 The first line of each rejection is a copy of the line that is also written to
64618 the main log. Then, if the message&#x2019;s header has been read at the time the log
64619 is written, its contents are written to this log. Only the original header
64620 lines are available; header lines added by ACLs are not logged. You can use the
64621 reject log to check that your policy controls are working correctly; on a busy
64622 host this may be easier than scanning the main log for rejection messages. You
64623 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
64624 false.
64625 </para>
64626 </listitem>
64627 <listitem>
64628 <para>
64629 <indexterm role="concept">
64630 <primary>panic log</primary>
64631 </indexterm>
64632 <indexterm role="concept">
64633 <primary>system log</primary>
64634 </indexterm>
64635 When certain serious errors occur, Exim writes entries to its panic log. If the
64636 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
64637 are usually written to the main log as well, but can get lost amid the mass of
64638 other entries. The panic log should be empty under normal circumstances. It is
64639 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
64640 regularly, in order to become aware of any problems. When Exim cannot open its
64641 panic log, it tries as a last resort to write to the system log (syslog). This
64642 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
64643 message itself is written at priority LOG_CRIT.
64644 </para>
64645 </listitem>
64646 </itemizedlist>
64647 <para>
64648 Every log line starts with a timestamp, in the format shown in the following
64649 example. Note that many of the examples shown in this chapter are line-wrapped.
64650 In the log file, this would be all on one line:
64651 </para>
64652 <literallayout class="monospaced">
64653 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
64654   by QUIT
64655 </literallayout>
64656 <para>
64657 By default, the timestamps are in the local timezone. There are two
64658 ways of changing this:
64659 </para>
64660 <itemizedlist>
64661 <listitem>
64662 <para>
64663 You can set the <option>timezone</option> option to a different time zone; in particular, if
64664 you set
64665 </para>
64666 <literallayout class="monospaced">
64667 timezone = UTC
64668 </literallayout>
64669 <para>
64670 the timestamps will be in UTC (aka GMT).
64671 </para>
64672 </listitem>
64673 <listitem>
64674 <para>
64675 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
64676 example:
64677 </para>
64678 <literallayout class="monospaced">
64679 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
64680 </literallayout>
64681 </listitem>
64682 </itemizedlist>
64683 <para>
64684 <indexterm role="concept">
64685 <primary>log</primary>
64686 <secondary>process ids in</secondary>
64687 </indexterm>
64688 <indexterm role="concept">
64689 <primary>pid (process id)</primary>
64690 <secondary>in log lines</secondary>
64691 </indexterm>
64692 Exim does not include its process id in log lines by default, but you can
64693 request that it does so by specifying the <literal>pid</literal> log selector (see section
64694 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
64695 brackets, immediately after the time and date.
64696 </para>
64697 <section id="SECTwhelogwri">
64698 <title>Where the logs are written</title>
64699 <para>
64700 <indexterm role="concept">
64701 <primary>log</primary>
64702 <secondary>destination</secondary>
64703 </indexterm>
64704 <indexterm role="concept">
64705 <primary>log</primary>
64706 <secondary>to file</secondary>
64707 </indexterm>
64708 <indexterm role="concept">
64709 <primary>log</primary>
64710 <secondary>to syslog</secondary>
64711 </indexterm>
64712 <indexterm role="concept">
64713 <primary>syslog</primary>
64714 </indexterm>
64715 The logs may be written to local files, or to syslog, or both. However, it
64716 should be noted that many syslog implementations use UDP as a transport, and
64717 are therefore unreliable in the sense that messages are not guaranteed to
64718 arrive at the loghost, nor is the ordering of messages necessarily maintained.
64719 It has also been reported that on large log files (tens of megabytes) you may
64720 need to tweak syslog to prevent it syncing the file with each write &ndash; on
64721 Linux this has been seen to make syslog take 90% plus of CPU time.
64722 </para>
64723 <para>
64724 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
64725 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
64726 configuration. This latter string is expanded, so it can contain, for example,
64727 references to the host name:
64728 </para>
64729 <literallayout class="monospaced">
64730 log_file_path = /var/log/$primary_hostname/exim_%slog
64731 </literallayout>
64732 <para>
64733 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
64734 rather than at run time, because then the setting is available right from the
64735 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
64736 before it has read the configuration file (for example, an error in the
64737 configuration file) it will not use the path you want, and may not be able to
64738 log at all.
64739 </para>
64740 <para>
64741 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
64742 list, currently limited to at most two items. This is one option where the
64743 facility for changing a list separator may not be used. The list must always be
64744 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
64745 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
64746 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
64747 implying the use of a default path.
64748 </para>
64749 <para>
64750 When Exim encounters an empty item in the list, it searches the list defined by
64751 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
64752 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
64753 mean <quote>use the path specified at build time</quote>. It no such item exists, log
64754 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
64755 equivalent to the setting:
64756 </para>
64757 <literallayout class="monospaced">
64758 log_file_path = $spool_directory/log/%slog
64759 </literallayout>
64760 <para>
64761 If you do not specify anything at build time or run time,
64762 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
64763 that is where the logs are written.
64764 </para>
64765 <para>
64766 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
64767 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
64768 </para>
64769 <para>
64770 Here are some examples of possible settings:
64771 </para>
64772 <literallayout>
64773 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
64774 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
64775 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
64776 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
64777 </literallayout>
64778 <para>
64779 If there are more than two paths in the list, the first is used and a panic
64780 error is logged.
64781 </para>
64782 </section>
64783 <section id="SECID285">
64784 <title>Logging to local files that are periodically <quote>cycled</quote></title>
64785 <para>
64786 <indexterm role="concept">
64787 <primary>log</primary>
64788 <secondary>cycling local files</secondary>
64789 </indexterm>
64790 <indexterm role="concept">
64791 <primary>cycling logs</primary>
64792 </indexterm>
64793 <indexterm role="concept">
64794 <primary><emphasis>exicyclog</emphasis></primary>
64795 </indexterm>
64796 <indexterm role="concept">
64797 <primary>log</primary>
64798 <secondary>local files; writing to</secondary>
64799 </indexterm>
64800 Some operating systems provide centralized and standardized methods for cycling
64801 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
64802 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
64803 main and reject logs each time it is called. The maximum number of old logs to
64804 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
64805 </para>
64806 <para>
64807 An Exim delivery process opens the main log when it first needs to write to it,
64808 and it keeps the file open in case subsequent entries are required &ndash; for
64809 example, if a number of different deliveries are being done for the same
64810 message. However, remote SMTP deliveries can take a long time, and this means
64811 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
64812 something similar is being used to rename log files on a regular basis. To
64813 ensure that a switch of log files is noticed as soon as possible, Exim calls
64814 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
64815 does not exist, or its inode has changed, the old file is closed and Exim
64816 tries to open the main log from scratch. Thus, an old log file may remain open
64817 for quite some time, but no Exim processes should write to it once it has been
64818 renamed.
64819 </para>
64820 </section>
64821 <section id="SECTdatlogfil">
64822 <title>Datestamped log files</title>
64823 <para>
64824 <indexterm role="concept">
64825 <primary>log</primary>
64826 <secondary>datestamped files</secondary>
64827 </indexterm>
64828 Instead of cycling the main and reject log files by renaming them
64829 periodically, some sites like to use files whose names contain a datestamp,
64830 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
64831 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
64832 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
64833 point where the datestamp is required. For example:
64834 </para>
64835 <literallayout class="monospaced">
64836 log_file_path = /var/spool/exim/log/%slog-%D
64837 log_file_path = /var/log/exim-%s-%D.log
64838 log_file_path = /var/spool/exim/log/%D-%slog
64839 log_file_path = /var/log/exim/%s.%M
64840 </literallayout>
64841 <para>
64842 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
64843 examples of names generated by the above examples:
64844 </para>
64845 <literallayout class="monospaced">
64846 /var/spool/exim/log/mainlog-20021225
64847 /var/log/exim-reject-20021225.log
64848 /var/spool/exim/log/20021225-mainlog
64849 /var/log/exim/main.200212
64850 </literallayout>
64851 <para>
64852 When this form of log file is specified, Exim automatically switches to new
64853 files at midnight. It does not make any attempt to compress old logs; you
64854 will need to write your own script if you require this. You should not
64855 run <emphasis>exicyclog</emphasis> with this form of logging.
64856 </para>
64857 <para>
64858 The location of the panic log is also determined by <option>log_file_path</option>, but it
64859 is not datestamped, because rotation of the panic log does not make sense.
64860 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
64861 the string. In addition, if it immediately follows a slash, a following
64862 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
64863 character is removed. Thus, the four examples above would give these panic
64864 log names:
64865 </para>
64866 <literallayout class="monospaced">
64867 /var/spool/exim/log/paniclog
64868 /var/log/exim-panic.log
64869 /var/spool/exim/log/paniclog
64870 /var/log/exim/panic
64871 </literallayout>
64872 </section>
64873 <section id="SECID249">
64874 <title>Logging to syslog</title>
64875 <para>
64876 <indexterm role="concept">
64877 <primary>log</primary>
64878 <secondary>syslog; writing to</secondary>
64879 </indexterm>
64880 The use of syslog does not change what Exim logs or the format of its messages,
64881 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
64882 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
64883 that, the same strings are written to syslog as to log files. The syslog
64884 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
64885 by default, but you can change these by setting the <option>syslog_facility</option> and
64886 <option>syslog_processname</option> options, respectively. If Exim was compiled with
64887 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
64888 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
64889 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
64890 the time and host name to each line.
64891 The three log streams are mapped onto syslog priorities as follows:
64892 </para>
64893 <itemizedlist>
64894 <listitem>
64895 <para>
64896 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
64897 </para>
64898 </listitem>
64899 <listitem>
64900 <para>
64901 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
64902 </para>
64903 </listitem>
64904 <listitem>
64905 <para>
64906 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
64907 </para>
64908 </listitem>
64909 </itemizedlist>
64910 <para>
64911 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
64912 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
64913 these are routed by syslog to the same place. You can suppress this duplication
64914 by setting <option>syslog_duplication</option> false.
64915 </para>
64916 <para>
64917 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
64918 entries contain multiple lines when headers are included. To cope with both
64919 these cases, entries written to syslog are split into separate <function>syslog()</function>
64920 calls at each internal newline, and also after a maximum of
64921 870 data characters. (This allows for a total syslog line length of 1024, when
64922 additions such as timestamps are added.) If you are running a syslog
64923 replacement that can handle lines longer than the 1024 characters allowed by
64924 RFC 3164, you should set
64925 </para>
64926 <literallayout class="monospaced">
64927 SYSLOG_LONG_LINES=yes
64928 </literallayout>
64929 <para>
64930 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
64931 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
64932 </para>
64933 <para>
64934 To make it easy to re-assemble split lines later, each component of a split
64935 entry starts with a string of the form [&lt;<emphasis>n</emphasis>&gt;/&lt;<emphasis>m</emphasis>&gt;] or [&lt;<emphasis>n</emphasis>&gt;\&lt;<emphasis>m</emphasis>&gt;]
64936 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
64937 components in the entry. The / delimiter is used when the line was split
64938 because it was too long; if it was split because of an internal newline, the \
64939 delimiter is used. For example, supposing the length limit to be 50 instead of
64940 870, the following would be the result of a typical rejection message to
64941 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
64942 name, and pid as added by syslog:
64943 </para>
64944 <literallayout class="monospaced">
64945 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
64946 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
64947 [3/5]  when scanning for sender: missing or malformed lo
64948 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
64949 [5/5] mple&gt;)
64950 </literallayout>
64951 <para>
64952 The same error might cause the following lines to be written to <quote>rejectlog</quote>
64953 (LOG_NOTICE):
64954 </para>
64955 <literallayout class="monospaced">
64956 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
64957 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
64958 [3/18] er when scanning for sender: missing or malformed
64959 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
64960 [5\18] .example&gt;)
64961 [6\18] Recipients: ph10@some.domain.cam.example
64962 [7\18] P Received: from [127.0.0.1] (ident=ph10)
64963 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
64964 [9\18]        id 16RdAL-0006pc-00
64965 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
64966 [11\18] 09:43 +0100
64967 [12\18] F From: &lt;&gt;
64968 [13\18]   Subject: this is a test header
64969 [18\18]   X-something: this is another header
64970 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
64971 [16\18] le&gt;
64972 [17\18] B Bcc:
64973 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
64974 </literallayout>
64975 <para>
64976 Log lines that are neither too long nor contain newlines are written to syslog
64977 without modification.
64978 </para>
64979 <para>
64980 If only syslog is being used, the Exim monitor is unable to provide a log tail
64981 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
64982 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
64983 where it is.
64984 </para>
64985 </section>
64986 <section id="SECID250">
64987 <title>Log line flags</title>
64988 <para>
64989 One line is written to the main log for each message received, and for each
64990 successful, unsuccessful, and delayed delivery. These lines can readily be
64991 picked out by the distinctive two-character flags that immediately follow the
64992 timestamp. The flags are:
64993 </para>
64994 <literallayout>
64995 <literal>&lt;=</literal>     message arrival
64996 <literal>(=</literal>     message fakereject
64997 <literal>=&gt;</literal>     normal message delivery
64998 <literal>-&gt;</literal>     additional address in same delivery
64999 <literal>&gt;&gt;</literal>     cutthrough message delivery
65000 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
65001 <literal>**</literal>     delivery failed; address bounced
65002 <literal>==</literal>     delivery deferred; temporary problem
65003 </literallayout>
65004 </section>
65005 <section id="SECID251">
65006 <title>Logging message reception</title>
65007 <para>
65008 <indexterm role="concept">
65009 <primary>log</primary>
65010 <secondary>reception line</secondary>
65011 </indexterm>
65012 The format of the single-line entry in the main log that is written for every
65013 message received is shown in the basic example below, which is split over
65014 several lines in order to fit it on the page:
65015 </para>
65016 <literallayout class="monospaced">
65017 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
65018   H=mailer.fict.example [192.168.123.123] U=exim
65019   P=smtp S=5678 id=&lt;incoming message id&gt;
65020 </literallayout>
65021 <para>
65022 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
65023 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
65024 generated, this is followed by an item of the form
65025 </para>
65026 <literallayout class="monospaced">
65027 R=&lt;message id&gt;
65028 </literallayout>
65029 <para>
65030 which is a reference to the message that caused the bounce to be sent.
65031 </para>
65032 <para>
65033 <indexterm role="concept">
65034 <primary>HELO</primary>
65035 </indexterm>
65036 <indexterm role="concept">
65037 <primary>EHLO</primary>
65038 </indexterm>
65039 For messages from other hosts, the H and U fields identify the remote host and
65040 record the RFC 1413 identity of the user that sent the message, if one was
65041 received. The number given in square brackets is the IP address of the sending
65042 host. If there is a single, unparenthesized  host name in the H field, as
65043 above, it has been verified to correspond to the IP address (see the
65044 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
65045 by the remote host in the SMTP HELO or EHLO command, and has not been
65046 verified. If verification yields a different name to that given for HELO or
65047 EHLO, the verified name appears first, followed by the HELO or EHLO
65048 name in parentheses.
65049 </para>
65050 <para>
65051 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
65052 without brackets, in the HELO or EHLO command, leading to entries in
65053 the log containing text like these examples:
65054 </para>
65055 <literallayout class="monospaced">
65056 H=(10.21.32.43) [192.168.8.34]
65057 H=([10.21.32.43]) [192.168.8.34]
65058 </literallayout>
65059 <para>
65060 This can be confusing. Only the final address in square brackets can be relied
65061 on.
65062 </para>
65063 <para>
65064 For locally generated messages (that is, messages not received over TCP/IP),
65065 the H field is omitted, and the U field contains the login name of the caller
65066 of Exim.
65067 </para>
65068 <para>
65069 <indexterm role="concept">
65070 <primary>authentication</primary>
65071 <secondary>logging</secondary>
65072 </indexterm>
65073 <indexterm role="concept">
65074 <primary>AUTH</primary>
65075 <secondary>logging</secondary>
65076 </indexterm>
65077 For all messages, the P field specifies the protocol used to receive the
65078 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
65079 of incoming SMTP messages, the value indicates whether or not any SMTP
65080 extensions (ESMTP), encryption, or authentication were used. If the SMTP
65081 session was encrypted, there is an additional X field that records the cipher
65082 suite that was used.
65083 </para>
65084 <para>
65085 <indexterm role="concept">
65086 <primary>log</primary>
65087 <secondary>protocol</secondary>
65088 </indexterm>
65089 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
65090 hosts that have authenticated themselves using the SMTP AUTH command. The first
65091 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
65092 there is an additional item A= followed by the name of the authenticator that
65093 was used. If an authenticated identification was set up by the authenticator&#x2019;s
65094 <option>server_set_id</option> option, this is logged too, separated by a colon from the
65095 authenticator name.
65096 </para>
65097 <para>
65098 <indexterm role="concept">
65099 <primary>size</primary>
65100 <secondary>of message</secondary>
65101 </indexterm>
65102 The id field records the existing message id, if present. The size of the
65103 received message is given by the S field. When the message is delivered,
65104 headers may be removed or added, so that the size of delivered copies of the
65105 message may not correspond with this value (and indeed may be different to each
65106 other).
65107 </para>
65108 <para>
65109 The <option>log_selector</option> option can be used to request the logging of additional
65110 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
65111 </para>
65112 </section>
65113 <section id="SECID252">
65114 <title>Logging deliveries</title>
65115 <para>
65116 <indexterm role="concept">
65117 <primary>log</primary>
65118 <secondary>delivery line</secondary>
65119 </indexterm>
65120 The format of the single-line entry in the main log that is written for every
65121 delivery is shown in one of the examples below, for local and remote
65122 deliveries, respectively. Each example has been split into multiple lines in order
65123 to fit it on the page:
65124 </para>
65125 <literallayout class="monospaced">
65126 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
65127   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
65128 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
65129   monk@holistic.fict.example R=dnslookup T=remote_smtp
65130   H=holistic.fict.example [192.168.234.234]
65131 </literallayout>
65132 <para>
65133 For ordinary local deliveries, the original address is given in angle brackets
65134 after the final delivery address, which might be a pipe or a file. If
65135 intermediate address(es) exist between the original and the final address, the
65136 last of these is given in parentheses after the final address. The R and T
65137 fields record the router and transport that were used to process the address.
65138 </para>
65139 <para>
65140 If SMTP AUTH was used for the delivery there is an additional item A=
65141 followed by the name of the authenticator that was used.
65142 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
65143 option, this is logged too, separated by a colon from the authenticator name.
65144 </para>
65145 <para>
65146 If a shadow transport was run after a successful local delivery, the log line
65147 for the successful delivery has an item added on the end, of the form
65148 </para>
65149 <literallayout>
65150 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
65151 </literallayout>
65152 <para>
65153 If the shadow transport did not succeed, the error message is put in
65154 parentheses afterwards.
65155 </para>
65156 <para>
65157 <indexterm role="concept">
65158 <primary>asterisk</primary>
65159 <secondary>after IP address</secondary>
65160 </indexterm>
65161 When more than one address is included in a single delivery (for example, two
65162 SMTP RCPT commands in one transaction) the second and subsequent addresses are
65163 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
65164 down a single SMTP connection, an asterisk follows the IP address in the log
65165 lines for the second and subsequent messages.
65166 </para>
65167 <para>
65168 <indexterm role="concept">
65169 <primary>delivery</primary>
65170 <secondary>cutthrough; logging</secondary>
65171 </indexterm>
65172 <indexterm role="concept">
65173 <primary>cutthrough</primary>
65174 <secondary>logging</secondary>
65175 </indexterm>
65176 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
65177 line precedes the reception line, since cutthrough waits for a possible
65178 rejection from the destination in case it can reject the sourced item.
65179 </para>
65180 <para>
65181 The generation of a reply message by a filter file gets logged as a
65182 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
65183 </para>
65184 <para>
65185 The <option>log_selector</option> option can be used to request the logging of additional
65186 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
65187 </para>
65188 </section>
65189 <section id="SECID253">
65190 <title>Discarded deliveries</title>
65191 <para>
65192 <indexterm role="concept">
65193 <primary>discarded messages</primary>
65194 </indexterm>
65195 <indexterm role="concept">
65196 <primary>message</primary>
65197 <secondary>discarded</secondary>
65198 </indexterm>
65199 <indexterm role="concept">
65200 <primary>delivery</primary>
65201 <secondary>discarded; logging</secondary>
65202 </indexterm>
65203 When a message is discarded as a result of the command <quote>seen finish</quote> being
65204 obeyed in a filter file which generates no deliveries, a log entry of the form
65205 </para>
65206 <literallayout class="monospaced">
65207 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
65208   &lt;low.club@bridge.example&gt; R=userforward
65209 </literallayout>
65210 <para>
65211 is written, to record why no deliveries are logged. When a message is discarded
65212 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
65213 </para>
65214 <literallayout class="monospaced">
65215 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
65216   &lt;hole@nowhere.example&gt; R=blackhole_router
65217 </literallayout>
65218 </section>
65219 <section id="SECID254">
65220 <title>Deferred deliveries</title>
65221 <para>
65222 When a delivery is deferred, a line of the following form is logged:
65223 </para>
65224 <literallayout class="monospaced">
65225 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
65226   R=dnslookup T=smtp defer (146): Connection refused
65227 </literallayout>
65228 <para>
65229 In the case of remote deliveries, the error is the one that was given for the
65230 last IP address that was tried. Details of individual SMTP failures are also
65231 written to the log, so the above line would be preceded by something like
65232 </para>
65233 <literallayout class="monospaced">
65234 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
65235   mail1.endrest.example [192.168.239.239]: Connection refused
65236 </literallayout>
65237 <para>
65238 When a deferred address is skipped because its retry time has not been reached,
65239 a message is written to the log, but this can be suppressed by setting an
65240 appropriate value in <option>log_selector</option>.
65241 </para>
65242 </section>
65243 <section id="SECID255">
65244 <title>Delivery failures</title>
65245 <para>
65246 <indexterm role="concept">
65247 <primary>delivery</primary>
65248 <secondary>failure; logging</secondary>
65249 </indexterm>
65250 If a delivery fails because an address cannot be routed, a line of the
65251 following form is logged:
65252 </para>
65253 <literallayout class="monospaced">
65254 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
65255   &lt;jim@trek99.example&gt;: unknown mail domain
65256 </literallayout>
65257 <para>
65258 If a delivery fails at transport time, the router and transport are shown, and
65259 the response from the remote host is included, as in this example:
65260 </para>
65261 <literallayout class="monospaced">
65262 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
65263   R=dnslookup T=remote_smtp: SMTP error from remote mailer
65264   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
65265   pbmail3.py.example [192.168.63.111]: 553 5.3.0
65266   &lt;ace400@pb.example&gt;...Addressee unknown
65267 </literallayout>
65268 <para>
65269 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
65270 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
65271 disabling PIPELINING. The log lines for all forms of delivery failure are
65272 flagged with <literal>**</literal>.
65273 </para>
65274 </section>
65275 <section id="SECID256">
65276 <title>Fake deliveries</title>
65277 <para>
65278 <indexterm role="concept">
65279 <primary>delivery</primary>
65280 <secondary>fake; logging</secondary>
65281 </indexterm>
65282 If a delivery does not actually take place because the <option>-N</option> option has been
65283 used to suppress it, a normal delivery line is written to the log, except that
65284 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
65285 </para>
65286 </section>
65287 <section id="SECID257">
65288 <title>Completion</title>
65289 <para>
65290 A line of the form
65291 </para>
65292 <literallayout class="monospaced">
65293 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
65294 </literallayout>
65295 <para>
65296 is written to the main log when a message is about to be removed from the spool
65297 at the end of its processing.
65298 </para>
65299 </section>
65300 <section id="SECID258">
65301 <title>Summary of Fields in Log Lines</title>
65302 <para>
65303 <indexterm role="concept">
65304 <primary>log</primary>
65305 <secondary>summary of fields</secondary>
65306 </indexterm>
65307 A summary of the field identifiers that are used in log lines is shown in
65308 the following table:
65309 </para>
65310 <literallayout>
65311 <literal>A   </literal>        authenticator name (and optional id and sender)
65312 <literal>C   </literal>        SMTP confirmation on delivery
65313 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
65314 <literal>CV  </literal>        certificate verification status
65315 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
65316 <literal>DN  </literal>        distinguished name from peer certificate
65317 <literal>DS  </literal>        DNSSEC secured lookups
65318 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
65319 <literal>F   </literal>        sender address (on delivery lines)
65320 <literal>H   </literal>        host name and IP address
65321 <literal>I   </literal>        local interface used
65322 <literal>K   </literal>        CHUNKING extension used
65323 <literal>id  </literal>        message id for incoming message
65324 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
65325 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
65326 <literal>PRDR</literal>        PRDR extension used
65327 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
65328 <literal>Q   </literal>        alternate queue name
65329 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
65330 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
65331 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
65332 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
65333 <literal>S   </literal>        size of message in bytes
65334 <literal>SNI </literal>        server name indication from TLS client hello
65335 <literal>ST  </literal>        shadow transport name
65336 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
65337 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
65338 <literal>U   </literal>        local user or RFC 1413 identity
65339 <literal>X   </literal>        TLS cipher suite
65340 </literallayout>
65341 </section>
65342 <section id="SECID259">
65343 <title>Other log entries</title>
65344 <para>
65345 Various other types of log entry are written from time to time. Most should be
65346 self-explanatory. Among the more common are:
65347 </para>
65348 <itemizedlist>
65349 <listitem>
65350 <para>
65351 <indexterm role="concept">
65352 <primary>retry</primary>
65353 <secondary>time not reached</secondary>
65354 </indexterm>
65355 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
65356 during routing or local delivery, and the time to retry has not yet arrived.
65357 This message is not written to an individual message log file unless it happens
65358 during the first delivery attempt.
65359 </para>
65360 </listitem>
65361 <listitem>
65362 <para>
65363 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
65364 temporary errors during remote delivery, and the retry time has not yet arrived
65365 for any of the hosts to which it is routed.
65366 </para>
65367 </listitem>
65368 <listitem>
65369 <para>
65370 <indexterm role="concept">
65371 <primary>spool directory</primary>
65372 <secondary>file locked</secondary>
65373 </indexterm>
65374 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
65375 some other Exim process is already working on the message. This can be quite
65376 common if queue running processes are started at frequent intervals. The
65377 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
65378 doing.
65379 </para>
65380 </listitem>
65381 <listitem>
65382 <para>
65383 <indexterm role="concept">
65384 <primary>error</primary>
65385 <secondary>ignored</secondary>
65386 </indexterm>
65387 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
65388 message:
65389 </para>
65390 <orderedlist numeration="arabic">
65391 <listitem>
65392 <para>
65393 Exim failed to deliver a bounce message whose age was greater than
65394 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
65395 </para>
65396 </listitem>
65397 <listitem>
65398 <para>
65399 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
65400 failed. The delivery was discarded.
65401 </para>
65402 </listitem>
65403 <listitem>
65404 <para>
65405 A delivery set up by a router configured with
65406 </para>
65407 <literallayout class="monospaced">
65408     errors_to = &lt;&gt;
65409 </literallayout>
65410 <para>
65411 failed. The delivery was discarded.
65412 </para>
65413 </listitem>
65414 </orderedlist>
65415 </listitem>
65416 </itemizedlist>
65417 </section>
65418 <section id="SECTlogselector">
65419 <title>Reducing or increasing what is logged</title>
65420 <para>
65421 <indexterm role="concept">
65422 <primary>log</primary>
65423 <secondary>selectors</secondary>
65424 </indexterm>
65425 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
65426 default logging, or you can request additional logging. The value of
65427 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
65428 example:
65429 </para>
65430 <literallayout class="monospaced">
65431 log_selector = +arguments -retry_defer
65432 </literallayout>
65433 <para>
65434 The list of optional log items is in the following table, with the default
65435 selection marked by asterisks:
65436 </para>
65437 <literallayout>
65438 <literal> 8bitmime                   </literal>  received 8BITMIME status
65439 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
65440 <literal> address_rewrite            </literal>  address rewriting
65441 <literal> all_parents                </literal>  all parents in =&gt; lines
65442 <literal> arguments                  </literal>  command line arguments
65443 <literal>*connection_reject          </literal>  connection rejections
65444 <literal>*delay_delivery             </literal>  immediate delivery delayed
65445 <literal> deliver_time               </literal>  time taken to perform delivery
65446 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
65447 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
65448 <literal> dnssec                     </literal>  DNSSEC secured lookups
65449 <literal>*etrn                       </literal>  ETRN commands
65450 <literal>*host_lookup_failed         </literal>  as it says
65451 <literal> ident_timeout              </literal>  timeout for ident connection
65452 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
65453 <literal> incoming_port              </literal>  remote port on &lt;= lines
65454 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
65455 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
65456 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
65457 <literal>*queue_run                  </literal>  start and end queue runs
65458 <literal> queue_time                 </literal>  time on queue for one recipient
65459 <literal> queue_time_overall         </literal>  time on queue for whole message
65460 <literal> pid                        </literal>  Exim process id
65461 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
65462 <literal> received_recipients        </literal>  recipients on &lt;= lines
65463 <literal> received_sender            </literal>  sender on &lt;= lines
65464 <literal>*rejected_header            </literal>  header contents on reject log
65465 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
65466 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
65467 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
65468 <literal>*sender_verify_fail         </literal>  sender verification failures
65469 <literal>*size_reject                </literal>  rejection because too big
65470 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
65471 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
65472 <literal> smtp_connection            </literal>  incoming SMTP connections
65473 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
65474 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
65475 <literal> smtp_no_mail               </literal>  session with no MAIL commands
65476 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
65477 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
65478 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
65479 <literal>*tls_certificate_verified   </literal>  certificate verification status
65480 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
65481 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
65482 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
65483 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
65484
65485 <literal> all                        </literal>  all of the above
65486 </literallayout>
65487 <para>
65488 See also the <option>slow_lookup_log</option> main configuration option,
65489 section <xref linkend="SECID99"/>
65490 </para>
65491 <para>
65492 More details on each of these items follows:
65493 </para>
65494 <itemizedlist>
65495 <listitem>
65496 <para>
65497 <indexterm role="concept">
65498 <primary>8BITMIME</primary>
65499 </indexterm>
65500 <indexterm role="concept">
65501 <primary>log</primary>
65502 <secondary>8BITMIME</secondary>
65503 </indexterm>
65504 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
65505 which may help in tracking down interoperability issues with ancient MTAs
65506 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
65507 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
65508 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
65509 </para>
65510 </listitem>
65511 <listitem>
65512 <para>
65513 <indexterm role="concept">
65514 <primary><option>warn</option> ACL verb</primary>
65515 <secondary>log when skipping</secondary>
65516 </indexterm>
65517 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
65518 its conditions cannot be evaluated, a log line to this effect is written if
65519 this log selector is set.
65520 </para>
65521 </listitem>
65522 <listitem>
65523 <para>
65524 <indexterm role="concept">
65525 <primary>log</primary>
65526 <secondary>rewriting</secondary>
65527 </indexterm>
65528 <indexterm role="concept">
65529 <primary>rewriting</primary>
65530 <secondary>logging</secondary>
65531 </indexterm>
65532 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
65533 rewrites, but not to rewrites in filters run as an unprivileged user (because
65534 such users cannot access the log).
65535 </para>
65536 </listitem>
65537 <listitem>
65538 <para>
65539 <indexterm role="concept">
65540 <primary>log</primary>
65541 <secondary>full parentage</secondary>
65542 </indexterm>
65543 <option>all_parents</option>: Normally only the original and final addresses are logged on
65544 delivery lines; with this selector, intermediate parents are given in
65545 parentheses between them.
65546 </para>
65547 </listitem>
65548 <listitem>
65549 <para>
65550 <indexterm role="concept">
65551 <primary>log</primary>
65552 <secondary>Exim arguments</secondary>
65553 </indexterm>
65554 <indexterm role="concept">
65555 <primary>Exim arguments, logging</primary>
65556 </indexterm>
65557 <option>arguments</option>: This causes Exim to write the arguments with which it was called
65558 to the main log, preceded by the current working directory. This is a debugging
65559 feature, added to make it easier to find out how certain MUAs call
65560 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
65561 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
65562 that are empty or that contain white space are quoted. Non-printing characters
65563 are shown as escape sequences. This facility cannot log unrecognized arguments,
65564 because the arguments are checked before the configuration file is read. The
65565 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
65566 between the caller and Exim.
65567 </para>
65568 </listitem>
65569 <listitem>
65570 <para>
65571 <indexterm role="concept">
65572 <primary>log</primary>
65573 <secondary>connection rejections</secondary>
65574 </indexterm>
65575 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
65576 connection is rejected, for whatever reason.
65577 </para>
65578 </listitem>
65579 <listitem>
65580 <para>
65581 <indexterm role="concept">
65582 <primary>log</primary>
65583 <secondary>delayed delivery</secondary>
65584 </indexterm>
65585 <indexterm role="concept">
65586 <primary>delayed delivery, logging</primary>
65587 </indexterm>
65588 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
65589 started for an incoming message because the load is too high or too many
65590 messages were received on one connection. Logging does not occur if no delivery
65591 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
65592 </para>
65593 </listitem>
65594 <listitem>
65595 <para>
65596 <indexterm role="concept">
65597 <primary>log</primary>
65598 <secondary>delivery duration</secondary>
65599 </indexterm>
65600 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
65601 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
65602 </para>
65603 </listitem>
65604 <listitem>
65605 <para>
65606 <indexterm role="concept">
65607 <primary>log</primary>
65608 <secondary>message size on delivery</secondary>
65609 </indexterm>
65610 <indexterm role="concept">
65611 <primary>size</primary>
65612 <secondary>of message</secondary>
65613 </indexterm>
65614 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
65615 the <quote>=&gt;</quote> line, tagged with S=.
65616 </para>
65617 </listitem>
65618 <listitem>
65619 <para>
65620 <indexterm role="concept">
65621 <primary>log</primary>
65622 <secondary>dnslist defer</secondary>
65623 </indexterm>
65624 <indexterm role="concept">
65625 <primary>DNS list</primary>
65626 <secondary>logging defer</secondary>
65627 </indexterm>
65628 <indexterm role="concept">
65629 <primary>black list (DNS)</primary>
65630 </indexterm>
65631 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
65632 DNS black list suffers a temporary error.
65633 </para>
65634 </listitem>
65635 <listitem>
65636 <para>
65637 <indexterm role="concept">
65638 <primary>log</primary>
65639 <secondary>dnssec</secondary>
65640 </indexterm>
65641 <indexterm role="concept">
65642 <primary>dnssec</primary>
65643 <secondary>logging</secondary>
65644 </indexterm>
65645 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
65646 dns lookups gave secure results a tag of DS is added.
65647 For acceptance this covers the reverse and forward lookups for host name verification.
65648 It does not cover helo-name verification.
65649 For delivery this covers the SRV, MX, A and/or AAAA lookups.
65650 </para>
65651 </listitem>
65652 <listitem>
65653 <para>
65654 <indexterm role="concept">
65655 <primary>log</primary>
65656 <secondary>ETRN commands</secondary>
65657 </indexterm>
65658 <indexterm role="concept">
65659 <primary>ETRN</primary>
65660 <secondary>logging</secondary>
65661 </indexterm>
65662 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
65663 is run to determine whether or not it is actually accepted. An invalid ETRN
65664 command, or one received within a message transaction is not logged by this
65665 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
65666 </para>
65667 </listitem>
65668 <listitem>
65669 <para>
65670 <indexterm role="concept">
65671 <primary>log</primary>
65672 <secondary>host lookup failure</secondary>
65673 </indexterm>
65674 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
65675 any addresses, or when a lookup of an IP address fails to find a host name, a
65676 log line is written. This logging does not apply to direct DNS lookups when
65677 routing email addresses, but it does apply to <quote>byname</quote> lookups.
65678 </para>
65679 </listitem>
65680 <listitem>
65681 <para>
65682 <indexterm role="concept">
65683 <primary>log</primary>
65684 <secondary>ident timeout</secondary>
65685 </indexterm>
65686 <indexterm role="concept">
65687 <primary>RFC 1413</primary>
65688 <secondary>logging timeout</secondary>
65689 </indexterm>
65690 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
65691 client&#x2019;s ident port times out.
65692 </para>
65693 </listitem>
65694 <listitem>
65695 <para>
65696 <indexterm role="concept">
65697 <primary>log</primary>
65698 <secondary>incoming interface</secondary>
65699 </indexterm>
65700 <indexterm role="concept">
65701 <primary>log</primary>
65702 <secondary>local interface</secondary>
65703 </indexterm>
65704 <indexterm role="concept">
65705 <primary>log</primary>
65706 <secondary>local address and port</secondary>
65707 </indexterm>
65708 <indexterm role="concept">
65709 <primary>TCP/IP</primary>
65710 <secondary>logging local address and port</secondary>
65711 </indexterm>
65712 <indexterm role="concept">
65713 <primary>interface</primary>
65714 <secondary>logging</secondary>
65715 </indexterm>
65716 <option>incoming_interface</option>: The interface on which a message was received is added
65717 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
65718 followed by a colon and the port number. The local interface and port are also
65719 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, to
65720 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
65721 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
65722 </para>
65723 </listitem>
65724 <listitem>
65725 <para>
65726 <indexterm role="concept">
65727 <primary>log</primary>
65728 <secondary>incoming proxy address</secondary>
65729 </indexterm>
65730 <indexterm role="concept">
65731 <primary>proxy</primary>
65732 <secondary>logging proxy address</secondary>
65733 </indexterm>
65734 <indexterm role="concept">
65735 <primary>TCP/IP</primary>
65736 <secondary>logging proxy address</secondary>
65737 </indexterm>
65738 <option>proxy</option>: The internal (closest to the system running Exim) IP address
65739 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
65740 on a proxied connection
65741 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
65742 See <xref linkend="SECTproxyInbound"/> for more information.
65743 </para>
65744 </listitem>
65745 <listitem>
65746 <para>
65747 <indexterm role="concept">
65748 <primary>log</primary>
65749 <secondary>incoming remote port</secondary>
65750 </indexterm>
65751 <indexterm role="concept">
65752 <primary>port</primary>
65753 <secondary>logging remote</secondary>
65754 </indexterm>
65755 <indexterm role="concept">
65756 <primary>TCP/IP</primary>
65757 <secondary>logging incoming remote port</secondary>
65758 </indexterm>
65759 <indexterm role="variable">
65760 <primary><varname>$sender_fullhost</varname></primary>
65761 </indexterm>
65762 <indexterm role="variable">
65763 <primary><varname>$sender_rcvhost</varname></primary>
65764 </indexterm>
65765 <option>incoming_port</option>: The remote port number from which a message was received is
65766 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
65767 in square brackets, and separated from it by a colon. This is implemented by
65768 changing the value that is put in the <varname>$sender_fullhost</varname> and
65769 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
65770 important with the widening use of NAT (see RFC 2505).
65771 </para>
65772 </listitem>
65773 <listitem>
65774 <para>
65775 <indexterm role="concept">
65776 <primary>log</primary>
65777 <secondary>dropped connection</secondary>
65778 </indexterm>
65779 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
65780 connection is unexpectedly dropped.
65781 </para>
65782 </listitem>
65783 <listitem>
65784 <para>
65785 <indexterm role="concept">
65786 <primary>log</primary>
65787 <secondary>outgoing interface</secondary>
65788 </indexterm>
65789 <indexterm role="concept">
65790 <primary>log</primary>
65791 <secondary>local interface</secondary>
65792 </indexterm>
65793 <indexterm role="concept">
65794 <primary>log</primary>
65795 <secondary>local address and port</secondary>
65796 </indexterm>
65797 <indexterm role="concept">
65798 <primary>TCP/IP</primary>
65799 <secondary>logging local address and port</secondary>
65800 </indexterm>
65801 <indexterm role="concept">
65802 <primary>interface</primary>
65803 <secondary>logging</secondary>
65804 </indexterm>
65805 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
65806 interface on which a message was sent is added to delivery lines as an I= tag
65807 followed by IP address in square brackets. You can disable this by turning
65808 off the <option>outgoing_interface</option> option.
65809 </para>
65810 </listitem>
65811 <listitem>
65812 <para>
65813 <indexterm role="concept">
65814 <primary>log</primary>
65815 <secondary>outgoing remote port</secondary>
65816 </indexterm>
65817 <indexterm role="concept">
65818 <primary>port</primary>
65819 <secondary>logging outgoint remote</secondary>
65820 </indexterm>
65821 <indexterm role="concept">
65822 <primary>TCP/IP</primary>
65823 <secondary>logging outgoing remote port</secondary>
65824 </indexterm>
65825 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
65826 containing =&gt; tags) following the IP address.
65827 The local port is also added if <option>incoming_interface</option> and
65828 <option>outgoing_interface</option> are both enabled.
65829 This option is not included in the default setting, because for most ordinary
65830 configurations, the remote port number is always 25 (the SMTP port), and the
65831 local port is a random ephemeral port.
65832 </para>
65833 </listitem>
65834 <listitem>
65835 <para>
65836 <indexterm role="concept">
65837 <primary>log</primary>
65838 <secondary>process ids in</secondary>
65839 </indexterm>
65840 <indexterm role="concept">
65841 <primary>pid (process id)</primary>
65842 <secondary>in log lines</secondary>
65843 </indexterm>
65844 <option>pid</option>: The current process id is added to every log line, in square brackets,
65845 immediately after the time and date.
65846 </para>
65847 </listitem>
65848 <listitem>
65849 <para>
65850 <indexterm role="concept">
65851 <primary>log</primary>
65852 <secondary>queue run</secondary>
65853 </indexterm>
65854 <indexterm role="concept">
65855 <primary>queue runner</primary>
65856 <secondary>logging</secondary>
65857 </indexterm>
65858 <option>queue_run</option>: The start and end of every queue run are logged.
65859 </para>
65860 </listitem>
65861 <listitem>
65862 <para>
65863 <indexterm role="concept">
65864 <primary>log</primary>
65865 <secondary>queue time</secondary>
65866 </indexterm>
65867 <option>queue_time</option>: The amount of time the message has been in the queue on the
65868 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
65869 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
65870 includes reception time as well as the delivery time for the current address.
65871 This means that it may be longer than the difference between the arrival and
65872 delivery log line times, because the arrival log line is not written until the
65873 message has been successfully received.
65874 </para>
65875 </listitem>
65876 <listitem>
65877 <para>
65878 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
65879 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
65880 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
65881 message, so it includes reception time as well as the total delivery time.
65882 </para>
65883 </listitem>
65884 <listitem>
65885 <para>
65886 <indexterm role="concept">
65887 <primary>log</primary>
65888 <secondary>recipients</secondary>
65889 </indexterm>
65890 <option>received_recipients</option>: The recipients of a message are listed in the main log
65891 as soon as the message is received. The list appears at the end of the log line
65892 that is written when a message is received, preceded by the word <quote>for</quote>. The
65893 addresses are listed after they have been qualified, but before any rewriting
65894 has taken place.
65895 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
65896 in the list.
65897 </para>
65898 </listitem>
65899 <listitem>
65900 <para>
65901 <indexterm role="concept">
65902 <primary>log</primary>
65903 <secondary>sender reception</secondary>
65904 </indexterm>
65905 <option>received_sender</option>: The unrewritten original sender of a message is added to
65906 the end of the log line that records the message&#x2019;s arrival, after the word
65907 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
65908 </para>
65909 </listitem>
65910 <listitem>
65911 <para>
65912 <indexterm role="concept">
65913 <primary>log</primary>
65914 <secondary>header lines for rejection</secondary>
65915 </indexterm>
65916 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
65917 rejection is written to the reject log, the complete header is added to the
65918 log. Header logging can be turned off individually for messages that are
65919 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
65920 </para>
65921 </listitem>
65922 <listitem>
65923 <para>
65924 <indexterm role="concept">
65925 <primary>log</primary>
65926 <secondary>retry defer</secondary>
65927 </indexterm>
65928 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
65929 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
65930 message is always omitted from individual message logs after the first delivery
65931 attempt.
65932 </para>
65933 </listitem>
65934 <listitem>
65935 <para>
65936 <indexterm role="concept">
65937 <primary>log</primary>
65938 <secondary>return path</secondary>
65939 </indexterm>
65940 <option>return_path_on_delivery</option>: The return path that is being transmitted with
65941 the message is included in delivery and bounce lines, using the tag P=.
65942 This is omitted if no delivery actually happens, for example, if routing fails,
65943 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
65944 </para>
65945 </listitem>
65946 <listitem>
65947 <para>
65948 <indexterm role="concept">
65949 <primary>log</primary>
65950 <secondary>sender on delivery</secondary>
65951 </indexterm>
65952 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
65953 and bounce line, tagged by F= (for <quote>from</quote>).
65954 This is the original sender that was received with the message; it is not
65955 necessarily the same as the outgoing return path.
65956 </para>
65957 </listitem>
65958 <listitem>
65959 <para>
65960 <indexterm role="concept">
65961 <primary>log</primary>
65962 <secondary>sender verify failure</secondary>
65963 </indexterm>
65964 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
65965 gives details of a sender verification failure is not written. Log lines for
65966 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
65967 detail is lost.
65968 </para>
65969 </listitem>
65970 <listitem>
65971 <para>
65972 <indexterm role="concept">
65973 <primary>log</primary>
65974 <secondary>size rejection</secondary>
65975 </indexterm>
65976 <option>size_reject</option>: A log line is written whenever a message is rejected because
65977 it is too big.
65978 </para>
65979 </listitem>
65980 <listitem>
65981 <para>
65982 <indexterm role="concept">
65983 <primary>log</primary>
65984 <secondary>frozen messages; skipped</secondary>
65985 </indexterm>
65986 <indexterm role="concept">
65987 <primary>frozen messages</primary>
65988 <secondary>logging skipping</secondary>
65989 </indexterm>
65990 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
65991 queue run because it is frozen or because another process is already delivering
65992 it.
65993 <indexterm role="concept">
65994 <primary><quote>spool file is locked</quote></primary>
65995 </indexterm>
65996 The message that is written is <quote>spool file is locked</quote>.
65997 </para>
65998 </listitem>
65999 <listitem>
66000 <para>
66001 <indexterm role="concept">
66002 <primary>log</primary>
66003 <secondary>smtp confirmation</secondary>
66004 </indexterm>
66005 <indexterm role="concept">
66006 <primary>SMTP</primary>
66007 <secondary>logging confirmation</secondary>
66008 </indexterm>
66009 <indexterm role="concept">
66010 <primary>LMTP</primary>
66011 <secondary>logging confirmation</secondary>
66012 </indexterm>
66013 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
66014 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
66015 A number of MTAs (including Exim) return an identifying string in this
66016 response.
66017 </para>
66018 </listitem>
66019 <listitem>
66020 <para>
66021 <indexterm role="concept">
66022 <primary>log</primary>
66023 <secondary>SMTP connections</secondary>
66024 </indexterm>
66025 <indexterm role="concept">
66026 <primary>SMTP</primary>
66027 <secondary>logging connections</secondary>
66028 </indexterm>
66029 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
66030 established or closed, unless the connection is from a host that matches
66031 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
66032 only when the closure is unexpected.) This applies to connections from local
66033 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
66034 dropped in the middle of a message, a log line is always written, whether or
66035 not this selector is set, but otherwise nothing is written at the start and end
66036 of connections unless this selector is enabled.
66037 </para>
66038 <para>
66039 For TCP/IP connections to an Exim daemon, the current number of connections is
66040 included in the log message for each new connection, but note that the count is
66041 reset if the daemon is restarted.
66042 Also, because connections are closed (and the closure is logged) in
66043 subprocesses, the count may not include connections that have been closed but
66044 whose termination the daemon has not yet noticed. Thus, while it is possible to
66045 match up the opening and closing of connections in the log, the value of the
66046 logged counts may not be entirely accurate.
66047 </para>
66048 </listitem>
66049 <listitem>
66050 <para>
66051 <indexterm role="concept">
66052 <primary>log</primary>
66053 <secondary>SMTP transaction; incomplete</secondary>
66054 </indexterm>
66055 <indexterm role="concept">
66056 <primary>SMTP</primary>
66057 <secondary>logging incomplete transactions</secondary>
66058 </indexterm>
66059 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
66060 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
66061 and the message sender plus any accepted recipients are included in the log
66062 line. This can provide evidence of dictionary attacks.
66063 </para>
66064 </listitem>
66065 <listitem>
66066 <para>
66067 <indexterm role="concept">
66068 <primary>log</primary>
66069 <secondary>non-MAIL SMTP sessions</secondary>
66070 </indexterm>
66071 <indexterm role="concept">
66072 <primary>MAIL</primary>
66073 <secondary>logging session without</secondary>
66074 </indexterm>
66075 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
66076 connection terminates without having issued a MAIL command. This includes both
66077 the case when the connection is dropped, and the case when QUIT is used. It
66078 does not include cases where the connection is rejected right at the start (by
66079 an ACL, or because there are too many connections, or whatever). These cases
66080 already have their own log lines.
66081 </para>
66082 <para>
66083 The log line that is written contains the identity of the client in the usual
66084 way, followed by D= and a time, which records the duration of the connection.
66085 If the connection was authenticated, this fact is logged exactly as it is for
66086 an incoming message, with an A= item. If the connection was encrypted, CV=,
66087 DN=, and X= items may appear as they do for an incoming message, controlled by
66088 the same logging options.
66089 </para>
66090 <para>
66091 Finally, if any SMTP commands were issued during the connection, a C= item
66092 is added to the line, listing the commands that were used. For example,
66093 </para>
66094 <literallayout class="monospaced">
66095 C=EHLO,QUIT
66096 </literallayout>
66097 <para>
66098 shows that the client issued QUIT straight after EHLO. If there were fewer
66099 than 20 commands, they are all listed. If there were more than 20 commands,
66100 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
66101 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
66102 have been aborted before 20 non-mail commands are processed.
66103 </para>
66104 </listitem>
66105 <listitem>
66106 <para>
66107 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
66108 colon-separated, is appended to the A= item for a message arrival or delivery
66109 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
66110 was accepted or used.
66111 </para>
66112 </listitem>
66113 <listitem>
66114 <para>
66115 <indexterm role="concept">
66116 <primary>log</primary>
66117 <secondary>SMTP protocol error</secondary>
66118 </indexterm>
66119 <indexterm role="concept">
66120 <primary>SMTP</primary>
66121 <secondary>logging protocol error</secondary>
66122 </indexterm>
66123 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
66124 encountered. Exim does not have perfect detection of all protocol errors
66125 because of transmission delays and the use of pipelining. If PIPELINING has
66126 been advertised to a client, an Exim server assumes that the client will use
66127 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
66128 received after rejecting MAIL) as protocol errors.
66129 </para>
66130 </listitem>
66131 <listitem>
66132 <para>
66133 <indexterm role="concept">
66134 <primary>SMTP</primary>
66135 <secondary>logging syntax errors</secondary>
66136 </indexterm>
66137 <indexterm role="concept">
66138 <primary>SMTP</primary>
66139 <secondary>syntax errors; logging</secondary>
66140 </indexterm>
66141 <indexterm role="concept">
66142 <primary>SMTP</primary>
66143 <secondary>unknown command; logging</secondary>
66144 </indexterm>
66145 <indexterm role="concept">
66146 <primary>log</primary>
66147 <secondary>unknown SMTP command</secondary>
66148 </indexterm>
66149 <indexterm role="concept">
66150 <primary>log</primary>
66151 <secondary>SMTP syntax error</secondary>
66152 </indexterm>
66153 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
66154 encountered. An unrecognized command is treated as a syntax error. For an
66155 external connection, the host identity is given; for an internal connection
66156 using <option>-bs</option> the sender identification (normally the calling user) is given.
66157 </para>
66158 </listitem>
66159 <listitem>
66160 <para>
66161 <indexterm role="concept">
66162 <primary>log</primary>
66163 <secondary>subject</secondary>
66164 </indexterm>
66165 <indexterm role="concept">
66166 <primary>subject, logging</primary>
66167 </indexterm>
66168 <option>subject</option>: The subject of the message is added to the arrival log line,
66169 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
66170 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
66171 specifies whether characters with values greater than 127 should be logged
66172 unchanged, or whether they should be rendered as escape sequences.
66173 </para>
66174 </listitem>
66175 <listitem>
66176 <para>
66177 <indexterm role="concept">
66178 <primary>log</primary>
66179 <secondary>certificate verification</secondary>
66180 </indexterm>
66181 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
66182 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
66183 verified, and <literal>CV=no</literal> if not.
66184 </para>
66185 </listitem>
66186 <listitem>
66187 <para>
66188 <indexterm role="concept">
66189 <primary>log</primary>
66190 <secondary>TLS cipher</secondary>
66191 </indexterm>
66192 <indexterm role="concept">
66193 <primary>TLS</primary>
66194 <secondary>logging cipher</secondary>
66195 </indexterm>
66196 <option>tls_cipher</option>: When a message is sent or received over an encrypted
66197 connection, the cipher suite used is added to the log line, preceded by X=.
66198 </para>
66199 </listitem>
66200 <listitem>
66201 <para>
66202 <indexterm role="concept">
66203 <primary>log</primary>
66204 <secondary>TLS peer DN</secondary>
66205 </indexterm>
66206 <indexterm role="concept">
66207 <primary>TLS</primary>
66208 <secondary>logging peer DN</secondary>
66209 </indexterm>
66210 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
66211 connection, and a certificate is supplied by the remote host, the peer DN is
66212 added to the log line, preceded by DN=.
66213 </para>
66214 </listitem>
66215 <listitem>
66216 <para>
66217 <indexterm role="concept">
66218 <primary>log</primary>
66219 <secondary>TLS SNI</secondary>
66220 </indexterm>
66221 <indexterm role="concept">
66222 <primary>TLS</primary>
66223 <secondary>logging SNI</secondary>
66224 </indexterm>
66225 <option>tls_sni</option>: When a message is received over an encrypted connection, and
66226 the remote host provided the Server Name Indication extension, the SNI is
66227 added to the log line, preceded by SNI=.
66228 </para>
66229 </listitem>
66230 <listitem>
66231 <para>
66232 <indexterm role="concept">
66233 <primary>log</primary>
66234 <secondary>DNS failure in list</secondary>
66235 </indexterm>
66236 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
66237 result of a list match is failure because a DNS lookup failed.
66238 </para>
66239 </listitem>
66240 </itemizedlist>
66241 </section>
66242 <section id="SECID260">
66243 <title>Message log</title>
66244 <para>
66245 <indexterm role="concept">
66246 <primary>message</primary>
66247 <secondary>log file for</secondary>
66248 </indexterm>
66249 <indexterm role="concept">
66250 <primary>log</primary>
66251 <secondary>message log; description of</secondary>
66252 </indexterm>
66253 <indexterm role="concept">
66254 <primary><filename>msglog</filename> directory</primary>
66255 </indexterm>
66256 <indexterm role="option">
66257 <primary><option>preserve_message_logs</option></primary>
66258 </indexterm>
66259 In addition to the general log files, Exim writes a log file for each message
66260 that it handles. The names of these per-message logs are the message ids, and
66261 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
66262 message log contains copies of the log lines that apply to the message. This
66263 makes it easier to inspect the status of an individual message without having
66264 to search the main log. A message log is deleted when processing of the message
66265 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
66266 only with great care because they can fill up your disk very quickly.
66267 </para>
66268 <para>
66269 On a heavily loaded system, it may be desirable to disable the use of
66270 per-message logs, in order to reduce disk I/O. This can be done by setting the
66271 <option>message_logs</option> option false.
66272 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
66273 </para>
66274 </section>
66275 </chapter>
66276
66277 <chapter id="CHAPutils">
66278 <title>Exim utilities</title>
66279 <para>
66280 <indexterm role="concept" id="IIDutils" class="startofrange">
66281 <primary>utilities</primary>
66282 </indexterm>
66283 A number of utility scripts and programs are supplied with Exim and are
66284 described in this chapter. There is also the Exim Monitor, which is covered in
66285 the next chapter. The utilities described here are:
66286 </para>
66287 <informaltable frame="none">
66288 <tgroup cols="3" colsep="0" rowsep="0">
66289 <colspec colwidth="7*" align="left"/>
66290 <colspec colwidth="15*" align="left"/>
66291 <colspec colwidth="40*" align="left"/>
66292 <tbody>
66293 <row>
66294 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
66295 <entry><emphasis>exiwhat</emphasis></entry>
66296 <entry>list what Exim processes are doing</entry>
66297 </row>
66298 <row>
66299 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
66300 <entry><emphasis>exiqgrep</emphasis></entry>
66301 <entry>grep the queue</entry>
66302 </row>
66303 <row>
66304 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
66305 <entry><emphasis>exiqsumm</emphasis></entry>
66306 <entry>summarize the queue</entry>
66307 </row>
66308 <row>
66309 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
66310 <entry><emphasis>exigrep</emphasis></entry>
66311 <entry>search the main log</entry>
66312 </row>
66313 <row>
66314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
66315 <entry><emphasis>exipick</emphasis></entry>
66316 <entry>select messages on various criteria</entry>
66317 </row>
66318 <row>
66319 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
66320 <entry><emphasis>exicyclog</emphasis></entry>
66321 <entry>cycle (rotate) log files</entry>
66322 </row>
66323 <row>
66324 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
66325 <entry><emphasis>eximstats</emphasis></entry>
66326 <entry>extract statistics from the log</entry>
66327 </row>
66328 <row>
66329 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
66330 <entry><emphasis>exim_checkaccess</emphasis></entry>
66331 <entry>check address acceptance from given IP</entry>
66332 </row>
66333 <row>
66334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
66335 <entry><emphasis>exim_dbmbuild</emphasis></entry>
66336 <entry>build a DBM file</entry>
66337 </row>
66338 <row>
66339 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
66340 <entry><emphasis>exinext</emphasis></entry>
66341 <entry>extract retry information</entry>
66342 </row>
66343 <row>
66344 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66345 <entry><emphasis>exim_dumpdb</emphasis></entry>
66346 <entry>dump a hints database</entry>
66347 </row>
66348 <row>
66349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66350 <entry><emphasis>exim_tidydb</emphasis></entry>
66351 <entry>clean up a hints database</entry>
66352 </row>
66353 <row>
66354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66355 <entry><emphasis>exim_fixdb</emphasis></entry>
66356 <entry>patch a hints database</entry>
66357 </row>
66358 <row>
66359 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
66360 <entry><emphasis>exim_lock</emphasis></entry>
66361 <entry>lock a mailbox file</entry>
66362 </row>
66363 </tbody>
66364 </tgroup>
66365 </informaltable>
66366 <para>
66367 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
66368 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
66369 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
66370 </para>
66371 <section id="SECTfinoutwha">
66372 <title>Finding out what Exim processes are doing (exiwhat)</title>
66373 <para>
66374 <indexterm role="concept">
66375 <primary><emphasis>exiwhat</emphasis></primary>
66376 </indexterm>
66377 <indexterm role="concept">
66378 <primary>process, querying</primary>
66379 </indexterm>
66380 <indexterm role="concept">
66381 <primary>SIGUSR1</primary>
66382 </indexterm>
66383 On operating systems that can restart a system call after receiving a signal
66384 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
66385 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
66386 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
66387 processes it can find, having first emptied the file. It then waits for one
66388 second to allow the Exim processes to react before displaying the results. In
66389 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
66390 send the signal to the Exim processes, so it is normally run as root.
66391 </para>
66392 <para>
66393 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
66394 use by system administrators. It is not sensible, for example, to set up a
66395 script that sends SIGUSR1 signals to Exim processes at short intervals.
66396 </para>
66397 <para>
66398 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
66399 varies in different operating systems. Not only are different options used,
66400 but the format of the output is different. For this reason, there are some
66401 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
66402 it doesn&#x2019;t seem to be working for you, check the following compile-time
66403 options:
66404 </para>
66405 <literallayout>
66406 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
66407 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
66408 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
66409 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
66410 </literallayout>
66411 <para>
66412 An example of typical output from <emphasis>exiwhat</emphasis> is
66413 </para>
66414 <literallayout class="monospaced">
66415 164 daemon: -q1h, listening on port 25
66416 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
66417 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
66418   [10.19.42.42] (editor@ref.example)
66419 10592 handling incoming call from [192.168.243.242]
66420 10628 accepting a local non-SMTP message
66421 </literallayout>
66422 <para>
66423 The first number in the output line is the process number. The third line has
66424 been split here, in order to fit it on the page.
66425 </para>
66426 </section>
66427 <section id="SECTgreptheque">
66428 <title>Selective queue listing (exiqgrep)</title>
66429 <para>
66430 <indexterm role="concept">
66431 <primary><emphasis>exiqgrep</emphasis></primary>
66432 </indexterm>
66433 <indexterm role="concept">
66434 <primary>queue</primary>
66435 <secondary>grepping</secondary>
66436 </indexterm>
66437 This utility is a Perl script contributed by Matt Hubbard. It runs
66438 </para>
66439 <literallayout class="monospaced">
66440 exim -bpu
66441 </literallayout>
66442 <para>
66443 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
66444 </para>
66445 <literallayout class="monospaced">
66446 exim -bp
66447 </literallayout>
66448 <para>
66449 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
66450 contain alternate exim configuration the queue management might be using.
66451 </para>
66452 <para>
66453 to obtain a queue listing, and then greps the output to select messages
66454 that match given criteria. The following selection options are available:
66455 </para>
66456 <variablelist>
66457 <varlistentry>
66458 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66459 <listitem>
66460 <para>
66461 Match the sender address using a case-insensitive search. The field that is
66462 tested is enclosed in angle brackets, so you can test for bounce messages with
66463 </para>
66464 <literallayout class="monospaced">
66465 exiqgrep -f '^&lt;&gt;$'
66466 </literallayout>
66467 </listitem></varlistentry>
66468 <varlistentry>
66469 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66470 <listitem>
66471 <para>
66472 Match a recipient address using a case-insensitive search. The field that is
66473 tested is not enclosed in angle brackets.
66474 </para>
66475 </listitem></varlistentry>
66476 <varlistentry>
66477 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66478 <listitem>
66479 <para>
66480 Match against the size field.
66481 </para>
66482 </listitem></varlistentry>
66483 <varlistentry>
66484 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
66485 <listitem>
66486 <para>
66487 Match messages that are younger than the given time.
66488 </para>
66489 </listitem></varlistentry>
66490 <varlistentry>
66491 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
66492 <listitem>
66493 <para>
66494 Match messages that are older than the given time.
66495 </para>
66496 </listitem></varlistentry>
66497 <varlistentry>
66498 <term><emphasis role="bold">-z</emphasis></term>
66499 <listitem>
66500 <para>
66501 Match only frozen messages.
66502 </para>
66503 </listitem></varlistentry>
66504 <varlistentry>
66505 <term><emphasis role="bold">-x</emphasis></term>
66506 <listitem>
66507 <para>
66508 Match only non-frozen messages.
66509 </para>
66510 </listitem></varlistentry>
66511 </variablelist>
66512 <para>
66513 The following options control the format of the output:
66514 </para>
66515 <variablelist>
66516 <varlistentry>
66517 <term><emphasis role="bold">-c</emphasis></term>
66518 <listitem>
66519 <para>
66520 Display only the count of matching messages.
66521 </para>
66522 </listitem></varlistentry>
66523 <varlistentry>
66524 <term><emphasis role="bold">-l</emphasis></term>
66525 <listitem>
66526 <para>
66527 Long format &ndash; display the full message information as output by Exim. This is
66528 the default.
66529 </para>
66530 </listitem></varlistentry>
66531 <varlistentry>
66532 <term><emphasis role="bold">-i</emphasis></term>
66533 <listitem>
66534 <para>
66535 Display message ids only.
66536 </para>
66537 </listitem></varlistentry>
66538 <varlistentry>
66539 <term><emphasis role="bold">-b</emphasis></term>
66540 <listitem>
66541 <para>
66542 Brief format &ndash; one line per message.
66543 </para>
66544 </listitem></varlistentry>
66545 <varlistentry>
66546 <term><emphasis role="bold">-R</emphasis></term>
66547 <listitem>
66548 <para>
66549 Display messages in reverse order.
66550 </para>
66551 </listitem></varlistentry>
66552 <varlistentry>
66553 <term><emphasis role="bold">-a</emphasis></term>
66554 <listitem>
66555 <para>
66556 Include delivered recipients in queue listing.
66557 </para>
66558 </listitem></varlistentry>
66559 </variablelist>
66560 <para>
66561 There is one more option, <option>-h</option>, which outputs a list of options.
66562 </para>
66563 </section>
66564 <section id="SECTsumtheque">
66565 <title>Summarizing the queue (exiqsumm)</title>
66566 <para>
66567 <indexterm role="concept">
66568 <primary><emphasis>exiqsumm</emphasis></primary>
66569 </indexterm>
66570 <indexterm role="concept">
66571 <primary>queue</primary>
66572 <secondary>summary</secondary>
66573 </indexterm>
66574 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
66575 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
66576 running a command such as
66577 </para>
66578 <literallayout class="monospaced">
66579 exim -bp | exiqsumm
66580 </literallayout>
66581 <para>
66582 The output consists of one line for each domain that has messages waiting for
66583 it, as in the following example:
66584 </para>
66585 <literallayout class="monospaced">
66586 3   2322   74m   66m  msn.com.example
66587 </literallayout>
66588 <para>
66589 Each line lists the number of pending deliveries for a domain, their total
66590 volume, and the length of time that the oldest and the newest messages have
66591 been waiting. Note that the number of pending deliveries is greater than the
66592 number of messages when messages have more than one recipient.
66593 </para>
66594 <para>
66595 A summary line is output at the end. By default the output is sorted on the
66596 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
66597 the output to be sorted by oldest message and by count of messages,
66598 respectively. There are also three options that split the messages for each
66599 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
66600 separates frozen messages, and <option>-s</option> separates messages according to their
66601 sender.
66602 </para>
66603 <para>
66604 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
66605 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
66606 generated by aliasing or forwarding are included (unless the <option>one_time</option>
66607 option of the <command>redirect</command> router has been used to convert them into <quote>top
66608 level</quote> addresses).
66609 </para>
66610 </section>
66611 <section id="SECTextspeinf">
66612 <title>Extracting specific information from the log (exigrep)</title>
66613 <para>
66614 <indexterm role="concept">
66615 <primary><emphasis>exigrep</emphasis></primary>
66616 </indexterm>
66617 <indexterm role="concept">
66618 <primary>log</primary>
66619 <secondary>extracts; grepping for</secondary>
66620 </indexterm>
66621 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
66622 files for entries that match a given pattern. When it finds a match, it
66623 extracts all the log entries for the relevant message, not just those that
66624 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
66625 given message, or all mail for a given user, or for a given host, for example.
66626 The input files can be in Exim log format or syslog format.
66627 If a matching log line is not associated with a specific message, it is
66628 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
66629 </para>
66630 <literallayout>
66631 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-M] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
66632 </literallayout>
66633 <para>
66634 If no log file names are given on the command line, the standard input is read.
66635 </para>
66636 <para>
66637 The <option>-t</option> argument specifies a number of seconds. It adds an additional
66638 condition for message selection. Messages that are complete are shown only if
66639 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
66640 </para>
66641 <para>
66642 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
66643 makes it case-sensitive. This may give a performance improvement when searching
66644 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
66645 option; with <option>-I</option> they do not. In both cases it is possible to change the
66646 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
66647 </para>
66648 <para>
66649 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
66650 pattern as standing for themselves. Otherwise the pattern must be a Perl
66651 regular expression.
66652 </para>
66653 <para>
66654 The <option>-v</option> option inverts the matching condition. That is, a line is selected
66655 if it does <emphasis>not</emphasis> match the pattern.
66656 </para>
66657 <para>
66658 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
66659 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
66660 normally.
66661 </para>
66662 <para>
66663 Example of <option>-M</option>:
66664 user_a sends a message to user_b, which generates a bounce back to user_b. If
66665 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
66666 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
66667 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
66668 when searching for <quote>user_a</quote> will show both messages since the bounce is
66669 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
66670 search term.
66671 </para>
66672 <para>
66673 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
66674 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
66675 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
66676 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
66677 autodetection of some well known compression extensions.
66678 </para>
66679 </section>
66680 <section id="SECTexipick">
66681 <title>Selecting messages by various criteria (exipick)</title>
66682 <para>
66683 <indexterm role="concept">
66684 <primary><emphasis>exipick</emphasis></primary>
66685 </indexterm>
66686 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
66687 lists messages from the queue according to a variety of criteria. For details
66688 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
66689 <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run <emphasis>exipick</emphasis> with
66690 the <option>--help</option> option.
66691 </para>
66692 </section>
66693 <section id="SECTcyclogfil">
66694 <title>Cycling log files (exicyclog)</title>
66695 <para>
66696 <indexterm role="concept">
66697 <primary>log</primary>
66698 <secondary>cycling local files</secondary>
66699 </indexterm>
66700 <indexterm role="concept">
66701 <primary>cycling logs</primary>
66702 </indexterm>
66703 <indexterm role="concept">
66704 <primary><emphasis>exicyclog</emphasis></primary>
66705 </indexterm>
66706 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
66707 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
66708 you are using log files with datestamps in their names (see section
66709 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
66710 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
66711 There are two command line options for <emphasis>exicyclog</emphasis>:
66712 </para>
66713 <itemizedlist>
66714 <listitem>
66715 <para>
66716 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
66717 default that is set when Exim is built. The default default is 10.
66718 </para>
66719 </listitem>
66720 <listitem>
66721 <para>
66722 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
66723 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
66724 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
66725 configuration.
66726 </para>
66727 </listitem>
66728 </itemizedlist>
66729 <para>
66730 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
66731 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
66732 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
66733 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
66734 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
66735 logs are handled similarly.
66736 </para>
66737 <para>
66738 If the limit is greater than 99, the script uses 3-digit numbers such as
66739 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
66740 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
66741 any existing log files.
66742 </para>
66743 <para>
66744 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
66745 the end are deleted. All files with numbers greater than 01 are compressed,
66746 using a compression command which is configured by the COMPRESS_COMMAND
66747 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
66748 root <option>crontab</option> entry of the form
66749 </para>
66750 <literallayout class="monospaced">
66751 1 0 * * * su exim -c /usr/exim/bin/exicyclog
66752 </literallayout>
66753 <para>
66754 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
66755 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
66756 </para>
66757 </section>
66758 <section id="SECTmailstat">
66759 <title>Mail statistics (eximstats)</title>
66760 <para>
66761 <indexterm role="concept">
66762 <primary>statistics</primary>
66763 </indexterm>
66764 <indexterm role="concept">
66765 <primary><emphasis>eximstats</emphasis></primary>
66766 </indexterm>
66767 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
66768 information from log files. The output is either plain text, or HTML.
66769 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
66770 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
66771 </para>
66772 <para>
66773 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
66774 latest version is the result of some extensive revision by Steve Campbell. A
66775 lot of information is given by default, but there are options for suppressing
66776 various parts of it. Following any options, the arguments to the script are a
66777 list of files, which should be main log files. For example:
66778 </para>
66779 <literallayout class="monospaced">
66780 eximstats -nr /var/spool/exim/log/mainlog.01
66781 </literallayout>
66782 <para>
66783 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
66784 messages received from or delivered to various hosts. The information is sorted
66785 both by message count and by volume, and the top fifty hosts in each category
66786 are listed on the standard output. Similar information, based on email
66787 addresses or domains instead of hosts can be requested by means of various
66788 options. For messages delivered and received locally, similar statistics are
66789 also produced per user.
66790 </para>
66791 <para>
66792 The output also includes total counts and statistics about delivery errors, and
66793 histograms showing the number of messages received and deliveries made in each
66794 hour of the day. A delivery with more than one address in its envelope (for
66795 example, an SMTP transaction with more than one RCPT command) is counted
66796 as a single delivery by <emphasis>eximstats</emphasis>.
66797 </para>
66798 <para>
66799 Though normally more deliveries than receipts are reported (as messages may
66800 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
66801 messages received than delivered, even though the queue is empty at the start
66802 and end of the period in question. If an incoming message contains no valid
66803 recipients, no deliveries are recorded for it. A bounce message is handled as
66804 an entirely separate message.
66805 </para>
66806 <para>
66807 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
66808 of messages received and deliveries made, and the number of hosts involved in
66809 each case. It also outputs the number of messages that were delayed (that is,
66810 not completely delivered at the first attempt), and the number that had at
66811 least one address that failed.
66812 </para>
66813 <para>
66814 The remainder of the output is in sections that can be independently disabled
66815 or modified by various options. It consists of a summary of deliveries by
66816 transport, histograms of messages received and delivered per time interval
66817 (default per hour), information about the time messages spent on the queue,
66818 a list of relayed messages, lists of the top fifty sending hosts, local
66819 senders, destination hosts, and destination local users by count and by volume,
66820 and a list of delivery errors that occurred.
66821 </para>
66822 <para>
66823 The relay information lists messages that were actually relayed, that is, they
66824 came from a remote host and were directly delivered to some other remote host,
66825 without being processed (for example, for aliasing or forwarding) locally.
66826 </para>
66827 <para>
66828 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
66829 outputs. These are documented in the Perl script itself, and can be extracted
66830 by running the command <command>perldoc</command> on the script. For example:
66831 </para>
66832 <literallayout class="monospaced">
66833 perldoc /usr/exim/bin/eximstats
66834 </literallayout>
66835 </section>
66836 <section id="SECTcheckaccess">
66837 <title>Checking access policy (exim_checkaccess)</title>
66838 <para>
66839 <indexterm role="concept">
66840 <primary><emphasis>exim_checkaccess</emphasis></primary>
66841 </indexterm>
66842 <indexterm role="concept">
66843 <primary>policy control</primary>
66844 <secondary>checking access</secondary>
66845 </indexterm>
66846 <indexterm role="concept">
66847 <primary>checking access</primary>
66848 </indexterm>
66849 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
66850 debugging output, in order to check what Exim is doing when it is applying
66851 policy controls to incoming SMTP mail. However, not everybody is sufficiently
66852 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
66853 sometimes you just want to answer the question <quote>Does this address have
66854 access?</quote> without bothering with any further details.
66855 </para>
66856 <para>
66857 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
66858 two arguments, an IP address and an email address:
66859 </para>
66860 <literallayout class="monospaced">
66861 exim_checkaccess 10.9.8.7 A.User@a.domain.example
66862 </literallayout>
66863 <para>
66864 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
66865 given email address would be accepted in a RCPT command in a TCP/IP
66866 connection from the host with the given IP address. The output of the utility
66867 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
66868 </para>
66869 <literallayout class="monospaced">
66870 Rejected:
66871 550 Relay not permitted
66872 </literallayout>
66873 <para>
66874 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
66875 for the MAIL command, but you can change this by providing additional
66876 options. These are passed directly to the Exim command. For example, to specify
66877 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
66878 you can use:
66879 </para>
66880 <literallayout class="monospaced">
66881 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
66882                  -f himself@there.example
66883 </literallayout>
66884 <para>
66885 Note that these additional Exim command line items must be given after the two
66886 mandatory arguments.
66887 </para>
66888 <para>
66889 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
66890 while running its checks. You can run checks that include callouts by using
66891 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
66892 </para>
66893 </section>
66894 <section id="SECTdbmbuild">
66895 <title>Making DBM files (exim_dbmbuild)</title>
66896 <para>
66897 <indexterm role="concept">
66898 <primary>DBM</primary>
66899 <secondary>building dbm files</secondary>
66900 </indexterm>
66901 <indexterm role="concept">
66902 <primary>building DBM files</primary>
66903 </indexterm>
66904 <indexterm role="concept">
66905 <primary><emphasis>exim_dbmbuild</emphasis></primary>
66906 </indexterm>
66907 <indexterm role="concept">
66908 <primary>lower casing</primary>
66909 </indexterm>
66910 <indexterm role="concept">
66911 <primary>binary zero</primary>
66912 <secondary>in lookup key</secondary>
66913 </indexterm>
66914 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
66915 the format used by the <command>lsearch</command> lookup (see section
66916 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
66917 names as keys and the remainder of the information as data. The lower-casing
66918 can be prevented by calling the program with the <option>-nolc</option> option.
66919 </para>
66920 <para>
66921 A terminating zero is included as part of the key string. This is expected by
66922 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
66923 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
66924 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
66925 files.
66926 </para>
66927 <para>
66928 The program requires two arguments: the name of the input file (which can be a
66929 single hyphen to indicate the standard input), and the name of the output file.
66930 It creates the output under a temporary name, and then renames it if all went
66931 well.
66932 </para>
66933 <para>
66934 <indexterm role="concept">
66935 <primary>USE_DB</primary>
66936 </indexterm>
66937 If the native DB interface is in use (USE_DB is set in a compile-time
66938 configuration file &ndash; this is common in free versions of Unix) the two file
66939 names must be different, because in this mode the Berkeley DB functions create
66940 a single output file using exactly the name given. For example,
66941 </para>
66942 <literallayout class="monospaced">
66943 exim_dbmbuild /etc/aliases /etc/aliases.db
66944 </literallayout>
66945 <para>
66946 reads the system alias file and creates a DBM version of it in
66947 <filename>/etc/aliases.db</filename>.
66948 </para>
66949 <para>
66950 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
66951 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
66952 environment, the suffixes are added to the second argument of
66953 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
66954 when the Berkeley functions are used in compatibility mode (though this is not
66955 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
66956 </para>
66957 <para>
66958 If a duplicate key is encountered, the program outputs a warning, and when it
66959 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
66960 option is used. By default, only the first of a set of duplicates is used &ndash;
66961 this makes it compatible with <command>lsearch</command> lookups. There is an option
66962 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
66963 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
66964 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
66965 return code is 2.
66966 </para>
66967 </section>
66968 <section id="SECTfinindret">
66969 <title>Finding individual retry times (exinext)</title>
66970 <para>
66971 <indexterm role="concept">
66972 <primary>retry</primary>
66973 <secondary>times</secondary>
66974 </indexterm>
66975 <indexterm role="concept">
66976 <primary><emphasis>exinext</emphasis></primary>
66977 </indexterm>
66978 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
66979 fish specific information out of the retry database. Given a mail domain (or a
66980 complete address), it looks up the hosts for that domain, and outputs any retry
66981 information for the hosts or for the domain. At present, the retry information
66982 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
66983 output. For example:
66984 </para>
66985 <literallayout class="monospaced">
66986 $ exinext piglet@milne.fict.example
66987 kanga.milne.example:192.168.8.1 error 146: Connection refused
66988   first failed: 21-Feb-1996 14:57:34
66989   last tried:   21-Feb-1996 14:57:34
66990   next try at:  21-Feb-1996 15:02:34
66991 roo.milne.example:192.168.8.3 error 146: Connection refused
66992   first failed: 20-Jan-1996 13:12:08
66993   last tried:   21-Feb-1996 11:42:03
66994   next try at:  21-Feb-1996 19:42:03
66995   past final cutoff time
66996 </literallayout>
66997 <para>
66998 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
66999 will give any retry information for that local part in your default domain.
67000 A message id can be used to obtain retry information pertaining to a specific
67001 message. This exists only when an attempt to deliver a message to a remote host
67002 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
67003 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
67004 run very often.
67005 </para>
67006 <para>
67007 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
67008 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
67009 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
67010 configuration file, and the second sets macros for use within the configuration
67011 file. These features are mainly to help in testing, but might also be useful in
67012 environments where more than one configuration file is in use.
67013 </para>
67014 </section>
67015 <section id="SECThindatmai">
67016 <title>Hints database maintenance</title>
67017 <para>
67018 <indexterm role="concept">
67019 <primary>hints database</primary>
67020 <secondary>maintenance</secondary>
67021 </indexterm>
67022 <indexterm role="concept">
67023 <primary>maintaining Exim&#x2019;s hints database</primary>
67024 </indexterm>
67025 Three utility programs are provided for maintaining the DBM files that Exim
67026 uses to contain its delivery hint information. Each program requires two
67027 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
67028 second is the name of the database it is to operate on. These are as follows:
67029 </para>
67030 <itemizedlist>
67031 <listitem>
67032 <para>
67033 <emphasis>retry</emphasis>: the database of retry information
67034 </para>
67035 </listitem>
67036 <listitem>
67037 <para>
67038 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
67039 for remote hosts
67040 </para>
67041 </listitem>
67042 <listitem>
67043 <para>
67044 <emphasis>callout</emphasis>: the callout cache
67045 </para>
67046 </listitem>
67047 <listitem>
67048 <para>
67049 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
67050 </para>
67051 </listitem>
67052 <listitem>
67053 <para>
67054 <emphasis>misc</emphasis>: other hints data
67055 </para>
67056 </listitem>
67057 </itemizedlist>
67058 <para>
67059 The <emphasis>misc</emphasis> database is used for
67060 </para>
67061 <itemizedlist>
67062 <listitem>
67063 <para>
67064 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
67065 </para>
67066 </listitem>
67067 <listitem>
67068 <para>
67069 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
67070 <command>smtp</command> transport)
67071 </para>
67072 </listitem>
67073 <listitem>
67074 <para>
67075 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
67076 in a transport)
67077 </para>
67078 </listitem>
67079 </itemizedlist>
67080 </section>
67081 <section id="SECID261">
67082 <title>exim_dumpdb</title>
67083 <para>
67084 <indexterm role="concept">
67085 <primary><emphasis>exim_dumpdb</emphasis></primary>
67086 </indexterm>
67087 The entire contents of a database are written to the standard output by the
67088 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
67089 spool and database names. For example, to dump the retry database:
67090 </para>
67091 <literallayout class="monospaced">
67092 exim_dumpdb /var/spool/exim retry
67093 </literallayout>
67094 <para>
67095 Two lines of output are produced for each entry:
67096 </para>
67097 <literallayout class="monospaced">
67098 T:mail.ref.example:192.168.242.242 146 77 Connection refused
67099 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
67100 </literallayout>
67101 <para>
67102 The first item on the first line is the key of the record. It starts with one
67103 of the letters R, or T, depending on whether it refers to a routing or
67104 transport retry. For a local delivery, the next part is the local address; for
67105 a remote delivery it is the name of the remote host, followed by its failing IP
67106 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
67107 transport). If the remote port is not the standard one (port 25), it is added
67108 to the IP address. Then there follows an error code, an additional error code,
67109 and a textual description of the error.
67110 </para>
67111 <para>
67112 The three times on the second line are the time of first failure, the time of
67113 the last delivery attempt, and the computed time for the next attempt. The line
67114 ends with an asterisk if the cutoff time for the last retry rule has been
67115 exceeded.
67116 </para>
67117 <para>
67118 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
67119 consists of a host name followed by a list of ids for messages that are or were
67120 waiting to be delivered to that host. If there are a very large number for any
67121 one host, continuation records, with a sequence number added to the host name,
67122 may be seen. The data in these records is often out of date, because a message
67123 may be routed to several alternative hosts, and Exim makes no effort to keep
67124 cross-references.
67125 </para>
67126 </section>
67127 <section id="SECID262">
67128 <title>exim_tidydb</title>
67129 <para>
67130 <indexterm role="concept">
67131 <primary><emphasis>exim_tidydb</emphasis></primary>
67132 </indexterm>
67133 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
67134 database. If run with no options, it removes all records that are more than 30
67135 days old. The age is calculated from the date and time that the record was last
67136 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
67137 since the first delivery failure. Information about a host that has been down
67138 for more than 30 days will remain in the database, provided that the record is
67139 updated sufficiently often.
67140 </para>
67141 <para>
67142 The cutoff date can be altered by means of the <option>-t</option> option, which must be
67143 followed by a time. For example, to remove all records older than a week from
67144 the retry database:
67145 </para>
67146 <literallayout class="monospaced">
67147 exim_tidydb -t 7d /var/spool/exim retry
67148 </literallayout>
67149 <para>
67150 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
67151 message ids. In the former these appear as data in records keyed by host &ndash;
67152 they were messages that were waiting for that host &ndash; and in the latter they
67153 are the keys for retry information for messages that have suffered certain
67154 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
67155 message ids in database records are those of messages that are still on the
67156 queue. Message ids for messages that no longer exist are removed from
67157 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
67158 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
67159 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
67160 whenever it removes information from the database.
67161 </para>
67162 <para>
67163 Certain records are automatically removed by Exim when they are no longer
67164 needed, but others are not. For example, if all the MX hosts for a domain are
67165 down, a retry record is created for each one. If the primary MX host comes back
67166 first, its record is removed when Exim successfully delivers to it, but the
67167 records for the others remain because Exim has not tried to use those hosts.
67168 </para>
67169 <para>
67170 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
67171 hints databases. You should do this at a quiet time of day, because it requires
67172 a database to be locked (and therefore inaccessible to Exim) while it does its
67173 work. Removing records from a DBM file does not normally make the file smaller,
67174 but all the common DBM libraries are able to re-use the space that is released.
67175 After an initial phase of increasing in size, the databases normally reach a
67176 point at which they no longer get any bigger, as long as they are regularly
67177 tidied.
67178 </para>
67179 <para>
67180 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
67181 databases is likely to keep on increasing.
67182 </para>
67183 </section>
67184 <section id="SECID263">
67185 <title>exim_fixdb</title>
67186 <para>
67187 <indexterm role="concept">
67188 <primary><emphasis>exim_fixdb</emphasis></primary>
67189 </indexterm>
67190 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
67191 Its main use is for testing Exim, but it might also be occasionally useful for
67192 getting round problems in a live system. It has no options, and its interface
67193 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
67194 key of a database record can then be entered, and the data for that record is
67195 displayed.
67196 </para>
67197 <para>
67198 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
67199 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
67200 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
67201 data for individual fields can be changed by typing the field number followed
67202 by new data, for example:
67203 </para>
67204 <literallayout class="monospaced">
67205 &gt; 4 951102:1000
67206 </literallayout>
67207 <para>
67208 resets the time of the next delivery attempt. Time values are given as a
67209 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
67210 used as optional separators.
67211 </para>
67212 </section>
67213 <section id="SECTmailboxmaint">
67214 <title>Mailbox maintenance (exim_lock)</title>
67215 <para>
67216 <indexterm role="concept">
67217 <primary>mailbox</primary>
67218 <secondary>maintenance</secondary>
67219 </indexterm>
67220 <indexterm role="concept">
67221 <primary><emphasis>exim_lock</emphasis></primary>
67222 </indexterm>
67223 <indexterm role="concept">
67224 <primary>locking mailboxes</primary>
67225 </indexterm>
67226 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
67227 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
67228 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
67229 a user agent while investigating a problem. The utility requires the name of
67230 the file as its first argument. If the locking is successful, the second
67231 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
67232 second argument, the value of the SHELL environment variable is used; if this
67233 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
67234 is unlocked and the utility ends. The following options are available:
67235 </para>
67236 <variablelist>
67237 <varlistentry>
67238 <term><option>-fcntl</option></term>
67239 <listitem>
67240 <para>
67241 Use <function>fcntl()</function> locking on the open mailbox.
67242 </para>
67243 </listitem></varlistentry>
67244 <varlistentry>
67245 <term><option>-flock</option></term>
67246 <listitem>
67247 <para>
67248 Use <function>flock()</function> locking on the open mailbox, provided the operating system
67249 supports it.
67250 </para>
67251 </listitem></varlistentry>
67252 <varlistentry>
67253 <term><option>-interval</option></term>
67254 <listitem>
67255 <para>
67256 This must be followed by a number, which is a number of seconds; it sets the
67257 interval to sleep between retries (default 3).
67258 </para>
67259 </listitem></varlistentry>
67260 <varlistentry>
67261 <term><option>-lockfile</option></term>
67262 <listitem>
67263 <para>
67264 Create a lock file before opening the mailbox.
67265 </para>
67266 </listitem></varlistentry>
67267 <varlistentry>
67268 <term><option>-mbx</option></term>
67269 <listitem>
67270 <para>
67271 Lock the mailbox using MBX rules.
67272 </para>
67273 </listitem></varlistentry>
67274 <varlistentry>
67275 <term><option>-q</option></term>
67276 <listitem>
67277 <para>
67278 Suppress verification output.
67279 </para>
67280 </listitem></varlistentry>
67281 <varlistentry>
67282 <term><option>-retries</option></term>
67283 <listitem>
67284 <para>
67285 This must be followed by a number; it sets the number of times to try to get
67286 the lock (default 10).
67287 </para>
67288 </listitem></varlistentry>
67289 <varlistentry>
67290 <term><option>-restore_time</option></term>
67291 <listitem>
67292 <para>
67293 This option causes <option>exim_lock</option> to restore the modified and read times to the
67294 locked file before exiting. This allows you to access a locked mailbox (for
67295 example, to take a backup copy) without disturbing the times that the user
67296 subsequently sees.
67297 </para>
67298 </listitem></varlistentry>
67299 <varlistentry>
67300 <term><option>-timeout</option></term>
67301 <listitem>
67302 <para>
67303 This must be followed by a number, which is a number of seconds; it sets a
67304 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
67305 default), a non-blocking call is used.
67306 </para>
67307 </listitem></varlistentry>
67308 <varlistentry>
67309 <term><option>-v</option></term>
67310 <listitem>
67311 <para>
67312 Generate verbose output.
67313 </para>
67314 </listitem></varlistentry>
67315 </variablelist>
67316 <para>
67317 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
67318 default is to create a lock file and also to use <function>fcntl()</function> locking on the
67319 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
67320 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
67321 requires that the directory containing the file be writeable. Locking by lock
67322 file does not last for ever; Exim assumes that a lock file is expired if it is
67323 more than 30 minutes old.
67324 </para>
67325 <para>
67326 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
67327 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
67328 to be taken out on the open mailbox, and an exclusive lock on the file
67329 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
67330 number of the mailbox file. When the locking is released, if an exclusive lock
67331 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
67332 </para>
67333 <para>
67334 The default output contains verification of the locking that takes place. The
67335 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
67336 suppresses all output except error messages.
67337 </para>
67338 <para>
67339 A command such as
67340 </para>
67341 <literallayout class="monospaced">
67342 exim_lock /var/spool/mail/spqr
67343 </literallayout>
67344 <para>
67345 runs an interactive shell while the file is locked, whereas
67346 </para>
67347 <literallayout>
67348 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
67349 &lt;<emphasis>some commands</emphasis>&gt;
67350 <literal>End</literal>
67351 </literallayout>
67352 <para>
67353 runs a specific non-interactive sequence of commands while the file is locked,
67354 suppressing all verification output. A single command can be run by a command
67355 such as
67356 </para>
67357 <literallayout class="monospaced">
67358 exim_lock -q /var/spool/mail/spqr \
67359   "cp /var/spool/mail/spqr /some/where"
67360 </literallayout>
67361 <para>
67362 Note that if a command is supplied, it must be entirely contained within the
67363 second argument &ndash; hence the quotes.
67364 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
67365 </para>
67366 </section>
67367 </chapter>
67368
67369 <chapter id="CHAPeximon">
67370 <title>The Exim monitor</title>
67371 <para>
67372 <indexterm role="concept" id="IIDeximon" class="startofrange">
67373 <primary>Exim monitor</primary>
67374 <secondary>description</secondary>
67375 </indexterm>
67376 <indexterm role="concept">
67377 <primary>X-windows</primary>
67378 </indexterm>
67379 <indexterm role="concept">
67380 <primary><emphasis>eximon</emphasis></primary>
67381 </indexterm>
67382 <indexterm role="concept">
67383 <primary>Local/eximon.conf</primary>
67384 </indexterm>
67385 <indexterm role="concept">
67386 <primary><filename>exim_monitor/EDITME</filename></primary>
67387 </indexterm>
67388 The Exim monitor is an application which displays in an X window information
67389 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
67390 perform certain operations on messages from this GUI interface; however all
67391 such facilities are also available from the command line, and indeed, the
67392 monitor itself makes use of the command line to perform any actions requested.
67393 </para>
67394 <section id="SECID264">
67395 <title>Running the monitor</title>
67396 <para>
67397 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
67398 script that sets up a number of environment variables, and then runs the
67399 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
67400 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
67401 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
67402 parameters are for.
67403 </para>
67404 <para>
67405 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
67406 a particular invocation by setting up environment variables of the same names,
67407 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
67408 </para>
67409 <literallayout class="monospaced">
67410 EXIMON_LOG_DEPTH=400 eximon
67411 </literallayout>
67412 <para>
67413 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
67414 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
67415 overrides the Exim log file configuration. This makes it possible to have
67416 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
67417 syslog messages are routed to a file on the local host.
67418 </para>
67419 <para>
67420 X resources can be used to change the appearance of the window in the normal
67421 way. For example, a resource setting of the form
67422 </para>
67423 <literallayout class="monospaced">
67424 Eximon*background: gray94
67425 </literallayout>
67426 <para>
67427 changes the colour of the background to light grey rather than white. The
67428 stripcharts are drawn with both the data lines and the reference lines in
67429 black. This means that the reference lines are not visible when on top of the
67430 data. However, their colour can be changed by setting a resource called
67431 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
67432 For example, if your X server is running Unix, you could set up lighter
67433 reference lines in the stripcharts by obeying
67434 </para>
67435 <literallayout class="monospaced">
67436 xrdb -merge &lt;&lt;End
67437 Eximon*highlight: gray
67438 End
67439 </literallayout>
67440 <para>
67441 <indexterm role="concept">
67442 <primary>admin user</primary>
67443 </indexterm>
67444 In order to see the contents of messages on the queue, and to operate on them,
67445 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
67446 </para>
67447 <para>
67448 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
67449 contain X11 resource parameters interpreted by the X11 library.  In addition,
67450 if the first parameter starts with the string "gdb" then it is removed and the
67451 binary is invoked under gdb (the parameter is used as the gdb command-name, so
67452 versioned variants of gdb can be invoked).
67453 </para>
67454 <para>
67455 The monitor&#x2019;s window is divided into three parts. The first contains one or
67456 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
67457 main log file, and the third is a display of the queue of messages awaiting
67458 delivery, with two more action buttons. The following sections describe these
67459 different parts of the display.
67460 </para>
67461 </section>
67462 <section id="SECID265">
67463 <title>The stripcharts</title>
67464 <para>
67465 <indexterm role="concept">
67466 <primary>stripchart</primary>
67467 </indexterm>
67468 The first stripchart is always a count of messages on the queue. Its name can
67469 be configured by setting QUEUE_STRIPCHART_NAME in the
67470 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
67471 configuration script by regular expression matches on log file entries, making
67472 it possible to display, for example, counts of messages delivered to certain
67473 hosts or using certain transports. The supplied defaults display counts of
67474 received and delivered messages, and of local and SMTP deliveries. The default
67475 period between stripchart updates is one minute; this can be adjusted by a
67476 parameter in the <filename>Local/eximon.conf</filename> file.
67477 </para>
67478 <para>
67479 The stripchart displays rescale themselves automatically as the value they are
67480 displaying changes. There are always 10 horizontal lines in each chart; the
67481 title string indicates the value of each division when it is greater than one.
67482 For example, <quote>x2</quote> means that each division represents a value of 2.
67483 </para>
67484 <para>
67485 It is also possible to have a stripchart which shows the percentage fullness of
67486 a particular disk partition, which is useful when local deliveries are confined
67487 to a single partition.
67488 </para>
67489 <para>
67490 <indexterm role="concept">
67491 <primary><option>statvfs</option> function</primary>
67492 </indexterm>
67493 This relies on the availability of the <function>statvfs()</function> function or equivalent in
67494 the operating system. Most, but not all versions of Unix that support Exim have
67495 this. For this particular stripchart, the top of the chart always represents
67496 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
67497 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
67498 <filename>Local/eximon.conf</filename> file.
67499 </para>
67500 </section>
67501 <section id="SECID266">
67502 <title>Main action buttons</title>
67503 <para>
67504 <indexterm role="concept">
67505 <primary>size</primary>
67506 <secondary>of monitor window</secondary>
67507 </indexterm>
67508 <indexterm role="concept">
67509 <primary>Exim monitor</primary>
67510 <secondary>window size</secondary>
67511 </indexterm>
67512 <indexterm role="concept">
67513 <primary>window size</primary>
67514 </indexterm>
67515 Below the stripcharts there is an action button for quitting the monitor. Next
67516 to this is another button marked <quote>Size</quote>. They are placed here so that
67517 shrinking the window to its default minimum size leaves just the queue count
67518 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
67519 the window to expand to its maximum size, unless it is already at the maximum,
67520 in which case it is reduced to its minimum.
67521 </para>
67522 <para>
67523 When expanding to the maximum, if the window cannot be fully seen where it
67524 currently is, it is moved back to where it was the last time it was at full
67525 size. When it is expanding from its minimum size, the old position is
67526 remembered, and next time it is reduced to the minimum it is moved back there.
67527 </para>
67528 <para>
67529 The idea is that you can keep a reduced window just showing one or two
67530 stripcharts at a convenient place on your screen, easily expand it to show
67531 the full window when required, and just as easily put it back to what it was.
67532 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
67533 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
67534 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
67535 </para>
67536 <para>
67537 Normally, the monitor starts up with the window at its full size, but it can be
67538 built so that it starts up with the window at its smallest size, by setting
67539 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
67540 </para>
67541 </section>
67542 <section id="SECID267">
67543 <title>The log display</title>
67544 <para>
67545 <indexterm role="concept">
67546 <primary>log</primary>
67547 <secondary>tail of; in monitor</secondary>
67548 </indexterm>
67549 The second section of the window is an area in which a display of the tail of
67550 the main log is maintained.
67551 To save space on the screen, the timestamp on each log line is shortened by
67552 removing the date and, if <option>log_timezone</option> is set, the timezone.
67553 The log tail is not available when the only destination for logging data is
67554 syslog, unless the syslog lines are routed to a local file whose name is passed
67555 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
67556 </para>
67557 <para>
67558 The log sub-window has a scroll bar at its lefthand side which can be used to
67559 move back to look at earlier text, and the up and down arrow keys also have a
67560 scrolling effect. The amount of log that is kept depends on the setting of
67561 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
67562 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
67563 much more efficient than throwing it away line by line. The sub-window also has
67564 a horizontal scroll bar for accessing the ends of long log lines. This is the
67565 only means of horizontal scrolling; the right and left arrow keys are not
67566 available. Text can be cut from this part of the window using the mouse in the
67567 normal way. The size of this subwindow is controlled by parameters in the
67568 configuration file <filename>Local/eximon.conf</filename>.
67569 </para>
67570 <para>
67571 Searches of the text in the log window can be carried out by means of the ^R
67572 and ^S keystrokes, which default to a reverse and a forward search,
67573 respectively. The search covers only the text that is displayed in the window.
67574 It cannot go further back up the log.
67575 </para>
67576 <para>
67577 The point from which the search starts is indicated by a caret marker. This is
67578 normally at the end of the text in the window, but can be positioned explicitly
67579 by pointing and clicking with the left mouse button, and is moved automatically
67580 by a successful search. If new text arrives in the window when it is scrolled
67581 back, the caret remains where it is, but if the window is not scrolled back,
67582 the caret is moved to the end of the new text.
67583 </para>
67584 <para>
67585 Pressing ^R or ^S pops up a window into which the search text can be typed.
67586 There are buttons for selecting forward or reverse searching, for carrying out
67587 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
67588 happens and the window remains so that further searches can be done. If the
67589 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
67590 ^C is typed the search is cancelled.
67591 </para>
67592 <para>
67593 The searching facility is implemented using the facilities of the Athena text
67594 widget. By default this pops up a window containing both <quote>search</quote> and
67595 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
67596 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
67597 However, the linkers in BSDI and HP-UX seem unable to handle an externally
67598 provided version of <option>TextPop</option> when the remaining parts of the text widget
67599 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
67600 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
67601 on these systems, at the expense of having unwanted items in the search popup
67602 window.
67603 </para>
67604 </section>
67605 <section id="SECID268">
67606 <title>The queue display</title>
67607 <para>
67608 <indexterm role="concept">
67609 <primary>queue</primary>
67610 <secondary>display in monitor</secondary>
67611 </indexterm>
67612 The bottom section of the monitor window contains a list of all messages that
67613 are on the queue, which includes those currently being received or delivered,
67614 as well as those awaiting delivery. The size of this subwindow is controlled by
67615 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
67616 at which it is updated is controlled by another parameter in the same file &ndash;
67617 the default is 5 minutes, since queue scans can be quite expensive. However,
67618 there is an <quote>Update</quote> action button just above the display which can be used
67619 to force an update of the queue display at any time.
67620 </para>
67621 <para>
67622 When a host is down for some time, a lot of pending mail can build up for it,
67623 and this can make it hard to deal with other messages on the queue. To help
67624 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
67625 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
67626 type anything in here and press <quote>Return</quote>, the text is added to a chain of
67627 such texts, and if every undelivered address in a message matches at least one
67628 of the texts, the message is not displayed.
67629 </para>
67630 <para>
67631 If there is an address that does not match any of the texts, all the addresses
67632 are displayed as normal. The matching happens on the ends of addresses so, for
67633 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
67634 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
67635 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
67636 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
67637 a hide request is automatically cancelled after one hour.
67638 </para>
67639 <para>
67640 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
67641 else to the monitor window. For this reason, if you want to cut text from the
67642 queue display to use in the dialogue box, you have to do the cutting before
67643 pressing the <quote>Hide</quote> button.
67644 </para>
67645 <para>
67646 The queue display contains, for each unhidden queued message, the length of
67647 time it has been on the queue, the size of the message, the message id, the
67648 message sender, and the first undelivered recipient, all on one line. If it is
67649 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
67650 recipient to which the message has not yet been delivered, subsequent ones are
67651 listed on additional lines, up to a maximum configured number, following which
67652 an ellipsis is displayed. Recipients that have already received the message are
67653 not shown.
67654 </para>
67655 <para>
67656 <indexterm role="concept">
67657 <primary>frozen messages</primary>
67658 <secondary>display</secondary>
67659 </indexterm>
67660 If a message is frozen, an asterisk is displayed at the left-hand side.
67661 </para>
67662 <para>
67663 The queue display has a vertical scroll bar, and can also be scrolled by means
67664 of the arrow keys. Text can be cut from it using the mouse in the normal way.
67665 The text searching facilities, as described above for the log window, are also
67666 available, but the caret is always moved to the end of the text when the queue
67667 display is updated.
67668 </para>
67669 </section>
67670 <section id="SECID269">
67671 <title>The queue menu</title>
67672 <para>
67673 <indexterm role="concept">
67674 <primary>queue</primary>
67675 <secondary>menu in monitor</secondary>
67676 </indexterm>
67677 If the <option>shift</option> key is held down and the left button is clicked when the mouse
67678 pointer is over the text for any message, an action menu pops up, and the first
67679 line of the queue display for the message is highlighted. This does not affect
67680 any selected text.
67681 </para>
67682 <para>
67683 If you want to use some other event for popping up the menu, you can set the
67684 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
67685 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
67686 value set in this parameter is a standard X event description. For example, to
67687 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
67688 </para>
67689 <literallayout class="monospaced">
67690 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
67691 </literallayout>
67692 <para>
67693 The title of the menu is the message id, and it contains entries which act as
67694 follows:
67695 </para>
67696 <itemizedlist>
67697 <listitem>
67698 <para>
67699 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
67700 in a new text window.
67701 </para>
67702 </listitem>
67703 <listitem>
67704 <para>
67705 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
67706 information and headers is displayed in a new text window. See chapter
67707 <xref linkend="CHAPspool"/> for a description of the format of spool files.
67708 </para>
67709 </listitem>
67710 <listitem>
67711 <para>
67712 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
67713 displayed in a new text window. There is a default limit of 20,000 bytes to the
67714 amount of data displayed. This can be changed by setting the BODY_MAX
67715 option at compile time, or the EXIMON_BODY_MAX option at run time.
67716 </para>
67717 </listitem>
67718 <listitem>
67719 <para>
67720 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
67721 delivery of the message. This causes an automatic thaw if the message is
67722 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
67723 a new text window. The delivery is run in a separate process, to avoid holding
67724 up the monitor while the delivery proceeds.
67725 </para>
67726 </listitem>
67727 <listitem>
67728 <para>
67729 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
67730 that the message be frozen.
67731 </para>
67732 </listitem>
67733 <listitem>
67734 <para>
67735 <indexterm role="concept">
67736 <primary>thawing messages</primary>
67737 </indexterm>
67738 <indexterm role="concept">
67739 <primary>unfreezing messages</primary>
67740 </indexterm>
67741 <indexterm role="concept">
67742 <primary>frozen messages</primary>
67743 <secondary>thawing</secondary>
67744 </indexterm>
67745 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
67746 that the message be thawed.
67747 </para>
67748 </listitem>
67749 <listitem>
67750 <para>
67751 <indexterm role="concept">
67752 <primary>delivery</primary>
67753 <secondary>forcing failure</secondary>
67754 </indexterm>
67755 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
67756 that Exim gives up trying to deliver the message. A bounce message is generated
67757 for any remaining undelivered addresses.
67758 </para>
67759 </listitem>
67760 <listitem>
67761 <para>
67762 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
67763 that the message be deleted from the system without generating a bounce
67764 message.
67765 </para>
67766 </listitem>
67767 <listitem>
67768 <para>
67769 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
67770 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67771 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67772 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67773 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
67774 additional recipient be added to the message, unless the entry box is empty, in
67775 which case no action is taken.
67776 </para>
67777 </listitem>
67778 <listitem>
67779 <para>
67780 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
67781 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67782 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67783 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67784 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
67785 recipient address as already delivered, unless the entry box is empty, in which
67786 case no action is taken.
67787 </para>
67788 </listitem>
67789 <listitem>
67790 <para>
67791 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
67792 mark all recipient addresses as already delivered.
67793 </para>
67794 </listitem>
67795 <listitem>
67796 <para>
67797 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
67798 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
67799 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
67800 in which case no action is taken. If you want to set an empty sender (as in
67801 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
67802 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
67803 the address is qualified with that domain.
67804 </para>
67805 </listitem>
67806 </itemizedlist>
67807 <para>
67808 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
67809 other cases when a call to Exim is made, if there is any output from Exim (in
67810 particular, if the command fails) a window containing the command and the
67811 output is displayed. Otherwise, the results of the action are normally apparent
67812 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
67813 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
67814 if no output is generated.
67815 </para>
67816 <para>
67817 The queue display is automatically updated for actions such as freezing and
67818 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
67819 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
67820 force an update of the display after one of these actions.
67821 </para>
67822 <para>
67823 In any text window that is displayed as result of a menu action, the normal
67824 cut-and-paste facility is available, and searching can be carried out using ^R
67825 and ^S, as described above for the log tail window.
67826 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
67827 </para>
67828 </section>
67829 </chapter>
67830
67831 <chapter id="CHAPsecurity">
67832 <title>Security considerations</title>
67833 <para>
67834 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
67835 <primary>security</primary>
67836 <secondary>discussion of</secondary>
67837 </indexterm>
67838 This chapter discusses a number of issues concerned with security, some of
67839 which are also covered in other parts of this manual.
67840 </para>
67841 <para>
67842 For reasons that this author does not understand, some people have promoted
67843 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
67844 existence of this chapter in the documentation. However, the intent of the
67845 chapter is simply to describe the way Exim works in relation to certain
67846 security concerns, not to make any specific claims about the effectiveness of
67847 its security as compared with other MTAs.
67848 </para>
67849 <para>
67850 What follows is a description of the way Exim is supposed to be. Best efforts
67851 have been made to try to ensure that the code agrees with the theory, but an
67852 absence of bugs can never be guaranteed. Any that are reported will get fixed
67853 as soon as possible.
67854 </para>
67855 <section id="SECID286">
67856 <title>Building a more <quote>hardened</quote> Exim</title>
67857 <para>
67858 <indexterm role="concept">
67859 <primary>security</primary>
67860 <secondary>build-time features</secondary>
67861 </indexterm>
67862 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
67863 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
67864 Exim administrator who does not have the root password, or by someone who has
67865 penetrated the Exim (but not the root) account. These options are as follows:
67866 </para>
67867 <itemizedlist>
67868 <listitem>
67869 <para>
67870 ALT_CONFIG_PREFIX can be set to a string that is required to match the
67871 start of any file names used with the <option>-C</option> option. When it is set, these file
67872 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
67873 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
67874 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
67875 default setting for <option>ALT_CONFIG_PREFIX</option>.
67876 </para>
67877 <para>
67878 If the permitted configuration files are confined to a directory to
67879 which only root has access, this guards against someone who has broken
67880 into the Exim account from running a privileged Exim with an arbitrary
67881 configuration file, and using it to break into other accounts.
67882 </para>
67883 </listitem>
67884 <listitem>
67885 <para>
67886 If a non-trusted configuration file (i.e. not the default configuration file
67887 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
67888 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
67889 the next item), then root privilege is retained only if the caller of Exim is
67890 root. This locks out the possibility of testing a configuration using <option>-C</option>
67891 right through message reception and delivery, even if the caller is root. The
67892 reception works, but by that time, Exim is running as the Exim user, so when
67893 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
67894 privilege to be lost. However, root can test reception and delivery using two
67895 separate commands.
67896 </para>
67897 </listitem>
67898 <listitem>
67899 <para>
67900 The WHITELIST_D_MACROS build option declares some macros to be safe to override
67901 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
67902 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
67903 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
67904 the restrictive side.  Requiring build-time selection of safe macros is onerous
67905 but this option is intended solely as a transition mechanism to permit
67906 previously-working configurations to continue to work after release 4.73.
67907 </para>
67908 </listitem>
67909 <listitem>
67910 <para>
67911 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
67912 is disabled.
67913 </para>
67914 </listitem>
67915 <listitem>
67916 <para>
67917 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
67918 never to be used for any deliveries. This is like the <option>never_users</option> runtime
67919 option, but it cannot be overridden; the runtime option adds additional users
67920 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
67921 is permitted to modify the runtime file from using Exim as a way to get root.
67922 </para>
67923 </listitem>
67924 </itemizedlist>
67925 </section>
67926 <section id="SECID270">
67927 <title>Root privilege</title>
67928 <para>
67929 <indexterm role="concept">
67930 <primary>setuid</primary>
67931 </indexterm>
67932 <indexterm role="concept">
67933 <primary>root privilege</primary>
67934 </indexterm>
67935 The Exim binary is normally setuid to root, which means that it gains root
67936 privilege (runs as root) when it starts execution. In some special cases (for
67937 example, when the daemon is not in use and there are no local deliveries), it
67938 may be possible to run Exim setuid to some user other than root. This is
67939 discussed in the next section. However, in most installations, root privilege
67940 is required for two things:
67941 </para>
67942 <itemizedlist>
67943 <listitem>
67944 <para>
67945 To set up a socket connected to the standard SMTP port (25) when initialising
67946 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
67947 not required.
67948 </para>
67949 </listitem>
67950 <listitem>
67951 <para>
67952 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
67953 perform local deliveries as the receiving user or as specified in the
67954 configuration.
67955 </para>
67956 </listitem>
67957 </itemizedlist>
67958 <para>
67959 It is not necessary to be root to do any of the other things Exim does, such as
67960 receiving messages and delivering them externally over SMTP, and it is
67961 obviously more secure if Exim does not run as root except when necessary.
67962 For this reason, a user and group for Exim to use must be defined in
67963 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
67964 group</quote>. Their values can be changed by the run time configuration, though this
67965 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
67966 <emphasis>mail</emphasis> or another user name altogether.
67967 </para>
67968 <para>
67969 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
67970 abdication; the process cannot regain root afterwards. Prior to release 4.00,
67971 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
67972 </para>
67973 <para>
67974 After a new Exim process has interpreted its command line options, it changes
67975 uid and gid in the following cases:
67976 </para>
67977 <itemizedlist>
67978 <listitem>
67979 <para>
67980 <indexterm role="option">
67981 <primary><option>-C</option></primary>
67982 </indexterm>
67983 <indexterm role="option">
67984 <primary><option>-D</option></primary>
67985 </indexterm>
67986 If the <option>-C</option> option is used to specify an alternate configuration file, or if
67987 the <option>-D</option> option is used to define macro values for the configuration, and the
67988 calling process is not running as root, the uid and gid are changed to those of
67989 the calling process.
67990 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
67991 option may not be used at all.
67992 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
67993 can be supplied if the calling process is running as root, the Exim run-time
67994 user or CONFIGURE_OWNER, if defined.
67995 </para>
67996 </listitem>
67997 <listitem>
67998 <para>
67999 <indexterm role="option">
68000 <primary><option>-be</option></primary>
68001 </indexterm>
68002 <indexterm role="option">
68003 <primary><option>-bf</option></primary>
68004 </indexterm>
68005 <indexterm role="option">
68006 <primary><option>-bF</option></primary>
68007 </indexterm>
68008 If the expansion test option (<option>-be</option>) or one of the filter testing options
68009 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
68010 calling process.
68011 </para>
68012 </listitem>
68013 <listitem>
68014 <para>
68015 If the process is not a daemon process or a queue runner process or a delivery
68016 process or a process for testing address routing (started with <option>-bt</option>), the
68017 uid and gid are changed to the Exim user and group. This means that Exim always
68018 runs under its own uid and gid when receiving messages. This also applies when
68019 testing address verification
68020 <indexterm role="option">
68021 <primary><option>-bv</option></primary>
68022 </indexterm>
68023 <indexterm role="option">
68024 <primary><option>-bh</option></primary>
68025 </indexterm>
68026 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
68027 option).
68028 </para>
68029 </listitem>
68030 <listitem>
68031 <para>
68032 For a daemon, queue runner, delivery, or address testing process, the uid
68033 remains as root at this stage, but the gid is changed to the Exim group.
68034 </para>
68035 </listitem>
68036 </itemizedlist>
68037 <para>
68038 The processes that initially retain root privilege behave as follows:
68039 </para>
68040 <itemizedlist>
68041 <listitem>
68042 <para>
68043 A daemon process changes the gid to the Exim group and the uid to the Exim
68044 user after setting up one or more listening sockets. The <function>initgroups()</function>
68045 function is called, so that if the Exim user is in any additional groups, they
68046 will be used during message reception.
68047 </para>
68048 </listitem>
68049 <listitem>
68050 <para>
68051 A queue runner process retains root privilege throughout its execution. Its
68052 job is to fork a controlled sequence of delivery processes.
68053 </para>
68054 </listitem>
68055 <listitem>
68056 <para>
68057 A delivery process retains root privilege throughout most of its execution,
68058 but any actual deliveries (that is, the transports themselves) are run in
68059 subprocesses which always change to a non-root uid and gid. For local
68060 deliveries this is typically the uid and gid of the owner of the mailbox; for
68061 remote deliveries, the Exim uid and gid are used. Once all the delivery
68062 subprocesses have been run, a delivery process changes to the Exim uid and gid
68063 while doing post-delivery tidying up such as updating the retry database and
68064 generating bounce and warning messages.
68065 </para>
68066 <para>
68067 While the recipient addresses in a message are being routed, the delivery
68068 process runs as root. However, if a user&#x2019;s filter file has to be processed,
68069 this is done in a subprocess that runs under the individual user&#x2019;s uid and
68070 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
68071 </para>
68072 </listitem>
68073 <listitem>
68074 <para>
68075 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
68076 the routing is done in the same environment as a message delivery.
68077 </para>
68078 </listitem>
68079 </itemizedlist>
68080 </section>
68081 <section id="SECTrunexiwitpri">
68082 <title>Running Exim without privilege</title>
68083 <para>
68084 <indexterm role="concept">
68085 <primary>privilege, running without</primary>
68086 </indexterm>
68087 <indexterm role="concept">
68088 <primary>unprivileged running</primary>
68089 </indexterm>
68090 <indexterm role="concept">
68091 <primary>root privilege</primary>
68092 <secondary>running without</secondary>
68093 </indexterm>
68094 Some installations like to run Exim in an unprivileged state for more of its
68095 operation, for added security. Support for this mode of operation is provided
68096 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
68097 gid are changed to the Exim user and group at the start of a delivery process
68098 (and also queue runner and address testing processes). This means that address
68099 routing is no longer run as root, and the deliveries themselves cannot change
68100 to any other uid.
68101 </para>
68102 <para>
68103 <indexterm role="concept">
68104 <primary>SIGHUP</primary>
68105 </indexterm>
68106 <indexterm role="concept">
68107 <primary>daemon</primary>
68108 <secondary>restarting</secondary>
68109 </indexterm>
68110 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
68111 that the daemon can still be started in the usual way, and it can respond
68112 correctly to SIGHUP because the re-invocation regains root privilege.
68113 </para>
68114 <para>
68115 An alternative approach is to make Exim setuid to the Exim user and also setgid
68116 to the Exim group. If you do this, the daemon must be started from a root
68117 process. (Calling Exim from a root process makes it behave in the way it does
68118 when it is setuid root.) However, the daemon cannot restart itself after a
68119 SIGHUP signal because it cannot regain privilege.
68120 </para>
68121 <para>
68122 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
68123 stops Exim from trying to re-invoke itself to do a delivery after a message has
68124 been received. Such a re-invocation is a waste of resources because it has no
68125 effect.
68126 </para>
68127 <para>
68128 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
68129 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
68130 to the Exim user seems a clean approach, but there is one complication:
68131 </para>
68132 <para>
68133 In this style of operation, Exim is running with the real uid and gid set to
68134 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
68135 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
68136 that is, the real uid/gid should be reset to the effective values so as to
68137 discard any privileges that the caller may have. While some operating systems
68138 have a function that permits this action for a non-root effective uid, quite a
68139 number of them do not. Because of this lack of standardization, Exim does not
68140 address this problem at this time.
68141 </para>
68142 <para>
68143 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
68144 is to keep the Exim binary setuid to root, and to set
68145 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
68146 be used in the most straightforward way.
68147 </para>
68148 <para>
68149 If you configure Exim not to run delivery processes as root, there are a
68150 number of restrictions on what you can do:
68151 </para>
68152 <itemizedlist>
68153 <listitem>
68154 <para>
68155 You can deliver only as the Exim user/group. You should  explicitly use the
68156 <option>user</option> and <option>group</option> options to override routers or local transports that
68157 normally deliver as the recipient. This makes sure that configurations that
68158 work in this mode function the same way in normal mode. Any implicit or
68159 explicit specification of another user causes an error.
68160 </para>
68161 </listitem>
68162 <listitem>
68163 <para>
68164 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
68165 not worthwhile to include them in the configuration.
68166 </para>
68167 </listitem>
68168 <listitem>
68169 <para>
68170 Users who wish to use <filename>.forward</filename> would have to make their home directory and
68171 the file itself accessible to the Exim user. Pipe and append-to-file entries,
68172 and their equivalents in Exim filters, cannot be used. While they could be
68173 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
68174 </para>
68175 </listitem>
68176 <listitem>
68177 <para>
68178 Unless the local user mailboxes are all owned by the Exim user (possible in
68179 some POP3 or IMAP-only environments):
68180 </para>
68181 <orderedlist numeration="arabic">
68182 <listitem>
68183 <para>
68184 They must be owned by the Exim group and be writeable by that group. This
68185 implies you must set <option>mode</option> in the appendfile configuration, as well as the
68186 mode of the mailbox files themselves.
68187 </para>
68188 </listitem>
68189 <listitem>
68190 <para>
68191 You must set <option>no_check_owner</option>, since most or all of the files will not be
68192 owned by the Exim user.
68193 </para>
68194 </listitem>
68195 <listitem>
68196 <para>
68197 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
68198 on a newly created mailbox when unprivileged. This also implies that new
68199 mailboxes need to be created manually.
68200 </para>
68201 </listitem>
68202 </orderedlist>
68203 </listitem>
68204 </itemizedlist>
68205 <para>
68206 These restrictions severely restrict what can be done in local deliveries.
68207 However, there are no restrictions on remote deliveries. If you are running a
68208 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
68209 gives more security at essentially no cost.
68210 </para>
68211 <para>
68212 If you are using the <option>mua_wrapper</option> facility (see chapter
68213 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
68214 </para>
68215 </section>
68216 <section id="SECID271">
68217 <title>Delivering to local files</title>
68218 <para>
68219 Full details of the checks applied by <command>appendfile</command> before it writes to a file
68220 are given in chapter <xref linkend="CHAPappendfile"/>.
68221 </para>
68222 </section>
68223 <section id="SECTsecconslocalcmds">
68224 <title>Running local commands</title>
68225 <para>
68226 <indexterm role="concept">
68227 <primary>security</primary>
68228 <secondary>local commands</secondary>
68229 </indexterm>
68230 <indexterm role="concept">
68231 <primary>security</primary>
68232 <secondary>command injection attacks</secondary>
68233 </indexterm>
68234 There are a number of ways in which an administrator can configure Exim to run
68235 commands based upon received, untrustworthy, data. Further, in some
68236 configurations a user who can control a <filename>.forward</filename> file can also arrange to
68237 run commands. Configuration to check includes, but is not limited to:
68238 </para>
68239 <itemizedlist>
68240 <listitem>
68241 <para>
68242 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
68243 injection may be possible with this option present. It is dangerous and should
68244 be used only with considerable caution. Consider constraints which whitelist
68245 allowed characters in a variable which is to be used in a pipe transport that
68246 has <option>use_shell</option> enabled.
68247 </para>
68248 </listitem>
68249 <listitem>
68250 <para>
68251 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
68252 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
68253 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
68254 hub to which ordinary users do not have shell access, but home directories are
68255 NFS mounted (for instance) then administrators should review the list of these
68256 forbid options available, and should bear in mind that the options that may
68257 need forbidding can change as new features are added between releases.
68258 </para>
68259 </listitem>
68260 <listitem>
68261 <para>
68262 The <option>${run...}</option> expansion item does not use a shell by default, but
68263 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
68264 Such invocations should be viewed with prejudicial suspicion.
68265 </para>
68266 </listitem>
68267 <listitem>
68268 <para>
68269 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
68270 taint checking might apply to their usage.
68271 </para>
68272 </listitem>
68273 <listitem>
68274 <para>
68275 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
68276 administrators are well advised to view its use with suspicion, in case (for
68277 instance) it allows a local-part to contain embedded Exim directives.
68278 </para>
68279 </listitem>
68280 <listitem>
68281 <para>
68282 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
68283 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
68284 each can reference arbitrary lists and files, rather than just being a list
68285 of opaque strings.
68286 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
68287 real-world security vulnerabilities caused by its use with untrustworthy data
68288 injected in, for SQL injection attacks.
68289 Consider the use of the <option>inlisti</option> expansion condition instead.
68290 </para>
68291 </listitem>
68292 </itemizedlist>
68293 </section>
68294 <section id="SECTsecconfdata">
68295 <title>Trust in configuration data</title>
68296 <para>
68297 <indexterm role="concept">
68298 <primary>security</primary>
68299 <secondary>data sources</secondary>
68300 </indexterm>
68301 <indexterm role="concept">
68302 <primary>security</primary>
68303 <secondary>regular expressions</secondary>
68304 </indexterm>
68305 <indexterm role="concept">
68306 <primary>regular expressions</primary>
68307 <secondary>security</secondary>
68308 </indexterm>
68309 <indexterm role="concept">
68310 <primary>PCRE</primary>
68311 <secondary>security</secondary>
68312 </indexterm>
68313 If configuration data for Exim can come from untrustworthy sources, there
68314 are some issues to be aware of:
68315 </para>
68316 <itemizedlist>
68317 <listitem>
68318 <para>
68319 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
68320 </para>
68321 </listitem>
68322 <listitem>
68323 <para>
68324 Letting untrusted data provide a regular expression is unwise.
68325 </para>
68326 </listitem>
68327 <listitem>
68328 <para>
68329 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
68330 data may result in pathological behaviour within PCRE.  Be aware of what
68331 "backtracking" means and consider options for being more strict with a regular
68332 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
68333 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
68334 possessive quantifiers or just not using regular expressions against untrusted
68335 data.
68336 </para>
68337 </listitem>
68338 <listitem>
68339 <para>
68340 It can be important to correctly use <option>${quote:...}</option>,
68341 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
68342 items to ensure that data is correctly constructed.
68343 </para>
68344 </listitem>
68345 <listitem>
68346 <para>
68347 Some lookups might return multiple results, even though normal usage is only
68348 expected to yield one result.
68349 </para>
68350 </listitem>
68351 </itemizedlist>
68352 </section>
68353 <section id="SECID272">
68354 <title>IPv4 source routing</title>
68355 <para>
68356 <indexterm role="concept">
68357 <primary>source routing</primary>
68358 <secondary>in IP packets</secondary>
68359 </indexterm>
68360 <indexterm role="concept">
68361 <primary>IP source routing</primary>
68362 </indexterm>
68363 Many operating systems suppress IP source-routed packets in the kernel, but
68364 some cannot be made to do this, so Exim does its own check. It logs incoming
68365 IPv4 source-routed TCP calls, and then drops them. Things are all different in
68366 IPv6. No special checking is currently done.
68367 </para>
68368 </section>
68369 <section id="SECID273">
68370 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
68371 <para>
68372 Support for these SMTP commands is disabled by default. If required, they can
68373 be enabled by defining suitable ACLs.
68374 </para>
68375 </section>
68376 <section id="SECID274">
68377 <title>Privileged users</title>
68378 <para>
68379 <indexterm role="concept">
68380 <primary>trusted users</primary>
68381 </indexterm>
68382 <indexterm role="concept">
68383 <primary>admin user</primary>
68384 </indexterm>
68385 <indexterm role="concept">
68386 <primary>privileged user</primary>
68387 </indexterm>
68388 <indexterm role="concept">
68389 <primary>user</primary>
68390 <secondary>trusted</secondary>
68391 </indexterm>
68392 <indexterm role="concept">
68393 <primary>user</primary>
68394 <secondary>admin</secondary>
68395 </indexterm>
68396 Exim recognizes two sets of users with special privileges. Trusted users are
68397 able to submit new messages to Exim locally, but supply their own sender
68398 addresses and information about a sending host. For other users submitting
68399 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
68400 permit a remote host to be specified.
68401 </para>
68402 <para>
68403 <indexterm role="option">
68404 <primary><option>-f</option></primary>
68405 </indexterm>
68406 However, an untrusted user is permitted to use the <option>-f</option> command line option
68407 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
68408 message should not cause an error report. This affects the message&#x2019;s envelope,
68409 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
68410 permitted to use specific forms of address with the <option>-f</option> option by setting
68411 the <option>untrusted_set_sender</option> option.
68412 </para>
68413 <para>
68414 Trusted users are used to run processes that receive mail messages from some
68415 other mail domain and pass them on to Exim for delivery either locally, or over
68416 the Internet. Exim trusts a caller that is running as root, as the Exim user,
68417 as any user listed in the <option>trusted_users</option> configuration option, or under any
68418 group listed in the <option>trusted_groups</option> option.
68419 </para>
68420 <para>
68421 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
68422 can freeze or thaw messages, cause them to be returned to their senders, remove
68423 them entirely, or modify them in various ways. In addition, admin users can run
68424 the Exim monitor and see all the information it is capable of providing, which
68425 includes the contents of files on the spool.
68426 </para>
68427 <para>
68428 <indexterm role="option">
68429 <primary><option>-M</option></primary>
68430 </indexterm>
68431 <indexterm role="option">
68432 <primary><option>-q</option></primary>
68433 </indexterm>
68434 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
68435 delivery of messages on its queue is restricted to admin users. This
68436 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
68437 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
68438 queue is also restricted to admin users. This restriction can be relaxed by
68439 setting <option>no_queue_list_requires_admin</option>.
68440 </para>
68441 <para>
68442 Exim recognizes an admin user if the calling process is running as root or as
68443 the Exim user or if any of the groups associated with the calling process is
68444 the Exim group. It is not necessary actually to be running under the Exim
68445 group. However, if admin users who are not root or the Exim user are to access
68446 the contents of files on the spool via the Exim monitor (which runs
68447 unprivileged), Exim must be built to allow group read access to its spool
68448 files.
68449 </para>
68450 </section>
68451 <section id="SECID275">
68452 <title>Spool files</title>
68453 <para>
68454 <indexterm role="concept">
68455 <primary>spool directory</primary>
68456 <secondary>files</secondary>
68457 </indexterm>
68458 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
68459 set to the Exim group. The mode for spool files is defined in the
68460 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
68461 any user who is a member of the Exim group can access these files.
68462 </para>
68463 </section>
68464 <section id="SECID276">
68465 <title>Use of argv[0]</title>
68466 <para>
68467 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
68468 of specific strings, Exim assumes certain options. For example, calling Exim
68469 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
68470 to calling it with the option <option>-bS</option>. There are no security implications in
68471 this.
68472 </para>
68473 </section>
68474 <section id="SECID277">
68475 <title>Use of %f formatting</title>
68476 <para>
68477 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
68478 are actually stored in integer variables as 1000 times the load average.
68479 Consequently, their range is limited and so therefore is the length of the
68480 converted output.
68481 </para>
68482 </section>
68483 <section id="SECID278">
68484 <title>Embedded Exim path</title>
68485 <para>
68486 Exim uses its own path name, which is embedded in the code, only when it needs
68487 to re-exec in order to regain root privilege. Therefore, it is not root when it
68488 does so. If some bug allowed the path to get overwritten, it would lead to an
68489 arbitrary program&#x2019;s being run as exim, not as root.
68490 </para>
68491 </section>
68492 <section id="SECTdynmoddir">
68493 <title>Dynamic module directory</title>
68494 <para>
68495 Any dynamically loadable modules must be installed into the directory
68496 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
68497 loading it.
68498 </para>
68499 </section>
68500 <section id="SECID279">
68501 <title>Use of sprintf()</title>
68502 <para>
68503 <indexterm role="concept">
68504 <primary><function>sprintf()</function></primary>
68505 </indexterm>
68506 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
68507 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
68508 The intermediate formatting is done into a large fixed buffer by a function
68509 that runs through the format string itself, and checks the length of each
68510 conversion before performing it, thus preventing buffer overruns.
68511 </para>
68512 <para>
68513 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
68514 the output buffer is known to be sufficiently long to contain the converted
68515 string.
68516 </para>
68517 </section>
68518 <section id="SECID280">
68519 <title>Use of debug_printf() and log_write()</title>
68520 <para>
68521 Arbitrary strings are passed to both these functions, but they do their
68522 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
68523 the format string itself, and checks the length of each conversion.
68524 </para>
68525 </section>
68526 <section id="SECID281">
68527 <title>Use of strcat() and strcpy()</title>
68528 <para>
68529 These are used only in cases where the output buffer is known to be large
68530 enough to hold the result.
68531 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
68532 </para>
68533 </section>
68534 </chapter>
68535
68536 <chapter id="CHAPspool">
68537 <title>Format of spool files</title>
68538 <para>
68539 <indexterm role="concept" id="IIDforspo1" class="startofrange">
68540 <primary>format</primary>
68541 <secondary>spool files</secondary>
68542 </indexterm>
68543 <indexterm role="concept" id="IIDforspo2" class="startofrange">
68544 <primary>spool directory</primary>
68545 <secondary>format of files</secondary>
68546 </indexterm>
68547 <indexterm role="concept" id="IIDforspo3" class="startofrange">
68548 <primary>spool files</primary>
68549 <secondary>format of</secondary>
68550 </indexterm>
68551 <indexterm role="concept">
68552 <primary>spool files</primary>
68553 <secondary>editing</secondary>
68554 </indexterm>
68555 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
68556 followed by -D and -H, respectively. The data portion of the message is kept in
68557 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
68558 kept in the -H file, whose format is described in this chapter. Each of these
68559 two files contains the final component of its own name as its first line. This
68560 is insurance against disk crashes where the directory is lost but the files
68561 themselves are recoverable.
68562 </para>
68563 <para>
68564 Some people are tempted into editing -D files in order to modify messages. You
68565 need to be extremely careful if you do this; it is not recommended and you are
68566 on your own if you do it. Here are some of the pitfalls:
68567 </para>
68568 <itemizedlist>
68569 <listitem>
68570 <para>
68571 You must ensure that Exim does not try to deliver the message while you are
68572 fiddling with it. The safest way is to take out a write lock on the -D file,
68573 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
68574 place, the lock will be retained. If you write a new file and rename it, the
68575 lock will be lost at the instant of rename.
68576 </para>
68577 </listitem>
68578 <listitem>
68579 <para>
68580 <indexterm role="variable">
68581 <primary><varname>$body_linecount</varname></primary>
68582 </indexterm>
68583 If you change the number of lines in the file, the value of
68584 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
68585 cause incomplete transmission of messages or undeliverable messages.
68586 </para>
68587 </listitem>
68588 <listitem>
68589 <para>
68590 If the message is in MIME format, you must take care not to break it.
68591 </para>
68592 </listitem>
68593 <listitem>
68594 <para>
68595 If the message is cryptographically signed, any change will invalidate the
68596 signature.
68597 </para>
68598 </listitem>
68599 </itemizedlist>
68600 <para>
68601 All in all, modifying -D files is fraught with danger.
68602 </para>
68603 <para>
68604 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
68605 its subdirectories when <option>split_spool_directory</option> is set). These are journal
68606 files, used to record addresses to which the message has been delivered during
68607 the course of a delivery attempt. If there are still undelivered recipients at
68608 the end, the -H file is updated, and the -J file is deleted. If, however, there
68609 is some kind of crash (for example, a power outage) before this happens, the -J
68610 file remains in existence. When Exim next processes the message, it notices the
68611 -J file and uses it to update the -H file before starting the next delivery
68612 attempt.
68613 </para>
68614 <section id="SECID282">
68615 <title>Format of the -H file</title>
68616 <para>
68617 <indexterm role="concept">
68618 <primary>uid (user id)</primary>
68619 <secondary>in spool file</secondary>
68620 </indexterm>
68621 <indexterm role="concept">
68622 <primary>gid (group id)</primary>
68623 <secondary>in spool file</secondary>
68624 </indexterm>
68625 The second line of the -H file contains the login name for the uid of the
68626 process that called Exim to read the message, followed by the numerical uid and
68627 gid. For a locally generated message, this is normally the user who sent the
68628 message. For a message received over TCP/IP via the daemon, it is
68629 normally the Exim user.
68630 </para>
68631 <para>
68632 The third line of the file contains the address of the message&#x2019;s sender as
68633 transmitted in the envelope, contained in angle brackets. The sender address is
68634 empty for bounce messages. For incoming SMTP mail, the sender address is given
68635 in the MAIL command. For locally generated mail, the sender address is
68636 created by Exim from the login name of the current user and the configured
68637 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
68638 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
68639 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
68640 </para>
68641 <para>
68642 The fourth line contains two numbers. The first is the time that the message
68643 was received, in the conventional Unix form &ndash; the number of seconds since the
68644 start of the epoch. The second number is a count of the number of messages
68645 warning of delayed delivery that have been sent to the sender.
68646 </para>
68647 <para>
68648 There follow a number of lines starting with a hyphen. These can appear in any
68649 order, and are omitted when not relevant:
68650 </para>
68651 <variablelist>
68652 <varlistentry>
68653 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68654 <listitem>
68655 <para>
68656 This item is obsolete, and is not generated from Exim release 4.61 onwards;
68657 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
68658 recognized, to provide backward compatibility. In the old format, a line of
68659 this form is present for every ACL variable that is not empty. The number
68660 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
68661 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
68662 the data string for the variable. The string itself starts at the beginning of
68663 the next line, and is followed by a newline character. It may contain internal
68664 newlines.
68665 </para>
68666 </listitem></varlistentry>
68667 <varlistentry>
68668 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68669 <listitem>
68670 <para>
68671 A line of this form is present for every ACL connection variable that is
68672 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
68673 The length is the length of the data string for the variable. The string itself
68674 starts at the beginning of the next line, and is followed by a newline
68675 character. It may contain internal newlines.
68676 </para>
68677 </listitem></varlistentry>
68678 <varlistentry>
68679 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68680 <listitem>
68681 <para>
68682 A line of this form is present for every ACL message variable that is defined.
68683 Note that there is a space between <option>-aclm</option> and the rest of the name. The
68684 length is the length of the data string for the variable. The string itself
68685 starts at the beginning of the next line, and is followed by a newline
68686 character. It may contain internal newlines.
68687 </para>
68688 </listitem></varlistentry>
68689 <varlistentry>
68690 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
68691 <listitem>
68692 <para>
68693 This is present if, when the message was received over SMTP, the value of
68694 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
68695 </para>
68696 </listitem></varlistentry>
68697 <varlistentry>
68698 <term><option>-allow_unqualified_recipient</option></term>
68699 <listitem>
68700 <para>
68701 This is present if unqualified recipient addresses are permitted in header
68702 lines (to stop such addresses from being qualified if rewriting occurs at
68703 transport time). Local messages that were input using <option>-bnq</option> and remote
68704 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
68705 </para>
68706 </listitem></varlistentry>
68707 <varlistentry>
68708 <term><option>-allow_unqualified_sender</option></term>
68709 <listitem>
68710 <para>
68711 This is present if unqualified sender addresses are permitted in header lines
68712 (to stop such addresses from being qualified if rewriting occurs at transport
68713 time). Local messages that were input using <option>-bnq</option> and remote messages from
68714 hosts that match <option>sender_unqualified_hosts</option> set this flag.
68715 </para>
68716 </listitem></varlistentry>
68717 <varlistentry>
68718 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68719 <listitem>
68720 <para>
68721 The id information for a message received on an authenticated SMTP connection
68722 &ndash; the value of the <varname>$authenticated_id</varname> variable.
68723 </para>
68724 </listitem></varlistentry>
68725 <varlistentry>
68726 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
68727 <listitem>
68728 <para>
68729 The address of an authenticated sender &ndash; the value of the
68730 <varname>$authenticated_sender</varname> variable.
68731 </para>
68732 </listitem></varlistentry>
68733 <varlistentry>
68734 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68735 <listitem>
68736 <para>
68737 This records the number of lines in the body of the message, and is always
68738 present.
68739 </para>
68740 </listitem></varlistentry>
68741 <varlistentry>
68742 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68743 <listitem>
68744 <para>
68745 This records the number of binary zero bytes in the body of the message, and is
68746 present if the number is greater than zero.
68747 </para>
68748 </listitem></varlistentry>
68749 <varlistentry>
68750 <term><option>-deliver_firsttime</option></term>
68751 <listitem>
68752 <para>
68753 This is written when a new message is first added to the spool. When the spool
68754 file is updated after a deferral, it is omitted.
68755 </para>
68756 </listitem></varlistentry>
68757 <varlistentry>
68758 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
68759 <listitem>
68760 <para>
68761 <indexterm role="concept">
68762 <primary>frozen messages</primary>
68763 <secondary>spool data</secondary>
68764 </indexterm>
68765 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
68766 </para>
68767 </listitem></varlistentry>
68768 <varlistentry>
68769 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68770 <listitem>
68771 <para>
68772 This records the host name as specified by a remote host in a HELO or EHLO
68773 command.
68774 </para>
68775 </listitem></varlistentry>
68776 <varlistentry>
68777 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68778 <listitem>
68779 <para>
68780 This records the IP address of the host from which the message was received and
68781 the remote port number that was used. It is omitted for locally generated
68782 messages.
68783 </para>
68784 </listitem></varlistentry>
68785 <varlistentry>
68786 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68787 <listitem>
68788 <para>
68789 If the message was received on an authenticated SMTP connection, this records
68790 the name of the authenticator &ndash; the value of the
68791 <varname>$sender_host_authenticated</varname> variable.
68792 </para>
68793 </listitem></varlistentry>
68794 <varlistentry>
68795 <term><option>-host_lookup_failed</option></term>
68796 <listitem>
68797 <para>
68798 This is present if an attempt to look up the sending host&#x2019;s name from its IP
68799 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
68800 </para>
68801 </listitem></varlistentry>
68802 <varlistentry>
68803 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68804 <listitem>
68805 <para>
68806 <indexterm role="concept">
68807 <primary>reverse DNS lookup</primary>
68808 </indexterm>
68809 <indexterm role="concept">
68810 <primary>DNS</primary>
68811 <secondary>reverse lookup</secondary>
68812 </indexterm>
68813 This records the name of the remote host from which the message was received,
68814 if the host name was looked up from the IP address when the message was being
68815 received. It is not present if no reverse lookup was done.
68816 </para>
68817 </listitem></varlistentry>
68818 <varlistentry>
68819 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68820 <listitem>
68821 <para>
68822 For locally submitted messages, this records the login of the originating user,
68823 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
68824 ident value. For messages received over TCP/IP, this records the ident string
68825 supplied by the remote host, if any.
68826 </para>
68827 </listitem></varlistentry>
68828 <varlistentry>
68829 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68830 <listitem>
68831 <para>
68832 This records the IP address of the local interface and the port number through
68833 which a message was received from a remote host. It is omitted for locally
68834 generated messages.
68835 </para>
68836 </listitem></varlistentry>
68837 <varlistentry>
68838 <term><option>-local</option></term>
68839 <listitem>
68840 <para>
68841 The message is from a local sender.
68842 </para>
68843 </listitem></varlistentry>
68844 <varlistentry>
68845 <term><option>-localerror</option></term>
68846 <listitem>
68847 <para>
68848 The message is a locally-generated bounce message.
68849 </para>
68850 </listitem></varlistentry>
68851 <varlistentry>
68852 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
68853 <listitem>
68854 <para>
68855 This records the data string that was returned by the <function>local_scan()</function> function
68856 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
68857 variable. It is omitted if no data was returned.
68858 </para>
68859 </listitem></varlistentry>
68860 <varlistentry>
68861 <term><option>-manual_thaw</option></term>
68862 <listitem>
68863 <para>
68864 The message was frozen but has been thawed manually, that is, by an explicit
68865 Exim command rather than via the auto-thaw process.
68866 </para>
68867 </listitem></varlistentry>
68868 <varlistentry>
68869 <term><option>-N</option></term>
68870 <listitem>
68871 <para>
68872 A testing delivery process was started using the <option>-N</option> option to suppress any
68873 actual deliveries, but delivery was deferred. At any further delivery attempts,
68874 <option>-N</option> is assumed.
68875 </para>
68876 </listitem></varlistentry>
68877 <varlistentry>
68878 <term><option>-received_protocol</option></term>
68879 <listitem>
68880 <para>
68881 This records the value of the <varname>$received_protocol</varname> variable, which contains
68882 the name of the protocol by which the message was received.
68883 </para>
68884 </listitem></varlistentry>
68885 <varlistentry>
68886 <term><option>-sender_set_untrusted</option></term>
68887 <listitem>
68888 <para>
68889 The envelope sender of this message was set by an untrusted local caller (used
68890 to ensure that the caller is displayed in queue listings).
68891 </para>
68892 </listitem></varlistentry>
68893 <varlistentry>
68894 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68895 <listitem>
68896 <para>
68897 If a message was scanned by SpamAssassin, this is present. It records the value
68898 of <varname>$spam_score_int</varname>.
68899 </para>
68900 </listitem></varlistentry>
68901 <varlistentry>
68902 <term><option>-tls_certificate_verified</option></term>
68903 <listitem>
68904 <para>
68905 A TLS certificate was received from the client that sent this message, and the
68906 certificate was verified by the server.
68907 </para>
68908 </listitem></varlistentry>
68909 <varlistentry>
68910 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
68911 <listitem>
68912 <para>
68913 When the message was received over an encrypted connection, this records the
68914 name of the cipher suite that was used.
68915 </para>
68916 </listitem></varlistentry>
68917 <varlistentry>
68918 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
68919 <listitem>
68920 <para>
68921 When the message was received over an encrypted connection, and a certificate
68922 was received from the client, this records the Distinguished Name from that
68923 certificate.
68924 </para>
68925 </listitem></varlistentry>
68926 </variablelist>
68927 <para>
68928 Following the options there is a list of those addresses to which the message
68929 is not to be delivered. This set of addresses is initialized from the command
68930 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
68931 is set; otherwise it starts out empty. Whenever a successful delivery is made,
68932 the address is added to this set. The addresses are kept internally as a
68933 balanced binary tree, and it is a representation of that tree which is written
68934 to the spool file. If an address is expanded via an alias or forward file, the
68935 original address is added to the tree when deliveries to all its child
68936 addresses are complete.
68937 </para>
68938 <para>
68939 If the tree is empty, there is a single line in the spool file containing just
68940 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
68941 Y or N, followed by an address. The address is the value for the node of the
68942 tree, and the letters indicate whether the node has a left branch and/or a
68943 right branch attached to it, respectively. If branches exist, they immediately
68944 follow. Here is an example of a three-node tree:
68945 </para>
68946 <literallayout class="monospaced">
68947 YY darcy@austen.fict.example
68948 NN alice@wonderland.fict.example
68949 NN editor@thesaurus.ref.example
68950 </literallayout>
68951 <para>
68952 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
68953 This is a simple list, preceded by a count. It includes all the original
68954 recipients of the message, including those to whom the message has already been
68955 delivered. In the simplest case, the list contains one address per line. For
68956 example:
68957 </para>
68958 <literallayout class="monospaced">
68959 4
68960 editor@thesaurus.ref.example
68961 darcy@austen.fict.example
68962 rdo@foundation
68963 alice@wonderland.fict.example
68964 </literallayout>
68965 <para>
68966 However, when a child address has been added to the top-level addresses as a
68967 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
68968 line is of the following form:
68969 </para>
68970 <literallayout>
68971 &lt;<emphasis>top-level address</emphasis>&gt; &lt;<emphasis>errors_to address</emphasis>&gt; &lt;<emphasis>length</emphasis>&gt;,&lt;<emphasis>parent number</emphasis>&gt;#&lt;<emphasis>flag bits</emphasis>&gt;
68972 </literallayout>
68973 <para>
68974 The 01 flag bit indicates the presence of the three other fields that follow
68975 the top-level address. Other bits may be used in future to support additional
68976 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
68977 original parent of the <quote>one time</quote> address. The first two fields are the
68978 envelope sender that is associated with this address and its length. If the
68979 length is zero, there is no special envelope sender (there are then two space
68980 characters in the line). A non-empty field can arise from a <command>redirect</command> router
68981 that has an <option>errors_to</option> setting.
68982 </para>
68983 <para>
68984 A blank line separates the envelope and status information from the headers
68985 which follow. A header may occupy several lines of the file, and to save effort
68986 when reading it in, each header is preceded by a number and an identifying
68987 character. The number is the number of characters in the header, including any
68988 embedded newlines and the terminating newline. The character is one of the
68989 following:
68990 </para>
68991 <informaltable frame="none">
68992 <tgroup cols="2" colsep="0" rowsep="0">
68993 <colspec colwidth="50pt" align="left"/>
68994 <colspec colwidth="254pt" align="left"/>
68995 <tbody>
68996 <row>
68997 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
68998 <entry>header in which Exim has no special interest</entry>
68999 </row>
69000 <row>
69001 <entry><literal>B</literal></entry>
69002 <entry><emphasis>Bcc:</emphasis> header</entry>
69003 </row>
69004 <row>
69005 <entry><literal>C</literal></entry>
69006 <entry><emphasis>Cc:</emphasis> header</entry>
69007 </row>
69008 <row>
69009 <entry><literal>F</literal></entry>
69010 <entry><emphasis>From:</emphasis> header</entry>
69011 </row>
69012 <row>
69013 <entry><literal>I</literal></entry>
69014 <entry><emphasis>Message-id:</emphasis> header</entry>
69015 </row>
69016 <row>
69017 <entry><literal>P</literal></entry>
69018 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
69019 </row>
69020 <row>
69021 <entry><literal>R</literal></entry>
69022 <entry><emphasis>Reply-To:</emphasis> header</entry>
69023 </row>
69024 <row>
69025 <entry><literal>S</literal></entry>
69026 <entry><emphasis>Sender:</emphasis> header</entry>
69027 </row>
69028 <row>
69029 <entry><literal>T</literal></entry>
69030 <entry><emphasis>To:</emphasis> header</entry>
69031 </row>
69032 <row>
69033 <entry><literal>*</literal></entry>
69034 <entry>replaced or deleted header</entry>
69035 </row>
69036 </tbody>
69037 </tgroup>
69038 </informaltable>
69039 <para>
69040 Deleted or replaced (rewritten) headers remain in the spool file for debugging
69041 purposes. They are not transmitted when the message is delivered. Here is a
69042 typical set of headers:
69043 </para>
69044 <literallayout class="monospaced">
69045 111P Received: by hobbit.fict.example with local (Exim 4.00)
69046 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
69047 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
69048 038* X-rewrote-sender: bb@hobbit.fict.example
69049 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
69050 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
69051 099* To: alice@wonderland.fict.example, rdo@foundation,
69052 darcy@austen.fict.example, editor@thesaurus.ref.example
69053 104T To: alice@wonderland.fict.example, rdo@foundation.example,
69054 darcy@austen.fict.example, editor@thesaurus.ref.example
69055 038  Date: Fri, 11 May 2001 10:28:59 +0100
69056 </literallayout>
69057 <para>
69058 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
69059 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
69060 unqualified domain <emphasis>foundation</emphasis>.
69061 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
69062 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
69063 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
69064 </para>
69065 </section>
69066 </chapter>
69067
69068 <chapter id="CHAPdkim">
69069 <title>Support for DKIM (DomainKeys Identified Mail)</title>
69070 <titleabbrev>DKIM Support</titleabbrev>
69071 <para>
69072 <indexterm role="concept">
69073 <primary>DKIM</primary>
69074 </indexterm>
69075 </para>
69076 <para>
69077 DKIM is a mechanism by which messages sent by some entity can be provably
69078 linked to a domain which that entity controls.  It permits reputation to
69079 be tracked on a per-domain basis, rather than merely upon source IP address.
69080 DKIM is documented in RFC 4871.
69081 </para>
69082 <para>
69083 DKIM support is compiled into Exim by default if TLS support is present.
69084 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
69085 </para>
69086 <para>
69087 Exim&#x2019;s DKIM implementation allows for
69088 </para>
69089 <orderedlist numeration="arabic">
69090 <listitem>
69091 <para>
69092 Signing outgoing messages: This function is implemented in the SMTP transport.
69093 It can co-exist with all other Exim features
69094 (including transport filters)
69095 except cutthrough delivery.
69096 </para>
69097 </listitem>
69098 <listitem>
69099 <para>
69100 Verifying signatures in incoming messages: This is implemented by an additional
69101 ACL (acl_smtp_dkim), which can be called several times per message, with
69102 different signature contexts.
69103 </para>
69104 </listitem>
69105 </orderedlist>
69106 <para>
69107 In typical Exim style, the verification implementation does not include any
69108 default "policy". Instead it enables you to build your own policy using
69109 Exim&#x2019;s standard controls.
69110 </para>
69111 <para>
69112 Please note that verification of DKIM signatures in incoming mail is turned
69113 on by default for logging purposes. For each signature in incoming email,
69114 exim will log a line displaying the most important signature details, and the
69115 signature status. Here is an example (with line-breaks added for clarity):
69116 </para>
69117 <literallayout class="monospaced">
69118 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
69119     d=facebookmail.com s=q1-2009b
69120     c=relaxed/relaxed a=rsa-sha1
69121     i=@facebookmail.com t=1252484542 [verification succeeded]
69122 </literallayout>
69123 <para>
69124 You might want to turn off DKIM verification processing entirely for internal
69125 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
69126 control modifier. This should typically be done in the RCPT ACL, at points
69127 where you accept mail from relay sources (internal hosts or authenticated
69128 senders).
69129 </para>
69130 <section id="SECDKIMSIGN">
69131 <title>Signing outgoing messages</title>
69132 <para>
69133 <indexterm role="concept">
69134 <primary>DKIM</primary>
69135 <secondary>signing</secondary>
69136 </indexterm>
69137 </para>
69138 <para>
69139 Signing is enabled by setting private options on the SMTP transport.
69140 These options take (expandable) strings as arguments.
69141 </para>
69142 <para>
69143 <indexterm role="option">
69144 <primary><option>dkim_domain</option></primary>
69145 </indexterm>
69146 </para>
69147 <informaltable frame="all">
69148 <tgroup cols="4" colsep="0" rowsep="0">
69149 <colspec colwidth="8*" align="left"/>
69150 <colspec colwidth="6*" align="center"/>
69151 <colspec colwidth="6*" align="center"/>
69152 <colspec colwidth="6*" align="right"/>
69153 <tbody>
69154 <row>
69155 <entry><option>dkim_domain</option></entry>
69156 <entry>Use: <emphasis>smtp</emphasis></entry>
69157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69158 <entry>Default: <emphasis>unset</emphasis></entry>
69159 </row>
69160 </tbody>
69161 </tgroup>
69162 </informaltable>
69163 <para>
69164 MANDATORY:
69165 The domain you want to sign with. The result of this expanded
69166 option is put into the <option>$dkim_domain</option> expansion variable.
69167 If it is empty after expansion, DKIM signing is not done.
69168 </para>
69169 <para>
69170 <indexterm role="option">
69171 <primary><option>dkim_selector</option></primary>
69172 </indexterm>
69173 </para>
69174 <informaltable frame="all">
69175 <tgroup cols="4" colsep="0" rowsep="0">
69176 <colspec colwidth="8*" align="left"/>
69177 <colspec colwidth="6*" align="center"/>
69178 <colspec colwidth="6*" align="center"/>
69179 <colspec colwidth="6*" align="right"/>
69180 <tbody>
69181 <row>
69182 <entry><option>dkim_selector</option></entry>
69183 <entry>Use: <emphasis>smtp</emphasis></entry>
69184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69185 <entry>Default: <emphasis>unset</emphasis></entry>
69186 </row>
69187 </tbody>
69188 </tgroup>
69189 </informaltable>
69190 <para>
69191 MANDATORY:
69192 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
69193 variable to look up a matching selector. The result is put in the expansion
69194 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
69195 option along with <option>$dkim_domain</option>.
69196 </para>
69197 <para>
69198 <indexterm role="option">
69199 <primary><option>dkim_private_key</option></primary>
69200 </indexterm>
69201 </para>
69202 <informaltable frame="all">
69203 <tgroup cols="4" colsep="0" rowsep="0">
69204 <colspec colwidth="8*" align="left"/>
69205 <colspec colwidth="6*" align="center"/>
69206 <colspec colwidth="6*" align="center"/>
69207 <colspec colwidth="6*" align="right"/>
69208 <tbody>
69209 <row>
69210 <entry><option>dkim_private_key</option></entry>
69211 <entry>Use: <emphasis>smtp</emphasis></entry>
69212 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69213 <entry>Default: <emphasis>unset</emphasis></entry>
69214 </row>
69215 </tbody>
69216 </tgroup>
69217 </informaltable>
69218 <para>
69219 MANDATORY:
69220 This sets the private key to use. You can use the <option>$dkim_domain</option> and
69221 <option>$dkim_selector</option> expansion variables to determine the private key to use.
69222 The result can either
69223 </para>
69224 <itemizedlist>
69225 <listitem>
69226 <para>
69227 be a valid RSA private key in ASCII armor, including line breaks.
69228 </para>
69229 </listitem>
69230 <listitem>
69231 <para>
69232 start with a slash, in which case it is treated as a file that contains
69233 the private key.
69234 </para>
69235 </listitem>
69236 <listitem>
69237 <para>
69238 be "0", "false" or the empty string, in which case the message will not
69239 be signed. This case will not result in an error, even if <option>dkim_strict</option>
69240 is set.
69241 </para>
69242 </listitem>
69243 </itemizedlist>
69244 <para>
69245 <indexterm role="option">
69246 <primary><option>dkim_canon</option></primary>
69247 </indexterm>
69248 </para>
69249 <informaltable frame="all">
69250 <tgroup cols="4" colsep="0" rowsep="0">
69251 <colspec colwidth="8*" align="left"/>
69252 <colspec colwidth="6*" align="center"/>
69253 <colspec colwidth="6*" align="center"/>
69254 <colspec colwidth="6*" align="right"/>
69255 <tbody>
69256 <row>
69257 <entry><option>dkim_canon</option></entry>
69258 <entry>Use: <emphasis>smtp</emphasis></entry>
69259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69260 <entry>Default: <emphasis>unset</emphasis></entry>
69261 </row>
69262 </tbody>
69263 </tgroup>
69264 </informaltable>
69265 <para>
69266 OPTIONAL:
69267 This option sets the canonicalization method used when signing a message.
69268 The DKIM RFC currently supports two methods: "simple" and "relaxed".
69269 The option defaults to "relaxed" when unset. Note: the current implementation
69270 only supports using the same canonicalization method for both headers and body.
69271 </para>
69272 <para>
69273 <indexterm role="option">
69274 <primary><option>dkim_strict</option></primary>
69275 </indexterm>
69276 </para>
69277 <informaltable frame="all">
69278 <tgroup cols="4" colsep="0" rowsep="0">
69279 <colspec colwidth="8*" align="left"/>
69280 <colspec colwidth="6*" align="center"/>
69281 <colspec colwidth="6*" align="center"/>
69282 <colspec colwidth="6*" align="right"/>
69283 <tbody>
69284 <row>
69285 <entry><option>dkim_strict</option></entry>
69286 <entry>Use: <emphasis>smtp</emphasis></entry>
69287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69288 <entry>Default: <emphasis>unset</emphasis></entry>
69289 </row>
69290 </tbody>
69291 </tgroup>
69292 </informaltable>
69293 <para>
69294 OPTIONAL:
69295 This  option  defines  how  Exim  behaves  when  signing a message that
69296 should be signed fails for some reason.  When the expansion evaluates to
69297 either "1" or "true", Exim will defer. Otherwise Exim will send the message
69298 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
69299 variables here.
69300 </para>
69301 <para>
69302 <indexterm role="option">
69303 <primary><option>dkim_sign_headers</option></primary>
69304 </indexterm>
69305 </para>
69306 <informaltable frame="all">
69307 <tgroup cols="4" colsep="0" rowsep="0">
69308 <colspec colwidth="8*" align="left"/>
69309 <colspec colwidth="6*" align="center"/>
69310 <colspec colwidth="6*" align="center"/>
69311 <colspec colwidth="6*" align="right"/>
69312 <tbody>
69313 <row>
69314 <entry><option>dkim_sign_headers</option></entry>
69315 <entry>Use: <emphasis>smtp</emphasis></entry>
69316 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69317 <entry>Default: <emphasis>unset</emphasis></entry>
69318 </row>
69319 </tbody>
69320 </tgroup>
69321 </informaltable>
69322 <para>
69323 OPTIONAL:
69324 When set, this option must expand to (or be specified as) a colon-separated
69325 list of header names. Headers with these names will be included in the message
69326 signature. When unspecified, the header names recommended in RFC4871 will be
69327 used.
69328 </para>
69329 </section>
69330 <section id="SECID514">
69331 <title>Verifying DKIM signatures in incoming mail</title>
69332 <para>
69333 <indexterm role="concept">
69334 <primary>DKIM</primary>
69335 <secondary>verification</secondary>
69336 </indexterm>
69337 </para>
69338 <para>
69339 Verification of DKIM signatures in SMTP incoming email is implemented via the
69340 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
69341 syntactically(!) correct signature in the incoming message.
69342 A missing ACL definition defaults to accept.
69343 If any ACL call does not accept, the message is not accepted.
69344 If a cutthrough delivery was in progress for the message it is
69345 summarily dropped (having wasted the transmission effort).
69346 </para>
69347 <para>
69348 To evaluate the signature in the ACL a large number of expansion variables
69349 containing the signature status and its details are set up during the
69350 runtime of the ACL.
69351 </para>
69352 <para>
69353 Calling the ACL only for existing signatures is not sufficient to build
69354 more advanced policies. For that reason, the global option
69355 <option>dkim_verify_signers</option>, and a global expansion variable
69356 <option>$dkim_signers</option> exist.
69357 </para>
69358 <para>
69359 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
69360 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
69361 called. It is expanded when the message has been received. At this point,
69362 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
69363 list of signer domains and identities for the message. When
69364 <option>dkim_verify_signers</option> is not specified in the main configuration,
69365 it defaults as:
69366 </para>
69367 <literallayout class="monospaced">
69368 dkim_verify_signers = $dkim_signers
69369 </literallayout>
69370 <para>
69371 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
69372 DKIM signature in the message. Current DKIM verifiers may want to explicitly
69373 call the ACL for known domains or identities. This would be achieved as follows:
69374 </para>
69375 <literallayout class="monospaced">
69376 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
69377 </literallayout>
69378 <para>
69379 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
69380 and "ebay.com", plus all domains and identities that have signatures in the message.
69381 You can also be more creative in constructing your policy. For example:
69382 </para>
69383 <literallayout class="monospaced">
69384 dkim_verify_signers = $sender_address_domain:$dkim_signers
69385 </literallayout>
69386 <para>
69387 If a domain or identity is listed several times in the (expanded) value of
69388 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
69389 </para>
69390 <para>
69391 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
69392 available (from most to least important):
69393 </para>
69394 <variablelist>
69395 <varlistentry>
69396 <term><option>$dkim_cur_signer</option></term>
69397 <listitem>
69398 <para>
69399 The signer that is being evaluated in this ACL run. This can be a domain or
69400 an identity. This is one of the list items from the expanded main option
69401 <option>dkim_verify_signers</option> (see above).
69402 </para>
69403 </listitem></varlistentry>
69404 <varlistentry>
69405 <term><option>$dkim_verify_status</option></term>
69406 <listitem>
69407 <para>
69408 A string describing the general status of the signature. One of
69409 </para>
69410 <itemizedlist>
69411 <listitem>
69412 <para>
69413 <option>none</option>: There is no signature in the message for the current domain or
69414 identity (as reflected by <option>$dkim_cur_signer</option>).
69415 </para>
69416 </listitem>
69417 <listitem>
69418 <para>
69419 <option>invalid</option>: The signature could not be verified due to a processing error.
69420 More detail is available in <option>$dkim_verify_reason</option>.
69421 </para>
69422 </listitem>
69423 <listitem>
69424 <para>
69425 <option>fail</option>: Verification of the signature failed.  More detail is
69426 available in <option>$dkim_verify_reason</option>.
69427 </para>
69428 </listitem>
69429 <listitem>
69430 <para>
69431 <option>pass</option>: The signature passed verification. It is valid.
69432 </para>
69433 </listitem>
69434 </itemizedlist>
69435 </listitem></varlistentry>
69436 <varlistentry>
69437 <term><option>$dkim_verify_reason</option></term>
69438 <listitem>
69439 <para>
69440 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
69441 "fail" or "invalid". One of
69442 </para>
69443 <itemizedlist>
69444 <listitem>
69445 <para>
69446 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
69447 key for the domain could not be retrieved. This may be a temporary problem.
69448 </para>
69449 </listitem>
69450 <listitem>
69451 <para>
69452 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
69453 record for the domain is syntactically invalid.
69454 </para>
69455 </listitem>
69456 <listitem>
69457 <para>
69458 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
69459 body hash does not match the one specified in the signature header. This
69460 means that the message body was modified in transit.
69461 </para>
69462 </listitem>
69463 <listitem>
69464 <para>
69465 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
69466 could not be verified. This may mean that headers were modified,
69467 re-written or otherwise changed in a way which is incompatible with
69468 DKIM verification. It may of course also mean that the signature is forged.
69469 </para>
69470 </listitem>
69471 </itemizedlist>
69472 </listitem></varlistentry>
69473 <varlistentry>
69474 <term><option>$dkim_domain</option></term>
69475 <listitem>
69476 <para>
69477 The signing domain. IMPORTANT: This variable is only populated if there is
69478 an actual signature in the message for the current domain or identity (as
69479 reflected by <option>$dkim_cur_signer</option>).
69480 </para>
69481 </listitem></varlistentry>
69482 <varlistentry>
69483 <term><option>$dkim_identity</option></term>
69484 <listitem>
69485 <para>
69486 The signing identity, if present. IMPORTANT: This variable is only populated
69487 if there is an actual signature in the message for the current domain or
69488 identity (as reflected by <option>$dkim_cur_signer</option>).
69489 </para>
69490 </listitem></varlistentry>
69491 <varlistentry>
69492 <term><option>$dkim_selector</option></term>
69493 <listitem>
69494 <para>
69495 The key record selector string.
69496 </para>
69497 </listitem></varlistentry>
69498 <varlistentry>
69499 <term><option>$dkim_algo</option></term>
69500 <listitem>
69501 <para>
69502 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
69503 </para>
69504 </listitem></varlistentry>
69505 <varlistentry>
69506 <term><option>$dkim_canon_body</option></term>
69507 <listitem>
69508 <para>
69509 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69510 </para>
69511 </listitem></varlistentry>
69512 <varlistentry>
69513 <term><option>dkim_canon_headers</option></term>
69514 <listitem>
69515 <para>
69516 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69517 </para>
69518 </listitem></varlistentry>
69519 <varlistentry>
69520 <term><option>$dkim_copiedheaders</option></term>
69521 <listitem>
69522 <para>
69523 A transcript of headers and their values which are included in the signature
69524 (copied from the &#x2019;z=&#x2019; tag of the signature).
69525 Note that RFC6376 requires that verification fail if the From: header is
69526 not included in the signature.  Exim does not enforce this; sites wishing
69527 strict enforcement should code the check explicitly.
69528 </para>
69529 </listitem></varlistentry>
69530 <varlistentry>
69531 <term><option>$dkim_bodylength</option></term>
69532 <listitem>
69533 <para>
69534 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
69535 limit was set by the signer, "9999999999999" is returned. This makes sure
69536 that this variable always expands to an integer value.
69537 </para>
69538 </listitem></varlistentry>
69539 <varlistentry>
69540 <term><option>$dkim_created</option></term>
69541 <listitem>
69542 <para>
69543 UNIX timestamp reflecting the date and time when the signature was created.
69544 When this was not specified by the signer, "0" is returned.
69545 </para>
69546 </listitem></varlistentry>
69547 <varlistentry>
69548 <term><option>$dkim_expires</option></term>
69549 <listitem>
69550 <para>
69551 UNIX timestamp reflecting the date and time when the signer wants the
69552 signature to be treated as "expired". When this was not specified by the
69553 signer, "9999999999999" is returned. This makes it possible to do useful
69554 integer size comparisons against this value.
69555 </para>
69556 </listitem></varlistentry>
69557 <varlistentry>
69558 <term><option>$dkim_headernames</option></term>
69559 <listitem>
69560 <para>
69561 A colon-separated list of names of headers included in the signature.
69562 </para>
69563 </listitem></varlistentry>
69564 <varlistentry>
69565 <term><option>$dkim_key_testing</option></term>
69566 <listitem>
69567 <para>
69568 "1" if the key record has the "testing" flag set, "0" if not.
69569 </para>
69570 </listitem></varlistentry>
69571 <varlistentry>
69572 <term><option>$dkim_key_nosubdomains</option></term>
69573 <listitem>
69574 <para>
69575 "1" if the key record forbids subdomaining, "0" otherwise.
69576 </para>
69577 </listitem></varlistentry>
69578 <varlistentry>
69579 <term><option>$dkim_key_srvtype</option></term>
69580 <listitem>
69581 <para>
69582 Service type (tag s=) from the key record. Defaults to "*" if not specified
69583 in the key record.
69584 </para>
69585 </listitem></varlistentry>
69586 <varlistentry>
69587 <term><option>$dkim_key_granularity</option></term>
69588 <listitem>
69589 <para>
69590 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
69591 in the key record.
69592 </para>
69593 </listitem></varlistentry>
69594 <varlistentry>
69595 <term><option>$dkim_key_notes</option></term>
69596 <listitem>
69597 <para>
69598 Notes from the key record (tag n=).
69599 </para>
69600 </listitem></varlistentry>
69601 <varlistentry>
69602 <term><option>$dkim_key_length</option></term>
69603 <listitem>
69604 <para>
69605 Number of bits in the key.
69606 </para>
69607 </listitem></varlistentry>
69608 </variablelist>
69609 <para>
69610 In addition, two ACL conditions are provided:
69611 </para>
69612 <variablelist>
69613 <varlistentry>
69614 <term><option>dkim_signers</option></term>
69615 <listitem>
69616 <para>
69617 ACL condition that checks a colon-separated list of domains or identities
69618 for a match against the domain or identity that the ACL is currently verifying
69619 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
69620 verb to a group of domains or identities. For example:
69621 </para>
69622 <literallayout class="monospaced">
69623 # Warn when Mail purportedly from GMail has no gmail signature
69624 warn log_message = GMail sender without gmail.com DKIM signature
69625      sender_domains = gmail.com
69626      dkim_signers = gmail.com
69627      dkim_status = none
69628 </literallayout>
69629 <para>
69630 Note that the above does not check for a total lack of DKIM signing;
69631 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
69632 </para>
69633 </listitem></varlistentry>
69634 <varlistentry>
69635 <term><option>dkim_status</option></term>
69636 <listitem>
69637 <para>
69638 ACL condition that checks a colon-separated list of possible DKIM verification
69639 results against the actual result of verification. This is typically used
69640 to restrict an ACL verb to a list of verification outcomes, for example:
69641 </para>
69642 <literallayout class="monospaced">
69643 deny message = Mail from Paypal with invalid/missing signature
69644      sender_domains = paypal.com:paypal.de
69645      dkim_signers = paypal.com:paypal.de
69646      dkim_status = none:invalid:fail
69647 </literallayout>
69648 <para>
69649 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
69650 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
69651 for more information of what they mean.
69652 </para>
69653 </listitem></varlistentry>
69654 </variablelist>
69655 </section>
69656 </chapter>
69657
69658 <chapter id="CHAPproxies">
69659 <title>Proxies</title>
69660 <titleabbrev>Proxy support</titleabbrev>
69661 <para>
69662 <indexterm role="concept">
69663 <primary>proxy support</primary>
69664 </indexterm>
69665 <indexterm role="concept">
69666 <primary>proxy</primary>
69667 <secondary>access via</secondary>
69668 </indexterm>
69669 </para>
69670 <para>
69671 A proxy is an intermediate system through which communication is passed.
69672 Proxies may provide a security, availability or load-distribution function.
69673 </para>
69674 <section id="SECTproxyInbound">
69675 <title>Inbound proxies</title>
69676 <para>
69677 <indexterm role="concept">
69678 <primary>proxy</primary>
69679 <secondary>inbound</secondary>
69680 </indexterm>
69681 <indexterm role="concept">
69682 <primary>proxy</primary>
69683 <secondary>server side</secondary>
69684 </indexterm>
69685 <indexterm role="concept">
69686 <primary>proxy</primary>
69687 <secondary>Proxy protocol</secondary>
69688 </indexterm>
69689 <indexterm role="concept">
69690 <primary>Proxy protocol</primary>
69691 <secondary>proxy</secondary>
69692 </indexterm>
69693 </para>
69694 <para>
69695 Exim has support for receiving inbound SMTP connections via a proxy
69696 that uses <quote>Proxy Protocol</quote> to speak to it.
69697 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
69698 in Local/Makefile.
69699 </para>
69700 <para>
69701 It was built on specifications from:
69702 (<emphasis role="bold"><ulink url="http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt">http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt</ulink></emphasis>).
69703 That URL was revised in May 2014 to version 2 spec:
69704 (<emphasis role="bold"><ulink url="http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e">http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e</ulink></emphasis>).
69705 </para>
69706 <para>
69707 The purpose of this facility is so that an application load balancer,
69708 such as HAProxy, can sit in front of several Exim servers
69709 to distribute load.
69710 Exim uses the local protocol communication with the proxy to obtain
69711 the remote SMTP system IP address and port information.
69712 There is no logging if a host passes or
69713 fails Proxy Protocol negotiation, but it can easily be determined and
69714 recorded in an ACL (example is below).
69715 </para>
69716 <para>
69717 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
69718 main configuration option to a hostlist; connections from these
69719 hosts will use Proxy Protocol.
69720 Exim supports both version 1 and version 2 of the Proxy Protocol and
69721 automatically determines which version is in use.
69722 </para>
69723 <para>
69724 The Proxy Protocol header is the first data received on a TCP connection
69725 and is inserted before any TLS-on-connect handshake from the client; Exim
69726 negotiates TLS between Exim-as-server and the remote client, not between
69727 Exim and the proxy server.
69728 </para>
69729 <para>
69730 The following expansion variables are usable
69731 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
69732 of the proxy):
69733 </para>
69734 <literallayout>
69735 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
69736 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
69737 <emphasis>proxy_local_address </emphasis> IP of proxy server inbound or IP of local interface of proxy
69738 <emphasis>proxy_local_port    </emphasis> Port of proxy server inbound or Port on local interface of proxy
69739 <emphasis>proxy_session        </emphasis> boolean: SMTP connection via proxy
69740 </literallayout>
69741 <para>
69742 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
69743 there was a protocol error.
69744 </para>
69745 <para>
69746 Since the real connections are all coming from the proxy, and the
69747 per host connection tracking is done before Proxy Protocol is
69748 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
69749 handle all of the parallel volume you expect per inbound proxy.
69750 With the option set so high, you lose the ability
69751 to protect your server from many connections from one IP.
69752 In order to prevent your server from overload, you
69753 need to add a per connection ratelimit to your connect ACL.
69754 A possible solution is:
69755 </para>
69756 <literallayout>
69757   # Set max number of connections per host
69758   LIMIT   = 5
69759   # Or do some kind of IP lookup in a flat file or database
69760   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
69761
69762   defer   message        = Too many connections from this IP right now
69763           ratelimit      = LIMIT / 5s / per_conn / strict
69764 </literallayout>
69765 </section>
69766 <section id="SECTproxySOCKS">
69767 <title>Outbound proxies</title>
69768 <para>
69769 <indexterm role="concept">
69770 <primary>proxy</primary>
69771 <secondary>outbound</secondary>
69772 </indexterm>
69773 <indexterm role="concept">
69774 <primary>proxy</primary>
69775 <secondary>client side</secondary>
69776 </indexterm>
69777 <indexterm role="concept">
69778 <primary>proxy</primary>
69779 <secondary>SOCKS</secondary>
69780 </indexterm>
69781 <indexterm role="concept">
69782 <primary>SOCKS</primary>
69783 <secondary>proxy</secondary>
69784 </indexterm>
69785 Exim has support for sending outbound SMTP via a proxy
69786 using a protocol called SOCKS5 (defined by RFC1928).
69787 The support can be optionally included by defining SUPPORT_SOCKS=yes in
69788 Local/Makefile.
69789 </para>
69790 <para>
69791 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
69792 on an smtp transport.
69793 The option value is expanded and should then be a list
69794 (colon-separated by default) of proxy specifiers.
69795 Each proxy specifier is a list
69796 (space-separated by default) where the initial element
69797 is an IP address and any subsequent elements are options.
69798 </para>
69799 <para>
69800 Options are a string &lt;name&gt;=&lt;value&gt;.
69801 The list of options is in the following table:
69802 </para>
69803 <literallayout>
69804 <emphasis>auth   </emphasis> authentication method
69805 <emphasis>name   </emphasis> authentication username
69806 <emphasis>pass   </emphasis> authentication password
69807 <emphasis>port   </emphasis> tcp port
69808 <emphasis>tmo    </emphasis> connection timeout
69809 <emphasis>pri    </emphasis> priority
69810 <emphasis>weight </emphasis> selection bias
69811 </literallayout>
69812 <para>
69813 More details on each of these options follows:
69814 </para>
69815 <itemizedlist>
69816 <listitem>
69817 <para>
69818 <indexterm role="concept">
69819 <primary>authentication</primary>
69820 <secondary>to proxy</secondary>
69821 </indexterm>
69822 <indexterm role="concept">
69823 <primary>proxy</primary>
69824 <secondary>authentication</secondary>
69825 </indexterm>
69826 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
69827 Using <quote>name</quote> selects username/password authentication per RFC 1929
69828 for access to the proxy.
69829 Default is <quote>none</quote>.
69830 </para>
69831 </listitem>
69832 <listitem>
69833 <para>
69834 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
69835 Default is empty.
69836 </para>
69837 </listitem>
69838 <listitem>
69839 <para>
69840 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
69841 Default is empty.
69842 </para>
69843 </listitem>
69844 <listitem>
69845 <para>
69846 <option>port</option>: the TCP port number to use for the connection to the proxy.
69847 Default is 1080.
69848 </para>
69849 </listitem>
69850 <listitem>
69851 <para>
69852 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
69853 Default is 5.
69854 </para>
69855 </listitem>
69856 <listitem>
69857 <para>
69858 <option>pri</option>: specifies a priority for the proxy within the list,
69859 higher values being tried first.
69860 The default priority is 1.
69861 </para>
69862 </listitem>
69863 <listitem>
69864 <para>
69865 <option>weight</option>: specifies a selection bias.
69866 Within a priority set servers are queried in a random fashion,
69867 weighted by this value.
69868 The default value for selection bias is 1.
69869 </para>
69870 </listitem>
69871 </itemizedlist>
69872 <para>
69873 Proxies from the list are tried according to their priority
69874 and weight settings until one responds.  The timeout for the
69875 overall connection applies to the set of proxied attempts.
69876 </para>
69877 </section>
69878 <section id="SECTproxyLog">
69879 <title>Logging</title>
69880 <para>
69881 To log the (local) IP of a proxy in the incoming or delivery logline,
69882 add <quote>+proxy</quote> to the <option>log_selector</option> option.
69883 This will add a component tagged with <quote>PRX=</quote> to the line.
69884 </para>
69885 </section>
69886 </chapter>
69887
69888 <chapter id="CHAPi18n">
69889 <title>Internationalisation</title>
69890 <titleabbrev>Internationalisation"</titleabbrev>
69891 <para>
69892 <indexterm role="concept">
69893 <primary>internationalisation</primary>
69894 <secondary>email address</secondary>
69895 </indexterm>
69896 <indexterm role="concept">
69897 <primary>EAI</primary>
69898 </indexterm>
69899 <indexterm role="concept">
69900 <primary>i18n</primary>
69901 </indexterm>
69902 <indexterm role="concept">
69903 <primary>UTF-8</primary>
69904 <secondary>mail name handling</secondary>
69905 </indexterm>
69906 </para>
69907 <para>
69908 Exim has support for Internationalised mail names.
69909 To include this it must be built with SUPPORT_I18N and the libidn library.
69910 Standards supported are RFCs 2060, 5890, 6530 and 6533.
69911 </para>
69912 <para revisionflag="changed">
69913 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
69914 instead of it) then IDNA2008 is supported; this adds an extra library
69915 requirement, upon libidn2.
69916 </para>
69917 <section id="SECTi18nMTA">
69918 <title>MTA operations</title>
69919 <para>
69920 <indexterm role="concept">
69921 <primary>SMTPUTF8</primary>
69922 <secondary>ESMTP option</secondary>
69923 </indexterm>
69924 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
69925 a host list.  If this matches the sending host and
69926 accept_8bitmime is true (the default) then the ESMTP option
69927 SMTPUTF8 will be advertised.
69928 </para>
69929 <para>
69930 If the sender specifies the SMTPUTF8 option on a MAIL command
69931 international handling for the message is enabled and
69932 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
69933 </para>
69934 <para>
69935 The option <option>allow_utf8_domains</option> is set to true for this
69936 message. All DNS lookups are converted to a-label form
69937 whatever the setting of <option>allow_utf8_domains</option>
69938 when Exim is built with SUPPORT_I18N.
69939 </para>
69940 <para>
69941 Both localparts and domain are maintained as the original
69942 UTF-8 form internally; any comparison or regular-expression use will
69943 require appropriate care.  Filenames created, eg. by
69944 the appendfile transport, will have UTF-8 names.
69945 </para>
69946 <para>
69947 HELO names sent by the smtp transport will have any UTF-8
69948 components expanded to a-label form,
69949 and any certificate name checks will be done using the a-label
69950 form of the name.
69951 </para>
69952 <para>
69953 <indexterm role="concept">
69954 <primary>log</primary>
69955 <secondary>protocol</secondary>
69956 </indexterm>
69957 <indexterm role="concept">
69958 <primary>SMTPUTF8</primary>
69959 <secondary>logging</secondary>
69960 </indexterm>
69961 Log lines and Received-by: header lines will acquire a "utf8"
69962 prefix on the protocol element, eg. utf8esmtp.
69963 </para>
69964 <para>
69965 The following expansion operators can be used:
69966 </para>
69967 <literallayout class="monospaced">
69968 ${utf8_domain_to_alabel:str}
69969 ${utf8_domain_from_alabel:str}
69970 ${utf8_localpart_to_alabel:str}
69971 ${utf8_localpart_from_alabel:str}
69972 </literallayout>
69973 <para>
69974 ACLs may use the following modifier:
69975 </para>
69976 <literallayout>
69977 control = utf8_downconvert
69978 control = utf8_downconvert/&lt;value&gt;
69979 </literallayout>
69980 <para>
69981 This sets a flag requiring that addresses are converted to
69982 a-label form before smtp delivery, for use in a
69983 Message Submission Agent context.
69984 If a value is appended it may be:
69985 </para>
69986 <literallayout>
69987 <literal>1  </literal> (default) mandatory downconversion
69988 <literal>0  </literal> no downconversion
69989 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
69990 </literallayout>
69991 <para>
69992 If mua_wrapper is set, the utf8_downconvert control
69993 is initially set to -1.
69994 </para>
69995 <para>
69996 There is no explicit support for VRFY and EXPN.
69997 Configurations supporting these should inspect
69998 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
69999 </para>
70000 <para>
70001 There is no support for LMTP on Unix sockets.
70002 Using the "lmtp" protocol option on an smtp transport,
70003 for LMTP over TCP, should work as expected.
70004 </para>
70005 <para>
70006 There is no support for DSN unitext handling,
70007 and no provision for converting logging from or to UTF-8.
70008 </para>
70009 </section>
70010 <section id="SECTi18nMDA">
70011 <title>MDA operations</title>
70012 <para>
70013 To aid in constructing names suitable for IMAP folders
70014 the following expansion operator can be used:
70015 </para>
70016 <literallayout class="monospaced">
70017 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
70018 </literallayout>
70019 <para>
70020 The string is converted from the charset specified by
70021 the "headers charset" command (in a filter file)
70022 or <option>headers_charset</option> main configuration option (otherwise),
70023 to the
70024 modified UTF-7 encoding specified by RFC 2060,
70025 with the following exception: All occurences of &lt;sep&gt;
70026 (which has to be a single character)
70027 are replaced with periods ("."), and all periods and slashes that are not
70028 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
70029 </para>
70030 <para>
70031 The third argument can be omitted, defaulting to an empty string.
70032 The second argument can be omitted, defaulting to "/".
70033 </para>
70034 <para>
70035 This is the encoding used by Courier for Maildir names on disk, and followed
70036 by many other IMAP servers.
70037 </para>
70038 <para>
70039 Examples:
70040 </para>
70041 <literallayout>
70042 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
70043 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
70044 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
70045 </literallayout>
70046 <para>
70047 Note that the source charset setting is vital, and also that characters
70048 must be representable in UTF-16.
70049 </para>
70050 </section>
70051 </chapter>
70052
70053 <chapter id="CHAPevents">
70054 <title>Events</title>
70055 <titleabbrev>Events</titleabbrev>
70056 <para>
70057 <indexterm role="concept">
70058 <primary>events</primary>
70059 </indexterm>
70060 </para>
70061 <para>
70062 The events mechanism in Exim can be used to intercept processing at a number
70063 of points.  It was originally invented to give a way to do customised logging
70064 actions (for example, to a database) but can also be used to modify some
70065 processing actions.
70066 </para>
70067 <para>
70068 Most installations will never need to use Events.
70069 The support can be left out of a build by defining DISABLE_EVENT=yes
70070 in <filename>Local/Makefile</filename>.
70071 </para>
70072 <para>
70073 There are two major classes of events: main and transport.
70074 The main configuration option <option>event_action</option> controls reception events;
70075 a transport option <option>event_action</option> controls delivery events.
70076 </para>
70077 <para>
70078 Both options are a string which is expanded when the event fires.
70079 An example might look like:
70080 <indexterm role="concept">
70081 <primary>logging</primary>
70082 <secondary>custom</secondary>
70083 </indexterm>
70084 </para>
70085 <literallayout class="monospaced">
70086 event_action = ${if eq {msg:delivery}{$event_name} \
70087 {${lookup pgsql {SELECT * FROM record_Delivery( \
70088     '${quote_pgsql:$sender_address_domain}',\
70089     '${quote_pgsql:${lc:$sender_address_local_part}}', \
70090     '${quote_pgsql:$domain}', \
70091     '${quote_pgsql:${lc:$local_part}}', \
70092     '${quote_pgsql:$host_address}', \
70093     '${quote_pgsql:${lc:$host}}', \
70094     '${quote_pgsql:$message_exim_id}')}} \
70095 } {}}
70096 </literallayout>
70097 <para>
70098 Events have names which correspond to the point in process at which they fire.
70099 The name is placed in the variable <varname>$event_name</varname> and the event action
70100 expansion must check this, as it will be called for every possible event type.
70101 </para>
70102 <para>
70103 The current list of events is:
70104 </para>
70105 <literallayout>
70106 <literal>msg:complete           after    main       </literal> per message
70107 <literal>msg:delivery           after    transport  </literal> per recipient
70108 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
70109 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
70110 <literal>msg:host:defer         after    transport  </literal> per attempt
70111 <literal>msg:fail:delivery      after    main       </literal> per recipient
70112 <literal>msg:fail:internal      after    main       </literal> per recipient
70113 <literal>tcp:connect            before   transport  </literal> per connection
70114 <literal>tcp:close              after    transport  </literal> per connection
70115 <literal>tls:cert               before   both       </literal> per certificate in verification chain
70116 <literal>smtp:connect           after    transport  </literal> per connection
70117 </literallayout>
70118 <para>
70119 New event types may be added in future.
70120 </para>
70121 <para>
70122 The event name is a colon-separated list, defining the type of
70123 event in a tree of possibilities.  It may be used as a list
70124 or just matched on as a whole.  There will be no spaces in the name.
70125 </para>
70126 <para>
70127 The second column in the table above describes whether the event fires
70128 before or after the action is associates with.  Those which fire before
70129 can be used to affect that action (more on this below).
70130 </para>
70131 <para>
70132 An additional variable, <varname>$event_data</varname>, is filled with information varying
70133 with the event type:
70134 </para>
70135 <literallayout>
70136 <literal>msg:delivery         </literal> smtp confirmation message
70137 <literal>msg:rcpt:host:defer  </literal> error string
70138 <literal>msg:rcpt:defer       </literal> error string
70139 <literal>msg:host:defer       </literal> error string
70140 <literal>tls:cert             </literal> verification chain depth
70141 <literal>smtp:connect         </literal> smtp banner
70142 </literallayout>
70143 <para>
70144 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
70145 </para>
70146 <para>
70147 For complex operations an ACL expansion can be used in <option>event_action</option>
70148 however due to the multiple contexts that Exim operates in during
70149 the course of its processing:
70150 </para>
70151 <itemizedlist>
70152 <listitem>
70153 <para>
70154 variables set in transport events will not be visible outside that
70155 transport call
70156 </para>
70157 </listitem>
70158 <listitem>
70159 <para>
70160 acl_m variables in a server context are lost on a new connection,
70161 and after smtp helo/ehlo/mail/starttls/rset commands
70162 </para>
70163 </listitem>
70164 </itemizedlist>
70165 <para>
70166 Using an ACL expansion with the logwrite modifier can be
70167 a useful way of writing to the main log.
70168 </para>
70169 <para>
70170 The expansion of the event_action option should normally
70171 return an empty string.  Should it return anything else the
70172 following will be forced:
70173 </para>
70174 <literallayout>
70175 <literal>msg:delivery     </literal>  (ignored)
70176 <literal>msg:host:defer   </literal>  (ignored)
70177 <literal>msg:fail:delivery</literal>  (ignored)
70178 <literal>tcp:connect      </literal>  do not connect
70179 <literal>tcp:close        </literal>  (ignored)
70180 <literal>tls:cert         </literal>  refuse verification
70181 <literal>smtp:connect     </literal>  close connection
70182 </literallayout>
70183 <para>
70184 No other use is made of the result string.
70185 </para>
70186 <para>
70187 For a tcp:connect event, if the connection is being made to a proxy
70188 then the address and port variables will be that of the proxy and not
70189 the target system.
70190 </para>
70191 <para>
70192 For tls:cert events, if GnuTLS is in use this will trigger only per
70193 chain element received on the connection.
70194 For OpenSSL it will trigger for every chain element including those
70195 loaded locally.
70196 </para>
70197 </chapter>
70198
70199 <chapter id="CHID13">
70200 <title>Adding new drivers or lookup types</title>
70201 <titleabbrev>Adding drivers or lookups</titleabbrev>
70202 <para>
70203 <indexterm role="concept">
70204 <primary>adding drivers</primary>
70205 </indexterm>
70206 <indexterm role="concept">
70207 <primary>new drivers, adding</primary>
70208 </indexterm>
70209 <indexterm role="concept">
70210 <primary>drivers</primary>
70211 <secondary>adding new</secondary>
70212 </indexterm>
70213 The following actions have to be taken in order to add a new router, transport,
70214 authenticator, or lookup type to Exim:
70215 </para>
70216 <orderedlist numeration="arabic">
70217 <listitem>
70218 <para>
70219 Choose a name for the driver or lookup type that does not conflict with any
70220 existing name; I will use <quote>newdriver</quote> in what follows.
70221 </para>
70222 </listitem>
70223 <listitem>
70224 <para>
70225 Add to <filename>src/EDITME</filename> the line:
70226 </para>
70227 <literallayout>
70228 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
70229 </literallayout>
70230 <para>
70231 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
70232 code is not to be included in the binary by default, comment this line out. You
70233 should also add any relevant comments about the driver or lookup type.
70234 </para>
70235 </listitem>
70236 <listitem>
70237 <para>
70238 Add to <filename>src/config.h.defaults</filename> the line:
70239 </para>
70240 <literallayout class="monospaced">
70241 #define &lt;type&gt;_NEWDRIVER
70242 </literallayout>
70243 </listitem>
70244 <listitem>
70245 <para>
70246 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
70247 and create a table entry as is done for all the other drivers and lookup types.
70248 </para>
70249 </listitem>
70250 <listitem>
70251 <para>
70252 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
70253 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
70254 Add your <literal>NEWDRIVER</literal> to that list.
70255 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
70256 simple form that most lookups have.
70257 </para>
70258 </listitem>
70259 <listitem>
70260 <para>
70261 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
70262 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
70263 driver or lookup type and add it to the definition of OBJ.
70264 </para>
70265 </listitem>
70266 <listitem>
70267 <para>
70268 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
70269 <filename>src</filename>.
70270 </para>
70271 </listitem>
70272 <listitem>
70273 <para>
70274 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
70275 as for other drivers and lookups.
70276 </para>
70277 </listitem>
70278 </orderedlist>
70279 <para>
70280 Then all you need to do is write the code! A good way to start is to make a
70281 proforma by copying an existing module of the same type, globally changing all
70282 occurrences of the name, and cutting out most of the code. Note that any
70283 options you create must be listed in alphabetical order, because the tables are
70284 searched using a binary chop procedure.
70285 </para>
70286 <para>
70287 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
70288 the interface that is expected.
70289 </para>
70290 <?sdop
70291   format="newpage"
70292   foot_right_recto="&chaptertitle;"
70293   foot_right_verso="&chaptertitle;"
70294 ?>
70295 </chapter>
70296
70297 <index role="option">
70298 <title>Options index</title>
70299 </index>
70300
70301 <index role="variable">
70302 <title>Variables index</title>
70303 </index>
70304
70305 <index role="concept">
70306 <title>Concept index</title>
70307 </index>
70308
70309 </book>